Detection (and warning) of char size in bits
[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 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # The metaunits are also available from the public git repository:
23 #     http://perl5.git.perl.org/metaconfig.git/ or
24 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
25 #
26 # See Porting/pumpkin.pod for more information on metaconfig.
27 #
28
29 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
30 #
31 # Generated on Fri Nov  6 07:43:05 CET 2009 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat >&4 <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat >&4 <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 d_atolf=''
336 d_atoll=''
337 baserev=''
338 bin=''
339 binexp=''
340 initialinstalllocation=''
341 installbin=''
342 userelocatableinc=''
343 byteorder=''
344 cc=''
345 ccflags=''
346 cppflags=''
347 ldflags=''
348 lkflags=''
349 locincpth=''
350 optimize=''
351 cf_email=''
352 cf_by=''
353 cf_time=''
354 charbits=''
355 charsize=''
356 contains=''
357 cpp_stuff=''
358 cpplast=''
359 cppminus=''
360 cpprun=''
361 cppstdin=''
362 d__fwalk=''
363 d_access=''
364 d_accessx=''
365 d_aintl=''
366 d_alarm=''
367 asctime_r_proto=''
368 d_asctime_r=''
369 d_attribute_deprecated=''
370 d_attribute_format=''
371 d_attribute_malloc=''
372 d_attribute_nonnull=''
373 d_attribute_noreturn=''
374 d_attribute_pure=''
375 d_attribute_unused=''
376 d_attribute_warn_unused_result=''
377 d_printf_format_null=''
378 d_bcmp=''
379 d_bcopy=''
380 d_builtin_choose_expr=''
381 d_builtin_expect=''
382 d_bzero=''
383 d_c99_variadic_macros=''
384 d_casti32=''
385 castflags=''
386 d_castneg=''
387 d_chown=''
388 d_chroot=''
389 d_chsize=''
390 d_class=''
391 d_clearenv=''
392 d_closedir=''
393 d_void_closedir=''
394 d_cmsghdr_s=''
395 d_const=''
396 d_copysignl=''
397 d_cplusplus=''
398 cryptlib=''
399 d_crypt=''
400 crypt_r_proto=''
401 d_crypt_r=''
402 d_csh=''
403 full_csh=''
404 d_ctermid=''
405 ctermid_r_proto=''
406 d_ctermid_r=''
407 ctime_r_proto=''
408 d_ctime_r=''
409 d_cuserid=''
410 d_dbl_dig=''
411 d_dbminitproto=''
412 d_difftime=''
413 d_dir_dd_fd=''
414 d_dirfd=''
415 d_dlerror=''
416 d_dlopen=''
417 d_dlsymun=''
418 d_dosuid=''
419 d_suidsafe=''
420 d_drand48_r=''
421 drand48_r_proto=''
422 d_drand48proto=''
423 d_dup2=''
424 d_eaccess=''
425 d_endgrent=''
426 d_endgrent_r=''
427 endgrent_r_proto=''
428 d_endhent=''
429 d_endhostent_r=''
430 endhostent_r_proto=''
431 d_endnent=''
432 d_endnetent_r=''
433 endnetent_r_proto=''
434 d_endpent=''
435 d_endprotoent_r=''
436 endprotoent_r_proto=''
437 d_endpwent=''
438 d_endpwent_r=''
439 endpwent_r_proto=''
440 d_endsent=''
441 d_endservent_r=''
442 endservent_r_proto=''
443 d_faststdio=''
444 d_fchdir=''
445 d_fchmod=''
446 d_fchown=''
447 d_fcntl=''
448 d_fcntl_can_lock=''
449 d_fd_macros=''
450 d_fd_set=''
451 d_fds_bits=''
452 d_fgetpos=''
453 d_finite=''
454 d_finitel=''
455 d_flexfnam=''
456 d_flock=''
457 d_flockproto=''
458 d_fork=''
459 d_fp_class=''
460 d_fpclass=''
461 d_fpclassify=''
462 d_fpclassl=''
463 d_fpos64_t=''
464 d_frexpl=''
465 d_fs_data_s=''
466 d_fseeko=''
467 d_fsetpos=''
468 d_fstatfs=''
469 d_fsync=''
470 d_ftello=''
471 d_ftime=''
472 d_gettimeod=''
473 d_futimes=''
474 d_Gconvert=''
475 d_getaddrinfo=''
476 d_getcwd=''
477 d_getespwnam=''
478 d_getfsstat=''
479 d_getgrent=''
480 d_getgrent_r=''
481 getgrent_r_proto=''
482 d_getgrgid_r=''
483 getgrgid_r_proto=''
484 d_getgrnam_r=''
485 getgrnam_r_proto=''
486 d_getgrps=''
487 d_gethbyaddr=''
488 d_gethbyname=''
489 d_gethent=''
490 aphostname=''
491 d_gethname=''
492 d_phostname=''
493 d_uname=''
494 d_gethostbyaddr_r=''
495 gethostbyaddr_r_proto=''
496 d_gethostbyname_r=''
497 gethostbyname_r_proto=''
498 d_gethostent_r=''
499 gethostent_r_proto=''
500 d_gethostprotos=''
501 d_getitimer=''
502 d_getlogin=''
503 d_getlogin_r=''
504 getlogin_r_proto=''
505 d_getmnt=''
506 d_getmntent=''
507 d_getnameinfo=''
508 d_getnbyaddr=''
509 d_getnbyname=''
510 d_getnent=''
511 d_getnetbyaddr_r=''
512 getnetbyaddr_r_proto=''
513 d_getnetbyname_r=''
514 getnetbyname_r_proto=''
515 d_getnetent_r=''
516 getnetent_r_proto=''
517 d_getnetprotos=''
518 d_getpagsz=''
519 d_getpent=''
520 d_getpgid=''
521 d_getpgrp2=''
522 d_bsdgetpgrp=''
523 d_getpgrp=''
524 d_getppid=''
525 d_getprior=''
526 d_getpbyname=''
527 d_getpbynumber=''
528 d_getprotobyname_r=''
529 getprotobyname_r_proto=''
530 d_getprotobynumber_r=''
531 getprotobynumber_r_proto=''
532 d_getprotoent_r=''
533 getprotoent_r_proto=''
534 d_getprotoprotos=''
535 d_getprpwnam=''
536 d_getpwent=''
537 d_getpwent_r=''
538 getpwent_r_proto=''
539 d_getpwnam_r=''
540 getpwnam_r_proto=''
541 d_getpwuid_r=''
542 getpwuid_r_proto=''
543 d_getsent=''
544 d_getservbyname_r=''
545 getservbyname_r_proto=''
546 d_getservbyport_r=''
547 getservbyport_r_proto=''
548 d_getservent_r=''
549 getservent_r_proto=''
550 d_getservprotos=''
551 d_getspnam=''
552 d_getspnam_r=''
553 getspnam_r_proto=''
554 d_getsbyname=''
555 d_getsbyport=''
556 d_gmtime_r=''
557 gmtime_r_proto=''
558 d_gnulibc=''
559 gnulibc_version=''
560 d_hasmntopt=''
561 d_htonl=''
562 d_ilogbl=''
563 d_inetaton=''
564 d_inetntop=''
565 d_inetpton=''
566 d_int64_t=''
567 d_isascii=''
568 d_isfinite=''
569 d_isinf=''
570 d_isnan=''
571 d_isnanl=''
572 d_killpg=''
573 d_lchown=''
574 d_ldbl_dig=''
575 d_libm_lib_version=''
576 d_link=''
577 d_localtime_r=''
578 d_localtime_r_needs_tzset=''
579 localtime_r_proto=''
580 d_locconv=''
581 d_lockf=''
582 d_longdbl=''
583 longdblsize=''
584 d_longlong=''
585 longlongsize=''
586 d_lseekproto=''
587 d_lstat=''
588 d_madvise=''
589 d_malloc_good_size=''
590 d_malloc_size=''
591 d_mblen=''
592 d_mbstowcs=''
593 d_mbtowc=''
594 d_memchr=''
595 d_memcmp=''
596 d_memcpy=''
597 d_memmove=''
598 d_memset=''
599 d_mkdir=''
600 d_mkdtemp=''
601 d_mkfifo=''
602 d_mkstemp=''
603 d_mkstemps=''
604 d_mktime=''
605 d_mmap=''
606 mmaptype=''
607 d_modfl=''
608 d_modfl_pow32_bug=''
609 d_modflproto=''
610 d_mprotect=''
611 d_msg=''
612 d_msgctl=''
613 d_msgget=''
614 d_msghdr_s=''
615 d_msgrcv=''
616 d_msgsnd=''
617 d_msync=''
618 d_munmap=''
619 d_nice=''
620 d_nl_langinfo=''
621 d_off64_t=''
622 d_open3=''
623 d_fpathconf=''
624 d_pathconf=''
625 d_pause=''
626 d_pipe=''
627 d_poll=''
628 d_portable=''
629 d_procselfexe=''
630 procselfexe=''
631 d_old_pthread_create_joinable=''
632 old_pthread_create_joinable=''
633 d_pthread_atfork=''
634 d_pthread_attr_setscope=''
635 d_pthread_yield=''
636 d_sched_yield=''
637 sched_yield=''
638 d_qgcvt=''
639 d_random_r=''
640 random_r_proto=''
641 d_readdir64_r=''
642 readdir64_r_proto=''
643 d_readdir=''
644 d_rewinddir=''
645 d_seekdir=''
646 d_telldir=''
647 d_readdir_r=''
648 readdir_r_proto=''
649 d_readlink=''
650 d_readv=''
651 d_recvmsg=''
652 d_rename=''
653 d_rmdir=''
654 d_safebcpy=''
655 d_safemcpy=''
656 d_sanemcmp=''
657 d_sbrkproto=''
658 d_scalbnl=''
659 d_select=''
660 d_sem=''
661 d_semctl=''
662 d_semget=''
663 d_semop=''
664 d_sendmsg=''
665 d_setegid=''
666 d_seteuid=''
667 d_setgrent=''
668 d_setgrent_r=''
669 setgrent_r_proto=''
670 d_setgrps=''
671 d_sethent=''
672 d_sethostent_r=''
673 sethostent_r_proto=''
674 d_setitimer=''
675 d_setlinebuf=''
676 d_setlocale=''
677 d_setlocale_r=''
678 setlocale_r_proto=''
679 d_setnent=''
680 d_setnetent_r=''
681 setnetent_r_proto=''
682 d_setpent=''
683 d_setpgid=''
684 d_setpgrp2=''
685 d_bsdsetpgrp=''
686 d_setpgrp=''
687 d_setprior=''
688 d_setproctitle=''
689 d_setprotoent_r=''
690 setprotoent_r_proto=''
691 d_setpwent=''
692 d_setpwent_r=''
693 setpwent_r_proto=''
694 d_setregid=''
695 d_setresgid=''
696 d_setresuid=''
697 d_setreuid=''
698 d_setrgid=''
699 d_setruid=''
700 d_setsent=''
701 d_setservent_r=''
702 setservent_r_proto=''
703 d_setsid=''
704 d_setvbuf=''
705 d_sfio=''
706 usesfio=''
707 d_shm=''
708 d_shmat=''
709 d_shmatprototype=''
710 shmattype=''
711 d_shmctl=''
712 d_shmdt=''
713 d_shmget=''
714 d_sigaction=''
715 d_signbit=''
716 d_sigprocmask=''
717 d_sigsetjmp=''
718 usesitecustomize=''
719 d_snprintf=''
720 d_vsnprintf=''
721 d_sockatmark=''
722 d_sockatmarkproto=''
723 d_msg_ctrunc=''
724 d_msg_dontroute=''
725 d_msg_oob=''
726 d_msg_peek=''
727 d_msg_proxy=''
728 d_oldsock=''
729 d_scm_rights=''
730 d_socket=''
731 d_sockpair=''
732 sockethdr=''
733 socketlib=''
734 d_socklen_t=''
735 d_socks5_init=''
736 d_sprintf_returns_strlen=''
737 d_sqrtl=''
738 d_srand48_r=''
739 srand48_r_proto=''
740 d_srandom_r=''
741 srandom_r_proto=''
742 d_sresgproto=''
743 d_sresuproto=''
744 d_statblks=''
745 d_statfs_f_flags=''
746 d_statfs_s=''
747 d_fstatvfs=''
748 d_statvfs=''
749 d_stdio_cnt_lval=''
750 d_stdio_ptr_lval=''
751 d_stdio_ptr_lval_nochange_cnt=''
752 d_stdio_ptr_lval_sets_cnt=''
753 d_stdiobase=''
754 d_stdstdio=''
755 stdio_base=''
756 stdio_bufsiz=''
757 stdio_cnt=''
758 stdio_filbuf=''
759 stdio_ptr=''
760 d_index=''
761 d_strchr=''
762 d_strcoll=''
763 d_strctcpy=''
764 d_strerrm=''
765 d_strerror=''
766 d_sysernlst=''
767 d_syserrlst=''
768 d_strerror_r=''
769 strerror_r_proto=''
770 d_strftime=''
771 d_strlcat=''
772 d_strlcpy=''
773 d_strtod=''
774 d_strtol=''
775 d_strtold=''
776 d_strtoll=''
777 d_strtoq=''
778 d_strtoul=''
779 d_strtoull=''
780 d_strtouq=''
781 d_strxfrm=''
782 d_symlink=''
783 d_syscall=''
784 d_syscallproto=''
785 d_sysconf=''
786 d_system=''
787 d_tcgetpgrp=''
788 d_tcsetpgrp=''
789 d_telldirproto=''
790 d_time=''
791 timetype=''
792 d_asctime64=''
793 d_ctime64=''
794 d_difftime64=''
795 d_gmtime64=''
796 d_localtime64=''
797 d_mktime64=''
798 d_timegm=''
799 clocktype=''
800 d_times=''
801 d_tmpnam_r=''
802 tmpnam_r_proto=''
803 d_truncate=''
804 d_ttyname_r=''
805 ttyname_r_proto=''
806 d_tzname=''
807 d_u32align=''
808 d_ualarm=''
809 d_umask=''
810 d_semctl_semid_ds=''
811 d_semctl_semun=''
812 d_union_semun=''
813 d_unordered=''
814 d_unsetenv=''
815 d_usleep=''
816 d_usleepproto=''
817 d_ustat=''
818 d_pseudofork=''
819 d_vfork=''
820 usevfork=''
821 d_voidsig=''
822 signal_t=''
823 d_volatile=''
824 d_charvspr=''
825 d_vprintf=''
826 d_wait4=''
827 d_waitpid=''
828 d_wcstombs=''
829 d_wctomb=''
830 d_writev=''
831 dlext=''
832 bin_ELF=''
833 cccdlflags=''
834 ccdlflags=''
835 dlsrc=''
836 ld=''
837 lddlflags=''
838 usedl=''
839 doublesize=''
840 ebcdic=''
841 fflushNULL=''
842 fflushall=''
843 fpossize=''
844 fpostype=''
845 gccansipedantic=''
846 gccosandvers=''
847 gccversion=''
848 gidformat=''
849 gidsign=''
850 gidsize=''
851 gidtype=''
852 groupstype=''
853 h_fcntl=''
854 h_sysfile=''
855 html1dir=''
856 html1direxp=''
857 installhtml1dir=''
858 html3dir=''
859 html3direxp=''
860 installhtml3dir=''
861 i_arpainet=''
862 i_assert=''
863 i_crypt=''
864 db_hashtype=''
865 db_prefixtype=''
866 db_version_major=''
867 db_version_minor=''
868 db_version_patch=''
869 i_db=''
870 i_dbm=''
871 i_rpcsvcdbm=''
872 d_dirnamlen=''
873 direntrytype=''
874 i_dirent=''
875 i_dld=''
876 i_dlfcn=''
877 i_fcntl=''
878 i_float=''
879 i_fp=''
880 i_fp_class=''
881 i_gdbm=''
882 d_grpasswd=''
883 i_grp=''
884 i_ieeefp=''
885 i_inttypes=''
886 i_langinfo=''
887 i_libutil=''
888 i_limits=''
889 i_locale=''
890 i_machcthr=''
891 i_malloc=''
892 i_mallocmalloc=''
893 i_math=''
894 i_memory=''
895 i_mntent=''
896 d_gdbm_ndbm_h_uses_prototypes=''
897 d_gdbmndbm_h_uses_prototypes=''
898 d_ndbm=''
899 d_ndbm_h_uses_prototypes=''
900 i_gdbm_ndbm=''
901 i_gdbmndbm=''
902 i_ndbm=''
903 i_netdb=''
904 i_neterrno=''
905 i_netinettcp=''
906 i_niin=''
907 i_sysin=''
908 i_poll=''
909 i_prot=''
910 i_pthread=''
911 d_pwage=''
912 d_pwchange=''
913 d_pwclass=''
914 d_pwcomment=''
915 d_pwexpire=''
916 d_pwgecos=''
917 d_pwpasswd=''
918 d_pwquota=''
919 i_pwd=''
920 i_sfio=''
921 i_shadow=''
922 i_socks=''
923 i_stddef=''
924 i_stdlib=''
925 i_string=''
926 strings=''
927 i_sunmath=''
928 i_sysaccess=''
929 i_sysdir=''
930 i_sysfile=''
931 d_voidtty=''
932 i_bsdioctl=''
933 i_sysfilio=''
934 i_sysioctl=''
935 i_syssockio=''
936 i_syslog=''
937 i_sysmman=''
938 i_sysmode=''
939 i_sysmount=''
940 i_sysndir=''
941 i_sysparam=''
942 i_syspoll=''
943 i_sysresrc=''
944 i_syssecrt=''
945 i_sysselct=''
946 i_sysstat=''
947 i_sysstatfs=''
948 i_sysstatvfs=''
949 i_systimes=''
950 i_systypes=''
951 i_sysuio=''
952 i_sysun=''
953 i_sysutsname=''
954 i_sysvfs=''
955 i_syswait=''
956 i_sgtty=''
957 i_termio=''
958 i_termios=''
959 d_tm_tm_gmtoff=''
960 d_tm_tm_zone=''
961 i_systime=''
962 i_systimek=''
963 i_time=''
964 timeincl=''
965 i_unistd=''
966 i_ustat=''
967 i_utime=''
968 i_values=''
969 i_stdarg=''
970 i_varargs=''
971 i_varhdr=''
972 i_vfork=''
973 d_inc_version_list=''
974 inc_version_list=''
975 inc_version_list_init=''
976 installprefix=''
977 installprefixexp=''
978 installstyle=''
979 installusrbinperl=''
980 intsize=''
981 longsize=''
982 shortsize=''
983 issymlink=''
984 libc=''
985 ldlibpthname=''
986 libperl=''
987 shrpenv=''
988 useshrplib=''
989 glibpth=''
990 libpth=''
991 loclibpth=''
992 plibpth=''
993 xlibpth=''
994 ignore_versioned_solibs=''
995 libs=''
996 libsdirs=''
997 libsfiles=''
998 libsfound=''
999 libspath=''
1000 lns=''
1001 d_PRIEUldbl=''
1002 d_PRIFUldbl=''
1003 d_PRIGUldbl=''
1004 d_PRIeldbl=''
1005 d_PRIfldbl=''
1006 d_PRIgldbl=''
1007 d_SCNfldbl=''
1008 sPRIEUldbl=''
1009 sPRIFUldbl=''
1010 sPRIGUldbl=''
1011 sPRIeldbl=''
1012 sPRIfldbl=''
1013 sPRIgldbl=''
1014 sSCNfldbl=''
1015 lseeksize=''
1016 lseektype=''
1017 mad=''
1018 madlyh=''
1019 madlyobj=''
1020 madlysrc=''
1021 make_set_make=''
1022 d_mymalloc=''
1023 freetype=''
1024 mallocobj=''
1025 mallocsrc=''
1026 malloctype=''
1027 usemallocwrap=''
1028 usemymalloc=''
1029 installman1dir=''
1030 man1dir=''
1031 man1direxp=''
1032 man1ext=''
1033 installman3dir=''
1034 man3dir=''
1035 man3direxp=''
1036 man3ext=''
1037 modetype=''
1038 multiarch=''
1039 mydomain=''
1040 myhostname=''
1041 phostname=''
1042 c=''
1043 n=''
1044 d_eofnblk=''
1045 eagain=''
1046 o_nonblock=''
1047 rd_nodata=''
1048 need_va_copy=''
1049 netdb_hlen_type=''
1050 netdb_host_type=''
1051 netdb_name_type=''
1052 netdb_net_type=''
1053 groupcat=''
1054 hostcat=''
1055 passcat=''
1056 orderlib=''
1057 ranlib=''
1058 d_perl_otherlibdirs=''
1059 otherlibdirs=''
1060 package=''
1061 spackage=''
1062 pager=''
1063 api_revision=''
1064 api_subversion=''
1065 api_version=''
1066 api_versionstring=''
1067 patchlevel=''
1068 perl_patchlevel=''
1069 revision=''
1070 subversion=''
1071 version=''
1072 version_patchlevel_string=''
1073 perl5=''
1074 perladmin=''
1075 perlpath=''
1076 d_nv_preserves_uv=''
1077 d_nv_zero_is_allbits_zero=''
1078 i16size=''
1079 i16type=''
1080 i32size=''
1081 i32type=''
1082 i64size=''
1083 i64type=''
1084 i8size=''
1085 i8type=''
1086 ivsize=''
1087 ivtype=''
1088 nv_overflows_integers_at=''
1089 nv_preserves_uv_bits=''
1090 nvsize=''
1091 nvtype=''
1092 u16size=''
1093 u16type=''
1094 u32size=''
1095 u32type=''
1096 u64size=''
1097 u64type=''
1098 u8size=''
1099 u8type=''
1100 uvsize=''
1101 uvtype=''
1102 ivdformat=''
1103 nvEUformat=''
1104 nvFUformat=''
1105 nvGUformat=''
1106 nveformat=''
1107 nvfformat=''
1108 nvgformat=''
1109 uvXUformat=''
1110 uvoformat=''
1111 uvuformat=''
1112 uvxformat=''
1113 pidtype=''
1114 prefix=''
1115 prefixexp=''
1116 installprivlib=''
1117 privlib=''
1118 privlibexp=''
1119 prototype=''
1120 ptrsize=''
1121 d_PRIXU64=''
1122 d_PRId64=''
1123 d_PRIi64=''
1124 d_PRIo64=''
1125 d_PRIu64=''
1126 d_PRIx64=''
1127 sPRIXU64=''
1128 sPRId64=''
1129 sPRIi64=''
1130 sPRIo64=''
1131 sPRIu64=''
1132 sPRIx64=''
1133 d_quad=''
1134 quadkind=''
1135 quadtype=''
1136 uquadtype=''
1137 drand01=''
1138 randbits=''
1139 randfunc=''
1140 randseedtype=''
1141 seedfunc=''
1142 installscript=''
1143 scriptdir=''
1144 scriptdirexp=''
1145 selectminbits=''
1146 selecttype=''
1147 sh=''
1148 sig_count=''
1149 sig_name=''
1150 sig_name_init=''
1151 sig_num=''
1152 sig_num_init=''
1153 sig_size=''
1154 d_sitearch=''
1155 installsitearch=''
1156 sitearch=''
1157 sitearchexp=''
1158 installsitebin=''
1159 sitebin=''
1160 sitebinexp=''
1161 installsitehtml1dir=''
1162 sitehtml1dir=''
1163 sitehtml1direxp=''
1164 installsitehtml3dir=''
1165 sitehtml3dir=''
1166 sitehtml3direxp=''
1167 installsitelib=''
1168 sitelib=''
1169 sitelib_stem=''
1170 sitelibexp=''
1171 installsiteman1dir=''
1172 siteman1dir=''
1173 siteman1direxp=''
1174 installsiteman3dir=''
1175 siteman3dir=''
1176 siteman3direxp=''
1177 siteprefix=''
1178 siteprefixexp=''
1179 installsitescript=''
1180 sitescript=''
1181 sitescriptexp=''
1182 sizesize=''
1183 sizetype=''
1184 so=''
1185 socksizetype=''
1186 sharpbang=''
1187 shsharp=''
1188 spitshell=''
1189 src=''
1190 ssizetype=''
1191 startperl=''
1192 startsh=''
1193 stdchar=''
1194 d_stdio_stream_array=''
1195 stdio_stream_array=''
1196 sysman=''
1197 sGMTIME_max=''
1198 sGMTIME_min=''
1199 sLOCALTIME_max=''
1200 sLOCALTIME_min=''
1201 trnl=''
1202 uidformat=''
1203 uidsign=''
1204 uidsize=''
1205 uidtype=''
1206 archname64=''
1207 use64bitall=''
1208 use64bitint=''
1209 dtrace=''
1210 usedtrace=''
1211 usefaststdio=''
1212 ccflags_uselargefiles=''
1213 ldflags_uselargefiles=''
1214 libswanted_uselargefiles=''
1215 uselargefiles=''
1216 uselongdouble=''
1217 usemorebits=''
1218 usemultiplicity=''
1219 nm_opt=''
1220 nm_so_opt=''
1221 runnm=''
1222 usenm=''
1223 useperlio=''
1224 usesocks=''
1225 d_oldpthreads=''
1226 use5005threads=''
1227 useithreads=''
1228 usereentrant=''
1229 usethreads=''
1230 incpath=''
1231 mips_type=''
1232 usrinc=''
1233 d_vendorarch=''
1234 installvendorarch=''
1235 vendorarch=''
1236 vendorarchexp=''
1237 d_vendorbin=''
1238 installvendorbin=''
1239 vendorbin=''
1240 vendorbinexp=''
1241 installvendorhtml1dir=''
1242 vendorhtml1dir=''
1243 vendorhtml1direxp=''
1244 installvendorhtml3dir=''
1245 vendorhtml3dir=''
1246 vendorhtml3direxp=''
1247 d_vendorlib=''
1248 installvendorlib=''
1249 vendorlib=''
1250 vendorlib_stem=''
1251 vendorlibexp=''
1252 installvendorman1dir=''
1253 vendorman1dir=''
1254 vendorman1direxp=''
1255 installvendorman3dir=''
1256 vendorman3dir=''
1257 vendorman3direxp=''
1258 usevendorprefix=''
1259 vendorprefix=''
1260 vendorprefixexp=''
1261 d_vendorscript=''
1262 installvendorscript=''
1263 vendorscript=''
1264 vendorscriptexp=''
1265 versiononly=''
1266 defvoidused=''
1267 voidflags=''
1268 yacc=''
1269 yaccflags=''
1270 CONFIG=''
1271
1272 : Detect odd OSs
1273 define='define'
1274 undef='undef'
1275 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1276 rmlist=''
1277
1278 : We must find out about Eunice early
1279 eunicefix=':'
1280 if test -f /etc/unixtovms; then
1281         eunicefix=/etc/unixtovms
1282 fi
1283 if test -f /etc/unixtovms.exe; then
1284         eunicefix=/etc/unixtovms.exe
1285 fi
1286
1287 : Set executable suffix now -- needed before hints available
1288 if test -f "/libs/version.library"; then
1289 : Amiga OS
1290     _exe=""
1291 elif test -f "/system/gnu_library/bin/ar.pm"; then
1292 : Stratus VOS
1293     _exe=".pm"
1294 elif test -n "$DJGPP"; then
1295 : DOS DJGPP
1296     _exe=".exe"
1297 elif test -d c:/. -o -n "$is_os2" ; then
1298 : OS/2 or cygwin
1299     _exe=".exe"
1300 fi
1301
1302 groupstype=''
1303 i_whoami=''
1304 : Trailing extension.  Override this in a hint file, if needed.
1305 : Extra object files, if any, needed on this platform.
1306 archobjs=''
1307 archname=''
1308 libnames=''
1309 : change the next line if compiling for Xenix/286 on Xenix/386
1310 xlibpth='/usr/lib/386 /lib/386'
1311 : Possible local library directories to search.
1312 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1313 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1314
1315 : general looking path for locating libraries
1316 glibpth="/lib /usr/lib $xlibpth"
1317 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1318 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1319 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1320 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1321
1322 : Private path used by Configure to find libraries.  Its value
1323 : is prepended to libpth. This variable takes care of special
1324 : machines, like the mips.  Usually, it should be empty.
1325 plibpth=''
1326
1327 : default library list
1328 libswanted=''
1329 : some systems want to use only the non-versioned libso:s
1330 ignore_versioned_solibs=''
1331 : set usethreads on the Configure command line to enable threads.
1332 usereentrant='undef'
1333 : full support for void wanted by default
1334 defvoidused=15
1335
1336 : Possible local include directories to search.
1337 : Set locincpth to "" in a hint file to defeat local include searches.
1338 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1339 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1340 :
1341 : no include file wanted by default
1342 inclwanted=''
1343
1344 : Enable -DEBUGGING and -DDEBUGGING from the command line
1345 EBUGGING=''
1346 DEBUGGING=old
1347
1348 ccname=''
1349 ccversion=''
1350 perllibs=''
1351 : set useposix=false in your hint file to disable the POSIX extension.
1352 useposix=true
1353 : set useopcode=false in your hint file to disable the Opcode extension.
1354 useopcode=true
1355 archname64=''
1356 ccflags_uselargefiles=''
1357 ldflags_uselargefiles=''
1358 libswanted_uselargefiles=''
1359 : set usemultiplicity on the Configure command line to enable multiplicity.
1360 : set usesocks on the Configure command line to enable socks.
1361 : List of libraries we want.
1362 : If anyone needs extra -lxxx, put those in a hint file.
1363 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1364 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1365 : We probably want to search /usr/shlib before most other libraries.
1366 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1367 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1368 glibpth="/usr/shlib $glibpth"
1369 : Do not use vfork unless overridden by a hint file.
1370 usevfork=false
1371
1372 : Find the basic shell for Bourne shell scripts
1373 case "$sh" in
1374 '')
1375         case "$SYSTYPE" in
1376         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1377         *) xxx='/bin/sh';;
1378         esac
1379         if test -f "$xxx"; then
1380                 sh="$xxx"
1381         else
1382                 : Build up a list and do a single loop so we can 'break' out.
1383                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1384                 for xxx in sh bash ksh pdksh ash; do
1385                         for p in $pth; do
1386                                 try="$try ${p}/${xxx}"
1387                         done
1388                 done
1389                 for xxx in $try; do
1390                         if test -f "$xxx"; then
1391                                 sh="$xxx";
1392                                 break
1393                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1394                                 sh="$xxx";
1395                                 break
1396                         elif test -f "$xxx.exe"; then
1397                                 sh="$xxx";
1398                                 break
1399                         fi
1400                 done
1401         fi
1402         ;;
1403 esac
1404
1405 case "$sh" in
1406 '')     cat >&2 <<EOM
1407 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1408
1409 Usually it's in /bin/sh.  How did you even get this far?
1410 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1411 we'll try to straighten this all out.
1412 EOM
1413         exit 1
1414         ;;
1415 esac
1416
1417 : see if sh knows # comments
1418 if `$sh -c '#' >/dev/null 2>&1`; then
1419         shsharp=true
1420         spitshell=cat
1421         xcat=/bin/cat
1422         test -f $xcat$_exe || xcat=/usr/bin/cat
1423         if test ! -f $xcat$_exe; then
1424                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1425                         if test -f $p/cat$_exe; then
1426                                 xcat=$p/cat
1427                                 break
1428                         fi
1429                 done
1430                 if test ! -f $xcat$_exe; then
1431                         echo "Can't find cat anywhere!"
1432                         exit 1
1433                 fi
1434         fi
1435         echo "#!$xcat" >sharp
1436         $eunicefix sharp
1437         chmod +x sharp
1438         ./sharp > today 2>/dev/null
1439         if test -s today; then
1440                 sharpbang='#!'
1441         else
1442                 echo "#! $xcat" > sharp
1443                 $eunicefix sharp
1444                 chmod +x sharp
1445                 ./sharp > today 2>/dev/null
1446                 if test -s today; then
1447                         sharpbang='#! '
1448                 else
1449                         sharpbang=': use '
1450                 fi
1451         fi
1452 else
1453         echo " "
1454         echo "Your $sh doesn't grok # comments--I will strip them later on."
1455         shsharp=false
1456         cd ..
1457         echo "exec grep -v '^[  ]*#'" >spitshell
1458         chmod +x spitshell
1459         $eunicefix spitshell
1460         spitshell=`pwd`/spitshell
1461         cd UU
1462         echo "I presume that if # doesn't work, #! won't work either!"
1463         sharpbang=': use '
1464 fi
1465 rm -f sharp today
1466
1467 : figure out how to guarantee sh startup
1468 case "$startsh" in
1469 '') startsh=${sharpbang}${sh} ;;
1470 *)
1471 esac
1472 cat >sharp <<EOSS
1473 $startsh
1474 set abc
1475 test "$?abc" != 1
1476 EOSS
1477
1478 chmod +x sharp
1479 $eunicefix sharp
1480 if ./sharp; then
1481         : echo "Yup, it does."
1482 else
1483         echo "Hmm... '$startsh' does not guarantee sh startup..."
1484         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1485 fi
1486 rm -f sharp
1487
1488 : Save command line options in file UU/cmdline.opt for later use in
1489 : generating config.sh.
1490 cat > cmdline.opt <<EOSH
1491 : Configure command line arguments.
1492 config_arg0='$0'
1493 config_args='$*'
1494 config_argc=$#
1495 EOSH
1496 argn=1
1497 args_exp=''
1498 args_sep=''
1499 for arg in "$@"; do
1500         cat >>cmdline.opt <<EOSH
1501 config_arg$argn='$arg'
1502 EOSH
1503         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1504 $arg
1505 EOC
1506         arg_exp=`cat cmdl.opt`
1507         args_exp="$args_exp$args_sep'$arg_exp'"
1508         argn=`expr $argn + 1`
1509         args_sep=' '
1510 done
1511 rm -f cmdl.opt
1512
1513 : produce awk script to parse command line options
1514 cat >options.awk <<'EOF'
1515 BEGIN {
1516         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1517
1518         len = length(optstr);
1519         for (i = 1; i <= len; i++) {
1520                 c = substr(optstr, i, 1);
1521                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1522                 if (a == ":") {
1523                         arg[c] = 1;
1524                         i++;
1525                 }
1526                 opt[c] = 1;
1527         }
1528 }
1529 {
1530         expect = 0;
1531         str = $0;
1532         if (substr(str, 1, 1) != "-") {
1533                 printf("'%s'\n", str);
1534                 next;
1535         }
1536         len = length($0);
1537         for (i = 2; i <= len; i++) {
1538                 c = substr(str, i, 1);
1539                 if (!opt[c]) {
1540                         printf("-%s\n", substr(str, i));
1541                         next;
1542                 }
1543                 printf("-%s\n", c);
1544                 if (arg[c]) {
1545                         if (i < len)
1546                                 printf("'%s'\n", substr(str, i + 1));
1547                         else
1548                                 expect = 1;
1549                         next;
1550                 }
1551         }
1552 }
1553 END {
1554         if (expect)
1555                 print "?";
1556 }
1557 EOF
1558
1559 : process the command line options
1560 set X `for arg in "$@"; do echo "X$arg"; done |
1561         sed -e s/X// | awk -f options.awk`
1562 eval "set $*"
1563 shift
1564 rm -f options.awk
1565
1566 : set up default values
1567 fastread=''
1568 reuseval=false
1569 config_sh=''
1570 alldone=''
1571 error=''
1572 silent=''
1573 extractsh=''
1574 override=''
1575 knowitall=''
1576 rm -f optdef.sh posthint.sh
1577 cat >optdef.sh <<EOS
1578 $startsh
1579 EOS
1580
1581
1582 : option parsing
1583 while test $# -gt 0; do
1584         case "$1" in
1585         -d) shift; fastread=yes;;
1586         -e) shift; alldone=cont;;
1587         -f)
1588                 shift
1589                 cd ..
1590                 if test -r "$1"; then
1591                         config_sh="$1"
1592                 else
1593                         echo "$me: cannot read config file $1." >&2
1594                         error=true
1595                 fi
1596                 cd UU
1597                 shift;;
1598         --help|\
1599         -h) shift; error=true;;
1600         -r) shift; reuseval=true;;
1601         -s) shift; silent=true; realsilent=true;;
1602         -E) shift; alldone=exit;;
1603         -K) shift; knowitall=true;;
1604         -O) shift; override=true;;
1605         -S) shift; silent=true; extractsh=true;;
1606         -D)
1607                 shift
1608                 case "$1" in
1609                 *=)
1610                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1611                         echo "$me: ignoring -D $1" >&2
1612                         ;;
1613                 *=*) echo "$1" | \
1614                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1615                 *) echo "$1='define'" >> optdef.sh;;
1616                 esac
1617                 shift
1618                 ;;
1619         -U)
1620                 shift
1621                 case "$1" in
1622                 *=) echo "$1" >> optdef.sh;;
1623                 *=*)
1624                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1625                         echo "$me: ignoring -U $1" >&2
1626                         ;;
1627                 *) echo "$1='undef'" >> optdef.sh;;
1628                 esac
1629                 shift
1630                 ;;
1631         -A)
1632             shift
1633             xxx=''
1634             yyy="$1"
1635             zzz=''
1636             uuu=undef
1637             case "$yyy" in
1638             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1639                  case "$zzz" in
1640                  *:*) zzz='' ;;
1641                  *)   xxx=append
1642                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1643                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1644                  esac
1645                  ;;
1646             esac
1647             case "$xxx" in
1648             '')  case "$yyy" in
1649                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1650                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1651                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1652                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1653                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1654                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1655                  esac
1656                  ;;
1657             esac
1658             case "$xxx" in
1659             append)
1660                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1661             clear)
1662                 echo "$yyy=''"                  >> posthint.sh ;;
1663             define)
1664                 case "$zzz" in
1665                 '') zzz=define ;;
1666                 esac
1667                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1668             eval)
1669                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1670             prepend)
1671                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1672             undef)
1673                 case "$zzz" in
1674                 '') zzz="$uuu" ;;
1675                 esac
1676                 echo "$yyy=$zzz"                >> posthint.sh ;;
1677             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1678             esac
1679             shift
1680             ;;
1681         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1682             exit 0;;
1683         --) break;;
1684         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1685         *) break;;
1686         esac
1687 done
1688
1689 case "$error" in
1690 true)
1691         cat >&2 <<EOM
1692 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1693                  [-U symbol] [-U symbol=] [-A command:symbol...]
1694   -d : use defaults for all answers.
1695   -e : go on without questioning past the production of config.sh.
1696   -f : specify an alternate default configuration file.
1697   -h : print this help message and exit (with an error status).
1698   -r : reuse C symbols value if possible (skips costly nm extraction).
1699   -s : silent mode, only echoes questions and essential information.
1700   -D : define symbol to have some value:
1701          -D symbol         symbol gets the value 'define'
1702          -D symbol=value   symbol gets the value 'value'
1703        common used examples (see INSTALL for more info):
1704          -Duse64bitint            use 64bit integers
1705          -Duse64bitall            use 64bit integers and pointers
1706          -Dusethreads             use thread support
1707          -Dinc_version_list=none  do not include older perl trees in @INC
1708          -DEBUGGING=none          DEBUGGING options
1709          -Dcc=gcc                 choose your compiler
1710          -Dprefix=/opt/perl5      choose your destination
1711   -E : stop at the end of questions, after having produced config.sh.
1712   -K : do not use unless you know what you are doing.
1713   -O : let -D and -U override definitions from loaded configuration file.
1714   -S : perform variable substitutions on all .SH files (can mix with -f)
1715   -U : undefine symbol:
1716          -U symbol    symbol gets the value 'undef'
1717          -U symbol=   symbol gets completely empty
1718        e.g.:  -Uversiononly
1719   -A : manipulate symbol after the platform specific hints have been applied:
1720          -A append:symbol=value   append value to symbol
1721          -A symbol=value          like append:, but with a separating space
1722          -A define:symbol=value   define symbol to have value
1723          -A clear:symbol          define symbol to be ''
1724          -A define:symbol         define symbol to be 'define'
1725          -A eval:symbol=value     define symbol to be eval of value
1726          -A prepend:symbol=value  prepend value to symbol
1727          -A undef:symbol          define symbol to be 'undef'
1728          -A undef:symbol=         define symbol to be ''
1729        e.g.:  -A prepend:libswanted='cl pthread '
1730               -A ccflags=-DSOME_MACRO
1731   -V : print version number and exit (with a zero status).
1732 EOM
1733         exit 1
1734         ;;
1735 esac
1736
1737 : Sanity checks
1738 case "$fastread$alldone" in
1739 yescont|yesexit) ;;
1740 *)
1741         case "$extractsh" in
1742         true) ;;
1743         *)
1744                 if test ! -t 0; then
1745                         echo "Say 'sh Configure', not 'sh <Configure'"
1746                         exit 1
1747                 fi
1748                 ;;
1749         esac
1750         ;;
1751 esac
1752
1753 exec 4>&1
1754 case "$silent" in
1755 true) exec 1>/dev/null;;
1756 esac
1757
1758 : run the defines and the undefines, if any, but leave the file out there...
1759 touch optdef.sh
1760 . ./optdef.sh
1761 : create the posthint manipulation script and leave the file out there...
1762 touch posthint.sh
1763
1764 : set package name
1765 package='perl5'
1766 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1767 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1768 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1769 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1770 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1771 esac
1772
1773 : Some greps do not return status, grrr.
1774 echo "grimblepritz" >grimble
1775 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1776         contains=contains
1777 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1778         contains=grep
1779 else
1780         contains=contains
1781 fi
1782 rm -f grimble
1783 : the following should work in any shell
1784 case "$contains" in
1785 contains*)
1786         echo " "
1787         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1788         cat >contains <<'EOSS'
1789 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1790 EOSS
1791 chmod +x contains
1792 esac
1793
1794 : Find the path to the source tree
1795 case "$src" in
1796 '') case "$0" in
1797     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1798          case "$src" in
1799          /*)    ;;
1800          .)     ;;
1801          *)     src=`cd ../$src && pwd` ;;
1802          esac
1803          ;;
1804     *)   src='.';;
1805     esac;;
1806 esac
1807 case "$src" in
1808 '')     src=/
1809         rsrc=/
1810         ;;
1811 /*)     rsrc="$src";;
1812 *)      rsrc="../$src";;
1813 esac
1814 if test -f $rsrc/Configure && \
1815         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1816 then
1817    : found it, so we are ok.
1818 else
1819         rsrc=''
1820         for src in . .. ../.. ../../.. ../../../..; do
1821                 if test -f ../$src/Configure && \
1822                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1823                 then
1824                         rsrc=../$src
1825                         break
1826                 fi
1827         done
1828 fi
1829 case "$rsrc" in
1830 '')
1831         cat <<EOM >&4
1832
1833 Sorry, I can't seem to locate the source dir for $package.  Please start
1834 Configure with an explicit path -- i.e. /some/path/Configure.
1835
1836 EOM
1837         exit 1
1838         ;;
1839 ../.)   rsrc='..';;
1840 *)
1841         echo " "
1842         echo "Sources for $package found in \"$src\"." >&4
1843         ;;
1844 esac
1845
1846 : script used to extract .SH files with variable substitutions
1847 cat >extract <<'EOS'
1848 PERL_CONFIG_SH=true
1849 echo "Doing variable substitutions on .SH files..."
1850 if test -f MANIFEST; then
1851         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1852 else
1853         echo "(Looking for .SH files under the source directory.)"
1854         set x `(cd "$src"; find . -name "*.SH" -print)`
1855 fi
1856 shift
1857 case $# in
1858 0) set x `(cd "$src"; echo *.SH)`; shift;;
1859 esac
1860 if test ! -f "$src/$1"; then
1861         shift
1862 fi
1863 mkdir_p='
1864 name=$1;
1865 create="";
1866 while test $name; do
1867         if test ! -d "$name"; then
1868                 create="$name $create";
1869                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1870                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1871         else
1872                 name="";
1873         fi;
1874 done;
1875 for file in $create; do
1876         mkdir $file;
1877 done
1878 '
1879 for file in $*; do
1880         case "$src" in
1881         ".")
1882                 case "$file" in
1883                 */*)
1884                         dir=`expr X$file : 'X\(.*\)/'`
1885                         file=`expr X$file : 'X.*/\(.*\)'`
1886                         (cd "$dir" && . ./$file)
1887                         ;;
1888                 *)
1889                         . ./$file
1890                         ;;
1891                 esac
1892                 ;;
1893         *)
1894                 case "$file" in
1895                 */*)
1896                         dir=`expr X$file : 'X\(.*\)/'`
1897                         file=`expr X$file : 'X.*/\(.*\)'`
1898                         (set x $dir; shift; eval $mkdir_p)
1899                         sh <"$src/$dir/$file"
1900                         ;;
1901                 *)
1902                         sh <"$src/$file"
1903                         ;;
1904                 esac
1905                 ;;
1906         esac
1907 done
1908 if test -f "$src/config_h.SH"; then
1909         if test ! -f config.h; then
1910         : oops, they left it out of MANIFEST, probably, so do it anyway.
1911         . "$src/config_h.SH"
1912         fi
1913 fi
1914 EOS
1915
1916 : extract files and exit if asked to do so
1917 case "$extractsh" in
1918 true)
1919         case "$realsilent" in
1920         true) ;;
1921         *) exec 1>&4;;
1922         esac
1923         case "$config_sh" in
1924         '') config_sh='config.sh';;
1925         esac
1926         echo " "
1927         echo "Fetching answers from $config_sh..."
1928         cd ..
1929         . $config_sh
1930         test "$override" && . ./optdef.sh
1931         echo " "
1932         . UU/extract
1933         rm -rf UU
1934         echo "Extraction done."
1935         exit 0
1936         ;;
1937 esac
1938
1939 : Eunice requires " " instead of "", can you believe it
1940 echo " "
1941 : Here we go...
1942 echo "Beginning of configuration questions for $package."
1943
1944 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1945
1946 : first determine how to suppress newline on echo command
1947 echo " "
1948 echo "Checking echo to see how to suppress newlines..."
1949 (echo "hi there\c" ; echo " ") >.echotmp
1950 if $contains c .echotmp >/dev/null 2>&1 ; then
1951         echo "...using -n."
1952         n='-n'
1953         c=''
1954 else
1955         cat <<'EOM'
1956 ...using \c
1957 EOM
1958         n=''
1959         c='\c'
1960 fi
1961 echo $n "The star should be here-->$c"
1962 echo '*'
1963 rm -f .echotmp
1964
1965 : Now test for existence of everything in MANIFEST
1966 echo " "
1967 if test -f "$rsrc/MANIFEST"; then
1968         echo "First let's make sure your kit is complete.  Checking..." >&4
1969         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1970                 (split -l 50 2>/dev/null || split -50)
1971         rm -f missing
1972         tmppwd=`pwd`
1973         for filelist in x??; do
1974                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1975                         >/dev/null 2>>"$tmppwd/missing")
1976         done
1977         if test -s missing; then
1978                 cat missing >&4
1979                 cat >&4 <<'EOM'
1980
1981 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1982
1983 You have the option of continuing the configuration process, despite the
1984 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1985 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1986 and contact the author (perlbug@perl.org).
1987
1988 EOM
1989                 echo $n "Continue? [n] $c" >&4
1990                 read ans
1991                 case "$ans" in
1992                 y*)
1993                         echo "Continuing..." >&4
1994                         rm -f missing
1995                         ;;
1996                 *)
1997                         echo "ABORTING..." >&4
1998                         kill $$
1999                         ;;
2000                 esac
2001         else
2002                 echo "Looks good..."
2003         fi
2004 else
2005         echo "There is no MANIFEST file.  I hope your kit is complete !"
2006 fi
2007 rm -f missing x??
2008
2009 : Find the appropriate value for a newline for tr
2010 echo " "
2011 if test -n "$DJGPP"; then
2012        trnl='\012'
2013 fi
2014 if test X"$trnl" = X; then
2015         case "`echo foo|tr '\n' x 2>/dev/null`" in
2016         foox) trnl='\n' ;;
2017         esac
2018 fi
2019 if test X"$trnl" = X; then
2020         case "`echo foo|tr '\012' x 2>/dev/null`" in
2021         foox) trnl='\012' ;;
2022         esac
2023 fi
2024 if test X"$trnl" = X; then
2025        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2026        fooxy) trnl='\n\r' ;;
2027        esac
2028 fi
2029 if test X"$trnl" = X; then
2030         cat <<EOM >&2
2031
2032 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2033
2034 EOM
2035         exit 1
2036 fi
2037
2038 : compute the number of columns on the terminal for proper question formatting
2039 case "$COLUMNS" in
2040 '') COLUMNS='80';;
2041 esac
2042
2043 : set up the echo used in my read
2044 myecho="case \"\$xxxm\" in
2045 '') echo $n \"\$rp $c\" >&4;;
2046 *) case \"\$rp\" in
2047         '') echo $n \"[\$xxxm] $c\";;
2048         *)
2049                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2050                         echo \"\$rp\" >&4
2051                         echo $n \"[\$xxxm] $c\" >&4
2052                 else
2053                         echo $n \"\$rp [\$xxxm] $c\" >&4
2054                 fi
2055                 ;;
2056         esac;;
2057 esac"
2058
2059 : now set up to do reads with possible shell escape and default assignment
2060 cat <<EOSC >myread
2061 $startsh
2062 xxxm=\$dflt
2063 $myecho
2064 ans='!'
2065 case "\$fastread" in
2066 yes) case "\$dflt" in
2067         '') ;;
2068         *) ans='';
2069                 case "\$silent-\$rp" in
2070                 true-) ;;
2071                 *) echo " " >&4;;
2072                 esac;;
2073         esac;;
2074 *) case "\$silent" in
2075         true) case "\$rp" in
2076                 '') ans='';;
2077                 esac;;
2078         esac;;
2079 esac
2080 while expr "X\$ans" : "X!" >/dev/null; do
2081         read answ
2082         set x \$xxxm
2083         shift
2084         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2085         case  "\$answ" in
2086         "!")
2087                 sh 1>&4
2088                 echo " "
2089                 $myecho
2090                 ;;
2091         !*)
2092                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2093                 shift
2094                 sh 1>&4 -c "\$*"
2095                 echo " "
2096                 $myecho
2097                 ;;
2098         "\$ans")
2099                 case "\$ans" in
2100                 \\&*)
2101                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2102                         shift
2103                         case "\$1" in
2104                         -d)
2105                                 fastread=yes
2106                                 echo "(OK, I'll run with -d after this question.)" >&4
2107                                 ;;
2108                         -*)
2109                                 echo "*** Sorry, \$1 not supported yet." >&4
2110                                 ;;
2111                         esac
2112                         $myecho
2113                         ans=!
2114                         ;;
2115                 esac;;
2116         *)
2117                 case "\$aok" in
2118                 y)
2119                         echo "*** Substitution done -- please confirm."
2120                         xxxm="\$ans"
2121                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2122                         xxxm="\$ans"
2123                         ans=!
2124                         ;;
2125                 *)
2126                         echo "*** Error -- try again."
2127                         ans=!
2128                         ;;
2129                 esac
2130                 $myecho
2131                 ;;
2132         esac
2133         case "\$ans\$xxxm\$nostick" in
2134         '')
2135                 ans=!
2136                 $myecho
2137                 ;;
2138         esac
2139 done
2140 case "\$ans" in
2141 '') ans="\$xxxm";;
2142 esac
2143 EOSC
2144
2145 : create .config dir to save info across Configure sessions
2146 test -d ../.config || mkdir ../.config
2147 cat >../.config/README <<EOF
2148 This directory created by Configure to save information that should
2149 persist across sessions for $package.
2150
2151 You may safely delete it if you wish.
2152 EOF
2153
2154 : See if we are using a devel version and want that
2155 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2156 case "$usedevel" in
2157 $define|true|[yY]*)
2158     usedevel="$define" ;;
2159 *) case "$xversion" in
2160    *[13579])
2161         cat >&4 <<EOH
2162 *** WHOA THERE!!! ***
2163
2164     This is an UNSTABLE DEVELOPMENT release.
2165     The version of this $package distribution is $xversion, that is, odd,
2166     (as opposed to even) and that signifies a development release.
2167     If you want a maintenance release, you want an even-numbered version.
2168
2169     Do ***NOT*** install this into production use.
2170     Data corruption and crashes are possible.
2171
2172     It is most seriously suggested that you do not continue any further
2173     unless you want to help in developing and debugging Perl.
2174
2175     If you *still* want to build perl, you can answer 'y' now,
2176     or pass -Dusedevel to Configure.
2177
2178 EOH
2179         rp='Do you really want to continue?'
2180         dflt='n'
2181         . ./myread
2182         case "$ans" in
2183         [yY]) echo >&4 "Okay, continuing."
2184               usedevel="$define" ;;
2185         *) echo >&4 "Okay, bye."
2186            exit 1
2187            ;;
2188         esac
2189         ;;
2190     esac
2191     usedevel="$undef"
2192     ;;
2193 esac
2194 case "$usedevel" in
2195 $define|true|[yY]*)
2196         case "$versiononly" in
2197         '') versiononly="$define" ;;
2198         esac
2199         case "$installusrbinperl" in
2200         '') installusrbinperl="$undef" ;;
2201         esac
2202         ;;
2203 esac
2204
2205 : general instructions
2206 needman=true
2207 firsttime=true
2208 user=`(logname) 2>/dev/null`
2209 case "$user" in
2210 '') user=`whoami 2>&1`;;
2211 esac
2212 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2213         firsttime=false
2214         echo " "
2215         rp='Would you like to see the instructions?'
2216         dflt=n
2217         . ./myread
2218         case "$ans" in
2219         [yY]*) ;;
2220         *) needman=false;;
2221         esac
2222 fi
2223 if $needman; then
2224         cat <<EOH
2225
2226 This installation shell script will examine your system and ask you questions
2227 to determine how the perl5 package should be installed. If you get
2228 stuck on a question, you may use a ! shell escape to start a subshell or
2229 execute a command.  Many of the questions will have default answers in square
2230 brackets; typing carriage return will give you the default.
2231
2232 On some of the questions which ask for file or directory names you are allowed
2233 to use the ~name construct to specify the login directory belonging to "name",
2234 even if you don't have a shell which knows about that.  Questions where this is
2235 allowed will be marked "(~name ok)".
2236
2237 EOH
2238         rp=''
2239         dflt='Type carriage return to continue'
2240         . ./myread
2241         cat <<'EOH'
2242
2243 The prompter used in this script allows you to use shell variables and
2244 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2245 in the default answer, as if the default line was a set of arguments given to a
2246 script shell.  This means you may also use $* to repeat the whole default line,
2247 so you do not have to re-type everything to add something to the default.
2248
2249 Everytime there is a substitution, you will have to confirm.  If there is an
2250 error (e.g. an unmatched backtick), the default answer will remain unchanged
2251 and you will be prompted again.
2252
2253 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2254 the questions and use the computed defaults (or the previous answers if there
2255 was already a config.sh file). Type 'Configure -h' for a list of options.
2256 You may also start interactively and then answer '& -d' at any prompt to turn
2257 on the non-interactive behaviour for the remainder of the execution.
2258
2259 EOH
2260         . ./myread
2261         cat <<EOH
2262
2263 Much effort has been expended to ensure that this shell script will run on any
2264 Unix system.  If despite that it blows up on yours, your best bet is to edit
2265 Configure and run it again.  If you can't run Configure for some reason,
2266 you'll have to generate a config.sh file by hand.  Whatever problems you
2267 have, let me (perlbug@perl.org) know how I blew it.
2268
2269 This installation script affects things in two ways:
2270
2271 1) it may do direct variable substitutions on some of the files included
2272    in this kit.
2273 2) it builds a config.h file for inclusion in C programs.  You may edit
2274    any of these files as the need arises after running this script.
2275
2276 If you make a mistake on a question, there is no easy way to back up to it
2277 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2278 files.  Configure will offer to let you do this before it runs the SH files.
2279
2280 EOH
2281         dflt='Type carriage return to continue'
2282         . ./myread
2283         case "$firsttime" in
2284         true) echo $user >>../.config/instruct;;
2285         esac
2286 fi
2287
2288 : find out where common programs are
2289 echo " "
2290 echo "Locating common programs..." >&4
2291 cat <<EOSC >loc
2292 $startsh
2293 case \$# in
2294 0) exit 1;;
2295 esac
2296 thing=\$1
2297 shift
2298 dflt=\$1
2299 shift
2300 for dir in \$*; do
2301         case "\$thing" in
2302         .)
2303         if test -d \$dir/\$thing; then
2304                 echo \$dir
2305                 exit 0
2306         fi
2307         ;;
2308         *)
2309         for thisthing in \$dir/\$thing; do
2310                 : just loop through to pick last item
2311         done
2312         if test -f \$thisthing; then
2313                 echo \$thisthing
2314                 exit 0
2315         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2316                 echo \$thisthing
2317                 exit 0
2318         elif test -f \$dir/\$thing.exe; then
2319                 if test -n "$DJGPP"; then
2320                         echo \$dir/\$thing.exe
2321                 elif test "$eunicefix" != ":"; then
2322                         : on Eunice apparently
2323                         echo \$dir/\$thing
2324                 fi
2325                 exit 0
2326         fi
2327         ;;
2328         esac
2329 done
2330 echo \$dflt
2331 exit 1
2332 EOSC
2333 chmod +x loc
2334 $eunicefix loc
2335 loclist="
2336 awk
2337 cat
2338 chmod
2339 comm
2340 cp
2341 echo
2342 expr
2343 grep
2344 ls
2345 mkdir
2346 rm
2347 sed
2348 sort
2349 touch
2350 tr
2351 uniq
2352 "
2353 trylist="
2354 ar
2355 bison
2356 byacc
2357 cpp
2358 csh
2359 date
2360 egrep
2361 gmake
2362 gzip
2363 less
2364 ln
2365 make
2366 more
2367 nm
2368 nroff
2369 pg
2370 test
2371 uname
2372 zip
2373 "
2374 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2375 pth="$pth /lib /usr/lib"
2376 for file in $loclist; do
2377         eval xxx=\$$file
2378         case "$xxx" in
2379         /*|?:[\\/]*)
2380                 if test -f "$xxx"; then
2381                         : ok
2382                 else
2383                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2384                         xxx=`./loc $file $file $pth`
2385                 fi
2386                 ;;
2387         '') xxx=`./loc $file $file $pth`;;
2388         *) xxx=`./loc $xxx $xxx $pth`;;
2389         esac
2390         eval $file=$xxx$_exe
2391         eval _$file=$xxx
2392         case "$xxx" in
2393         /*)
2394                 echo $file is in $xxx.
2395                 ;;
2396         ?:[\\/]*)
2397                 echo $file is in $xxx.
2398                 ;;
2399         *)
2400                 echo "I don't know where '$file' is, and my life depends on it." >&4
2401                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2402                 exit 1
2403                 ;;
2404         esac
2405 done
2406 echo " "
2407 echo "Don't worry if any of the following aren't found..."
2408 say=offhand
2409 for file in $trylist; do
2410         eval xxx=\$$file
2411         case "$xxx" in
2412         /*|?:[\\/]*)
2413                 if test -f "$xxx"; then
2414                         : ok
2415                 else
2416                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2417                         xxx=`./loc $file $file $pth`
2418                 fi
2419                 ;;
2420         '') xxx=`./loc $file $file $pth`;;
2421         *) xxx=`./loc $xxx $xxx $pth`;;
2422         esac
2423         eval $file=$xxx$_exe
2424         eval _$file=$xxx
2425         case "$xxx" in
2426         /*)
2427                 echo $file is in $xxx.
2428                 ;;
2429         ?:[\\/]*)
2430                 echo $file is in $xxx.
2431                 ;;
2432         *)
2433                 echo "I don't see $file out there, $say."
2434                 say=either
2435                 ;;
2436         esac
2437 done
2438 case "$egrep" in
2439 egrep)
2440         echo "Substituting grep for egrep."
2441         egrep=$grep
2442         _egrep=$grep
2443         ;;
2444 esac
2445 case "$ln" in
2446 ln)
2447         echo "Substituting cp for ln."
2448         ln=$cp
2449         _ln=$cp
2450         ;;
2451 esac
2452 case "$make" in
2453 make)
2454         case "$gmake" in
2455         gmake)
2456         echo "I can't find make or gmake, and my life depends on it." >&4
2457         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2458         exit 1
2459         ;;
2460         esac
2461         ;;
2462 esac
2463 case "$gmake" in
2464 gmake)  ;;
2465 *)      # We can't have osname yet.
2466         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2467                 # Assume that gmake, if found, is definitely GNU make
2468                 # and prefer it over the system make.
2469                 echo "Substituting gmake for make."
2470                 make=$gmake
2471                 _make=$gmake
2472         fi
2473         ;;
2474 esac
2475 case "$test" in
2476 test)
2477         echo "Hopefully test is built into your sh."
2478         ;;
2479 *)
2480         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2481                 echo "Using the test built into your sh."
2482                 test=test
2483                 _test=test
2484         fi
2485         ;;
2486 esac
2487 case "$echo" in
2488 echo)
2489         echo "Hopefully echo is built into your sh."
2490         ;;
2491 '') ;;
2492 *)
2493         echo " "
2494 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2495         $echo $n "hi there$c" >foo1
2496         echo $n "hi there$c" >foo2
2497         if cmp foo1 foo2 >/dev/null 2>&1; then
2498                 echo "They are compatible.  In fact, they may be identical."
2499         else
2500                 case "$n" in
2501                 '-n') n='' c='\c';;
2502                 *) n='-n' c='';;
2503                 esac
2504                 cat <<FOO
2505 They are not compatible!  You are probably running ksh on a non-USG system.
2506 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2507 have echo built in and we may have to run some Bourne shell scripts.  That
2508 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2509
2510 FOO
2511                 $echo $n "The star should be here-->$c"
2512                 $echo "*"
2513         fi
2514         $rm -f foo1 foo2
2515         ;;
2516 esac
2517
2518 # This question was auctioned at YAPC::Europe-2007 in Vienna
2519 # I never promised you could answer it. I only auctioned the question.
2520 cat <<FOO
2521 The following message is sponsored by
2522
2523   Dresden.pm<--The stars should be here.
2524
2525 Dear Perl user, system administrator or package
2526 maintainer, the Perl community sends greetings to
2527 you. Do you (emblematical) greet back [Y/n]? n
2528
2529 FOO
2530
2531 : Check what type of C compiler we use
2532 cat <<EOS >trygcc
2533 $startsh
2534 EOS
2535 cat <<'EOSC' >>trygcc
2536 case "$cc" in
2537 '') ;;
2538 *)  $rm -f try try.*
2539     $cat >try.c <<EOM
2540 int main(int argc, char *argv[]) {
2541   return 0;
2542 }
2543 EOM
2544     if $cc -o try $ccflags $ldflags try.c; then
2545        :
2546     else
2547         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2548         despair=yes
2549         trygcc=yes
2550         case "$cc" in
2551         *gcc*) trygcc=no ;;
2552         esac
2553         # Skip this test because it gives a false match on output like:
2554         #    ./trygcc: line 23: cc: command not found
2555         # case "`$cc -v -c try.c 2>&1`" in
2556         # *gcc*) trygcc=no ;;
2557         # esac
2558         if $test X"$trygcc" = Xyes; then
2559             if gcc -o try -c try.c; then
2560                 echo " "
2561                 echo "You seem to have a working gcc, though." >&4
2562                 # Switching compilers may undo the work of hints files.
2563                 # The most common problem is -D_REENTRANT for threads.
2564                 # This heuristic catches that case, but gets false positives
2565                 # if -Dusethreads was not actually specified.  Better to
2566                 # bail out here with a useful message than fail 
2567                 # mysteriously later. Should we perhaps just try to
2568                 # re-invoke Configure -Dcc=gcc config_args ?
2569                 if $test -f usethreads.cbu; then
2570                         $cat >&4 <<EOM 
2571
2572 *** However, any setting of the C compiler flags (e.g. for thread support)
2573 *** will be lost.  It may be necessary for you to restart Configure and
2574 *** add -Dcc=gcc to your Configure command line.
2575
2576 EOM
2577                         rp="Would you like to go ahead and try gcc anyway?"
2578                         dflt=n
2579                 else
2580                         rp="Would you like to use it?"
2581                         dflt=y
2582                 fi
2583                 if $test -f myread; then
2584                     . ./myread
2585                 else
2586                     if $test -f UU/myread; then
2587                         . ./UU/myread
2588                     else
2589                         echo "Cannot find myread, sorry.  Aborting." >&2
2590                         exit 1
2591                     fi
2592                 fi  
2593                 case "$ans" in
2594                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2595                 esac
2596             fi
2597         fi
2598     fi
2599     $rm -f try try.*
2600     ;;
2601 esac
2602 EOSC
2603
2604 cat <<EOS >checkcc
2605 $startsh
2606 EOS
2607 cat <<'EOSC' >>checkcc
2608 case "$cc" in        
2609 '') ;;
2610 *)  $rm -f try try.*              
2611     $cat >try.c <<EOM
2612 int main(int argc, char *argv[]) {
2613   return 0;
2614 }
2615 EOM
2616     if $cc -o try $ccflags $ldflags try.c; then
2617        :
2618     else
2619         if $test X"$despair" = Xyes; then
2620            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2621         fi
2622         $cat >&4 <<EOM         
2623 You need to find a working C compiler.
2624 Either (purchase and) install the C compiler supplied by your OS vendor,
2625 or for a free C compiler try http://gcc.gnu.org/
2626 I cannot continue any further, aborting.
2627 EOM
2628         exit 1
2629     fi
2630     $rm -f try try.*
2631     ;;
2632 esac
2633 EOSC
2634
2635 : determine whether symbolic links are supported
2636 echo " "
2637 $touch blurfl
2638 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2639         echo "Symbolic links are supported." >&4
2640         lns="$ln -s"
2641 else
2642         echo "Symbolic links are NOT supported." >&4
2643         lns="$ln"
2644 fi
2645 $rm -f blurfl sym
2646
2647 : determine whether symbolic links are supported
2648 echo " "
2649 case "$lns" in
2650 *"ln"*" -s")
2651         echo "Checking how to test for symbolic links..." >&4
2652         $lns blurfl sym
2653         if $test "X$issymlink" = X; then
2654                 case "$newsh" in
2655                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2656                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2657                 esac
2658                 if test $? = 0; then
2659                         issymlink="test -h"
2660                 else
2661                         echo "Your builtin 'test -h' may be broken." >&4
2662                         case "$test" in
2663                         /*)     ;;
2664                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2665                                 for p in $pth
2666                                 do
2667                                         if test -f "$p/$test"; then
2668                                                 test="$p/$test"
2669                                                 break
2670                                         fi
2671                                 done
2672                                 ;;
2673                         esac
2674                         case "$test" in
2675                         /*)
2676                                 echo "Trying external '$test -h'." >&4
2677                                 issymlink="$test -h"
2678                                 if $test ! -h sym >/dev/null 2>&1; then
2679                                         echo "External '$test -h' is broken, too." >&4
2680                                         issymlink=''
2681                                 fi
2682                                 ;;
2683                         *)      issymlink='' ;;
2684                         esac
2685                 fi              
2686         fi
2687         if $test "X$issymlink" = X; then
2688                 if $test -L sym 2>/dev/null; then
2689                         issymlink="$test -L"
2690                         echo "The builtin '$test -L' worked." >&4
2691                 fi
2692         fi
2693         if $test "X$issymlink" != X; then
2694                 echo "You can test for symbolic links with '$issymlink'." >&4
2695         else
2696                 echo "I do not know how you can test for symbolic links." >&4
2697         fi
2698         $rm -f blurfl sym
2699         ;;
2700 *)      echo "No symbolic links, so not testing for their testing..." >&4
2701         ;;
2702 esac
2703 echo " "
2704
2705 : Make symlinks util
2706 case "$mksymlinks" in
2707 $define|true|[yY]*)
2708         case "$src" in
2709         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2710                 exit 1
2711                 ;;
2712         *)      case "$lns:$issymlink" in
2713                 *"ln"*" -s:"*"test -"?)
2714                         echo "Creating the symbolic links..." >&4
2715                         echo "(First creating the subdirectories...)" >&4
2716                         cd ..
2717                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2718                                 read directory
2719                                 test -z "$directory" && break
2720                                 mkdir -p $directory
2721                         done
2722                         # Sanity check 1.
2723                         if test ! -d t/base; then
2724                                 echo "Failed to create the subdirectories.  Aborting." >&4
2725                                 exit 1
2726                         fi
2727                         echo "(Then creating the symlinks...)" >&4
2728                         awk '{print $1}' $src/MANIFEST | while true; do
2729                                 read filename
2730                                 test -z "$filename" && break
2731                                 if test -f $filename; then
2732                                         if $issymlink $filename; then
2733                                                 rm -f $filename
2734                                         fi
2735                                 fi
2736                                 if test -f $filename; then
2737                                         echo "$filename already exists, not symlinking."
2738                                 else
2739                                         ln -s $src/$filename $filename
2740                                 fi
2741                         done
2742                         # Sanity check 2.
2743                         if test ! -f t/base/lex.t; then
2744                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2745                                 exit 1
2746                         fi
2747                         cd UU
2748                         ;;
2749                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2750                         ;;
2751                 esac
2752                 ;;
2753         esac
2754         ;;
2755 esac
2756
2757 : Check for Cross-Compilation
2758 case "$usecrosscompile" in
2759 $define|true|[yY]*)
2760         $echo "Cross-compiling..."
2761         croak=''
2762         case "$cc" in
2763         *-*-gcc) # A cross-compiling gcc, probably.
2764             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2765             ar=$targetarch-ar
2766             # leave out ld, choosing it is more complex
2767             nm=$targetarch-nm
2768             ranlib=$targetarch-ranlib
2769             $echo 'extern int foo;' > try.c
2770             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2771             shift
2772             if $test $# -gt 0; then
2773                 incpth="$incpth $*"
2774                 incpth="`$echo $incpth|$sed 's/^ //'`"
2775                 echo "Guessing incpth '$incpth'." >&4
2776                 for i in $*; do
2777                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2778                     if $test -d $j; then
2779                         libpth="$libpth $j"
2780                     fi
2781                 done   
2782                 libpth="`$echo $libpth|$sed 's/^ //'`"
2783                 echo "Guessing libpth '$libpth'." >&4
2784             fi
2785             $rm -f try.c
2786             ;;
2787         esac
2788         case "$targetarch" in
2789         '') echo "Targetarch not defined." >&4; croak=y ;;
2790         *)  echo "Using targetarch $targetarch." >&4 ;;
2791         esac
2792         case "$incpth" in
2793         '') echo "Incpth not defined." >&4; croak=y ;;
2794         *)  echo "Using incpth '$incpth'." >&4 ;;
2795         esac
2796         case "$libpth" in
2797         '') echo "Libpth not defined." >&4; croak=y ;;
2798         *)  echo "Using libpth '$libpth'." >&4 ;;
2799         esac
2800         case "$usrinc" in
2801         '') for i in $incpth; do
2802                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2803                     usrinc=$i
2804                     echo "Guessing usrinc $usrinc." >&4
2805                     break
2806                 fi
2807             done
2808             case "$usrinc" in
2809             '') echo "Usrinc not defined." >&4; croak=y ;;
2810             esac
2811             ;;
2812         *)  echo "Using usrinc $usrinc." >&4 ;;
2813         esac
2814         case "$targethost" in
2815         '') echo "Targethost not defined." >&4; croak=y ;;
2816         *)  echo "Using targethost $targethost." >&4
2817         esac
2818         locincpth=' '
2819         loclibpth=' '
2820         case "$croak" in
2821         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2822         esac
2823         case "$src" in
2824         /*) run=$src/Cross/run
2825             targetmkdir=$src/Cross/mkdir
2826             to=$src/Cross/to
2827             from=$src/Cross/from
2828             ;;
2829         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2830             run=$pwd/Cross/run
2831             targetmkdir=$pwd/Cross/mkdir
2832             to=$pwd/Cross/to
2833             from=$pwd/Cross/from
2834             ;;
2835         esac
2836         case "$targetrun" in
2837         '') targetrun=ssh ;;
2838         esac
2839         case "$targetto" in
2840         '') targetto=scp ;;
2841         esac
2842         case "$targetfrom" in
2843         '') targetfrom=scp ;;
2844         esac
2845         run=$run-$targetrun
2846         to=$to-$targetto
2847         from=$from-$targetfrom
2848         case "$targetdir" in
2849         '')  targetdir=/tmp
2850              echo "Guessing targetdir $targetdir." >&4
2851              ;;
2852         esac
2853         case "$targetuser" in
2854         '')  targetuser=root
2855              echo "Guessing targetuser $targetuser." >&4
2856              ;;
2857         esac
2858         case "$targetfrom" in
2859         scp)    q=-q ;;
2860         *)      q='' ;;
2861         esac
2862         case "$targetrun" in
2863         ssh|rsh)
2864             cat >$run <<EOF
2865 #!/bin/sh
2866 case "\$1" in
2867 -cwd)
2868   shift
2869   cwd=\$1
2870   shift
2871   ;;
2872 esac
2873 case "\$cwd" in
2874 '') cwd=$targetdir ;;
2875 esac
2876 exe=\$1
2877 shift
2878 if $test ! -f \$exe.xok; then
2879   $to \$exe
2880   $touch \$exe.xok
2881 fi
2882 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2883 EOF
2884             ;;
2885         *)  echo "Unknown targetrun '$targetrun'" >&4
2886             exit 1
2887             ;;
2888         esac
2889         case "$targetmkdir" in
2890         */Cross/mkdir)
2891             cat >$targetmkdir <<EOF
2892 #!/bin/sh
2893 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2894 EOF
2895             $chmod a+rx $targetmkdir
2896             ;;
2897         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2898             exit 1
2899             ;;
2900         esac
2901         case "$targetto" in
2902         scp|rcp)
2903             cat >$to <<EOF
2904 #!/bin/sh
2905 for f in \$@
2906 do
2907   case "\$f" in
2908   /*)
2909     $targetmkdir \`dirname \$f\`
2910     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2911     ;;
2912   *)
2913     $targetmkdir $targetdir/\`dirname \$f\`
2914     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2915     ;;
2916   esac
2917 done
2918 exit 0
2919 EOF
2920             ;;
2921         cp) cat >$to <<EOF
2922 #!/bin/sh
2923 for f in \$@
2924 do
2925   case "\$f" in
2926   /*)
2927     $mkdir -p $targetdir/\`dirname \$f\`
2928     $cp \$f $targetdir/\$f || exit 1
2929     ;;
2930   *)
2931     $targetmkdir $targetdir/\`dirname \$f\`
2932     $cp \$f $targetdir/\$f || exit 1
2933     ;;
2934   esac
2935 done
2936 exit 0
2937 EOF
2938             ;;
2939         *)  echo "Unknown targetto '$targetto'" >&4
2940             exit 1
2941             ;;
2942         esac
2943         case "$targetfrom" in
2944         scp|rcp)
2945           cat >$from <<EOF
2946 #!/bin/sh
2947 for f in \$@
2948 do
2949   $rm -f \$f
2950   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2951 done
2952 exit 0
2953 EOF
2954             ;;
2955         cp) cat >$from <<EOF
2956 #!/bin/sh
2957 for f in \$@
2958 do
2959   $rm -f \$f
2960   cp $targetdir/\$f . || exit 1
2961 done
2962 exit 0
2963 EOF
2964             ;;
2965         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2966             exit 1
2967             ;;
2968         esac
2969         if $test ! -f $run; then
2970             echo "Target 'run' script '$run' not found." >&4
2971         else
2972             $chmod a+rx $run
2973         fi
2974         if $test ! -f $to; then
2975             echo "Target 'to' script '$to' not found." >&4
2976         else
2977             $chmod a+rx $to
2978         fi
2979         if $test ! -f $from; then
2980             echo "Target 'from' script '$from' not found." >&4
2981         else
2982             $chmod a+rx $from
2983         fi
2984         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2985             exit 1
2986         fi
2987         cat >&4 <<EOF
2988 Using '$run' for remote execution,
2989 and '$from' and '$to'
2990 for remote file transfer.
2991 EOF
2992         ;;
2993 *)      run=''
2994         to=:
2995         from=:
2996         usecrosscompile='undef'
2997         targetarch=''
2998         ;;
2999 esac
3000
3001 : see whether [:lower:] and [:upper:] are supported character classes
3002 echo " "
3003 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3004 ABYZ)
3005         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3006         up='[:upper:]'
3007         low='[:lower:]'
3008         ;;
3009 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3010         # (0xd9 and 0xe2), therefore that is a nice testing point.
3011         if test "X$up" = X -o "X$low" = X; then
3012             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3013             rs) up='[A-Z]'
3014                 low='[a-z]'
3015                 ;;
3016             esac
3017         fi
3018         if test "X$up" = X -o "X$low" = X; then
3019             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3020             rs) up='A-Z'
3021                 low='a-z'
3022                 ;;
3023             esac
3024         fi
3025         if test "X$up" = X -o "X$low" = X; then
3026             case "`echo RS | od -x 2>/dev/null`" in
3027             *D9E2*|*d9e2*)
3028                 echo "Hey, this might be EBCDIC." >&4
3029                 if test "X$up" = X -o "X$low" = X; then
3030                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3031                     rs) up='[A-IJ-RS-Z]'
3032                         low='[a-ij-rs-z]'
3033                         ;;
3034                     esac
3035                 fi
3036                 if test "X$up" = X -o "X$low" = X; then
3037                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3038                     rs) up='A-IJ-RS-Z'
3039                         low='a-ij-rs-z'
3040                         ;;
3041                     esac
3042                 fi
3043                 ;;
3044             esac
3045         fi
3046 esac
3047 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3048 rs)
3049     echo "Using $up and $low to convert case." >&4
3050     ;;
3051 *)
3052     echo "I don't know how to translate letters from upper to lower case." >&4
3053     echo "Your tr is not acting any way I know of." >&4
3054     exit 1
3055     ;;
3056 esac
3057 : set up the translation script tr, must be called with ./tr of course
3058 cat >tr <<EOSC
3059 $startsh
3060 case "\$1\$2" in
3061 '[A-Z][a-z]') exec $tr '$up' '$low';;
3062 '[a-z][A-Z]') exec $tr '$low' '$up';;
3063 esac
3064 exec $tr "\$@"
3065 EOSC
3066 chmod +x tr
3067 $eunicefix tr
3068
3069 : Try to determine whether config.sh was made on this system
3070 case "$config_sh" in
3071 '')
3072 myuname=`$uname -a 2>/dev/null`
3073 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3074 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3075 # because the A-Z/a-z are not consecutive.
3076 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3077         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3078 newmyuname="$myuname"
3079 dflt=n
3080 case "$knowitall" in
3081 '')
3082         if test -f ../config.sh; then
3083                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3084                         eval "`grep myuname= ../config.sh`"
3085                 fi
3086                 if test "X$myuname" = "X$newmyuname"; then
3087                         dflt=y
3088                 fi
3089         fi
3090         ;;
3091 *) dflt=y;;
3092 esac
3093
3094 : Get old answers from old config file if Configure was run on the
3095 : same system, otherwise use the hints.
3096 hint=default
3097 cd ..
3098 if test -f config.sh; then
3099         echo " "
3100         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3101         . UU/myread
3102         case "$ans" in
3103         n*|N*) echo "OK, I'll ignore it."
3104                 mv config.sh config.sh.old
3105                 myuname="$newmyuname"
3106                 ;;
3107         *)  echo "Fetching default answers from your old config.sh file..." >&4
3108                 tmp_n="$n"
3109                 tmp_c="$c"
3110                 tmp_sh="$sh"
3111                 . ./config.sh
3112                 cp config.sh UU
3113                 n="$tmp_n"
3114                 c="$tmp_c"
3115                 : Older versions did not always set $sh.  Catch re-use of such
3116                 : an old config.sh.
3117                 case "$sh" in
3118                 '') sh="$tmp_sh" ;;
3119                 esac
3120                 hint=previous
3121                 ;;
3122         esac
3123 fi
3124 . ./UU/checkcc
3125 if test ! -f config.sh; then
3126         $cat <<EOM
3127
3128 First time through, eh?  I have some defaults handy for some systems
3129 that need some extra help getting the Configure answers right:
3130
3131 EOM
3132         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3133         dflt=''
3134         : Half the following guesses are probably wrong... If you have better
3135         : tests or hints, please send them to perlbug@perl.org
3136         : The metaconfig authors would also appreciate a copy...
3137         $test -f /irix && osname=irix
3138         $test -f /xenix && osname=sco_xenix
3139         $test -f /dynix && osname=dynix
3140         $test -f /dnix && osname=dnix
3141         $test -f /lynx.os && osname=lynxos
3142         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3143         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3144         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3145         $test -f /bin/mips && /bin/mips && osname=mips
3146         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3147                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3148         $test -d /usr/apollo/bin && osname=apollo
3149         $test -f /etc/saf/_sactab && osname=svr4
3150         $test -d /usr/include/minix && osname=minix
3151         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3152         if $test -d /MachTen -o -d /MachTen_Folder; then
3153                 osname=machten
3154                 if $test -x /sbin/version; then
3155                         osvers=`/sbin/version | $awk '{print $2}' |
3156                         $sed -e 's/[A-Za-z]$//'`
3157                 elif $test -x /usr/etc/version; then
3158                         osvers=`/usr/etc/version | $awk '{print $2}' |
3159                         $sed -e 's/[A-Za-z]$//'`
3160                 else
3161                         osvers="$2.$3"
3162                 fi
3163         fi
3164
3165         $test -f /sys/posix.dll &&
3166                 $test -f /usr/bin/what &&
3167                 set X `/usr/bin/what /sys/posix.dll` &&
3168                 $test "$3" = UWIN &&
3169                 osname=uwin &&
3170                 osvers="$5"
3171
3172         if $test -f $uname; then
3173                 set X $myuname
3174                 shift
3175
3176                 case "$5" in
3177                 fps*) osname=fps ;;
3178                 mips*)
3179                         case "$4" in
3180                         umips) osname=umips ;;
3181                         *) osname=mips ;;
3182                         esac;;
3183                 [23]100) osname=mips ;;
3184                 next*) osname=next ;;
3185                 i386*)
3186                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3187                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3188                                 osname='sco'
3189                                 osvers=$tmp
3190                         elif $test -f /etc/kconfig; then
3191                                 osname=isc
3192                                 if test "$lns" = "$ln -s"; then
3193                                         osvers=4
3194                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3195                                         osvers=3
3196                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3197                                         osvers=2
3198                                 fi
3199                         fi
3200                         tmp=''
3201                         ;;
3202                 pc*)
3203                         if test -n "$DJGPP"; then
3204                                 osname=dos
3205                                 osvers=djgpp
3206                         fi
3207                         ;;
3208                 esac
3209
3210                 case "$1" in
3211                 aix) osname=aix
3212                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3213                         case "$tmp" in
3214                         # oslevel can fail with:
3215                         # oslevel: Unable to acquire lock.
3216                         *not\ found) osvers="$4"."$3" ;;
3217                         '<3240'|'<>3240') osvers=3.2.0 ;;
3218                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3219                         '=3250'|'>3250') osvers=3.2.5 ;;
3220                         *) osvers=$tmp;;
3221                         esac
3222                         ;;
3223                 bsd386) osname=bsd386
3224                         osvers=`$uname -r`
3225                         ;;
3226                 cygwin*) osname=cygwin
3227                         osvers="$3"
3228                         ;;
3229                 *dc.osx) osname=dcosx
3230                         osvers="$3"
3231                         ;;
3232                 dnix) osname=dnix
3233                         osvers="$3"
3234                         ;;
3235                 domainos) osname=apollo
3236                         osvers="$3"
3237                         ;;
3238                 dgux)   osname=dgux
3239                         osvers="$3"
3240                         ;;
3241                 dragonfly) osname=dragonfly
3242                         osvers="$3"
3243                         ;;
3244                 dynixptx*) osname=dynixptx
3245                         osvers=`echo "$4"|sed 's/^v//'`
3246                         ;;
3247                 freebsd) osname=freebsd
3248                         osvers="$3" ;;
3249                 genix)  osname=genix ;;
3250                 gnu)    osname=gnu
3251                         osvers="$3" ;;
3252                 hp*)    osname=hpux
3253                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3254                         ;;
3255                 irix*)  osname=irix
3256                         case "$3" in
3257                         4*) osvers=4 ;;
3258                         5*) osvers=5 ;;
3259                         *)      osvers="$3" ;;
3260                         esac
3261                         ;;
3262                 linux)  osname=linux
3263                         case "$3" in
3264                         *)      osvers="$3" ;;
3265                         esac
3266                         ;;
3267                 MiNT)   osname=mint
3268                         ;;
3269                 netbsd*) osname=netbsd
3270                         osvers="$3"
3271                         ;;
3272                 news-os) osvers="$3"
3273                         case "$3" in
3274                         4*) osname=newsos4 ;;
3275                         *) osname=newsos ;;
3276                         esac
3277                         ;;
3278                 next*) osname=next ;;
3279                 nonstop-ux) osname=nonstopux ;;
3280                 openbsd) osname=openbsd
3281                         osvers="$3"
3282                         ;;
3283                 os2)    osname=os2
3284                         osvers="$4"
3285                         ;;
3286                 POSIX-BC | posix-bc ) osname=posix-bc
3287                         osvers="$3"
3288                         ;;
3289                 powerux | power_ux | powermax_os | powermaxos | \
3290                 powerunix | power_unix) osname=powerux
3291                         osvers="$3"
3292                         ;;
3293                 qnx) osname=qnx
3294                         osvers="$4"
3295                         ;;
3296                 solaris) osname=solaris
3297                         case "$3" in
3298                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3299                         *)      osvers="$3" ;;
3300                         esac
3301                         ;;
3302                 sunos) osname=sunos
3303                         case "$3" in
3304                         5*) osname=solaris
3305                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3306                         *)      osvers="$3" ;;
3307                         esac
3308                         ;;
3309                 titanos) osname=titanos
3310                         case "$3" in
3311                         1*) osvers=1 ;;
3312                         2*) osvers=2 ;;
3313                         3*) osvers=3 ;;
3314                         4*) osvers=4 ;;
3315                         *)      osvers="$3" ;;
3316                         esac
3317                         ;;
3318                 ultrix) osname=ultrix
3319                         osvers="$3"
3320                         ;;
3321                 osf1|mls+)      case "$5" in
3322                                 alpha)
3323                                         osname=dec_osf
3324                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3325                                         case "$osvers" in
3326                                         [1-9].[0-9]*) ;;
3327                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3328                                         esac
3329                                         ;;
3330                         hp*)    osname=hp_osf1  ;;
3331                         mips)   osname=mips_osf1 ;;
3332                         esac
3333                         ;;
3334                 # UnixWare 7.1.2 is known as Open UNIX 8
3335                 openunix|unixware) osname=svr5
3336                         osvers="$4"
3337                         ;;
3338                 uts)    osname=uts
3339                         osvers="$3"
3340                         ;;
3341                 vos) osvers="$3"
3342                         ;;
3343                 $2) case "$osname" in
3344                         *isc*) ;;
3345                         *freebsd*) ;;
3346                         svr*)
3347                                 : svr4.x or possibly later
3348                                 case "svr$3" in
3349                                 ${osname}*)
3350                                         osname=svr$3
3351                                         osvers=$4
3352                                         ;;
3353                                 esac
3354                                 case "$osname" in
3355                                 svr4.0)
3356                                         : Check for ESIX
3357                                         if test -f /stand/boot ; then
3358                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3359                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3360                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3361                                                         if test -n "$isesix"; then
3362                                                                 osname=esix4
3363                                                         fi
3364                                                 fi
3365                                         fi
3366                                         ;;
3367                                 esac
3368                                 ;;
3369                         *)      if test -f /etc/systemid; then
3370                                         osname=sco
3371                                         set `echo $3 | $sed 's/\./ /g'` $4
3372                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3373                                                 osvers=$1.$2.$3
3374                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3375                                                 osvers=$1.$2
3376                                         elif $test -f $src/hints/sco_$1.sh; then
3377                                                 osvers=$1
3378                                         fi
3379                                 else
3380                                         case "$osname" in
3381                                         '') : Still unknown.  Probably a generic Sys V.
3382                                                 osname="sysv"
3383                                                 osvers="$3"
3384                                                 ;;
3385                                         esac
3386                                 fi
3387                                 ;;
3388                         esac
3389                         ;;
3390                 *)      case "$osname" in
3391                         '') : Still unknown.  Probably a generic BSD.
3392                                 osname="$1"
3393                                 osvers="$3"
3394                                 ;;
3395                         esac
3396                         ;;
3397                 esac
3398         else
3399                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3400                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3401                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3402                                 osname=news_os
3403                         fi
3404                         $rm -f UU/kernel.what
3405                 elif test -d c:/. -o -n "$is_os2" ; then
3406                         set X $myuname
3407                         osname=os2
3408                         osvers="$5"
3409                 fi
3410         fi
3411
3412         case "$targetarch" in
3413         '') ;;
3414         *)  hostarch=$osname
3415             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3416             osvers=''
3417             ;;
3418         esac
3419
3420         : Now look for a hint file osname_osvers, unless one has been
3421         : specified already.
3422         case "$hintfile" in
3423         ''|' ')
3424                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3425                 : Also try without trailing minor version numbers.
3426                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3427                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3428                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3429                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3430                 case "$file" in
3431                 '') dflt=none ;;
3432                 *)  case "$osvers" in
3433                         '') dflt=$file
3434                                 ;;
3435                         *)  if $test -f $src/hints/$file.sh ; then
3436                                         dflt=$file
3437                                 elif $test -f $src/hints/$xfile.sh ; then
3438                                         dflt=$xfile
3439                                 elif $test -f $src/hints/$xxfile.sh ; then
3440                                         dflt=$xxfile
3441                                 elif $test -f $src/hints/$xxxfile.sh ; then
3442                                         dflt=$xxxfile
3443                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3444                                         dflt=$xxxxfile
3445                                 elif $test -f "$src/hints/${osname}.sh" ; then
3446                                         dflt="${osname}"
3447                                 else
3448                                         dflt=none
3449                                 fi
3450                                 ;;
3451                         esac
3452                         ;;
3453                 esac
3454                 if $test -f Policy.sh ; then
3455                         case "$dflt" in
3456                         *Policy*) ;;
3457                         none) dflt="Policy" ;;
3458                         *) dflt="Policy $dflt" ;;
3459                         esac
3460                 fi
3461                 ;;
3462         *)
3463                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3464                 ;;
3465         esac
3466
3467         if $test -f Policy.sh ; then
3468                 $cat <<EOM
3469
3470 There's also a Policy hint file available, which should make the
3471 site-specific (policy) questions easier to answer.
3472 EOM
3473
3474         fi
3475
3476         $cat <<EOM
3477
3478 You may give one or more space-separated answers, or "none" if appropriate.
3479 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3480 previous run of Configure, you may specify it as well as or instead of
3481 OS-specific hints.  If hints are provided for your OS, you should use them:
3482 although Perl can probably be built without hints on many platforms, using
3483 hints often improve performance and may enable features that Configure can't
3484 set up on its own. If there are no hints that match your OS, specify "none";
3485 DO NOT give a wrong version or a wrong OS.
3486
3487 EOM
3488
3489         rp="Which of these apply, if any?"
3490         . UU/myread
3491         tans=$ans
3492         for file in $tans; do
3493                 if $test X$file = XPolicy -a -f Policy.sh; then
3494                         . Policy.sh
3495                         $cat Policy.sh >> UU/config.sh
3496                 elif $test -f $src/hints/$file.sh; then
3497                         . $src/hints/$file.sh
3498                         $cat $src/hints/$file.sh >> UU/config.sh
3499                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3500                         : nothing
3501                 else
3502                         : Give one chance to correct a possible typo.
3503                         echo "$file.sh does not exist"
3504                         dflt=$file
3505                         rp="hint to use instead?"
3506                         . UU/myread
3507                         for file in $ans; do
3508                                 if $test -f "$src/hints/$file.sh"; then
3509                                         . $src/hints/$file.sh
3510                                         $cat $src/hints/$file.sh >> UU/config.sh
3511                                 elif $test X$ans = X -o X$ans = Xnone ; then
3512                                         : nothing
3513                                 else
3514                                         echo "$file.sh does not exist -- ignored."
3515                                 fi
3516                         done
3517                 fi
3518         done
3519
3520         hint=recommended
3521         : Remember our hint file for later.
3522         if $test -f "$src/hints/$file.sh" ; then
3523                 hintfile="$file"
3524         else
3525                 hintfile=''
3526         fi
3527 fi
3528 cd UU
3529 ;;
3530 *)
3531         echo " "
3532         echo "Fetching default answers from $config_sh..." >&4
3533         tmp_n="$n"
3534         tmp_c="$c"
3535         cd ..
3536         cp $config_sh config.sh 2>/dev/null
3537         chmod +w config.sh
3538         . ./config.sh
3539         cd UU
3540         cp ../config.sh .
3541         n="$tmp_n"
3542         c="$tmp_c"
3543         hint=previous
3544         ;;
3545 esac
3546 test "$override" && . ./optdef.sh
3547
3548 : Restore computed paths
3549 for file in $loclist $trylist; do
3550         eval $file="\$_$file"
3551 done
3552
3553 cat << EOM
3554
3555 Configure uses the operating system name and version to set some defaults.
3556 The default value is probably right if the name rings a bell. Otherwise,
3557 since spelling matters for me, either accept the default or answer "none"
3558 to leave it blank.
3559
3560 EOM
3561 case "$osname" in
3562         ''|' ')
3563                 case "$hintfile" in
3564                 ''|' '|none) dflt=none ;;
3565                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3566                 esac
3567                 ;;
3568         *) dflt="$osname" ;;
3569 esac
3570 rp="Operating system name?"
3571 . ./myread
3572 case "$ans" in
3573 none)  osname='' ;;
3574 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3575 esac
3576 echo " "
3577 case "$osvers" in
3578         ''|' ')
3579                 case "$hintfile" in
3580                 ''|' '|none) dflt=none ;;
3581                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3582                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3583                         case "$dflt" in
3584                         ''|' ') dflt=none ;;
3585                         esac
3586                         ;;
3587                 esac
3588                 ;;
3589         *) dflt="$osvers" ;;
3590 esac
3591 rp="Operating system version?"
3592 . ./myread
3593 case "$ans" in
3594 none)  osvers='' ;;
3595 *) osvers="$ans" ;;
3596 esac
3597
3598
3599 . ./posthint.sh
3600
3601 : who configured the system
3602 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3603 case "$cf_by" in
3604 "")
3605         cf_by=`(logname) 2>/dev/null`
3606         case "$cf_by" in
3607         "")
3608                 cf_by=`(whoami) 2>/dev/null`
3609                 case "$cf_by" in
3610                 "") cf_by=unknown ;;
3611                 esac ;;
3612         esac ;;
3613 esac
3614
3615 : decide how portable to be.  Allow command line overrides.
3616 case "$d_portable" in
3617 "$undef") ;;
3618 *)      d_portable="$define" ;;
3619 esac
3620
3621 : set up shell script to do ~ expansion
3622 cat >filexp <<EOSS
3623 $startsh
3624 : expand filename
3625 case "\$1" in
3626  \~/*|\~)
3627         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3628         ;;
3629  \~*)
3630         if $test -f /bin/csh; then
3631                 /bin/csh -f -c "glob \$1"
3632                 failed=\$?
3633                 echo ""
3634                 exit \$failed
3635         else
3636                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3637                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3638                 if $test ! -d "\$dir"; then
3639                         me=\`basename \$0\`
3640                         echo "\$me: can't locate home directory for: \$name" >&2
3641                         exit 1
3642                 fi
3643                 case "\$1" in
3644                 */*)
3645                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3646                         ;;
3647                 *)
3648                         echo \$dir
3649                         ;;
3650                 esac
3651         fi
3652         ;;
3653 *)
3654         echo \$1
3655         ;;
3656 esac
3657 EOSS
3658 chmod +x filexp
3659 $eunicefix filexp
3660
3661 : now set up to get a file name
3662 cat <<EOS >getfile
3663 $startsh
3664 EOS
3665 cat <<'EOSC' >>getfile
3666 tilde=''
3667 fullpath=''
3668 already=''
3669 skip=''
3670 none_ok=''
3671 exp_file=''
3672 nopath_ok=''
3673 orig_rp="$rp"
3674 orig_dflt="$dflt"
3675 case "$gfpth" in
3676 '') gfpth='.' ;;
3677 esac
3678
3679 case "$fn" in
3680 *\(*)
3681         : getfile will accept an answer from the comma-separated list
3682         : enclosed in parentheses even if it does not meet other criteria.
3683         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3684         fn=`echo $fn | sed 's/(.*)//'`
3685         ;;
3686 esac
3687
3688 case "$fn" in
3689 *:*)
3690         loc_file=`expr $fn : '.*:\(.*\)'`
3691         fn=`expr $fn : '\(.*\):.*'`
3692         ;;
3693 esac
3694
3695 case "$fn" in
3696 *~*) tilde=true;;
3697 esac
3698 case "$fn" in
3699 */*) fullpath=true;;
3700 esac
3701 case "$fn" in
3702 *+*) skip=true;;
3703 esac
3704 case "$fn" in
3705 *n*) none_ok=true;;
3706 esac
3707 case "$fn" in
3708 *e*) exp_file=true;;
3709 esac
3710 case "$fn" in
3711 *p*) nopath_ok=true;;
3712 esac
3713
3714 case "$fn" in
3715 *f*) type='File';;
3716 *d*) type='Directory';;
3717 *l*) type='Locate';;
3718 esac
3719
3720 what="$type"
3721 case "$what" in
3722 Locate) what='File';;
3723 esac
3724
3725 case "$exp_file" in
3726 '')
3727         case "$d_portable" in
3728         "$define") ;;
3729         *) exp_file=true;;
3730         esac
3731         ;;
3732 esac
3733
3734 cd ..
3735 while test "$type"; do
3736         redo=''
3737         rp="$orig_rp"
3738         dflt="$orig_dflt"
3739         case "$tilde" in
3740         true) rp="$rp (~name ok)";;
3741         esac
3742         . UU/myread
3743         if test -f UU/getfile.ok && \
3744                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3745         then
3746                 value="$ans"
3747                 ansexp="$ans"
3748                 break
3749         fi
3750         case "$ans" in
3751         none)
3752                 value=''
3753                 ansexp=''
3754                 case "$none_ok" in
3755                 true) type='';;
3756                 esac
3757                 ;;
3758         *)
3759                 case "$tilde" in
3760                 '') value="$ans"
3761                         ansexp="$ans";;
3762                 *)
3763                         value=`UU/filexp $ans`
3764                         case $? in
3765                         0)
3766                                 if test "$ans" != "$value"; then
3767                                         echo "(That expands to $value on this system.)"
3768                                 fi
3769                                 ;;
3770                         *) value="$ans";;
3771                         esac
3772                         ansexp="$value"
3773                         case "$exp_file" in
3774                         '') value="$ans";;
3775                         esac
3776                         ;;
3777                 esac
3778                 case "$fullpath" in
3779                 true)
3780                         case "$ansexp" in
3781                         /*) value="$ansexp" ;;
3782                         [a-zA-Z]:/*) value="$ansexp" ;;
3783                         *)
3784                                 redo=true
3785                                 case "$already" in
3786                                 true)
3787                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3788                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3789                                         ;;
3790                                 *)
3791                                 echo "Please give a full path name, starting with slash." >&4
3792                                         case "$tilde" in
3793                                         true)
3794                                 echo "Note that using ~name is ok provided it expands well." >&4
3795                                                 already=true
3796                                                 ;;
3797                                         esac
3798                                 esac
3799                                 ;;
3800                         esac
3801                         ;;
3802                 esac
3803                 case "$redo" in
3804                 '')
3805                         case "$type" in
3806                         File)
3807                                 for fp in $gfpth; do
3808                                         if test "X$fp" = X.; then
3809                                             pf="$ansexp"
3810                                         else    
3811                                             pf="$fp/$ansexp"
3812                                         fi
3813                                         if test -f "$pf"; then
3814                                                 type=''
3815                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3816                                         then
3817                                                 echo "($value is not a plain file, but that's ok.)"
3818                                                 type=''
3819                                         fi
3820                                         if test X"$type" = X; then
3821                                             value="$pf"
3822                                             break
3823                                         fi
3824                                 done
3825                                 ;;
3826                         Directory)
3827                                 for fp in $gfpth; do
3828                                         if test "X$fp" = X.; then
3829                                             dir="$ans"
3830                                             direxp="$ansexp"
3831                                         else    
3832                                             dir="$fp/$ansexp"
3833                                             direxp="$fp/$ansexp"
3834                                         fi
3835                                         if test -d "$direxp"; then
3836                                                 type=''
3837                                                 value="$dir"
3838                                                 break
3839                                         fi
3840                                 done
3841                                 ;;
3842                         Locate)
3843                                 if test -d "$ansexp"; then
3844                                         echo "(Looking for $loc_file in directory $value.)"
3845                                         value="$value/$loc_file"
3846                                         ansexp="$ansexp/$loc_file"
3847                                 fi
3848                                 if test -f "$ansexp"; then
3849                                         type=''
3850                                 fi
3851                                 case "$nopath_ok" in
3852                                 true)   case "$value" in
3853                                         */*) ;;
3854                                         *)      echo "Assuming $value will be in people's path."
3855                                                 type=''
3856                                                 ;;
3857                                         esac
3858                                         ;;
3859                                 esac
3860                                 ;;
3861                         esac
3862
3863                         case "$skip" in
3864                         true) type='';
3865                         esac
3866
3867                         case "$type" in
3868                         '') ;;
3869                         *)
3870                                 if test "$fastread" = yes; then
3871                                         dflt=y
3872                                 else
3873                                         dflt=n
3874                                 fi
3875                                 rp="$what $value doesn't exist.  Use that name anyway?"
3876                                 . UU/myread
3877                                 dflt=''
3878                                 case "$ans" in
3879                                 y*) type='';;
3880                                 *) echo " ";;
3881                                 esac
3882                                 ;;
3883                         esac
3884                         ;;
3885                 esac
3886                 ;;
3887         esac
3888 done
3889 cd UU
3890 ans="$value"
3891 rp="$orig_rp"
3892 dflt="$orig_dflt"
3893 rm -f getfile.ok
3894 test "X$gfpthkeep" != Xy && gfpth=""
3895 EOSC
3896
3897 : determine root of directory hierarchy where package will be installed.
3898 case "$prefix" in
3899 '')
3900         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3901         ;;
3902 *?/)
3903         dflt=`echo "$prefix" | sed 's/.$//'`
3904         ;;
3905 *)
3906         dflt="$prefix"
3907         ;;
3908 esac
3909 $cat <<EOM
3910
3911 By default, $package will be installed in $dflt/bin, manual pages
3912 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3913 installation directories. Typically this is something like /usr/local.
3914 If you wish to have binaries under /usr/bin but other parts of the
3915 installation under /usr/local, that's ok: you will be prompted
3916 separately for each of the installation directories, the prefix being
3917 only used to set the defaults.
3918
3919 EOM
3920 fn=d~
3921 rp='Installation prefix to use?'
3922 . ./getfile
3923 oldprefix=''
3924 case "$prefix" in
3925 '') ;;
3926 *)
3927         case "$ans" in
3928         "$prefix") ;;
3929         *) oldprefix="$prefix";;
3930         esac
3931         ;;
3932 esac
3933 prefix="$ans"
3934 prefixexp="$ansexp"
3935
3936 : allow them to override the AFS root
3937 case "$afsroot" in
3938 '')     afsroot=/afs ;;
3939 *)      afsroot=$afsroot ;;
3940 esac
3941
3942 : is AFS running?
3943 echo " "
3944 case "$afs" in
3945 $define|true)   afs=true ;;
3946 $undef|false)   afs=false ;;
3947 *)      if $test -d $afsroot; then
3948                 afs=true
3949         else
3950                 afs=false
3951         fi
3952         ;;
3953 esac
3954 if $afs; then
3955         echo "AFS may be running... I'll be extra cautious then..." >&4
3956 else
3957         echo "AFS does not seem to be running..." >&4
3958 fi
3959
3960 : determine installation prefix for where package is to be installed.
3961 if $afs; then 
3962 $cat <<EOM
3963
3964 Since you are running AFS, I need to distinguish the directory in which
3965 files will reside from the directory in which they are installed (and from
3966 which they are presumably copied to the former directory by occult means).
3967
3968 EOM
3969         case "$installprefix" in
3970         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3971         *) dflt="$installprefix";;
3972         esac
3973 else
3974 $cat <<EOM
3975
3976 In some special cases, particularly when building $package for distribution,
3977 it is convenient to distinguish the directory in which files should be
3978 installed from the directory ($prefix) in which they will
3979 eventually reside.  For most users, these two directories are the same.
3980
3981 EOM
3982         case "$installprefix" in
3983         '') dflt=$prefix ;;
3984         *) dflt=$installprefix;;
3985         esac
3986 fi
3987 fn=d~
3988 rp='What installation prefix should I use for installing files?'
3989 . ./getfile
3990 installprefix="$ans"
3991 installprefixexp="$ansexp"
3992
3993 : Perform the prefixexp/installprefixexp correction if necessary
3994 cat <<EOS >installprefix
3995 $startsh
3996 EOS
3997 cat <<'EOSC' >>installprefix
3998 : Change installation prefix, if necessary.
3999 if $test X"$prefix" != X"$installprefix"; then
4000     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4001 else
4002     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4003 fi
4004 EOSC
4005 chmod +x installprefix
4006 $eunicefix installprefix
4007
4008 : Set variables such as privlib and privlibexp from the output of ./getfile
4009 : performing the prefixexp/installprefixexp correction if necessary.
4010 cat <<EOS >setprefixvar
4011 $startsh
4012 EOS
4013 cat <<'EOSC' >>setprefixvar
4014 eval "${prefixvar}=\"\$ans\""
4015 eval "${prefixvar}exp=\"\$ansexp\""
4016 . ./installprefix
4017 EOSC
4018 chmod +x setprefixvar
4019 $eunicefix setprefixvar
4020
4021 : set up the script used to warn in case of inconsistency
4022 cat <<EOS >whoa
4023 $startsh
4024 EOS
4025 cat <<'EOSC' >>whoa
4026 dflt=y
4027 case "$hint" in
4028     recommended)
4029         case "$hintfile" in
4030         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4031                 ;;
4032         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4033                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4034                 ;;
4035         esac
4036         ;;
4037     *)  echo " "
4038         echo "*** WHOA THERE!!! ***" >&4
4039         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4040         ;;
4041 esac
4042 rp="    Keep the $hint value?"
4043 . ./myread
4044 case "$ans" in
4045 y) td=$was; tu=$was;;
4046 esac
4047 EOSC
4048
4049 : function used to set '$1' to '$val'
4050 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4051 case "$val$was" in
4052 $define$undef) . ./whoa; eval "$var=\$td";;
4053 $undef$define) . ./whoa; eval "$var=\$tu";;
4054 *) eval "$var=$val";;
4055 esac'
4056
4057 : Check is we will use socks
4058 case "$usesocks" in
4059 $define|true|[yY]*)     dflt='y';;
4060 *) dflt='n';;
4061 esac
4062 cat <<EOM
4063
4064 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4065 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4066 to use the PerlIO abstraction layer, this will be implicitly selected.
4067
4068 If this doesn't make any sense to you, just accept the default '$dflt'.
4069 EOM
4070 rp='Build Perl for SOCKS?'
4071 . ./myread
4072 case "$ans" in
4073 y|Y)    val="$define" ;;
4074 *)      val="$undef" ;;
4075 esac
4076 set usesocks
4077 eval $setvar
4078
4079 case "$usesocks" in
4080 $define|true|[yY]*) useperlio="$define";;
4081 esac
4082
4083 : Check if we want perlio
4084 case "$useperlio" in
4085 $define|true|[yY]*|'')  dflt='y';;
4086 *) dflt='n';;
4087 esac
4088 cat <<EOM
4089
4090 Previous version of $package used the standard IO mechanisms as
4091 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4092 alternate IO mechanisms via the PerlIO abstraction layer, but the
4093 stdio mechanism is still available if needed.  The abstraction layer
4094 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4095 Using PerlIO with sfio may cause problems with some extension modules.
4096
4097 If this doesn't make any sense to you, just accept the default '$dflt'.
4098 EOM
4099 rp='Use the PerlIO abstraction layer?'
4100 . ./myread
4101 case "$ans" in
4102 y|Y)
4103         val="$define"
4104         ;;
4105 *)
4106         echo "Ok, doing things the stdio way."
4107         val="$undef"
4108         ;;
4109 esac
4110 set useperlio
4111 eval $setvar
4112
4113 case "$usesocks" in
4114 $define|true|[yY]*)
4115         case "$useperlio" in
4116         $define|true|[yY]*) ;;
4117         *)      cat >&4 <<EOM
4118
4119 You are using the SOCKS proxy protocol library which means that you
4120 should also use the PerlIO layer.  You may be headed for trouble.
4121
4122 EOM
4123                 ;;
4124         esac
4125         ;;
4126 esac
4127
4128 : get the patchlevel
4129 echo " "
4130 echo "Getting the current patchlevel..." >&4
4131 if $test -r $rsrc/patchlevel.h;then
4132         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4133         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4134         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4135         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4136         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4137         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4138         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4139 else
4140         revision=0
4141         patchlevel=0
4142         subversion=0
4143         api_revision=0
4144         api_version=0
4145         api_subversion=0
4146         perl_patchlevel=0
4147         $echo "(You do not have patchlevel.h.  Eek.)"
4148 fi
4149 if $test -r $rsrc/.patch ; then
4150         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4151                 perl_patchlevel=`cat $rsrc/.patch`
4152         fi
4153 fi
4154 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4155 version_patchlevel_string="version $patchlevel subversion $subversion"
4156 case "$perl_patchlevel" in
4157 0|'') ;;
4158 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4159     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4160     ;;
4161 esac
4162
4163 $echo "(You have $package $version_patchlevel_string.)"
4164
4165 case "$osname" in
4166 dos|vms)
4167         : XXX Should be a Configure test for double-dots in filenames.
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 *)
4174         version=`echo $revision $patchlevel $subversion | \
4175                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4176         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4177                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4178         ;;
4179 esac
4180 : Special case the 5.005_xx maintenance series, which used 5.005
4181 : without any subversion label as a subdirectory in $sitelib
4182 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4183         api_versionstring='5.005'
4184 fi
4185
4186 : Do we want threads support and if so, what type
4187 case "$usethreads" in
4188 $define|true|[yY]*)     dflt='y';;
4189 *)     # Catch case where user specified ithreads or 5005threads but
4190        # forgot -Dusethreads (A.D. 4/2002)
4191        case "$useithreads$use5005threads" in
4192        *$define*)
4193                 case "$useperlio" in
4194                 "$define")      dflt='y' ;;
4195                 *)              dflt='n' ;;
4196                 esac
4197                 ;;
4198        *)       dflt='n';;
4199        esac
4200        ;;
4201 esac
4202 cat <<EOM
4203
4204 Perl can be built to take advantage of threads on some systems.
4205 To do so, Configure can be run with -Dusethreads.
4206
4207 Note that Perl built with threading support runs slightly slower
4208 and uses more memory than plain Perl. The current implementation
4209 is believed to be stable, but it is fairly new, and so should be
4210 treated with caution.
4211
4212 If this doesn't make any sense to you, just accept the default '$dflt'.
4213 EOM
4214 rp='Build a threading Perl?'
4215 . ./myread
4216 case "$ans" in
4217 y|Y)    val="$define" ;;
4218 *)      val="$undef" ;;
4219 esac
4220 set usethreads
4221 eval $setvar
4222
4223 if $test $patchlevel -lt 9; then
4224     case "$usethreads" in
4225     $define)
4226         $cat <<EOM
4227
4228 Since release 5.6, Perl has had two different threading implementations,
4229 the newer interpreter-based version (ithreads) with one interpreter per
4230 thread, and the older 5.005 version (5005threads).
4231 The 5005threads version is effectively unmaintained and will probably be
4232 removed in Perl 5.10, so there should be no need to build a Perl using it
4233 unless needed for backwards compatibility with some existing 5.005threads
4234 code.
4235
4236 EOM
4237         : Default to ithreads unless overridden on command line or with
4238         : old config.sh
4239         dflt='y'
4240         case "$use5005threads" in
4241                 $define|true|[yY]*) dflt='n';;
4242         esac
4243         case "$useithreads" in
4244                 $undef|false|[nN]*) dflt='n';;
4245         esac
4246         rp='Use the newer interpreter-based ithreads?'
4247         . ./myread
4248         case "$ans" in
4249         y|Y)    val="$define" ;;
4250         *)      val="$undef" ;;
4251         esac
4252         set useithreads
4253         eval $setvar
4254         : Now set use5005threads to the opposite value.
4255         case "$useithreads" in
4256         $define) val="$undef" ;;
4257         *) val="$define" ;;
4258         esac
4259         set use5005threads
4260         eval $setvar
4261         ;;
4262     *)
4263         useithreads="$undef"
4264         use5005threads="$undef"
4265         ;;
4266     esac
4267
4268     case "$useithreads$use5005threads" in
4269     "$define$define")
4270         $cat >&4 <<EOM
4271
4272 You cannot have both the ithreads and the 5.005 threads enabled
4273 at the same time.  Disabling the 5.005 threads since they are
4274 much less stable than the ithreads.
4275
4276 EOM
4277         use5005threads="$undef"
4278         ;;
4279     esac
4280
4281 else
4282 : perl-5.9.x and later
4283
4284     if test X"$usethreads" = "X$define"; then
4285         case "$use5005threads" in
4286             $define|true|[yY]*)
4287                 $cat >&4 <<EOM
4288
4289 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4290
4291 EOM
4292             ;;
4293         esac
4294     fi
4295
4296     use5005threads="$undef"
4297     useithreads="$usethreads"
4298 fi
4299
4300 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4301         cat >&4 <<EOF
4302 ***
4303 *** To build with ithreads you must also use the PerlIO layer.
4304 *** Cannot continue, aborting.
4305 ***
4306 EOF
4307         exit 1
4308 fi
4309
4310 case "$d_oldpthreads" in
4311 '')     : Configure tests would be welcome here.  For now, assume undef.
4312         val="$undef" ;;
4313 *)      val="$d_oldpthreads" ;;
4314 esac
4315 set d_oldpthreads
4316 eval $setvar
4317
4318
4319 : Look for a hint-file generated 'call-back-unit'.  If the
4320 : user has specified that a threading perl is to be built,
4321 : we may need to set or change some other defaults.
4322 if $test -f usethreads.cbu; then
4323     echo "Your platform has some specific hints regarding threaded builds, using them..."
4324     . ./usethreads.cbu
4325 else
4326     case "$usethreads" in
4327         "$define"|true|[yY]*)
4328                 $cat <<EOM
4329 (Your platform does not have any specific hints for threaded builds.
4330  Assuming POSIX threads, then.)
4331 EOM
4332         ;;
4333     esac
4334 fi
4335
4336 : Check if multiplicity is required
4337 cat <<EOM
4338
4339 Perl can be built so that multiple Perl interpreters can coexist
4340 within the same Perl executable.
4341 EOM
4342
4343 case "$useithreads" in
4344 $define)
4345         cat <<EOM
4346 This multiple interpreter support is required for interpreter-based threads.
4347 EOM
4348         val="$define"
4349         ;;
4350 *)      case "$usemultiplicity" in
4351         $define|true|[yY]*)     dflt='y';;
4352         *) dflt='n';;
4353         esac
4354         echo " "
4355         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4356         rp='Build Perl for multiplicity?'
4357         . ./myread
4358         case "$ans" in
4359         y|Y)    val="$define" ;;
4360         *)      val="$undef" ;;
4361         esac
4362         ;;
4363 esac
4364 set usemultiplicity
4365 eval $setvar
4366
4367 : Check if morebits is requested
4368 case "$usemorebits" in
4369 "$define"|true|[yY]*)
4370         use64bitint="$define"
4371         uselongdouble="$define"
4372         usemorebits="$define"
4373         ;;
4374 *)      usemorebits="$undef"
4375         ;;
4376 esac
4377
4378 : Determine the C compiler to be used
4379 echo " "
4380 case "$cc" in
4381 '') dflt=cc;;
4382 *) dflt="$cc";;
4383 esac
4384 rp="Use which C compiler?"
4385 . ./myread
4386 cc="$ans"
4387
4388 : See whether they have no cc but they do have gcc
4389 . ./trygcc
4390 if $test -f cc.cbu; then
4391     . ./cc.cbu
4392 fi
4393 . ./checkcc
4394
4395 : make some quick guesses about what we are up against
4396 echo " "
4397 $echo $n "Hmm...  $c"
4398 echo exit 1 >bsd
4399 echo exit 1 >usg
4400 echo exit 1 >v7
4401 echo exit 1 >osf1
4402 echo exit 1 >eunice
4403 echo exit 1 >xenix
4404 echo exit 1 >venix
4405 echo exit 1 >os2
4406 d_bsd="$undef"
4407 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4408 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4409 then
4410         echo "Looks kind of like an OSF/1 system, but we'll see..."
4411         echo exit 0 >osf1
4412 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4413         xxx=`./loc addbib blurfl $pth`
4414         if $test -f $xxx; then
4415         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4416                 echo exit 0 >bsd
4417                 echo exit 0 >usg
4418         else
4419                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4420                         echo "Looks kind of like an extended USG system, but we'll see..."
4421                 else
4422                         echo "Looks kind of like a USG system, but we'll see..."
4423                 fi
4424                 echo exit 0 >usg
4425         fi
4426 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4427         echo "Looks kind of like a BSD system, but we'll see..."
4428         d_bsd="$define"
4429         echo exit 0 >bsd
4430 else
4431         echo "Looks kind of like a Version 7 system, but we'll see..."
4432         echo exit 0 >v7
4433 fi
4434 case "$eunicefix" in
4435 *unixtovms*)
4436         $cat <<'EOI'
4437 There is, however, a strange, musty smell in the air that reminds me of
4438 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4439 EOI
4440         echo exit 0 >eunice
4441         d_eunice="$define"
4442 : it so happens the Eunice I know will not run shell scripts in Unix format
4443         ;;
4444 *)
4445         echo " "
4446         echo "Congratulations.  You aren't running Eunice."
4447         d_eunice="$undef"
4448         ;;
4449 esac
4450 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4451 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4452 : semicolon as a patch separator
4453 case "$p_" in
4454 :) ;;
4455 *)
4456         $cat <<'EOI'
4457 I have the feeling something is not exactly right, however...don't tell me...
4458 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4459 (Or you may be running DOS with DJGPP.)
4460 EOI
4461         echo exit 0 >os2
4462         ;;
4463 esac
4464 if test -f /xenix; then
4465         echo "Actually, this looks more like a XENIX system..."
4466         echo exit 0 >xenix
4467         d_xenix="$define"
4468 else
4469         echo " "
4470         echo "It's not Xenix..."
4471         d_xenix="$undef"
4472 fi
4473 chmod +x xenix
4474 $eunicefix xenix
4475 if test -f /venix; then
4476         echo "Actually, this looks more like a VENIX system..."
4477         echo exit 0 >venix
4478 else
4479         echo " "
4480         if ./xenix; then
4481                 : null
4482         else
4483                 echo "Nor is it Venix..."
4484         fi
4485 fi
4486 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4487 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4488 $rm -f foo
4489
4490 : Check if we are using GNU gcc and what its version is
4491 echo " "
4492 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4493 $cat >try.c <<EOM
4494 #include <stdio.h>
4495 int main() {
4496 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4497 #ifdef __VERSION__
4498         printf("%s\n", __VERSION__);
4499 #else
4500         printf("%s\n", "1");
4501 #endif
4502 #endif
4503         return(0);
4504 }
4505 EOM
4506 if $cc -o try $ccflags $ldflags try.c; then
4507         gccversion=`$run ./try`
4508         case "$gccversion" in
4509         '') echo "You are not using GNU cc." ;;
4510         *)  echo "You are using GNU cc $gccversion."
4511             ccname=gcc
4512             ;;
4513         esac
4514 else
4515         echo " "
4516         echo "*** WHOA THERE!!! ***" >&4
4517         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4518         case "$knowitall" in
4519         '')
4520         echo "    You'd better start hunting for one and let me know about it." >&4
4521                 exit 1
4522                 ;;
4523         esac
4524 fi
4525 $rm -f try try.*
4526 case "$gccversion" in
4527 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4528 esac
4529 case "$gccversion" in
4530 '') gccosandvers='' ;;
4531 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4532    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4533    gccshortvers=''
4534    case "$gccosandvers" in
4535    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4536    $osname$osvers) ;; # looking good
4537    $osname*) cat <<EOM >&4
4538
4539 *** WHOA THERE!!! ***
4540
4541     Your gcc has not been compiled for the exact release of
4542     your operating system ($gccosandvers versus $osname$osvers).
4543
4544     In general it is a good idea to keep gcc synchronized with
4545     the operating system because otherwise serious problems
4546     may ensue when trying to compile software, like Perl.
4547
4548     I'm trying to be optimistic here, though, and will continue.
4549     If later during the configuration and build icky compilation
4550     problems appear (headerfile conflicts being the most common
4551     manifestation), I suggest reinstalling the gcc to match
4552     your operating system release.
4553
4554 EOM
4555       ;;
4556    *) gccosandvers='' ;; # failed to parse, better be silent
4557    esac
4558    ;;
4559 esac
4560 case "$ccname" in
4561 '') ccname="$cc" ;;
4562 esac
4563
4564 # gcc 3.* complain about adding -Idirectories that they already know about,
4565 # so we will take those off from locincpth.
4566 case "$gccversion" in
4567 3*)
4568     echo "main(){}">try.c
4569     for incdir in $locincpth; do
4570        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4571              grep '^c[cp]p*[01]: warning: changing search order '`
4572        if test "X$warn" != X; then
4573            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4574        fi
4575     done
4576     $rm -f try try.*
4577 esac
4578
4579 : What should the include directory be ?
4580 echo " "
4581 $echo $n "Hmm...  $c"
4582 dflt='/usr/include'
4583 incpath=''
4584 mips_type=''
4585 if $test -f /bin/mips && /bin/mips; then
4586         echo "Looks like a MIPS system..."
4587         $cat >usr.c <<'EOCP'
4588 #ifdef SYSTYPE_BSD43
4589 /bsd43
4590 #endif
4591 EOCP
4592         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4593                 dflt='/bsd43/usr/include'
4594                 incpath='/bsd43'
4595                 mips_type='BSD 4.3'
4596         else
4597                 mips_type='System V'
4598         fi
4599         $rm -f usr.c usr.out
4600         echo "and you're compiling with the $mips_type compiler and libraries."
4601         xxx_prompt=y
4602         echo "exit 0" >mips
4603 else
4604         echo "Doesn't look like a MIPS system."
4605         xxx_prompt=n
4606         echo "exit 1" >mips
4607 fi
4608 chmod +x mips
4609 $eunicefix mips
4610 case "$usrinc" in
4611 '') ;;
4612 *) dflt="$usrinc";;
4613 esac
4614 case "$xxx_prompt" in
4615 y)      fn=d/
4616         echo " "
4617         rp='Where are the include files you want to use?'
4618         . ./getfile
4619         usrinc="$ans"
4620         ;;
4621 *)      usrinc="$dflt"
4622         ;;
4623 esac
4624
4625 : see how we invoke the C preprocessor
4626 echo " "
4627 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4628 cat <<'EOT' >testcpp.c
4629 #define ABC abc
4630 #define XYZ xyz
4631 ABC.XYZ
4632 EOT
4633 cd ..
4634 if test ! -f cppstdin; then
4635         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4636                 # AIX cc -E doesn't show the absolute headerfile
4637                 # locations but we'll cheat by using the -M flag.
4638                 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
4639         else
4640                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4641         fi
4642 else
4643         echo "Keeping your $hint cppstdin wrapper."
4644 fi
4645 chmod 755 cppstdin
4646 wrapper=`pwd`/cppstdin
4647 ok='false'
4648 cd UU
4649
4650 if $test "X$cppstdin" != "X" && \
4651         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4652         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4653 then
4654         echo "You used to use $cppstdin $cppminus so we'll use that again."
4655         case "$cpprun" in
4656         '') echo "But let's see if we can live without a wrapper..." ;;
4657         *)
4658                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4659                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4660                 then
4661                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4662                         ok='true'
4663                 else
4664                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4665                 fi
4666                 ;;
4667         esac
4668 else
4669         case "$cppstdin" in
4670         '') ;;
4671         *)
4672                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4673                 ;;
4674         esac
4675 fi
4676
4677 if $ok; then
4678         : nothing
4679 elif echo '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"' -E -" will work...'; \
4686         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4687         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4688         echo "Yup, it does."
4689         x_cpp="$cc -E"
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 "Yipee, that works!"
4695         x_cpp="$cc -P"
4696         x_minus='';
4697 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4698         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4699         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4700         echo "At long last!"
4701         x_cpp="$cc -P"
4702         x_minus='-';
4703 elif echo 'No such luck, 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 "It works!"
4707         x_cpp="$cpp"
4708         x_minus='';
4709 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4710         $cpp - <testcpp.c >testcpp.out 2>&1; \
4711         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4712         echo "Hooray, it works!  I was beginning to wonder."
4713         x_cpp="$cpp"
4714         x_minus='-';
4715 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4716         $wrapper <testcpp.c >testcpp.out 2>&1; \
4717         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4718         x_cpp="$wrapper"
4719         x_minus=''
4720         echo "Eureka!"
4721 else
4722         dflt=''
4723         rp="No dice.  I can't find a C preprocessor.  Name one:"
4724         . ./myread
4725         x_cpp="$ans"
4726         x_minus=''
4727         $x_cpp <testcpp.c >testcpp.out 2>&1
4728         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4729                 echo "OK, that will do." >&4
4730         else
4731 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4732                 exit 1
4733         fi
4734 fi
4735
4736 case "$ok" in
4737 false)
4738         cppstdin="$x_cpp"
4739         cppminus="$x_minus"
4740         cpprun="$x_cpp"
4741         cpplast="$x_minus"
4742         set X $x_cpp
4743         shift
4744         case "$1" in
4745         "$cpp")
4746                 echo "Perhaps can we force $cc -E using a wrapper..."
4747                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4748                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4749                 then
4750                         echo "Yup, we can."
4751                         cppstdin="$wrapper"
4752                         cppminus='';
4753                 else
4754                         echo "Nope, we'll have to live without it..."
4755                 fi
4756                 ;;
4757         esac
4758         case "$cpprun" in
4759         "$wrapper")
4760                 cpprun=''
4761                 cpplast=''
4762                 ;;
4763         esac
4764         ;;
4765 esac
4766
4767 case "$cppstdin" in
4768 "$wrapper"|'cppstdin') ;;
4769 *) $rm -f $wrapper;;
4770 esac
4771 $rm -f testcpp.c testcpp.out
4772
4773 : Set private lib path
4774 case "$plibpth" in
4775 '') if ./mips; then
4776                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4777         fi;;
4778 esac
4779 case "$libpth" in
4780 ' ') dlist='';;
4781 '') dlist="$loclibpth $plibpth $glibpth";;
4782 *) dlist="$libpth";;
4783 esac
4784
4785 : Now check and see which directories actually exist, avoiding duplicates
4786 libpth=''
4787 for xxx in $dlist
4788 do
4789     if $test -d $xxx; then
4790                 case " $libpth " in
4791                 *" $xxx "*) ;;
4792                 *) libpth="$libpth $xxx";;
4793                 esac
4794     fi
4795 done
4796 $cat <<'EOM'
4797
4798 Some systems have incompatible or broken versions of libraries.  Among
4799 the directories listed in the question below, please remove any you
4800 know not to be holding relevant libraries, and add any that are needed.
4801 Say "none" for none.
4802
4803 EOM
4804 case "$libpth" in
4805 '') dflt='none';;
4806 *)
4807         set X $libpth
4808         shift
4809         dflt=${1+"$@"}
4810         ;;
4811 esac
4812 rp="Directories to use for library searches?"
4813 . ./myread
4814 case "$ans" in
4815 none) libpth=' ';;
4816 *) libpth="$ans";;
4817 esac
4818
4819 : compute shared library extension
4820 case "$so" in
4821 '')
4822         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4823                 dflt='sl'
4824         else
4825                 dflt='so'
4826         fi
4827         ;;
4828 *) dflt="$so";;
4829 esac
4830 $cat <<EOM
4831
4832 On some systems, shared libraries may be available.  Answer 'none' if
4833 you want to suppress searching of shared libraries for the remainder
4834 of this configuration.
4835
4836 EOM
4837 rp='What is the file extension used for shared libraries?'
4838 . ./myread
4839 so="$ans"
4840
4841 : Define several unixisms.
4842 : Hints files or command line option can be used to override them.
4843 : The convoluted testing is in case hints files set either the old
4844 : or the new name.
4845 case "$_exe" in
4846 '')     case "$exe_ext" in
4847         '')     ;;
4848         *)      _exe="$exe_ext" ;;
4849         esac
4850         ;;
4851 esac
4852 case "$_a" in
4853 '')     case "$lib_ext" in
4854     '') _a='.a';;
4855         *)      _a="$lib_ext" ;;
4856         esac
4857         ;;
4858 esac
4859 case "$_o" in
4860 '') case "$obj_ext" in
4861         '')     _o='.o';;
4862         *)      _o="$obj_ext";;
4863         esac
4864         ;;
4865 esac
4866 case "$p_" in
4867 '') case "$path_sep" in
4868         '')     p_=':';;
4869         *)      p_="$path_sep";;
4870         esac
4871         ;;
4872 esac
4873 exe_ext=$_exe
4874 lib_ext=$_a
4875 obj_ext=$_o
4876 path_sep=$p_
4877
4878 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4879
4880 : Which makefile gets called first.  This is used by make depend.
4881 case "$firstmakefile" in
4882 '') firstmakefile='makefile';;
4883 esac
4884
4885 : Check for uselongdouble support
4886 case "$ccflags" in
4887 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4888 esac
4889
4890 case "$uselongdouble" in
4891 $define|true|[yY]*)     dflt='y';;
4892 *) dflt='n';;
4893 esac
4894 cat <<EOM
4895
4896 Perl can be built to take advantage of long doubles which
4897 (if available) may give more accuracy and range for floating point numbers.
4898
4899 If this doesn't make any sense to you, just accept the default '$dflt'.
4900 EOM
4901 rp='Try to use long doubles if available?'
4902 . ./myread
4903 case "$ans" in
4904 y|Y)    val="$define"   ;;
4905 *)      val="$undef"    ;;
4906 esac
4907 set uselongdouble
4908 eval $setvar
4909
4910 case "$uselongdouble" in
4911 true|[yY]*) uselongdouble="$define" ;;
4912 esac
4913
4914 : Look for a hint-file generated 'call-back-unit'.  If the
4915 : user has specified that long doubles should be used,
4916 : we may need to set or change some other defaults.
4917 if $test -f uselongdouble.cbu; then
4918     echo "Your platform has some specific hints regarding long doubles, using them..."
4919     . ./uselongdouble.cbu
4920 else
4921     case "$uselongdouble" in
4922         $define)
4923                 $cat <<EOM
4924 (Your platform does not have any specific hints for long doubles.)
4925 EOM
4926         ;;
4927     esac
4928 fi
4929
4930 : Looking for optional libraries
4931 echo " "
4932 echo "Checking for optional libraries..." >&4
4933 case "$libs" in
4934 ' '|'') dflt='';;
4935 *) dflt="$libs";;
4936 esac
4937 case "$libswanted" in
4938 '') libswanted='c_s';;
4939 esac
4940 case "$usesocks" in
4941 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4942 esac
4943 libsfound=''
4944 libsfiles=''
4945 libsdirs=''
4946 libspath=''
4947 for thisdir in $libpth $xlibpth; do
4948   test -d $thisdir && libspath="$libspath $thisdir"
4949 done
4950 for thislib in $libswanted; do
4951         for thisdir in $libspath; do
4952             xxx=''
4953             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4954                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4955                 $test -f "$xxx" && eval $libscheck
4956                 $test -f "$xxx" && libstyle=shared
4957             fi
4958             if test ! -f "$xxx"; then
4959                 xxx=$thisdir/lib$thislib.$so
4960                 $test -f "$xxx" && eval $libscheck
4961                 $test -f "$xxx" && libstyle=shared
4962             fi
4963             if test ! -f "$xxx"; then
4964                 xxx=$thisdir/lib$thislib$_a
4965                 $test -f "$xxx" && eval $libscheck
4966                 $test -f "$xxx" && libstyle=static
4967             fi
4968             if test ! -f "$xxx"; then
4969                 xxx=$thisdir/$thislib$_a
4970                 $test -f "$xxx" && eval $libscheck
4971                 $test -f "$xxx" && libstyle=static
4972             fi
4973             if test ! -f "$xxx"; then
4974                 xxx=$thisdir/lib${thislib}_s$_a
4975                 $test -f "$xxx" && eval $libscheck
4976                 $test -f "$xxx" && libstyle=static
4977                 $test -f "$xxx" && thislib=${thislib}_s
4978             fi
4979             if test ! -f "$xxx"; then
4980                 xxx=$thisdir/Slib$thislib$_a
4981                 $test -f "$xxx" && eval $libscheck
4982                 $test -f "$xxx" && libstyle=static
4983             fi
4984             if $test -f "$xxx"; then
4985                 case "$libstyle" in
4986                 shared) echo "Found -l$thislib (shared)." ;;
4987                 static) echo "Found -l$thislib." ;;
4988                 *)      echo "Found -l$thislib ($libstyle)." ;;
4989                 esac
4990                 case " $dflt " in
4991                 *"-l$thislib "*);;
4992                 *) dflt="$dflt -l$thislib"
4993                    libsfound="$libsfound $xxx"
4994                    yyy=`basename $xxx`
4995                    libsfiles="$libsfiles $yyy"
4996                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4997                    case " $libsdirs " in
4998                    *" $yyy "*) ;;
4999                    *) libsdirs="$libsdirs $yyy" ;;
5000                    esac
5001                    ;;
5002                 esac
5003                 break
5004             fi
5005         done
5006         if $test ! -f "$xxx"; then
5007             echo "No -l$thislib."
5008         fi
5009 done
5010 set X $dflt
5011 shift
5012 dflt="$*"
5013 case "$libs" in
5014 '') dflt="$dflt";;
5015 *) dflt="$libs";;
5016 esac
5017 case "$dflt" in
5018 ' '|'') dflt='none';;
5019 esac
5020
5021 $cat <<EOM
5022
5023 In order to compile $package on your machine, a number of libraries
5024 are usually needed.  Include any other special libraries here as well.
5025 Say "none" for none.  The default list is almost always right.
5026 EOM
5027
5028 echo " "
5029 rp="What libraries to use?"
5030 . ./myread
5031 case "$ans" in
5032 none) libs=' ';;
5033 *) libs="$ans";;
5034 esac
5035
5036 : determine optimization, if desired, or use for debug flag also
5037 case "$optimize" in
5038 ' '|$undef) dflt='none';;
5039 '') dflt='-O';;
5040 *) dflt="$optimize";;
5041 esac
5042 $cat <<EOH
5043
5044 By default, $package compiles with the -O flag to use the optimizer.
5045 Alternately, you might want to use the symbolic debugger, which uses
5046 the -g flag (on traditional Unix systems).  Either flag can be
5047 specified here.  To use neither flag, specify the word "none".
5048
5049 EOH
5050 rp="What optimizer/debugger flag should be used?"
5051 . ./myread
5052 optimize="$ans"
5053 case "$optimize" in
5054 'none') optimize=" ";;
5055 esac
5056
5057 : Check what DEBUGGING is required from the command line
5058 : -DEBUGGING      or -DDEBUGGING or
5059 : -DEBUGGING=both                       = -g + -DDEBUGGING
5060 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5061 : -DEBUGGING=none or -UDEBUGGING        =
5062 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5063 case "$EBUGGING" in
5064 '')     ;;
5065 *)      DEBUGGING=$EBUGGING ;;
5066 esac
5067
5068 case "$DEBUGGING" in
5069 -g|both|$define)
5070     case "$optimize" in
5071         *-g*) ;;
5072         *)    optimize="$optimize -g" ;;
5073     esac ;;
5074 none|$undef)
5075     case "$optimize" in
5076         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5077                 shift
5078                 optimize="$*"
5079                 ;;
5080     esac ;;
5081 esac
5082
5083 dflt=''
5084 case "$DEBUGGING" in
5085 both|$define) dflt='-DDEBUGGING'
5086 esac
5087
5088 : argument order is deliberate, as the flag will start with - which set could
5089 : think is an option
5090 checkccflag='check=$1; flag=$2; callback=$3;
5091 echo " ";
5092 echo "Checking if your compiler accepts $flag" 2>&1;
5093 echo "int main(void) { return 0; }" > gcctest.c;
5094 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5095     echo "Yes, it does." 2>&1;
5096     if $test -s gcctest.out ; then
5097         echo "But your platform does not like it:";
5098         cat gcctest.out;
5099     else
5100         case "$ccflags" in
5101         *$check*)
5102             echo "Leaving current flags $ccflags alone." 2>&1
5103             ;;
5104         *) dflt="$dflt $flag";
5105             eval $callback
5106             ;;
5107         esac
5108     fi
5109 else
5110     echo "Nope, it does not, but that is ok." 2>&1;
5111 fi
5112 '
5113
5114 : We will not override a previous value, but we might want to
5115 : augment a hint file
5116 case "$hint" in
5117 default|recommended)
5118         case "$gccversion" in
5119         1*) dflt="$dflt -fpcc-struct-return" ;;
5120         esac
5121         case "$optimize:$DEBUGGING" in
5122         *-g*:old) dflt="$dflt -DDEBUGGING";;
5123         esac
5124         case "$gccversion" in
5125         2*) if $test -d /etc/conf/kconfig.d &&
5126                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5127                 then
5128                         # Interactive Systems (ISC) POSIX mode.
5129                         dflt="$dflt -posix"
5130                 fi
5131                 ;;
5132         esac
5133         case "$gccversion" in
5134         1*) ;;
5135         2.[0-8]*) ;;
5136         ?*)     set strict-aliasing -fno-strict-aliasing
5137                 eval $checkccflag
5138                 ;;
5139         esac
5140         # For gcc, adding -pipe speeds up compilations for some, but apparently
5141         # some assemblers can't read from stdin.  (It also slows down compilations
5142         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5143         case "$gccversion" in
5144         ?*)     set pipe -pipe
5145                 eval $checkccflag
5146                 ;;
5147         esac
5148
5149         # on x86_64 (at least) we require an extra library (libssp) in the
5150         # link command line. This library is not named, so I infer that it is
5151         # an implementation detail that may change. Hence the safest approach
5152         # is to add the flag to the flags passed to the compiler at link time,
5153         # as that way the compiler can do the right implementation dependant
5154         # thing. (NWC)
5155         case "$gccversion" in
5156         ?*)     set stack-protector -fstack-protector
5157                 eval $checkccflag
5158                 ;;
5159         esac
5160         ;;
5161 esac
5162
5163 case "$mips_type" in
5164 *BSD*|'') inclwanted="$locincpth $usrinc";;
5165 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5166 esac
5167 for thisincl in $inclwanted; do
5168         if $test -d $thisincl; then
5169                 if $test x$thisincl != x$usrinc; then
5170                         case "$dflt" in
5171                         *" -I$thisincl "*);;
5172                         *) dflt="$dflt -I$thisincl ";;
5173                         esac
5174                 fi
5175         fi
5176 done
5177
5178 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5179         xxx=true;
5180 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5181         xxx=true;
5182 else
5183         xxx=false;
5184 fi;
5185 if $xxx; then
5186         case "$dflt" in
5187         *$2*);;
5188         *) dflt="$dflt -D$2";;
5189         esac;
5190 fi'
5191
5192 set signal.h LANGUAGE_C; eval $inctest
5193
5194 case "$usesocks" in
5195 $define)
5196         ccflags="$ccflags -DSOCKS"
5197         ;;
5198 esac
5199
5200 case "$hint" in
5201 default|recommended) dflt="$ccflags $dflt" ;;
5202 *) dflt="$ccflags";;
5203 esac
5204
5205 case "$dflt" in
5206 ''|' ') dflt=none;;
5207 esac
5208
5209 $cat <<EOH
5210
5211 Your C compiler may want other flags.  For this question you should include
5212 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5213 but you should NOT include libraries or ld flags like -lwhatever.  If you
5214 want $package to honor its debug switch, you should include -DDEBUGGING here.
5215 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5216
5217 To use no flags, specify the word "none".
5218
5219 EOH
5220 set X $dflt
5221 shift
5222 dflt=${1+"$@"}
5223 rp="Any additional cc flags?"
5224 . ./myread
5225 case "$ans" in
5226 none) ccflags='';;
5227 *) ccflags="$ans";;
5228 esac
5229
5230 : the following weeds options from ccflags that are of no interest to cpp
5231 case "$cppflags" in
5232 '') cppflags="$ccflags" ;;
5233 *)  cppflags="$cppflags $ccflags" ;;
5234 esac
5235 case "$gccversion" in
5236 1*) cppflags="$cppflags -D__GNUC__"
5237 esac
5238 case "$mips_type" in
5239 '');;
5240 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5241 esac
5242 case "$cppflags" in
5243 '');;
5244 *)
5245         echo " "
5246         echo "Let me guess what the preprocessor flags are..." >&4
5247         set X $cppflags
5248         shift
5249         cppflags=''
5250         $cat >cpp.c <<'EOM'
5251 #define BLURFL foo
5252
5253 BLURFL xx LFRULB
5254 EOM
5255         previous=''
5256         for flag in $*
5257         do
5258                 case "$flag" in
5259                 -*) ftry="$flag";;
5260                 *) ftry="$previous $flag";;
5261                 esac
5262                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5263                         >cpp1.out 2>/dev/null && \
5264                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5265                         >cpp2.out 2>/dev/null && \
5266                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5267                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5268                 then
5269                         cppflags="$cppflags $ftry"
5270                         previous=''
5271                 else
5272                         previous="$flag"
5273                 fi
5274         done
5275         set X $cppflags
5276         shift
5277         cppflags=${1+"$@"}
5278         case "$cppflags" in
5279         *-*)  echo "They appear to be: $cppflags";;
5280         esac
5281         $rm -f cpp.c cpp?.out
5282         ;;
5283 esac
5284
5285 : flags used in final linking phase
5286 case "$ldflags" in
5287 '') if ./venix; then
5288                 dflt='-i -z'
5289         else
5290                 dflt=''
5291         fi
5292         case "$ccflags" in
5293         *-posix*) dflt="$dflt -posix" ;;
5294         esac
5295         ;;
5296 *) dflt="$ldflags";;
5297 esac
5298 # See note above about -fstack-protector
5299 case "$ccflags" in
5300 *-fstack-protector*) 
5301         case "$dflt" in
5302         *-fstack-protector*) ;; # Don't add it again
5303         *) dflt="$dflt -fstack-protector" ;; 
5304         esac
5305         ;;
5306 esac
5307
5308 : Try to guess additional flags to pick up local libraries.
5309 for thislibdir in $libpth; do
5310         case " $loclibpth " in
5311         *" $thislibdir "*)
5312                 case "$dflt " in
5313                 *"-L$thislibdir "*) ;;
5314                 *)  dflt="$dflt -L$thislibdir" ;;
5315                 esac
5316                 ;;
5317         esac
5318 done
5319
5320 case "$dflt" in
5321 '') dflt='none' ;;
5322 esac
5323
5324 $cat <<EOH
5325
5326 Your C linker may need flags.  For this question you should
5327 include -L/whatever and any other flags used by the C linker, but you
5328 should NOT include libraries like -lwhatever.
5329
5330 Make sure you include the appropriate -L/path flags if your C linker
5331 does not normally search all of the directories you specified above,
5332 namely
5333         $libpth
5334 To use no flags, specify the word "none".
5335
5336 EOH
5337
5338 rp="Any additional ld flags (NOT including libraries)?"
5339 . ./myread
5340 case "$ans" in
5341 none) ldflags='';;
5342 *) ldflags="$ans";;
5343 esac
5344 rmlist="$rmlist pdp11"
5345
5346 : coherency check
5347 echo " "
5348 echo "Checking your choice of C compiler and flags for coherency..." >&4
5349 $cat > try.c <<'EOF'
5350 #include <stdio.h>
5351 int main() { printf("Ok\n"); return(0); }
5352 EOF
5353 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5354 shift
5355 $cat >try.msg <<'EOM'
5356 I've tried to compile and run the following simple program:
5357
5358 EOM
5359 $cat try.c >> try.msg
5360
5361 $cat >> try.msg <<EOM
5362
5363 I used the command:
5364
5365         $*
5366         $run ./try
5367
5368 and I got the following output:
5369
5370 EOM
5371 dflt=y
5372 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5373         if $sh -c "$run ./try " >>try.msg 2>&1; then
5374                 xxx=`$run ./try`
5375                 case "$xxx" in
5376                 "Ok") dflt=n ;;
5377                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5378                         case " $libs " in
5379                         *" -lsfio "*)
5380                                 cat >> try.msg <<'EOQS'
5381 If $libs contains -lsfio, and sfio is mis-configured, then it
5382 sometimes (apparently) runs and exits with a 0 status, but with no
5383 output!  It may have to do with sfio's use of _exit vs. exit.
5384
5385 EOQS
5386                                 rp="You have a big problem.  Shall I abort Configure"
5387                                 dflt=y
5388                                 ;;
5389                         esac
5390                         ;;
5391                 esac
5392         else
5393                 echo "The program compiled OK, but exited with status $?." >>try.msg
5394                 rp="You have a problem.  Shall I abort Configure"
5395                 dflt=y
5396         fi
5397 else
5398         echo "I can't compile the test program." >>try.msg
5399         rp="You have a BIG problem.  Shall I abort Configure"
5400         dflt=y
5401 fi
5402 case "$dflt" in
5403 y)
5404         $cat try.msg >&4
5405         case "$knowitall" in
5406         '')
5407                 echo "(The supplied flags or libraries might be incorrect.)"
5408                 ;;
5409         *) dflt=n;;
5410         esac
5411         echo " "
5412         . ./myread
5413         case "$ans" in
5414         n*|N*) ;;
5415         *)      echo "Ok.  Stopping Configure." >&4
5416                 exit 1
5417                 ;;
5418         esac
5419         ;;
5420 n) echo "OK, that should do.";;
5421 esac
5422 $rm_try gcctest gcctest.out
5423
5424 : define a shorthand compile call
5425 compile='
5426 mc_file=$1;
5427 shift;
5428 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5429 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5430 exit 1;
5431 fi;
5432 esac;
5433 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5434 : define a shorthand compile call for compilations that should be ok.
5435 compile_ok='
5436 mc_file=$1;
5437 shift;
5438 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5439
5440 : determine filename position in cpp output
5441 echo " "
5442 echo "Computing filename position in cpp output for #include directives..." >&4
5443 case "$osname" in
5444 vos) testaccess=-e ;;
5445 *)   testaccess=-r ;;
5446 esac
5447 echo '#include <stdio.h>' > foo.c
5448 $cat >fieldn <<EOF
5449 $startsh
5450 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5451 $grep '^[       ]*#.*stdio\.h' | \
5452 while read cline; do
5453         pos=1
5454         set \$cline
5455         while $test \$# -gt 0; do
5456                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5457                         echo "\$pos"
5458                         exit 0
5459                 fi
5460                 shift
5461                 pos=\`expr \$pos + 1\`
5462         done
5463 done
5464 EOF
5465 chmod +x fieldn
5466 fieldn=`./fieldn`
5467 $rm -f foo.c fieldn
5468 case $fieldn in
5469 '') pos='???';;
5470 1) pos=first;;
5471 2) pos=second;;
5472 3) pos=third;;
5473 *) pos="${fieldn}th";;
5474 esac
5475 echo "Your cpp writes the filename in the $pos field of the line."
5476
5477 case "$osname" in
5478 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5479 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5480 *)   cppfilter='' ;;
5481 esac
5482 : locate header file
5483 $cat >findhdr <<EOF
5484 $startsh
5485 wanted=\$1
5486 name=''
5487 for usrincdir in $usrinc
5488 do
5489         if test -f \$usrincdir/\$wanted; then
5490                 echo "\$usrincdir/\$wanted"
5491                 exit 0
5492         fi
5493 done
5494 awkprg='{ print \$$fieldn }'
5495 echo "#include <\$wanted>" > foo\$\$.c
5496 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5497 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5498 while read cline; do
5499         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5500         case "\$name" in
5501         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5502         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5503         *) exit 2;;
5504         esac;
5505 done;
5506 #
5507 # status = 0: grep returned 0 lines, case statement not executed
5508 # status = 1: headerfile found
5509 # status = 2: while loop executed, no headerfile found
5510 #
5511 status=\$?
5512 $rm -f foo\$\$.c;
5513 if test \$status -eq 1; then
5514         exit 0;
5515 fi
5516 exit 1
5517 EOF
5518 chmod +x findhdr
5519
5520 : define an alternate in-header-list? function
5521 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5522 cont=true; xxf="echo \"<\$1> found.\" >&4";
5523 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5524 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5525 esac;
5526 case $# in 4) instead=instead;; *) instead="at last";; esac;
5527 while $test "$cont"; do
5528         xxx=`./findhdr $1`
5529         var=$2; eval "was=\$$2";
5530         if $test "$xxx" && $test -r "$xxx";
5531         then eval $xxf;
5532         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5533                 cont="";
5534         else eval $xxnf;
5535         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5536         set $yyy; shift; shift; yyy=$@;
5537         case $# in 0) cont="";;
5538         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5539                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5540         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5541                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5542         esac;
5543 done;
5544 while $test "$yyy";
5545 do set $yyy; var=$2; eval "was=\$$2";
5546         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5547         set $yyy; shift; shift; yyy=$@;
5548 done'
5549
5550 : see if stdlib is available
5551 set stdlib.h i_stdlib
5552 eval $inhdr
5553
5554 : check for lengths of integral types
5555 echo " "
5556 case "$intsize" in
5557 '')
5558         echo "Checking to see how big your integers are..." >&4
5559         $cat >try.c <<EOCP
5560 #include <stdio.h>
5561 #$i_stdlib I_STDLIB
5562 #ifdef I_STDLIB
5563 #include <stdlib.h>
5564 #endif
5565 int main()
5566 {
5567         printf("intsize=%d;\n", (int)sizeof(int));
5568         printf("longsize=%d;\n", (int)sizeof(long));
5569         printf("shortsize=%d;\n", (int)sizeof(short));
5570         exit(0);
5571 }
5572 EOCP
5573         set try
5574         if eval $compile_ok && $run ./try > /dev/null; then
5575                 eval `$run ./try`
5576                 echo "Your integers are $intsize bytes long."
5577                 echo "Your long integers are $longsize bytes long."
5578                 echo "Your short integers are $shortsize bytes long."
5579         else
5580                 $cat >&4 <<EOM
5581 !
5582 Help! I can't compile and run the intsize test program: please enlighten me!
5583 (This is probably a misconfiguration in your system or libraries, and
5584 you really ought to fix it.  Still, I'll try anyway.)
5585 !
5586 EOM
5587                 dflt=4
5588                 rp="What is the size of an integer (in bytes)?"
5589                 . ./myread
5590                 intsize="$ans"
5591                 dflt=$intsize
5592                 rp="What is the size of a long integer (in bytes)?"
5593                 . ./myread
5594                 longsize="$ans"
5595                 dflt=2
5596                 rp="What is the size of a short integer (in bytes)?"
5597                 . ./myread
5598                 shortsize="$ans"
5599         fi
5600         ;;
5601 esac
5602 $rm_try
5603
5604 : check for long long
5605 echo " "
5606 echo "Checking to see if you have long long..." >&4
5607 echo 'int main() { long long x = 7; return 0; }' > try.c
5608 set try
5609 if eval $compile; then
5610         val="$define"
5611         echo "You have long long."
5612 else
5613         val="$undef"
5614         echo "You do not have long long."
5615 fi
5616 $rm_try
5617 set d_longlong
5618 eval $setvar
5619
5620 : check for length of long long
5621 case "${d_longlong}${longlongsize}" in
5622 $define)
5623         echo " "
5624         echo "Checking to see how big your long longs are..." >&4
5625         $cat >try.c <<'EOCP'
5626 #include <stdio.h>
5627 int main()
5628 {
5629     printf("%d\n", (int)sizeof(long long));
5630     return(0);
5631 }
5632 EOCP
5633         set try
5634         if eval $compile_ok; then
5635                 longlongsize=`$run ./try`
5636                 echo "Your long longs are $longlongsize bytes long."
5637         else
5638                 dflt='8'
5639                 echo " "
5640                 echo "(I can't seem to compile the test program.  Guessing...)"
5641                 rp="What is the size of a long long (in bytes)?"
5642                 . ./myread
5643                 longlongsize="$ans"
5644         fi
5645         if $test "X$longsize" = "X$longlongsize"; then
5646                 echo "(That isn't any different from an ordinary long.)"
5647         fi
5648         ;;
5649 esac
5650 $rm_try
5651
5652 : see if inttypes.h is available
5653 : we want a real compile instead of Inhdr because some systems
5654 : have an inttypes.h which includes non-existent headers
5655 echo " "
5656 $cat >try.c <<EOCP
5657 #include <inttypes.h>
5658 int main() {
5659         static int32_t foo32 = 0x12345678;
5660 }
5661 EOCP
5662 set try
5663 if eval $compile; then
5664         echo "<inttypes.h> found." >&4
5665         val="$define"
5666 else
5667         echo "<inttypes.h> NOT found." >&4
5668         val="$undef"
5669 fi
5670 $rm_try
5671 set i_inttypes
5672 eval $setvar
5673
5674 : check for int64_t
5675 echo " "
5676 echo "Checking to see if you have int64_t..." >&4
5677 $cat >try.c <<EOCP
5678 #include <sys/types.h>
5679 #$i_inttypes I_INTTYPES
5680 #ifdef I_INTTYPES
5681 #include <inttypes.h>
5682 #endif
5683 int main() { int64_t x = 7; }
5684 EOCP
5685 set try
5686 if eval $compile; then
5687         val="$define"
5688         echo "You have int64_t."
5689 else
5690         val="$undef"
5691         echo "You do not have int64_t."
5692 fi
5693 $rm_try
5694 set d_int64_t
5695 eval $setvar
5696
5697 : Check if 64bit ints have a quad type
5698 echo " "
5699 echo "Checking which 64-bit integer type we could use..." >&4
5700
5701 case "$intsize" in
5702 8) val=int
5703    set quadtype
5704    eval $setvar
5705    val='"unsigned int"'
5706    set uquadtype
5707    eval $setvar
5708    quadkind=1
5709    ;;
5710 *) case "$longsize" in
5711    8) val=long
5712       set quadtype
5713       eval $setvar
5714       val='"unsigned long"'
5715       set uquadtype
5716       eval $setvar
5717       quadkind=2
5718       ;;
5719    *) case "$d_longlong:$longlongsize" in
5720       define:8)
5721         val='"long long"'
5722         set quadtype
5723         eval $setvar
5724         val='"unsigned long long"'
5725         set uquadtype
5726         eval $setvar
5727         quadkind=3
5728         ;;
5729       *) case "$d_int64_t" in
5730          define)
5731            val=int64_t
5732            set quadtype
5733            eval $setvar
5734            val=uint64_t
5735            set uquadtype
5736            eval $setvar
5737            quadkind=4
5738            ;;
5739          esac
5740          ;;
5741       esac
5742       ;;
5743    esac
5744    ;;
5745 esac
5746
5747 case "$quadtype" in
5748 '')     echo "Alas, no 64-bit integer types in sight." >&4
5749         d_quad="$undef"
5750         ;;
5751 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5752         d_quad="$define"
5753         ;;
5754 esac
5755
5756 : Do we want 64bit support
5757 case "$uselonglong" in
5758 "$define"|true|[yY]*)
5759         cat <<EOM >&4
5760
5761 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5762 EOM
5763         use64bitint="$define"
5764         ;;
5765 esac
5766 case "$use64bits" in
5767 "$define"|true|[yY]*)
5768         cat <<EOM >&4
5769
5770 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5771 EOM
5772         use64bitint="$define"
5773         ;;
5774 esac
5775 case "$use64bitints" in
5776 "$define"|true|[yY]*)
5777         cat <<EOM >&4
5778
5779 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5780 EOM
5781         use64bitint="$define"
5782         ;;
5783 esac
5784 case "$use64bitsint" in
5785 "$define"|true|[yY]*)
5786         cat <<EOM >&4
5787
5788 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5789 EOM
5790         use64bitint="$define"
5791         ;;
5792 esac
5793 case "$uselonglongs" in
5794 "$define"|true|[yY]*)
5795         cat <<EOM >&4
5796
5797 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5798 EOM
5799         use64bitint="$define"
5800         ;;
5801 esac
5802 case "$use64bitsall" in
5803 "$define"|true|[yY]*)
5804         cat <<EOM >&4
5805
5806 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5807 EOM
5808         use64bitall="$define"
5809         ;;
5810 esac
5811
5812 case "$ccflags" in
5813 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5814 esac
5815 case "$use64bitall" in
5816 "$define"|true|[yY]*) use64bitint="$define" ;;
5817 esac
5818
5819 case "$longsize" in
5820 8) cat <<EOM
5821
5822 You have natively 64-bit long integers.
5823 EOM
5824    val="$define"
5825    ;;
5826 *) case "$use64bitint" in
5827    "$define"|true|[yY]*) dflt='y';;
5828    *) dflt='n';;
5829    esac
5830    case "$d_quad" in
5831    "$define") ;;
5832    *) dflt='n' ;;
5833    esac
5834    cat <<EOM
5835
5836 Perl can be built to take advantage of 64-bit integer types
5837 on some systems.  To do so, Configure can be run with -Duse64bitint.
5838 Choosing this option will most probably introduce binary incompatibilities.
5839
5840 If this doesn't make any sense to you, just accept the default '$dflt'.
5841 (The default has been chosen based on your configuration.)
5842 EOM
5843    rp='Try to use 64-bit integers, if available?'
5844    . ./myread
5845    case "$ans" in
5846    [yY]*) val="$define" ;;
5847    *)     val="$undef"  ;;
5848    esac
5849    ;;
5850 esac
5851 set use64bitint
5852 eval $setvar
5853
5854 case "$use64bitall" in
5855 "$define"|true|[yY]*) dflt='y' ;;
5856 *) case "$longsize" in
5857    8) dflt='y' ;;
5858    *) dflt='n' ;;
5859    esac
5860    ;;
5861 esac
5862 cat <<EOM
5863
5864 You may also choose to try maximal 64-bitness.  It means using as much
5865 64-bitness as possible on the platform.  This in turn means even more
5866 binary incompatibilities.  On the other hand, your platform may not
5867 have any more 64-bitness available than what you already have chosen.
5868
5869 If this doesn't make any sense to you, just accept the default '$dflt'.
5870 (The default has been chosen based on your configuration.)
5871 EOM
5872 rp='Try to use maximal 64-bit support, if available?'
5873 . ./myread
5874 case "$ans" in
5875 [yY]*) val="$define" ;;
5876 *)     val="$undef"  ;;
5877 esac
5878 set use64bitall
5879 eval $setvar
5880 case "$use64bitall" in
5881 "$define")
5882         case "$use64bitint" in
5883         "$undef")
5884                 cat <<EOM
5885
5886 Since you have chosen a maximally 64-bit build, I'm also turning on
5887 the use of 64-bit integers.
5888 EOM
5889                 use64bitint="$define" ;;
5890         esac
5891         ;;
5892 esac
5893
5894 : Look for a hint-file generated 'call-back-unit'.  If the
5895 : user has specified that a 64-bit perl is to be built,
5896 : we may need to set or change some other defaults.
5897 if $test -f use64bitint.cbu; then
5898         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5899         . ./use64bitint.cbu
5900 fi
5901 case "$use64bitint" in
5902 "$define"|true|[yY]*)
5903         case "$longsize" in
5904         4) case "$archname64" in
5905            '') archname64=64int ;;
5906            esac
5907            ;;
5908         esac
5909         ;;
5910 esac
5911
5912 : Look for a hint-file generated 'call-back-unit'.  If the
5913 : user has specified that a maximally 64-bit perl is to be built,
5914 : we may need to set or change some other defaults.
5915 if $test -f use64bitall.cbu; then
5916         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5917         . ./use64bitall.cbu
5918 fi
5919 case "$use64bitall" in
5920 "$define"|true|[yY]*)
5921         case "$longsize" in
5922         4) case "$archname64" in
5923            ''|64int) archname64=64all ;;
5924            esac
5925            ;;
5926         esac
5927         ;;
5928 esac
5929
5930 case "$d_quad:$use64bitint" in
5931 $undef:$define)
5932         cat >&4 <<EOF
5933
5934 *** You have chosen to use 64-bit integers,
5935 *** but none can be found.
5936 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5937 *** Cannot continue, aborting.
5938
5939 EOF
5940         exit 1
5941         ;;
5942 esac
5943
5944 : check for length of double
5945 echo " "
5946 case "$doublesize" in
5947 '')
5948         echo "Checking to see how big your double precision numbers are..." >&4
5949         $cat >try.c <<EOCP
5950 #include <stdio.h>
5951 #$i_stdlib I_STDLIB
5952 #ifdef I_STDLIB
5953 #include <stdlib.h>
5954 #endif
5955 int main()
5956 {
5957     printf("%d\n", (int)sizeof(double));
5958     exit(0);
5959 }
5960 EOCP
5961         set try
5962         if eval $compile_ok; then
5963                 doublesize=`$run ./try`
5964                 echo "Your double is $doublesize bytes long."
5965         else
5966                 dflt='8'
5967                 echo "(I can't seem to compile the test program.  Guessing...)"
5968                 rp="What is the size of a double precision number (in bytes)?"
5969                 . ./myread
5970                 doublesize="$ans"
5971         fi
5972         ;;
5973 esac
5974 $rm_try
5975
5976 : check for long doubles
5977 echo " "
5978 echo "Checking to see if you have long double..." >&4
5979 echo 'int main() { long double x = 7.0; }' > try.c
5980 set try
5981 if eval $compile; then
5982         val="$define"
5983         echo "You have long double."
5984 else
5985         val="$undef"
5986         echo "You do not have long double."
5987 fi
5988 $rm_try
5989 set d_longdbl
5990 eval $setvar
5991
5992 : check for length of long double
5993 case "${d_longdbl}${longdblsize}" in
5994 $define)
5995         echo " "
5996         echo "Checking to see how big your long doubles are..." >&4
5997         $cat >try.c <<'EOCP'
5998 #include <stdio.h>
5999 int main()
6000 {
6001         printf("%d\n", sizeof(long double));
6002 }
6003 EOCP
6004         set try
6005         set try
6006         if eval $compile; then
6007                 longdblsize=`$run ./try`
6008                 echo "Your long doubles are $longdblsize bytes long."
6009         else
6010                 dflt='8'
6011                 echo " "
6012                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6013                 rp="What is the size of a long double (in bytes)?"
6014                 . ./myread
6015                 longdblsize="$ans"
6016         fi
6017         if $test "X$doublesize" = "X$longdblsize"; then
6018                 echo "That isn't any different from an ordinary double."
6019                 echo "I'll keep your setting anyway, but you may see some"
6020                 echo "harmless compilation warnings."
6021         fi
6022         ;;
6023 esac
6024 $rm_try
6025
6026 : determine the architecture name
6027 echo " "
6028 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6029         tarch=`arch`"-$osname"
6030 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6031         if uname -m > tmparch 2>&1 ; then
6032                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6033                         -e 's/$/'"-$osname/" tmparch`
6034         else
6035                 tarch="$osname"
6036         fi
6037         $rm -f tmparch
6038 else
6039         tarch="$osname"
6040 fi
6041 case "$myarchname" in
6042 ''|"$tarch") ;;
6043 *)
6044         echo "(Your architecture name used to be $myarchname.)"
6045         archname=''
6046         ;;
6047 esac
6048 case "$targetarch" in
6049 '') ;;
6050 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6051 esac
6052 myarchname="$tarch"
6053 case "$archname" in
6054 '') dflt="$tarch";;
6055 *) dflt="$archname";;
6056 esac
6057 rp='What is your architecture name'
6058 . ./myread
6059 archname="$ans"
6060 case "$usethreads" in
6061 $define)
6062         echo "Threads selected." >&4
6063         case "$archname" in
6064         *-thread*) echo "...and architecture name already has -thread." >&4
6065                 ;;
6066         *)      archname="$archname-thread"
6067                 echo "...setting architecture name to $archname." >&4
6068                 ;;
6069         esac
6070         ;;
6071 esac
6072 case "$usemultiplicity" in
6073 $define)
6074         echo "Multiplicity selected." >&4
6075         case "$archname" in
6076         *-multi*) echo "...and architecture name already has -multi." >&4
6077                 ;;
6078         *)      archname="$archname-multi"
6079                 echo "...setting architecture name to $archname." >&4
6080                 ;;
6081         esac
6082         ;;
6083 esac
6084 case "$use64bitint$use64bitall" in
6085 *"$define"*)
6086         case "$archname64" in
6087         '')
6088                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6089                 ;;
6090         *)
6091                 case "$use64bitint" in
6092                 "$define") echo "64 bit integers selected." >&4 ;;
6093                 esac
6094                 case "$use64bitall" in
6095                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6096                 esac
6097                 case "$archname" in
6098                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6099                         ;;
6100                 *)      archname="$archname-$archname64"
6101                         echo "...setting architecture name to $archname." >&4
6102                         ;;
6103                 esac
6104                 ;;
6105         esac
6106 esac
6107 case "$uselongdouble" in
6108 $define)
6109         echo "Long doubles selected." >&4
6110         case "$longdblsize" in
6111         $doublesize)
6112                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6113                 ;;
6114         *)
6115                 case "$archname" in
6116                 *-ld*) echo "...and architecture name already has -ld." >&4
6117                         ;;
6118                 *)      archname="$archname-ld"
6119                         echo "...setting architecture name to $archname." >&4
6120                         ;;
6121                 esac
6122                 ;;
6123         esac
6124         ;;
6125 esac
6126 case "$useperlio" in
6127 $define)
6128         echo "Perlio selected." >&4
6129         ;;
6130 *)
6131         echo "Perlio not selected, using stdio." >&4
6132         case "$archname" in
6133         *-stdio*) echo "...and architecture name already has -stdio." >&4
6134                 ;;
6135         *)      archname="$archname-stdio"
6136                 echo "...setting architecture name to $archname." >&4
6137                 ;;
6138         esac
6139         ;;
6140 esac
6141 if $test -f archname.cbu; then
6142         echo "Your platform has some specific hints for architecture name, using them..."
6143         . ./archname.cbu
6144 fi
6145
6146 : set the prefixit variable, to compute a suitable default value
6147 prefixit='case "$3" in
6148 ""|none)
6149         case "$oldprefix" in
6150         "") eval "$1=\"\$$2\"";;
6151         *)
6152                 case "$3" in
6153                 "") eval "$1=";;
6154                 none)
6155                         eval "tp=\"\$$2\"";
6156                         case "$tp" in
6157                         ""|" ") eval "$1=\"\$$2\"";;
6158                         *) eval "$1=";;
6159                         esac;;
6160                 esac;;
6161         esac;;
6162 *)
6163         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6164         case "$tp" in
6165         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6166         /*-$oldprefix/*|\~*-$oldprefix/*)
6167                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6168         *) eval "$1=\"\$$2\"";;
6169         esac;;
6170 esac'
6171
6172 : determine installation style
6173 : For now, try to deduce it from prefix unless it is already set.
6174 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6175 case "$installstyle" in
6176 '')     case "$prefix" in
6177                 *perl*) dflt='lib';;
6178                 *) dflt='lib/perl5' ;;
6179         esac
6180         ;;
6181 *)      dflt="$installstyle" ;;
6182 esac
6183 : Probably not worth prompting for this since we prompt for all
6184 : the directories individually, and the prompt would be too long and
6185 : confusing anyway.
6186 installstyle=$dflt
6187
6188 : determine where public executables go
6189 echo " "
6190 set dflt bin bin
6191 eval $prefixit
6192 fn=d~
6193 rp='Pathname where the public executables will reside?'
6194 . ./getfile
6195 if $test "X$ansexp" != "X$binexp"; then
6196         installbin=''
6197 fi
6198 prefixvar=bin
6199 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6200 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6201 :     this via initialinstalllocation
6202 . ./setprefixvar
6203
6204 case "$userelocatableinc" in
6205 $define|true|[yY]*)     dflt='y' ;;
6206 *)                      dflt='n' ;;
6207 esac
6208 cat <<EOM
6209
6210 Would you like to build Perl so that the installation is relocatable, so that
6211 library paths in @INC are determined relative to the path of the perl binary?
6212 This is not advised for system Perl installs, or if you need to run setid
6213 scripts or scripts under taint mode.
6214
6215 If this doesn't make any sense to you, just accept the default '$dflt'.
6216 EOM
6217 rp='Use relocatable @INC?'
6218 . ./myread
6219 case "$ans" in
6220 y|Y)    val="$define" ;;
6221 *)      val="$undef"  ;;
6222 esac
6223 set userelocatableinc
6224 eval $setvar
6225
6226 initialinstalllocation="$binexp"
6227 : Default prefix is now "up one level from where the binaries are"
6228 case "$userelocatableinc" in
6229 $define|true|[yY]*)
6230     bin=".../"
6231     binexp=".../"
6232     prefix=".../.."
6233     prefixexp=".../.."
6234     installprefixexp=".../.."
6235     ;;
6236 esac
6237
6238 : determine where private library files go
6239 : Usual default is /usr/local/lib/perl5/$version.
6240 : Also allow things like /opt/perl/lib/$version, since
6241 : /opt/perl/lib/perl5... would be redundant.
6242 : The default "style" setting is made in installstyle.U
6243 case "$installstyle" in
6244 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6245 *)       set dflt privlib lib/$version ;;
6246 esac
6247 eval $prefixit
6248 $cat <<EOM
6249
6250 There are some auxiliary files for $package that need to be put into a
6251 private library directory that is accessible by everyone.
6252
6253 EOM
6254 fn=$binexp
6255 fn=d~+
6256 rp='Pathname where the private library files will reside?'
6257 . ./getfile
6258 prefixvar=privlib
6259 . ./setprefixvar
6260
6261 : set the prefixup variable, to restore leading tilda escape
6262 prefixup='case "$prefixexp" in
6263 "$prefix") ;;
6264 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6265 esac'
6266
6267 : determine where public architecture dependent libraries go
6268 set archlib archlib
6269 eval $prefixit
6270 : privlib default is /usr/local/lib/$package/$version
6271 : archlib default is /usr/local/lib/$package/$version/$archname
6272 : privlib may have an optional trailing /share.
6273 tdflt=`echo $privlib | $sed 's,/share$,,'`
6274 tdflt=$tdflt/$archname
6275 case "$archlib" in
6276 '')     dflt=$tdflt
6277         ;;
6278 *)      dflt="$archlib"
6279     ;;
6280 esac
6281 $cat <<EOM
6282
6283 $spackage contains architecture-dependent library files.  If you are
6284 sharing libraries in a heterogeneous environment, you might store
6285 these files in a separate location.  Otherwise, you can just include
6286 them with the rest of the public library files.
6287
6288 EOM
6289 fn=$binexp
6290 fn=d+~
6291 rp='Where do you want to put the public architecture-dependent libraries?'
6292 . ./getfile
6293 prefixvar=archlib
6294 . ./setprefixvar
6295 if $test X"$archlib" = X"$privlib"; then
6296         d_archlib="$undef"
6297 else
6298         d_archlib="$define"
6299 fi
6300
6301 : see if setuid scripts can be secure
6302 $cat <<EOM
6303
6304 Some kernels have a bug that prevents setuid #! scripts from being
6305 secure.  Some sites have disabled setuid #! scripts because of this.
6306
6307 First let's decide if your kernel supports secure setuid #! scripts.
6308 (If setuid #! scripts would be secure but have been disabled anyway,
6309 don't say that they are secure if asked.)
6310
6311 EOM
6312
6313 val="$undef"
6314 if $test -d /dev/fd; then
6315         echo "#!$ls" >reflect
6316         chmod +x,u+s reflect
6317         ./reflect >flect 2>&1
6318         if $contains "/dev/fd" flect >/dev/null; then
6319                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6320                 val="$define"
6321         else
6322                 $cat <<EOM
6323 If you are not sure if they are secure, I can check but I'll need a
6324 username and password different from the one you are using right now.
6325 If you don't have such a username or don't want me to test, simply
6326 enter 'none'.
6327
6328 EOM
6329                 rp='Other username to test security of setuid scripts with?'
6330                 dflt='none'
6331                 . ./myread
6332                 case "$ans" in
6333                 n|none)
6334                         case "$d_suidsafe" in
6335                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6336                                 dflt=n;;
6337                         "$undef")
6338                                 echo "Well, the $hint value is *not* secure." >&4
6339                                 dflt=n;;
6340                         *)      echo "Well, the $hint value *is* secure." >&4
6341                                 dflt=y;;
6342                         esac
6343                         ;;
6344                 *)
6345                         $rm -f reflect flect
6346                         echo "#!$ls" >reflect
6347                         chmod +x,u+s reflect
6348                         echo >flect
6349                         chmod a+w flect
6350                         echo '"su" will (probably) prompt you for '"$ans's password."
6351                         su $ans -c './reflect >flect'
6352                         if $contains "/dev/fd" flect >/dev/null; then
6353                                 echo "Okay, it looks like setuid scripts are secure." >&4
6354                                 dflt=y
6355                         else
6356                                 echo "I don't think setuid scripts are secure." >&4
6357                                 dflt=n
6358                         fi
6359                         ;;
6360                 esac
6361                 rp='Does your kernel have *secure* setuid scripts?'
6362                 . ./myread
6363                 case "$ans" in
6364                 [yY]*)  val="$define";;
6365                 *)      val="$undef";;
6366                 esac
6367         fi
6368 else
6369         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6370         echo "(That's for file descriptors, not floppy disks.)"
6371         val="$undef"
6372 fi
6373 set d_suidsafe
6374 eval $setvar
6375
6376 $rm -f reflect flect
6377
6378 : now see if they want to do setuid emulation
6379 if $test $patchlevel -lt 11; then
6380 echo " "
6381 val="$undef"
6382 case "$d_suidsafe" in
6383 "$define")
6384         val="$undef"
6385         echo "No need to emulate SUID scripts since they are secure here." >&4
6386         ;;
6387 *)
6388         $cat <<EOM
6389 Some systems have disabled setuid scripts, especially systems where
6390 setuid scripts cannot be secure.  On systems where setuid scripts have
6391 been disabled, the setuid/setgid bits on scripts are currently
6392 useless.  It is possible for $package to detect those bits and emulate
6393 setuid/setgid in a secure fashion.  This emulation will only work if
6394 setuid scripts have been disabled in your kernel.
6395
6396 EOM
6397         case "$d_dosuid" in
6398         "$define") dflt=y ;;
6399         *) dflt=n ;;
6400         esac
6401         rp="Do you want to do setuid/setgid emulation?"
6402         . ./myread
6403         case "$ans" in
6404         [yY]*)  val="$define";;
6405         *)      val="$undef";;
6406         esac
6407         ;;
6408 esac
6409 set d_dosuid
6410 eval $setvar
6411 else
6412     case "$d_dosuid" in
6413         "$define")
6414         cat >&4 <<EOH
6415
6416 SUID emulation has been removed for 5.12
6417 Please re-run Configure without -Dd_dosuid
6418
6419 EOH
6420         exit 1;
6421         ;;
6422     esac
6423     d_dosuid=undef
6424 fi
6425
6426 : Find perl5.005 or later.
6427 echo "Looking for a previously installed perl5.005 or later... "
6428 case "$perl5" in
6429 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6430                 : Check if this perl is recent and can load a simple module
6431                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6432                         perl5=$tdir/perl
6433                         break;
6434                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6435                         perl5=$tdir/perl5
6436                         break;
6437                 fi
6438         done
6439         ;;
6440 *)      perl5="$perl5"
6441         ;;
6442 esac
6443 case "$perl5" in
6444 '')     echo "None found.  That's ok.";;
6445 *)      echo "Using $perl5." ;;
6446 esac
6447
6448 : Set the siteprefix variables
6449 $cat <<EOM
6450
6451 After $package is installed, you may wish to install various
6452 add-on modules and utilities.  Typically, these add-ons will
6453 be installed under $prefix with the rest
6454 of this package.  However, you may wish to install such add-ons
6455 elsewhere under a different prefix.
6456
6457 If you do not wish to put everything under a single prefix, that's
6458 ok.  You will be prompted for the individual locations; this siteprefix
6459 is only used to suggest the defaults.
6460
6461 The default should be fine for most people.
6462
6463 EOM
6464 fn=d~+
6465 rp='Installation prefix to use for add-on modules and utilities?'
6466 : XXX Here might be another good place for an installstyle setting.
6467 case "$siteprefix" in
6468 '') dflt=$prefix ;;
6469 *)  dflt=$siteprefix ;;
6470 esac
6471 . ./getfile
6472 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6473 oldsiteprefix=''
6474 case "$siteprefix" in
6475 '') ;;
6476 *)      case "$ans" in
6477         "$prefix") ;;
6478         *) oldsiteprefix="$prefix";;
6479         esac
6480         ;;
6481 esac
6482 siteprefix="$ans"
6483 siteprefixexp="$ansexp"
6484
6485 : determine where site specific libraries go.
6486 : Usual default is /usr/local/lib/perl5/site_perl/$version
6487 : The default "style" setting is made in installstyle.U
6488 : XXX No longer works with Prefixit stuff.
6489 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6490 case "$sitelib" in
6491 '') case "$installstyle" in
6492         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6493         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6494         esac
6495         ;;
6496 *)      dflt="$sitelib"
6497         ;;
6498 esac
6499 $cat <<EOM
6500
6501 The installation process will create a directory for
6502 site-specific extensions and modules.  Most users find it convenient
6503 to place all site-specific files in this directory rather than in the
6504 main distribution directory.
6505
6506 EOM
6507 fn=d~+
6508 rp='Pathname for the site-specific library files?'
6509 . ./getfile
6510 prefixvar=sitelib
6511 . ./setprefixvar
6512 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6513
6514 : Determine list of previous versions to include in @INC
6515 $cat > getverlist <<EOPL
6516 #!$perl5 -w
6517 use File::Basename;
6518 \$api_versionstring = "$api_versionstring";
6519 \$version = "$version";
6520 \$stem = "$sitelib_stem";
6521 \$archname = "$archname";
6522 EOPL
6523         $cat >> getverlist <<'EOPL'
6524 # The list found is store twice for each entry: the original name, and
6525 # the binary broken down version as pack "sss", so sorting is easy and
6526 # unambiguous. This will work for all versions that have a maximum of
6527 # three digit groups, separate by '.'s or '_'s. Names are extended with
6528 # ".0.0" to ensure at least three elements for the pack.
6529 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6530
6531 # Can't have leading @ because metaconfig interprets it as a command!
6532 ;@inc_version_list=();
6533 # XXX Redo to do opendir/readdir?
6534 if (-d $stem) {
6535     chdir($stem);
6536     ;@candidates = map {
6537         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6538     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6539 }
6540 else {
6541     ;@candidates = ();
6542 }
6543
6544 ($pversion, $aversion, $vsn5005) = map {
6545     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6546 foreach $d (@candidates) {
6547     if ($d->[1] lt $pversion) {
6548         if ($d->[1] ge $aversion) {
6549             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6550         }
6551         elsif ($d->[1] ge $vsn5005) {
6552             unshift(@inc_version_list, grep { -d } $d->[0]);
6553         }
6554     }
6555     else {
6556         # Skip newer version.  I.e. don't look in
6557         # 5.7.0 if we're installing 5.6.1.
6558     }
6559 }
6560
6561 if (@inc_version_list) {
6562     print join(' ', @inc_version_list);
6563 }
6564 else {
6565     # Blank space to preserve value for next Configure run.
6566     print " ";
6567 }
6568 EOPL
6569 chmod +x getverlist
6570 case "$inc_version_list" in
6571 '')     if test -x "$perl5$exe_ext"; then
6572                 dflt=`$perl5 getverlist`
6573         else
6574                 dflt='none'
6575         fi
6576         ;;
6577 $undef) dflt='none' ;;
6578 *)  eval dflt=\"$inc_version_list\" ;;
6579 esac
6580 case "$dflt" in
6581 ''|' ') dflt=none ;;
6582 esac
6583 case "$dflt" in
6584 5.005) dflt=none ;;
6585 esac
6586 $cat <<EOM
6587
6588 In order to ease the process of upgrading, this version of perl
6589 can be configured to use modules built and installed with earlier
6590 versions of perl that were installed under $prefix.  Specify here
6591 the list of earlier versions that this version of perl should check.
6592 If Configure detected no earlier versions of perl installed under
6593 $prefix, then the list will be empty.  Answer 'none' to tell perl
6594 to not search earlier versions.
6595
6596 The default should almost always be sensible, so if you're not sure,
6597 just accept the default.
6598 EOM
6599
6600 rp='List of earlier versions to include in @INC?'
6601 . ./myread
6602 case "$ans" in
6603 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6604 *) inc_version_list="$ans" ;;
6605 esac
6606 case "$inc_version_list" in
6607 ''|' ')
6608         inc_version_list_init='0'
6609         d_inc_version_list="$undef"
6610         ;;
6611 *)      inc_version_list_init=`echo $inc_version_list |
6612                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6613         d_inc_version_list="$define"
6614         ;;
6615 esac
6616 $rm -f getverlist
6617
6618 : see if malloc/malloc.h has to be included
6619 set malloc/malloc.h i_mallocmalloc
6620 eval $inhdr
6621
6622 : see if this is a malloc.h system
6623 : we want a real compile instead of Inhdr because some systems have a
6624 : malloc.h that just gives a compile error saying to use stdlib.h instead
6625 echo " "
6626 $cat >try.c <<EOCP
6627 #include <stdlib.h>
6628 #include <malloc.h>
6629 #$i_mallocmalloc I_MALLOCMALLOC
6630 #ifdef I_MALLOCMALLOC
6631 # include <malloc/malloc.h>
6632 #endif
6633
6634 int main () { return 0; }
6635 EOCP
6636 set try
6637 if eval $compile; then
6638     echo "<malloc.h> found." >&4
6639     val="$define"
6640 else
6641     echo "<malloc.h> NOT found." >&4
6642     val="$undef"
6643 fi
6644 $rm_try
6645 set i_malloc
6646 eval $setvar
6647
6648 : check for void type
6649 echo " "
6650 echo "Checking to see how well your C compiler groks the void type..." >&4
6651 case "$voidflags" in
6652 '')
6653         $cat >try.c <<EOCP
6654 #$i_stdlib I_STDLIB
6655 #ifdef I_STDLIB
6656 #include <stdlib.h>
6657 #endif
6658 #if TRY & 1
6659 void sub() {
6660 #else
6661 sub() {
6662 #endif
6663         extern void moo();      /* function returning void */
6664         void (*goo)();          /* ptr to func returning void */
6665 #if TRY & 8
6666         void *hue;              /* generic ptr */
6667 #endif
6668 #if TRY & 2
6669         void (*foo[10])();
6670 #endif
6671
6672 #if TRY & 4
6673         if(goo == moo) {
6674                 exit(0);
6675         }
6676 #endif
6677         exit(0);
6678 }
6679 int main() { sub(); }
6680 EOCP
6681         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6682                 voidflags=$defvoidused
6683         echo "Good.  It appears to support void to the level $package wants.">&4
6684                 if $contains warning .out >/dev/null 2>&1; then
6685                         echo "However, you might get some warnings that look like this:"
6686                         $cat .out
6687                 fi
6688         else
6689 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6690                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6691                         echo "It supports 1..."
6692                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6693                                 echo "It also supports 2..."
6694                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6695                                         voidflags=7
6696                                         echo "And it supports 4 but not 8 definitely."
6697                                 else
6698                                         echo "It doesn't support 4..."
6699                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6700                                                 voidflags=11
6701                                                 echo "But it supports 8."
6702                                         else
6703                                                 voidflags=3
6704                                                 echo "Neither does it support 8."
6705                                         fi
6706                                 fi
6707                         else
6708                                 echo "It does not support 2..."
6709                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6710                                         voidflags=13
6711                                         echo "But it supports 4 and 8."
6712                                 else
6713                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6714                                                 voidflags=5
6715                                                 echo "And it supports 4 but has not heard about 8."
6716                                         else
6717                                                 echo "However it supports 8 but not 4."
6718                                         fi
6719                                 fi
6720                         fi
6721                 else
6722                         echo "There is no support at all for void."
6723                         voidflags=0
6724                 fi
6725         fi
6726 esac
6727 case "$voidflags" in
6728 "$defvoidused") ;;
6729 *)      $cat >&4 <<'EOM'
6730   Support flag bits are:
6731     1: basic void declarations.
6732     2: arrays of pointers to functions returning void.
6733     4: operations between pointers to and addresses of void functions.
6734     8: generic void pointers.
6735 EOM
6736         dflt="$voidflags";
6737         rp="Your void support flags add up to what?"
6738         . ./myread
6739         voidflags="$ans"
6740         ;;
6741 esac
6742 $rm_try
6743
6744 : check for length of pointer
6745 echo " "
6746 case "$ptrsize" in
6747 '')
6748         echo "Checking to see how big your pointers are..." >&4
6749         if test "$voidflags" -gt 7; then
6750                 echo '#define VOID_PTR char *' > try.c
6751         else
6752                 echo '#define VOID_PTR void *' > try.c
6753         fi
6754         $cat >>try.c <<EOCP
6755 #include <stdio.h>
6756 #$i_stdlib I_STDLIB
6757 #ifdef I_STDLIB
6758 #include <stdlib.h>
6759 #endif
6760 int main()
6761 {
6762     printf("%d\n", (int)sizeof(VOID_PTR));
6763     exit(0);
6764 }
6765 EOCP
6766         set try
6767         if eval $compile_ok; then
6768                 ptrsize=`$run ./try`
6769                 echo "Your pointers are $ptrsize bytes long."
6770         else
6771                 dflt='4'
6772                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6773                 rp="What is the size of a pointer (in bytes)?"
6774                 . ./myread
6775                 ptrsize="$ans"
6776         fi
6777         ;;
6778 esac
6779 $rm_try
6780 case "$use64bitall" in
6781 "$define"|true|[yY]*)
6782         case "$ptrsize" in
6783         4)      cat <<EOM >&4
6784
6785 *** You have chosen a maximally 64-bit build,
6786 *** but your pointers are only 4 bytes wide.
6787 *** Please rerun Configure without -Duse64bitall.
6788 EOM
6789                 case "$d_quad" in
6790                 define)
6791                         cat <<EOM >&4
6792 *** Since you have quads, you could possibly try with -Duse64bitint.
6793 EOM
6794                         ;;
6795                 esac
6796                 cat <<EOM >&4
6797 *** Cannot continue, aborting.
6798
6799 EOM
6800
6801                 exit 1
6802                 ;;
6803         esac
6804         ;;
6805 esac
6806
6807
6808 : determine whether to use malloc wrapping
6809 echo " "
6810 case "$usemallocwrap" in
6811 [yY]*|true|$define)     dflt='y' ;;
6812 [nN]*|false|$undef)     dflt='n' ;;
6813 *)      case "$usedevel" in
6814         [yY]*|true|$define)     dflt='y' ;;
6815         *) dflt='n' ;;
6816         esac
6817         ;;
6818 esac
6819 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6820 . ./myread
6821 usemallocwrap="$ans"
6822 case "$ans" in
6823 y*|true)
6824         usemallocwrap="$define" ;;
6825 *)
6826         usemallocwrap="$undef" ;;
6827 esac
6828
6829 : determine which malloc to compile in
6830 echo " "
6831 case "$usemymalloc" in
6832 [yY]*|true|$define)     dflt='y' ;;
6833 [nN]*|false|$undef)     dflt='n' ;;
6834 *)      case "$ptrsize" in
6835         4) dflt='y' ;;
6836         *) dflt='n' ;;
6837         esac
6838         ;;
6839 esac
6840 rp="Do you wish to attempt to use the malloc that comes with $package?"
6841 . ./myread
6842 usemymalloc="$ans"
6843 case "$ans" in
6844 y*|true)
6845         usemymalloc='y'
6846         mallocsrc='malloc.c'
6847         mallocobj="malloc$_o"
6848         d_mymalloc="$define"
6849         case "$libs" in
6850         *-lmalloc*)
6851                 : Remove malloc from list of libraries to use
6852                 echo "Removing unneeded -lmalloc from library list" >&4
6853                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6854                 shift
6855                 libs="$*"
6856                 echo "libs = $libs" >&4
6857                 ;;
6858         esac
6859         ;;
6860 *)
6861         usemymalloc='n'
6862         mallocsrc=''
6863         mallocobj=''
6864         d_mymalloc="$undef"
6865         ;;
6866 esac
6867
6868 : compute the return types of malloc and free
6869 echo " "
6870 $cat >malloc.c <<END
6871 #$i_malloc I_MALLOC
6872 #$i_stdlib I_STDLIB
6873 #include <stdio.h>
6874 #include <sys/types.h>
6875 #ifdef I_MALLOC
6876 #include <malloc.h>
6877 #endif
6878 #ifdef I_STDLIB
6879 #include <stdlib.h>
6880 #endif
6881 #ifdef TRY_MALLOC
6882 void *malloc();
6883 #endif
6884 #ifdef TRY_FREE
6885 void free();
6886 #endif
6887 END
6888 case "$malloctype" in
6889 '')
6890         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6891                 malloctype='void *'
6892         else
6893                 malloctype='char *'
6894         fi
6895         ;;
6896 esac
6897 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6898
6899 case "$freetype" in
6900 '')
6901         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6902                 freetype='void'
6903         else
6904                 freetype='int'
6905         fi
6906         ;;
6907 esac
6908 echo "Your system uses $freetype free(), it would seem." >&4
6909 $rm -f malloc.[co]
6910 : determine where site specific architecture-dependent libraries go.
6911 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6912 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6913 : sitelib may have an optional trailing /share.
6914 case "$sitearch" in
6915 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6916         dflt="$dflt/$archname"
6917         ;;
6918 *)      dflt="$sitearch"
6919         ;;
6920 esac
6921 set sitearch sitearch none
6922 eval $prefixit
6923 $cat <<EOM
6924
6925 The installation process will also create a directory for
6926 architecture-dependent site-specific extensions and modules.
6927
6928 EOM
6929 fn=d~+
6930 rp='Pathname for the site-specific architecture-dependent library files?'
6931 . ./getfile
6932 prefixvar=sitearch
6933 . ./setprefixvar
6934 if $test X"$sitearch" = X"$sitelib"; then
6935         d_sitearch="$undef"
6936 else
6937         d_sitearch="$define"
6938 fi
6939
6940 : Set the vendorprefix variables
6941 $cat <<EOM
6942
6943 The installation process will also create a directory for
6944 vendor-supplied add-ons.  Vendors who supply perl with their system
6945 may find it convenient to place all vendor-supplied files in this
6946 directory rather than in the main distribution directory.  This will
6947 ease upgrades between binary-compatible maintenance versions of perl.
6948
6949 Of course you may also use these directories in whatever way you see
6950 fit.  For example, you might use them to access modules shared over a
6951 company-wide network.
6952
6953 The default answer should be fine for most people.
6954 This causes further questions about vendor add-ons to be skipped
6955 and no vendor-specific directories will be configured for perl.
6956
6957 EOM
6958 rp='Do you want to configure vendor-specific add-on directories?'
6959 case "$usevendorprefix" in
6960 define|true|[yY]*) dflt=y ;;
6961 *)      : User may have set vendorprefix directly on Configure command line.
6962         case "$vendorprefix" in
6963         ''|' ') dflt=n ;;
6964         *)      dflt=y ;;
6965         esac
6966         ;;
6967 esac
6968 . ./myread
6969 case "$ans" in
6970 [yY]*)  fn=d~+
6971         rp='Installation prefix to use for vendor-supplied add-ons?'
6972         case "$vendorprefix" in
6973         '') dflt='' ;;
6974         *)  dflt=$vendorprefix ;;
6975         esac
6976         . ./getfile
6977         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6978         oldvendorprefix=''
6979         case "$vendorprefix" in
6980         '') ;;
6981         *)      case "$ans" in
6982                 "$prefix") ;;
6983                 *) oldvendorprefix="$prefix";;
6984                 esac
6985                 ;;
6986         esac
6987         usevendorprefix="$define"
6988         vendorprefix="$ans"
6989         vendorprefixexp="$ansexp"
6990         ;;
6991 *)      usevendorprefix="$undef"
6992         vendorprefix=''
6993         vendorprefixexp=''
6994         ;;
6995 esac
6996
6997 : Set the vendorlib variables
6998 case "$vendorprefix" in
6999 '')     d_vendorlib="$undef"
7000         vendorlib=''
7001         vendorlibexp=''
7002         ;;
7003 *)      d_vendorlib="$define"
7004         : determine where vendor-supplied modules go.
7005         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7006         case "$vendorlib" in
7007         '')
7008                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7009                 case "$installstyle" in
7010                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7011                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7012                 esac
7013                 ;;
7014         *)      dflt="$vendorlib"
7015                 ;;
7016         esac
7017         fn=d~+
7018         rp='Pathname for the vendor-supplied library files?'
7019         . ./getfile
7020         vendorlib="$ans"
7021         vendorlibexp="$ansexp"
7022         ;;
7023 esac
7024 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7025 prefixvar=vendorlib
7026 . ./installprefix
7027
7028 : Set the vendorarch variables
7029 case "$vendorprefix" in
7030 '')     d_vendorarch="$undef"
7031         vendorarch=''
7032         vendorarchexp=''
7033         ;;
7034 *)      d_vendorarch="$define"
7035         : determine where vendor-supplied architecture-dependent libraries go.
7036         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7037         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7038         : vendorlib may have an optional trailing /share.
7039         case "$vendorarch" in
7040         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7041                 dflt="$dflt/$archname"
7042                 ;;
7043         *)      dflt="$vendorarch" ;;
7044         esac
7045         fn=d~+
7046         rp='Pathname for vendor-supplied architecture-dependent files?'
7047         . ./getfile
7048         vendorarch="$ans"
7049         vendorarchexp="$ansexp"
7050         ;;
7051 esac
7052 prefixvar=vendorarch
7053 . ./installprefix
7054 if $test X"$vendorarch" = X"$vendorlib"; then
7055         d_vendorarch="$undef"
7056 else
7057         d_vendorarch="$define"
7058 fi
7059
7060 : Final catch-all directories to search
7061 $cat <<EOM
7062
7063 Lastly, you can have perl look in other directories for extensions and
7064 modules in addition to those already specified.
7065 These directories will be searched after 
7066         $sitearch 
7067         $sitelib 
7068 EOM
7069 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7070 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7071 echo ' '
7072 case "$otherlibdirs" in
7073 ''|' ') dflt='none' ;;
7074 *)      dflt="$otherlibdirs" ;;
7075 esac
7076 $cat <<EOM
7077 Enter a colon-separated set of extra paths to include in perl's @INC
7078 search path, or enter 'none' for no extra paths.
7079
7080 EOM
7081
7082 rp='Colon-separated list of additional directories for perl to search?'
7083 . ./myread
7084 case "$ans" in
7085 ' '|''|none)    otherlibdirs=' ' ;;     
7086 *)      otherlibdirs="$ans" ;;
7087 esac
7088 case "$otherlibdirs" in
7089 ' ') val=$undef ;;
7090 *)      val=$define ;;
7091 esac
7092 set d_perl_otherlibdirs
7093 eval $setvar
7094
7095 : Cruising for prototypes
7096 echo " "
7097 echo "Checking out function prototypes..." >&4
7098 $cat >prototype.c <<EOCP
7099 #$i_stdlib I_STDLIB
7100 #ifdef I_STDLIB
7101 #include <stdlib.h>
7102 #endif
7103 int main(int argc, char *argv[]) {
7104         exit(0);}
7105 EOCP
7106 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7107         echo "Your C compiler appears to support function prototypes."
7108         val="$define"
7109 else
7110         echo "Your C compiler doesn't seem to understand function prototypes."
7111         val="$undef"
7112 fi
7113 set prototype
7114 eval $setvar
7115 $rm -f prototype*
7116
7117 : Check if ansi2knr is required
7118 case "$prototype" in
7119 "$define") ;;
7120 *)      ansi2knr='ansi2knr'
7121         echo " "
7122         cat <<EOM >&4
7123
7124 $me:  FATAL ERROR:
7125 This version of $package can only be compiled by a compiler that 
7126 understands function prototypes.  Unfortunately, your C compiler 
7127         $cc $ccflags
7128 doesn't seem to understand them.  Sorry about that.
7129
7130 If GNU cc is available for your system, perhaps you could try that instead.  
7131
7132 Eventually, we hope to support building Perl with pre-ANSI compilers.
7133 If you would like to help in that effort, please contact <perlbug@perl.org>.
7134
7135 Aborting Configure now.
7136 EOM
7137         exit 2
7138         ;;
7139 esac
7140
7141 : DTrace support
7142 dflt_dtrace='/usr/sbin/dtrace'
7143 cat <<EOM
7144
7145 Perl can be built to support DTrace on platforms that support it.
7146 DTrace is a diagnosis and performance analysis tool from Sun.
7147
7148 If this doesn't make any sense to you, just accept the default '$dflt'.
7149 EOM
7150
7151 while $test 1 ; do
7152         case "$usedtrace" in
7153         $define|true|[yY]*)
7154                 dflt='y'
7155                 ;;
7156         ?*)
7157                 dflt='y'
7158                 dflt_dtrace=$usedtrace
7159                 ;;
7160         *)
7161                 dflt='n'
7162                 ;;
7163         esac
7164
7165         rp='Support DTrace if available?'
7166         . ./myread
7167         case "$ans" in
7168         y|Y)    val="$define" ;;
7169         *)      val="$undef" ;;
7170         esac
7171         set usedtrace
7172         eval $setvar
7173
7174         test "X$usedtrace" != "X$define" && break
7175
7176         echo " "
7177         rp='Where is the dtrace executable?'
7178         dflt=$dflt_dtrace
7179         . ./getfile
7180         val="$ans"
7181         set dtrace
7182         eval $setvar
7183
7184         if $test -f $dtrace
7185         then
7186                 if $dtrace -h -s ../perldtrace.d \
7187                         -o perldtrace.tmp >/dev/null 2>&1 \
7188                         && rm -f perldtrace.tmp
7189                 then
7190                         echo " "
7191                         echo "Good: your $dtrace knows about the -h flag."
7192                 else
7193                         cat >&2 <<EOM
7194
7195 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7196 ***
7197 *** Your installed dtrace doesn't support the -h switch to compile a D
7198 *** program into a C header. Can't continue.
7199
7200 EOM
7201                         exit 1
7202                 fi
7203                 break;
7204         fi
7205
7206         case "$fastread" in
7207         yes)
7208                 cat >&2 <<EOM
7209
7210 *** $me:  Fatal Error:  $dtrace not found.
7211 *** Can't continue.
7212
7213 EOM
7214                 exit 1
7215                 ;;
7216         *)
7217                 echo "*** $dtrace was not found."
7218                 echo " "
7219                 ;;
7220         esac
7221 done
7222
7223 : See if we want extra modules installed
7224 echo " "
7225 case "$extras" in
7226 '') dflt='n';;
7227 *) dflt='y';;
7228 esac
7229 cat <<EOM
7230 Perl can be built with extra modules or bundles of modules which
7231 will be fetched from the CPAN and installed alongside Perl.
7232
7233 Notice that you will need access to the CPAN; either via the Internet,
7234 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7235 be asked later to configure the CPAN.pm module which will in turn do
7236 the installation of the rest of the extra modules or bundles.)
7237
7238 Notice also that if the modules require any external software such as
7239 libraries and headers (the libz library and the zlib.h header for the
7240 Compress::Zlib module, for example) you MUST have any such software
7241 already installed, this configuration process will NOT install such
7242 things for you.
7243
7244 If this doesn't make any sense to you, just accept the default '$dflt'.
7245 EOM
7246 rp='Install any extra modules (y or n)?'
7247 . ./myread
7248 case "$ans" in
7249 y|Y)
7250         cat <<EOM
7251
7252 Please list any extra modules or bundles to be installed from CPAN,
7253 with spaces between the names.  The names can be in any format the
7254 'install' command of CPAN.pm will understand.  (Answer 'none',
7255 without the quotes, to install no extra modules or bundles.)
7256 EOM
7257         rp='Extras?'
7258         dflt="$extras"
7259         . ./myread
7260         extras="$ans"
7261 esac
7262 case "$extras" in
7263 ''|'none')
7264         val=''
7265         $rm -f ../extras.lst
7266         ;;
7267 *)      echo "(Saving the list of extras for later...)"
7268         echo "$extras" > ../extras.lst
7269         val="'$extras'"
7270         ;;
7271 esac
7272 set extras
7273 eval $setvar
7274 echo " "
7275
7276 : determine where html pages for programs go
7277 set html1dir html1dir none
7278 eval $prefixit
7279 $cat <<EOM
7280
7281 If you wish to install html files for programs in $spackage, indicate
7282 the appropriate directory here.  To skip installing html files,
7283 answer "none".
7284 EOM
7285 case "$html1dir" in
7286 ''|none|$undef|' ') dflt=none ;;
7287 *) dflt=$html1dir ;;
7288 esac
7289 fn=dn+~
7290 rp="Directory for the main $spackage html pages?"
7291 . ./getfile
7292 prefixvar=html1dir
7293 . ./setprefixvar
7294 : Use ' ' for none so value is preserved next time through Configure
7295 $test X"$html1dir" = "X" && html1dir=' '
7296
7297 : determine where html pages for libraries and modules go
7298 set html3dir html3dir none
7299 eval $prefixit
7300 $cat <<EOM
7301
7302 If you wish to install html files for modules associated with $spackage,
7303 indicate the appropriate directory here.  To skip installing html files,
7304 answer "none".
7305 EOM
7306 : There is no obvious default.  If they have specified html1dir, then
7307 : try to key off that, possibly changing .../html1 into .../html3.
7308 case "$html3dir" in
7309 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7310 *) dflt=$html3dir ;;
7311 esac
7312 fn=dn+~
7313 rp="Directory for the $spackage module html pages?"
7314 . ./getfile
7315 prefixvar=html3dir
7316 . ./setprefixvar
7317 : Use ' ' for none so value is preserved next time through Configure
7318 $test X"$html3dir" = "X" && html3dir=' '
7319
7320 : determine whether to install perl also as /usr/bin/perl
7321
7322 echo " "
7323 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7324         $cat <<EOM
7325 Many scripts expect perl to be installed as /usr/bin/perl.
7326
7327 If you want to, I can install the perl you are about to compile
7328 as /usr/bin/perl (in addition to $bin/perl).
7329 EOM
7330         if test -f /usr/bin/perl; then
7331             $cat <<EOM
7332
7333 However, please note that because you already have a /usr/bin/perl,
7334 overwriting that with a new Perl would very probably cause problems.
7335 Therefore I'm assuming you don't want to do that (unless you insist).
7336
7337 EOM
7338             case "$installusrbinperl" in
7339             "$define"|[yY]*)    dflt='y';;
7340             *)                  dflt='n';;
7341             esac
7342         else
7343             $cat <<EOM
7344
7345 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7346
7347 EOM
7348             case "$installusrbinperl" in
7349             "$undef"|[nN]*)     dflt='n';;
7350             *)                  dflt='y';;
7351             esac
7352         fi
7353         rp="Do you want to install perl as /usr/bin/perl?"
7354         . ./myread
7355         case "$ans" in
7356         [yY]*)  val="$define";;
7357         *)      val="$undef" ;;
7358         esac
7359 else
7360         val="$undef"
7361 fi
7362 set installusrbinperl
7363 eval $setvar
7364
7365 : Check if we are using the GNU C library
7366 echo " "
7367 echo "Checking for GNU C Library..." >&4
7368 cat >try.c <<'EOCP'
7369 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7370    alone are insufficient to distinguish different versions, such as
7371    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7372    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7373 */
7374 #include <stdio.h>
7375 int main(void)
7376 {
7377 #ifdef __GLIBC__
7378 #   ifdef __GLIBC_MINOR__
7379 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7380 #           include <gnu/libc-version.h>
7381             printf("%s\n",  gnu_get_libc_version());
7382 #       else
7383             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7384 #       endif
7385 #   else
7386         printf("%d\n",  __GLIBC__);
7387 #   endif
7388     return 0;
7389 #else
7390     return 1;
7391 #endif
7392 }
7393 EOCP
7394 set try
7395 if eval $compile_ok && $run ./try > glibc.ver; then
7396         val="$define"
7397         gnulibc_version=`$cat glibc.ver`
7398         echo "You are using the GNU C Library version $gnulibc_version"
7399 else
7400         val="$undef"
7401         gnulibc_version=''
7402         echo "You are not using the GNU C Library"
7403 fi
7404 $rm_try glibc.ver
7405 set d_gnulibc
7406 eval $setvar
7407
7408 : see if nm is to be used to determine whether a symbol is defined or not
7409 case "$usenm" in
7410 '')
7411         dflt=''
7412         case "$d_gnulibc" in
7413         "$define")
7414                 echo " "
7415                 echo "nm probably won't work on the GNU C Library." >&4
7416                 dflt=n
7417                 ;;
7418         esac
7419         case "$dflt" in
7420         '') 
7421                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7422                         echo " "
7423                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7424                         echo "'nm' won't be sufficient on this sytem." >&4
7425                         dflt=n
7426                 fi
7427                 ;;
7428         esac
7429         case "$dflt" in
7430         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7431                 if $test $dflt -gt 20; then
7432                         dflt=y
7433                 else
7434                         dflt=n
7435                 fi
7436                 ;;
7437         esac
7438         ;;
7439 *)
7440         case "$usenm" in
7441         true|$define) dflt=y;;
7442         *) dflt=n;;
7443         esac
7444         ;;
7445 esac
7446 $cat <<EOM
7447
7448 I can use $nm to extract the symbols from your C libraries. This
7449 is a time consuming task which may generate huge output on the disk (up
7450 to 3 megabytes) but that should make the symbols extraction faster. The
7451 alternative is to skip the 'nm' extraction part and to compile a small
7452 test program instead to determine whether each symbol is present. If
7453 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7454 this may be the best solution.
7455
7456 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7457
7458 EOM
7459 rp="Shall I use $nm to extract C symbols from the libraries?"
7460 . ./myread
7461 case "$ans" in
7462 [Nn]*) usenm=false;;
7463 *) usenm=true;;
7464 esac
7465
7466 runnm=$usenm
7467 case "$reuseval" in
7468 true) runnm=false;;
7469 esac
7470
7471 : nm options which may be necessary
7472 case "$nm_opt" in
7473 '') if $test -f /mach_boot; then
7474                 nm_opt=''       # Mach
7475         elif $test -d /usr/ccs/lib; then
7476                 nm_opt='-p'     # Solaris (and SunOS?)
7477         elif $test -f /dgux; then
7478                 nm_opt='-p'     # DG-UX
7479         elif $test -f /lib64/rld; then
7480                 nm_opt='-p'     # 64-bit Irix
7481         else
7482                 nm_opt=''
7483         fi;;
7484 esac
7485
7486 : nm options which may be necessary for shared libraries but illegal
7487 : for archive libraries.  Thank you, Linux.
7488 case "$nm_so_opt" in
7489 '')     case "$myuname" in
7490         *linux*|gnu*)
7491                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7492                         nm_so_opt='--dynamic'
7493                 fi
7494                 ;;
7495         esac
7496         ;;
7497 esac
7498
7499 : Figure out where the libc is located
7500 case "$runnm" in
7501 true)
7502 : get list of predefined functions in a handy place
7503 echo " "
7504 case "$libc" in
7505 '') libc=unknown
7506         case "$libs" in
7507         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7508         esac
7509         ;;
7510 esac
7511 case "$libs" in
7512 '') ;;
7513 *)  for thislib in $libs; do
7514         case "$thislib" in
7515         -lc|-lc_s)
7516                 : Handle C library specially below.
7517                 ;;
7518         -l*)
7519                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7520                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7521                         :
7522                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7523                         :
7524                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7525                         :
7526                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7527                         :
7528                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7529                         :
7530                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7531                         :
7532                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7533                         :
7534                 else
7535                         try=''
7536                 fi
7537                 libnames="$libnames $try"
7538                 ;;
7539         *) libnames="$libnames $thislib" ;;
7540         esac
7541         done
7542         ;;
7543 esac
7544 xxx=normal
7545 case "$libc" in
7546 unknown)
7547         set /lib/libc.$so
7548         for xxx in $libpth; do
7549                 $test -r $1 || set $xxx/libc.$so
7550                 : The messy sed command sorts on library version numbers.
7551                 $test -r $1 || \
7552                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7553                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7554                                 h
7555                                 s/[0-9][0-9]*/0000&/g
7556                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7557                                 G
7558                                 s/\n/ /' | \
7559                          $sort | $sed -e 's/^.* //'`
7560                 eval set \$$#
7561         done
7562         $test -r $1 || set /usr/ccs/lib/libc.$so
7563         $test -r $1 || set /lib/libsys_s$_a
7564         ;;
7565 *)
7566         set blurfl
7567         ;;
7568 esac
7569 if $test -r "$1"; then
7570         echo "Your (shared) C library seems to be in $1."
7571         libc="$1"
7572 elif $test -r /lib/libc && $test -r /lib/clib; then
7573         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7574         xxx=apollo
7575         libc='/lib/clib /lib/libc'
7576         if $test -r /lib/syslib; then
7577                 echo "(Your math library is in /lib/syslib.)"
7578                 libc="$libc /lib/syslib"
7579         fi
7580 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7581         echo "Your C library seems to be in $libc, as you said before."
7582 elif $test -r $incpath/usr/lib/libc$_a; then
7583         libc=$incpath/usr/lib/libc$_a;
7584         echo "Your C library seems to be in $libc.  That's fine."
7585 elif $test -r /lib/libc$_a; then
7586         libc=/lib/libc$_a;
7587         echo "Your C library seems to be in $libc.  You're normal."
7588 else
7589         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7590                 :
7591         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7592                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7593         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7594                 :
7595         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7596                 :
7597         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7598                 :
7599         else
7600                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7601         fi
7602         if $test -r "$tans"; then
7603                 echo "Your C library seems to be in $tans, of all places."
7604                 libc=$tans
7605         else
7606                 libc='blurfl'
7607         fi
7608 fi
7609 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7610         dflt="$libc"
7611         cat <<EOM
7612
7613 If the guess above is wrong (which it might be if you're using a strange
7614 compiler, or your machine supports multiple models), you can override it here.
7615
7616 EOM
7617 else
7618         dflt=''
7619         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7620         cat >&4 <<EOM
7621 I can't seem to find your C library.  I've looked in the following places:
7622
7623 EOM
7624         $sed 's/^/      /' libpath
7625         cat <<EOM
7626
7627 None of these seems to contain your C library. I need to get its name...
7628
7629 EOM
7630 fi
7631 fn=f
7632 rp='Where is your C library?'
7633 . ./getfile
7634 libc="$ans"
7635
7636 echo " "
7637 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7638 set X `cat libnames`
7639 shift
7640 xxx=files
7641 case $# in 1) xxx=file; esac
7642 echo "Extracting names from the following $xxx for later perusal:" >&4
7643 echo " "
7644 $sed 's/^/      /' libnames >&4
7645 echo " "
7646 $echo $n "This may take a while...$c" >&4
7647
7648 for file in $*; do
7649         case $file in
7650         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7651         *) $nm $nm_opt $file 2>/dev/null;;
7652         esac
7653 done >libc.tmp
7654
7655 $echo $n ".$c"
7656 $grep fprintf libc.tmp > libc.ptf
7657 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7658 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7659 xxx='[ADTSIW]'
7660 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7665         eval $xscan;\
7666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7667                 eval $xrun
7668 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7669         eval $xscan;\
7670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7671                 eval $xrun
7672 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7673         eval $xscan;\
7674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7675                 eval $xrun
7676 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7677         eval $xscan;\
7678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7679                 eval $xrun
7680 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7681         eval $xscan;\
7682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7683                 eval $xrun
7684 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7685                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7686         eval $xscan;\
7687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7688                 eval $xrun
7689 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7690         eval $xscan;\
7691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7692                 eval $xrun
7693 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7694         eval $xscan;\
7695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7696                 eval $xrun
7697 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7698         eval $xscan;\
7699         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7700                 eval $xrun
7701 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7702         eval $xscan;\
7703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7704                 eval $xrun
7705 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7706         eval $xscan;\
7707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7708                 eval $xrun
7709 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7710         eval $xscan;\
7711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7712                 eval $xrun
7713 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7714         eval $xscan;\
7715         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7716                 eval $xrun
7717 else
7718         $nm -p $* 2>/dev/null >libc.tmp
7719         $grep fprintf libc.tmp > libc.ptf
7720         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7721                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7722         then
7723                 nm_opt='-p'
7724                 eval $xrun
7725         else
7726                 echo " "
7727                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7728                 com=''
7729                 if $ar t $libc > libc.tmp && \
7730                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7731                 then
7732                         for thisname in $libnames $libc; do
7733                                 $ar t $thisname >>libc.tmp
7734                         done
7735                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7736                         echo "Ok." >&4
7737                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7738                         for thisname in $libnames $libc; do
7739                                 $ar tv $thisname >>libc.tmp
7740                                 emximp -o tmp.imp $thisname \
7741                                     2>/dev/null && \
7742                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7743                                     < tmp.imp >>libc.tmp
7744                                 $rm -f tmp.imp
7745                         done
7746                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7747                         echo "Ok." >&4
7748                 else
7749                         echo "$ar didn't seem to work right." >&4
7750                         echo "Maybe this is a Cray...trying bld instead..." >&4
7751                         if  bld t $libc | \
7752                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7753                                 $test -s libc.list
7754                         then
7755                                 for thisname in $libnames; do
7756                                         bld t $libnames | \
7757                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7758                                         $ar t $thisname >>libc.tmp
7759                                 done
7760                                 echo "Ok." >&4
7761                         else
7762                                 echo "That didn't work either.  Giving up." >&4
7763                                 exit 1
7764                         fi
7765                 fi
7766         fi
7767 fi
7768 nm_extract="$com"
7769 case "$PASE" in
7770 define)
7771     echo " "
7772     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7773     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7774     ;;
7775 *)  if $test -f /lib/syscalls.exp; then
7776         echo " "
7777         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7778         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7779                 /lib/syscalls.exp >>libc.list
7780     fi
7781     ;;
7782 esac
7783 ;;
7784 esac
7785 $rm -f libnames libpath
7786
7787 : see if dld is available
7788 set dld.h i_dld
7789 eval $inhdr
7790
7791 : Check if we are using C++
7792 echo " "
7793 echo "Checking for C++..." >&4
7794 $cat >try.c <<'EOCP'
7795 #include <stdio.h>
7796 int main(void)
7797 {
7798 #ifdef __cplusplus
7799     return 0;
7800 #else
7801     return 1;
7802 #endif
7803 }
7804 EOCP
7805 set try
7806 if eval $compile_ok && $run ./try; then
7807         val="$define"
7808         echo "You are using a C++ compiler."
7809 else
7810         val="$undef"
7811         echo "You are not using a C++ compiler."
7812 fi
7813 $rm_try cplusplus$$
7814 set d_cplusplus
7815 eval $setvar
7816
7817 : is a C symbol defined?
7818 csym='tlook=$1;
7819 case "$3" in
7820 -v) tf=libc.tmp; tdc="";;
7821 -a) tf=libc.tmp; tdc="[]";;
7822 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7823 esac;
7824 case "$d_cplusplus" in
7825     $define)    extern_C="extern \"C\"" ;;
7826     *)          extern_C="extern"       ;;
7827 esac;
7828 tx=yes;
7829 case "$reuseval-$4" in
7830 true-) ;;
7831 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7832 esac;
7833 case "$tx" in
7834 yes)
7835         tval=false;
7836         if $test "$runnm" = true; then
7837                 if $contains $tlook $tf >/dev/null 2>&1; then
7838                         tval=true;
7839                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7840                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7841                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7842                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7843                         $rm_try;
7844                 fi;
7845         else
7846                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7847                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7848                 $rm_try;
7849         fi;
7850         ;;
7851 *)
7852         case "$tval" in
7853         $define) tval=true;;
7854         *) tval=false;;
7855         esac;
7856         ;;
7857 esac;
7858 eval "$2=$tval"'
7859
7860 : define an is-in-libc? function
7861 inlibc='echo " "; td=$define; tu=$undef;
7862 sym=$1; var=$2; eval "was=\$$2";
7863 tx=yes;
7864 case "$reuseval$was" in
7865 true) ;;
7866 true*) tx=no;;
7867 esac;
7868 case "$tx" in
7869 yes)
7870         set $sym tres -f;
7871         eval $csym;
7872         case "$tres" in
7873         true)
7874                 echo "$sym() found." >&4;
7875                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7876         *)
7877                 echo "$sym() NOT found." >&4;
7878                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7879         esac;;
7880 *)
7881         case "$was" in
7882         $define) echo "$sym() found." >&4;;
7883         *) echo "$sym() NOT found." >&4;;
7884         esac;;
7885 esac'
7886
7887 : see if dlopen exists
7888 xxx_runnm="$runnm"
7889 xxx_ccflags="$ccflags"
7890 runnm=false
7891 : with g++ one needs -shared to get is-in-libc to work for dlopen
7892 case "$gccversion" in
7893 '')     ;;
7894 *)      case "$d_cplusplus" in
7895         "$define") ccflags="$ccflags -shared" ;;
7896         esac
7897         ;;
7898 esac
7899 set dlopen d_dlopen
7900 eval $inlibc
7901 runnm="$xxx_runnm"
7902 ccflags="$xxx_ccflags"
7903
7904 : see if this is a unistd.h system
7905 set unistd.h i_unistd
7906 eval $inhdr
7907
7908 : determine which dynamic loading, if any, to compile in
7909 echo " "
7910 dldir="ext/DynaLoader"
7911 case "$usedl" in
7912 $define|y|true)
7913         dflt='y'
7914         usedl="$define"
7915         ;;
7916 $undef|n|false)
7917         dflt='n'
7918         usedl="$undef"
7919         ;;
7920 *)
7921         dflt='n'
7922         case "$d_dlopen" in
7923             $define) dflt='y' ;;
7924         esac
7925         case "$i_dld" in
7926             $define) dflt='y' ;;
7927         esac
7928         : Does a dl_xxx.xs file exist for this operating system
7929         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7930         ;;
7931 esac
7932 rp="Do you wish to use dynamic loading?"
7933 . ./myread
7934 usedl="$ans"
7935 bin_ELF="$undef"
7936 case "$ans" in
7937 y*) usedl="$define"
7938         case "$dlsrc" in
7939         '')
7940                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7941                         dflt="$dldir/dl_${osname}.xs"
7942                 elif $test "$d_dlopen" = "$define" ; then
7943                         dflt="$dldir/dl_dlopen.xs"
7944                 elif $test "$i_dld" = "$define" ; then
7945                         dflt="$dldir/dl_dld.xs"
7946                 else
7947                         dflt=''
7948                 fi
7949                 ;;
7950         *)      dflt="$dldir/$dlsrc"
7951                 ;;
7952         esac
7953     echo "The following dynamic loading files are available:"
7954         : Can not go over to $dldir because getfile has path hard-coded in.
7955         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7956         rp="Source file to use for dynamic loading"
7957         fn="fne"
7958         gfpth="$src"
7959         . ./getfile
7960         usedl="$define"
7961         : emulate basename
7962         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7963
7964         $cat << EOM
7965
7966 Some systems may require passing special flags to $cc -c to
7967 compile modules that will be used to create a shared library.
7968 To use no flags, say "none".
7969
7970 EOM
7971     case "$cccdlflags" in
7972     '') case "$gccversion" in
7973                 '') case "$osname" in
7974                         hpux)   dflt='+z' ;;
7975                         next)   dflt='none' ;;
7976                         irix*)  dflt='-KPIC' ;;
7977                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7978                         sunos)  dflt='-pic' ;;
7979                         *)      dflt='none' ;;
7980                     esac
7981                         ;;
7982                 *)  case "$osname" in
7983                         darwin) dflt='none' ;;
7984                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7985                         *)      dflt='-fpic' ;;
7986                     esac ;;
7987             esac ;;
7988         ' ') dflt='none' ;;
7989     *)  dflt="$cccdlflags" ;;
7990     esac
7991     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7992     . ./myread
7993     case "$ans" in
7994     none) cccdlflags=' ' ;;
7995     *) cccdlflags="$ans" ;;
7996     esac
7997
7998     cat << EOM
7999
8000 Some systems use ld to create libraries that can be dynamically loaded,
8001 while other systems (such as those using ELF) use $cc.
8002
8003 EOM
8004         case "$ld" in
8005         '')     $cat >try.c <<EOM
8006 /* Test for whether ELF binaries are produced */
8007 #include <fcntl.h>
8008 #$i_stdlib I_STDLIB
8009 #ifdef I_STDLIB
8010 #include <stdlib.h>
8011 #endif
8012 #$i_unistd I_UNISTD
8013 #ifdef I_UNISTD
8014 #include <unistd.h>
8015 #endif
8016 int main() {
8017         char b[4];
8018         int i = open("a.out",O_RDONLY);
8019         if(i == -1)
8020                 exit(1); /* fail */
8021         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8022                 exit(0); /* succeed (yes, it's ELF) */
8023         else
8024                 exit(1); /* fail */
8025 }
8026 EOM
8027                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8028                         cat <<EOM
8029 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8030 EOM
8031                         dflt="$cc"
8032                         bin_ELF="$define"
8033                 else
8034                         echo "I'll use ld to build dynamic libraries."
8035                         dflt='ld'
8036                 fi
8037                 $rm_try
8038                 ;;
8039         *)      dflt="$ld"
8040                 ;;
8041         esac
8042
8043     rp="What command should be used to create dynamic libraries?"
8044     . ./myread
8045         ld="$ans"
8046
8047     cat << EOM
8048
8049 Some systems may require passing special flags to $ld to create a
8050 library that can be dynamically loaded.  If your ld flags include
8051 -L/other/path options to locate libraries outside your loader's normal
8052 search path, you may need to specify those -L options here as well.  To
8053 use no flags, say "none".
8054
8055 EOM
8056     case "$lddlflags" in
8057     '') case "$osname" in
8058                         beos) dflt='-nostart' ;;
8059                         haiku) dflt='-shared' ;;
8060                         hpux) dflt='-b';
8061                               case "$gccversion" in
8062                               '') dflt="$dflt +vnocompatwarnings" ;;
8063                               esac
8064                               ;;
8065                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8066                         next)  dflt='none' ;;
8067                         solaris) dflt='-G' ;;
8068                         sunos) dflt='-assert nodefinitions' ;;
8069                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8070                 *)     dflt='none' ;;
8071                         esac
8072                         ;;
8073     *) dflt="$lddlflags" ;;
8074     esac
8075
8076         : Try to guess additional flags to pick up local libraries.
8077         : Be careful not to append to a plain 'none'
8078         case "$dflt" in
8079         none) dflt='' ;;
8080         esac
8081         for thisflag in $ldflags; do
8082                 case "$thisflag" in
8083                 -L*|-R*|-Wl,-R*)
8084                         case " $dflt " in
8085                         *" $thisflag "*) ;;
8086                         *) dflt="$dflt $thisflag" ;;
8087                         esac
8088                         ;;
8089                 esac
8090         done
8091
8092         case "$dflt" in
8093         ''|' ') dflt='none' ;;
8094         esac
8095
8096         case "$ldflags" in
8097         *-fstack-protector*)
8098             case "$dflt" in
8099                         *-fstack-protector*) ;; # Don't add it again
8100                         *) dflt="$dflt -fstack-protector" ;; 
8101                 esac
8102                 ;;
8103         esac
8104
8105
8106     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8107     . ./myread
8108     case "$ans" in
8109     none) lddlflags=' ' ;;
8110     *) lddlflags="$ans" ;;
8111     esac
8112
8113         cat <<EOM
8114
8115 Some systems may require passing special flags to $cc to indicate that
8116 the resulting executable will use dynamic linking.  To use no flags,
8117 say "none".
8118
8119 EOM
8120     case "$ccdlflags" in
8121     '') case "$osname" in
8122             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8123             next|sunos) dflt='none' ;;
8124             *)          dflt='none' ;;
8125             esac ;;
8126     ' ')  dflt='none' ;;
8127     *)  dflt="$ccdlflags" ;;
8128     esac
8129     rp="Any special flags to pass to $cc to use dynamic linking?"
8130     . ./myread
8131     case "$ans" in
8132     none) ccdlflags=' ' ;;
8133     *) ccdlflags="$ans" ;;
8134     esac
8135     ;;
8136 *)  usedl="$undef"
8137         ld='ld'
8138     dlsrc='dl_none.xs'
8139     lddlflags=''
8140     ccdlflags=''
8141     ;;
8142 esac
8143
8144 : Do we want a shared libperl?
8145 also=''
8146 case "$usedl" in
8147 $undef)
8148         # No dynamic loading being used, so don't bother even to prompt.
8149         useshrplib='false'
8150         ;;
8151 *)      case "$useshrplib" in
8152         '')     case "$osname" in
8153                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8154                         dflt=y
8155                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8156                         ;;
8157                 next*)
8158                         case "$osvers" in
8159                         4*)     dflt=y
8160                                 also='Building a shared libperl is needed for MAB support.'
8161                                 ;;
8162                         *)      dflt=n
8163                                 ;;
8164                         esac
8165                         ;;
8166                 *)      dflt=n
8167                         ;;
8168                 esac
8169                 ;;
8170         $define|true|[Yy]*)
8171                 dflt=y
8172                 ;;
8173         *)      dflt=n
8174                 ;;
8175         esac
8176         $cat << EOM
8177
8178 The perl executable is normally obtained by linking perlmain.c with
8179 libperl${_a}, any static extensions (usually just DynaLoader), and
8180 any other libraries needed on this system (such as -lm, etc.).  Since
8181 your system supports dynamic loading, it is probably possible to build
8182 a shared libperl.$so.  If you will have more than one executable linked
8183 to libperl.$so, this will significantly reduce the size of each
8184 executable, but it may have a noticeable effect on performance.  The
8185 default is probably sensible for your system.
8186 $also
8187
8188 EOM
8189         rp="Build a shared libperl.$so (y/n)"
8190         . ./myread
8191         case "$ans" in
8192         true|$define|[Yy]*)
8193                 useshrplib='true'  ;;
8194         *)      useshrplib='false' ;;
8195         esac
8196         ;;
8197 esac
8198
8199 case "$useshrplib" in
8200 true)
8201         case "$userelocatableinc" in
8202         true|define)
8203                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8204                 echo "See INSTALL for an explanation why that won't work." >&4
8205                 exit 4
8206                 ;;
8207         esac
8208         case "$libperl" in
8209         '')
8210                 # Figure out a good name for libperl.so.  Since it gets stored in
8211                 # a version-specific architecture-dependent library, the version
8212                 # number isn't really that important, except for making cc/ld happy.
8213                 #
8214                 # A name such as libperl.so.10.1
8215                 majmin="libperl.$so.$patchlevel.$subversion"
8216                 # A name such as libperl.so.100
8217                 majonly=`echo $patchlevel $subversion |
8218                         $awk '{printf "%d%02d", $1, $2}'`
8219                 majonly=libperl.$so.$majonly
8220                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8221                 # rely on figuring it out from the naming of libc.
8222                 case "${osname}${osvers}" in
8223                 next4*)
8224                         dflt=libperl.5.$so
8225                         # XXX How handle the --version stuff for MAB?
8226                         ;;
8227                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8228                         dflt=libperl.$so
8229                         ;;
8230                 cygwin*) # ld links now against the dll directly
8231                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8232                         majonly=`echo $patchlevel $subversion |
8233                                 $awk '{printf "%03d%03d", $1, $2}'`
8234                         majonly=cygperl5.$majonly.$so
8235                         dflt=$majmin
8236                         ;;
8237                 *)      # Try to guess based on whether libc has major.minor.
8238                         case "$libc" in
8239                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8240                         *libc.$so.[0-9]*) dflt=$majonly ;;
8241                         *)      dflt=libperl.$so ;;
8242                         esac
8243                         ;;
8244                 esac
8245                 ;;
8246         *)      dflt=$libperl
8247                 ;;
8248         esac
8249         cat << EOM
8250
8251 I need to select a good name for the shared libperl.  If your system uses
8252 library names with major and minor numbers, then you might want something
8253 like $majmin.  Alternatively, if your system uses a single version
8254 number for shared libraries, then you might want to use $majonly.
8255 Or, your system might be quite happy with a simple libperl.$so.
8256
8257 Since the shared libperl will get installed into a version-specific
8258 architecture-dependent directory, the version number of the shared perl
8259 library probably isn't important, so the default should be o.k.
8260
8261 EOM
8262         rp='What name do you want to give to the shared libperl?'
8263         . ./myread
8264         libperl=$ans
8265         echo "Ok, I'll use $libperl"
8266         ;;
8267 *)
8268         libperl="libperl${_a}"
8269         ;;
8270 esac
8271
8272 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8273 case "$shrpdir" in
8274 '') ;;
8275 *)      $cat >&4 <<EOM
8276 WARNING:  Use of the shrpdir variable for the installation location of
8277 the shared $libperl is not supported.  It was never documented and
8278 will not work in this version.  Let me (perlbug@perl.org)
8279 know of any problems this may cause.
8280
8281 EOM
8282         case "$shrpdir" in
8283         "$archlibexp/CORE")
8284                 $cat >&4 <<EOM
8285 But your current setting of $shrpdir is
8286 the default anyway, so it's harmless.
8287 EOM
8288                 ;;
8289         *)
8290                 $cat >&4 <<EOM
8291 Further, your current attempted setting of $shrpdir
8292 conflicts with the value of $archlibexp/CORE
8293 that installperl will use.
8294 EOM
8295                 ;;
8296         esac
8297         ;;
8298 esac
8299
8300 # How will the perl executable find the installed shared $libperl?
8301 # Add $xxx to ccdlflags.
8302 # If we can't figure out a command-line option, use $shrpenv to
8303 # set env LD_RUN_PATH.  The main perl makefile uses this.
8304 shrpdir=$archlibexp/CORE
8305 xxx=''
8306 tmp_shrpenv=''
8307 if "$useshrplib"; then
8308     case "$osname" in
8309         aix)
8310                 # We'll set it in Makefile.SH...
8311                 ;;
8312         solaris)
8313                 xxx="-R $shrpdir"
8314                 ;;
8315         freebsd|netbsd|openbsd|interix|dragonfly)
8316                 xxx="-Wl,-R$shrpdir"
8317                 ;;
8318         bsdos|linux|irix*|dec_osf|gnu*)
8319                 xxx="-Wl,-rpath,$shrpdir"
8320                 ;;
8321         next)
8322                 # next doesn't like the default...
8323                 ;;
8324         beos)
8325                 # beos doesn't like the default, either.
8326                 ;;
8327         haiku)
8328                 # Haiku doesn't like the default, either.
8329                 ;;
8330         hpux*)
8331                 # hpux doesn't like the default, either.
8332                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8333                 ;;
8334         cygwin)
8335                 # cygwin needs only ldlibpth
8336                 ;;
8337         *)
8338                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8339                 ;;
8340         esac
8341         case "$xxx" in
8342         '') ;;
8343         *)
8344                 # Only add $xxx if it isn't already in ccdlflags.
8345                 case " $ccdlflags " in
8346                 *" $xxx "*)     ;;
8347                 *)      ccdlflags="$ccdlflags $xxx"
8348                         cat <<EOM >&4
8349
8350 Adding $xxx to the flags
8351 passed to $ld so that the perl executable will find the
8352 installed shared $libperl.
8353
8354 EOM
8355                         ;;
8356                 esac
8357                 ;;
8358         esac
8359 fi
8360 # Fix ccdlflags in AIX for building external extensions.
8361 # (For building Perl itself bare -bE:perl.exp is needed,
8362 #  Makefile.SH takes care of this.)
8363 case "$osname" in
8364 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8365 esac
8366 # Respect a hint or command-line value.
8367 case "$shrpenv" in
8368 '') shrpenv="$tmp_shrpenv" ;;
8369 esac
8370 case "$ldlibpthname" in
8371 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8372 none)   ldlibpthname='' ;;
8373 esac
8374
8375 : determine where manual pages are on this system
8376 echo " "
8377 case "$sysman" in
8378 '') 
8379         syspath='/usr/share/man/man1 /usr/man/man1'
8380         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8381         syspath="$syspath /usr/man/u_man/man1"
8382         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8383         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8384         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8385         sysman=`./loc . /usr/man/man1 $syspath`
8386         ;;
8387 esac
8388 if $test -d "$sysman"; then
8389         echo "System manual is in $sysman." >&4
8390 else
8391         echo "Could not find manual pages in source form." >&4
8392 fi
8393
8394 : determine where manual pages go
8395 set man1dir man1dir none
8396 eval $prefixit
8397 $cat <<EOM
8398
8399 $spackage has manual pages available in source form.
8400 EOM
8401 case "$nroff" in
8402 nroff)
8403         echo "However, you don't have nroff, so they're probably useless to you."
8404         case "$man1dir" in
8405         '') man1dir="none";;
8406         esac;;
8407 esac
8408 echo "If you don't want the manual sources installed, answer 'none'."
8409 case "$man1dir" in
8410 ' ') dflt=none
8411         ;;
8412 '')
8413         lookpath="$prefixexp/share/man/man1"
8414         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8415         lookpath="$lookpath $prefixexp/man/p_man/man1"
8416         lookpath="$lookpath $prefixexp/man/u_man/man1"
8417         lookpath="$lookpath $prefixexp/man/man.1"
8418         case "$sysman" in
8419         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8420         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8421         esac
8422         set dflt
8423         eval $prefixup
8424         ;;
8425 *)  dflt="$man1dir"
8426         ;;
8427 esac
8428 echo " "
8429 fn=dn+~
8430 rp="Where do the main $spackage manual pages (source) go?"
8431 . ./getfile
8432 if $test "X$man1direxp" != "X$ansexp"; then
8433         installman1dir=''
8434 fi
8435 prefixvar=man1dir
8436 . ./setprefixvar
8437
8438 case "$man1dir" in
8439 '')     man1dir=' '
8440         installman1dir='';;
8441 esac
8442
8443 : What suffix to use on installed man pages
8444
8445 case "$man1dir" in
8446 ' ')
8447         man1ext='0'
8448         ;;
8449 *)
8450         rp="What suffix should be used for the main $spackage man pages?"
8451         case "$man1ext" in
8452         '')     case "$man1dir" in
8453                 *1)  dflt=1 ;;
8454                 *1p) dflt=1p ;;
8455                 *1pm) dflt=1pm ;;
8456                 *l) dflt=l;;
8457                 *n) dflt=n;;
8458                 *o) dflt=o;;
8459                 *p) dflt=p;;
8460                 *C) dflt=C;;
8461                 *L) dflt=L;;
8462                 *L1) dflt=L1;;
8463                 *) dflt=1;;
8464                 esac
8465                 ;;
8466         *)      dflt="$man1ext";;
8467         esac
8468         . ./myread
8469         man1ext="$ans"
8470         ;;
8471 esac
8472
8473 : see if we can have long filenames
8474 echo " "
8475 first=123456789abcdef
8476 $rm -f $first
8477 if (echo hi >$first) 2>/dev/null; then
8478         if $test -f 123456789abcde; then
8479                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8480                 val="$undef"
8481         else
8482                 echo 'You can have filenames longer than 14 characters.'>&4
8483                 val="$define"
8484         fi
8485 else
8486         $cat <<'EOM'
8487 You can't have filenames longer than 14 chars.
8488 You can't even think about them!
8489 EOM
8490         val="$undef"
8491 fi
8492 set d_flexfnam
8493 eval $setvar
8494 $rm -rf 123456789abcde*
8495
8496 : determine where library module manual pages go
8497 set man3dir man3dir none
8498 eval $prefixit
8499 $cat <<EOM
8500
8501 $spackage has manual pages for many of the library modules.
8502 EOM
8503
8504 case "$nroff" in
8505 nroff)
8506         $cat <<'EOM'
8507 However, you don't have nroff, so they're probably useless to you.
8508 EOM
8509         case "$man3dir" in
8510         '') man3dir="none";;
8511         esac;;
8512 esac
8513
8514 case "$d_flexfnam" in
8515 undef)
8516         $cat <<'EOM'
8517 However, your system can't handle the long file names like File::Basename.3.
8518 EOM
8519         case "$man3dir" in
8520         '') man3dir="none";;
8521         esac;;
8522 esac
8523
8524 echo "If you don't want the manual sources installed, answer 'none'."
8525 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8526 case "$man3dir" in
8527 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8528         if $test -d "$privlib/man/man3"; then
8529                 cat <<EOM >&4
8530
8531 WARNING:  Previous versions of perl installed man3 pages into
8532 $privlib/man/man3.  This version will suggest a
8533 new default of $dflt.
8534 EOM
8535                 tdflt=$dflt
8536                 dflt='n'
8537                 rp='Do you wish to preserve the old behavior?(y/n)'
8538                 . ./myread
8539                 case "$ans" in
8540                 y*) dflt="$privlib/man/man3" ;;
8541                 *)  dflt=$tdflt ;;
8542                 esac
8543     fi
8544         ;;
8545 *)      dflt="$man3dir" ;;
8546 esac
8547 case "$dflt" in
8548 ' ') dflt=none ;;
8549 esac
8550 echo " "
8551 fn=dn+~
8552 rp="Where do the $package library man pages (source) go?"
8553 . ./getfile
8554 prefixvar=man3dir
8555 . ./setprefixvar
8556
8557 case "$man3dir" in
8558 '')     man3dir=' '
8559         installman3dir='';;
8560 esac
8561
8562 : What suffix to use on installed man pages
8563 case "$man3dir" in
8564 ' ')
8565         man3ext='0'
8566         ;;
8567 *)
8568         rp="What suffix should be used for the $package library man pages?"
8569         case "$man3ext" in
8570         '')     case "$man3dir" in
8571                 *3)  dflt=3 ;;
8572                 *3p) dflt=3p ;;
8573                 *3pm) dflt=3pm ;;
8574                 *l) dflt=l;;
8575                 *n) dflt=n;;
8576                 *o) dflt=o;;
8577                 *p) dflt=p;;
8578                 *C) dflt=C;;
8579                 *L) dflt=L;;
8580                 *L3) dflt=L3;;
8581                 *) dflt=3;;
8582                 esac
8583                 ;;
8584         *)      dflt="$man3ext";;
8585         esac
8586         . ./myread
8587         man3ext="$ans"
8588         ;;
8589 esac
8590
8591 : see if we have to deal with yellow pages, now NIS.
8592 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8593         if $test -f /usr/etc/nibindd; then
8594                 echo " "
8595                 echo "I'm fairly confident you're on a NeXT."
8596                 echo " "
8597                 rp='Do you get the hosts file via NetInfo?'
8598                 dflt=y
8599                 case "$hostcat" in
8600                 nidump*) ;;
8601                 '') ;;
8602                 *) dflt=n;;
8603                 esac
8604                 . ./myread
8605                 case "$ans" in
8606                 y*) hostcat='nidump hosts .';;
8607                 *)      case "$hostcat" in
8608                         nidump*) hostcat='';;
8609                         esac
8610                         ;;
8611                 esac
8612         fi
8613         case "$hostcat" in
8614         nidump*) ;;
8615         *)
8616                 case "$hostcat" in
8617                 *ypcat*) dflt=y;;
8618                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8619                                 dflt=y
8620                         else
8621                                 dflt=n
8622                         fi;;
8623                 *) dflt=n;;
8624                 esac
8625                 echo " "
8626                 rp='Are you getting the hosts file via yellow pages?'
8627                 . ./myread
8628                 case "$ans" in
8629                 y*) hostcat='ypcat hosts';;
8630                 *) hostcat='cat /etc/hosts';;
8631                 esac
8632                 ;;
8633         esac
8634 fi
8635 case "$hostcat" in
8636 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8637 esac
8638 case "$groupcat" in
8639 '') test -f /etc/group && groupcat='cat /etc/group';;
8640 esac
8641 case "$passcat" in
8642 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8643 esac
8644
8645 : now get the host name
8646 echo " "
8647 echo "Figuring out host name..." >&4
8648 case "$myhostname" in
8649 '') cont=true
8650         echo 'Maybe "hostname" will work...'
8651         if tans=`sh -c hostname 2>&1` ; then
8652                 myhostname=$tans
8653                 phostname=hostname
8654                 cont=''
8655         fi
8656         ;;
8657 *) cont='';;
8658 esac
8659 if $test "$cont"; then
8660         if ./xenix; then
8661                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8662                 if tans=`cat /etc/systemid 2>&1` ; then
8663                         myhostname=$tans
8664                         phostname='cat /etc/systemid'
8665                         echo "Whadyaknow.  Xenix always was a bit strange..."
8666                         cont=''
8667                 fi
8668         elif $test -r /etc/systemid; then
8669                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8670         fi
8671 fi
8672 if $test "$cont"; then
8673         echo 'No, maybe "uuname -l" will work...'
8674         if tans=`sh -c 'uuname -l' 2>&1` ; then
8675                 myhostname=$tans
8676                 phostname='uuname -l'
8677         else
8678                 echo 'Strange.  Maybe "uname -n" will work...'
8679                 if tans=`sh -c 'uname -n' 2>&1` ; then
8680                         myhostname=$tans
8681                         phostname='uname -n'
8682                 else
8683                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8684                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8685                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8686                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8687                         else
8688                                 case "$myhostname" in
8689                                 '') echo "Does this machine have an identity crisis or something?"
8690                                         phostname='';;
8691                                 *)
8692                                         echo "Well, you said $myhostname before..."
8693                                         phostname='echo $myhostname';;
8694                                 esac
8695                         fi
8696                 fi
8697         fi
8698 fi
8699 case "$myhostname" in
8700 '') myhostname=noname ;;
8701 esac
8702 : you do not want to know about this
8703 set $myhostname
8704 myhostname=$1
8705
8706 : verify guess
8707 if $test "$myhostname" ; then
8708         dflt=y
8709         rp='Your host name appears to be "'$myhostname'".'" Right?"
8710         . ./myread
8711         case "$ans" in
8712         y*) ;;
8713         *) myhostname='';;
8714         esac
8715 fi
8716
8717 : bad guess or no guess
8718 while $test "X$myhostname" = X ; do
8719         dflt=''
8720         rp="Please type the (one word) name of your host:"
8721         . ./myread
8722         myhostname="$ans"
8723 done
8724
8725 : translate upper to lower if necessary
8726 case "$myhostname" in
8727 *[A-Z]*)
8728         echo "(Normalizing case in your host name)"
8729         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8730         ;;
8731 esac
8732
8733 case "$myhostname" in
8734 *.*)
8735         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8736         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8737         echo "(Trimming domain name from host name--host name is now $myhostname)"
8738         ;;
8739 *) case "$mydomain" in
8740         '')
8741                 {
8742                         test "X$hostcat" = "Xypcat hosts" &&
8743                         ypmatch "$myhostname" hosts 2>/dev/null |\
8744                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8745                         $test -s hosts
8746                 } || {
8747                         test "X$hostcat" != "X" &&
8748                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8749                                         /[       ]$myhostname[  . ]/p" > hosts
8750                 }
8751                 tmp_re="[       . ]"
8752                 if $test -f hosts; then
8753                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8754                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8755                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8756                                 hosts | $sort | $uniq | \
8757                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8758                         case `$echo X$dflt` in
8759                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8760                                 dflt=.
8761                                 ;;
8762                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8763                                 ;;
8764                         esac
8765                 else
8766                         echo "(I cannot locate a hosts database anywhere)"
8767                         dflt=.
8768                 fi
8769                 case "$dflt" in
8770                 .)
8771                         tans=`./loc resolv.conf X /etc /usr/etc`
8772                         if $test -f "$tans"; then
8773                                 echo "(Attempting domain name extraction from $tans)"
8774                                 dflt=.`$sed -n -e 's/   / /g' \
8775                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8776                                   -e 1q 2>/dev/null`
8777                                 case "$dflt" in
8778                                 .) dflt=.`$sed -n -e 's/        / /g' \
8779                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8780                                      -e 1q 2>/dev/null`
8781                                         ;;
8782                                 esac
8783                         fi
8784                         ;;
8785                 esac
8786                 case "$dflt" in
8787                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8788                         dflt=.`sh -c domainname 2>/dev/null`
8789                         case "$dflt" in
8790                         '') dflt='.';;
8791                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8792                         esac
8793                         ;;
8794                 esac
8795                 case "$dflt$osname" in
8796                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8797                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8798                         ;;
8799                 esac
8800                 case "$dflt" in
8801                 .) echo "(Lost all hope -- silly guess then)"
8802                         dflt='.nonet'
8803                         ;;
8804                 esac
8805                 $rm -f hosts
8806                 ;;
8807         *) dflt="$mydomain";;
8808         esac;;
8809 esac
8810 echo " "
8811 rp="What is your domain name?"
8812 . ./myread
8813 tans="$ans"
8814 case "$ans" in
8815 '') ;;
8816 .*) ;;
8817 *) tans=".$tans";;
8818 esac
8819 mydomain="$tans"
8820
8821 : translate upper to lower if necessary
8822 case "$mydomain" in
8823 *[A-Z]*)
8824         echo "(Normalizing case in your domain name)"
8825         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8826         ;;
8827 esac
8828
8829 : a little sanity check here
8830 case "$phostname" in
8831 '') ;;
8832 *)
8833         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8834         $myhostname$mydomain|$myhostname) ;;
8835         *)
8836                 case "$phostname" in
8837                 sed*)
8838                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8839                         ;;
8840                 *)
8841                         echo "(That doesn't agree with your $phostname command, by the way.)"
8842                         ;;
8843                 esac
8844         ;;
8845         esac
8846         ;;
8847 esac
8848
8849 : determine the e-mail address of the user who is running us
8850 $cat <<EOM
8851
8852 I need to get your e-mail address in Internet format if possible, i.e.
8853 something like user@host.domain. Please answer accurately since I have
8854 no easy means to double check it. The default value provided below
8855 is most probably close to reality but may not be valid from outside
8856 your organization...
8857
8858 EOM
8859 cont=x
8860 while test "$cont"; do
8861         case "$cf_email" in
8862         '') dflt="$cf_by@$myhostname$mydomain";;
8863         *) dflt="$cf_email";;
8864         esac
8865         rp='What is your e-mail address?'
8866         . ./myread
8867         cf_email="$ans"
8868         case "$cf_email" in
8869         *@*.*) cont='' ;;
8870         *)
8871                 rp='Address does not look like an Internet one.  Use it anyway?'
8872                 case "$fastread" in
8873                 yes) dflt=y ;;
8874                 *) dflt=n ;;
8875                 esac
8876                 . ./myread
8877                 case "$ans" in
8878                 y*) cont='' ;;
8879                 *) echo " " ;;
8880                 esac
8881                 ;;
8882         esac
8883 done
8884
8885 : Ask e-mail of administrator
8886 $cat <<EOM
8887
8888 If you or somebody else will be maintaining perl at your site, please
8889 fill in the correct e-mail address here so that they may be contacted
8890 if necessary. Currently, the "perlbug" program included with perl
8891 will send mail to this address in addition to perlbug@perl.org. You may
8892 enter "none" for no administrator.
8893
8894 EOM
8895 case "$perladmin" in
8896 '') dflt="$cf_email";;
8897 *) dflt="$perladmin";;
8898 esac
8899 rp='Perl administrator e-mail address'
8900 . ./myread
8901 perladmin="$ans"
8902
8903 : determine whether to only install version-specific parts.
8904 echo " "
8905 $cat <<EOM
8906 Do you want to install only the version-specific parts of the perl
8907 distribution?  Usually you do *not* want to do this.
8908 EOM
8909 case "$versiononly" in
8910 "$define"|[Yy]*|true) dflt='y' ;;
8911 *) dflt='n';
8912 esac
8913 rp="Do you want to install only the version-specific parts of perl?"
8914 . ./myread
8915 case "$ans" in
8916 [yY]*)  val="$define";;
8917 *)      val="$undef" ;;
8918 esac
8919 set versiononly
8920 eval $setvar
8921
8922 case "$versiononly" in
8923 "$define") inc_version_list=''
8924            inc_version_list_init=0
8925            ;;
8926 esac
8927
8928 : figure out how to guarantee perl startup
8929 : XXX Note that this currently takes advantage of the bug that binexp ignores
8930 :     the Configure -Dinstallprefix setting, which in turn means that under
8931 :     relocatable @INC, initialinstalllocation is what binexp started as.
8932 case "$startperl" in
8933 '')
8934         case "$sharpbang" in
8935         *!)
8936                 $cat <<EOH
8937
8938 I can use the #! construct to start perl on your system. This will
8939 make startup of perl scripts faster, but may cause problems if you
8940 want to share those scripts and perl is not in a standard place
8941 ($initialinstalllocation/perl) on all your platforms. The alternative
8942 is to force a shell by starting the script with a single ':' character.
8943
8944 EOH
8945                 case "$versiononly" in
8946                 "$define")      dflt="$initialinstalllocation/perl$version";;
8947                 *)              dflt="$initialinstalllocation/perl";;
8948                 esac
8949                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8950                 . ./myread
8951                 case "$ans" in
8952                 none)   startperl=": # use perl";;
8953                 *)      startperl="#!$ans"
8954                         if $test 30 -lt `echo "$ans" | wc -c`; then
8955                                 $cat >&4 <<EOM
8956
8957 WARNING:  Some systems limit the #! command to 32 characters.
8958 If you experience difficulty running Perl scripts with #!, try
8959 installing Perl in a directory with a shorter pathname.
8960
8961 EOM
8962                         fi ;;
8963                 esac
8964                 ;;
8965         *) startperl=": # use perl"
8966                 ;;
8967         esac
8968         ;;
8969 esac
8970 echo "I'll use $startperl to start perl scripts."
8971
8972 : figure best path for perl in scripts
8973 case "$perlpath" in
8974 '')
8975         case "$versiononly" in
8976         "$define")      perlpath="$initialinstalllocation/perl$version";;
8977         *)              perlpath="$initialinstalllocation/perl";;
8978         esac
8979         case "$startperl" in
8980         *!*) ;;
8981         *)
8982                 $cat <<EOH
8983
8984 I will use the "eval 'exec'" idiom to start Perl on your system.
8985 I can use the full path of your Perl binary for this purpose, but
8986 doing so may cause problems if you want to share those scripts and
8987 Perl is not always in a standard place ($initialinstalllocation/perl).
8988
8989 EOH
8990                 dflt="$initialinstalllocation/perl"
8991                 rp="What path shall I use in \"eval 'exec'\"?"
8992                 . ./myread
8993                 perlpath="$ans"
8994                 ;;
8995         esac
8996         ;;
8997 esac
8998 case "$startperl" in
8999 *!*)    ;;
9000 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9001 esac
9002
9003 : determine where public executable scripts go
9004 set scriptdir scriptdir
9005 eval $prefixit
9006 case "$scriptdir" in
9007 '')
9008         dflt="$bin"
9009         : guess some guesses
9010         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9011         $test -d /usr/share/bin     && dflt=/usr/share/bin
9012         $test -d /usr/local/script  && dflt=/usr/local/script
9013         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9014         $test -d $prefixexp/script  && dflt=$prefixexp/script
9015         set dflt
9016         eval $prefixup
9017         ;;
9018 *)  dflt="$scriptdir"
9019         ;;
9020 esac
9021 $cat <<EOM
9022
9023 Some installations have a separate directory just for executable scripts so
9024 that they can mount it across multiple architectures but keep the scripts in
9025 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9026 Or you might just lump your scripts in with all your other executables.
9027
9028 EOM
9029 fn=d~
9030 rp='Where do you keep publicly executable scripts?'
9031 . ./getfile
9032 if $test "X$ansexp" != "X$scriptdirexp"; then
9033         installscript=''
9034 fi
9035 installscriptdir=''
9036 prefixvar=scriptdir
9037 . ./setprefixvar
9038 : A little fix up for an irregularly named variable.
9039 installscript="$installscriptdir"
9040
9041 : determine where add-on public executables go
9042 case "$sitebin" in
9043 '')     dflt=$siteprefix/bin ;;
9044 *)      dflt=$sitebin ;;
9045 esac
9046 fn=d~
9047 rp='Pathname where the add-on public executables should be installed?'
9048 . ./getfile
9049 prefixvar=sitebin
9050 . ./setprefixvar
9051
9052 : determine where add-on html pages go
9053 : There is no standard location, so try to copy the previously-selected
9054 : directory structure for the core html pages.
9055 case "$sitehtml1dir" in
9056 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9057 *)     dflt=$sitehtml1dir ;;
9058 esac
9059 case "$dflt" in
9060 ''|' ') dflt=none ;;
9061 esac
9062 fn=dn+~
9063 rp='Pathname where the site-specific html pages should be installed?'
9064 . ./getfile
9065 prefixvar=sitehtml1dir
9066 . ./setprefixvar
9067
9068 : determine where add-on library html pages go
9069 : There is no standard location, so try to copy the previously-selected
9070 : directory structure for the core html pages.
9071 case "$sitehtml3dir" in
9072 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9073 *)     dflt=$sitehtml3dir ;;
9074 esac
9075 case "$dflt" in
9076 ''|' ') dflt=none ;;
9077 esac
9078 fn=dn+~
9079 rp='Pathname where the site-specific library html pages should be installed?'
9080 . ./getfile
9081 prefixvar=sitehtml3dir
9082 . ./setprefixvar
9083
9084 : determine where add-on manual pages go
9085 case "$siteman1dir" in
9086 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9087 *)      dflt=$siteman1dir ;;
9088 esac
9089 case "$dflt" in
9090 ''|' ') dflt=none ;;
9091 esac
9092 fn=dn+~
9093 rp='Pathname where the site-specific manual pages should be installed?'
9094 . ./getfile
9095 prefixvar=siteman1dir
9096 . ./setprefixvar
9097
9098 : determine where add-on library man pages go
9099 case "$siteman3dir" in
9100 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9101 *)      dflt=$siteman3dir ;;
9102 esac
9103 case "$dflt" in
9104 ''|' ') dflt=none ;;
9105 esac
9106 fn=dn+~
9107 rp='Pathname where the site-specific library manual pages should be installed?'
9108 . ./getfile
9109 prefixvar=siteman3dir
9110 . ./setprefixvar
9111
9112 : determine where add-on public executable scripts go
9113 case "$sitescript" in
9114 '')     dflt=$siteprefix/script
9115         $test -d $dflt || dflt=$sitebin ;;
9116 *)  dflt="$sitescript" ;;
9117 esac
9118 fn=d~+
9119 rp='Pathname where add-on public executable scripts should be installed?'
9120 . ./getfile
9121 prefixvar=sitescript
9122 . ./setprefixvar
9123
9124 : Check if faststdio is requested and available
9125 case "$usefaststdio" in
9126 $define|true|[yY]*|'')
9127         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9128         case "$xversion" in
9129         [68])   dflt='y' ;;
9130         *)      dflt='n' ;;
9131         esac
9132         ;;
9133 *) dflt='n';;
9134 esac
9135 cat <<EOM
9136
9137 Perl can be built to use 'fast stdio', which means using the stdio
9138 library but also directly manipulating the stdio buffers to enable
9139 faster I/O.  Using stdio is better for backward compatibility (especially
9140 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9141 interface has been preferred instead of stdio.
9142
9143 If this doesn't make any sense to you, just accept the default '$dflt'.
9144 EOM
9145 rp='Use the "fast stdio" if available?'
9146 . ./myread
9147 case "$ans" in
9148 y|Y)    val="$define" ;;
9149 *)      val="$undef" ;;
9150 esac
9151 set usefaststdio
9152 eval $setvar
9153
9154
9155 : define an is-a-typedef? function
9156 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9157 case "$inclist" in
9158 "") inclist="sys/types.h";;
9159 esac;
9160 eval "varval=\$$var";
9161 case "$varval" in
9162 "")
9163         $rm -f temp.c;
9164         for inc in $inclist; do
9165                 echo "#include <$inc>" >>temp.c;
9166         done;
9167         echo "#ifdef $type" >> temp.c;
9168         echo "printf(\"We have $type\");" >> temp.c;
9169         echo "#endif" >> temp.c;
9170         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9171         if $contains $type temp.E >/dev/null 2>&1; then
9172                 eval "$var=\$type";
9173         else
9174                 eval "$var=\$def";
9175         fi;
9176         $rm -f temp.?;;
9177 *) eval "$var=\$varval";;
9178 esac'
9179
9180 : define an is-a-typedef? function that prompts if the type is not available.
9181 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9182 case "$inclist" in
9183 "") inclist="sys/types.h";;
9184 esac;
9185 eval "varval=\$$var";
9186 case "$varval" in
9187 "")
9188         $rm -f temp.c;
9189         for inc in $inclist; do
9190                 echo "#include <$inc>" >>temp.c;
9191         done;
9192         echo "#ifdef $type" >> temp.c;
9193         echo "printf(\"We have $type\");" >> temp.c;
9194         echo "#endif" >> temp.c;
9195         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9196         echo " " ;
9197         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9198         if $contains $type temp.E >/dev/null 2>&1; then
9199                 echo "$type found." >&4;
9200                 eval "$var=\$type";
9201         else
9202                 echo "$type NOT found." >&4;
9203                 dflt="$def";
9204                 . ./myread ;
9205                 eval "$var=\$ans";
9206         fi;
9207         $rm -f temp.?;;
9208 *) eval "$var=\$varval";;
9209 esac'
9210
9211 : see what type lseek is declared as in the kernel
9212 rp="What is the type used for lseek's offset on this system?"
9213 set off_t lseektype long stdio.h sys/types.h
9214 eval $typedef_ask
9215
9216 echo " "
9217 echo "Checking to see how big your file offsets are..." >&4
9218 $cat >try.c <<EOCP
9219 #include <sys/types.h>
9220 #include <stdio.h>
9221 int main()
9222 {
9223     printf("%d\n", (int)sizeof($lseektype));
9224     return(0);
9225 }
9226 EOCP
9227 set try
9228 if eval $compile_ok; then
9229         lseeksize=`$run ./try`
9230         echo "Your file offsets are $lseeksize bytes long."
9231 else
9232         dflt=$longsize
9233         echo " "
9234         echo "(I can't seem to compile the test program.  Guessing...)"
9235         rp="What is the size of your file offsets (in bytes)?"
9236         . ./myread
9237         lseeksize="$ans"
9238 fi
9239 $rm_try
9240
9241 : see what type file positions are declared as in the library
9242 rp="What is the type for file position used by fsetpos()?"
9243 set fpos_t fpostype long stdio.h sys/types.h
9244 eval $typedef_ask
9245
9246 : Check size for Fpos_t
9247 echo " "
9248 case "$fpostype" in
9249 *_t) zzz="$fpostype"    ;;
9250 *)   zzz="fpos_t"       ;;
9251 esac
9252 echo "Checking the size of $zzz..." >&4
9253 cat > try.c <<EOCP
9254 #include <sys/types.h>
9255 #include <stdio.h>
9256 #$i_stdlib I_STDLIB
9257 #ifdef I_STDLIB
9258 #include <stdlib.h>
9259 #endif
9260 int main() {
9261     printf("%d\n", (int)sizeof($fpostype));
9262     exit(0);
9263 }
9264 EOCP
9265 set try
9266 if eval $compile_ok; then
9267         yyy=`$run ./try`
9268         case "$yyy" in
9269         '')     fpossize=4
9270                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9271                 ;;
9272         *)      fpossize=$yyy
9273                 echo "Your $zzz is $fpossize bytes long."
9274                 ;;
9275         esac
9276 else
9277         dflt="$longsize"
9278         echo " " >&4
9279         echo "(I can't compile the test program.  Guessing...)" >&4
9280         rp="What is the size of your file positions (in bytes)?"
9281         . ./myread
9282         fpossize="$ans"
9283 fi
9284
9285 : Check for large file support
9286 # Backward compatibility (uselfs is deprecated).
9287 case "$uselfs" in
9288 "$define"|true|[yY]*)
9289         cat <<EOM >&4
9290
9291 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9292 EOM
9293         uselargefiles="$define"
9294         ;;
9295 esac
9296
9297 case "$lseeksize:$fpossize" in
9298 8:8) cat <<EOM
9299
9300 You can have files larger than 2 gigabytes.
9301 EOM
9302    val="$define" ;;
9303 *)    case "$uselargefiles" in
9304    "$undef"|false|[nN]*) dflt='n' ;;
9305    *)   dflt='y' ;;
9306    esac
9307    cat <<EOM
9308
9309 Perl can be built to understand large files (files larger than 2 gigabytes)
9310 on some systems.  To do so, Configure can be run with -Duselargefiles.
9311
9312 If this doesn't make any sense to you, just accept the default '$dflt'.
9313 EOM
9314    rp='Try to understand large files, if available?'
9315    . ./myread
9316    case "$ans" in
9317    y|Y)         val="$define" ;;
9318    *)           val="$undef"  ;;
9319    esac
9320    ;;
9321 esac
9322 set uselargefiles
9323 eval $setvar
9324 : Look for a hint-file generated 'call-back-unit'.  If the
9325 : user has specified that a large files perl is to be built,
9326 : we may need to set or change some other defaults.
9327 if $test -f uselargefiles.cbu; then
9328         echo "Your platform has some specific hints regarding large file builds, using them..."
9329         . ./uselargefiles.cbu
9330 fi
9331 case "$uselargefiles" in
9332 "$define")
9333         if $test -f uselargefiles.cbu; then
9334                 echo " "
9335                 echo "Rechecking to see how big your file offsets are..." >&4
9336                 $cat >try.c <<EOCP
9337 #include <sys/types.h>
9338 #include <stdio.h>
9339 int main()
9340 {
9341     printf("%d\n", (int)sizeof($lseektype));
9342     return(0);
9343 }
9344 EOCP
9345                 set try
9346                 if eval $compile_ok; then
9347                         lseeksize=`$run ./try`
9348                         $echo "Your file offsets are now $lseeksize bytes long."
9349                 else
9350                         dflt="$lseeksize"
9351                         echo " "
9352                         echo "(I can't seem to compile the test program.  Guessing...)"
9353                         rp="What is the size of your file offsets (in bytes)?"
9354                         . ./myread
9355                         lseeksize="$ans"
9356                 fi
9357                 case "$fpostype" in
9358                 *_t) zzz="$fpostype"    ;;
9359                 *)   zzz="fpos_t"       ;;
9360                 esac
9361                 $echo $n "Rechecking the size of $zzz...$c" >&4
9362                 $cat > try.c <<EOCP
9363 #include <sys/types.h>
9364 #include <stdio.h>
9365 #$i_stdlib I_STDLIB
9366 #ifdef I_STDLIB
9367 #include <stdlib.h>
9368 #endif
9369 int main() {
9370     printf("%d\n", (int)sizeof($fpostype));
9371     return(0);
9372 }
9373 EOCP
9374                 set try
9375                 if eval $compile_ok; then
9376                         yyy=`$run ./try`
9377                         dflt="$lseeksize"
9378                         case "$yyy" in
9379                         '')     echo " "
9380                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9381                                 ;;
9382                         *)      fpossize=$yyy
9383                                 echo " $fpossize bytes." >&4
9384                                 ;;
9385                         esac
9386                 else
9387                         dflt="$fpossize"
9388                         echo " "
9389                         echo "(I can't compile the test program.  Guessing...)" >&4
9390                         rp="What is the size of your file positions (in bytes)?"
9391                         . ./myread
9392                         fpossize="$ans"
9393                 fi
9394                 $rm_try
9395         fi
9396         ;;
9397 esac
9398
9399 : Set the vendorbin variables
9400 case "$vendorprefix" in
9401 '')     d_vendorbin="$undef"
9402         vendorbin=''
9403         vendorbinexp=''
9404         ;;
9405 *)      d_vendorbin="$define"
9406         : determine where vendor-supplied executables go.
9407         case "$vendorbin" in
9408         '') dflt=$vendorprefix/bin ;;
9409         *)      dflt="$vendorbin" ;;
9410         esac
9411         fn=d~+
9412         rp='Pathname for the vendor-supplied executables directory?'
9413         . ./getfile
9414         vendorbin="$ans"
9415         vendorbinexp="$ansexp"
9416         ;;
9417 esac
9418 prefixvar=vendorbin
9419 . ./installprefix
9420
9421 : Set the vendorhtml1dir variables
9422 case "$vendorprefix" in
9423 '')     vendorhtml1dir=''
9424         vendorhtml1direxp=''
9425         ;;
9426 *)      : determine where vendor-supplied html pages go.
9427         : There is no standard location, so try to copy the previously-selected
9428         : directory structure for the core html pages.
9429         : XXX Better default suggestions would be welcome.
9430         case "$vendorhtml1dir" in
9431         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9432         *)      dflt=$vendorhtml1dir ;;
9433         esac
9434         case "$dflt" in
9435         ''|' ') dflt=none ;;
9436         esac
9437         fn=dn+~
9438         rp='Pathname for the vendor-supplied html pages?'
9439         . ./getfile
9440         vendorhtml1dir="$ans"
9441         vendorhtml1direxp="$ansexp"
9442         ;;
9443 esac
9444 : Use ' ' for none so value is preserved next time through Configure
9445 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9446 prefixvar=vendorhtml1dir
9447 . ./installprefix
9448
9449 : Set the vendorhtml3dir variables
9450 case "$vendorprefix" in
9451 '')     vendorhtml3dir=''
9452         vendorhtml3direxp=''
9453         ;;
9454 *)      : determine where vendor-supplied module html pages go.
9455         : There is no standard location, so try to copy the previously-selected
9456         : directory structure for the core html pages.
9457         : XXX Better default suggestions would be welcome.
9458         case "$vendorhtml3dir" in
9459         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9460         *)      dflt=$vendorhtml3dir ;;
9461         esac
9462         case "$dflt" in
9463         ''|' ') dflt=none ;;
9464         esac
9465         fn=dn+~
9466         rp='Pathname for the vendor-supplied html pages?'
9467         . ./getfile
9468         vendorhtml3dir="$ans"
9469         vendorhtml3direxp="$ansexp"
9470         ;;
9471 esac
9472 : Use ' ' for none so value is preserved next time through Configure
9473 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9474 prefixvar=vendorhtml3dir
9475 . ./installprefix
9476
9477 : Set the vendorman1dir variables
9478 case "$vendorprefix" in
9479 '')     vendorman1dir=''
9480         vendorman1direxp=''
9481         ;;
9482 *)      : determine where vendor-supplied manual pages go.
9483         case "$vendorman1dir" in
9484         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9485         *)      dflt=$vendorman1dir ;;
9486         esac
9487         case "$dflt" in
9488         ''|' ') dflt=none ;;
9489         esac
9490         fn=nd~+
9491         rp='Pathname for the vendor-supplied manual section 1 pages?'
9492         . ./getfile
9493         vendorman1dir="$ans"
9494         vendorman1direxp="$ansexp"
9495         ;;
9496 esac
9497 : Use ' ' for none so value is preserved next time through Configure
9498 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9499 prefixvar=vendorman1dir
9500 . ./installprefix
9501
9502 : Set the vendorman3dir variables
9503 case "$vendorprefix" in
9504 '')     vendorman3dir=''
9505         vendorman3direxp=''
9506         ;;
9507 *)      : determine where vendor-supplied module manual pages go.
9508         case "$vendorman3dir" in
9509         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9510         *)      dflt=$vendorman3dir ;;
9511         esac
9512         case "$dflt" in
9513         ''|' ') dflt=none ;;
9514         esac
9515         fn=nd~+
9516         rp='Pathname for the vendor-supplied manual section 3 pages?'
9517         . ./getfile
9518         vendorman3dir="$ans"
9519         vendorman3direxp="$ansexp"
9520         ;;
9521 esac
9522 : Use ' ' for none so value is preserved next time through Configure
9523 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9524 prefixvar=vendorman3dir
9525 . ./installprefix
9526
9527 : Set the vendorscript variables
9528 case "$vendorprefix" in
9529 '')     d_vendorscript="$undef"
9530         vendorscript=''
9531         vendorscriptexp=''
9532         ;;
9533 *)      d_vendorscript="$define"
9534         : determine where vendor-supplied scripts go.
9535         case "$vendorscript" in
9536         '')     dflt=$vendorprefix/script
9537                 $test -d $dflt || dflt=$vendorbin ;;
9538         *)  dflt="$vendorscript" ;;
9539         esac
9540         $cat <<EOM
9541
9542 The installation process will create a directory for
9543 vendor-supplied scripts.
9544
9545 EOM
9546         fn=d~+
9547         rp='Pathname for the vendor-supplied scripts directory?'
9548         . ./getfile
9549         vendorscript="$ans"
9550         vendorscriptexp="$ansexp"
9551         ;;
9552 esac
9553 prefixvar=vendorscript
9554 . ./installprefix
9555
9556 : script used to emit important warnings
9557 cat >warn <<EOS
9558 $startsh
9559 if test \$# -gt 0; then
9560         echo "\$@" >msg
9561 else
9562         cat >msg
9563 fi
9564 echo "*** WARNING:" >&4
9565 sed -e 's/^/*** /' <msg >&4
9566 echo "*** " >&4
9567 cat msg >>config.msg
9568 echo " " >>config.msg
9569 rm -f msg
9570 EOS
9571 chmod +x warn
9572 $eunicefix warn
9573
9574 : see which of string.h or strings.h is needed
9575 echo " "
9576 strings=`./findhdr string.h`
9577 if $test "$strings" && $test -r "$strings"; then
9578         echo "Using <string.h> instead of <strings.h>." >&4
9579         val="$define"
9580 else
9581         val="$undef"
9582         strings=`./findhdr strings.h`
9583         if $test "$strings" && $test -r "$strings"; then
9584                 echo "Using <strings.h> instead of <string.h>." >&4
9585         else
9586                 ./warn "No string header found -- You'll surely have problems."
9587         fi
9588 fi
9589 set i_string
9590 eval $setvar
9591 case "$i_string" in
9592 "$undef") strings=`./findhdr strings.h`;;
9593 *)        strings=`./findhdr string.h`;;
9594 esac
9595
9596 : see if qgcvt exists
9597 set qgcvt d_qgcvt
9598 eval $inlibc
9599
9600 : Check print/scan long double stuff
9601 echo " "
9602
9603 if $test X"$d_longdbl" = X"$define"; then
9604
9605 echo "Checking how to print long doubles..." >&4
9606
9607 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9608         $cat >try.c <<'EOCP'
9609 #include <sys/types.h>
9610 #include <stdio.h>
9611 int main() {
9612   double d = 123.456;
9613   printf("%.3f\n", d);
9614 }
9615 EOCP
9616         set try
9617         if eval $compile; then
9618                 yyy=`$run ./try`
9619                 case "$yyy" in
9620                 123.456)
9621                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9622                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9623                         echo "We will use %f."
9624                         ;;
9625                 esac
9626         fi
9627 fi
9628
9629 if $test X"$sPRIfldbl" = X; then
9630         $cat >try.c <<'EOCP'
9631 #include <sys/types.h>
9632 #include <stdio.h>
9633 int main() {
9634   long double d = 123.456;
9635   printf("%.3Lf\n", d);
9636 }
9637 EOCP
9638         set try
9639         if eval $compile; then
9640                 yyy=`$run ./try`
9641                 case "$yyy" in
9642                 123.456)
9643                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9644                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9645                         echo "We will use %Lf."
9646                         ;;
9647                 esac
9648         fi
9649 fi
9650
9651 if $test X"$sPRIfldbl" = X; then
9652         $cat >try.c <<'EOCP'
9653 #include <sys/types.h>
9654 #include <stdio.h>
9655 int main() {
9656   long double d = 123.456;
9657   printf("%.3llf\n", d);
9658 }
9659 EOCP
9660         set try
9661         if eval $compile; then
9662                 yyy=`$run ./try`
9663                 case "$yyy" in
9664                 123.456)
9665                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9666                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9667                         echo "We will use %llf."
9668                         ;;
9669                 esac
9670         fi
9671 fi
9672
9673 if $test X"$sPRIfldbl" = X; then
9674         $cat >try.c <<'EOCP'
9675 #include <sys/types.h>
9676 #include <stdio.h>
9677 int main() {
9678   long double d = 123.456;
9679   printf("%.3lf\n", d);
9680 }
9681 EOCP
9682         set try
9683         if eval $compile; then
9684                 yyy=`$run ./try`
9685                 case "$yyy" in
9686                 123.456)
9687                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9688                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9689                         echo "We will use %lf."
9690                         ;;
9691                 esac
9692         fi
9693 fi
9694
9695 if $test X"$sPRIfldbl" = X; then
9696         echo "Cannot figure out how to print long doubles." >&4
9697 else
9698         sSCNfldbl=$sPRIfldbl    # expect consistency
9699 fi
9700
9701 $rm_try
9702
9703 fi # d_longdbl
9704
9705 case "$sPRIfldbl" in
9706 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9707         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9708         d_SCNfldbl="$undef";
9709         ;;
9710 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9711         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9712         d_SCNfldbl="$define";
9713         ;;
9714 esac
9715
9716 : Check how to convert floats to strings.
9717
9718 if test "X$d_Gconvert" = X; then
9719
9720 echo " "
9721 echo "Checking for an efficient way to convert floats to strings."
9722 echo " " > try.c
9723 case "$uselongdouble" in
9724 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9725 esac
9726 case "$d_longdbl" in
9727 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9728 esac
9729 case "$d_PRIgldbl" in
9730 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9731 esac
9732 $cat >>try.c <<EOP
9733 #ifdef TRY_gconvert
9734 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9735 char *myname = "gconvert";
9736 #endif
9737 #ifdef TRY_gcvt
9738 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9739 char *myname = "gcvt";
9740 #endif
9741 #ifdef TRY_qgcvt
9742 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9743 char *myname = "qgcvt";
9744 #define DOUBLETYPE long double
9745 #endif
9746 #ifdef TRY_sprintf
9747 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9748 #ifdef HAS_PRIgldbl
9749 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9750 #else
9751 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9752 #endif
9753 #else
9754 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9755 #endif
9756 char *myname = "sprintf";
9757 #endif
9758
9759 #ifndef DOUBLETYPE
9760 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9761 #define DOUBLETYPE long double
9762 #else
9763 #define DOUBLETYPE double
9764 #endif
9765 #endif
9766
9767 #include <stdio.h>
9768
9769 #$i_stdlib I_STDLIB
9770 #ifdef I_STDLIB
9771 #include <stdlib.h>
9772 #endif
9773 #$i_string I_STRING
9774 #ifdef I_STRING
9775 #  include <string.h>
9776 #else
9777 #  include <strings.h>
9778 #endif
9779
9780 int checkit(char *expect, char *got)
9781 {
9782     if (strcmp(expect, got)) {
9783                 printf("%s oddity:  Expected %s, got %s\n",
9784                         myname, expect, got);
9785                 exit(1);
9786         }
9787 }
9788
9789 int main()
9790 {
9791         char buf[64];
9792         buf[63] = '\0';
9793
9794         /* This must be 1st test on (which?) platform */
9795         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9796         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9797         checkit("0.1", buf);
9798
9799         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9800         checkit("0.01", buf);
9801
9802         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9803         checkit("0.001", buf);
9804
9805         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9806         checkit("0.0001", buf);
9807
9808         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9809         if (strlen(buf) > 5)
9810             checkit("9e-005", buf); /* for Microsoft ?? */
9811         else
9812             checkit("9e-05", buf);
9813
9814         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9815         checkit("1", buf);
9816
9817         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9818         checkit("1.1", buf);
9819
9820         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9821         checkit("1.01", buf);
9822
9823         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9824         checkit("1.001", buf);
9825
9826         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9827         checkit("1.0001", buf);
9828
9829         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9830         checkit("1.00001", buf);
9831
9832         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9833         checkit("1.000001", buf);
9834
9835         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9836         checkit("0", buf);
9837
9838         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9839         checkit("-1", buf);
9840
9841         /* Some Linux gcvt's give 1.e+5 here. */
9842         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9843         checkit("100000", buf);
9844
9845         /* Some Linux gcvt's give -1.e+5 here. */
9846         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9847         checkit("-100000", buf);
9848
9849         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9850         checkit("123.456", buf);
9851
9852         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9853         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9854         /* 34 should be enough to scare even long double
9855          * places into using the e notation. */
9856         if (strlen(buf) > 5)
9857             checkit("1e+034", buf); /* for Microsoft */
9858         else
9859             checkit("1e+34", buf);
9860
9861         /* For Perl, if you add additional tests here, also add them to
9862          * t/base/num.t for benefit of platforms not using Configure or
9863          * overriding d_Gconvert */
9864
9865         exit(0);
9866 }
9867 EOP
9868 : first add preferred functions to our list
9869 xxx_list=""
9870 for xxx_convert in $gconvert_preference; do
9871     case $xxx_convert in
9872     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9873     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9874     esac
9875 done
9876 : then add any others
9877 for xxx_convert in gconvert gcvt sprintf; do
9878     case "$xxx_list" in
9879     *$xxx_convert*) ;;
9880     *) xxx_list="$xxx_list $xxx_convert" ;;
9881     esac
9882 done
9883
9884 case "$d_longdbl$uselongdouble" in
9885 "$define$define")
9886     : again, add prefered functions to our list first
9887     xxx_ld_list=""
9888     for xxx_convert in $gconvert_ld_preference; do
9889         case $xxx_convert in
9890         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9891         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9892         esac
9893     done
9894     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9895     for xxx_convert in qgcvt sprintf $xxx_list; do
9896         case "$xxx_ld_list" in
9897         $xxx_convert*|*" $xxx_convert"*) ;;
9898         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9899         esac
9900     done
9901     : if sprintf cannot do long doubles, move it to the end
9902     if test "$d_PRIgldbl" != "$define"; then
9903         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9904     fi
9905     : if no qgcvt, remove it
9906     if test "$d_qgcvt" != "$define"; then
9907         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9908     fi
9909     : use the ld_list
9910     xxx_list="$xxx_ld_list"
9911     ;;
9912 esac
9913
9914 for xxx_convert in $xxx_list; do
9915         echo "Trying $xxx_convert..."
9916         $rm -f try try$_o core
9917         set try -DTRY_$xxx_convert
9918         if eval $compile; then
9919                 echo "$xxx_convert() found." >&4
9920                 if $run ./try; then
9921                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9922                         break;
9923                 else
9924                         echo "...But $xxx_convert didn't work as I expected."
9925                         xxx_convert=''
9926                 fi
9927         else
9928                 echo "$xxx_convert NOT found." >&4
9929         fi
9930 done
9931
9932 if test X$xxx_convert = X; then
9933     echo "*** WHOA THERE!!! ***" >&4
9934     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9935     xxx_convert=sprintf
9936 fi
9937
9938 case "$xxx_convert" in
9939 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9940 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9941 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9942 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9943    "$define$define$define")
9944       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9945    "$define$define$undef")
9946       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9947    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9948    esac
9949    ;;
9950 esac
9951
9952 fi
9953 $rm_try
9954
9955 : see if _fwalk exists
9956 set fwalk d__fwalk
9957 eval $inlibc
9958
9959 : Initialize h_fcntl
9960 h_fcntl=false
9961
9962 : Initialize h_sysfile
9963 h_sysfile=false
9964
9965 : access call always available on UNIX
9966 set access d_access
9967 eval $inlibc
9968
9969 : locate the flags for 'access()'
9970 case "$d_access" in
9971 "$define")
9972         echo " "
9973         $cat >access.c <<EOCP
9974 #include <sys/types.h>
9975 #ifdef I_FCNTL
9976 #include <fcntl.h>
9977 #endif
9978 #ifdef I_SYS_FILE
9979 #include <sys/file.h>
9980 #endif
9981 #ifdef I_UNISTD
9982 #include <unistd.h>
9983 #endif
9984 #$i_stdlib I_STDLIB
9985 #ifdef I_STDLIB
9986 #include <stdlib.h>
9987 #endif
9988 int main() {
9989         exit(R_OK);
9990 }
9991 EOCP
9992         : check sys/file.h first, no particular reason here
9993         if $test `./findhdr sys/file.h` && \
9994                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9995                 h_sysfile=true;
9996                 echo "<sys/file.h> defines the *_OK access constants." >&4
9997         elif $test `./findhdr fcntl.h` && \
9998                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9999                 h_fcntl=true;
10000                 echo "<fcntl.h> defines the *_OK access constants." >&4
10001         elif $test `./findhdr unistd.h` && \
10002                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10003                 echo "<unistd.h> defines the *_OK access constants." >&4
10004         else
10005                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10006         fi
10007         ;;
10008 esac
10009 $rm -f access*
10010
10011 : see if accessx exists
10012 set accessx d_accessx
10013 eval $inlibc
10014
10015 : see if aintl exists
10016 set aintl d_aintl
10017 eval $inlibc
10018
10019 : see if alarm exists
10020 set alarm d_alarm
10021 eval $inlibc
10022
10023 : see if 64bit time functions exists
10024
10025 set ctime64 d_ctime64
10026 eval $inlibc
10027
10028 set localtime64 d_localtime64
10029 eval $inlibc
10030
10031 set gmtime64 d_gmtime64
10032 eval $inlibc
10033
10034 set mktime64 d_mktime64
10035 eval $inlibc
10036
10037 set difftime64 d_difftime64
10038 eval $inlibc
10039
10040 set asctime64 d_asctime64
10041 eval $inlibc
10042
10043 : see if POSIX threads are available
10044 set pthread.h i_pthread
10045 eval $inhdr
10046
10047 : define a fucntion to check prototypes
10048 $cat > protochk <<EOSH
10049 $startsh
10050 cc="$cc"
10051 optimize="$optimize"
10052 ccflags="$ccflags"
10053 prototype="$prototype"
10054 define="$define"
10055 rm_try="$rm_try"
10056 usethreads=$usethreads
10057 i_pthread=$i_pthread
10058 pthread_h_first=$pthread_h_first
10059 EOSH
10060
10061 $cat >> protochk <<'EOSH'
10062
10063 $rm_try
10064 foo="$1"
10065 shift
10066 while test $# -ge 2; do
10067         case "$1" in
10068                 $define) echo "#include <$2>" >> try.c ;;
10069                 literal) echo "$2" >> try.c ;;
10070         esac
10071     # Extra magic for the benefit of systems that need pthread.h
10072     # to be included early to correctly detect threadsafe functions.
10073     # Such functions must guarantee themselves, though, that the usethreads
10074     # and i_pthread have been defined, before calling protochk.
10075     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10076         echo "#include <pthread.h>" >> try.c
10077         pthread_h_done=yes
10078     fi
10079     shift 2
10080 done
10081 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10082 cat >> try.c <<'EOCP'
10083 #ifdef CAN_PROTOTYPE
10084 #define _(args) args
10085 #else
10086 #define _(args) ()
10087 #endif
10088 EOCP
10089 echo "$foo" >> try.c
10090 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10091 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10092 status=$?
10093 $rm_try
10094 exit $status
10095 EOSH
10096 chmod +x protochk
10097 $eunicefix protochk
10098
10099 : Define hasproto macro for Configure internal use
10100 hasproto='varname=$1; func=$2; shift; shift;
10101 while $test $# -ge 2; do
10102         case "$1" in
10103         $define) echo "#include <$2>";;
10104         esac ;
10105     shift 2;
10106 done > try.c;
10107 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10108 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10109         echo "$func() prototype found.";
10110         val="$define";
10111 else
10112         echo "$func() prototype NOT found.";
10113         val="$undef";
10114 fi;
10115 set $varname;
10116 eval $setvar;
10117 $rm_try tryout.c'
10118
10119 : see if sys/types.h has to be included
10120 set sys/types.h i_systypes
10121 eval $inhdr
10122
10123 : see if sys/select.h has to be included
10124 set sys/select.h i_sysselct
10125 eval $inhdr
10126
10127 : Define hasfield macro for Configure internal use
10128 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10129 while $test $# -ge 2; do
10130         case "$1" in
10131         $define) echo "#include <$2>";;
10132         esac ;
10133     shift 2;
10134 done > try.c;
10135 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10136 set try;
10137 if eval $compile; then
10138         val="$define";
10139 else
10140         val="$undef";
10141 fi;
10142 set $varname;
10143 eval $setvar;
10144 $rm_try'
10145
10146 : see if we should include time.h, sys/time.h, or both
10147 echo " "
10148 if test "X$timeincl" = X; then
10149         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10150         $echo $n "I'm now running the test program...$c"
10151         $cat >try.c <<EOCP
10152 #include <sys/types.h>
10153 #ifdef I_TIME
10154 #include <time.h>
10155 #endif
10156 #ifdef I_SYSTIME
10157 #ifdef SYSTIMEKERNEL
10158 #define KERNEL
10159 #endif
10160 #include <sys/time.h>
10161 #endif
10162 #ifdef I_SYSSELECT
10163 #include <sys/select.h>
10164 #endif
10165 #$i_stdlib I_STDLIB
10166 #ifdef I_STDLIB
10167 #include <stdlib.h>
10168 #endif
10169 int main()
10170 {
10171         struct tm foo;
10172 #ifdef S_TIMEVAL
10173         struct timeval bar;
10174 #endif
10175 #ifdef S_TIMEZONE
10176         struct timezone tzp;
10177 #endif
10178         if (foo.tm_sec == foo.tm_sec)
10179                 exit(0);
10180 #ifdef S_TIMEVAL
10181         if (bar.tv_sec == bar.tv_sec)
10182                 exit(0);
10183 #endif
10184         exit(1);
10185 }
10186 EOCP
10187         flags=''
10188         for s_timezone in '-DS_TIMEZONE' ''; do
10189         sysselect=''
10190         for s_timeval in '-DS_TIMEVAL' ''; do
10191         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10192         for i_time in '' '-DI_TIME'; do
10193         for i_systime in '-DI_SYSTIME' ''; do
10194                 case "$flags" in
10195                 '') $echo $n ".$c"
10196                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10197                         if eval $compile; then
10198                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10199                                 shift
10200                                 flags="$*"
10201                                 echo " "
10202                                 $echo $n "Succeeded with $flags$c"
10203                         fi
10204                         ;;
10205                 esac
10206         done
10207         done
10208         done
10209         done
10210         done
10211         timeincl=''
10212         echo " "
10213         case "$flags" in
10214         *SYSTIMEKERNEL*) i_systimek="$define"
10215                 timeincl=`./findhdr sys/time.h`
10216                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10217         *) i_systimek="$undef";;
10218         esac
10219         case "$flags" in
10220         *I_TIME*) i_time="$define"
10221                 timeincl=`./findhdr time.h`" $timeincl"
10222                 echo "We'll include <time.h>." >&4;;
10223         *) i_time="$undef";;
10224         esac
10225         case "$flags" in
10226         *I_SYSTIME*) i_systime="$define"
10227                 timeincl=`./findhdr sys/time.h`" $timeincl"
10228                 echo "We'll include <sys/time.h>." >&4;;
10229         *) i_systime="$undef";;
10230         esac
10231         $rm_try
10232 fi
10233 : see if struct tm knows about tm_zone
10234 case "$i_systime$i_time" in
10235 *$define*)
10236         echo " "
10237         echo "Checking to see if your struct tm has tm_zone field..." >&4
10238         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10239         eval $hasfield
10240         ;;
10241 *)      val="$undef"
10242         set d_tm_tm_zone
10243         eval $setvar
10244         ;;
10245 esac
10246 case "$d_tm_tm_zone" in
10247 "$define")      echo "Yes, it does."   ;;
10248 *)              echo "No, it doesn't." ;;
10249 esac
10250 : see if struct tm knows about tm_gmtoff
10251 case "$i_systime$i_time" in
10252 *$define*)
10253         echo " "
10254         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10255         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10256         eval $hasfield
10257         ;;
10258 *)      val="$undef"
10259         set d_tm_tm_gmtoff
10260         eval $setvar
10261         ;;
10262 esac
10263 case "$d_tm_tm_gmtoff" in
10264 "$define")      echo "Yes, it does."   ;;
10265 *)              echo "No, it doesn't." ;;
10266 esac
10267
10268 : see if asctime_r exists
10269 set asctime_r d_asctime_r
10270 eval $inlibc
10271 case "$d_asctime_r" in
10272 "$define")
10273         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10274         case "$d_asctime_r_proto:$usethreads" in
10275         ":define")      d_asctime_r_proto=define
10276                 set d_asctime_r_proto asctime_r $hdrs
10277                 eval $hasproto ;;
10278         *)      ;;
10279         esac
10280         case "$d_asctime_r_proto" in
10281         define)
10282         case "$asctime_r_proto" in
10283         ''|0) try='char* asctime_r(const struct tm*, char*);'
10284         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10285         esac
10286         case "$asctime_r_proto" in
10287         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10288         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10289         esac
10290         case "$asctime_r_proto" in
10291         ''|0) try='int asctime_r(const struct tm*, char*);'
10292         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10293         esac
10294         case "$asctime_r_proto" in
10295         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10296         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10297         esac
10298         case "$asctime_r_proto" in
10299         ''|0)   d_asctime_r=undef
10300                 asctime_r_proto=0
10301                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10302         * )     case "$asctime_r_proto" in
10303                 REENTRANT_PROTO*) ;;
10304                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10305                 esac
10306                 echo "Prototype: $try" ;;
10307         esac
10308         ;;
10309         *)      case "$usethreads" in
10310                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10311                 esac
10312                 d_asctime_r=undef
10313                 asctime_r_proto=0
10314                 ;;
10315         esac
10316         ;;
10317 *)      asctime_r_proto=0
10318         ;;
10319 esac
10320
10321 : see if atolf exists
10322 set atolf d_atolf
10323 eval $inlibc
10324
10325 : see if atoll exists
10326 set atoll d_atoll
10327 eval $inlibc
10328
10329 : Look for GCC-style attribute format
10330 case "$d_attribute_format" in
10331 '')
10332 echo " "
10333 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10334 $cat >attrib.c <<'EOCP'
10335 #include <stdio.h>
10336 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10337 EOCP
10338 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10339         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10340                 echo "Your C compiler doesn't support __attribute__((format))."
10341                 val="$undef"
10342         else
10343                 echo "Your C compiler supports __attribute__((format))."
10344                 val="$define"
10345         fi
10346 else
10347         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10348         val="$undef"
10349 fi
10350 ;;
10351 *) val="$d_attribute_format" ;;
10352 esac
10353 set d_attribute_format
10354 eval $setvar
10355 $rm -f attrib*
10356
10357 : Look for GCC-style attribute format with null format allowed
10358 case "$d_printf_format_null" in
10359 '') case "$d_attribute_format" in
10360     $define)
10361         echo " "
10362         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10363 $cat >attrib.c <<EOCP
10364 #include <stdio.h>
10365 #$i_stdlib I_STDLIB
10366 #ifdef I_STDLIB
10367 #include <stdlib.h>
10368 #endif
10369 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10370 int null_printf (char* pat,...) { return (int)pat; }
10371 int main () { exit(null_printf(NULL)); }
10372 EOCP
10373         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10374             : run the executable in case it produces a run-time warning
10375             if $run ./attrib >>attrib.out 2>&1; then
10376                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10377                     echo "Your C compiler doesn't allow __printf__ format to be null."
10378                     val="$undef"
10379                 else
10380                     echo "Your C compiler allows __printf__ format to be null."
10381                     val="$define"
10382                 fi
10383             else
10384             echo "Your C compiler executable failed with __printf__ format null."
10385             val="$undef"
10386         fi
10387     else
10388         echo "Your C compiler fails with __printf__ format null."
10389         val="$undef"
10390     fi
10391     ;;
10392     *)  val="$undef" ;;
10393     esac
10394 ;;
10395 *)  val="$d_printf_format_null" ;;
10396 esac
10397 set d_printf_format_null
10398 eval $setvar
10399 $rm -f attrib*
10400
10401 : Look for GCC-style attribute malloc
10402 case "$d_attribute_malloc" in
10403 '')
10404 echo " "
10405 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10406 $cat >attrib.c <<'EOCP'
10407 #include <stdio.h>
10408 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10409 EOCP
10410 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10411         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10412                 echo "Your C compiler doesn't support __attribute__((malloc))."
10413                 val="$undef"
10414         else
10415                 echo "Your C compiler supports __attribute__((malloc))."
10416                 val="$define"
10417         fi
10418 else
10419         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10420         val="$undef"
10421 fi
10422 ;;
10423 *) val="$d_attribute_malloc" ;;
10424 esac
10425 set d_attribute_malloc
10426 eval $setvar
10427 $rm -f attrib*
10428
10429 : Look for GCC-style attribute nonnull
10430 case "$d_attribute_nonnull" in
10431 '')
10432 echo " "
10433 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10434 $cat >attrib.c <<'EOCP'
10435 #include <stdio.h>
10436 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10437 EOCP
10438 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10439         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10440                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10441                 val="$undef"
10442         else
10443                 echo "Your C compiler supports __attribute__((nonnull))."
10444                 val="$define"
10445         fi
10446 else
10447         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10448         val="$undef"
10449 fi
10450 ;;
10451 *) val="$d_attribute_nonnull" ;;
10452 esac
10453 set d_attribute_nonnull
10454 eval $setvar
10455 $rm -f attrib*
10456
10457 : Look for GCC-style attribute noreturn
10458 case "$d_attribute_noreturn" in
10459 '')
10460 echo " "
10461 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10462 $cat >attrib.c <<'EOCP'
10463 #include <stdio.h>
10464 void fall_over_dead( void ) __attribute__((noreturn));
10465 EOCP
10466 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10467         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10468                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10469                 val="$undef"
10470         else
10471                 echo "Your C compiler supports __attribute__((noreturn))."
10472                 val="$define"
10473         fi
10474 else
10475         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10476         val="$undef"
10477 fi
10478 ;;
10479 *) val="$d_attribute_noreturn" ;;
10480 esac
10481 set d_attribute_noreturn
10482 eval $setvar
10483 $rm -f attrib*
10484
10485 : Look for GCC-style attribute pure
10486 case "$d_attribute_pure" in
10487 '')
10488 echo " "
10489 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10490 $cat >attrib.c <<'EOCP'
10491 #include <stdio.h>
10492 int square( int n ) __attribute__((pure));
10493 EOCP
10494 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10495         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10496                 echo "Your C compiler doesn't support __attribute__((pure))."
10497                 val="$undef"
10498         else
10499                 echo "Your C compiler supports __attribute__((pure))."
10500                 val="$define"
10501         fi
10502 else
10503         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10504         val="$undef"
10505 fi
10506 ;;
10507 *) val="$d_attribute_pure" ;;
10508 esac
10509 set d_attribute_pure
10510 eval $setvar
10511 $rm -f attrib*
10512
10513 : Look for GCC-style attribute unused
10514 case "$d_attribute_unused" in
10515 '')
10516 echo " "
10517 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10518 $cat >attrib.c <<'EOCP'
10519 #include <stdio.h>
10520 int do_something( int dummy __attribute__((unused)), int n );
10521 EOCP
10522 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10523         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10524                 echo "Your C compiler doesn't support __attribute__((unused))."
10525                 val="$undef"
10526         else
10527                 echo "Your C compiler supports __attribute__((unused))."
10528                 val="$define"
10529         fi
10530 else
10531         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10532         val="$undef"
10533 fi
10534 ;;
10535 *) val="$d_attribute_unused" ;;
10536 esac
10537 set d_attribute_unused
10538 eval $setvar
10539 $rm -f attrib*
10540
10541 : Look for GCC-style attribute deprecated
10542 case "$d_attribute_deprecated" in
10543 '')
10544 echo " "
10545 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10546 $cat >attrib.c <<'EOCP'
10547 #include <stdio.h>
10548 int I_am_deprecated(void) __attribute__((deprecated));
10549 EOCP
10550 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10551         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10552                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10553                 val="$undef"
10554         else
10555                 echo "Your C compiler supports __attribute__((deprecated))."
10556                 val="$define"
10557         fi
10558 else
10559         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10560         val="$undef"
10561 fi
10562 ;;
10563 *) val="$d_attribute_deprecated" ;;
10564 esac
10565 set d_attribute_deprecated
10566 eval $setvar
10567 $rm -f attrib*
10568
10569 : Look for GCC-style attribute warn_unused_result
10570 case "$d_attribute_warn_unused_result" in
10571 '')
10572 echo " "
10573 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10574 $cat >attrib.c <<'EOCP'
10575 #include <stdio.h>
10576 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10577 EOCP
10578 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10579         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10580                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10581                 val="$undef"
10582         else
10583                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10584                 val="$define"
10585         fi
10586 else
10587         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10588         val="$undef"
10589 fi
10590 ;;
10591 *) val="$d_attribute_warn_unused_result" ;;
10592 esac
10593 set d_attribute_warn_unused_result
10594 eval $setvar
10595 $rm -f attrib*
10596
10597 : see if bcmp exists
10598 set bcmp d_bcmp
10599 eval $inlibc
10600
10601 : see if bcopy exists
10602 set bcopy d_bcopy
10603 eval $inlibc
10604
10605 : see if getpgrp exists
10606 set getpgrp d_getpgrp
10607 eval $inlibc
10608
10609 case "$d_getpgrp" in
10610 "$define")
10611         echo " "
10612         echo "Checking to see which flavor of getpgrp is in use..."
10613         $cat >try.c <<EOP
10614 #$i_unistd I_UNISTD
10615 #include <sys/types.h>
10616 #ifdef I_UNISTD
10617 #  include <unistd.h>
10618 #endif
10619 #$i_stdlib I_STDLIB
10620 #ifdef I_STDLIB
10621 #include <stdlib.h>
10622 #endif
10623 int main()
10624 {
10625         if (getuid() == 0) {
10626                 printf("(I see you are running Configure as super-user...)\n");
10627                 setuid(1);
10628         }
10629 #ifdef TRY_BSD_PGRP
10630         if (getpgrp(1) == 0)
10631                 exit(0);
10632 #else
10633         if (getpgrp() > 0)
10634                 exit(0);
10635 #endif
10636         exit(1);
10637 }
10638 EOP
10639         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10640                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10641                 val="$define"
10642         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10643                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10644                 val="$undef"
10645         else
10646                 echo "I can't seem to compile and run the test program."
10647                 if ./usg; then
10648                         xxx="a USG one, i.e. you use getpgrp()."
10649                 else
10650                         # SVR4 systems can appear rather BSD-ish.
10651                         case "$i_unistd" in
10652                         $undef)
10653                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10654                                 val="$define"
10655                                 ;;
10656                         $define)
10657                                 xxx="probably a USG one, i.e. you use getpgrp()."
10658                                 val="$undef"
10659                                 ;;
10660                         esac
10661                 fi
10662                 echo "Assuming your getpgrp is $xxx" >&4
10663         fi
10664         ;;
10665 *) val="$undef";;
10666 esac
10667 set d_bsdgetpgrp
10668 eval $setvar
10669 $rm_try
10670
10671 : see if setpgrp exists
10672 set setpgrp d_setpgrp
10673 eval $inlibc
10674
10675 case "$d_setpgrp" in
10676 "$define")
10677         echo " "
10678         echo "Checking to see which flavor of setpgrp is in use..."
10679         $cat >try.c <<EOP
10680 #$i_unistd I_UNISTD
10681 #include <sys/types.h>
10682 #ifdef I_UNISTD
10683 #  include <unistd.h>
10684 #endif
10685 #$i_stdlib I_STDLIB
10686 #ifdef I_STDLIB
10687 #include <stdlib.h>
10688 #endif
10689 int main()
10690 {
10691         if (getuid() == 0) {
10692                 printf("(I see you are running Configure as super-user...)\n");
10693                 setuid(1);
10694         }
10695 #ifdef TRY_BSD_PGRP
10696         if (-1 == setpgrp(1, 1))
10697                 exit(0);
10698 #else
10699         if (setpgrp() != -1)
10700                 exit(0);
10701 #endif
10702         exit(1);
10703 }
10704 EOP
10705         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10706                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10707                 val="$define"
10708         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10709                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10710                 val="$undef"
10711         else
10712                 echo "(I can't seem to compile and run the test program.)"
10713                 if ./usg; then
10714                         xxx="a USG one, i.e. you use setpgrp()."
10715                 else
10716                         # SVR4 systems can appear rather BSD-ish.
10717                         case "$i_unistd" in
10718                         $undef)
10719                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10720                                 val="$define"
10721                                 ;;
10722                         $define)
10723                                 xxx="probably a USG one, i.e. you use setpgrp()."
10724                                 val="$undef"
10725                                 ;;
10726                         esac
10727                 fi
10728                 echo "Assuming your setpgrp is $xxx" >&4
10729         fi
10730         ;;
10731 *) val="$undef";;
10732 esac
10733 set d_bsdsetpgrp
10734 eval $setvar
10735 $rm_try
10736
10737 : Look for GCC-style __builtin_choose_expr
10738 case "$d_builtin_choose_expr" in
10739 '')
10740     echo " "
10741     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10742     $cat >try.c <<'EOCP'
10743 #include <assert.h>
10744 #include <stdlib.h>
10745 #include <stdio.h>
10746
10747 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10748
10749 int main(void) {
10750     assert( SYRINX(1) == 2112 );
10751     assert( SYRINX(1) != 5150 );
10752     assert( SYRINX(0) == 5150 );
10753     assert( SYRINX(0) != 2112 );
10754     puts( "All good!" );
10755     exit(0);
10756 }
10757
10758 EOCP
10759     set try
10760     if eval $compile && $run ./try; then
10761         echo "Your C compiler supports __builtin_choose_expr."
10762         val="$define"
10763     else
10764         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10765         val="$undef"
10766     fi
10767 ;;
10768 *) val="$d_builtin_choose_expr" ;;
10769 esac
10770
10771 set d_builtin_choose_expr
10772 eval $setvar
10773 $rm_try
10774
10775 : Look for GCC-style __builtin_expect
10776 case "$d_builtin_expect" in
10777 '')
10778     echo " "
10779     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10780     $cat >try.c <<'EOCP'
10781 int main(void) {
10782     int n = 50;
10783     if ( __builtin_expect(n, 0) ) n = 1;
10784     /* Remember shell exit code truth is 0, C truth is non-zero */
10785     return !(n == 1);
10786 }
10787 EOCP
10788     set try
10789     if eval $compile && $run ./try; then
10790         echo "Your C compiler supports __builtin_expect."
10791         val="$define"
10792     else
10793         echo "Your C compiler doesn't seem to understand __builtin_expect."
10794         val="$undef"
10795     fi
10796     ;;
10797 *) val="$d_builtin_expect" ;;
10798 esac
10799
10800 set d_builtin_expect
10801 eval $setvar
10802 $rm_try
10803
10804 : see if bzero exists
10805 set bzero d_bzero
10806 eval $inlibc
10807
10808 : see if stdarg is available
10809 echo " "
10810 if $test `./findhdr stdarg.h`; then
10811         echo "<stdarg.h> found." >&4
10812         valstd="$define"
10813 else
10814         echo "<stdarg.h> NOT found." >&4
10815         valstd="$undef"
10816 fi
10817
10818 : see if varags is available
10819 echo " "
10820 if $test `./findhdr varargs.h`; then
10821         echo "<varargs.h> found." >&4
10822 else
10823         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10824 fi
10825
10826 : set up the varargs testing programs
10827 $cat > varargs.c <<EOP
10828 #ifdef I_STDARG
10829 #include <stdarg.h>
10830 #endif
10831 #ifdef I_VARARGS
10832 #include <varargs.h>
10833 #endif
10834
10835 #ifdef I_STDARG
10836 int f(char *p, ...)
10837 #else
10838 int f(va_alist)
10839 va_dcl
10840 #endif
10841 {
10842         va_list ap;
10843 #ifndef I_STDARG
10844         char *p;
10845 #endif
10846 #ifdef I_STDARG
10847         va_start(ap,p);
10848 #else
10849         va_start(ap);
10850         p = va_arg(ap, char *);
10851 #endif
10852         va_end(ap);
10853         return 0;
10854 }
10855 EOP
10856 $cat > varargs <<EOP
10857 $startsh
10858 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10859         echo "true"
10860 else
10861         echo "false"
10862 fi
10863 $rm -f varargs$_o
10864 EOP
10865 chmod +x varargs
10866
10867 : now check which varargs header should be included
10868 echo " "
10869 i_varhdr=''
10870 case "$valstd" in
10871 "$define")
10872         if `./varargs I_STDARG`; then
10873                 val='stdarg.h'
10874         elif `./varargs I_VARARGS`; then
10875                 val='varargs.h'
10876         fi
10877         ;;
10878 *)
10879         if `./varargs I_VARARGS`; then
10880                 val='varargs.h'
10881         fi
10882         ;;
10883 esac
10884 case "$val" in
10885 '')
10886 echo "I could not find the definition for va_dcl... You have problems..." >&4
10887         val="$undef"; set i_stdarg; eval $setvar
10888         val="$undef"; set i_varargs; eval $setvar
10889         ;;
10890 *)
10891         set i_varhdr
10892         eval $setvar
10893         case "$i_varhdr" in
10894         stdarg.h)
10895                 val="$define"; set i_stdarg; eval $setvar
10896                 val="$undef"; set i_varargs; eval $setvar
10897                 ;;
10898         varargs.h)
10899                 val="$undef"; set i_stdarg; eval $setvar
10900                 val="$define"; set i_varargs; eval $setvar
10901                 ;;
10902         esac
10903         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10904 esac
10905 $rm -f varargs*
10906
10907 : see if the Compiler supports C99 variadic macros
10908 case "$i_stdarg$i_stdlib" in
10909     "$define$define")
10910     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10911     $cat >try.c <<EOCP
10912 #include <stdio.h>
10913 #include <stdarg.h>
10914
10915 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10916
10917 int main() {
10918   char buf[20];
10919   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10920   puts(buf);
10921   return 0;
10922 }
10923 EOCP
10924     set try
10925     if eval $compile && $run ./try 2>&1 >/dev/null; then
10926         case "`$run ./try`" in
10927             "123 456 789")
10928             echo "You have C99 variadic macros." >&4
10929             d_c99_variadic_macros="$define"
10930             ;;
10931             *)
10932             echo "You don't have functional C99 variadic macros." >&4
10933             d_c99_variadic_macros="$undef"
10934             ;;
10935         esac
10936     else
10937         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10938         d_c99_variadic_macros="$undef"
10939     fi
10940     $rm_try
10941     ;;
10942     *)
10943     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10944     d_c99_variadic_macros="$undef"
10945     ;;
10946 esac
10947
10948 : see if signal is declared as pointer to function returning int or void
10949 echo " "
10950 xxx=`./findhdr signal.h`
10951 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10952 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10953         echo "You have int (*signal())() instead of void." >&4
10954         val="$undef"
10955 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10956         echo "You have void (*signal())()." >&4
10957         val="$define"
10958 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10959         echo "You have int (*signal())() instead of void." >&4
10960         val="$undef"
10961 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10962         echo "You have void (*signal())()." >&4
10963         val="$define"
10964 else
10965         case "$d_voidsig" in
10966         '')
10967         echo "I can't determine whether signal handler returns void or int..." >&4
10968                 dflt=void
10969                 rp="What type does your signal handler return?"
10970                 . ./myread
10971                 case "$ans" in
10972                 v*) val="$define";;
10973                 *) val="$undef";;
10974                 esac;;
10975         "$define")
10976                 echo "As you already told me, signal handler returns void." >&4
10977                 val="$define"
10978                 ;;
10979         *)      echo "As you already told me, signal handler returns int." >&4
10980                 val="$undef"
10981                 ;;
10982         esac
10983 fi
10984 set d_voidsig
10985 eval $setvar
10986 case "$d_voidsig" in
10987 "$define") signal_t="void";;
10988 *) signal_t="int";;
10989 esac
10990 $rm -f $$.tmp
10991
10992 : check for ability to cast large floats to 32-bit ints.
10993 echo " "
10994 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10995 if $test "$intsize" -ge 4; then
10996         xxx=int
10997 else
10998         xxx=long
10999 fi
11000 $cat >try.c <<EOCP
11001 #include <stdio.h>
11002 #$i_stdlib I_STDLIB
11003 #ifdef I_STDLIB
11004 #include <stdlib.h>
11005 #endif
11006 #include <sys/types.h>
11007 #include <signal.h>
11008 $signal_t blech(int s) { exit(3); }
11009 int main()
11010 {
11011         $xxx i32;
11012         double f, g;
11013         int result = 0;
11014         char str[16];
11015         signal(SIGFPE, blech);
11016
11017         /* Don't let compiler optimize the test away.  Store the number
11018            in a writable string for gcc to pass to sscanf under HP-UX.
11019         */
11020         sprintf(str, "2147483647");
11021         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11022         g = 10 * f;
11023         i32  = ($xxx) g;
11024
11025         /* x86 processors will probably give 0x8000 0000, which is a
11026            sign change.  We don't want that.  We want to mimic SPARC
11027            behavior here, which is to preserve the sign and give
11028            back 0x7fff ffff.
11029         */
11030         if (i32 != ($xxx) f)
11031                 result |= 1;
11032         exit(result);
11033 }
11034 EOCP
11035 set try
11036 if eval $compile_ok; then
11037         $run ./try
11038         yyy=$?
11039 else
11040         echo "(I can't seem to compile the test program--assuming it can't)"
11041         yyy=1
11042 fi
11043 case "$yyy" in
11044 0)      val="$define"
11045         echo "Yup, it can."
11046         ;;
11047 *)      val="$undef"
11048         echo "Nope, it can't."
11049         ;;
11050 esac
11051 set d_casti32
11052 eval $setvar
11053 $rm_try
11054
11055 : check for ability to cast negative floats to unsigned
11056 echo " "
11057 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11058 $cat >try.c <<EOCP
11059 #include <stdio.h>
11060 #$i_stdlib I_STDLIB
11061 #ifdef I_STDLIB
11062 #include <stdlib.h>
11063 #endif
11064 #include <sys/types.h>
11065 #include <signal.h>
11066 $signal_t blech(int s) { exit(7); }
11067 $signal_t blech_in_list(int s) { exit(4); }
11068 unsigned long dummy_long(unsigned long p) { return p; }
11069 unsigned int dummy_int(unsigned int p) { return p; }
11070 unsigned short dummy_short(unsigned short p) { return p; }
11071 int main()
11072 {
11073         double f;
11074         unsigned long along;
11075         unsigned int aint;
11076         unsigned short ashort;
11077         int result = 0;
11078         char str[16];
11079
11080         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11081            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11082            optimized the whole file away
11083         */
11084         /* Store the number in a writable string for gcc to pass to
11085            sscanf under HP-UX.
11086         */
11087         sprintf(str, "-123");
11088         sscanf(str, "%lf", &f);  /* f = -123.; */
11089
11090         signal(SIGFPE, blech);
11091         along = (unsigned long)f;
11092         aint = (unsigned int)f;
11093         ashort = (unsigned short)f;
11094         if (along != (unsigned long)-123)
11095                 result |= 1;
11096         if (aint != (unsigned int)-123)
11097                 result |= 1;
11098         if (ashort != (unsigned short)-123)
11099                 result |= 1;
11100         sprintf(str, "1073741824.");
11101         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11102         f = f + f;
11103         along = 0;
11104         along = (unsigned long)f;
11105         if (along != 0x80000000)
11106                 result |= 2;
11107         f -= 1.;
11108         along = 0;
11109         along = (unsigned long)f;
11110         if (along != 0x7fffffff)
11111                 result |= 1;
11112         f += 2.;
11113         along = 0;
11114         along = (unsigned long)f;
11115         if (along != 0x80000001)
11116                 result |= 2;
11117         if (result)
11118                 exit(result);
11119         signal(SIGFPE, blech_in_list);
11120         sprintf(str, "123.");
11121         sscanf(str, "%lf", &f);  /* f = 123.; */
11122         along = dummy_long((unsigned long)f);
11123         aint = dummy_int((unsigned int)f);
11124         ashort = dummy_short((unsigned short)f);
11125         if (along != (unsigned long)123)
11126                 result |= 4;
11127         if (aint != (unsigned int)123)
11128                 result |= 4;
11129         if (ashort != (unsigned short)123)
11130                 result |= 4;
11131         exit(result);
11132
11133 }
11134 EOCP
11135 set try
11136 if eval $compile_ok; then
11137         $run ./try
11138         castflags=$?
11139 else
11140         echo "(I can't seem to compile the test program--assuming it can't)"
11141         castflags=7
11142 fi
11143 case "$castflags" in
11144 0)      val="$define"
11145         echo "Yup, it can."
11146         ;;
11147 *)      val="$undef"
11148         echo "Nope, it can't."
11149         ;;
11150 esac
11151 set d_castneg
11152 eval $setvar
11153 $rm_try
11154
11155 : see if vprintf exists
11156 echo " "
11157 if set vprintf val -f d_vprintf; eval $csym; $val; then
11158         echo 'vprintf() found.' >&4
11159         val="$define"
11160         $cat >try.c <<EOF
11161 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11162 #$i_varargs I_VARARGS
11163
11164 #$i_stdlib I_STDLIB
11165 #$i_unistd I_UNISTD
11166
11167 #ifdef I_STDARG
11168 #  include <stdarg.h>
11169 #else /* I_VARARGS */
11170 #  include <varargs.h>
11171 #endif
11172
11173 #ifdef I_UNISTD
11174 #  include <unistd.h>
11175 #endif
11176
11177 #ifdef I_STDLIB
11178 #  include <stdlib.h>
11179 #endif
11180
11181 #include <stdio.h> /* vsprintf prototype */
11182
11183 #ifdef I_STDARG
11184 void xxx(int n, ...)
11185 {
11186     va_list args;
11187     char buf[10];
11188     va_start(args, n);
11189     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11190 }
11191 int main() { xxx(1, "foo"); }
11192
11193 #else /* I_VARARGS */
11194
11195 xxx(va_alist)
11196 va_dcl
11197 {
11198     va_list args;
11199     char buf[10];
11200     va_start(args);
11201     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11202 }
11203 int main() { xxx("foo"); }
11204
11205 #endif
11206
11207 EOF
11208         set try
11209         if eval $compile_ok; then
11210                 if $run ./try; then
11211                         echo "Your vsprintf() returns (int)." >&4
11212                         val2="$undef"
11213                 else
11214                         echo "Your vsprintf() returns (char*)." >&4
11215                         val2="$define"
11216                 fi
11217         else
11218                 echo 'I am unable to compile the vsprintf() test program.' >&4
11219                 # We shouldn't get here.  If we do, assume the standard signature,
11220                 # not the old BSD one.
11221                 echo 'Guessing that vsprintf() returns (int).' >&4
11222                 val2="$undef"
11223         fi
11224 else
11225         echo 'vprintf() NOT found.' >&4
11226         val="$undef"
11227         val2="$undef"
11228 fi
11229 $rm_try
11230 set d_vprintf
11231 eval $setvar
11232 val=$val2
11233 set d_charvspr
11234 eval $setvar
11235
11236 : see if chown exists
11237 set chown d_chown
11238 eval $inlibc
11239
11240 : see if chroot exists
11241 set chroot d_chroot
11242 eval $inlibc
11243
11244 : see if chsize exists
11245 set chsize d_chsize
11246 eval $inlibc
11247
11248 : see if class exists
11249 set class d_class
11250 eval $inlibc
11251
11252 : see if clearenv exists
11253 set clearenv d_clearenv
11254 eval $inlibc
11255
11256 : Define hasstruct macro for Configure internal use
11257 hasstruct='varname=$1; struct=$2; shift; shift;
11258 while $test $# -ge 2; do
11259         case "$1" in
11260         $define) echo "#include <$2>";;
11261         esac ;
11262     shift 2;
11263 done > try.c;
11264 echo "int main () { struct $struct foo; }" >> try.c;
11265 set try;
11266 if eval $compile; then
11267         val="$define";
11268 else
11269         val="$undef";
11270 fi;
11271 set $varname;
11272 eval $setvar;
11273 $rm_try'
11274
11275 : see whether socket exists
11276 socketlib=''
11277 sockethdr=''
11278 echo " "
11279 $echo $n "Hmm... $c" >&4
11280 if set socket val -f d_socket; eval $csym; $val; then
11281         echo "Looks like you have Berkeley networking support." >&4
11282         d_socket="$define"
11283         if set setsockopt val -f; eval $csym; $val; then
11284                 d_oldsock="$undef"
11285         else
11286                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11287                 d_oldsock="$define"
11288         fi
11289 else
11290         if $contains socklib libc.list >/dev/null 2>&1; then
11291                 echo "Looks like you have Berkeley networking support." >&4
11292                 d_socket="$define"
11293                 : we will have to assume that it supports the 4.2 BSD interface
11294                 d_oldsock="$undef"
11295         else
11296                 echo "You don't have Berkeley networking in libc$_a..." >&4
11297                 if test "X$d_socket" = "X$define"; then
11298                    echo "...but you seem to believe that you have sockets." >&4
11299                 else
11300                         for net in net socket
11301                         do
11302                                 if test -f /usr/lib/lib$net$_a; then
11303                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11304                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11305                                         if $contains socket libc.list >/dev/null 2>&1; then
11306                                                 d_socket="$define"
11307                                                 socketlib="-l$net"
11308                                                 case "$net" in
11309                                                 net)
11310                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11311                                                         sockethdr="-I/usr/netinclude"
11312                                                         ;;
11313                                                 esac
11314                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11315                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11316                                                         d_oldsock="$undef"
11317                                                 else
11318                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11319                                                         d_oldsock="$define"
11320                                                 fi
11321                                                 break
11322                                         fi
11323                                 fi
11324                         done
11325                         if test "X$d_socket" != "X$define"; then
11326                            echo "or anywhere else I see." >&4
11327                            d_socket="$undef"
11328                            d_oldsock="$undef"
11329                         fi
11330                 fi
11331         fi
11332 fi
11333
11334 : see if socketpair exists
11335 set socketpair d_sockpair
11336 eval $inlibc
11337
11338
11339 echo " "
11340 echo "Checking the availability of certain socket constants..." >&4
11341 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11342         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11343         $cat >try.c <<EOF
11344 #include <sys/types.h>
11345 #include <sys/socket.h>
11346 int main() {
11347     int i = $ENUM;
11348 }
11349 EOF
11350         val="$undef"
11351         set try; if eval $compile; then
11352                 val="$define"
11353         fi
11354         set d_${enum}; eval $setvar
11355         $rm_try
11356 done
11357
11358 : see if this is a sys/uio.h system
11359 set sys/uio.h i_sysuio
11360 eval $inhdr
11361
11362 : Check for cmsghdr support
11363 echo " "
11364 echo "Checking to see if your system supports struct cmsghdr..." >&4
11365 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11366 eval $hasstruct
11367 case "$d_cmsghdr_s" in
11368 "$define")      echo "Yes, it does."   ;;
11369 *)              echo "No, it doesn't." ;;
11370 esac
11371
11372
11373 : check for const keyword
11374 echo " "
11375 echo 'Checking to see if your C compiler knows about "const"...' >&4
11376 $cat >const.c <<'EOCP'
11377 typedef struct spug { int drokk; } spug;
11378 int main()
11379 {
11380         const char *foo;
11381         const spug y = { 0 };
11382 }
11383 EOCP
11384 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11385         val="$define"
11386         echo "Yup, it does."
11387 else
11388         val="$undef"
11389         echo "Nope, it doesn't."
11390 fi
11391 set d_const
11392 eval $setvar
11393
11394 : see if copysignl exists
11395 set copysignl d_copysignl
11396 eval $inlibc
11397
11398 : see if crypt exists
11399 echo " "
11400 set crypt d_crypt
11401 eval $inlibc
11402 case "$d_crypt" in
11403 $define) cryptlib='' ;;
11404 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11405                 echo 'crypt() found.' >&4
11406                 val="$define"
11407                 cryptlib=''
11408         else
11409                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11410                 if $test -z "$cryptlib"; then
11411                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11412                 else
11413                         cryptlib=-lcrypt
11414                 fi
11415                 if $test -z "$cryptlib"; then
11416                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11417                 else
11418                         cryptlib=-lcrypt
11419                 fi
11420                 if $test -z "$cryptlib"; then
11421                         cryptlib=`./loc libcrypt$_a "" $libpth`
11422                 else
11423                         cryptlib=-lcrypt
11424                 fi
11425                 if $test -z "$cryptlib"; then
11426                         echo 'crypt() NOT found.' >&4
11427                         val="$undef"
11428                 else
11429                         val="$define"
11430                 fi
11431         fi
11432         set d_crypt
11433         eval $setvar
11434         ;;
11435 esac
11436
11437 : see if this is a crypt.h system
11438 set crypt.h i_crypt
11439 eval $inhdr
11440
11441 : see if crypt_r exists
11442 set crypt_r d_crypt_r
11443 eval $inlibc
11444 case "$d_crypt_r" in
11445 "$define")
11446         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11447         case "$d_crypt_r_proto:$usethreads" in
11448         ":define")      d_crypt_r_proto=define
11449                 set d_crypt_r_proto crypt_r $hdrs
11450                 eval $hasproto ;;
11451         *)      ;;
11452         esac
11453         case "$d_crypt_r_proto" in
11454         define)
11455         case "$crypt_r_proto" in
11456         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11457         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11458         esac
11459         case "$crypt_r_proto" in
11460         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11461         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11462         esac
11463         case "$crypt_r_proto" in
11464         ''|0)   d_crypt_r=undef
11465                 crypt_r_proto=0
11466                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11467         * )     case "$crypt_r_proto" in
11468                 REENTRANT_PROTO*) ;;
11469                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11470                 esac
11471                 echo "Prototype: $try" ;;
11472         esac
11473         ;;
11474         *)      case "$usethreads" in
11475                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11476                 esac
11477                 d_crypt_r=undef
11478                 crypt_r_proto=0
11479                 ;;
11480         esac
11481         ;;
11482 *)      crypt_r_proto=0
11483         ;;
11484 esac
11485
11486 : get csh whereabouts
11487 case "$csh" in
11488 'csh') val="$undef" ;;
11489 *) val="$define" ;;
11490 esac
11491 set d_csh
11492 eval $setvar
11493 : Respect a hint or command line value for full_csh.
11494 case "$full_csh" in
11495 '') full_csh=$csh ;;
11496 esac
11497
11498 : see if ctermid exists
11499 set ctermid d_ctermid
11500 eval $inlibc
11501
11502 : see if ctermid_r exists
11503 set ctermid_r d_ctermid_r
11504 eval $inlibc
11505 case "$d_ctermid_r" in
11506 "$define")
11507         hdrs="$i_systypes sys/types.h define stdio.h "
11508         case "$d_ctermid_r_proto:$usethreads" in
11509         ":define")      d_ctermid_r_proto=define
11510                 set d_ctermid_r_proto ctermid_r $hdrs
11511                 eval $hasproto ;;
11512         *)      ;;
11513         esac
11514         case "$d_ctermid_r_proto" in
11515         define)
11516         case "$ctermid_r_proto" in
11517         ''|0) try='char* ctermid_r(char*);'
11518         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11519         esac
11520         case "$ctermid_r_proto" in
11521         ''|0)   d_ctermid_r=undef
11522                 ctermid_r_proto=0
11523                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11524         * )     case "$ctermid_r_proto" in
11525                 REENTRANT_PROTO*) ;;
11526                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11527                 esac
11528                 echo "Prototype: $try" ;;
11529         esac
11530         ;;
11531         *)      case "$usethreads" in
11532                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11533                 esac
11534                 d_ctermid_r=undef
11535                 ctermid_r_proto=0
11536                 ;;
11537         esac
11538         ;;
11539 *)      ctermid_r_proto=0
11540         ;;
11541 esac
11542
11543 : see if ctime_r exists
11544 set ctime_r d_ctime_r
11545 eval $inlibc
11546 case "$d_ctime_r" in
11547 "$define")
11548         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11549         case "$d_ctime_r_proto:$usethreads" in
11550         ":define")      d_ctime_r_proto=define
11551                 set d_ctime_r_proto ctime_r $hdrs
11552                 eval $hasproto ;;
11553         *)      ;;
11554         esac
11555         case "$d_ctime_r_proto" in
11556         define)
11557         case "$ctime_r_proto" in
11558         ''|0) try='char* ctime_r(const time_t*, char*);'
11559         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11560         esac
11561         case "$ctime_r_proto" in
11562         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11563         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11564         esac
11565         case "$ctime_r_proto" in
11566         ''|0) try='int ctime_r(const time_t*, char*);'
11567         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11568         esac
11569         case "$ctime_r_proto" in
11570         ''|0) try='int ctime_r(const time_t*, char*, int);'
11571         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11572         esac
11573         case "$ctime_r_proto" in
11574         ''|0)   d_ctime_r=undef
11575                 ctime_r_proto=0
11576                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11577         * )     case "$ctime_r_proto" in
11578                 REENTRANT_PROTO*) ;;
11579                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11580                 esac
11581                 echo "Prototype: $try" ;;
11582         esac
11583         ;;
11584         *)      case "$usethreads" in
11585                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11586                 esac
11587                 d_ctime_r=undef
11588                 ctime_r_proto=0
11589                 ;;
11590         esac
11591         ;;
11592 *)      ctime_r_proto=0
11593         ;;
11594 esac
11595
11596 : see if cuserid exists
11597 set cuserid d_cuserid
11598 eval $inlibc
11599
11600 : see if this is a limits.h system
11601 set limits.h i_limits
11602 eval $inhdr
11603
11604 : see if this is a float.h system
11605 set float.h i_float
11606 eval $inhdr
11607
11608 : See if number of significant digits in a double precision number is known
11609 echo " "
11610 $cat >dbl_dig.c <<EOM
11611 #$i_limits I_LIMITS
11612 #$i_float I_FLOAT
11613 #ifdef I_LIMITS
11614 #include <limits.h>
11615 #endif
11616 #ifdef I_FLOAT
11617 #include <float.h>
11618 #endif
11619 #ifdef DBL_DIG
11620 printf("Contains DBL_DIG");
11621 #endif
11622 EOM
11623 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11624 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11625         echo "DBL_DIG found." >&4
11626         val="$define"
11627 else
11628         echo "DBL_DIG NOT found." >&4
11629         val="$undef"
11630 fi
11631 $rm -f dbl_dig.?
11632 set d_dbl_dig
11633 eval $setvar
11634
11635 : see if dbm.h is available
11636 : see if dbmclose exists
11637 set dbmclose d_dbmclose
11638 eval $inlibc
11639
11640 case "$d_dbmclose" in
11641 $define)
11642         set dbm.h i_dbm
11643         eval $inhdr
11644         case "$i_dbm" in
11645         $define)
11646                 val="$undef"
11647                 set i_rpcsvcdbm
11648                 eval $setvar
11649                 ;;
11650         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11651                 eval $inhdr
11652                 ;;
11653         esac
11654         ;;
11655 *)      echo "We won't be including <dbm.h>"
11656         val="$undef"
11657         set i_dbm
11658         eval $setvar
11659         val="$undef"
11660         set i_rpcsvcdbm
11661         eval $setvar
11662         ;;
11663 esac
11664
11665 : see if prototype for dbminit is available
11666 echo " "
11667 set d_dbminitproto dbminit $i_dbm dbm.h
11668 eval $hasproto
11669
11670 : see if difftime exists
11671 set difftime d_difftime
11672 eval $inlibc
11673
11674 : see if this is a dirent system
11675 echo " "
11676 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11677         val="$define"
11678         echo "<dirent.h> found." >&4
11679 else
11680         val="$undef"
11681         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11682                 echo "<sys/dir.h> found." >&4
11683                 echo " "
11684         else
11685                 xinc=`./findhdr sys/ndir.h`
11686         fi
11687         echo "<dirent.h> NOT found." >&4
11688 fi
11689 set i_dirent
11690 eval $setvar
11691
11692 : Look for type of directory structure.
11693 echo " "
11694 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11695
11696 case "$direntrytype" in
11697 ''|' ')
11698         case "$i_dirent" in
11699         $define) guess1='struct dirent' ;;
11700         *) guess1='struct direct'  ;;
11701         esac
11702         ;;
11703 *)      guess1="$direntrytype"
11704         ;;
11705 esac
11706
11707 case "$guess1" in
11708 'struct dirent') guess2='struct direct' ;;
11709 *) guess2='struct dirent' ;;
11710 esac
11711
11712 if $contains "$guess1" try.c >/dev/null 2>&1; then
11713         direntrytype="$guess1"
11714         echo "Your directory entries are $direntrytype." >&4
11715 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11716         direntrytype="$guess2"
11717         echo "Your directory entries seem to be $direntrytype." >&4
11718 else
11719         echo "I don't recognize your system's directory entries." >&4
11720         rp="What type is used for directory entries on this system?"
11721         dflt="$guess1"
11722         . ./myread
11723         direntrytype="$ans"
11724 fi
11725 $rm_try
11726
11727 : see if the directory entry stores field length
11728 echo " "
11729 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11730 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11731         echo "Good, your directory entry keeps length information in d_namlen." >&4
11732         val="$define"
11733 else
11734         echo "Your directory entry does not know about the d_namlen field." >&4
11735         val="$undef"
11736 fi
11737 set d_dirnamlen
11738 eval $setvar
11739 $rm_try
11740
11741 : Look for DIR.dd_fd
11742 case "$i_dirent" in
11743 "$define")
11744     echo "Checking to see if DIR has a dd_fd member variable" >&4
11745     $cat >try.c <<EOCP
11746 #$i_stdlib I_STDLIB
11747 #ifdef I_STDLIB
11748 #include <stdlib.h>
11749 #endif
11750 #include <dirent.h>
11751
11752 int main() {
11753     DIR dir;
11754     dir.dd_fd = 1;
11755     return 0;
11756 }
11757 EOCP
11758     val=$undef
11759     set try
11760     if eval $compile; then
11761         echo "Yes, it does."
11762         val="$define"
11763     else
11764         echo "No, it does not."
11765         val="$undef"
11766     fi
11767     ;;
11768 *)
11769     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11770     val="$undef"
11771     ;;
11772 esac
11773 set d_dir_dd_fd
11774 eval $setvar
11775 $rm_try
11776
11777 : see if this is an sysdir system
11778 set sys/dir.h i_sysdir
11779 eval $inhdr
11780
11781 : see if this is an sysndir system
11782 set sys/ndir.h i_sysndir
11783 eval $inhdr
11784
11785 : Look for dirfd
11786 echo " "
11787 $cat >dirfd.c <<EOM
11788 #include <stdio.h>
11789 #$i_stdlib I_STDLIB
11790 #ifdef I_STDLIB
11791 #include <stdlib.h>
11792 #endif
11793 #$i_dirent I_DIRENT             /**/
11794 #$i_sysdir I_SYS_DIR            /**/
11795 #$i_sysndir I_SYS_NDIR          /**/
11796 #$i_systypes I_SYS_TYPES        /**/
11797 #if defined(I_SYS_TYPES)
11798 #include <sys/types.h>
11799 #endif
11800 #if defined(I_DIRENT)
11801 #include <dirent.h>
11802 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11803 #include <sys/dir.h>
11804 #endif
11805 #else
11806 #ifdef I_SYS_NDIR
11807 #include <sys/ndir.h>
11808 #else
11809 #ifdef I_SYS_DIR
11810 #ifdef hp9000s500
11811 #include <ndir.h>       /* may be wrong in the future */
11812 #else
11813 #include <sys/dir.h>
11814 #endif
11815 #endif
11816 #endif
11817 #endif 
11818 int main() {
11819         DIR *dirp = opendir(".");
11820         if (dirfd(dirp) >= 0)
11821                 exit(0);
11822         else
11823                 exit(1);
11824 }
11825 EOM
11826 val=$undef
11827 set dirfd
11828 if eval $compile; then
11829         val="$define"
11830 fi
11831 case "$val" in
11832 $define)        echo "dirfd() found." >&4       ;;
11833 *)              echo "dirfd() NOT found." >&4   ;;
11834 esac
11835 set d_dirfd
11836 eval $setvar
11837 $rm -f dirfd*
11838
11839 : see if dlerror exists
11840 xxx_runnm="$runnm"
11841 runnm=false
11842 set dlerror d_dlerror
11843 eval $inlibc
11844 runnm="$xxx_runnm"
11845
11846 : see if dlfcn is available
11847 set dlfcn.h i_dlfcn
11848 eval $inhdr
11849
11850 : Check what extension to use for shared libs
11851 case "$usedl" in
11852 $define|y|true)
11853         $cat << EOM
11854
11855 On a few systems, the dynamically loaded modules that perl generates and uses
11856 will need a different extension than shared libs. The default will probably
11857 be appropriate.
11858
11859 EOM
11860         case "$dlext" in
11861         '')     dflt="$so" ;;
11862         *)      dflt="$dlext" ;;
11863         esac
11864         rp='What is the extension of dynamically loaded modules'
11865         . ./myread
11866         dlext="$ans"
11867         ;;
11868 *)
11869         dlext="none"
11870         ;;
11871 esac
11872
11873 : Check if dlsym need a leading underscore
11874 echo " "
11875 val="$undef"
11876
11877 case "$dlsrc" in
11878 dl_dlopen.xs)
11879         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11880         $cat >dyna.c <<'EOM'
11881 fred () { }
11882 EOM
11883
11884 $cat >fred.c<<EOM
11885
11886 #include <stdio.h>
11887 #$i_stdlib I_STDLIB
11888 #ifdef I_STDLIB
11889 #include <stdlib.h>
11890 #endif
11891 #$i_dlfcn I_DLFCN
11892 #ifdef I_DLFCN
11893 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11894 #else
11895 #include <sys/types.h>
11896 #include <nlist.h>
11897 #include <link.h>
11898 #endif
11899
11900 extern int fred() ;
11901
11902 int main()
11903 {
11904     void * handle ;
11905     void * symbol ;
11906 #ifndef RTLD_LAZY
11907     int mode = 1 ;
11908 #else
11909     int mode = RTLD_LAZY ;
11910 #endif
11911     handle = dlopen("./dyna.$dlext", mode) ;
11912     if (handle == NULL) {
11913         printf ("1\n") ;
11914         fflush (stdout) ;
11915         exit(0);
11916     }
11917     symbol = dlsym(handle, "fred") ;
11918     if (symbol == NULL) {
11919         /* try putting a leading underscore */
11920         symbol = dlsym(handle, "_fred") ;
11921         if (symbol == NULL) {
11922             printf ("2\n") ;
11923             fflush (stdout) ;
11924             exit(0);
11925         }
11926         printf ("3\n") ;
11927     }
11928     else
11929         printf ("4\n") ;
11930     fflush (stdout) ;
11931     exit(0);
11932 }
11933 EOM
11934         : Call the object file tmp-dyna.o in case dlext=o.
11935         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11936                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11937                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11938                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11939                 xxx=`$run ./fred`
11940                 case $xxx in
11941                 1)      echo "Test program failed using dlopen." >&4
11942                         echo "Perhaps you should not use dynamic loading." >&4;;
11943                 2)      echo "Test program failed using dlsym." >&4
11944                         echo "Perhaps you should not use dynamic loading." >&4;;
11945                 3)      echo "dlsym needs a leading underscore" >&4
11946                         val="$define" ;;
11947                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11948                 esac
11949         else
11950                 echo "I can't compile and run the test program." >&4
11951                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11952         fi
11953         ;;
11954 esac
11955
11956 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11957
11958 set d_dlsymun
11959 eval $setvar
11960
11961 : see if drand48_r exists
11962 set drand48_r d_drand48_r
11963 eval $inlibc
11964 case "$d_drand48_r" in
11965 "$define")
11966         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11967         case "$d_drand48_r_proto:$usethreads" in
11968         ":define")      d_drand48_r_proto=define
11969                 set d_drand48_r_proto drand48_r $hdrs
11970                 eval $hasproto ;;
11971         *)      ;;
11972         esac
11973         case "$d_drand48_r_proto" in
11974         define)
11975         case "$drand48_r_proto" in
11976         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11977         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11978         esac
11979         case "$drand48_r_proto" in
11980         ''|0)   d_drand48_r=undef
11981                 drand48_r_proto=0
11982                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11983         * )     case "$drand48_r_proto" in
11984                 REENTRANT_PROTO*) ;;
11985                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11986                 esac
11987                 echo "Prototype: $try" ;;
11988         esac
11989         ;;
11990         *)      case "$usethreads" in
11991                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11992                 esac
11993                 d_drand48_r=undef
11994                 drand48_r_proto=0
11995                 ;;
11996         esac
11997         ;;
11998 *)      drand48_r_proto=0
11999         ;;
12000 esac
12001
12002 : see if prototype for drand48 is available
12003 echo " "
12004 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12005 eval $hasproto
12006
12007 : see if dup2 exists
12008 set dup2 d_dup2
12009 eval $inlibc
12010
12011 : see if eaccess exists
12012 set eaccess d_eaccess
12013 eval $inlibc
12014
12015 : see if endgrent exists
12016 set endgrent d_endgrent
12017 eval $inlibc
12018
12019 : see if this is an grp system
12020 set grp.h i_grp
12021 eval $inhdr
12022
12023 case "$i_grp" in
12024 $define)
12025         xxx=`./findhdr grp.h`
12026         $cppstdin $cppflags $cppminus < $xxx >$$.h
12027
12028         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12029                 val="$define"
12030         else
12031                 val="$undef"
12032         fi
12033         set d_grpasswd
12034         eval $setvar
12035
12036         $rm -f $$.h
12037         ;;
12038 *)
12039         val="$undef";
12040         set d_grpasswd; eval $setvar
12041         ;;
12042 esac
12043
12044 : see if endgrent_r exists
12045 set endgrent_r d_endgrent_r
12046 eval $inlibc
12047 case "$d_endgrent_r" in
12048 "$define")
12049         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12050         case "$d_endgrent_r_proto:$usethreads" in
12051         ":define")      d_endgrent_r_proto=define
12052                 set d_endgrent_r_proto endgrent_r $hdrs
12053                 eval $hasproto ;;
12054         *)      ;;
12055         esac
12056         case "$d_endgrent_r_proto" in
12057         define)
12058         case "$endgrent_r_proto" in
12059         ''|0) try='int endgrent_r(FILE**);'
12060         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12061         esac
12062         case "$endgrent_r_proto" in
12063         ''|0) try='void endgrent_r(FILE**);'
12064         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12065         esac
12066         case "$endgrent_r_proto" in
12067         ''|0)   d_endgrent_r=undef
12068                 endgrent_r_proto=0
12069                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12070         * )     case "$endgrent_r_proto" in
12071                 REENTRANT_PROTO*) ;;
12072                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12073                 esac
12074                 echo "Prototype: $try" ;;
12075         esac
12076         ;;
12077         *)      case "$usethreads" in
12078                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12079                 esac
12080                 d_endgrent_r=undef
12081                 endgrent_r_proto=0
12082                 ;;
12083         esac
12084         ;;
12085 *)      endgrent_r_proto=0
12086         ;;
12087 esac
12088
12089 : see if endhostent exists
12090 set endhostent d_endhent
12091 eval $inlibc
12092
12093 : see if this is a netdb.h system
12094 set netdb.h i_netdb
12095 eval $inhdr
12096
12097 : see if endhostent_r exists
12098 set endhostent_r d_endhostent_r
12099 eval $inlibc
12100 case "$d_endhostent_r" in
12101 "$define")
12102         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12103         case "$d_endhostent_r_proto:$usethreads" in
12104         ":define")      d_endhostent_r_proto=define
12105                 set d_endhostent_r_proto endhostent_r $hdrs
12106                 eval $hasproto ;;
12107         *)      ;;
12108         esac
12109         case "$d_endhostent_r_proto" in
12110         define)
12111         case "$endhostent_r_proto" in
12112         ''|0) try='int endhostent_r(struct hostent_data*);'
12113         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12114         esac
12115         case "$endhostent_r_proto" in
12116         ''|0) try='void endhostent_r(struct hostent_data*);'
12117         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12118         esac
12119         case "$endhostent_r_proto" in
12120         ''|0)   d_endhostent_r=undef
12121                 endhostent_r_proto=0
12122                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12123         * )     case "$endhostent_r_proto" in
12124                 REENTRANT_PROTO*) ;;
12125                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12126                 esac
12127                 echo "Prototype: $try" ;;
12128         esac
12129         ;;
12130         *)      case "$usethreads" in
12131                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12132                 esac
12133                 d_endhostent_r=undef
12134                 endhostent_r_proto=0
12135                 ;;
12136         esac
12137         ;;
12138 *)      endhostent_r_proto=0
12139         ;;
12140 esac
12141
12142 : see if endnetent exists
12143 set endnetent d_endnent
12144 eval $inlibc
12145
12146 : see if endnetent_r exists
12147 set endnetent_r d_endnetent_r
12148 eval $inlibc
12149 case "$d_endnetent_r" in
12150 "$define")
12151         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12152         case "$d_endnetent_r_proto:$usethreads" in
12153         ":define")      d_endnetent_r_proto=define
12154                 set d_endnetent_r_proto endnetent_r $hdrs
12155                 eval $hasproto ;;
12156         *)      ;;
12157         esac
12158         case "$d_endnetent_r_proto" in
12159         define)
12160         case "$endnetent_r_proto" in
12161         ''|0) try='int endnetent_r(struct netent_data*);'
12162         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12163         esac
12164         case "$endnetent_r_proto" in
12165         ''|0) try='void endnetent_r(struct netent_data*);'
12166         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12167         esac
12168         case "$endnetent_r_proto" in
12169         ''|0)   d_endnetent_r=undef
12170                 endnetent_r_proto=0
12171                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12172         * )     case "$endnetent_r_proto" in
12173                 REENTRANT_PROTO*) ;;
12174                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12175                 esac
12176                 echo "Prototype: $try" ;;
12177         esac
12178         ;;
12179         *)      case "$usethreads" in
12180                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12181                 esac
12182                 d_endnetent_r=undef
12183                 endnetent_r_proto=0
12184                 ;;
12185         esac
12186         ;;
12187 *)      endnetent_r_proto=0
12188         ;;
12189 esac
12190
12191 : see if endprotoent exists
12192 set endprotoent d_endpent
12193 eval $inlibc
12194
12195 : see if endprotoent_r exists
12196 set endprotoent_r d_endprotoent_r
12197 eval $inlibc
12198 case "$d_endprotoent_r" in
12199 "$define")
12200         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12201         case "$d_endprotoent_r_proto:$usethreads" in
12202         ":define")      d_endprotoent_r_proto=define
12203                 set d_endprotoent_r_proto endprotoent_r $hdrs
12204                 eval $hasproto ;;
12205         *)      ;;
12206         esac
12207         case "$d_endprotoent_r_proto" in
12208         define)
12209         case "$endprotoent_r_proto" in
12210         ''|0) try='int endprotoent_r(struct protoent_data*);'
12211         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12212         esac
12213         case "$endprotoent_r_proto" in
12214         ''|0) try='void endprotoent_r(struct protoent_data*);'
12215         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12216         esac
12217         case "$endprotoent_r_proto" in
12218         ''|0)   d_endprotoent_r=undef
12219                 endprotoent_r_proto=0
12220                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12221         * )     case "$endprotoent_r_proto" in
12222                 REENTRANT_PROTO*) ;;
12223                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12224                 esac
12225                 echo "Prototype: $try" ;;
12226         esac
12227         ;;
12228         *)      case "$usethreads" in
12229                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12230                 esac
12231                 d_endprotoent_r=undef
12232                 endprotoent_r_proto=0
12233                 ;;
12234         esac
12235         ;;
12236 *)      endprotoent_r_proto=0
12237         ;;
12238 esac
12239
12240 : see if endpwent exists
12241 set endpwent d_endpwent
12242 eval $inlibc
12243
12244 : see if this is a pwd.h system
12245 set pwd.h i_pwd
12246 eval $inhdr
12247
12248 case "$i_pwd" in
12249 $define)
12250         xxx=`./findhdr pwd.h`
12251         $cppstdin $cppflags $cppminus < $xxx >$$.h
12252
12253         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12254                 val="$define"
12255         else
12256                 val="$undef"
12257         fi
12258         set d_pwquota
12259         eval $setvar
12260
12261         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12262                 val="$define"
12263         else
12264                 val="$undef"
12265         fi
12266         set d_pwage
12267         eval $setvar
12268
12269         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12270                 val="$define"
12271         else
12272                 val="$undef"
12273         fi
12274         set d_pwchange
12275         eval $setvar
12276
12277         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12278                 val="$define"
12279         else
12280                 val="$undef"
12281         fi
12282         set d_pwclass
12283         eval $setvar
12284
12285         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12286                 val="$define"
12287         else
12288                 val="$undef"
12289         fi
12290         set d_pwexpire
12291         eval $setvar
12292
12293         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12294                 val="$define"
12295         else
12296                 val="$undef"
12297         fi
12298         set d_pwcomment
12299         eval $setvar
12300
12301         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12302                 val="$define"
12303         else
12304                 val="$undef"
12305         fi
12306         set d_pwgecos
12307         eval $setvar
12308
12309         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12310                 val="$define"
12311         else
12312                 val="$undef"
12313         fi
12314         set d_pwpasswd
12315         eval $setvar
12316
12317         $rm -f $$.h
12318         ;;
12319 *)
12320         val="$undef"; 
12321         set d_pwquota; eval $setvar
12322         set d_pwage; eval $setvar
12323         set d_pwchange; eval $setvar
12324         set d_pwclass; eval $setvar
12325         set d_pwexpire; eval $setvar
12326         set d_pwcomment; eval $setvar
12327         set d_pwgecos; eval $setvar
12328         set d_pwpasswd; eval $setvar
12329         ;;
12330 esac
12331
12332 : see if endpwent_r exists
12333 set endpwent_r d_endpwent_r
12334 eval $inlibc
12335 case "$d_endpwent_r" in
12336 "$define")
12337         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12338         case "$d_endpwent_r_proto:$usethreads" in
12339         ":define")      d_endpwent_r_proto=define
12340                 set d_endpwent_r_proto endpwent_r $hdrs
12341                 eval $hasproto ;;
12342         *)      ;;
12343         esac
12344         case "$d_endpwent_r_proto" in
12345         define)
12346         case "$endpwent_r_proto" in
12347         ''|0) try='int endpwent_r(FILE**);'
12348         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12349         esac
12350         case "$endpwent_r_proto" in
12351         ''|0) try='void endpwent_r(FILE**);'
12352         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12353         esac
12354         case "$endpwent_r_proto" in
12355         ''|0)   d_endpwent_r=undef
12356                 endpwent_r_proto=0
12357                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12358         * )     case "$endpwent_r_proto" in
12359                 REENTRANT_PROTO*) ;;
12360                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12361                 esac
12362                 echo "Prototype: $try" ;;
12363         esac
12364         ;;
12365         *)      case "$usethreads" in
12366                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12367                 esac
12368                 d_endpwent_r=undef
12369                 endpwent_r_proto=0
12370                 ;;
12371         esac
12372         ;;
12373 *)      endpwent_r_proto=0
12374         ;;
12375 esac
12376
12377 : see if endservent exists
12378 set endservent d_endsent
12379 eval $inlibc
12380
12381 : see if endservent_r exists
12382 set endservent_r d_endservent_r
12383 eval $inlibc
12384 case "$d_endservent_r" in
12385 "$define")
12386         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12387         case "$d_endservent_r_proto:$usethreads" in
12388         ":define")      d_endservent_r_proto=define
12389                 set d_endservent_r_proto endservent_r $hdrs
12390                 eval $hasproto ;;
12391         *)      ;;
12392         esac
12393         case "$d_endservent_r_proto" in
12394         define)
12395         case "$endservent_r_proto" in
12396         ''|0) try='int endservent_r(struct servent_data*);'
12397         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12398         esac
12399         case "$endservent_r_proto" in
12400         ''|0) try='void endservent_r(struct servent_data*);'
12401         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12402         esac
12403         case "$endservent_r_proto" in
12404         ''|0)   d_endservent_r=undef
12405                 endservent_r_proto=0
12406                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12407         * )     case "$endservent_r_proto" in
12408                 REENTRANT_PROTO*) ;;
12409                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12410                 esac
12411                 echo "Prototype: $try" ;;
12412         esac
12413         ;;
12414         *)      case "$usethreads" in
12415                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12416                 esac
12417                 d_endservent_r=undef
12418                 endservent_r_proto=0
12419                 ;;
12420         esac
12421         ;;
12422 *)      endservent_r_proto=0
12423         ;;
12424 esac
12425
12426 : Locate the flags for 'open()'
12427 echo " "
12428 $cat >try.c <<EOCP
12429 #include <sys/types.h>
12430 #ifdef I_FCNTL
12431 #include <fcntl.h>
12432 #endif
12433 #ifdef I_SYS_FILE
12434 #include <sys/file.h>
12435 #endif
12436 #$i_stdlib I_STDLIB
12437 #ifdef I_STDLIB
12438 #include <stdlib.h>
12439 #endif
12440 int main() {
12441         if(O_RDONLY);
12442 #ifdef O_TRUNC
12443         exit(0);
12444 #else
12445         exit(1);
12446 #endif
12447 }
12448 EOCP
12449 : check sys/file.h first to get FREAD on Sun
12450 if $test `./findhdr sys/file.h` && \
12451                 set try -DI_SYS_FILE && eval $compile; then
12452         h_sysfile=true;
12453         echo "<sys/file.h> defines the O_* constants..." >&4
12454         if $run ./try; then
12455                 echo "and you have the 3 argument form of open()." >&4
12456                 val="$define"
12457         else
12458                 echo "but not the 3 argument form of open().  Oh, well." >&4
12459                 val="$undef"
12460         fi
12461 elif $test `./findhdr fcntl.h` && \
12462                 set try -DI_FCNTL && eval $compile; then
12463         h_fcntl=true;
12464         echo "<fcntl.h> defines the O_* constants..." >&4
12465         if $run ./try; then
12466                 echo "and you have the 3 argument form of open()." >&4
12467                 val="$define"
12468         else
12469                 echo "but not the 3 argument form of open().  Oh, well." >&4
12470                 val="$undef"
12471         fi
12472 else
12473         val="$undef"
12474         echo "I can't find the O_* constant definitions!  You got problems." >&4
12475 fi
12476 set d_open3
12477 eval $setvar
12478 $rm_try
12479
12480 : see if this is a sys/file.h system
12481 val=''
12482 set sys/file.h val
12483 eval $inhdr
12484
12485 : do we need to include sys/file.h ?
12486 case "$val" in
12487 "$define")
12488         echo " "
12489         if $h_sysfile; then
12490                 val="$define"
12491                 echo "We'll be including <sys/file.h>." >&4
12492         else
12493                 val="$undef"
12494                 echo "We won't be including <sys/file.h>." >&4
12495         fi
12496         ;;
12497 *)
12498         h_sysfile=false
12499         ;;
12500 esac
12501 set i_sysfile
12502 eval $setvar
12503
12504 : see if fcntl.h is there
12505 val=''
12506 set fcntl.h val
12507 eval $inhdr
12508
12509 : see if we can include fcntl.h
12510 case "$val" in
12511 "$define")
12512         echo " "
12513         if $h_fcntl; then
12514                 val="$define"
12515                 echo "We'll be including <fcntl.h>." >&4
12516         else
12517                 val="$undef"
12518                 if $h_sysfile; then
12519         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12520                 else
12521                         echo "We won't be including <fcntl.h>." >&4
12522                 fi
12523         fi
12524         ;;
12525 *)
12526         h_fcntl=false
12527         val="$undef"
12528         ;;
12529 esac
12530 set i_fcntl
12531 eval $setvar
12532
12533 : see if fork exists
12534 set fork d_fork
12535 eval $inlibc
12536
12537 : see if pipe exists
12538 set pipe d_pipe
12539 eval $inlibc
12540
12541 : check for non-blocking I/O stuff
12542 case "$h_sysfile" in
12543 true) echo "#include <sys/file.h>" > head.c;;
12544 *)
12545        case "$h_fcntl" in
12546        true) echo "#include <fcntl.h>" > head.c;;
12547        *) echo "#include <sys/fcntl.h>" > head.c;;
12548        esac
12549        ;;
12550 esac
12551 echo " "
12552 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12553 case "$o_nonblock" in
12554 '')
12555         $cat head.c > try.c
12556         $cat >>try.c <<EOCP
12557 #include <stdio.h>
12558 #$i_stdlib I_STDLIB
12559 #ifdef I_STDLIB
12560 #include <stdlib.h>
12561 #endif
12562 #$i_fcntl I_FCNTL
12563 #ifdef I_FCNTL
12564 #include <fcntl.h>
12565 #endif
12566 int main() {
12567 #ifdef O_NONBLOCK
12568         printf("O_NONBLOCK\n");
12569         exit(0);
12570 #endif
12571 #ifdef O_NDELAY
12572         printf("O_NDELAY\n");
12573         exit(0);
12574 #endif
12575 #ifdef FNDELAY
12576         printf("FNDELAY\n");
12577         exit(0);
12578 #endif
12579         exit(0);
12580 }
12581 EOCP
12582         set try
12583         if eval $compile_ok; then
12584                 o_nonblock=`$run ./try`
12585                 case "$o_nonblock" in
12586                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12587                 *) echo "Seems like we can use $o_nonblock.";;
12588                 esac
12589         else
12590                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12591         fi
12592         ;;
12593 *) echo "Using $hint value $o_nonblock.";;
12594 esac
12595 $rm_try
12596
12597 echo " "
12598 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12599 case "$eagain" in
12600 '')
12601         case "$d_fork:$d_pipe" in
12602         define:define)
12603         $cat head.c > try.c
12604         $cat >>try.c <<EOCP
12605 #include <errno.h>
12606 #include <sys/types.h>
12607 #include <signal.h>
12608 #include <stdio.h>
12609 #$i_stdlib I_STDLIB
12610 #ifdef I_STDLIB
12611 #include <stdlib.h>
12612 #endif
12613 #$i_fcntl I_FCNTL
12614 #ifdef I_FCNTL
12615 #include <fcntl.h>
12616 #endif
12617 #define MY_O_NONBLOCK $o_nonblock
12618 #ifndef errno  /* XXX need better Configure test */
12619 extern int errno;
12620 #endif
12621 #$i_unistd I_UNISTD
12622 #ifdef I_UNISTD
12623 #include <unistd.h>
12624 #endif
12625 #$i_string I_STRING
12626 #ifdef I_STRING
12627 #include <string.h>
12628 #else
12629 #include <strings.h>
12630 #endif
12631 $signal_t blech(int x) { exit(3); }
12632 EOCP
12633         $cat >> try.c <<'EOCP'
12634 int main()
12635 {
12636         int pd[2];
12637         int pu[2];
12638         char buf[1];
12639         char string[100];
12640
12641         pipe(pd);       /* Down: child -> parent */
12642         pipe(pu);       /* Up: parent -> child */
12643         if (0 != fork()) {
12644                 int ret;
12645                 close(pd[1]);   /* Parent reads from pd[0] */
12646                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12647 #ifdef F_SETFL
12648                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12649                         exit(1);
12650 #else
12651                 exit(4);
12652 #endif
12653                 signal(SIGALRM, blech);
12654                 alarm(5);
12655                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12656                         exit(2);
12657                 sprintf(string, "%d\n", ret);
12658                 write(2, string, strlen(string));
12659                 alarm(0);
12660 #ifdef EAGAIN
12661                 if (errno == EAGAIN) {
12662                         printf("EAGAIN\n");
12663                         goto ok;
12664                 }
12665 #endif
12666 #ifdef EWOULDBLOCK
12667                 if (errno == EWOULDBLOCK)
12668                         printf("EWOULDBLOCK\n");
12669 #endif
12670         ok:
12671                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12672                 sleep(2);                               /* Give it time to close our pipe */
12673                 alarm(5);
12674                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12675                 alarm(0);
12676                 sprintf(string, "%d\n", ret);
12677                 write(4, string, strlen(string));
12678                 exit(0);
12679         }
12680
12681         close(pd[0]);                   /* We write to pd[1] */
12682         close(pu[1]);                   /* We read from pu[0] */
12683         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12684         close(pd[1]);                   /* Pipe pd is now fully closed! */
12685         exit(0);                                /* Bye bye, thank you for playing! */
12686 }
12687 EOCP
12688         set try
12689         if eval $compile_ok; then
12690                 echo "$startsh" >mtry
12691                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12692                 chmod +x mtry
12693                 ./mtry >/dev/null 2>&1
12694                 case $? in
12695                 0) eagain=`$cat try.out`;;
12696                 1) echo "Could not perform non-blocking setting!";;
12697                 2) echo "I did a successful read() for something that was not there!";;
12698                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12699                 4) echo "Could not find F_SETFL!";;
12700                 *) echo "Something terribly wrong happened during testing.";;
12701                 esac
12702                 rd_nodata=`$cat try.ret`
12703                 echo "A read() system call with no data present returns $rd_nodata."
12704                 case "$rd_nodata" in
12705                 0|-1) ;;
12706                 *)
12707                         echo "(That's peculiar, fixing that to be -1.)"
12708                         rd_nodata=-1
12709                         ;;
12710                 esac
12711                 case "$eagain" in
12712                 '')
12713                         echo "Forcing errno EAGAIN on read() with no data available."
12714                         eagain=EAGAIN
12715                         ;;
12716                 *)
12717                         echo "Your read() sets errno to $eagain when no data is available."
12718                         ;;
12719                 esac
12720                 status=`$cat try.err`
12721                 case "$status" in
12722                 0) echo "And it correctly returns 0 to signal EOF.";;
12723                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12724                 *) echo "However, your read() returns '$status' on EOF??";;
12725                 esac
12726                 val="$define"
12727                 if test "$status" = "$rd_nodata"; then
12728                         echo "WARNING: you can't distinguish between EOF and no data!"
12729                         val="$undef"
12730                 fi
12731         else
12732                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12733                 eagain=EAGAIN
12734         fi
12735         ;;
12736         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12737                 eagain=EAGAIN
12738                 val="$define"
12739                 ;;
12740         esac
12741         set d_eofnblk
12742         eval $setvar
12743         ;;
12744 *)
12745         echo "Using $hint value $eagain."
12746         echo "Your read() returns $rd_nodata when no data is present."
12747         case "$d_eofnblk" in
12748         "$define") echo "And you can see EOF because read() returns 0.";;
12749         "$undef") echo "But you can't see EOF status from read() returned value.";;
12750         *)
12751                 echo "(Assuming you can't see EOF status from read anyway.)"
12752                 d_eofnblk=$undef
12753                 ;;
12754         esac
12755         ;;
12756 esac
12757 $rm_try head.c mtry
12758
12759 : see if _ptr and _cnt from stdio act std
12760 echo " "
12761
12762 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12763         echo "(Looks like you have stdio.h from BSD.)"
12764         case "$stdio_ptr" in
12765         '') stdio_ptr='((fp)->_p)'
12766                 ptr_lval=$define
12767                 ;;
12768         *)      ptr_lval=$d_stdio_ptr_lval;;
12769         esac
12770         case "$stdio_cnt" in
12771         '') stdio_cnt='((fp)->_r)'
12772                 cnt_lval=$define
12773                 ;;
12774         *)      cnt_lval=$d_stdio_cnt_lval;;
12775         esac
12776         case "$stdio_base" in
12777         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12778         esac
12779         case "$stdio_bufsiz" in
12780         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12781         esac
12782 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12783         echo "(Looks like you have stdio.h from Linux.)"
12784         case "$stdio_ptr" in
12785         '') stdio_ptr='((fp)->_IO_read_ptr)'
12786                 ptr_lval=$define
12787                 ;;
12788         *)      ptr_lval=$d_stdio_ptr_lval;;
12789         esac
12790         case "$stdio_cnt" in
12791         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12792                 cnt_lval=$undef
12793                 ;;
12794         *)      cnt_lval=$d_stdio_cnt_lval;;
12795         esac
12796         case "$stdio_base" in
12797         '') stdio_base='((fp)->_IO_read_base)';;
12798         esac
12799         case "$stdio_bufsiz" in
12800         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12801         esac
12802 else
12803         case "$stdio_ptr" in
12804         '') stdio_ptr='((fp)->_ptr)'
12805                 ptr_lval=$define
12806                 ;;
12807         *)      ptr_lval=$d_stdio_ptr_lval;;
12808         esac
12809         case "$stdio_cnt" in
12810         '') stdio_cnt='((fp)->_cnt)'
12811                 cnt_lval=$define
12812                 ;;
12813         *)      cnt_lval=$d_stdio_cnt_lval;;
12814         esac
12815         case "$stdio_base" in
12816         '') stdio_base='((fp)->_base)';;
12817         esac
12818         case "$stdio_bufsiz" in
12819         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12820         esac
12821 fi
12822
12823 : test whether _ptr and _cnt really work
12824 echo "Checking how std your stdio is..." >&4
12825 $cat >try.c <<EOP
12826 #include <stdio.h>
12827 #$i_stdlib I_STDLIB
12828 #ifdef I_STDLIB
12829 #include <stdlib.h>
12830 #endif
12831 #define FILE_ptr(fp)    $stdio_ptr
12832 #define FILE_cnt(fp)    $stdio_cnt
12833 int main() {
12834         FILE *fp = fopen("try.c", "r");
12835         char c = getc(fp);
12836         if (
12837                 18 <= FILE_cnt(fp) &&
12838                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12839         )
12840                 exit(0);
12841         exit(1);
12842 }
12843 EOP
12844 val="$undef"
12845 set try
12846 if eval $compile && $to try.c; then
12847         if $run ./try; then
12848                 echo "Your stdio acts pretty std."
12849                 val="$define"
12850         else
12851                 echo "Your stdio isn't very std."
12852         fi
12853 else
12854         echo "Your stdio doesn't appear very std."
12855 fi
12856 $rm_try
12857
12858 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12859 # direct buffer manipulation no longer works.  The Configure tests
12860 # should be changed to correctly detect this, but until then,
12861 # the following check should at least let perl compile and run.
12862 # (This quick fix should be updated before 5.8.1.)
12863 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12864 # A. Dougherty, June 3, 2002.
12865 case "$d_gnulibc" in
12866 $define)
12867         case "$gnulibc_version" in
12868         2.[01]*)  ;;
12869         2.2) ;;
12870         2.2.[0-9]) ;;
12871         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12872                 val="$undef"
12873                 ;;
12874         esac
12875         ;;
12876 esac
12877 set d_stdstdio
12878 eval $setvar
12879
12880 : Can _ptr be used as an lvalue?
12881 case "$d_stdstdio$ptr_lval" in
12882 $define$define) val=$define ;;
12883 *) val=$undef ;;
12884 esac
12885 set d_stdio_ptr_lval
12886 eval $setvar
12887
12888 : Can _cnt be used as an lvalue?
12889 case "$d_stdstdio$cnt_lval" in
12890 $define$define) val=$define ;;
12891 *) val=$undef ;;
12892 esac
12893 set d_stdio_cnt_lval
12894 eval $setvar
12895
12896
12897 : test whether setting _ptr sets _cnt as a side effect
12898 d_stdio_ptr_lval_sets_cnt="$undef"
12899 d_stdio_ptr_lval_nochange_cnt="$undef"
12900 case "$d_stdio_ptr_lval$d_stdstdio" in
12901 $define$define)
12902         echo "Checking to see what happens if we set the stdio ptr..." >&4
12903 $cat >try.c <<EOP
12904 #include <stdio.h>
12905 /* Can we scream? */
12906 /* Eat dust sed :-) */
12907 /* In the buffer space, no one can hear you scream. */
12908 #$i_stdlib I_STDLIB
12909 #ifdef I_STDLIB
12910 #include <stdlib.h>
12911 #endif
12912 #define FILE_ptr(fp)    $stdio_ptr
12913 #define FILE_cnt(fp)    $stdio_cnt
12914 #include <sys/types.h>
12915 int main() {
12916         FILE *fp = fopen("try.c", "r");
12917         int c;
12918         char *ptr;
12919         size_t cnt;
12920         if (!fp) {
12921             puts("Fail even to read");
12922             exit(1);
12923         }
12924         c = getc(fp); /* Read away the first # */
12925         if (c == EOF) {
12926             puts("Fail even to read");
12927             exit(1);
12928         }
12929         if (!(
12930                 18 <= FILE_cnt(fp) &&
12931                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12932         )) {
12933                 puts("Fail even to read");
12934                 exit (1);
12935         }
12936         ptr = (char*) FILE_ptr(fp);
12937         cnt = (size_t)FILE_cnt(fp);
12938
12939         FILE_ptr(fp) += 42;
12940
12941         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12942                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12943                 exit (1);
12944         }
12945         if (FILE_cnt(fp) <= 20) {
12946                 printf ("Fail (<20 chars to test)");
12947                 exit (1);
12948         }
12949         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12950                 puts("Fail compare");
12951                 exit (1);
12952         }
12953         if (cnt == FILE_cnt(fp)) {
12954                 puts("Pass_unchanged");
12955                 exit (0);
12956         }
12957         if (FILE_cnt(fp) == (cnt - 42)) {
12958                 puts("Pass_changed");
12959                 exit (0);
12960         }
12961         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12962         return 1;
12963
12964 }
12965 EOP
12966         set try
12967         if eval $compile && $to try.c; then
12968                 case `$run ./try` in
12969                 Pass_changed)
12970                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12971                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12972                 Pass_unchanged)
12973                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12974                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12975                 Fail*)
12976                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12977                 *)
12978                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12979         esac
12980         else
12981                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12982         fi
12983         $rm_try
12984         ;;
12985 esac
12986
12987 : see if _base is also standard
12988 val="$undef"
12989 case "$d_stdstdio" in
12990 $define)
12991         $cat >try.c <<EOP
12992 #include <stdio.h>
12993 #$i_stdlib I_STDLIB
12994 #ifdef I_STDLIB
12995 #include <stdlib.h>
12996 #endif
12997 #define FILE_base(fp)   $stdio_base
12998 #define FILE_bufsiz(fp) $stdio_bufsiz
12999 int main() {
13000         FILE *fp = fopen("try.c", "r");
13001         char c = getc(fp);
13002         if (
13003                 19 <= FILE_bufsiz(fp) &&
13004                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13005         )
13006                 exit(0);
13007         exit(1);
13008 }
13009 EOP
13010         set try
13011         if eval $compile && $to try.c; then
13012                 if $run ./try; then
13013                         echo "And its _base field acts std."
13014                         val="$define"
13015                 else
13016                         echo "But its _base field isn't std."
13017                 fi
13018         else
13019                 echo "However, it seems to be lacking the _base field."
13020         fi
13021         $rm_try
13022         ;;
13023 esac
13024 set d_stdiobase
13025 eval $setvar
13026
13027 : see if fast_stdio exists
13028 val="$undef"
13029 case "$d_stdstdio:$d_stdio_ptr_lval" in
13030 "$define:$define")
13031         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13032         *$define*)
13033                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13034                 val="$define"
13035                 ;;
13036         esac
13037         ;;
13038 esac
13039 set d_faststdio
13040 eval $setvar
13041
13042
13043
13044 : see if fchdir exists
13045 set fchdir d_fchdir
13046 eval $inlibc
13047
13048 : see if fchmod exists
13049 set fchmod d_fchmod
13050 eval $inlibc
13051
13052 : see if fchown exists
13053 set fchown d_fchown
13054 eval $inlibc
13055
13056 : see if this is an fcntl system
13057 set fcntl d_fcntl
13058 eval $inlibc
13059
13060 : See if fcntl-based locking works.
13061 echo " "
13062 $cat >try.c <<EOCP
13063 #$i_stdlib I_STDLIB
13064 #ifdef I_STDLIB
13065 #include <stdlib.h>
13066 #endif
13067 #include <unistd.h>
13068 #include <fcntl.h>
13069 #include <signal.h>
13070 $signal_t blech(int x) { exit(3); }
13071 int main() {
13072 #if defined(F_SETLK) && defined(F_SETLKW)
13073      struct flock flock;
13074      int retval, fd;
13075      fd = open("try.c", O_RDONLY);
13076      flock.l_type = F_RDLCK;
13077      flock.l_whence = SEEK_SET;
13078      flock.l_start = flock.l_len = 0;
13079      signal(SIGALRM, blech);
13080      alarm(10);
13081      retval = fcntl(fd, F_SETLK, &flock);
13082      close(fd);
13083      (retval < 0 ? exit(2) : exit(0));
13084 #else
13085      exit(2);
13086 #endif
13087 }
13088 EOCP
13089 echo "Checking if fcntl-based file locking works... "
13090 case "$d_fcntl" in
13091 "$define")
13092         set try
13093         if eval $compile_ok; then
13094                 if $run ./try; then
13095                         echo "Yes, it seems to work."
13096                         val="$define"
13097                 else
13098                         echo "Nope, it didn't work."
13099                         val="$undef"
13100                         case "$?" in
13101                         3) $cat >&4 <<EOM
13102 ***
13103 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13104 *** This is (almost) impossible.
13105 *** If your NFS lock daemons are not feeling well, something like
13106 *** this may happen, please investigate.  Cannot continue, aborting.
13107 ***
13108 EOM
13109                                 exit 1
13110                                 ;;
13111                         esac
13112                 fi
13113         else
13114                 echo "I'm unable to compile the test program, so I'll assume not."
13115                 val="$undef"
13116         fi
13117         ;;
13118 *) val="$undef";
13119         echo "Nope, since you don't even have fcntl()."
13120         ;;
13121 esac
13122 set d_fcntl_can_lock
13123 eval $setvar
13124 $rm_try
13125
13126 : check for fd_set items
13127 $cat <<EOM
13128
13129 Checking to see how well your C compiler handles fd_set and friends ...
13130 EOM
13131 $cat >try.c <<EOCP
13132 #$i_stdlib I_STDLIB
13133 #ifdef I_STDLIB
13134 #include <stdlib.h>
13135 #endif
13136 #$i_systime I_SYS_TIME
13137 #$i_sysselct I_SYS_SELECT
13138 #$d_socket HAS_SOCKET
13139 #include <sys/types.h>
13140 #ifdef HAS_SOCKET
13141 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13142 #endif
13143 #ifdef I_SYS_TIME
13144 #include <sys/time.h>
13145 #endif
13146 #ifdef I_SYS_SELECT
13147 #include <sys/select.h>
13148 #endif
13149 int main() {
13150         fd_set fds;
13151
13152 #ifdef TRYBITS
13153         if(fds.fds_bits);
13154 #endif
13155
13156 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13157         exit(0);
13158 #else
13159         exit(1);
13160 #endif
13161 }
13162 EOCP
13163 set try -DTRYBITS
13164 if eval $compile; then
13165         d_fds_bits="$define"
13166         d_fd_set="$define"
13167         echo "Well, your system knows about the normal fd_set typedef..." >&4
13168         if $run ./try; then
13169                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13170                 d_fd_macros="$define"
13171         else
13172                 $cat >&4 <<'EOM'
13173 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13174 EOM
13175                 d_fd_macros="$undef"
13176         fi
13177 else
13178         $cat <<'EOM'
13179 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13180 EOM
13181         set try
13182         if eval $compile; then
13183                 d_fds_bits="$undef"
13184                 d_fd_set="$define"
13185                 echo "Well, your system has some sort of fd_set available..." >&4
13186                 if $run ./try; then
13187                         echo "and you have the normal fd_set macros." >&4
13188                         d_fd_macros="$define"
13189                 else
13190                         $cat <<'EOM'
13191 but not the normal fd_set macros!  Gross!  More work for me...
13192 EOM
13193                         d_fd_macros="$undef"
13194                 fi
13195         else
13196         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13197                 d_fd_set="$undef"
13198                 d_fds_bits="$undef"
13199                 d_fd_macros="$undef"
13200         fi
13201 fi
13202 $rm_try
13203
13204 : see if fgetpos exists
13205 set fgetpos d_fgetpos
13206 eval $inlibc
13207
13208 : see if finite exists
13209 set finite d_finite
13210 eval $inlibc
13211
13212 : see if finitel exists
13213 set finitel d_finitel
13214 eval $inlibc
13215
13216 : see if flock exists
13217 set flock d_flock
13218 eval $inlibc
13219
13220 : see if prototype for flock is available
13221 echo " "
13222 set d_flockproto flock $i_sysfile sys/file.h
13223 eval $hasproto
13224
13225 : see if fp_class exists
13226 set fp_class d_fp_class
13227 eval $inlibc
13228
13229 : see if pathconf exists
13230 set pathconf d_pathconf
13231 eval $inlibc
13232
13233 : see if fpathconf exists
13234 set fpathconf d_fpathconf
13235 eval $inlibc
13236
13237 : see if fpclass exists
13238 set fpclass d_fpclass
13239 eval $inlibc
13240
13241 : see if fpclassify exists
13242 set fpclassify d_fpclassify
13243 eval $inlibc
13244
13245 : see if fpclassl exists
13246 set fpclassl d_fpclassl
13247 eval $inlibc
13248
13249 : check for fpos64_t
13250 echo " "
13251 echo "Checking to see if you have fpos64_t..." >&4
13252 $cat >try.c <<EOCP
13253 #include <stdio.h>
13254 int main() { fpos64_t x = 7; }
13255 EOCP
13256 set try
13257 if eval $compile; then
13258         val="$define"
13259         echo "You have fpos64_t."
13260 else
13261         val="$undef"
13262         echo "You do not have fpos64_t."
13263         case "$fpossize" in
13264         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13265         esac
13266 fi
13267 $rm_try
13268 set d_fpos64_t
13269 eval $setvar
13270
13271 : see if frexpl exists
13272 set frexpl d_frexpl
13273 eval $inlibc
13274
13275 : see if this is a sys/param system
13276 set sys/param.h i_sysparam
13277 eval $inhdr
13278
13279 : see if this is a sys/mount.h system
13280 set sys/mount.h i_sysmount
13281 eval $inhdr
13282
13283 : Check for fs_data_s
13284 echo " "
13285 echo "Checking to see if your system supports struct fs_data..." >&4
13286 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13287 eval $hasstruct
13288 case "$d_fs_data_s" in
13289 "$define")      echo "Yes, it does."   ;;
13290 *)              echo "No, it doesn't." ;;
13291 esac
13292
13293 : see if fseeko exists
13294 set fseeko d_fseeko
13295 eval $inlibc
13296 case "$longsize" in
13297 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13298 esac
13299
13300 : see if fsetpos exists
13301 set fsetpos d_fsetpos
13302 eval $inlibc
13303
13304 : see if fstatfs exists
13305 set fstatfs d_fstatfs
13306 eval $inlibc
13307
13308 : see if statvfs exists
13309 set statvfs d_statvfs
13310 eval $inlibc
13311
13312 : see if fstatvfs exists
13313 set fstatvfs d_fstatvfs
13314 eval $inlibc
13315
13316
13317 : see if fsync exists
13318 set fsync d_fsync
13319 eval $inlibc
13320
13321 : see if ftello exists
13322 set ftello d_ftello
13323 eval $inlibc
13324 case "$longsize" in
13325 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13326 esac
13327
13328 : check for a working futimes
13329 d_futimes="$undef"
13330 echo " "
13331 echo "Checking if you have a working futimes()" >&4
13332 $cat >try.c <<EOCP
13333 #include <stdio.h>
13334 #include <sys/time.h>
13335 #include <errno.h>
13336 #include <fcntl.h>
13337
13338 int main ()
13339 {
13340     int fd, rv;
13341     fd = open ("try.c", O_RDWR);
13342     if (-1 == fd) exit (1);
13343     rv = futimes (fd, NULL);
13344     exit (rv == -1 ? errno : 0);
13345 }
13346 EOCP
13347 set try
13348 if eval $compile; then
13349     `$run ./try`
13350     rc=$?
13351     case "$rc" in
13352         0)  echo "Yes, you have" >&4
13353             d_futimes="$define"
13354             ;;
13355         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13356             ;;
13357     esac
13358 else
13359     echo "No, it does not (probably harmless)" >&4
13360 fi
13361 $rm_try
13362
13363 : see if ndbm.h is available
13364 set ndbm.h i_ndbm
13365 eval $inhdr
13366 : Compatibility location for RedHat 7.1
13367 set gdbm/ndbm.h i_gdbmndbm
13368 eval $inhdr
13369 : Compatibility location for Debian 4.0
13370 set gdbm-ndbm.h i_gdbm_ndbm
13371 eval $inhdr
13372
13373 val="$undef"
13374 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13375         : see if dbm_open exists
13376         set dbm_open d_dbm_open
13377         eval $inlibc
13378         case "$d_dbm_open" in
13379         $undef)
13380                 i_ndbm="$undef"
13381                 i_gdbmndbm="$undef"
13382                 i_gdbm_ndbm="$undef"
13383                 echo "We won't be including <ndbm.h>"
13384                 val="$undef"
13385                 ;;
13386         *) val="$define"
13387            ;;
13388         esac
13389 fi
13390 set d_ndbm
13391 eval $setvar
13392
13393 ndbm_hdr_protochk='name=$1; hdr=$2;
13394 eval "ihdr=\$""i_$name";
13395 val="$undef";
13396 if $test "$ihdr" = "$define"; then
13397         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13398         case "$d_cplusplus" in
13399         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13400         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13401         esac;
13402         case "$val" in
13403         $define) $echo "Your <$hdr> seems to have prototypes";;
13404         *) $echo "Your <$hdr> does not seem to have prototypes";;
13405         esac;
13406 fi;
13407 set "d_${name}_h_uses_prototypes";
13408 eval $setvar'
13409
13410 set ndbm ndbm.h
13411 eval $ndbm_hdr_protochk
13412 set gdbmndbm gdbm/ndbm.h
13413 eval $ndbm_hdr_protochk
13414 set gdbm_ndbm gdbm-ndbm.h
13415 eval $ndbm_hdr_protochk
13416
13417 : see if getaddrinfo exists
13418 set getaddrinfo d_getaddrinfo
13419 eval $inlibc
13420
13421 : see if getcwd exists
13422 set getcwd d_getcwd
13423 eval $inlibc
13424
13425 : see if getespwnam exists
13426 set getespwnam d_getespwnam
13427 eval $inlibc
13428
13429 : see if getfsstat exists
13430 set getfsstat d_getfsstat
13431 eval $inlibc
13432
13433 : see if getgrent exists
13434 set getgrent d_getgrent
13435 eval $inlibc
13436
13437 : see if getgrent_r exists
13438 set getgrent_r d_getgrent_r
13439 eval $inlibc
13440 case "$d_getgrent_r" in
13441 "$define")
13442         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13443         case "$d_getgrent_r_proto:$usethreads" in
13444         ":define")      d_getgrent_r_proto=define
13445                 set d_getgrent_r_proto getgrent_r $hdrs
13446                 eval $hasproto ;;
13447         *)      ;;
13448         esac
13449         case "$d_getgrent_r_proto" in
13450         define)
13451         case "$getgrent_r_proto" in
13452         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13453         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13454         esac
13455         case "$getgrent_r_proto" in
13456         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13457         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13458         esac
13459         case "$getgrent_r_proto" in
13460         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13461         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13462         esac
13463         case "$getgrent_r_proto" in
13464         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13465         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13466         esac
13467         case "$getgrent_r_proto" in
13468         ''|0) try='int getgrent_r(struct group*, char*, int);'
13469         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13470         esac
13471         case "$getgrent_r_proto" in
13472         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13473         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13474         esac
13475         case "$getgrent_r_proto" in
13476         ''|0)   d_getgrent_r=undef
13477                 getgrent_r_proto=0
13478                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13479         * )     case "$getgrent_r_proto" in
13480                 REENTRANT_PROTO*) ;;
13481                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13482                 esac
13483                 echo "Prototype: $try" ;;
13484         esac
13485         ;;
13486         *)      case "$usethreads" in
13487                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13488                 esac
13489                 d_getgrent_r=undef
13490                 getgrent_r_proto=0
13491                 ;;
13492         esac
13493         ;;
13494 *)      getgrent_r_proto=0
13495         ;;
13496 esac
13497
13498 : see if getgrgid_r exists
13499 set getgrgid_r d_getgrgid_r
13500 eval $inlibc
13501 case "$d_getgrgid_r" in
13502 "$define")
13503         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13504         case "$d_getgrgid_r_proto:$usethreads" in
13505         ":define")      d_getgrgid_r_proto=define
13506                 set d_getgrgid_r_proto getgrgid_r $hdrs
13507                 eval $hasproto ;;
13508         *)      ;;
13509         esac
13510         case "$d_getgrgid_r_proto" in
13511         define)
13512         case "$getgrgid_r_proto" in
13513         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13514         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13515         esac
13516         case "$getgrgid_r_proto" in
13517         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13518         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13519         esac
13520         case "$getgrgid_r_proto" in
13521         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13522         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13523         esac
13524         case "$getgrgid_r_proto" in
13525         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13526         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13527         esac
13528         case "$getgrgid_r_proto" in
13529         ''|0)   d_getgrgid_r=undef
13530                 getgrgid_r_proto=0
13531                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13532         * )     case "$getgrgid_r_proto" in
13533                 REENTRANT_PROTO*) ;;
13534                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13535                 esac
13536                 echo "Prototype: $try" ;;
13537         esac
13538         ;;
13539         *)      case "$usethreads" in
13540                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13541                 esac
13542                 d_getgrgid_r=undef
13543                 getgrgid_r_proto=0
13544                 ;;
13545         esac
13546         ;;
13547 *)      getgrgid_r_proto=0
13548         ;;
13549 esac
13550
13551 : see if getgrnam_r exists
13552 set getgrnam_r d_getgrnam_r
13553 eval $inlibc
13554 case "$d_getgrnam_r" in
13555 "$define")
13556         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13557         case "$d_getgrnam_r_proto:$usethreads" in
13558         ":define")      d_getgrnam_r_proto=define
13559                 set d_getgrnam_r_proto getgrnam_r $hdrs
13560                 eval $hasproto ;;
13561         *)      ;;
13562         esac
13563         case "$d_getgrnam_r_proto" in
13564         define)
13565         case "$getgrnam_r_proto" in
13566         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13567         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13568         esac
13569         case "$getgrnam_r_proto" in
13570         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13571         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13572         esac
13573         case "$getgrnam_r_proto" in
13574         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13575         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13576         esac
13577         case "$getgrnam_r_proto" in
13578         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13579         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13580         esac
13581         case "$getgrnam_r_proto" in
13582         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13583         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13584         esac
13585         case "$getgrnam_r_proto" in
13586         ''|0)   d_getgrnam_r=undef
13587                 getgrnam_r_proto=0
13588                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13589         * )     case "$getgrnam_r_proto" in
13590                 REENTRANT_PROTO*) ;;
13591                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13592                 esac
13593                 echo "Prototype: $try" ;;
13594         esac
13595         ;;
13596         *)      case "$usethreads" in
13597                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13598                 esac
13599                 d_getgrnam_r=undef
13600                 getgrnam_r_proto=0
13601                 ;;
13602         esac
13603         ;;
13604 *)      getgrnam_r_proto=0
13605         ;;
13606 esac
13607
13608 : see if gethostbyaddr exists
13609 set gethostbyaddr d_gethbyaddr
13610 eval $inlibc
13611
13612 : see if gethostbyname exists
13613 set gethostbyname d_gethbyname
13614 eval $inlibc
13615
13616 : see if gethostent exists
13617 set gethostent d_gethent
13618 eval $inlibc
13619
13620 : see how we will look up host name
13621 echo " "
13622 call=''
13623 if set gethostname val -f d_gethname; eval $csym; $val; then
13624         echo 'gethostname() found.' >&4
13625         d_gethname="$define"
13626         call=gethostname
13627 fi
13628 if set uname val -f d_uname; eval $csym; $val; then
13629         if ./xenix; then
13630                 $cat <<'EOM'
13631 uname() was found, but you're running xenix, and older versions of xenix
13632 have a broken uname(). If you don't really know whether your xenix is old
13633 enough to have a broken system call, use the default answer.
13634
13635 EOM
13636                 dflt=y
13637                 case "$d_uname" in
13638                 "$define") dflt=n;;
13639                 esac
13640                 rp='Is your uname() broken?'
13641                 . ./myread
13642                 case "$ans" in
13643                 n*) d_uname="$define"; call=uname;;
13644                 esac
13645         else
13646                 echo 'uname() found.' >&4
13647                 d_uname="$define"
13648                 case "$call" in
13649                 '') call=uname ;;
13650                 esac
13651         fi
13652 fi
13653 case "$d_gethname" in
13654 '') d_gethname="$undef";;
13655 esac
13656 case "$d_uname" in
13657 '') d_uname="$undef";;
13658 esac
13659 case "$d_uname$d_gethname" in
13660 *define*)
13661         dflt=n
13662         cat <<EOM
13663
13664 Every now and then someone has a $call() that lies about the hostname
13665 but can't be fixed for political or economic reasons.  If you wish, I can
13666 pretend $call() isn't there and maybe compute hostname at run-time
13667 thanks to the '$phostname' command.
13668
13669 EOM
13670         rp="Shall I ignore $call() from now on?"
13671         . ./myread
13672         case "$ans" in
13673         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13674         esac;;
13675 esac
13676 case "$phostname" in
13677 '') aphostname='';;
13678 *) case "$aphostname" in
13679         /*) ;;
13680         *) set X $phostname
13681                 shift
13682                 file=$1
13683                 shift
13684                 file=`./loc $file $file $pth`
13685                 aphostname=`echo $file $*`
13686                 ;;
13687         esac
13688         ;;
13689 esac
13690 case "$d_uname$d_gethname" in
13691 *define*) ;;
13692 *)
13693         case "$phostname" in
13694         '')
13695                 echo "There will be no way for $package to get your hostname." >&4;;
13696         *)
13697         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13698                 ;;
13699         esac;;
13700 esac
13701 case "$d_phostname" in
13702 '') d_phostname="$undef";;
13703 esac
13704
13705 : see if gethostbyaddr_r exists
13706 set gethostbyaddr_r d_gethostbyaddr_r
13707 eval $inlibc
13708 case "$d_gethostbyaddr_r" in
13709 "$define")
13710         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13711         case "$d_gethostbyaddr_r_proto:$usethreads" in
13712         ":define")      d_gethostbyaddr_r_proto=define
13713                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13714                 eval $hasproto ;;
13715         *)      ;;
13716         esac
13717         case "$d_gethostbyaddr_r_proto" in
13718         define)
13719         case "$gethostbyaddr_r_proto" in
13720         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13721         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13722         esac
13723         case "$gethostbyaddr_r_proto" in
13724         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13725         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13726         esac
13727         case "$gethostbyaddr_r_proto" in
13728         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13729         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13730         esac
13731         case "$gethostbyaddr_r_proto" in
13732         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13733         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13734         esac
13735         case "$gethostbyaddr_r_proto" in
13736         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13737         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13738         esac
13739         case "$gethostbyaddr_r_proto" in
13740         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13741         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13742         esac
13743         case "$gethostbyaddr_r_proto" in
13744         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13745         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13746         esac
13747         case "$gethostbyaddr_r_proto" in
13748         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13749         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13750         esac
13751         case "$gethostbyaddr_r_proto" in
13752         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13753         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13754         esac
13755         case "$gethostbyaddr_r_proto" in
13756         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13757         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13758         esac
13759         case "$gethostbyaddr_r_proto" in
13760         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13761         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13762         esac
13763         case "$gethostbyaddr_r_proto" in
13764         ''|0)   d_gethostbyaddr_r=undef
13765                 gethostbyaddr_r_proto=0
13766                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13767         * )     case "$gethostbyaddr_r_proto" in
13768                 REENTRANT_PROTO*) ;;
13769                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13770                 esac
13771                 echo "Prototype: $try" ;;
13772         esac
13773         ;;
13774         *)      case "$usethreads" in
13775                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13776                 esac
13777                 d_gethostbyaddr_r=undef
13778                 gethostbyaddr_r_proto=0
13779                 ;;
13780         esac
13781         ;;
13782 *)      gethostbyaddr_r_proto=0
13783         ;;
13784 esac
13785
13786 : see if gethostbyname_r exists
13787 set gethostbyname_r d_gethostbyname_r
13788 eval $inlibc
13789 case "$d_gethostbyname_r" in
13790 "$define")
13791         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13792         case "$d_gethostbyname_r_proto:$usethreads" in
13793         ":define")      d_gethostbyname_r_proto=define
13794                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13795                 eval $hasproto ;;
13796         *)      ;;
13797         esac
13798         case "$d_gethostbyname_r_proto" in
13799         define)
13800         case "$gethostbyname_r_proto" in
13801         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13802         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13803         esac
13804         case "$gethostbyname_r_proto" in
13805         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13806         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13807         esac
13808         case "$gethostbyname_r_proto" in
13809         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13810         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13811         esac
13812         case "$gethostbyname_r_proto" in
13813         ''|0)   d_gethostbyname_r=undef
13814                 gethostbyname_r_proto=0
13815                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13816         * )     case "$gethostbyname_r_proto" in
13817                 REENTRANT_PROTO*) ;;
13818                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13819                 esac
13820                 echo "Prototype: $try" ;;
13821         esac
13822         ;;
13823         *)      case "$usethreads" in
13824                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13825                 esac
13826                 d_gethostbyname_r=undef
13827                 gethostbyname_r_proto=0
13828                 ;;
13829         esac
13830         ;;
13831 *)      gethostbyname_r_proto=0
13832         ;;
13833 esac
13834
13835 : see if gethostent_r exists
13836 set gethostent_r d_gethostent_r
13837 eval $inlibc
13838 case "$d_gethostent_r" in
13839 "$define")
13840         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13841         case "$d_gethostent_r_proto:$usethreads" in
13842         ":define")      d_gethostent_r_proto=define
13843                 set d_gethostent_r_proto gethostent_r $hdrs
13844                 eval $hasproto ;;
13845         *)      ;;
13846         esac
13847         case "$d_gethostent_r_proto" in
13848         define)
13849         case "$gethostent_r_proto" in
13850         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13851         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13852         esac
13853         case "$gethostent_r_proto" in
13854         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13855         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13856         esac
13857         case "$gethostent_r_proto" in
13858         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13859         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13860         esac
13861         case "$gethostent_r_proto" in
13862         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13863         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13864         esac
13865         case "$gethostent_r_proto" in
13866         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13867         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13868         esac
13869         case "$gethostent_r_proto" in
13870         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13871         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13872         esac
13873         case "$gethostent_r_proto" in
13874         ''|0)   d_gethostent_r=undef
13875                 gethostent_r_proto=0
13876                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13877         * )     case "$gethostent_r_proto" in
13878                 REENTRANT_PROTO*) ;;
13879                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13880                 esac
13881                 echo "Prototype: $try" ;;
13882         esac
13883         ;;
13884         *)      case "$usethreads" in
13885                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13886                 esac
13887                 d_gethostent_r=undef
13888                 gethostent_r_proto=0
13889                 ;;
13890         esac
13891         ;;
13892 *)      gethostent_r_proto=0
13893         ;;
13894 esac
13895
13896 : see if prototypes for various gethostxxx netdb.h functions are available
13897 echo " "
13898 set d_gethostprotos gethostent $i_netdb netdb.h
13899 eval $hasproto
13900
13901 : see if getitimer exists
13902 set getitimer d_getitimer
13903 eval $inlibc
13904
13905 : see if getlogin exists
13906 set getlogin d_getlogin
13907 eval $inlibc
13908
13909 : see if getlogin_r exists
13910 set getlogin_r d_getlogin_r
13911 eval $inlibc
13912 case "$d_getlogin_r" in
13913 "$define")
13914         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13915         case "$d_getlogin_r_proto:$usethreads" in
13916         ":define")      d_getlogin_r_proto=define
13917                 set d_getlogin_r_proto getlogin_r $hdrs
13918                 eval $hasproto ;;
13919         *)      ;;
13920         esac
13921         case "$d_getlogin_r_proto" in
13922         define)
13923         case "$getlogin_r_proto" in
13924         ''|0) try='int getlogin_r(char*, size_t);'
13925         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13926         esac
13927         case "$getlogin_r_proto" in
13928         ''|0) try='int getlogin_r(char*, int);'
13929         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13930         esac
13931         case "$getlogin_r_proto" in
13932         ''|0) try='char* getlogin_r(char*, size_t);'
13933         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13934         esac
13935         case "$getlogin_r_proto" in
13936         ''|0) try='char* getlogin_r(char*, int);'
13937         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13938         esac
13939         case "$getlogin_r_proto" in
13940         ''|0)   d_getlogin_r=undef
13941                 getlogin_r_proto=0
13942                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13943         * )     case "$getlogin_r_proto" in
13944                 REENTRANT_PROTO*) ;;
13945                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13946                 esac
13947                 echo "Prototype: $try" ;;
13948         esac
13949         ;;
13950         *)      case "$usethreads" in
13951                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13952                 esac
13953                 d_getlogin_r=undef
13954                 getlogin_r_proto=0
13955                 ;;
13956         esac
13957         ;;
13958 *)      getlogin_r_proto=0
13959         ;;
13960 esac
13961
13962 : see if getmnt exists
13963 set getmnt d_getmnt
13964 eval $inlibc
13965
13966 : see if getmntent exists
13967 set getmntent d_getmntent
13968 eval $inlibc
13969
13970 : see if getnameinfo exists
13971 set getnameinfo d_getnameinfo
13972 eval $inlibc
13973
13974 : see if getnetbyaddr exists
13975 set getnetbyaddr d_getnbyaddr
13976 eval $inlibc
13977
13978 : see if getnetbyname exists
13979 set getnetbyname d_getnbyname
13980 eval $inlibc
13981
13982 : see if getnetent exists
13983 set getnetent d_getnent
13984 eval $inlibc
13985
13986 : see if getnetbyaddr_r exists
13987 set getnetbyaddr_r d_getnetbyaddr_r
13988 eval $inlibc
13989 case "$d_getnetbyaddr_r" in
13990 "$define")
13991         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13992         case "$d_getnetbyaddr_r_proto:$usethreads" in
13993         ":define")      d_getnetbyaddr_r_proto=define
13994                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13995                 eval $hasproto ;;
13996         *)      ;;
13997         esac
13998         case "$d_getnetbyaddr_r_proto" in
13999         define)
14000         case "$getnetbyaddr_r_proto" in
14001         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14002         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14003         esac
14004         case "$getnetbyaddr_r_proto" in
14005         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14006         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14007         esac
14008         case "$getnetbyaddr_r_proto" in
14009         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14010         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14011         esac
14012         case "$getnetbyaddr_r_proto" in
14013         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14014         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14015         esac
14016         case "$getnetbyaddr_r_proto" in
14017         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14018         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14019         esac
14020         case "$getnetbyaddr_r_proto" in
14021         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14022         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14023         esac
14024         case "$getnetbyaddr_r_proto" in
14025         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14026         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14027         esac
14028         case "$getnetbyaddr_r_proto" in
14029         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14030         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14031         esac
14032         case "$getnetbyaddr_r_proto" in
14033         ''|0)   d_getnetbyaddr_r=undef
14034                 getnetbyaddr_r_proto=0
14035                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14036         * )     case "$getnetbyaddr_r_proto" in
14037                 REENTRANT_PROTO*) ;;
14038                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14039                 esac
14040                 echo "Prototype: $try" ;;
14041         esac
14042         ;;
14043         *)      case "$usethreads" in
14044                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14045                 esac
14046                 d_getnetbyaddr_r=undef
14047                 getnetbyaddr_r_proto=0
14048                 ;;
14049         esac
14050         ;;
14051 *)      getnetbyaddr_r_proto=0
14052         ;;
14053 esac
14054
14055 : see if getnetbyname_r exists
14056 set getnetbyname_r d_getnetbyname_r
14057 eval $inlibc
14058 case "$d_getnetbyname_r" in
14059 "$define")
14060         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14061         case "$d_getnetbyname_r_proto:$usethreads" in
14062         ":define")      d_getnetbyname_r_proto=define
14063                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14064                 eval $hasproto ;;
14065         *)      ;;
14066         esac
14067         case "$d_getnetbyname_r_proto" in
14068         define)
14069         case "$getnetbyname_r_proto" in
14070         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14071         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14072         esac
14073         case "$getnetbyname_r_proto" in
14074         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14075         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14076         esac
14077         case "$getnetbyname_r_proto" in
14078         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14079         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14080         esac
14081         case "$getnetbyname_r_proto" in
14082         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14083         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14084         esac
14085         case "$getnetbyname_r_proto" in
14086         ''|0)   d_getnetbyname_r=undef
14087                 getnetbyname_r_proto=0
14088                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14089         * )     case "$getnetbyname_r_proto" in
14090                 REENTRANT_PROTO*) ;;
14091                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14092                 esac
14093                 echo "Prototype: $try" ;;
14094         esac
14095         ;;
14096         *)      case "$usethreads" in
14097                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14098                 esac
14099                 d_getnetbyname_r=undef
14100                 getnetbyname_r_proto=0
14101                 ;;
14102         esac
14103         ;;
14104 *)      getnetbyname_r_proto=0
14105         ;;
14106 esac
14107
14108 : see if getnetent_r exists
14109 set getnetent_r d_getnetent_r
14110 eval $inlibc
14111 case "$d_getnetent_r" in
14112 "$define")
14113         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14114         case "$d_getnetent_r_proto:$usethreads" in
14115         ":define")      d_getnetent_r_proto=define
14116                 set d_getnetent_r_proto getnetent_r $hdrs
14117                 eval $hasproto ;;
14118         *)      ;;
14119         esac
14120         case "$d_getnetent_r_proto" in
14121         define)
14122         case "$getnetent_r_proto" in
14123         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14124         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14125         esac
14126         case "$getnetent_r_proto" in
14127         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14128         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14129         esac
14130         case "$getnetent_r_proto" in
14131         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14132         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14133         esac
14134         case "$getnetent_r_proto" in
14135         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14136         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14137         esac
14138         case "$getnetent_r_proto" in
14139         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14140         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14141         esac
14142         case "$getnetent_r_proto" in
14143         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14144         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14145         esac
14146         case "$getnetent_r_proto" in
14147         ''|0)   d_getnetent_r=undef
14148                 getnetent_r_proto=0
14149                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14150         * )     case "$getnetent_r_proto" in
14151                 REENTRANT_PROTO*) ;;
14152                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14153                 esac
14154                 echo "Prototype: $try" ;;
14155         esac
14156         ;;
14157         *)      case "$usethreads" in
14158                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14159                 esac
14160                 d_getnetent_r=undef
14161                 getnetent_r_proto=0
14162                 ;;
14163         esac
14164         ;;
14165 *)      getnetent_r_proto=0
14166         ;;
14167 esac
14168
14169 : see if prototypes for various getnetxxx netdb.h functions are available
14170 echo " "
14171 set d_getnetprotos getnetent $i_netdb netdb.h
14172 eval $hasproto
14173
14174 : see if getpagesize exists
14175 set getpagesize d_getpagsz
14176 eval $inlibc
14177
14178 : Optional checks for getprotobyname and getprotobynumber
14179
14180 : see if getprotobyname exists
14181 set getprotobyname d_getpbyname
14182 eval $inlibc
14183
14184 : see if getprotobynumber exists
14185 set getprotobynumber d_getpbynumber
14186 eval $inlibc
14187
14188 : see if getprotoent exists
14189 set getprotoent d_getpent
14190 eval $inlibc
14191
14192 : see if getpgid exists
14193 set getpgid d_getpgid
14194 eval $inlibc
14195
14196 : see if getpgrp2 exists
14197 set getpgrp2 d_getpgrp2
14198 eval $inlibc
14199
14200 : see if getppid exists
14201 set getppid d_getppid
14202 eval $inlibc
14203
14204 : see if getpriority exists
14205 set getpriority d_getprior
14206 eval $inlibc
14207
14208 : see if getprotobyname_r exists
14209 set getprotobyname_r d_getprotobyname_r
14210 eval $inlibc
14211 case "$d_getprotobyname_r" in
14212 "$define")
14213         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14214         case "$d_getprotobyname_r_proto:$usethreads" in
14215         ":define")      d_getprotobyname_r_proto=define
14216                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14217                 eval $hasproto ;;
14218         *)      ;;
14219         esac
14220         case "$d_getprotobyname_r_proto" in
14221         define)
14222         case "$getprotobyname_r_proto" in
14223         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14224         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14225         esac
14226         case "$getprotobyname_r_proto" in
14227         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14228         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14229         esac
14230         case "$getprotobyname_r_proto" in
14231         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14232         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14233         esac
14234         case "$getprotobyname_r_proto" in
14235         ''|0)   d_getprotobyname_r=undef
14236                 getprotobyname_r_proto=0
14237                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14238         * )     case "$getprotobyname_r_proto" in
14239                 REENTRANT_PROTO*) ;;
14240                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14241                 esac
14242                 echo "Prototype: $try" ;;
14243         esac
14244         ;;
14245         *)      case "$usethreads" in
14246                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14247                 esac
14248                 d_getprotobyname_r=undef
14249                 getprotobyname_r_proto=0
14250                 ;;
14251         esac
14252         ;;
14253 *)      getprotobyname_r_proto=0
14254         ;;
14255 esac
14256
14257 : see if getprotobynumber_r exists
14258 set getprotobynumber_r d_getprotobynumber_r
14259 eval $inlibc
14260 case "$d_getprotobynumber_r" in
14261 "$define")
14262         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14263         case "$d_getprotobynumber_r_proto:$usethreads" in
14264         ":define")      d_getprotobynumber_r_proto=define
14265                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14266                 eval $hasproto ;;
14267         *)      ;;
14268         esac
14269         case "$d_getprotobynumber_r_proto" in
14270         define)
14271         case "$getprotobynumber_r_proto" in
14272         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14273         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14274         esac
14275         case "$getprotobynumber_r_proto" in
14276         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14277         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14278         esac
14279         case "$getprotobynumber_r_proto" in
14280         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14281         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14282         esac
14283         case "$getprotobynumber_r_proto" in
14284         ''|0)   d_getprotobynumber_r=undef
14285                 getprotobynumber_r_proto=0
14286                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14287         * )     case "$getprotobynumber_r_proto" in
14288                 REENTRANT_PROTO*) ;;
14289                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14290                 esac
14291                 echo "Prototype: $try" ;;
14292         esac
14293         ;;
14294         *)      case "$usethreads" in
14295                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14296                 esac
14297                 d_getprotobynumber_r=undef
14298                 getprotobynumber_r_proto=0
14299                 ;;
14300         esac
14301         ;;
14302 *)      getprotobynumber_r_proto=0
14303         ;;
14304 esac
14305
14306 : see if getprotoent_r exists
14307 set getprotoent_r d_getprotoent_r
14308 eval $inlibc
14309 case "$d_getprotoent_r" in
14310 "$define")
14311         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14312         case "$d_getprotoent_r_proto:$usethreads" in
14313         ":define")      d_getprotoent_r_proto=define
14314                 set d_getprotoent_r_proto getprotoent_r $hdrs
14315                 eval $hasproto ;;
14316         *)      ;;
14317         esac
14318         case "$d_getprotoent_r_proto" in
14319         define)
14320         case "$getprotoent_r_proto" in
14321         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14322         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14323         esac
14324         case "$getprotoent_r_proto" in
14325         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14326         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14327         esac
14328         case "$getprotoent_r_proto" in
14329         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14330         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14331         esac
14332         case "$getprotoent_r_proto" in
14333         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14334         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14335         esac
14336         case "$getprotoent_r_proto" in
14337         ''|0)   d_getprotoent_r=undef
14338                 getprotoent_r_proto=0
14339                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14340         * )     case "$getprotoent_r_proto" in
14341                 REENTRANT_PROTO*) ;;
14342                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14343                 esac
14344                 echo "Prototype: $try" ;;
14345         esac
14346         ;;
14347         *)      case "$usethreads" in
14348                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14349                 esac
14350                 d_getprotoent_r=undef
14351                 getprotoent_r_proto=0
14352                 ;;
14353         esac
14354         ;;
14355 *)      getprotoent_r_proto=0
14356         ;;
14357 esac
14358
14359 : see if prototypes for various getprotoxxx netdb.h functions are available
14360 echo " "
14361 set d_getprotoprotos getprotoent $i_netdb netdb.h
14362 eval $hasproto
14363
14364 : see if getprpwnam exists
14365 set getprpwnam d_getprpwnam
14366 eval $inlibc
14367
14368 : see if getpwent exists
14369 set getpwent d_getpwent
14370 eval $inlibc
14371
14372 : see if getpwent_r exists
14373 set getpwent_r d_getpwent_r
14374 eval $inlibc
14375 case "$d_getpwent_r" in
14376 "$define")
14377         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14378         case "$d_getpwent_r_proto:$usethreads" in
14379         ":define")      d_getpwent_r_proto=define
14380                 set d_getpwent_r_proto getpwent_r $hdrs
14381                 eval $hasproto ;;
14382         *)      ;;
14383         esac
14384         case "$d_getpwent_r_proto" in
14385         define)
14386         case "$getpwent_r_proto" in
14387         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14388         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14389         esac
14390         case "$getpwent_r_proto" in
14391         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14392         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14393         esac
14394         case "$getpwent_r_proto" in
14395         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14396         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14397         esac
14398         case "$getpwent_r_proto" in
14399         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14400         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14401         esac
14402         case "$getpwent_r_proto" in
14403         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14404         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14405         esac
14406         case "$getpwent_r_proto" in
14407         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14408         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14409         esac
14410         case "$getpwent_r_proto" in
14411         ''|0)   d_getpwent_r=undef
14412                 getpwent_r_proto=0
14413                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14414         * )     case "$getpwent_r_proto" in
14415                 REENTRANT_PROTO*) ;;
14416                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14417                 esac
14418                 echo "Prototype: $try" ;;
14419         esac
14420         ;;
14421         *)      case "$usethreads" in
14422                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14423                 esac
14424                 d_getpwent_r=undef
14425                 getpwent_r_proto=0
14426                 ;;
14427         esac
14428         ;;
14429 *)      getpwent_r_proto=0
14430         ;;
14431 esac
14432
14433 : see if getpwnam_r exists
14434 set getpwnam_r d_getpwnam_r
14435 eval $inlibc
14436 case "$d_getpwnam_r" in
14437 "$define")
14438         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14439         case "$d_getpwnam_r_proto:$usethreads" in
14440         ":define")      d_getpwnam_r_proto=define
14441                 set d_getpwnam_r_proto getpwnam_r $hdrs
14442                 eval $hasproto ;;
14443         *)      ;;
14444         esac
14445         case "$d_getpwnam_r_proto" in
14446         define)
14447         case "$getpwnam_r_proto" in
14448         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14449         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14450         esac
14451         case "$getpwnam_r_proto" in
14452         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14453         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14454         esac
14455         case "$getpwnam_r_proto" in
14456         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14457         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14458         esac
14459         case "$getpwnam_r_proto" in
14460         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14461         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14462         esac
14463         case "$getpwnam_r_proto" in
14464         ''|0)   d_getpwnam_r=undef
14465                 getpwnam_r_proto=0
14466                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14467         * )     case "$getpwnam_r_proto" in
14468                 REENTRANT_PROTO*) ;;
14469                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14470                 esac
14471                 echo "Prototype: $try" ;;
14472         esac
14473         ;;
14474         *)      case "$usethreads" in
14475                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14476                 esac
14477                 d_getpwnam_r=undef
14478                 getpwnam_r_proto=0
14479                 ;;
14480         esac
14481         ;;
14482 *)      getpwnam_r_proto=0
14483         ;;
14484 esac
14485
14486 : see if getpwuid_r exists
14487 set getpwuid_r d_getpwuid_r
14488 eval $inlibc
14489 case "$d_getpwuid_r" in
14490 "$define")
14491         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14492         case "$d_getpwuid_r_proto:$usethreads" in
14493         ":define")      d_getpwuid_r_proto=define
14494                 set d_getpwuid_r_proto getpwuid_r $hdrs
14495                 eval $hasproto ;;
14496         *)      ;;
14497         esac
14498         case "$d_getpwuid_r_proto" in
14499         define)
14500         case "$getpwuid_r_proto" in
14501         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14502         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14503         esac
14504         case "$getpwuid_r_proto" in
14505         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14506         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14507         esac
14508         case "$getpwuid_r_proto" in
14509         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14510         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14511         esac
14512         case "$getpwuid_r_proto" in
14513         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14514         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14515         esac
14516         case "$getpwuid_r_proto" in
14517         ''|0)   d_getpwuid_r=undef
14518                 getpwuid_r_proto=0
14519                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14520         * )     case "$getpwuid_r_proto" in
14521                 REENTRANT_PROTO*) ;;
14522                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14523                 esac
14524                 echo "Prototype: $try" ;;
14525         esac
14526         ;;
14527         *)      case "$usethreads" in
14528                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14529                 esac
14530                 d_getpwuid_r=undef
14531                 getpwuid_r_proto=0
14532                 ;;
14533         esac
14534         ;;
14535 *)      getpwuid_r_proto=0
14536         ;;
14537 esac
14538
14539 : Optional checks for getsbyname and getsbyport
14540
14541 : see if getservbyname exists
14542 set getservbyname d_getsbyname
14543 eval $inlibc
14544
14545 : see if getservbyport exists
14546 set getservbyport d_getsbyport
14547 eval $inlibc
14548
14549 : see if getservent exists
14550 set getservent d_getsent
14551 eval $inlibc
14552
14553 : see if getservbyname_r exists
14554 set getservbyname_r d_getservbyname_r
14555 eval $inlibc
14556 case "$d_getservbyname_r" in
14557 "$define")
14558         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14559         case "$d_getservbyname_r_proto:$usethreads" in
14560         ":define")      d_getservbyname_r_proto=define
14561                 set d_getservbyname_r_proto getservbyname_r $hdrs
14562                 eval $hasproto ;;
14563         *)      ;;
14564         esac
14565         case "$d_getservbyname_r_proto" in
14566         define)
14567         case "$getservbyname_r_proto" in
14568         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14569         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14570         esac
14571         case "$getservbyname_r_proto" in
14572         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14573         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14574         esac
14575         case "$getservbyname_r_proto" in
14576         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14577         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14578         esac
14579         case "$getservbyname_r_proto" in
14580         ''|0)   d_getservbyname_r=undef
14581                 getservbyname_r_proto=0
14582                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14583         * )     case "$getservbyname_r_proto" in
14584                 REENTRANT_PROTO*) ;;
14585                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14586                 esac
14587                 echo "Prototype: $try" ;;
14588         esac
14589         ;;
14590         *)      case "$usethreads" in
14591                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14592                 esac
14593                 d_getservbyname_r=undef
14594                 getservbyname_r_proto=0
14595                 ;;
14596         esac
14597         ;;
14598 *)      getservbyname_r_proto=0
14599         ;;
14600 esac
14601
14602 : see if getservbyport_r exists
14603 set getservbyport_r d_getservbyport_r
14604 eval $inlibc
14605 case "$d_getservbyport_r" in
14606 "$define")
14607         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14608         case "$d_getservbyport_r_proto:$usethreads" in
14609         ":define")      d_getservbyport_r_proto=define
14610                 set d_getservbyport_r_proto getservbyport_r $hdrs
14611                 eval $hasproto ;;
14612         *)      ;;
14613         esac
14614         case "$d_getservbyport_r_proto" in
14615         define)
14616         case "$getservbyport_r_proto" in
14617         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14618         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14619         esac
14620         case "$getservbyport_r_proto" in
14621         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14622         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14623         esac
14624         case "$getservbyport_r_proto" in
14625         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14626         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14627         esac
14628         case "$getservbyport_r_proto" in
14629         ''|0)   d_getservbyport_r=undef
14630                 getservbyport_r_proto=0
14631                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14632         * )     case "$getservbyport_r_proto" in
14633                 REENTRANT_PROTO*) ;;
14634                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14635                 esac
14636                 echo "Prototype: $try" ;;
14637         esac
14638         ;;
14639         *)      case "$usethreads" in
14640                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14641                 esac
14642                 d_getservbyport_r=undef
14643                 getservbyport_r_proto=0
14644                 ;;
14645         esac
14646         ;;
14647 *)      getservbyport_r_proto=0
14648         ;;
14649 esac
14650
14651 : see if getservent_r exists
14652 set getservent_r d_getservent_r
14653 eval $inlibc
14654 case "$d_getservent_r" in
14655 "$define")
14656         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14657         case "$d_getservent_r_proto:$usethreads" in
14658         ":define")      d_getservent_r_proto=define
14659                 set d_getservent_r_proto getservent_r $hdrs
14660                 eval $hasproto ;;
14661         *)      ;;
14662         esac
14663         case "$d_getservent_r_proto" in
14664         define)
14665         case "$getservent_r_proto" in
14666         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14667         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14668         esac
14669         case "$getservent_r_proto" in
14670         ''|0) try='int getservent_r(struct servent*, char*, int);'
14671         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14672         esac
14673         case "$getservent_r_proto" in
14674         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14675         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14676         esac
14677         case "$getservent_r_proto" in
14678         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14679         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14680         esac
14681         case "$getservent_r_proto" in
14682         ''|0)   d_getservent_r=undef
14683                 getservent_r_proto=0
14684                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14685         * )     case "$getservent_r_proto" in
14686                 REENTRANT_PROTO*) ;;
14687                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14688                 esac
14689                 echo "Prototype: $try" ;;
14690         esac
14691         ;;
14692         *)      case "$usethreads" in
14693                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14694                 esac
14695                 d_getservent_r=undef
14696                 getservent_r_proto=0
14697                 ;;
14698         esac
14699         ;;
14700 *)      getservent_r_proto=0
14701         ;;
14702 esac
14703
14704 : see if prototypes for various getservxxx netdb.h functions are available
14705 echo " "
14706 set d_getservprotos getservent $i_netdb netdb.h
14707 eval $hasproto
14708
14709 : see if getspnam exists
14710 set getspnam d_getspnam
14711 eval $inlibc
14712
14713 : see if this is a shadow.h system
14714 set shadow.h i_shadow
14715 eval $inhdr
14716
14717 : see if getspnam_r exists
14718 set getspnam_r d_getspnam_r
14719 eval $inlibc
14720 case "$d_getspnam_r" in
14721 "$define")
14722         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14723         case "$d_getspnam_r_proto:$usethreads" in
14724         ":define")      d_getspnam_r_proto=define
14725                 set d_getspnam_r_proto getspnam_r $hdrs
14726                 eval $hasproto ;;
14727         *)      ;;
14728         esac
14729         case "$d_getspnam_r_proto" in
14730         define)
14731         case "$getspnam_r_proto" in
14732         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14733         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14734         esac
14735         case "$getspnam_r_proto" in
14736         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14737         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14738         esac
14739         case "$getspnam_r_proto" in
14740         ''|0)   d_getspnam_r=undef
14741                 getspnam_r_proto=0
14742                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14743         * )     case "$getspnam_r_proto" in
14744                 REENTRANT_PROTO*) ;;
14745                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14746                 esac
14747                 echo "Prototype: $try" ;;
14748         esac
14749         ;;
14750         *)      case "$usethreads" in
14751                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14752                 esac
14753                 d_getspnam_r=undef
14754                 getspnam_r_proto=0
14755                 ;;
14756         esac
14757         ;;
14758 *)      getspnam_r_proto=0
14759         ;;
14760 esac
14761
14762 : see if gettimeofday or ftime exists
14763 set gettimeofday d_gettimeod
14764 eval $inlibc
14765 case "$d_gettimeod" in
14766 "$undef")
14767         set ftime d_ftime 
14768         eval $inlibc
14769         ;;
14770 *)
14771         val="$undef"; set d_ftime; eval $setvar
14772         ;;
14773 esac
14774 case "$d_gettimeod$d_ftime" in
14775 "$undef$undef")
14776         echo " "
14777         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14778         ;;
14779 esac
14780
14781 : see if gmtime_r exists
14782 set gmtime_r d_gmtime_r
14783 eval $inlibc
14784 case "$d_gmtime_r" in
14785 "$define")
14786         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14787         case "$d_gmtime_r_proto:$usethreads" in
14788         ":define")      d_gmtime_r_proto=define
14789                 set d_gmtime_r_proto gmtime_r $hdrs
14790                 eval $hasproto ;;
14791         *)      ;;
14792         esac
14793         case "$d_gmtime_r_proto" in
14794         define)
14795         case "$gmtime_r_proto" in
14796         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14797         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14798         esac
14799         case "$gmtime_r_proto" in
14800         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14801         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14802         esac
14803         case "$gmtime_r_proto" in
14804         ''|0)   d_gmtime_r=undef
14805                 gmtime_r_proto=0
14806                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14807         * )     case "$gmtime_r_proto" in
14808                 REENTRANT_PROTO*) ;;
14809                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14810                 esac
14811                 echo "Prototype: $try" ;;
14812         esac
14813         ;;
14814         *)      case "$usethreads" in
14815                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14816                 esac
14817                 d_gmtime_r=undef
14818                 gmtime_r_proto=0
14819                 ;;
14820         esac
14821         ;;
14822 *)      gmtime_r_proto=0
14823         ;;
14824 esac
14825
14826 : see if hasmntopt exists
14827 set hasmntopt d_hasmntopt
14828 eval $inlibc
14829
14830 : see if this is a netinet/in.h or sys/in.h system
14831 set netinet/in.h i_niin sys/in.h i_sysin
14832 eval $inhdr
14833
14834 : see if arpa/inet.h has to be included
14835 set arpa/inet.h i_arpainet
14836 eval $inhdr
14837
14838 : see if htonl --and friends-- exists
14839 val=''
14840 set htonl val
14841 eval $inlibc
14842
14843 : Maybe they are macros.
14844 case "$val" in
14845 $undef)
14846         $cat >htonl.c <<EOM
14847 #include <stdio.h>
14848 #include <sys/types.h>
14849 #$i_niin I_NETINET_IN
14850 #$i_sysin I_SYS_IN
14851 #$i_arpainet I_ARPA_INET
14852 #ifdef I_NETINET_IN
14853 #include <netinet/in.h>
14854 #endif
14855 #ifdef I_SYS_IN
14856 #include <sys/in.h>
14857 #endif
14858 #ifdef I_ARPA_INET
14859 #include <arpa/inet.h>
14860 #endif
14861 #ifdef htonl
14862 printf("Defined as a macro.");
14863 #endif
14864 EOM
14865         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14866         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14867                 val="$define"
14868                 echo "But it seems to be defined as a macro." >&4
14869         fi
14870         $rm -f htonl.?
14871         ;;
14872 esac
14873 set d_htonl
14874 eval $setvar
14875
14876 : see if ilogbl exists
14877 set ilogbl d_ilogbl
14878 eval $inlibc
14879
14880 : index or strchr
14881 echo " "
14882 if set index val -f; eval $csym; $val; then
14883         if set strchr val -f d_strchr; eval $csym; $val; then
14884                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14885                         val="$define"
14886                         vali="$undef"
14887                         echo "strchr() found." >&4
14888                 else
14889                         val="$undef"
14890                         vali="$define"
14891                         echo "index() found." >&4
14892                 fi
14893         else
14894                 val="$undef"
14895                 vali="$define"
14896                 echo "index() found." >&4
14897         fi
14898 else
14899         if set strchr val -f d_strchr; eval $csym; $val; then
14900                 val="$define"
14901                 vali="$undef"
14902                 echo "strchr() found." >&4
14903         else
14904                 echo "No index() or strchr() found!" >&4
14905                 val="$undef"
14906                 vali="$undef"
14907         fi
14908 fi
14909 set d_strchr; eval $setvar
14910 val="$vali"
14911 set d_index; eval $setvar
14912
14913 : check whether inet_aton exists
14914 set inet_aton d_inetaton
14915 eval $inlibc
14916
14917 : see if inet_ntop exists
14918 set inet_ntop d_inetntop
14919 eval $inlibc
14920
14921 : see if inet_pton exists
14922 set inet_pton d_inetpton
14923 eval $inlibc
14924
14925 : Look for isascii
14926 echo " "
14927 $cat >isascii.c <<EOCP
14928 #include <stdio.h>
14929 #include <ctype.h>
14930 #$i_stdlib I_STDLIB
14931 #ifdef I_STDLIB
14932 #include <stdlib.h>
14933 #endif
14934 int main() {
14935         int c = 'A';
14936         if (isascii(c))
14937                 exit(0);
14938         else
14939                 exit(1);
14940 }
14941 EOCP
14942 set isascii
14943 if eval $compile; then
14944         echo "isascii() found." >&4
14945         val="$define"
14946 else
14947         echo "isascii() NOT found." >&4
14948         val="$undef"
14949 fi
14950 set d_isascii
14951 eval $setvar
14952 $rm -f isascii*
14953
14954 : see if isfinite exists
14955 set isfinite d_isfinite
14956 eval $inlibc
14957
14958 : see if isinf exists
14959 set isinf d_isinf
14960 eval $inlibc
14961
14962 : see if isnan exists
14963 set isnan d_isnan
14964 eval $inlibc
14965
14966 : see if isnanl exists
14967 set isnanl d_isnanl
14968 eval $inlibc
14969
14970 : see if killpg exists
14971 set killpg d_killpg
14972 eval $inlibc
14973
14974 : see if lchown exists
14975 echo " "
14976 $cat > try.c <<'EOCP'
14977 /* System header to define __stub macros and hopefully few prototypes,
14978     which can conflict with char lchown(); below.  */
14979 #include <assert.h>
14980 /* Override any gcc2 internal prototype to avoid an error.  */
14981 /* We use char because int might match the return type of a gcc2
14982    builtin and then its argument prototype would still apply.  */
14983 char lchown();
14984 int main() {
14985     /*  The GNU C library defines this for functions which it implements
14986         to always fail with ENOSYS.  Some functions are actually named
14987         something starting with __ and the normal name is an alias.  */
14988 #if defined (__stub_lchown) || defined (__stub___lchown)
14989 choke me
14990 #else
14991 lchown();
14992 #endif
14993 ; return 0; }
14994 EOCP
14995 set try
14996 if eval $compile; then
14997     $echo "lchown() found." >&4
14998     val="$define"
14999 else
15000     $echo "lchown() NOT found." >&4
15001     val="$undef"
15002 fi
15003 set d_lchown
15004 eval $setvar
15005
15006 : See if number of significant digits in a double precision number is known
15007 echo " "
15008 $cat >ldbl_dig.c <<EOM
15009 #$i_limits I_LIMITS
15010 #$i_float I_FLOAT
15011 #ifdef I_LIMITS
15012 #include <limits.h>
15013 #endif
15014 #ifdef I_FLOAT
15015 #include <float.h>
15016 #endif
15017 #ifdef LDBL_DIG
15018 printf("Contains LDBL_DIG");
15019 #endif
15020 EOM
15021 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15022 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15023         echo "LDBL_DIG found." >&4
15024         val="$define"
15025 else
15026         echo "LDBL_DIG NOT found." >&4
15027         val="$undef"
15028 fi
15029 $rm -f ldbl_dig.?
15030 set d_ldbl_dig
15031 eval $setvar
15032
15033 : see if this is a math.h system
15034 set math.h i_math
15035 eval $inhdr
15036
15037 : check to see if math.h defines _LIB_VERSION
15038 d_libm_lib_version="$undef"
15039 case $i_math in
15040     $define)
15041         echo " "
15042         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15043         $cat >try.c <<EOCP
15044 #include <unistd.h>
15045 #include <math.h>
15046 int main (int argc, char *argv[])
15047 {
15048     printf ("%d\n", _LIB_VERSION);
15049     return (0);
15050     } /* main */
15051 EOCP
15052         set try
15053         if eval $compile; then
15054             foo=`$run ./try`
15055             echo "Yes, it does ($foo)" >&4
15056             d_libm_lib_version="$define"
15057         else
15058             echo "No, it does not (probably harmless)" >&4
15059             fi
15060         $rm_try
15061         ;;
15062
15063     esac
15064
15065 : see if link exists
15066 set link d_link
15067 eval $inlibc
15068
15069 : see if localtime_r exists
15070 set localtime_r d_localtime_r
15071 eval $inlibc
15072 case "$d_localtime_r" in
15073 "$define")
15074         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15075         case "$d_localtime_r_proto:$usethreads" in
15076         ":define")      d_localtime_r_proto=define
15077                 set d_localtime_r_proto localtime_r $hdrs
15078                 eval $hasproto ;;
15079         *)      ;;
15080         esac
15081         case "$d_localtime_r_proto" in
15082         define)
15083         case "$localtime_r_proto" in
15084         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15085         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15086         esac
15087         case "$localtime_r_proto" in
15088         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15089         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15090         esac
15091         case "$localtime_r_proto" in
15092         ''|0)   d_localtime_r=undef
15093                 localtime_r_proto=0
15094                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15095         * )     case "$localtime_r_proto" in
15096                 REENTRANT_PROTO*) ;;
15097                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15098                 esac
15099                 echo "Prototype: $try" ;;
15100         esac
15101         ;;
15102         *)      case "$usethreads" in
15103                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15104                 esac
15105                 d_localtime_r=undef
15106                 localtime_r_proto=0
15107                 ;;
15108         esac
15109         ;;
15110 *)      localtime_r_proto=0
15111         ;;
15112 esac
15113
15114 : see if localtime_r calls tzset
15115 case "$localtime_r_proto" in
15116 REENTRANT_PROTO*)
15117         $cat >try.c <<EOCP
15118 /*  Does our libc's localtime_r call tzset ?
15119  *  return 0 if so, 1 otherwise.
15120  */
15121 #$i_systypes    I_SYS_TYPES
15122 #$i_unistd      I_UNISTD
15123 #$i_time        I_TIME
15124 #$i_stdlib      I_STDLIB
15125 #$i_string      I_STRING
15126 #$i_malloc      I_MALLOC
15127 #ifdef I_SYS_TYPES
15128 #  include <sys/types.h>
15129 #endif
15130 #ifdef I_UNISTD
15131 #  include <unistd.h>
15132 #endif
15133 #ifdef I_TIME
15134 #  include <time.h>
15135 #endif
15136 #ifdef I_STDLIB
15137 #include <stdlib.h>
15138 #endif
15139 #ifdef I_STRING
15140 #  include <string.h>
15141 #else
15142 #  include <strings.h>
15143 #endif
15144 #ifdef I_MALLOC
15145 #  include <malloc.h>
15146 #endif
15147 int main()
15148 {
15149     time_t t = time(0L);
15150     char w_tz[]="TZ" "=GMT+5",
15151          e_tz[]="TZ" "=GMT-5",
15152         *tz_e = (char*)malloc(16),
15153         *tz_w = (char*)malloc(16);
15154     struct tm tm_e, tm_w;
15155     memset(&tm_e,'\0',sizeof(struct tm));
15156     memset(&tm_w,'\0',sizeof(struct tm));
15157     strcpy(tz_e,e_tz);
15158     strcpy(tz_w,w_tz);
15159
15160     putenv(tz_e);
15161     localtime_r(&t, &tm_e);
15162
15163     putenv(tz_w);
15164     localtime_r(&t, &tm_w);
15165
15166     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15167         return 1;
15168     return 0;
15169 }
15170 EOCP
15171         set try
15172         if eval $compile; then
15173             if $run ./try; then
15174                 d_localtime_r_needs_tzset=undef;
15175             else
15176                 d_localtime_r_needs_tzset=define;
15177             fi;
15178         else
15179             d_localtime_r_needs_tzset=undef;
15180         fi;
15181      ;;
15182   *)
15183      d_localtime_r_needs_tzset=undef;
15184      ;;
15185 esac
15186 $rm_try
15187
15188 : see if localeconv exists
15189 set localeconv d_locconv
15190 eval $inlibc
15191
15192 : see if lockf exists
15193 set lockf d_lockf
15194 eval $inlibc
15195
15196 : see if prototype for lseek is available
15197 echo " "
15198 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15199 eval $hasproto
15200
15201 : see if lstat exists
15202 set lstat d_lstat
15203 eval $inlibc
15204
15205 : see if madvise exists
15206 set madvise d_madvise
15207 eval $inlibc
15208
15209 : see if malloc_size exists
15210 set malloc_size d_malloc_size
15211 eval $inlibc
15212
15213 : see if malloc_size_good exists
15214 set malloc_good_size d_malloc_good_size
15215 eval $inlibc
15216
15217 : see if mblen exists
15218 set mblen d_mblen
15219 eval $inlibc
15220
15221 : see if mbstowcs exists
15222 set mbstowcs d_mbstowcs
15223 eval $inlibc
15224
15225 : see if mbtowc exists
15226 set mbtowc d_mbtowc
15227 eval $inlibc
15228
15229 : see if memchr exists
15230 set memchr d_memchr
15231 eval $inlibc
15232
15233 : see if memcmp exists
15234 set memcmp d_memcmp
15235 eval $inlibc
15236
15237 : see if memcpy exists
15238 set memcpy d_memcpy
15239 eval $inlibc
15240
15241 : see if memmove exists
15242 set memmove d_memmove
15243 eval $inlibc
15244
15245 : see if memset exists
15246 set memset d_memset
15247 eval $inlibc
15248
15249 : see if mkdir exists
15250 set mkdir d_mkdir
15251 eval $inlibc
15252
15253 : see if mkdtemp exists
15254 set mkdtemp d_mkdtemp
15255 eval $inlibc
15256
15257 : see if mkfifo exists
15258 set mkfifo d_mkfifo
15259 eval $inlibc
15260
15261 : see if mkstemp exists
15262 set mkstemp d_mkstemp
15263 eval $inlibc
15264
15265 : see if mkstemps exists
15266 set mkstemps d_mkstemps
15267 eval $inlibc
15268
15269 : see if mktime exists
15270 set mktime d_mktime
15271 eval $inlibc
15272
15273 : see if this is a sys/mman.h system
15274 set sys/mman.h i_sysmman
15275 eval $inhdr
15276
15277 : see if mmap exists
15278 set mmap d_mmap
15279 eval $inlibc
15280 : see what shmat returns
15281 : default to something harmless
15282 mmaptype='void *'
15283 case "$i_sysmman$d_mmap" in
15284 "$define$define")
15285         $cat >mmap.c <<'END'
15286 #include <sys/mman.h>
15287 void *mmap();
15288 END
15289         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15290                 mmaptype='void *'
15291         else
15292                 mmaptype='caddr_t'
15293         fi
15294         echo "and it returns ($mmaptype)." >&4
15295         ;;
15296 esac
15297
15298
15299
15300 : see if sqrtl exists
15301 set sqrtl d_sqrtl
15302 eval $inlibc
15303
15304 : see if scalbnl exists
15305 set scalbnl d_scalbnl
15306 eval $inlibc
15307
15308 : see if modfl exists
15309 set modfl d_modfl
15310 eval $inlibc
15311
15312 : see if prototype for modfl is available
15313 echo " "
15314 set d_modflproto modfl $i_math math.h
15315 eval $hasproto
15316
15317 d_modfl_pow32_bug="$undef"
15318
15319 case "$d_longdbl$d_modfl" in
15320 $define$define)
15321         $cat <<EOM
15322 Checking to see whether your modfl() is okay for large values...
15323 EOM
15324 $cat >try.c <<EOCP
15325 #include <math.h>
15326 #include <stdio.h>
15327 EOCP
15328 if $test "X$d_modflproto" != "X$define"; then
15329         $cat >>try.c <<EOCP
15330 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15331 long double modfl (long double, long double *);
15332 EOCP
15333 fi
15334 $cat >>try.c <<EOCP
15335 int main() {
15336     long double nv = 4294967303.15;
15337     long double v, w;
15338     v = modfl(nv, &w);
15339 #ifdef __GLIBC__
15340     printf("glibc");
15341 #endif
15342     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15343     return 0;
15344 }
15345 EOCP
15346         case "$osname:$gccversion" in
15347         aix:)   saveccflags="$ccflags"
15348                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15349         esac
15350         set try
15351         if eval $compile; then
15352                 foo=`$run ./try`
15353                 case "$foo" in
15354                 *" 4294967303.150000 1.150000 4294967302.000000")
15355                         echo >&4 "Your modfl() is broken for large values."
15356                         d_modfl_pow32_bug="$define"
15357                         case "$foo" in
15358                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15359                         ;;
15360                         esac
15361                         ;;
15362                 *" 4294967303.150000 0.150000 4294967303.000000")
15363                         echo >&4 "Your modfl() seems okay for large values."
15364                         ;;
15365                 *)      echo >&4 "I don't understand your modfl() at all."
15366                         d_modfl="$undef"
15367                         ;;
15368                 esac
15369                 $rm_try
15370         else
15371                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15372                 d_modfl="$undef"
15373         fi
15374         case "$osname:$gccversion" in
15375         aix:)   ccflags="$saveccflags" ;; # restore
15376         esac
15377         ;;
15378 esac
15379
15380 if $test "$uselongdouble" = "$define"; then
15381     message=""
15382     if $test "$d_sqrtl" != "$define"; then
15383         message="$message sqrtl"
15384     fi
15385     if $test "$d_modfl" != "$define"; then
15386         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15387             echo "You have both aintl and copysignl, so I can emulate modfl."
15388         else
15389             message="$message modfl"
15390         fi
15391     fi
15392     if $test "$d_frexpl" != "$define"; then
15393         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15394             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15395         else
15396             message="$message frexpl"
15397         fi
15398     fi
15399
15400     if $test "$message" != ""; then
15401         $cat <<EOM >&4
15402
15403 *** You requested the use of long doubles but you do not seem to have
15404 *** the following mathematical functions needed for long double support:
15405 ***    $message
15406 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15407 *** Cannot continue, aborting.
15408
15409 EOM
15410
15411         exit 1
15412     fi
15413 fi
15414
15415 : see if mprotect exists
15416 set mprotect d_mprotect
15417 eval $inlibc
15418
15419 : see if msgctl exists
15420 set msgctl d_msgctl
15421 eval $inlibc
15422
15423 : see if msgget exists
15424 set msgget d_msgget
15425 eval $inlibc
15426
15427 : see if msgsnd exists
15428 set msgsnd d_msgsnd
15429 eval $inlibc
15430
15431 : see if msgrcv exists
15432 set msgrcv d_msgrcv
15433 eval $inlibc
15434
15435 : see how much of the 'msg*(2)' library is present.
15436 h_msg=true
15437 echo " "
15438 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15439 *"$undef"*) h_msg=false;;
15440 esac
15441 case "$osname" in
15442 freebsd)
15443     case "`ipcs 2>&1`" in
15444     "SVID messages"*"not configured"*)
15445         echo "Your $osname does not have the msg*(2) configured." >&4
15446         h_msg=false
15447         val="$undef"
15448         set msgctl d_msgctl
15449         eval $setvar
15450         set msgget d_msgget
15451         eval $setvar
15452         set msgsnd d_msgsnd
15453         eval $setvar
15454         set msgrcv d_msgrcv
15455         eval $setvar
15456         ;;
15457     esac
15458     ;;
15459 esac
15460 : we could also check for sys/ipc.h ...
15461 if $h_msg && $test `./findhdr sys/msg.h`; then
15462         echo "You have the full msg*(2) library." >&4
15463         val="$define"
15464 else
15465         echo "You don't have the full msg*(2) library." >&4
15466         val="$undef"
15467 fi
15468 set d_msg
15469 eval $setvar
15470
15471 : Check for msghdr_s
15472 echo " "
15473 echo "Checking to see if your system supports struct msghdr..." >&4
15474 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15475 eval $hasstruct
15476 case "$d_msghdr_s" in
15477 "$define")      echo "Yes, it does."   ;;
15478 *)              echo "No, it doesn't." ;;
15479 esac
15480
15481
15482 : see if msync exists
15483 set msync d_msync
15484 eval $inlibc
15485
15486 : see if munmap exists
15487 set munmap d_munmap
15488 eval $inlibc
15489
15490 : see if nice exists
15491 set nice d_nice
15492 eval $inlibc
15493
15494 : see if this is a langinfo.h system
15495 set langinfo.h i_langinfo
15496 eval $inhdr
15497
15498 : see if nl_langinfo exists
15499 set nl_langinfo d_nl_langinfo
15500 eval $inlibc
15501
15502 : check for volatile keyword
15503 echo " "
15504 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15505 $cat >try.c <<'EOCP'
15506 int main()
15507 {
15508         typedef struct _goo_struct goo_struct;
15509         goo_struct * volatile goo = ((goo_struct *)0);
15510         struct _goo_struct {
15511                 long long_int;
15512                 int reg_int;
15513                 char char_var;
15514         };
15515         typedef unsigned short foo_t;
15516         char *volatile foo;
15517         volatile int bar;
15518         volatile foo_t blech;
15519         foo = foo;
15520 }
15521 EOCP
15522 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15523         val="$define"
15524         echo "Yup, it does."
15525 else
15526         val="$undef"
15527         echo "Nope, it doesn't."
15528 fi
15529 set d_volatile
15530 eval $setvar
15531 $rm_try
15532
15533 : Check basic sizes
15534 echo " "
15535 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15536
15537 case "$use64bitint:$d_quad:$quadtype" in
15538 define:define:?*)
15539         ivtype="$quadtype"
15540         uvtype="$uquadtype"
15541         ivsize=8
15542         uvsize=8
15543         ;;
15544 *)      ivtype="long"
15545         uvtype="unsigned long"
15546         ivsize=$longsize
15547         uvsize=$longsize
15548         ;;
15549 esac
15550
15551 case "$uselongdouble:$d_longdbl" in
15552 define:define)
15553         nvtype="long double"
15554         nvsize=$longdblsize
15555         ;;
15556 *)      nvtype=double
15557         nvsize=$doublesize
15558         ;;
15559 esac
15560
15561 $echo "(IV will be "$ivtype", $ivsize bytes)"
15562 $echo "(UV will be "$uvtype", $uvsize bytes)"
15563 $echo "(NV will be "$nvtype", $nvsize bytes)"
15564
15565 $cat >try.c <<EOCP
15566 #$i_inttypes I_INTTYPES
15567 #ifdef I_INTTYPES
15568 #include <inttypes.h>
15569 #endif
15570 #include <stdio.h>
15571 int main() {
15572 #ifdef INT8
15573    int8_t i =  INT8_MAX;
15574   uint8_t u = UINT8_MAX;
15575   printf("int8_t\n");
15576 #endif
15577 #ifdef INT16
15578    int16_t i =  INT16_MAX;
15579   uint16_t i = UINT16_MAX;
15580   printf("int16_t\n");
15581 #endif
15582 #ifdef INT32
15583    int32_t i =  INT32_MAX;
15584   uint32_t u = UINT32_MAX;
15585   printf("int32_t\n");
15586 #endif
15587 }
15588 EOCP
15589
15590 i8type="signed char"
15591 u8type="unsigned char"
15592 i8size=1
15593 u8size=1
15594
15595 case "$i16type" in
15596 '')     case "$shortsize" in
15597         2)      i16type=short
15598                 u16type="unsigned short"
15599                 i16size=$shortsize
15600                 u16size=$shortsize
15601                 ;;
15602         esac
15603         ;;
15604 esac
15605 case "$i16type" in
15606 '')     set try -DINT16
15607         if eval $compile; then
15608                 case "`$run ./try`" in
15609                 int16_t)
15610                         i16type=int16_t
15611                         u16type=uint16_t
15612                         i16size=2
15613                         u16size=2
15614                         ;;
15615                 esac
15616         fi
15617         ;;
15618 esac
15619 case "$i16type" in
15620 '')     if $test $shortsize -ge 2; then
15621                 i16type=short
15622                 u16type="unsigned short"
15623                 i16size=$shortsize
15624                 u16size=$shortsize
15625         fi
15626         ;;
15627 esac
15628
15629 case "$i32type" in
15630 '')     case "$longsize" in
15631         4)      i32type=long
15632                 u32type="unsigned long"
15633                 i32size=$longsize
15634                 u32size=$longsize
15635                 ;;
15636         *)      case "$intsize" in
15637                 4)      i32type=int
15638                         u32type="unsigned int"
15639                         i32size=$intsize
15640                         u32size=$intsize
15641                         ;;
15642                 esac
15643                 ;;
15644         esac
15645         ;;
15646 esac
15647 case "$i32type" in
15648 '')     set try -DINT32
15649         if eval $compile; then
15650                 case "`$run ./try`" in
15651                 int32_t)
15652                         i32type=int32_t
15653                         u32type=uint32_t
15654                         i32size=4
15655                         u32size=4
15656                         ;;
15657                 esac
15658         fi
15659         ;;
15660 esac
15661 case "$i32type" in
15662 '')     if $test $intsize -ge 4; then
15663                 i32type=int
15664                 u32type="unsigned int"
15665                 i32size=$intsize
15666                 u32size=$intsize
15667         fi
15668         ;;
15669 esac
15670
15671 case "$i64type" in
15672 '')     case "$d_quad:$quadtype" in
15673         define:?*)
15674                 i64type="$quadtype"
15675                 u64type="$uquadtype"
15676                 i64size=8
15677                 u64size=8
15678                 ;;
15679         esac
15680         ;;
15681 esac
15682
15683 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15684 : volatile so that the compiler has to store it out to memory.
15685 if test X"$d_volatile" = X"$define"; then
15686         volatile=volatile
15687 fi
15688 $cat <<EOP >try.c
15689 #include <stdio.h>
15690 #$i_stdlib I_STDLIB
15691 #ifdef I_STDLIB
15692 #include <stdlib.h>
15693 #endif
15694 #include <sys/types.h>
15695 #include <signal.h>
15696 #ifdef SIGFPE
15697 $volatile int bletched = 0;
15698 $signal_t blech(int s) { bletched = 1; }
15699 #endif
15700 int main() {
15701     $uvtype u = 0;
15702     $nvtype d;
15703     int     n = 8 * $uvsize;
15704     int     i;
15705 #ifdef SIGFPE
15706     signal(SIGFPE, blech);
15707 #endif
15708
15709     for (i = 0; i < n; i++) {
15710       u = u << 1 | ($uvtype)1;
15711       d = ($nvtype)u;
15712       if (($uvtype)d != u)
15713         break;
15714       if (d <= 0)
15715         break;
15716       d = ($nvtype)(u - 1);
15717       if (($uvtype)d != (u - 1))
15718         break;
15719 #ifdef SIGFPE
15720       if (bletched)
15721         break;
15722 #endif
15723     }
15724     printf("%d\n", ((i == n) ? -n : i));
15725     exit(0);
15726 }
15727 EOP
15728 set try
15729
15730 d_nv_preserves_uv="$undef"
15731 if eval $compile; then
15732         nv_preserves_uv_bits="`$run ./try`"
15733 fi
15734 case "$nv_preserves_uv_bits" in
15735 \-[1-9]*)
15736         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15737         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15738         d_nv_preserves_uv="$define"
15739         ;;
15740 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15741         d_nv_preserves_uv="$undef" ;;
15742 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15743         nv_preserves_uv_bits="0" ;;
15744 esac
15745 $rm_try
15746
15747 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15748 : volatile so that the compiler has to store it out to memory.
15749 if test X"$d_volatile" = X"$define"; then
15750         volatile=volatile
15751 fi
15752 $cat <<EOP >try.c
15753 #include <stdio.h>
15754
15755 typedef $nvtype NV;
15756
15757 int
15758 main() {
15759   NV value = 2;
15760   int count = 1;
15761
15762   while(count < 256) {
15763     $volatile NV up = value + 1.0;
15764     $volatile NV negated = -value;
15765     $volatile NV down = negated - 1.0;
15766     $volatile NV got_up = up - value;
15767     int up_good = got_up == 1.0;
15768     int got_down = down - negated;
15769     int down_good = got_down == -1.0;
15770
15771     if (down_good != up_good) {
15772       fprintf(stderr,
15773               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15774               up_good, (double) got_up, down_good, (double) got_down,
15775               count, (double) value);
15776       return 1;
15777     }
15778     if (!up_good) {
15779       while (1) {
15780         if (count > 8) {
15781           count -= 8;
15782           fputs("256.0", stdout);
15783         } else {
15784           count--;
15785           fputs("2.0", stdout);
15786         }
15787         if (!count) {
15788           puts("");
15789           return 0;
15790         }
15791         fputs("*", stdout);
15792       }
15793     }
15794     value *= 2;
15795     ++count;
15796   }
15797   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15798           count, (double) value);
15799   return 1;
15800 }
15801 EOP
15802 set try
15803
15804 nv_overflows_integers_at='0'
15805 if eval $compile; then
15806     xxx="`$run ./try`"
15807     case "$?" in
15808         0)
15809             case "$xxx" in
15810                 2*)  cat >&4 <<EOM
15811 The largest integer your NVs can preserve is equal to $xxx
15812 EOM
15813                     nv_overflows_integers_at="$xxx"
15814                     ;;
15815                 *)  cat >&4 <<EOM
15816 Cannot determine the largest integer value your NVs can hold, unexpected output
15817 '$xxx'
15818 EOM
15819                     ;;
15820             esac
15821             ;;
15822         *)  cat >&4 <<EOM
15823 Cannot determine the largest integer value your NVs can hold
15824 EOM
15825             ;;
15826     esac
15827 fi
15828 $rm_try
15829
15830 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15831 : volatile so that the compiler has to store it out to memory.
15832 if test X"$d_volatile" = X"$define"; then
15833         volatile=volatile
15834 fi
15835 $cat <<EOP >try.c
15836 #include <stdio.h>
15837 #$i_stdlib I_STDLIB
15838 #ifdef I_STDLIB
15839 #include <stdlib.h>
15840 #endif
15841 #$i_string I_STRING
15842 #ifdef I_STRING
15843 #  include <string.h>
15844 #else
15845 #  include <strings.h>
15846 #endif
15847 #include <sys/types.h>
15848 #include <signal.h>
15849 #ifdef SIGFPE
15850 $volatile int bletched = 0;
15851 $signal_t blech(int s) { bletched = 1; }
15852 #endif
15853
15854 int checkit($nvtype d, char *where) {
15855     unsigned char *p = (char *)&d;
15856     unsigned char *end = p + sizeof(d);
15857     int fail = 0;
15858
15859     while (p < end)
15860         fail += *p++;
15861
15862     if (!fail)
15863         return 0;
15864
15865     p = (char *)&d;
15866     printf("No - %s: 0x", where);
15867     while (p < end)
15868         printf ("%02X", *p++);
15869     printf("\n");
15870     return 1;
15871 }
15872
15873 int main(int argc, char **argv) {
15874     $nvtype d = 0.0;
15875     int fail = 0;
15876     fail += checkit(d, "0.0");
15877
15878     /* The compiler shouldn't be assuming that bletched is 0  */
15879     d = bletched;
15880
15881     fail += checkit(d, "bleched");
15882
15883 #ifdef SIGFPE
15884     signal(SIGFPE, blech);
15885 #endif
15886
15887     /* Paranoia - the compiler should have no way of knowing that ANSI says
15888        that argv[argc] will always be NULL.  Actually, if it did assume this it
15889        would be buggy, as this is C and main() can be called from elsewhere in
15890        the program.  */
15891     d = argv[argc] ? 1 : 0;
15892
15893     if (d) {
15894         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15895     }
15896
15897     fail += checkit(d, "ternary");
15898
15899     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15900
15901     if (d != 0.0) {
15902         printf("No - memset doesn't give 0.0\n");
15903         /* This might just blow up:  */
15904         printf("(gives %g)\n", d);
15905         return 1;
15906     }
15907
15908 #ifdef SIGFPE
15909     if (bletched) {
15910         printf("No - something bleched\n");
15911         return 1;
15912     }
15913 #endif
15914     if (fail) {
15915       printf("No - %d fail(s)\n", fail);
15916       return 1;
15917     }
15918     printf("Yes\n");
15919     return 0;
15920 }
15921 EOP
15922 set try
15923
15924 d_nv_zero_is_allbits_zero="$undef"
15925 if eval $compile; then
15926     xxx="`$run ./try`"
15927     case "$?" in
15928         0)
15929             case "$xxx" in
15930                 Yes)  cat >&4 <<EOM
15931 0.0 is represented as all bits zero in memory
15932 EOM
15933                     d_nv_zero_is_allbits_zero="$define"
15934                     ;;
15935                 *)  cat >&4 <<EOM
15936 0.0 is not represented as all bits zero in memory
15937 EOM
15938                     d_nv_zero_is_allbits_zero="$undef"
15939                     ;;
15940             esac
15941             ;;
15942         *)  cat >&4 <<EOM
15943 0.0 is not represented as all bits zero in memory
15944 EOM
15945             d_nv_zero_is_allbits_zero="$undef"
15946             ;;
15947     esac
15948 fi
15949 $rm_try
15950
15951 : check for off64_t
15952 echo " "
15953 echo "Checking to see if you have off64_t..." >&4
15954 $cat >try.c <<EOCP
15955 #include <sys/types.h>
15956 #include <unistd.h>
15957 int main() { off64_t x = 7; }
15958 EOCP
15959 set try
15960 if eval $compile; then
15961         val="$define"
15962         echo "You have off64_t."
15963 else
15964         val="$undef"
15965         echo "You do not have off64_t."
15966         case "$lseeksize" in
15967         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15968         esac
15969 fi
15970 $rm_try
15971 set d_off64_t
15972 eval $setvar
15973
15974 : how to create joinable pthreads
15975 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15976         echo " "
15977         echo "Checking what constant to use for creating joinable pthreads..." >&4
15978         $cat >try.c <<'EOCP'
15979 #include <pthread.h>
15980 int main() {
15981     int detachstate = JOINABLE;
15982 }
15983 EOCP
15984         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15985         if eval $compile; then
15986                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15987                 val="$undef" # Yes, undef.
15988                 set d_old_pthread_create_joinable
15989                 eval $setvar
15990                 val=""
15991                 set old_pthread_create_joinable
15992                 eval $setvar
15993         else
15994                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15995                 if eval $compile; then
15996                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15997                         val="$define"
15998                         set d_old_pthread_create_joinable
15999                         eval $setvar
16000                         val=PTHREAD_CREATE_UNDETACHED
16001                         set old_pthread_create_joinable
16002                         eval $setvar
16003                 else
16004                         set try -DJOINABLE=__UNDETACHED
16005                         if eval $compile; then
16006                                 echo "You seem to use __UNDETACHED." >&4
16007                                 val="$define"
16008                                 set d_old_pthread_create_joinable
16009                                 eval $setvar
16010                                 val=__UNDETACHED
16011                                 set old_pthread_create_joinable
16012                                 eval $setvar
16013                         else
16014                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16015                                 val="$define"
16016                                 set d_old_pthread_create_joinable
16017                                 eval $setvar
16018                                 val=0
16019                                 set old_pthread_create_joinable
16020                                 eval $setvar
16021                         fi
16022                 fi
16023         fi
16024         $rm_try
16025 else
16026     d_old_pthread_create_joinable="$undef"
16027     old_pthread_create_joinable=""
16028 fi
16029
16030 : see if pause exists
16031 set pause d_pause
16032 eval $inlibc
16033
16034 : see if poll exists
16035 set poll d_poll
16036 eval $inlibc
16037
16038 : see if readlink exists
16039 set readlink d_readlink
16040 eval $inlibc
16041
16042 : Check if exe is symlink to abs path of executing program
16043 echo " "
16044 procselfexe=''
16045 val="$undef"
16046 case "$d_readlink" in
16047 "$define")
16048         if $issymlink /proc/self/exe ; then
16049                 $ls -l /proc/self/exe > reflect
16050                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16051                         echo "You have Linux-like /proc/self/exe."
16052                         procselfexe='"/proc/self/exe"'
16053                         val="$define"
16054                 fi
16055         fi
16056         if $issymlink /proc/curproc/file ; then
16057                 $ls -l /proc/curproc/file > reflect
16058                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16059                         echo "You have BSD-like /proc/curproc/file."
16060                         procselfexe='"/proc/curproc/file"'
16061                         val="$define"
16062                 fi
16063         fi
16064         ;;
16065 esac
16066 $rm -f reflect
16067 set d_procselfexe
16068 eval $setvar
16069
16070 : backward compatibility for d_hvfork
16071 if test X$d_hvfork != X; then
16072         d_vfork="$d_hvfork"
16073         d_hvfork=''
16074 fi
16075 : see if there is a vfork
16076 val=''
16077 set vfork val
16078 eval $inlibc
16079
16080 d_pseudofork=$undef
16081
16082 : Ok, but do we want to use it. vfork is reportedly unreliable in
16083 : perl on Solaris 2.x, and probably elsewhere.
16084 case "$val" in
16085 $define)
16086         echo " "
16087         case "$usevfork" in
16088         false) dflt='n';;
16089         *) dflt='y';;
16090         esac
16091         cat <<'EOM'
16092
16093 Perl can only use a vfork() that doesn't suffer from strict
16094 restrictions on calling functions or modifying global data in
16095 the child.  For example, glibc-2.1 contains such a vfork()
16096 that is unsuitable.  If your system provides a proper fork()
16097 call, chances are that you do NOT want perl to use vfork().
16098
16099 EOM
16100         rp="Do you still want to use vfork()?"
16101         . ./myread
16102         case "$ans" in
16103         y|Y) ;;
16104         *)
16105                 echo "Ok, we won't use vfork()."
16106                 val="$undef"
16107                 ;;
16108         esac
16109         ;;
16110 esac
16111 set d_vfork
16112 eval $setvar
16113 case "$d_vfork" in
16114 $define) usevfork='true';;
16115 *) usevfork='false';;
16116 esac
16117
16118 : see whether the pthread_atfork exists
16119 $cat >try.c <<EOP
16120 #include <pthread.h>
16121 #include <stdio.h>
16122 int main() {
16123 #ifdef  PTHREAD_ATFORK
16124         pthread_atfork(NULL,NULL,NULL);
16125 #endif
16126 }
16127 EOP
16128
16129 : see if pthread_atfork exists
16130 set try -DPTHREAD_ATFORK
16131 if eval $compile; then
16132     val="$define"
16133 else
16134     val="$undef"
16135 fi
16136 case "$usethreads" in
16137 $define)
16138         case "$val" in
16139         $define) echo 'pthread_atfork found.' >&4        ;;
16140         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16141         esac
16142 esac
16143 set d_pthread_atfork
16144 eval $setvar
16145
16146 : see if pthread_attr_setscope exists
16147 set pthread_attr_setscope d_pthread_attr_setscope
16148 eval $inlibc
16149
16150 : see whether the various POSIXish _yields exist
16151 $cat >try.c <<EOP
16152 #include <pthread.h>
16153 #include <stdio.h>
16154 int main() {
16155 #ifdef SCHED_YIELD
16156         sched_yield();
16157 #else
16158 #ifdef PTHREAD_YIELD
16159         pthread_yield();
16160 #else
16161 #ifdef PTHREAD_YIELD_NULL
16162         pthread_yield(NULL);
16163 #endif
16164 #endif
16165 #endif
16166 }
16167 EOP
16168 : see if sched_yield exists
16169 set try -DSCHED_YIELD
16170 if eval $compile; then
16171     val="$define"
16172     sched_yield='sched_yield()'
16173 else
16174     val="$undef"
16175 fi
16176 case "$usethreads" in
16177 $define)
16178         case "$val" in
16179         $define) echo 'sched_yield() found.' >&4        ;;
16180         *)       echo 'sched_yield() NOT found.' >&4    ;;
16181         esac
16182 esac
16183 set d_sched_yield
16184 eval $setvar
16185
16186 : see if pthread_yield exists
16187 set try -DPTHREAD_YIELD
16188 if eval $compile; then
16189     val="$define"
16190     case "$sched_yield" in
16191     '') sched_yield='pthread_yield()' ;;
16192     esac
16193 else
16194     set try -DPTHREAD_YIELD_NULL
16195     if eval $compile; then
16196         val="$define"
16197         case "$sched_yield" in
16198         '') sched_yield='pthread_yield(NULL)' ;;
16199         esac
16200     else
16201         val="$undef"
16202     fi
16203 fi
16204 case "$usethreads" in
16205 $define)
16206         case "$val" in
16207         $define) echo 'pthread_yield() found.' >&4      ;;
16208         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16209         esac
16210         ;;
16211 esac
16212 set d_pthread_yield
16213 eval $setvar
16214 case "$sched_yield" in
16215 '') sched_yield=undef ;;
16216 esac
16217 $rm_try
16218
16219 : see if random_r exists
16220 set random_r d_random_r
16221 eval $inlibc
16222 case "$d_random_r" in
16223 "$define")
16224         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16225         case "$d_random_r_proto:$usethreads" in
16226         ":define")      d_random_r_proto=define
16227                 set d_random_r_proto random_r $hdrs
16228                 eval $hasproto ;;
16229         *)      ;;
16230         esac
16231         case "$d_random_r_proto" in
16232         define)
16233         case "$random_r_proto" in
16234         ''|0) try='int random_r(int*, struct random_data*);'
16235         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16236         esac
16237         case "$random_r_proto" in
16238         ''|0) try='int random_r(long*, struct random_data*);'
16239         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16240         esac
16241         case "$random_r_proto" in
16242         ''|0) try='int random_r(struct random_data*, int32_t*);'
16243         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16244         esac
16245         case "$random_r_proto" in
16246         ''|0)   d_random_r=undef
16247                 random_r_proto=0
16248                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16249         * )     case "$random_r_proto" in
16250                 REENTRANT_PROTO*) ;;
16251                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16252                 esac
16253                 echo "Prototype: $try" ;;
16254         esac
16255         ;;
16256         *)      case "$usethreads" in
16257                 define) echo "random_r has no prototype, not using it." >&4 ;;
16258                 esac
16259                 d_random_r=undef
16260                 random_r_proto=0
16261                 ;;
16262         esac
16263         ;;
16264 *)      random_r_proto=0
16265         ;;
16266 esac
16267
16268 : see if readdir and friends exist
16269 set readdir d_readdir
16270 eval $inlibc
16271 set seekdir d_seekdir
16272 eval $inlibc
16273 set telldir d_telldir
16274 eval $inlibc
16275 set rewinddir d_rewinddir
16276 eval $inlibc
16277
16278 : see if readdir64_r exists
16279 set readdir64_r d_readdir64_r
16280 eval $inlibc
16281 case "$d_readdir64_r" in
16282 "$define")
16283         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16284         case "$d_readdir64_r_proto:$usethreads" in
16285         ":define")      d_readdir64_r_proto=define
16286                 set d_readdir64_r_proto readdir64_r $hdrs
16287                 eval $hasproto ;;
16288         *)      ;;
16289         esac
16290         case "$d_readdir64_r_proto" in
16291         define)
16292         case "$readdir64_r_proto" in
16293         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16294         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16295         esac
16296         case "$readdir64_r_proto" in
16297         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16298         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16299         esac
16300         case "$readdir64_r_proto" in
16301         ''|0)   d_readdir64_r=undef
16302                 readdir64_r_proto=0
16303                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16304         * )     case "$readdir64_r_proto" in
16305                 REENTRANT_PROTO*) ;;
16306                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16307                 esac
16308                 echo "Prototype: $try" ;;
16309         esac
16310         ;;
16311         *)      case "$usethreads" in
16312                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16313                 esac
16314                 d_readdir64_r=undef
16315                 readdir64_r_proto=0
16316                 ;;
16317         esac
16318         ;;
16319 *)      readdir64_r_proto=0
16320         ;;
16321 esac
16322
16323 : see if readdir_r exists
16324 set readdir_r d_readdir_r
16325 eval $inlibc
16326 case "$d_readdir_r" in
16327 "$define")
16328         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16329         case "$d_readdir_r_proto:$usethreads" in
16330         ":define")      d_readdir_r_proto=define
16331                 set d_readdir_r_proto readdir_r $hdrs
16332                 eval $hasproto ;;
16333         *)      ;;
16334         esac
16335         case "$d_readdir_r_proto" in
16336         define)
16337         case "$readdir_r_proto" in
16338         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16339         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16340         esac
16341         case "$readdir_r_proto" in
16342         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16343         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16344         esac
16345         case "$readdir_r_proto" in
16346         ''|0)   d_readdir_r=undef
16347                 readdir_r_proto=0
16348                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16349         * )     case "$readdir_r_proto" in
16350                 REENTRANT_PROTO*) ;;
16351                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16352                 esac
16353                 echo "Prototype: $try" ;;
16354         esac
16355         ;;
16356         *)      case "$usethreads" in
16357                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16358                 esac
16359                 d_readdir_r=undef
16360                 readdir_r_proto=0
16361                 ;;
16362         esac
16363         ;;
16364 *)      readdir_r_proto=0
16365         ;;
16366 esac
16367
16368 : see if readv exists
16369 set readv d_readv
16370 eval $inlibc
16371
16372 : see if recvmsg exists
16373 set recvmsg d_recvmsg
16374 eval $inlibc
16375
16376 : see if rename exists
16377 set rename d_rename
16378 eval $inlibc
16379
16380 : see if rmdir exists
16381 set rmdir d_rmdir
16382 eval $inlibc
16383
16384 : see if memory.h is available.
16385 val=''
16386 set memory.h val
16387 eval $inhdr
16388
16389 : See if it conflicts with string.h
16390 case "$val" in
16391 $define)
16392         case "$strings" in
16393         '') ;;
16394         *)
16395                 $cppstdin $cppflags $cppminus < $strings > mem.h
16396                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16397                         echo " "
16398                         echo "We won't be including <memory.h>."
16399                         val="$undef"
16400                 fi
16401                 $rm -f mem.h
16402                 ;;
16403         esac
16404 esac
16405 set i_memory
16406 eval $setvar
16407
16408 : can bcopy handle overlapping blocks?
16409 echo " "
16410 val="$undef"
16411 case "$d_memmove" in
16412 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16413 *)      case "$d_bcopy" in
16414         "$define")
16415                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16416                 $cat >try.c <<EOCP
16417 #$i_memory I_MEMORY
16418 #$i_stdlib I_STDLIB
16419 #$i_string I_STRING
16420 #$i_unistd I_UNISTD
16421 EOCP
16422         $cat >>try.c <<'EOCP'
16423 #include <stdio.h>
16424 #ifdef I_MEMORY
16425 #  include <memory.h>
16426 #endif
16427 #ifdef I_STDLIB
16428 #  include <stdlib.h>
16429 #endif
16430 #ifdef I_STRING
16431 #  include <string.h>
16432 #else
16433 #  include <strings.h>
16434 #endif
16435 #ifdef I_UNISTD
16436 #  include <unistd.h>  /* Needed for NetBSD */
16437 #endif
16438 int main()
16439 {
16440 char buf[128], abc[128];
16441 char *b;
16442 int len;
16443 int off;
16444 int align;
16445
16446 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16447    try to store the string in read-only memory. */
16448 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16449
16450 for (align = 7; align >= 0; align--) {
16451         for (len = 36; len; len--) {
16452                 b = buf+align;
16453                 bcopy(abc, b, len);
16454                 for (off = 1; off <= len; off++) {
16455                         bcopy(b, b+off, len);
16456                         bcopy(b+off, b, len);
16457                         if (bcmp(b, abc, len))
16458                                 exit(1);
16459                 }
16460         }
16461 }
16462 exit(0);
16463 }
16464 EOCP
16465                 set try
16466                 if eval $compile_ok; then
16467                         if $run ./try 2>/dev/null; then
16468                                 echo "Yes, it can."
16469                                 val="$define"
16470                         else
16471                                 echo "It can't, sorry."
16472                         fi
16473                 else
16474                         echo "(I can't compile the test program, so we'll assume not...)"
16475                 fi
16476                 ;;
16477         esac
16478         $rm_try
16479         ;;
16480 esac
16481 set d_safebcpy
16482 eval $setvar
16483
16484 : can memcpy handle overlapping blocks?
16485 echo " "
16486 val="$undef"
16487 case "$d_memmove" in
16488 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16489 *)      case "$d_memcpy" in
16490         "$define")
16491                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16492                 $cat >try.c <<EOCP
16493 #$i_memory I_MEMORY
16494 #$i_stdlib I_STDLIB
16495 #$i_string I_STRING
16496 #$i_unistd I_UNISTD
16497 EOCP
16498         $cat >>try.c <<'EOCP'
16499 #include <stdio.h>
16500 #ifdef I_MEMORY
16501 #  include <memory.h>
16502 #endif
16503 #ifdef I_STDLIB
16504 #  include <stdlib.h>
16505 #endif
16506 #ifdef I_STRING
16507 #  include <string.h>
16508 #else
16509 #  include <strings.h>
16510 #endif
16511 #ifdef I_UNISTD
16512 #  include <unistd.h>  /* Needed for NetBSD */
16513 #endif
16514 int main()
16515 {
16516 char buf[128], abc[128];
16517 char *b;
16518 int len;
16519 int off;
16520 int align;
16521
16522 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16523    try to store the string in read-only memory. */
16524 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16525
16526 for (align = 7; align >= 0; align--) {
16527         for (len = 36; len; len--) {
16528                 b = buf+align;
16529                 memcpy(b, abc, len);
16530                 for (off = 1; off <= len; off++) {
16531                         memcpy(b+off, b, len);
16532                         memcpy(b, b+off, len);
16533                         if (memcmp(b, abc, len))
16534                                 exit(1);
16535                 }
16536         }
16537 }
16538 exit(0);
16539 }
16540 EOCP
16541                 set try
16542                 if eval $compile_ok; then
16543                         if $run ./try 2>/dev/null; then
16544                                 echo "Yes, it can."
16545                                 val="$define"
16546                         else
16547                                 echo "It can't, sorry."
16548                         fi
16549                 else
16550                         echo "(I can't compile the test program, so we'll assume not...)"
16551                 fi
16552                 ;;
16553         esac
16554         $rm_try
16555         ;;
16556 esac
16557 set d_safemcpy
16558 eval $setvar
16559
16560 : can memcmp be trusted to compare relative magnitude?
16561 val="$undef"
16562 case "$d_memcmp" in
16563 "$define")
16564         echo " "
16565         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16566         $cat >try.c <<EOCP
16567 #$i_memory I_MEMORY
16568 #$i_stdlib I_STDLIB
16569 #$i_string I_STRING
16570 #$i_unistd I_UNISTD
16571 EOCP
16572         $cat >>try.c <<'EOCP'
16573 #include <stdio.h>
16574 #ifdef I_MEMORY
16575 #  include <memory.h>
16576 #endif
16577 #ifdef I_STDLIB
16578 #  include <stdlib.h>
16579 #endif
16580 #ifdef I_STRING
16581 #  include <string.h>
16582 #else
16583 #  include <strings.h>
16584 #endif
16585 #ifdef I_UNISTD
16586 #  include <unistd.h>  /* Needed for NetBSD */
16587 #endif
16588 int main()
16589 {
16590 char a = -1;
16591 char b = 0;
16592 if ((a < b) && memcmp(&a, &b, 1) < 0)
16593         exit(1);
16594 exit(0);
16595 }
16596 EOCP
16597         set try
16598         if eval $compile_ok; then
16599                 if $run ./try 2>/dev/null; then
16600                         echo "Yes, it can."
16601                         val="$define"
16602                 else
16603                         echo "No, it can't (it uses signed chars)."
16604                 fi
16605         else
16606                 echo "(I can't compile the test program, so we'll assume not...)"
16607         fi
16608         ;;
16609 esac
16610 $rm_try
16611 set d_sanemcmp
16612 eval $setvar
16613
16614 : see if prototype for sbrk is available
16615 echo " "
16616 set d_sbrkproto sbrk $i_unistd unistd.h
16617 eval $hasproto
16618
16619 : see if select exists
16620 set select d_select
16621 eval $inlibc
16622
16623 : see if semctl exists
16624 set semctl d_semctl
16625 eval $inlibc
16626
16627 : see if semget exists
16628 set semget d_semget
16629 eval $inlibc
16630
16631 : see if semop exists
16632 set semop d_semop
16633 eval $inlibc
16634
16635 : see how much of the 'sem*(2)' library is present.
16636 h_sem=true
16637 echo " "
16638 case "$d_semctl$d_semget$d_semop" in
16639 *"$undef"*) h_sem=false;;
16640 esac
16641 case "$osname" in
16642 freebsd)
16643     case "`ipcs 2>&1`" in
16644     "SVID messages"*"not configured"*)
16645         echo "Your $osname does not have the sem*(2) configured." >&4
16646         h_sem=false
16647         val="$undef"
16648         set semctl d_semctl
16649         eval $setvar
16650         set semget d_semget
16651         eval $setvar
16652         set semop d_semop
16653         eval $setvar
16654         ;;
16655     esac
16656     ;;
16657 esac
16658 : we could also check for sys/ipc.h ...
16659 if $h_sem && $test `./findhdr sys/sem.h`; then
16660         echo "You have the full sem*(2) library." >&4
16661         val="$define"
16662 else
16663         echo "You don't have the full sem*(2) library." >&4
16664         val="$undef"
16665 fi
16666 set d_sem
16667 eval $setvar
16668
16669 : see whether sys/sem.h defines union semun
16670 echo " "
16671 $cat > try.c <<'END'
16672 #include <sys/types.h>
16673 #include <sys/ipc.h>
16674 #include <sys/sem.h>
16675 int main () { union semun semun; semun.buf = 0; }
16676 END
16677 set try
16678 if eval $compile; then
16679     echo "You have union semun in <sys/sem.h>." >&4
16680     val="$define"
16681 else
16682     echo "You do not have union semun in <sys/sem.h>." >&4
16683     val="$undef"
16684 fi
16685 $rm_try
16686 set d_union_semun
16687 eval $setvar
16688
16689 : see how to do semctl IPC_STAT
16690 case "$d_sem" in
16691 $define)
16692     echo " "
16693     $cat > tryh.h <<END
16694 #ifndef S_IRUSR
16695 #   ifdef S_IREAD
16696 #       define S_IRUSR S_IREAD
16697 #       define S_IWUSR S_IWRITE
16698 #       define S_IXUSR S_IEXEC
16699 #   else
16700 #       define S_IRUSR 0400
16701 #       define S_IWUSR 0200
16702 #       define S_IXUSR 0100
16703 #   endif
16704 #   define S_IRGRP (S_IRUSR>>3)
16705 #   define S_IWGRP (S_IWUSR>>3)
16706 #   define S_IXGRP (S_IXUSR>>3)
16707 #   define S_IROTH (S_IRUSR>>6)
16708 #   define S_IWOTH (S_IWUSR>>6)
16709 #   define S_IXOTH (S_IXUSR>>6)
16710 #endif
16711 #ifndef S_IRWXU
16712 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16713 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16714 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16715 #endif
16716 END
16717     : see whether semctl IPC_STAT can use union semun
16718     case "$d_semctl_semun" in
16719     '')
16720       val="$undef"
16721       $cat > try.c <<END
16722 #include <sys/types.h>
16723 #include <sys/ipc.h>
16724 #include <sys/sem.h>
16725 #include <sys/stat.h>
16726 #include <stdio.h>
16727 #include <errno.h>
16728 #include "tryh.h"
16729 #ifndef errno
16730 extern int errno;
16731 #endif
16732 #$d_union_semun HAS_UNION_SEMUN
16733 int main() {
16734     union semun
16735 #ifndef HAS_UNION_SEMUN
16736     {
16737         int val;
16738         struct semid_ds *buf;
16739         unsigned short *array;
16740     }
16741 #endif
16742     arg;
16743     int sem, st;
16744
16745 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16746     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16747     if (sem > -1) {
16748         struct semid_ds argbuf;
16749         arg.buf = &argbuf;
16750 #       ifdef IPC_STAT
16751         st = semctl(sem, 0, IPC_STAT, arg);
16752         if (st == 0)
16753             printf("semun\n");
16754         else
16755 #       endif /* IPC_STAT */
16756             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16757 #       ifdef IPC_RMID
16758         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16759 #       endif /* IPC_RMID */
16760             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16761     } else
16762 #endif /* IPC_PRIVATE && ... */
16763         printf("semget failed: errno = %d\n", errno);
16764   return 0;
16765 }
16766 END
16767       set try
16768       if eval $compile; then
16769           xxx=`$run ./try`
16770           case "$xxx" in
16771           semun) val="$define" ;;
16772           esac
16773       fi
16774       $rm_try
16775       set d_semctl_semun
16776       eval $setvar
16777       ;;
16778     esac
16779     case "$d_semctl_semun" in
16780     $define)
16781         echo "You can use union semun for semctl IPC_STAT." >&4
16782         also='also'
16783         ;;
16784     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16785         also=''
16786         ;;
16787     esac
16788
16789     : see whether semctl IPC_STAT can use struct semid_ds pointer
16790     case "$d_semctl_semid_ds" in
16791     '')
16792       val="$undef"
16793       $cat > try.c <<'END'
16794 #include <sys/types.h>
16795 #include <sys/ipc.h>
16796 #include <sys/sem.h>
16797 #include <sys/stat.h>
16798 #include "tryh.h"
16799 #include <stdio.h>
16800 #include <errno.h>
16801 #ifndef errno
16802 extern int errno;
16803 #endif
16804 int main() {
16805     struct semid_ds arg;
16806     int sem, st;
16807
16808 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16809     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16810     if (sem > -1) {
16811 #       ifdef IPC_STAT
16812         st = semctl(sem, 0, IPC_STAT, &arg);
16813         if (st == 0)
16814             printf("semid_ds\n");
16815         else
16816 #       endif /* IPC_STAT */
16817             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16818 #       ifdef IPC_RMID
16819         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16820 #       endif /* IPC_RMID */
16821             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16822     } else
16823 #endif /* IPC_PRIVATE && ... */
16824         printf("semget failed: errno = %d\n", errno);
16825
16826     return 0;
16827 }
16828 END
16829       set try
16830       if eval $compile; then
16831           xxx=`$run ./try`
16832           case "$xxx" in
16833           semid_ds) val="$define" ;;
16834           esac
16835       fi
16836       $rm_try
16837       set d_semctl_semid_ds
16838       eval $setvar
16839       ;;
16840     esac
16841     case "$d_semctl_semid_ds" in
16842     $define)
16843         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16844         ;;
16845     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16846         ;;
16847     esac
16848     ;;
16849 *)  val="$undef"
16850
16851     # We do not have the full sem*(2) library, so assume we can not
16852     # use either.
16853
16854     set d_semctl_semun
16855     eval $setvar
16856
16857     set d_semctl_semid_ds
16858     eval $setvar
16859     ;;
16860 esac
16861 $rm_try tryh.h
16862
16863 : see if sendmsg exists
16864 set sendmsg d_sendmsg
16865 eval $inlibc
16866
16867 : see if setegid exists
16868 set setegid d_setegid
16869 eval $inlibc
16870
16871 : see if seteuid exists
16872 set seteuid d_seteuid
16873 eval $inlibc
16874
16875 : see if setgrent exists
16876 set setgrent d_setgrent
16877 eval $inlibc
16878
16879 : see if setgrent_r exists
16880 set setgrent_r d_setgrent_r
16881 eval $inlibc
16882 case "$d_setgrent_r" in
16883 "$define")
16884         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16885         case "$d_setgrent_r_proto:$usethreads" in
16886         ":define")      d_setgrent_r_proto=define
16887                 set d_setgrent_r_proto setgrent_r $hdrs
16888                 eval $hasproto ;;
16889         *)      ;;
16890         esac
16891         case "$d_setgrent_r_proto" in
16892         define)
16893         case "$setgrent_r_proto" in
16894         ''|0) try='int setgrent_r(FILE**);'
16895         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16896         esac
16897         case "$setgrent_r_proto" in
16898         ''|0) try='void setgrent_r(FILE**);'
16899         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16900         esac
16901         case "$setgrent_r_proto" in
16902         ''|0)   d_setgrent_r=undef
16903                 setgrent_r_proto=0
16904                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16905         * )     case "$setgrent_r_proto" in
16906                 REENTRANT_PROTO*) ;;
16907                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16908                 esac
16909                 echo "Prototype: $try" ;;
16910         esac
16911         ;;
16912         *)      case "$usethreads" in
16913                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16914                 esac
16915                 d_setgrent_r=undef
16916                 setgrent_r_proto=0
16917                 ;;
16918         esac
16919         ;;
16920 *)      setgrent_r_proto=0
16921         ;;
16922 esac
16923
16924 : see if sethostent exists
16925 set sethostent d_sethent
16926 eval $inlibc
16927
16928 : see if sethostent_r exists
16929 set sethostent_r d_sethostent_r
16930 eval $inlibc
16931 case "$d_sethostent_r" in
16932 "$define")
16933         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16934         case "$d_sethostent_r_proto:$usethreads" in
16935         ":define")      d_sethostent_r_proto=define
16936                 set d_sethostent_r_proto sethostent_r $hdrs
16937                 eval $hasproto ;;
16938         *)      ;;
16939         esac
16940         case "$d_sethostent_r_proto" in
16941         define)
16942         case "$sethostent_r_proto" in
16943         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16944         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16945         esac
16946         case "$sethostent_r_proto" in
16947         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16948         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16949         esac
16950         case "$sethostent_r_proto" in
16951         ''|0)   d_sethostent_r=undef
16952                 sethostent_r_proto=0
16953                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16954         * )     case "$sethostent_r_proto" in
16955                 REENTRANT_PROTO*) ;;
16956                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16957                 esac
16958                 echo "Prototype: $try" ;;
16959         esac
16960         ;;
16961         *)      case "$usethreads" in
16962                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16963                 esac
16964                 d_sethostent_r=undef
16965                 sethostent_r_proto=0
16966                 ;;
16967         esac
16968         ;;
16969 *)      sethostent_r_proto=0
16970         ;;
16971 esac
16972
16973 : see if setitimer exists
16974 set setitimer d_setitimer
16975 eval $inlibc
16976
16977 : see if setlinebuf exists
16978 set setlinebuf d_setlinebuf
16979 eval $inlibc
16980
16981 : see if setlocale exists
16982 set setlocale d_setlocale
16983 eval $inlibc
16984
16985 : see if locale.h is available
16986 set locale.h i_locale
16987 eval $inhdr
16988
16989 : see if setlocale_r exists
16990 set setlocale_r d_setlocale_r
16991 eval $inlibc
16992 case "$d_setlocale_r" in
16993 "$define")
16994         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16995         case "$d_setlocale_r_proto:$usethreads" in
16996         ":define")      d_setlocale_r_proto=define
16997                 set d_setlocale_r_proto setlocale_r $hdrs
16998                 eval $hasproto ;;
16999         *)      ;;
17000         esac
17001         case "$d_setlocale_r_proto" in
17002         define)
17003         case "$setlocale_r_proto" in
17004         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17005         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17006         esac
17007         case "$setlocale_r_proto" in
17008         ''|0)   d_setlocale_r=undef
17009                 setlocale_r_proto=0
17010                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17011         * )     case "$setlocale_r_proto" in
17012                 REENTRANT_PROTO*) ;;
17013                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17014                 esac
17015                 echo "Prototype: $try" ;;
17016         esac
17017         ;;
17018         *)      case "$usethreads" in
17019                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17020                 esac
17021                 d_setlocale_r=undef
17022                 setlocale_r_proto=0
17023                 ;;
17024         esac
17025         ;;
17026 *)      setlocale_r_proto=0
17027         ;;
17028 esac
17029
17030 : see if setnetent exists
17031 set setnetent d_setnent
17032 eval $inlibc
17033
17034 : see if setnetent_r exists
17035 set setnetent_r d_setnetent_r
17036 eval $inlibc
17037 case "$d_setnetent_r" in
17038 "$define")
17039         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17040         case "$d_setnetent_r_proto:$usethreads" in
17041         ":define")      d_setnetent_r_proto=define
17042                 set d_setnetent_r_proto setnetent_r $hdrs
17043                 eval $hasproto ;;
17044         *)      ;;
17045         esac
17046         case "$d_setnetent_r_proto" in
17047         define)
17048         case "$setnetent_r_proto" in
17049         ''|0) try='int setnetent_r(int, struct netent_data*);'
17050         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17051         esac
17052         case "$setnetent_r_proto" in
17053         ''|0) try='void setnetent_r(int, struct netent_data*);'
17054         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17055         esac
17056         case "$setnetent_r_proto" in
17057         ''|0)   d_setnetent_r=undef
17058                 setnetent_r_proto=0
17059                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17060         * )     case "$setnetent_r_proto" in
17061                 REENTRANT_PROTO*) ;;
17062                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17063                 esac
17064                 echo "Prototype: $try" ;;
17065         esac
17066         ;;
17067         *)      case "$usethreads" in
17068                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17069                 esac
17070                 d_setnetent_r=undef
17071                 setnetent_r_proto=0
17072                 ;;
17073         esac
17074         ;;
17075 *)      setnetent_r_proto=0
17076         ;;
17077 esac
17078
17079 : see if setprotoent exists
17080 set setprotoent d_setpent
17081 eval $inlibc
17082
17083 : see if setpgid exists
17084 set setpgid d_setpgid
17085 eval $inlibc
17086
17087 : see if setpgrp2 exists
17088 set setpgrp2 d_setpgrp2
17089 eval $inlibc
17090
17091 : see if setpriority exists
17092 set setpriority d_setprior
17093 eval $inlibc
17094
17095 : see if setproctitle exists
17096 set setproctitle d_setproctitle
17097 eval $inlibc
17098
17099 : see if setprotoent_r exists
17100 set setprotoent_r d_setprotoent_r
17101 eval $inlibc
17102 case "$d_setprotoent_r" in
17103 "$define")
17104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17105         case "$d_setprotoent_r_proto:$usethreads" in
17106         ":define")      d_setprotoent_r_proto=define
17107                 set d_setprotoent_r_proto setprotoent_r $hdrs
17108                 eval $hasproto ;;
17109         *)      ;;
17110         esac
17111         case "$d_setprotoent_r_proto" in
17112         define)
17113         case "$setprotoent_r_proto" in
17114         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17115         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17116         esac
17117         case "$setprotoent_r_proto" in
17118         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17119         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17120         esac
17121         case "$setprotoent_r_proto" in
17122         ''|0)   d_setprotoent_r=undef
17123                 setprotoent_r_proto=0
17124                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17125         * )     case "$setprotoent_r_proto" in
17126                 REENTRANT_PROTO*) ;;
17127                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17128                 esac
17129                 echo "Prototype: $try" ;;
17130         esac
17131         ;;
17132         *)      case "$usethreads" in
17133                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17134                 esac
17135                 d_setprotoent_r=undef
17136                 setprotoent_r_proto=0
17137                 ;;
17138         esac
17139         ;;
17140 *)      setprotoent_r_proto=0
17141         ;;
17142 esac
17143
17144 : see if setpwent exists
17145 set setpwent d_setpwent
17146 eval $inlibc
17147
17148 : see if setpwent_r exists
17149 set setpwent_r d_setpwent_r
17150 eval $inlibc
17151 case "$d_setpwent_r" in
17152 "$define")
17153         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17154         case "$d_setpwent_r_proto:$usethreads" in
17155         ":define")      d_setpwent_r_proto=define
17156                 set d_setpwent_r_proto setpwent_r $hdrs
17157                 eval $hasproto ;;
17158         *)      ;;
17159         esac
17160         case "$d_setpwent_r_proto" in
17161         define)
17162         case "$setpwent_r_proto" in
17163         ''|0) try='int setpwent_r(FILE**);'
17164         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17165         esac
17166         case "$setpwent_r_proto" in
17167         ''|0) try='void setpwent_r(FILE**);'
17168         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17169         esac
17170         case "$setpwent_r_proto" in
17171         ''|0)   d_setpwent_r=undef
17172                 setpwent_r_proto=0
17173                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17174         * )     case "$setpwent_r_proto" in
17175                 REENTRANT_PROTO*) ;;
17176                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17177                 esac
17178                 echo "Prototype: $try" ;;
17179         esac
17180         ;;
17181         *)      case "$usethreads" in
17182                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17183                 esac
17184                 d_setpwent_r=undef
17185                 setpwent_r_proto=0
17186                 ;;
17187         esac
17188         ;;
17189 *)      setpwent_r_proto=0
17190         ;;
17191 esac
17192
17193 : see if setregid exists
17194 set setregid d_setregid
17195 eval $inlibc
17196 set setresgid d_setresgid
17197 eval $inlibc
17198
17199 : see if setreuid exists
17200 set setreuid d_setreuid
17201 eval $inlibc
17202 set setresuid d_setresuid
17203 eval $inlibc
17204
17205 : see if setrgid exists
17206 set setrgid d_setrgid
17207 eval $inlibc
17208
17209 : see if setruid exists
17210 set setruid d_setruid
17211 eval $inlibc
17212
17213 : see if setservent exists
17214 set setservent d_setsent
17215 eval $inlibc
17216
17217 : see if setservent_r exists
17218 set setservent_r d_setservent_r
17219 eval $inlibc
17220 case "$d_setservent_r" in
17221 "$define")
17222         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17223         case "$d_setservent_r_proto:$usethreads" in
17224         ":define")      d_setservent_r_proto=define
17225                 set d_setservent_r_proto setservent_r $hdrs
17226                 eval $hasproto ;;
17227         *)      ;;
17228         esac
17229         case "$d_setservent_r_proto" in
17230         define)
17231         case "$setservent_r_proto" in
17232         ''|0) try='int setservent_r(int, struct servent_data*);'
17233         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17234         esac
17235         case "$setservent_r_proto" in
17236         ''|0) try='void setservent_r(int, struct servent_data*);'
17237         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17238         esac
17239         case "$setservent_r_proto" in
17240         ''|0)   d_setservent_r=undef
17241                 setservent_r_proto=0
17242                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17243         * )     case "$setservent_r_proto" in
17244                 REENTRANT_PROTO*) ;;
17245                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17246                 esac
17247                 echo "Prototype: $try" ;;
17248         esac
17249         ;;
17250         *)      case "$usethreads" in
17251                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17252                 esac
17253                 d_setservent_r=undef
17254                 setservent_r_proto=0
17255                 ;;
17256         esac
17257         ;;
17258 *)      setservent_r_proto=0
17259         ;;
17260 esac
17261
17262 : see if setsid exists
17263 set setsid d_setsid
17264 eval $inlibc
17265
17266 : see if setvbuf exists
17267 set setvbuf d_setvbuf
17268 eval $inlibc
17269
17270 : see if sfio.h is available
17271 set sfio.h i_sfio
17272 eval $inhdr
17273
17274 : see if sfio library is available
17275 case "$i_sfio" in
17276 $define)
17277         val=''
17278         set sfreserve val
17279         eval $inlibc
17280         ;;
17281 *)
17282         val="$undef"
17283         ;;
17284 esac
17285 : Ok, but do we want to use it.
17286 case "$val" in
17287 $define)
17288         case "$usesfio" in
17289         true|$define|[yY]*) dflt='y';;
17290         *) dflt='n';;
17291         esac
17292         echo "$package can use the sfio library, but it is experimental."
17293         case "$useperlio" in
17294         "$undef")
17295             echo "For sfio also the PerlIO abstraction layer is needed."
17296             echo "Earlier you said you wouldn't want that."
17297             ;;
17298         esac
17299         rp="You seem to have sfio available, do you want to try using it?"
17300         . ./myread
17301         case "$ans" in
17302         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17303                 useperlio="$define"
17304                 val="$define"
17305                 ;;
17306         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17307                 val="$undef"
17308                 ;;
17309         esac
17310         ;;
17311 *)      case "$usesfio" in
17312         true|$define|[yY]*)
17313                 echo "Sorry, cannot find sfio on this machine." >&4
17314                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17315                 val="$undef"
17316                 ;;
17317         esac
17318         ;;
17319 esac
17320 set d_sfio
17321 eval $setvar
17322 case "$d_sfio" in
17323 $define) usesfio='true';;
17324 *) usesfio='false';;
17325 esac
17326 case "$d_sfio" in
17327 $define) ;;
17328 *)      : Remove sfio from list of libraries to use
17329         case "$libs" in
17330         *-lsfio*)
17331                 echo "Removing unneeded -lsfio from library list" >&4
17332                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17333                 shift
17334                 libs="$*"
17335                 echo "libs = $libs" >&4
17336                 ;;
17337         esac
17338 ;;
17339 esac
17340
17341
17342 : see if shmctl exists
17343 set shmctl d_shmctl
17344 eval $inlibc
17345
17346 : see if shmget exists
17347 set shmget d_shmget
17348 eval $inlibc
17349
17350 : see if shmat exists
17351 set shmat d_shmat
17352 eval $inlibc
17353 : see what shmat returns
17354 case "$d_shmat" in
17355 "$define")
17356         $cat >shmat.c <<'END'
17357 #include <sys/shm.h>
17358 void *shmat();
17359 END
17360         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17361                 shmattype='void *'
17362         else
17363                 shmattype='char *'
17364         fi
17365         echo "and it returns ($shmattype)." >&4
17366         : see if a prototype for shmat is available
17367         xxx=`./findhdr sys/shm.h`
17368         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17369         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17370                 val="$define"
17371         else
17372                 val="$undef"
17373         fi
17374         $rm -f shmat.[co]
17375         ;;
17376 *)
17377         val="$undef"
17378         ;;
17379 esac
17380 set d_shmatprototype
17381 eval $setvar
17382
17383 : see if shmdt exists
17384 set shmdt d_shmdt
17385 eval $inlibc
17386
17387 : see how much of the 'shm*(2)' library is present.
17388 h_shm=true
17389 echo " "
17390 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17391 *"$undef"*) h_shm=false;;
17392 esac
17393 case "$osname" in
17394 freebsd)
17395     case "`ipcs 2>&1`" in
17396     "SVID shared memory"*"not configured"*)
17397         echo "Your $osname does not have the shm*(2) configured." >&4
17398         h_shm=false
17399         val="$undef"
17400         set shmctl d_shmctl
17401         evat $setvar
17402         set shmget d_shmget
17403         evat $setvar
17404         set shmat d_shmat
17405         evat $setvar
17406         set shmdt d_shmdt
17407         evat $setvar
17408         ;;
17409     esac
17410     ;;
17411 esac
17412 : we could also check for sys/ipc.h ...
17413 if $h_shm && $test `./findhdr sys/shm.h`; then
17414         echo "You have the full shm*(2) library." >&4
17415         val="$define"
17416 else
17417         echo "You don't have the full shm*(2) library." >&4
17418         val="$undef"
17419 fi
17420 set d_shm
17421 eval $setvar
17422
17423 : see if we have sigaction
17424 echo " "
17425 if set sigaction val -f d_sigaction; eval $csym; $val; then
17426         echo 'sigaction() found.' >&4
17427         $cat > try.c <<EOP
17428 #include <stdio.h>
17429 #include <sys/types.h>
17430 #include <signal.h>
17431 #$i_stdlib I_STDLIB
17432 #ifdef I_STDLIB
17433 #include <stdlib.h>
17434 #endif
17435 int main()
17436 {
17437     struct sigaction act, oact;
17438     act.sa_flags = 0;
17439     oact.sa_handler = 0;
17440     /* so that act and oact are used */
17441     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17442 }
17443 EOP
17444         set try
17445         if eval $compile_ok; then
17446                 val="$define"
17447         else
17448                 echo "But you don't seem to have a useable struct sigaction." >&4
17449                 val="$undef"
17450         fi
17451 else
17452         echo 'sigaction NOT found.' >&4
17453         val="$undef"
17454 fi
17455 set d_sigaction; eval $setvar
17456 $rm_try
17457
17458 : see if this is a sunmath.h system
17459 set sunmath.h i_sunmath
17460 eval $inhdr
17461
17462 : see if signbit exists
17463 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17464 $cat >try.c <<EOCP
17465 #$i_math I_MATH
17466 #$i_sunmath I_SUNMATH
17467 #ifdef I_MATH
17468 #  include <math.h>
17469 #endif
17470 #ifdef I_SUNMATH  /* Solaris special math library */
17471 #  include <sunmath.h>
17472 #endif
17473 #define NV $nvtype
17474 int main(int argc, char **argv)
17475 {
17476     NV x = 0.0;
17477     NV y = -0.0;
17478     if ((signbit(x) == 0) && (signbit(y) != 0))
17479         return 0;
17480     else
17481         return 1;
17482 }
17483 EOCP
17484 val="$undef"
17485 set try
17486 if eval $compile; then
17487     if $run ./try; then
17488         $echo "Yes." >&4
17489         val="$define"
17490     else
17491         $echo "Signbit seems to be available, but doesn't work as I expected."
17492         $echo "I won't use it." >&4
17493         val="$undef"
17494     fi
17495 else
17496     $echo "Nope." >&4
17497     dflt="$undef"
17498 fi
17499 set d_signbit
17500 eval $setvar
17501 $rm_try
17502
17503 : see if sigprocmask exists
17504 set sigprocmask d_sigprocmask
17505 eval $inlibc
17506
17507 : see if sigsetjmp exists
17508 echo " "
17509 case "$d_sigsetjmp" in
17510 '')
17511         $cat >try.c <<EOP
17512 #include <setjmp.h>
17513 #$i_stdlib I_STDLIB
17514 #ifdef I_STDLIB
17515 #include <stdlib.h>
17516 #endif
17517 sigjmp_buf env;
17518 int set = 1;
17519 int main()
17520 {
17521         if (sigsetjmp(env,1))
17522                 exit(set);
17523         set = 0;
17524         siglongjmp(env, 1);
17525         exit(1);
17526 }
17527 EOP
17528         set try
17529         if eval $compile; then
17530                 if $run ./try >/dev/null 2>&1; then
17531                         echo "POSIX sigsetjmp found." >&4
17532                         val="$define"
17533                 else
17534                         $cat >&4 <<EOM
17535 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17536 I'll ignore them.
17537 EOM
17538                         val="$undef"
17539                 fi
17540         else
17541                 echo "sigsetjmp not found." >&4
17542                 val="$undef"
17543         fi
17544         ;;
17545 *) val="$d_sigsetjmp"
17546         case "$d_sigsetjmp" in
17547         $define) echo "POSIX sigsetjmp found." >&4;;
17548         $undef) echo "sigsetjmp not found." >&4;;
17549         esac
17550         ;;
17551 esac
17552 set d_sigsetjmp
17553 eval $setvar
17554 $rm_try
17555
17556 : see if snprintf exists
17557 set snprintf d_snprintf
17558 eval $inlibc
17559
17560 : see if vsnprintf exists
17561 set vsnprintf d_vsnprintf
17562 eval $inlibc
17563
17564 case "$d_snprintf-$d_vsnprintf" in
17565 "$define-$define")
17566     $cat <<EOM
17567 Checking whether your snprintf() and vsnprintf() work okay...
17568 EOM
17569     $cat >try.c <<'EOCP'
17570 /* v?snprintf testing logic courtesy of Russ Allbery.
17571  * According to C99:
17572  * - if the buffer is too short it still must be \0-terminated
17573  * - if the buffer is too short the potentially required length
17574  *   must be returned and not -1
17575  * - if the buffer is NULL the potentially required length
17576  *   must be returned and not -1 or core dump
17577  */
17578 #include <stdio.h>
17579 #include <stdarg.h>
17580
17581 char buf[2];
17582
17583 int test (char *format, ...)
17584 {
17585     va_list args;
17586     int count;
17587
17588     va_start (args, format);
17589     count = vsnprintf (buf, sizeof buf, format, args);
17590     va_end (args);
17591     return count;
17592 }
17593
17594 int main ()
17595 {
17596     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17597              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17598 }
17599 EOCP
17600     set try
17601     if eval $compile; then
17602         `$run ./try`
17603         case "$?" in
17604         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17605         *) cat <<EOM >&4
17606 Your snprintf() and snprintf() don't seem to be working okay.
17607 EOM
17608            d_snprintf="$undef"
17609            d_vsnprintf="$undef"
17610            ;;
17611         esac
17612     else
17613         echo "(I can't seem to compile the test program--assuming they don't)"
17614         d_snprintf="$undef"
17615         d_vsnprintf="$undef"
17616     fi
17617     $rm_try
17618     ;;
17619 esac
17620
17621 : see if sockatmark exists
17622 set sockatmark d_sockatmark
17623 eval $inlibc
17624
17625 : see if prototype for sockatmark is available
17626 echo " "
17627 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17628 eval $hasproto
17629
17630 : see if socks5_init exists
17631 set socks5_init d_socks5_init
17632 eval $inlibc
17633
17634 : see if sprintf returns the length of the string in the buffer as per ANSI
17635 $echo "Checking whether sprintf returns the length of the string..." >&4
17636 $cat <<EOP >try.c
17637 #include <stdio.h>
17638 #$i_stdlib I_STDLIB
17639 #ifdef I_STDLIB
17640 #include <stdlib.h>
17641 #endif
17642 #$i_string I_STRING
17643 #ifdef I_STRING
17644 #  include <string.h>
17645 #else
17646 #  include <strings.h>
17647 #endif
17648 #$i_math I_MATH
17649 #ifdef I_MATH
17650 #include <math.h>
17651 #endif
17652
17653 char buffer[256];
17654
17655 int check (size_t expect, int test) {
17656   size_t got = strlen(buffer);
17657   if (expect == got)
17658     return 0;
17659
17660   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17661        test, buffer);
17662   exit (test);
17663 }
17664
17665 int main(int argc, char **argv) {
17666   int test = 0;
17667
17668   check(sprintf(buffer, ""), ++test);
17669   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17670   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17671
17672   return 0;
17673 }
17674 EOP
17675 set try
17676
17677 if eval $compile; then
17678     xxx="`$run ./try`"
17679     case "$?" in
17680         0) cat >&4 <<EOM
17681 sprintf returns the length of the string (as ANSI says it should)
17682 EOM
17683         d_sprintf_returns_strlen="$define"
17684         ;;
17685         *) cat >&4 <<EOM
17686 sprintf does not return the length of the string (how old is this system?)
17687 EOM
17688         d_sprintf_returns_strlen="$undef"
17689         ;;
17690     esac
17691 else
17692     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17693     d_sprintf_returns_strlen="$undef"
17694 fi
17695 $rm_try
17696
17697 : see if srand48_r exists
17698 set srand48_r d_srand48_r
17699 eval $inlibc
17700 case "$d_srand48_r" in
17701 "$define")
17702         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17703         case "$d_srand48_r_proto:$usethreads" in
17704         ":define")      d_srand48_r_proto=define
17705                 set d_srand48_r_proto srand48_r $hdrs
17706                 eval $hasproto ;;
17707         *)      ;;
17708         esac
17709         case "$d_srand48_r_proto" in
17710         define)
17711         case "$srand48_r_proto" in
17712         ''|0) try='int srand48_r(long, struct drand48_data*);'
17713         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17714         esac
17715         case "$srand48_r_proto" in
17716         ''|0)   d_srand48_r=undef
17717                 srand48_r_proto=0
17718                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17719         * )     case "$srand48_r_proto" in
17720                 REENTRANT_PROTO*) ;;
17721                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17722                 esac
17723                 echo "Prototype: $try" ;;
17724         esac
17725         ;;
17726         *)      case "$usethreads" in
17727                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17728                 esac
17729                 d_srand48_r=undef
17730                 srand48_r_proto=0
17731                 ;;
17732         esac
17733         ;;
17734 *)      srand48_r_proto=0
17735         ;;
17736 esac
17737
17738 : see if srandom_r exists
17739 set srandom_r d_srandom_r
17740 eval $inlibc
17741 case "$d_srandom_r" in
17742 "$define")
17743         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17744         case "$d_srandom_r_proto:$usethreads" in
17745         ":define")      d_srandom_r_proto=define
17746                 set d_srandom_r_proto srandom_r $hdrs
17747                 eval $hasproto ;;
17748         *)      ;;
17749         esac
17750         case "$d_srandom_r_proto" in
17751         define)
17752         case "$srandom_r_proto" in
17753         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17754         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17755         esac
17756         case "$srandom_r_proto" in
17757         ''|0)   d_srandom_r=undef
17758                 srandom_r_proto=0
17759                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17760         * )     case "$srandom_r_proto" in
17761                 REENTRANT_PROTO*) ;;
17762                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17763                 esac
17764                 echo "Prototype: $try" ;;
17765         esac
17766         ;;
17767         *)      case "$usethreads" in
17768                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17769                 esac
17770                 d_srandom_r=undef
17771                 srandom_r_proto=0
17772                 ;;
17773         esac
17774         ;;
17775 *)      srandom_r_proto=0
17776         ;;
17777 esac
17778
17779 : see if prototype for setresgid is available
17780 echo " "
17781 set d_sresgproto setresgid $i_unistd unistd.h
17782 eval $hasproto
17783
17784 : see if prototype for setresuid is available
17785 echo " "
17786 set d_sresuproto setresuid $i_unistd unistd.h
17787 eval $hasproto
17788
17789 : see if sys/stat.h is available
17790 set sys/stat.h i_sysstat
17791 eval $inhdr
17792
17793 : see if stat knows about block sizes
17794 echo " "
17795 echo "Checking to see if your struct stat has st_blocks field..." >&4
17796 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17797 eval $hasfield
17798
17799 : see if this is a sys/vfs.h system
17800 set sys/vfs.h i_sysvfs
17801 eval $inhdr
17802
17803 : see if this is a sys/statfs.h system
17804 set sys/statfs.h i_sysstatfs
17805 eval $inhdr
17806
17807 : Check for statfs_s
17808 echo " "
17809 echo "Checking to see if your system supports struct statfs..." >&4
17810 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
17811 eval $hasstruct
17812 case "$d_statfs_s" in
17813 "$define")      echo "Yes, it does."   ;;
17814 *)              echo "No, it doesn't." ;;
17815 esac
17816
17817
17818 : see if struct statfs knows about f_flags
17819 case "$d_statfs_s" in
17820 define)
17821         echo " "
17822         echo "Checking to see if your struct statfs has f_flags field..." >&4
17823         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
17824         eval $hasfield
17825         ;;
17826 *)      val="$undef"
17827         set d_statfs_f_flags
17828         eval $setvar
17829         ;;
17830 esac
17831 case "$d_statfs_f_flags" in
17832 "$define")      echo "Yes, it does."   ;;
17833 *)              echo "No, it doesn't." ;;
17834 esac
17835
17836 : Check stream access
17837 $cat >&4 <<EOM
17838 Checking how to access stdio streams by file descriptor number...
17839 EOM
17840 case "$stdio_stream_array" in
17841 '')     $cat >try.c <<EOCP
17842 #include <stdio.h>
17843 int main() {
17844   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17845     printf("yes\n");
17846 }
17847 EOCP
17848         for s in _iob __iob __sF
17849         do
17850                 set try -DSTDIO_STREAM_ARRAY=$s
17851                 if eval $compile; then
17852                         case "`$run ./try`" in
17853                         yes)    stdio_stream_array=$s; break ;;
17854                         esac
17855                 fi
17856         done
17857         $rm_try
17858 esac
17859 case "$stdio_stream_array" in
17860 '')     $cat >&4 <<EOM
17861 I can't figure out how to access stdio streams by file descriptor number.
17862 EOM
17863         d_stdio_stream_array="$undef"
17864         ;;
17865 *)      $cat >&4 <<EOM
17866 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17867 EOM
17868         d_stdio_stream_array="$define"
17869         ;;
17870 esac
17871
17872 : see if strcoll exists
17873 set strcoll d_strcoll
17874 eval $inlibc
17875
17876 : check for structure copying
17877 echo " "
17878 echo "Checking to see if your C compiler can copy structs..." >&4
17879 $cat >try.c <<'EOCP'
17880 int main()
17881 {
17882         struct blurfl {
17883                 int dyick;
17884         } foo, bar;
17885
17886         foo = bar;
17887 }
17888 EOCP
17889 if $cc -c try.c >/dev/null 2>&1 ; then
17890         val="$define"
17891         echo "Yup, it can."
17892 else
17893         val="$undef"
17894         echo "Nope, it can't."
17895 fi
17896 set d_strctcpy
17897 eval $setvar
17898 $rm_try
17899
17900 : see if strerror and/or sys_errlist[] exist
17901 echo " "
17902 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17903     if set strerror val -f d_strerror; eval $csym; $val; then
17904                 echo 'strerror() found.' >&4
17905                 d_strerror="$define"
17906                 d_strerrm='strerror(e)'
17907                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17908                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17909                         d_syserrlst="$define"
17910                 else
17911                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17912                         d_syserrlst="$undef"
17913                 fi
17914     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17915                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17916                 echo 'strerror() found in string header.' >&4
17917                 d_strerror="$define"
17918                 d_strerrm='strerror(e)'
17919                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17920                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17921                                 d_syserrlst="$define"
17922                 else
17923                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17924                         d_syserrlst="$undef"
17925                 fi
17926     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17927                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17928                 d_strerror="$undef"
17929                 d_syserrlst="$define"
17930                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17931     else
17932                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17933                 d_strerror="$undef"
17934                 d_syserrlst="$undef"
17935                 d_strerrm='"unknown"'
17936     fi
17937 fi
17938
17939 : see if strerror_r exists
17940 set strerror_r d_strerror_r
17941 eval $inlibc
17942 case "$d_strerror_r" in
17943 "$define")
17944         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17945         case "$d_strerror_r_proto:$usethreads" in
17946         ":define")      d_strerror_r_proto=define
17947                 set d_strerror_r_proto strerror_r $hdrs
17948                 eval $hasproto ;;
17949         *)      ;;
17950         esac
17951         case "$d_strerror_r_proto" in
17952         define)
17953         case "$strerror_r_proto" in
17954         ''|0) try='int strerror_r(int, char*, size_t);'
17955         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17956         esac
17957         case "$strerror_r_proto" in
17958         ''|0) try='int strerror_r(int, char*, int);'
17959         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17960         esac
17961         case "$strerror_r_proto" in
17962         ''|0) try='char* strerror_r(int, char*, size_t);'
17963         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17964         esac
17965         case "$strerror_r_proto" in
17966         ''|0)   d_strerror_r=undef
17967                 strerror_r_proto=0
17968                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17969         * )     case "$strerror_r_proto" in
17970                 REENTRANT_PROTO*) ;;
17971                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17972                 esac
17973                 echo "Prototype: $try" ;;
17974         esac
17975         ;;
17976         *)      case "$usethreads" in
17977                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17978                 esac
17979                 d_strerror_r=undef
17980                 strerror_r_proto=0
17981                 ;;
17982         esac
17983         ;;
17984 *)      strerror_r_proto=0
17985         ;;
17986 esac
17987
17988 : see if strftime exists
17989 set strftime d_strftime
17990 eval $inlibc
17991
17992 : see if strlcat exists
17993 set strlcat d_strlcat
17994 eval $inlibc
17995
17996 : see if strlcpy exists
17997 set strlcpy d_strlcpy
17998 eval $inlibc
17999
18000 : see if strtod exists
18001 set strtod d_strtod
18002 eval $inlibc
18003
18004 : see if strtol exists
18005 set strtol d_strtol
18006 eval $inlibc
18007
18008 : see if strtold exists
18009 set strtold d_strtold
18010 eval $inlibc
18011
18012 : see if strtoll exists
18013 set strtoll d_strtoll
18014 eval $inlibc
18015
18016 case "$d_longlong-$d_strtoll" in
18017 "$define-$define")
18018         $cat <<EOM
18019 Checking whether your strtoll() works okay...
18020 EOM
18021         $cat >try.c <<'EOCP'
18022 #include <errno.h>
18023 #ifdef __hpux
18024 #define strtoll __strtoll
18025 #endif
18026 #ifdef __EMX__
18027 #define strtoll _strtoll
18028 #endif
18029 #include <stdio.h>
18030 extern long long int strtoll(char *s, char **, int);
18031 static int bad = 0;
18032 int check(char *s, long long ell, int een) {
18033         long long gll;
18034         errno = 0;
18035         gll = strtoll(s, 0, 10);
18036         if (!((gll == ell) && (errno == een)))
18037                 bad++;
18038 }
18039 int main() {
18040         check(" 1",                                      1LL, 0);
18041         check(" 0",                                      0LL, 0);
18042         check("-1",                                     -1LL, 0);
18043         check("-9223372036854775808", -9223372036854775808LL, 0);
18044         check("-9223372036854775808", -9223372036854775808LL, 0);
18045         check(" 9223372036854775807",  9223372036854775807LL, 0);
18046         check("-9223372036854775808", -9223372036854775808LL, 0);
18047         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18048         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18049         if (!bad)
18050                 printf("ok\n");
18051 }
18052 EOCP
18053         set try
18054         if eval $compile; then
18055                 yyy=`$run ./try`
18056                 case "$yyy" in
18057                 ok) echo "Your strtoll() seems to be working okay." ;;
18058                 *) cat <<EOM >&4
18059 Your strtoll() doesn't seem to be working okay.
18060 EOM
18061                    d_strtoll="$undef"
18062                    ;;
18063                 esac
18064         else
18065                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18066                 d_strtoll="$undef"
18067         fi
18068         ;;
18069 esac
18070
18071 : see if strtoq exists
18072 set strtoq d_strtoq
18073 eval $inlibc
18074
18075 : see if strtoul exists
18076 set strtoul d_strtoul
18077 eval $inlibc
18078
18079 case "$d_strtoul" in
18080 "$define")
18081         $cat <<EOM
18082 Checking whether your strtoul() works okay...
18083 EOM
18084         $cat >try.c <<'EOCP'
18085 #include <errno.h>
18086 #include <stdio.h>
18087 extern unsigned long int strtoul(char *s, char **, int);
18088 static int bad = 0;
18089 void check(char *s, unsigned long eul, int een) {
18090         unsigned long gul;
18091         errno = 0;
18092         gul = strtoul(s, 0, 10);
18093         if (!((gul == eul) && (errno == een)))
18094                 bad++;
18095 }
18096 int main() {
18097         check(" 1", 1L, 0);
18098         check(" 0", 0L, 0);
18099 EOCP
18100         case "$longsize" in
18101         8)
18102             $cat >>try.c <<'EOCP'
18103         check("18446744073709551615", 18446744073709551615UL, 0);
18104         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18105 #if 0 /* strtoul() for /^-/ strings is undefined. */
18106         check("-1", 18446744073709551615UL, 0);
18107         check("-18446744073709551614", 2, 0);
18108         check("-18446744073709551615", 1, 0);
18109         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18110         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18111 #endif
18112 EOCP
18113                 ;;
18114         4)
18115                     $cat >>try.c <<'EOCP'
18116         check("4294967295", 4294967295UL, 0);
18117         check("4294967296", 4294967295UL, ERANGE);
18118 #if 0 /* strtoul() for /^-/ strings is undefined. */
18119         check("-1", 4294967295UL, 0);
18120         check("-4294967294", 2, 0);
18121         check("-4294967295", 1, 0);
18122         check("-4294967296", 4294967295UL, ERANGE);
18123         check("-4294967297", 4294967295UL, ERANGE);
18124 #endif
18125 EOCP
18126                 ;;
18127         *)
18128 : Should we write these tests to be more portable by sprintf-ing
18129 : ~0 and then manipulating that char string as input for strtol?
18130                 ;;
18131         esac
18132         $cat >>try.c <<'EOCP'
18133         if (!bad)
18134                 printf("ok\n");
18135         return 0;
18136 }
18137 EOCP
18138         set try
18139         if eval $compile; then
18140                 case "`$run ./try`" in
18141                 ok) echo "Your strtoul() seems to be working okay." ;;
18142                 *) cat <<EOM >&4
18143 Your strtoul() doesn't seem to be working okay.
18144 EOM
18145                    d_strtoul="$undef"
18146                    ;;
18147                 esac
18148         else
18149                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18150                 d_strtoul="$undef"
18151         fi
18152         ;;
18153 esac
18154
18155 : see if strtoull exists
18156 set strtoull d_strtoull
18157 eval $inlibc
18158
18159 case "$d_longlong-$d_strtoull" in
18160 "$define-$define")
18161         $cat <<EOM
18162 Checking whether your strtoull() works okay...
18163 EOM
18164         $cat >try.c <<'EOCP'
18165 #include <errno.h>
18166 #ifdef __hpux
18167 #define strtoull __strtoull
18168 #endif
18169 #include <stdio.h>
18170 extern unsigned long long int strtoull(char *s, char **, int);
18171 static int bad = 0;
18172 int check(char *s, long long eull, int een) {
18173         long long gull;
18174         errno = 0;
18175         gull = strtoull(s, 0, 10);
18176         if (!((gull == eull) && (errno == een)))
18177                 bad++;
18178 }
18179 int main() {
18180         check(" 1",                                        1LL, 0);
18181         check(" 0",                                        0LL, 0);
18182         check("18446744073709551615",  18446744073709551615ULL, 0);
18183         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18184 #if 0 /* strtoull() for /^-/ strings is undefined. */
18185         check("-1",                    18446744073709551615ULL, 0);
18186         check("-18446744073709551614",                     2LL, 0);
18187         check("-18446744073709551615",                     1LL, 0);
18188         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18189         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18190 #endif
18191         if (!bad)
18192                 printf("ok\n");
18193 }
18194 EOCP
18195         set try
18196         if eval $compile; then
18197                 case "`$run ./try`" in
18198                 ok) echo "Your strtoull() seems to be working okay." ;;
18199                 *) cat <<EOM >&4
18200 Your strtoull() doesn't seem to be working okay.
18201 EOM
18202                    d_strtoull="$undef"
18203                    ;;
18204                 esac
18205         else
18206                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18207                 d_strtoull="$undef"
18208         fi
18209         ;;
18210 esac
18211
18212 : see if strtouq exists
18213 set strtouq d_strtouq
18214 eval $inlibc
18215
18216 case "$d_strtouq" in
18217 "$define")
18218         $cat <<EOM
18219 Checking whether your strtouq() works okay...
18220 EOM
18221         $cat >try.c <<'EOCP'
18222 #include <errno.h>
18223 #include <stdio.h>
18224 extern unsigned long long int strtouq(char *s, char **, int);
18225 static int bad = 0;
18226 void check(char *s, unsigned long long eull, int een) {
18227         unsigned long long gull;
18228         errno = 0;
18229         gull = strtouq(s, 0, 10);
18230         if (!((gull == eull) && (errno == een)))
18231                 bad++;
18232 }
18233 int main() {
18234         check(" 1",                                        1LL, 0);
18235         check(" 0",                                        0LL, 0);
18236         check("18446744073709551615",  18446744073709551615ULL, 0);
18237         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18238 #if 0 /* strtouq() for /^-/ strings is undefined. */
18239         check("-1",                    18446744073709551615ULL, 0);
18240         check("-18446744073709551614",                     2LL, 0);
18241         check("-18446744073709551615",                     1LL, 0);
18242         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18243         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18244 #endif
18245         if (!bad)
18246                 printf("ok\n");
18247         return 0;
18248 }
18249 EOCP
18250         set try
18251         if eval $compile; then
18252                 case "`$run ./try`" in
18253                 ok) echo "Your strtouq() seems to be working okay." ;;
18254                 *) cat <<EOM >&4
18255 Your strtouq() doesn't seem to be working okay.
18256 EOM
18257                    d_strtouq="$undef"
18258                    ;;
18259                 esac
18260         else
18261                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18262                 d_strtouq="$undef"
18263         fi
18264         ;;
18265 esac
18266
18267 : see if strxfrm exists
18268 set strxfrm d_strxfrm
18269 eval $inlibc
18270
18271 : see if symlink exists
18272 set symlink d_symlink
18273 eval $inlibc
18274
18275 : see if syscall exists
18276 set syscall d_syscall
18277 eval $inlibc
18278
18279 : see if prototype for syscall is available
18280 echo " "
18281 set d_syscallproto syscall $i_unistd unistd.h
18282 eval $hasproto
18283
18284 : see if sysconf exists
18285 set sysconf d_sysconf
18286 eval $inlibc
18287
18288 : see if system exists
18289 set system d_system
18290 eval $inlibc
18291
18292 : see if tcgetpgrp exists
18293 set tcgetpgrp d_tcgetpgrp
18294 eval $inlibc
18295
18296 : see if tcsetpgrp exists
18297 set tcsetpgrp d_tcsetpgrp
18298 eval $inlibc
18299
18300 : see if prototype for telldir is available
18301 echo " "
18302 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18303 eval $hasproto
18304
18305 : see if time exists
18306 echo " "
18307 if test "X$d_time" = X -o X"$timetype" = X; then
18308     if set time val -f d_time; eval $csym; $val; then
18309                 echo 'time() found.' >&4
18310                 val="$define"
18311                 rp="What is the type returned by time() on this system?"
18312                 set time_t timetype long stdio.h sys/types.h
18313                 eval $typedef_ask
18314     else
18315                 echo 'time() not found, hope that will do.' >&4
18316                 val="$undef"
18317                 timetype='int';
18318     fi
18319     set d_time
18320     eval $setvar
18321 fi
18322
18323 : see if timegm exists
18324 set timegm d_timegm
18325 eval $inlibc
18326
18327 : see if this is a sys/times.h system
18328 set sys/times.h i_systimes
18329 eval $inhdr
18330
18331 : see if times exists
18332 echo " "
18333 if set times val -f d_times; eval $csym; $val; then
18334         echo 'times() found.' >&4
18335         d_times="$define"
18336         inc=''
18337         case "$i_systimes" in
18338         "$define") inc='sys/times.h';;
18339         esac
18340         rp="What is the type returned by times() on this system?"
18341         set clock_t clocktype long stdio.h sys/types.h $inc
18342         eval $typedef_ask
18343 else
18344         echo 'times() NOT found, hope that will do.' >&4
18345         d_times="$undef"
18346         clocktype='int'
18347 fi
18348
18349 : see if tmpnam_r exists
18350 set tmpnam_r d_tmpnam_r
18351 eval $inlibc
18352 case "$d_tmpnam_r" in
18353 "$define")
18354         hdrs="$i_systypes sys/types.h define stdio.h "
18355         case "$d_tmpnam_r_proto:$usethreads" in
18356         ":define")      d_tmpnam_r_proto=define
18357                 set d_tmpnam_r_proto tmpnam_r $hdrs
18358                 eval $hasproto ;;
18359         *)      ;;
18360         esac
18361         case "$d_tmpnam_r_proto" in
18362         define)
18363         case "$tmpnam_r_proto" in
18364         ''|0) try='char* tmpnam_r(char*);'
18365         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18366         esac
18367         case "$tmpnam_r_proto" in
18368         ''|0)   d_tmpnam_r=undef
18369                 tmpnam_r_proto=0
18370                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18371         * )     case "$tmpnam_r_proto" in
18372                 REENTRANT_PROTO*) ;;
18373                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18374                 esac
18375                 echo "Prototype: $try" ;;
18376         esac
18377         ;;
18378         *)      case "$usethreads" in
18379                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18380                 esac
18381                 d_tmpnam_r=undef
18382                 tmpnam_r_proto=0
18383                 ;;
18384         esac
18385         ;;
18386 *)      tmpnam_r_proto=0
18387         ;;
18388 esac
18389
18390 : see if truncate exists
18391 set truncate d_truncate
18392 eval $inlibc
18393
18394 : see if ttyname_r exists
18395 set ttyname_r d_ttyname_r
18396 eval $inlibc
18397 case "$d_ttyname_r" in
18398 "$define")
18399         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18400         case "$d_ttyname_r_proto:$usethreads" in
18401         ":define")      d_ttyname_r_proto=define
18402                 set d_ttyname_r_proto ttyname_r $hdrs
18403                 eval $hasproto ;;
18404         *)      ;;
18405         esac
18406         case "$d_ttyname_r_proto" in
18407         define)
18408         case "$ttyname_r_proto" in
18409         ''|0) try='int ttyname_r(int, char*, size_t);'
18410         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18411         esac
18412         case "$ttyname_r_proto" in
18413         ''|0) try='int ttyname_r(int, char*, int);'
18414         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18415         esac
18416         case "$ttyname_r_proto" in
18417         ''|0) try='char* ttyname_r(int, char*, int);'
18418         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18419         esac
18420         case "$ttyname_r_proto" in
18421         ''|0)   d_ttyname_r=undef
18422                 ttyname_r_proto=0
18423                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18424         * )     case "$ttyname_r_proto" in
18425                 REENTRANT_PROTO*) ;;
18426                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18427                 esac
18428                 echo "Prototype: $try" ;;
18429         esac
18430         ;;
18431         *)      case "$usethreads" in
18432                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18433                 esac
18434                 d_ttyname_r=undef
18435                 ttyname_r_proto=0
18436                 ;;
18437         esac
18438         ;;
18439 *)      ttyname_r_proto=0
18440         ;;
18441 esac
18442
18443 : see if tzname[] exists
18444 echo " "
18445 if set tzname val -a d_tzname; eval $csym; $val; then
18446         val="$define"
18447         echo 'tzname[] found.' >&4
18448 else
18449         val="$undef"
18450         echo 'tzname[] NOT found.' >&4
18451 fi
18452 set d_tzname
18453 eval $setvar
18454
18455 : Check if is a multiplatform env
18456 case "$osname" in
18457 next|rhapsody|darwin) multiarch="$define" ;;
18458 esac
18459 case "$multiarch" in
18460 ''|[nN]*) multiarch="$undef" ;;
18461 esac
18462
18463 : check for ordering of bytes in a UV
18464 echo " "
18465 case "$usecrosscompile$multiarch" in
18466 *$define*)
18467         $cat <<EOM
18468 You seem to be either cross-compiling or doing a multiarchitecture build,
18469 skipping the byteorder check.
18470
18471 EOM
18472         byteorder='ffff'
18473         ;;
18474 *)
18475         case "$byteorder" in
18476         '')
18477                 $cat <<'EOM'
18478 In the following, larger digits indicate more significance.  A big-endian
18479 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18480 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18481 machines may have weird orders like 3412.  A Cray will report 87654321,
18482 an Alpha will report 12345678. If the test program works the default is
18483 probably right.
18484 I'm now running the test program...
18485 EOM
18486                 $cat >try.c <<EOCP
18487 #include <stdio.h>
18488 #$i_stdlib I_STDLIB
18489 #ifdef I_STDLIB
18490 #include <stdlib.h>
18491 #endif
18492 #include <sys/types.h>
18493 typedef $uvtype UV;
18494 int main()
18495 {
18496         int i;
18497         union {
18498                 UV l;
18499                 char c[$uvsize];
18500         } u;
18501
18502         if ($uvsize > 4)
18503                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18504         else
18505                 u.l = (UV)0x04030201;
18506         for (i = 0; i < $uvsize; i++)
18507                 printf("%c", u.c[i]+'0');
18508         printf("\n");
18509         exit(0);
18510 }
18511 EOCP
18512                 xxx_prompt=y
18513                 set try
18514                 if eval $compile && $run ./try > /dev/null; then
18515                         dflt=`$run ./try`
18516                         case "$dflt" in
18517                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18518                                 echo "(The test program ran ok.)"
18519                                 echo "byteorder=$dflt"
18520                                 xxx_prompt=n
18521                         ;;
18522                         ????|????????) echo "(The test program ran ok.)" ;;
18523                         *) echo "(The test program didn't run right for some reason.)" ;;
18524                         esac
18525                 else
18526                         dflt='4321'
18527                         cat <<'EOM'
18528 (I can't seem to compile the test program.  Guessing big-endian...)
18529 EOM
18530                 fi
18531                 case "$xxx_prompt" in
18532                 y)
18533                         rp="What is the order of bytes in $uvtype?"
18534                         . ./myread
18535                         byteorder="$ans"
18536                         ;;
18537                 *)      byteorder=$dflt
18538                         ;;
18539                 esac
18540                 ;;
18541         esac
18542         $rm_try
18543         ;;
18544 esac
18545
18546 : Checking 32bit aligndness
18547 $cat <<EOM
18548
18549 Checking to see whether you can access character data unalignedly...
18550 EOM
18551 case "$d_u32align" in
18552 '')   $cat >try.c <<EOCP
18553 #include <stdio.h>
18554 #$i_stdlib I_STDLIB
18555 #ifdef I_STDLIB
18556 #include <stdlib.h>
18557 #endif
18558 #define U32 $u32type
18559 #define BYTEORDER 0x$byteorder
18560 #define U8 $u8type
18561 #include <signal.h>
18562 #ifdef SIGBUS
18563 $signal_t bletch(int s) { exit(4); }
18564 #endif
18565 int main() {
18566 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18567     U8 buf[8];
18568     U32 *up;
18569     int i;
18570
18571     if (sizeof(U32) != 4) {
18572         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18573         exit(1);
18574     }
18575
18576     fflush(stdout);
18577
18578 #ifdef SIGBUS
18579     signal(SIGBUS, bletch);
18580 #endif
18581
18582     buf[0] = 0;
18583     buf[1] = 0;
18584     buf[2] = 0;
18585     buf[3] = 1;
18586     buf[4] = 0;
18587     buf[5] = 0;
18588     buf[6] = 0;
18589     buf[7] = 1;
18590
18591     for (i = 0; i < 4; i++) {
18592         up = (U32*)(buf + i);
18593         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18594                (*up == 1 << (8*(3-i)))  /* little-endian */
18595               )
18596            )
18597         {
18598             printf("read failed (%x)\n", *up);
18599             exit(2);
18600         }
18601     }
18602
18603     /* write test */
18604     for (i = 0; i < 4; i++) {
18605         up = (U32*)(buf + i);
18606         *up = 0xBeef;
18607         if (*up != 0xBeef) {
18608             printf("write failed (%x)\n", *up);
18609             exit(3);
18610         }
18611     }
18612
18613     exit(0);
18614 #else
18615     printf("1\n");
18616     exit(1);
18617 #endif
18618     return 0;
18619 }
18620 EOCP
18621 set try
18622 if eval $compile_ok; then
18623         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18624         $run ./try 2>&1 >/dev/null
18625         case "$?" in
18626         0)      cat >&4 <<EOM
18627 You can access character data pretty unalignedly.
18628 EOM
18629                 d_u32align="$undef"
18630                 ;;
18631         *)      cat >&4 <<EOM
18632 It seems that you must access character data in an aligned manner.
18633 EOM
18634                 d_u32align="$define"
18635                 ;;
18636         esac
18637 else
18638         rp='Can you access character data at unaligned addresses?'
18639         dflt='n'
18640         . ./myread
18641         case "$ans" in
18642         [yY]*)  d_u32align="$undef"  ;;
18643         *)      d_u32align="$define" ;;
18644         esac
18645 fi
18646 $rm_try
18647 ;;
18648 esac
18649
18650 : see if ualarm exists
18651 set ualarm d_ualarm
18652 eval $inlibc
18653
18654 : see if umask exists
18655 set umask d_umask
18656 eval $inlibc
18657
18658 : see if unordered exists
18659 set unordered d_unordered
18660 eval $inlibc
18661
18662 : see if unsetenv exists
18663 set unsetenv d_unsetenv
18664 eval $inlibc
18665
18666 : see if usleep exists
18667 set usleep d_usleep
18668 eval $inlibc
18669
18670 : see if prototype for usleep is available
18671 echo " "
18672 set d_usleepproto usleep $i_unistd unistd.h
18673 eval $hasproto
18674
18675 : see if ustat exists
18676 set ustat d_ustat
18677 eval $inlibc
18678
18679 : see if closedir exists
18680 set closedir d_closedir
18681 eval $inlibc
18682
18683 case "$d_closedir" in
18684 "$define")
18685         echo " "
18686         echo "Checking whether closedir() returns a status..." >&4
18687         cat > try.c <<EOM
18688 #$i_dirent I_DIRENT             /**/
18689 #$i_sysdir I_SYS_DIR            /**/
18690 #$i_sysndir I_SYS_NDIR          /**/
18691 #$i_systypes I_SYS_TYPES        /**/
18692
18693 #if defined(I_SYS_TYPES)
18694 #include <sys/types.h>
18695 #endif
18696 #if defined(I_DIRENT)
18697 #include <dirent.h>
18698 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18699 #include <sys/dir.h>
18700 #endif
18701 #else
18702 #ifdef I_SYS_NDIR
18703 #include <sys/ndir.h>
18704 #else
18705 #ifdef I_SYS_DIR
18706 #ifdef hp9000s500
18707 #include <ndir.h>       /* may be wrong in the future */
18708 #else
18709 #include <sys/dir.h>
18710 #endif
18711 #endif
18712 #endif
18713 #endif
18714 int main() { return closedir(opendir(".")); }
18715 EOM
18716         set try
18717         if eval $compile_ok; then
18718                 if $run ./try > /dev/null 2>&1 ; then
18719                         echo "Yes, it does."
18720                         val="$undef"
18721                 else
18722                         echo "No, it doesn't."
18723                         val="$define"
18724                 fi
18725         else
18726                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18727                 val="$define"
18728         fi
18729         ;;
18730 *)
18731         val="$undef";
18732         ;;
18733 esac
18734 set d_void_closedir
18735 eval $setvar
18736 $rm_try
18737
18738 : see if there is a wait4
18739 set wait4 d_wait4
18740 eval $inlibc
18741
18742 : see if waitpid exists
18743 set waitpid d_waitpid
18744 eval $inlibc
18745
18746 : see if wcstombs exists
18747 set wcstombs d_wcstombs
18748 eval $inlibc
18749
18750 : see if wctomb exists
18751 set wctomb d_wctomb
18752 eval $inlibc
18753
18754 : see if writev exists
18755 set writev d_writev
18756 eval $inlibc
18757
18758 : preserve RCS keywords in files with variable substitution, grrr
18759 Date='$Date'
18760 Id='$Id'
18761 Log='$Log'
18762 RCSfile='$RCSfile'
18763 Revision='$Revision'
18764
18765 : check for alignment requirements
18766 echo " "
18767 case "$usecrosscompile$multiarch" in
18768 *$define*)
18769         $cat <<EOM
18770 You seem to be either cross-compiling or doing a multiarchitecture build,
18771 skipping the memory alignment check.
18772
18773 EOM
18774         case "$alignbytes" in
18775         '') alignbytes=8 ;;
18776         esac
18777         ;;
18778 *)
18779         case "$alignbytes" in
18780         '') echo "Checking alignment constraints..." >&4
18781                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18782                         $cat >try.c <<'EOCP'
18783 typedef long double NV;
18784 EOCP
18785                 else
18786                         $cat >try.c <<'EOCP'
18787 typedef double NV;
18788 EOCP
18789                 fi
18790                 $cat >>try.c <<'EOCP'
18791 #include <stdio.h>
18792 struct foobar {
18793         char foo;
18794         NV bar;
18795 } try_algn;
18796 int main()
18797 {
18798     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18799     return(0);
18800 }
18801 EOCP
18802                 set try
18803                 if eval $compile_ok; then
18804                         dflt=`$run ./try`
18805                 else
18806                         dflt='8'
18807                         echo "(I can't seem to compile the test program...)"
18808                 fi
18809                 ;;
18810         *) dflt="$alignbytes"
18811                 ;;
18812         esac
18813         rp="Doubles must be aligned on a how-many-byte boundary?"
18814         . ./myread
18815         alignbytes="$ans"
18816         $rm_try
18817         ;;
18818 esac
18819
18820
18821 : set the base revision
18822 baserev=5.0
18823
18824 : check for length of character
18825 echo " "
18826 case "$charsize" in
18827 '')
18828         echo "Checking to see how big your characters are (hey, you never know)..." >&4
18829         $cat >try.c <<EOCP
18830 #include <stdio.h>
18831 #$i_stdlib I_STDLIB
18832 #ifdef I_STDLIB
18833 #include <stdlib.h>
18834 #endif
18835 int main()
18836 {
18837     printf("%d\n", (int)sizeof(char));
18838     exit(0);
18839 }
18840 EOCP
18841         set try
18842         if eval $compile_ok; then
18843                 dflt=`$run ./try`
18844         else
18845                 dflt='1'
18846                 echo "(I can't seem to compile the test program.  Guessing...)"
18847         fi
18848         ;;
18849 *)
18850         dflt="$charsize"
18851         ;;
18852 esac
18853 rp="What is the size of a character (in bytes)?"
18854 . ./myread
18855 charsize="$ans"
18856 $rm_try
18857
18858 : Check for the number of bits in a character
18859 case "$charbits" in
18860 '')     echo "Checking how long a character is (in bits)..." >&4
18861         $cat >try.c <<EOCP
18862 #include <stdio.h>
18863 int main ()
18864 {
18865     int n;
18866     unsigned char c;
18867     for (c = 1, n = 0; c; c <<= 1, n++) ;
18868     printf ("%d\n", n);
18869     return (0);
18870     }
18871 EOCP
18872         set try
18873         if eval $compile_ok; then
18874                 dflt=`$run ./try`
18875         else
18876                 dflt='8'
18877                 echo "(I can't seem to compile the test program.  Guessing...)"
18878         fi
18879         ;;
18880 *)
18881         dflt="$charbits"
18882         ;;
18883 esac
18884 rp="What is the length of a character (in bits)?"
18885 . ./myread
18886 charbits="$ans"
18887 $rm_try
18888 case "$charbits" in
18889 8)      ;;
18890 *)      cat >&4 << EOM
18891 Your system has an unsigned character size of $charbits bits, which
18892 is rather unusual (normally it is 8 bits).  Perl likely will not work
18893 correctly on your system, with subtle bugs in various places.
18894 EOM
18895         rp='Do you really want to continue?'
18896         dflt='n'
18897         . ./myread
18898         case "$ans" in
18899                 [yY])   echo >&4 "Okay, continuing."    ;;
18900                 *)      exit 1                          ;;
18901         esac
18902 esac
18903
18904 : how do we concatenate cpp tokens here?
18905 echo " "
18906 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18907 $cat >cpp_stuff.c <<'EOCP'
18908 #define RCAT(a,b)a/**/b
18909 #define ACAT(a,b)a ## b
18910 RCAT(Rei,ser)
18911 ACAT(Cir,cus)
18912 EOCP
18913 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18914 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18915         echo "Oh!  Smells like ANSI's been here." >&4
18916         echo "We can catify or stringify, separately or together!"
18917         cpp_stuff=42
18918 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18919         echo "Ah, yes!  The good old days!" >&4
18920         echo "However, in the good old days we don't know how to stringify and"
18921         echo "catify at the same time."
18922         cpp_stuff=1
18923 else
18924         $cat >&4 <<EOM
18925 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18926 You're going to have to edit the values of CAT[2-5] in config.h...
18927 EOM
18928         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18929 fi
18930 $rm -f cpp_stuff.*
18931
18932 : see if this is a db.h system
18933 set db.h i_db
18934 eval $inhdr
18935
18936 case "$i_db" in
18937 $define)
18938         : Check db version.
18939         echo " "
18940         echo "Checking Berkeley DB version ..." >&4
18941         $cat >try.c <<EOCP
18942 #$d_const HASCONST
18943 #ifndef HASCONST
18944 #define const
18945 #endif
18946 #include <sys/types.h>
18947 #include <stdio.h>
18948 #$i_stdlib I_STDLIB
18949 #ifdef I_STDLIB
18950 #include <stdlib.h>
18951 #endif
18952 #include <db.h>
18953 int main(int argc, char *argv[])
18954 {
18955 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18956     int Major, Minor, Patch ;
18957     unsigned long Version ;
18958     (void)db_version(&Major, &Minor, &Patch) ;
18959     if (argc == 2) {
18960         printf("%d %d %d %d %d %d\n",
18961                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18962                Major, Minor, Patch);
18963         exit(0);
18964     }
18965     printf("You have Berkeley DB Version 2 or greater.\n");
18966
18967     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18968                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18969     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18970                 Major, Minor, Patch) ;
18971
18972     /* check that db.h & libdb are compatible */
18973     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18974         printf("db.h and libdb are incompatible.\n") ;
18975         exit(3);
18976     }
18977
18978     printf("db.h and libdb are compatible.\n") ;
18979
18980     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18981                 + DB_VERSION_PATCH ;
18982
18983     /* needs to be >= 2.3.4 */
18984     if (Version < 2003004) {
18985     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18986         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18987         exit(2);
18988     }
18989
18990     exit(0);
18991 #else
18992 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18993     if (argc == 2) {
18994         printf("1 0 0\n");
18995         exit(0);
18996     }
18997     printf("You have Berkeley DB Version 1.\n");
18998     exit(0);    /* DB version < 2: the coast is clear. */
18999 #else
19000     exit(1);    /* <db.h> not Berkeley DB? */
19001 #endif
19002 #endif
19003 }
19004 EOCP
19005         set try
19006         if eval $compile_ok && $run ./try; then
19007                 echo 'Looks OK.' >&4
19008                 set `$run ./try 1`
19009                 db_version_major=$1
19010                 db_version_minor=$2
19011                 db_version_patch=$3
19012         else
19013                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19014                 i_db=$undef
19015                 case " $libs " in
19016                 *"-ldb "*)
19017                         : Remove db from list of libraries to use
19018                         echo "Removing unusable -ldb from library list" >&4
19019                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19020                         shift
19021                         libs="$*"
19022                         echo "libs = $libs" >&4
19023                         ;;
19024                 esac
19025         fi
19026         $rm_try
19027         ;;
19028 esac
19029
19030 case "$i_db" in
19031 define)
19032         : Check the return type needed for hash
19033         echo " "
19034         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19035         $cat >try.c <<EOCP
19036 #$d_const HASCONST
19037 #ifndef HASCONST
19038 #define const
19039 #endif
19040 #include <sys/types.h>
19041 #include <db.h>
19042
19043 #ifndef DB_VERSION_MAJOR
19044 u_int32_t hash_cb (ptr, size)
19045 const void *ptr;
19046 size_t size;
19047 {
19048 }
19049 HASHINFO info;
19050 int main()
19051 {
19052         info.hash = hash_cb;
19053 }
19054 #endif
19055 EOCP
19056         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19057                 if $contains warning try.out >>/dev/null 2>&1 ; then
19058                         db_hashtype='int'
19059                 else
19060                         db_hashtype='u_int32_t'
19061                 fi
19062         else
19063                 : XXX Maybe we should just give up here.
19064                 db_hashtype=u_int32_t
19065                 $cat try.out >&4
19066                 echo "Help:  I can't seem to compile the db test program." >&4
19067                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19068         fi
19069         $rm_try
19070         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19071         ;;
19072 *)      db_hashtype=u_int32_t
19073         ;;
19074 esac
19075 case "$i_db" in
19076 define)
19077         : Check the return type needed for prefix
19078         echo " "
19079         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19080         cat >try.c <<EOCP
19081 #$d_const HASCONST
19082 #ifndef HASCONST
19083 #define const
19084 #endif
19085 #include <sys/types.h>
19086 #include <db.h>
19087
19088 #ifndef DB_VERSION_MAJOR
19089 size_t prefix_cb (key1, key2)
19090 const DBT *key1;
19091 const DBT *key2;
19092 {
19093 }
19094 BTREEINFO info;
19095 int main()
19096 {
19097         info.prefix = prefix_cb;
19098 }
19099 #endif
19100 EOCP
19101         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19102                 if $contains warning try.out >>/dev/null 2>&1 ; then
19103                         db_prefixtype='int'
19104                 else
19105                         db_prefixtype='size_t'
19106                 fi
19107         else
19108                 db_prefixtype='size_t'
19109                 : XXX Maybe we should just give up here.
19110                 $cat try.out >&4
19111                 echo "Help:  I can't seem to compile the db test program." >&4
19112                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19113         fi
19114         $rm_try
19115         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19116         ;;
19117 *)      db_prefixtype='size_t'
19118         ;;
19119 esac
19120
19121 : How can we generate normalized random numbers ?
19122 echo " "
19123 echo "Looking for a random number function..." >&4
19124 case "$randfunc" in
19125 '')
19126         if set drand48 val -f; eval $csym; $val; then
19127                 dflt="drand48"
19128                 echo "Good, found drand48()." >&4
19129         elif set random val -f; eval $csym; $val; then
19130                 dflt="random"
19131                 echo "OK, found random()." >&4
19132         else
19133                 dflt="rand"
19134                 echo "Yick, looks like I have to use rand()." >&4
19135         fi
19136         echo " "
19137         ;;
19138 *)
19139         dflt="$randfunc"
19140         ;;
19141 esac
19142 cont=true
19143
19144 case "$ccflags" in
19145 *-Dmy_rand=*|*-Dmy_srand=*)
19146         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19147         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19148         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19149         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19150         ;;
19151 esac
19152
19153 while $test "$cont"; do
19154         rp="Use which function to generate random numbers?"
19155         . ./myread
19156         if $test "$ans" = "$dflt"; then
19157                 : null
19158         else
19159                 randbits=''
19160         fi
19161         randfunc="$ans"
19162         if set $ans val -f; eval $csym; $val; then
19163                 cont=''
19164         else
19165                 dflt=y
19166                 rp="I cannot find function $ans. Use that name anyway?"
19167                 . ./myread
19168                 dflt=rand
19169                 case "$ans" in
19170                         [yY]*) cont='';;
19171                 esac
19172         fi
19173         case "$cont" in
19174         '')
19175                 case "$randfunc" in
19176                 drand48)
19177                         drand01="drand48()"
19178                         seedfunc="srand48"
19179                         randbits=48
19180                         randseedtype=long
19181                         ;;
19182                 rand|random)
19183                         case "$randbits" in
19184                         '')
19185 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19186                                 $cat >try.c <<EOCP
19187 #$i_unistd I_UNISTD
19188 #$i_stdlib I_STDLIB
19189 #include <stdio.h>
19190 #ifdef I_UNISTD
19191 #  include <unistd.h>
19192 #endif
19193 #ifdef I_STDLIB
19194 #  include <stdlib.h>
19195 #endif
19196 int main()
19197 {
19198         register int i;
19199         register unsigned long tmp;
19200         register unsigned long max = 0L;
19201
19202         for (i = 1000; i; i--) {
19203                 tmp = (unsigned long) $randfunc();
19204                 if (tmp > max) max = tmp;
19205         }
19206         for (i = 0; max; i++)
19207                 max /= 2;
19208         printf("%d\n",i);
19209 }
19210 EOCP
19211                                 set try
19212                                 if eval $compile_ok; then
19213                                         dflt=`try`
19214                                 else
19215                                         dflt='?'
19216                                         echo "(I can't seem to compile the test program...)"
19217                                 fi
19218                                 ;;
19219                         *)
19220                                 dflt="$randbits"
19221                                 ;;
19222                         esac
19223                         rp="How many bits does your $randfunc() function produce?"
19224                         . ./myread
19225                         randbits="$ans"
19226                         $rm_try
19227                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19228                         seedfunc="s$randfunc"
19229                         randseedtype=unsigned
19230                         ;;
19231                 *)
19232                         dflt="31"
19233                         rp="How many bits does your $randfunc() function produce?"
19234                         . ./myread
19235                         randbits="$ans"
19236                         seedfunc="s$randfunc"
19237                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19238                         if set $seedfunc val -f; eval $csym; $val; then
19239                                 echo "(Using $seedfunc() to seed random generator)"
19240                         else
19241                                 echo "(Warning: no $seedfunc() to seed random generator)"
19242                                 seedfunc=rand
19243                         fi
19244                         randseedtype=unsigned
19245                         ;;
19246                 esac
19247                 ;;
19248         esac
19249 done
19250
19251 : Determine if this is an EBCDIC system
19252 echo " "
19253 echo "Determining whether or not we are on an EBCDIC system..." >&4
19254 $cat >try.c <<'EOM'
19255 int main()
19256 {
19257   if ('M'==0xd4) return 0;
19258   return 1;
19259 }
19260 EOM
19261
19262 val=$undef
19263 set try
19264 if eval $compile_ok; then
19265         if $run ./try; then
19266                 echo "You seem to speak EBCDIC." >&4
19267                 val="$define"
19268         else
19269                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19270         fi
19271 else
19272         echo "I'm unable to compile the test program." >&4
19273         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19274 fi
19275 $rm_try
19276 set ebcdic
19277 eval $setvar
19278
19279 : Check how to flush
19280 echo " "
19281 $cat >&4 <<EOM
19282 Checking how to flush all pending stdio output...
19283 EOM
19284 # I only know how to find the first 32 possibly open files on SunOS.
19285 # See also hints/sunos_4_1.sh and util.c  --AD
19286 case "$osname" in
19287 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19288 esac
19289 $cat >>try.c <<EOCP
19290 #include <stdio.h>
19291 #$i_stdlib I_STDLIB
19292 #ifdef I_STDLIB
19293 #include <stdlib.h>
19294 #endif
19295 #$i_unistd I_UNISTD
19296 #ifdef I_UNISTD
19297 # include <unistd.h>
19298 #endif
19299 #$d_sysconf HAS_SYSCONF
19300 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19301 #ifdef HAS_STDIO_STREAM_ARRAY
19302 # define STDIO_STREAM_ARRAY $stdio_stream_array
19303 #endif
19304 int main() {
19305   FILE* p;
19306   unlink("try.out");
19307   p = fopen("try.out", "w");
19308 #ifdef TRY_FPUTC
19309   fputc('x', p);
19310 #else
19311 # ifdef TRY_FPRINTF
19312   fprintf(p, "x");
19313 # endif
19314 #endif
19315 #ifdef TRY_FFLUSH_NULL
19316   fflush(NULL);
19317 #endif
19318 #ifdef TRY_FFLUSH_ALL
19319   {
19320     long open_max = -1;
19321 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19322     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19323 # else
19324 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19325     open_max = sysconf(_SC_OPEN_MAX);
19326 #  else
19327 #   ifdef FOPEN_MAX
19328     open_max = FOPEN_MAX;
19329 #   else
19330 #    ifdef OPEN_MAX
19331     open_max = OPEN_MAX;
19332 #    else
19333 #     ifdef _NFILE
19334     open_max = _NFILE;
19335 #     endif
19336 #    endif
19337 #   endif
19338 #  endif
19339 # endif
19340 # ifdef HAS_STDIO_STREAM_ARRAY
19341     if (open_max > 0) {
19342       long i;
19343       for (i = 0; i < open_max; i++)
19344             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19345                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19346                 STDIO_STREAM_ARRAY[i]._flag)
19347                 fflush(&STDIO_STREAM_ARRAY[i]);
19348     }
19349   }
19350 # endif
19351 #endif
19352   _exit(42);
19353 }
19354 EOCP
19355 : first we have to find out how _not_ to flush
19356 $to try.c
19357 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19358     output=''
19359     set try -DTRY_FPUTC
19360     if eval $compile; then
19361             $run ./try 2>/dev/null
19362             code="$?"
19363             $from try.out
19364             if $test ! -s try.out -a "X$code" = X42; then
19365                 output=-DTRY_FPUTC
19366             fi
19367     fi
19368     case "$output" in
19369     '')
19370             set try -DTRY_FPRINTF
19371             if eval $compile; then
19372                     $run ./try 2>/dev/null
19373                     code="$?"
19374                     $from try.out
19375                     if $test ! -s try.out -a "X$code" = X42; then
19376                         output=-DTRY_FPRINTF
19377                     fi
19378             fi
19379         ;;
19380     esac
19381 fi
19382 : check for fflush NULL behaviour
19383 case "$fflushNULL" in
19384 '')     set try -DTRY_FFLUSH_NULL $output
19385         if eval $compile; then
19386                 $run ./try 2>/dev/null
19387                 code="$?"
19388                 $from try.out
19389                 if $test -s try.out -a "X$code" = X42; then
19390                         fflushNULL="`$cat try.out`"
19391                 else
19392                         if $test "X$code" != X42; then
19393                                 $cat >&4 <<EOM
19394 (If this test failed, don't worry, we'll try another method shortly.)
19395 EOM
19396                         fi
19397                 fi
19398         fi
19399         $rm -f core try.core core.try.*
19400         case "$fflushNULL" in
19401         x)      $cat >&4 <<EOM
19402 Your fflush(NULL) works okay for output streams.
19403 Let's see if it clobbers input pipes...
19404 EOM
19405 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19406 # bug that improperly flushes the input end of pipes.  So we avoid the
19407 # autoflush on fork/system/exec support for now. :-(
19408 $cat >tryp.c <<EOCP
19409 #include <stdio.h>
19410 int
19411 main(int argc, char **argv)
19412 {
19413     char buf[1024];
19414     int i;
19415     char *bp = buf;
19416     while (1) {
19417         while ((i = getc(stdin)) != -1
19418                && (*bp++ = i) != '\n'
19419                && bp < &buf[1024])
19420         /* DO NOTHING */ ;
19421         *bp = '\0';
19422         fprintf(stdout, "%s", buf);
19423         fflush(NULL);
19424         if (i == -1)
19425             return 0;
19426         bp = buf;
19427     }
19428 }
19429 EOCP
19430                 fflushNULL="$define"
19431                 set tryp
19432                 if eval $compile; then
19433                     $rm -f tryp.out
19434                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19435                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19436                        $cat >&4 <<EOM
19437 fflush(NULL) seems to behave okay with input streams.
19438 EOM
19439                         fflushNULL="$define"
19440                     else
19441                         $cat >&4 <<EOM
19442 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19443 EOM
19444                         fflushNULL="$undef"
19445                     fi
19446                 fi
19447                 $rm -f core tryp.c tryp.core core.tryp.*
19448                 ;;
19449         '')     $cat >&4 <<EOM
19450 Your fflush(NULL) isn't working (contrary to ANSI C).
19451 EOM
19452                 fflushNULL="$undef"
19453                 ;;
19454         *)      $cat >&4 <<EOM
19455 Cannot figure out whether your fflush(NULL) works or not.
19456 I'm assuming it doesn't (contrary to ANSI C).
19457 EOM
19458                 fflushNULL="$undef"
19459                 ;;
19460         esac
19461         ;;
19462 $define|true|[yY]*)
19463         fflushNULL="$define"
19464         ;;
19465 *)
19466         fflushNULL="$undef"
19467         ;;
19468 esac
19469 : check explicit looping only if NULL did not work, and if the pipe
19470 : bug does not show up on an explicit flush too
19471 case "$fflushNULL" in
19472 "$undef")
19473         $cat >tryp.c <<EOCP
19474 #include <stdio.h>
19475 int
19476 main(int argc, char **argv)
19477 {
19478     char buf[1024];
19479     int i;
19480     char *bp = buf;
19481     while (1) {
19482         while ((i = getc(stdin)) != -1
19483                && (*bp++ = i) != '\n'
19484                && bp < &buf[1024])
19485         /* DO NOTHING */ ;
19486         *bp = '\0';
19487         fprintf(stdout, "%s", buf);
19488         fflush(stdin);
19489         if (i == -1)
19490             return 0;
19491         bp = buf;
19492     }
19493 }
19494 EOCP
19495         set tryp
19496         if eval $compile; then
19497             $rm -f tryp.out
19498             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19499             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19500                $cat >&4 <<EOM
19501 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19502 EOM
19503                 : now check for fflushall behaviour
19504                 case "$fflushall" in
19505                 '')     set try -DTRY_FFLUSH_ALL $output
19506                         if eval $compile; then
19507                                 $cat >&4 <<EOM
19508 (Now testing the other method--but note that this also may fail.)
19509 EOM
19510                                 $run ./try 2>/dev/null
19511                                 code=$?
19512                                 $from try.out
19513                                 if $test -s try.out -a "X$code" = X42; then
19514                                         fflushall="`$cat try.out`"
19515                                 fi
19516                         fi
19517                         $rm_try
19518                         case "$fflushall" in
19519                         x)      $cat >&4 <<EOM
19520 Whew. Flushing explicitly all the stdio streams works.
19521 EOM
19522                                 fflushall="$define"
19523                                 ;;
19524                         '')     $cat >&4 <<EOM
19525 Sigh. Flushing explicitly all the stdio streams doesn't work.
19526 EOM
19527                                 fflushall="$undef"
19528                                 ;;
19529                         *)      $cat >&4 <<EOM
19530 Cannot figure out whether flushing stdio streams explicitly works or not.
19531 I'm assuming it doesn't.
19532 EOM
19533                                 fflushall="$undef"
19534                                 ;;
19535                         esac
19536                         ;;
19537                 "$define"|true|[yY]*)
19538                         fflushall="$define"
19539                         ;;
19540                 *)
19541                         fflushall="$undef"
19542                         ;;
19543                 esac
19544             else
19545                 $cat >&4 <<EOM
19546 All is futile.  Even fflush(stdin) clobbers input pipes!
19547 EOM
19548                 fflushall="$undef"
19549             fi
19550         else
19551             fflushall="$undef"
19552         fi
19553         $rm -f core tryp.c tryp.core core.tryp.*
19554         ;;
19555 *)      fflushall="$undef"
19556         ;;
19557 esac
19558
19559 case "$fflushNULL$fflushall" in
19560 undefundef)
19561         $cat <<EOM
19562 OK, I give up.  I cannot figure out how to flush pending stdio output.
19563 We won't be flushing handles at all before fork/exec/popen.
19564 EOM
19565         ;;
19566 esac
19567 $rm_try tryp
19568
19569 : Store the full pathname to the ar program for use in the C program
19570 : Respect a hint or command line value for full_ar.
19571 case "$full_ar" in
19572 '') full_ar=$ar ;;
19573 esac
19574
19575 : Store the full pathname to the sed program for use in the C program
19576 full_sed=$sed
19577
19578 : see what type gids are declared as in the kernel
19579 echo " "
19580 echo "Looking for the type for group ids returned by getgid()."
19581 set gid_t gidtype xxx stdio.h sys/types.h
19582 eval $typedef
19583 case "$gidtype" in
19584 xxx)
19585         xxx=`./findhdr sys/user.h`
19586         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19587         case $1 in
19588         unsigned) dflt="$1 $2" ;;
19589         *) dflt="$1" ;;
19590         esac
19591         ;;
19592 *) dflt="$gidtype";;
19593 esac
19594 case "$gidtype" in
19595 gid_t) echo "gid_t found." ;;
19596 *)      rp="What is the type for group ids returned by getgid()?"
19597         . ./myread
19598         gidtype="$ans"
19599         ;;
19600 esac
19601
19602 : Check the size of GID
19603 echo " "
19604 case "$gidtype" in
19605 *_t) zzz="$gidtype"     ;;
19606 *)   zzz="gid"          ;;
19607 esac
19608 echo "Checking the size of $zzz..." >&4
19609 cat > try.c <<EOCP
19610 #include <sys/types.h>
19611 #include <stdio.h>
19612 #$i_stdlib I_STDLIB
19613 #ifdef I_STDLIB
19614 #include <stdlib.h>
19615 #endif
19616 int main() {
19617     printf("%d\n", (int)sizeof($gidtype));
19618     exit(0);
19619 }
19620 EOCP
19621 set try
19622 if eval $compile_ok; then
19623         yyy=`$run ./try`
19624         case "$yyy" in
19625         '')     gidsize=4
19626                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19627                 ;;
19628         *)      gidsize=$yyy
19629                 echo "Your $zzz is $gidsize bytes long."
19630                 ;;
19631         esac
19632 else
19633         gidsize=4
19634         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19635 fi
19636
19637
19638 : Check if GID is signed
19639 echo " "
19640 case "$gidtype" in
19641 *_t) zzz="$gidtype"     ;;
19642 *)   zzz="gid"          ;;
19643 esac
19644 echo "Checking the sign of $zzz..." >&4
19645 cat > try.c <<EOCP
19646 #include <sys/types.h>
19647 #include <stdio.h>
19648 int main() {
19649         $gidtype foo = -1;
19650         if (foo < 0)
19651                 printf("-1\n");
19652         else
19653                 printf("1\n");
19654 }
19655 EOCP
19656 set try
19657 if eval $compile; then
19658         yyy=`$run ./try`
19659         case "$yyy" in
19660         '')     gidsign=1
19661                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19662                 ;;
19663         *)      gidsign=$yyy
19664                 case "$gidsign" in
19665                  1) echo "Your $zzz is unsigned." ;;
19666                 -1) echo "Your $zzz is signed."   ;;
19667                 esac
19668                 ;;
19669         esac
19670 else
19671         gidsign=1
19672         echo "(I can't compile the test program--guessing unsigned.)" >&4
19673 fi
19674
19675
19676 : Check 64bit sizes
19677 echo " "
19678
19679 if $test X"$quadtype" != X; then
19680
19681 echo "Checking how to print 64-bit integers..." >&4
19682
19683 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19684         $cat >try.c <<'EOCP'
19685 #include <sys/types.h>
19686 #include <stdio.h>
19687 int main() {
19688   int q = 12345678901;
19689   printf("%ld\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='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19698                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19699                         echo "We will use %d."
19700                         ;;
19701                 esac
19702         fi
19703 fi
19704
19705 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19706         $cat >try.c <<'EOCP'
19707 #include <sys/types.h>
19708 #include <stdio.h>
19709 int main() {
19710   long q = 12345678901;
19711   printf("%ld\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='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19720                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19721                         echo "We will use %ld."
19722                         ;;
19723                 esac
19724         fi
19725 fi
19726
19727 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19728         $cat >try.c <<'EOCP'
19729 #include <sys/types.h>
19730 #include <inttypes.h>
19731 #include <stdio.h>
19732 int main() {
19733   int64_t q = 12345678901;
19734   printf("%" PRId64 "\n", q);
19735 }
19736 EOCP
19737         set try
19738         if eval $compile; then
19739                 yyy=`$run ./try`
19740                 case "$yyy" in
19741                 12345678901)
19742                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19743                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19744                         echo "We will use the C9X style."
19745                         ;;
19746                 esac
19747         fi
19748 fi
19749
19750 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19751         $cat >try.c <<EOCP
19752 #include <sys/types.h>
19753 #include <stdio.h>
19754 int main() {
19755   $quadtype q = 12345678901;
19756   printf("%Ld\n", q);
19757 }
19758 EOCP
19759         set try
19760         if eval $compile; then
19761                 yyy=`$run ./try`
19762                 case "$yyy" in
19763                 12345678901)
19764                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19765                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19766                         echo "We will use %Ld."
19767                         ;;
19768                 esac
19769         fi
19770 fi
19771
19772 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19773         $cat >try.c <<'EOCP'
19774 #include <sys/types.h>
19775 #include <stdio.h>
19776 int main() {
19777   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19778   printf("%lld\n", q);
19779 }
19780 EOCP
19781         set try
19782         if eval $compile; then
19783                 yyy=`$run ./try`
19784                 case "$yyy" in
19785                 12345678901)
19786                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19787                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19788                         echo "We will use the %lld style."
19789                         ;;
19790                 esac
19791         fi
19792 fi
19793
19794 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19795         $cat >try.c <<EOCP
19796 #include <sys/types.h>
19797 #include <stdio.h>
19798 int main() {
19799   $quadtype q = 12345678901;
19800   printf("%qd\n", q);
19801 }
19802 EOCP
19803         set try
19804         if eval $compile; then
19805                 yyy=`$run ./try`
19806                 case "$yyy" in
19807                 12345678901)
19808                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19809                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19810                         echo "We will use %qd."
19811                         ;;
19812                 esac
19813         fi
19814 fi
19815
19816 if $test X"$sPRId64" = X; then
19817         echo "Cannot figure out how to print 64-bit integers." >&4
19818 fi
19819 $rm_try
19820
19821 fi
19822
19823 case "$sPRId64" in
19824 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19825         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19826         ;;
19827 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19828         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19829         ;;
19830 esac
19831
19832 : Check format strings for internal types
19833 echo " "
19834 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19835
19836 if $test X"$ivsize" = X8; then
19837         ivdformat="$sPRId64"
19838         uvuformat="$sPRIu64"
19839         uvoformat="$sPRIo64"
19840         uvxformat="$sPRIx64"
19841         uvXUformat="$sPRIXU64"
19842 else
19843         if $test X"$ivsize" = X"$longsize"; then
19844                 ivdformat='"ld"'
19845                 uvuformat='"lu"'
19846                 uvoformat='"lo"'
19847                 uvxformat='"lx"'
19848                 uvXUformat='"lX"'
19849         else
19850                 if $test X"$ivsize" = X"$intsize"; then
19851                         ivdformat='"d"'
19852                         uvuformat='"u"'
19853                         uvoformat='"o"'
19854                         uvxformat='"x"'
19855                         uvXUformat='"X"'
19856                 else
19857                         : far out
19858                         if $test X"$ivsize" = X"$shortsize"; then
19859                                 ivdformat='"hd"'
19860                                 uvuformat='"hu"'
19861                                 uvoformat='"ho"'
19862                                 uvxformat='"hx"'
19863                                 uvXUformat='"hX"'
19864                         fi
19865                 fi
19866         fi
19867 fi
19868
19869 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19870         nveformat="$sPRIeldbl"
19871         nvfformat="$sPRIfldbl"
19872         nvgformat="$sPRIgldbl"
19873         nvEUformat="$sPRIEUldbl"
19874         nvFUformat="$sPRIFUldbl"
19875         nvGUformat="$sPRIGUldbl"
19876 else
19877         nveformat='"e"'
19878         nvfformat='"f"'
19879         nvgformat='"g"'
19880         nvEUformat='"E"'
19881         nvFUformat='"F"'
19882         nvGUformat='"G"'
19883 fi
19884
19885 case "$ivdformat" in
19886 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19887     exit 1
19888     ;;
19889 esac
19890
19891 : Check format string for GID
19892
19893 echo " "
19894 $echo "Checking the format string to be used for gids..." >&4
19895
19896 case "$gidsign" in
19897 -1)     if $test X"$gidsize" = X"$ivsize"; then
19898                 gidformat="$ivdformat"
19899         else
19900                 if $test X"$gidsize" = X"$longsize"; then
19901                         gidformat='"ld"'
19902                 else
19903                         if $test X"$gidsize" = X"$intsize"; then
19904                                 gidformat='"d"'
19905                         else
19906                                 if $test X"$gidsize" = X"$shortsize"; then
19907                                         gidformat='"hd"'
19908                                 fi
19909                         fi
19910                 fi
19911         fi
19912         ;;
19913 *)      if $test X"$gidsize" = X"$uvsize"; then
19914                 gidformat="$uvuformat"
19915         else
19916                 if $test X"$gidsize" = X"$longsize"; then
19917                         gidformat='"lu"'
19918                 else
19919                         if $test X"$gidsize" = X"$intsize"; then
19920                                 gidformat='"u"'
19921                         else
19922                                 if $test X"$gidsize" = X"$shortsize"; then
19923                                         gidformat='"hu"'
19924                                 fi
19925                         fi
19926                 fi
19927         fi
19928         ;;
19929 esac
19930
19931 : see if getgroups exists
19932 set getgroups d_getgrps
19933 eval $inlibc
19934
19935 : see if setgroups exists
19936 set setgroups d_setgrps
19937 eval $inlibc
19938
19939 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19940 echo " "
19941 case "$d_getgrps$d_setgrps" in
19942 *define*)
19943         case "$groupstype" in
19944         '') dflt="$gidtype" ;;
19945         *)  dflt="$groupstype" ;;
19946         esac
19947         $cat <<EOM
19948 What type of pointer is the second argument to getgroups() and setgroups()?
19949 Usually this is the same as group ids, $gidtype, but not always.
19950
19951 EOM
19952         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19953         . ./myread
19954         groupstype="$ans"
19955         ;;
19956 *)  groupstype="$gidtype";;
19957 esac
19958
19959 : MAD = Misc Attribute Definition
19960
19961 if $test $patchlevel -lt 9; then
19962 : MAD is not available in 5.8.x or earlier.
19963     ans=n;
19964 else
19965     case "$mad" in
19966     $define|true|[yY]*) dflt='y' ;;
19967     *)                  dflt='n' ;;
19968     esac
19969     cat <<EOM
19970
19971 Would you like to build with Misc Attribute Decoration? This is development
19972 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19973 overhead on the interpreter.
19974
19975 If this doesn't make any sense to you, just accept the default '$dflt'.
19976 EOM
19977     rp='Build Perl with MAD?'
19978     . ./myread
19979 fi
19980 case "$ans" in
19981 y|Y)    val="$define"
19982         madlyh='madly.h madly.act madly.tab'
19983         madlysrc='madly.c'
19984         madlyobj="madly$_o" ;;
19985 *)      val="$undef"
19986         madlyh=''
19987         madlysrc=''
19988         madlyobj='' ;;
19989 esac
19990 set mad
19991 eval $setvar
19992
19993 : check whether make sets MAKE
19994 echo " "
19995 echo "Checking if your $make program sets \$(MAKE)..." >&4
19996 case "$make_set_make" in
19997 '')
19998         $sed 's/^X //' > testmake.mak << 'EOF'
19999 Xall:
20000 X       @echo 'maketemp="$(MAKE)"'
20001 EOF
20002         case "`$make -f testmake.mak 2>/dev/null`" in
20003         *maketemp=*) make_set_make='#' ;;
20004         *)      make_set_make="MAKE=$make" ;;
20005         esac
20006         $rm -f testmake.mak
20007         ;;
20008 esac
20009 case "$make_set_make" in
20010 '#') echo "Yup, it does.";;
20011 *) echo "Nope, it doesn't.";;
20012 esac
20013
20014 : see what type is used for mode_t
20015 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20016 set mode_t modetype int stdio.h sys/types.h
20017 eval $typedef_ask
20018
20019 : see if we need va_copy
20020 echo " "
20021 case "$i_stdarg" in
20022 "$define")
20023         $cat >try.c <<EOCP
20024 #include <stdarg.h>
20025 #include <stdio.h>
20026 #$i_stdlib I_STDLIB
20027 #ifdef I_STDLIB
20028 #include <stdlib.h>
20029 #endif
20030 #include <signal.h>
20031
20032 int
20033 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20034 {
20035   return vfprintf(f, fmt, *valp);
20036 }
20037
20038 int
20039 myvfprintf(FILE *f, const  char *fmt, va_list val)
20040 {
20041   return ivfprintf(f, fmt, &val);
20042 }
20043
20044 int
20045 myprintf(char *fmt, ...)
20046 {
20047   va_list val;
20048   va_start(val, fmt);
20049   return myvfprintf(stdout, fmt, val);
20050 }
20051
20052 int
20053 main(int ac, char **av)
20054 {
20055   signal(SIGSEGV, exit);
20056
20057   myprintf("%s%cs all right, then\n", "that", '\'');
20058   exit(0);
20059 }
20060 EOCP
20061         set try
20062         if eval $compile && $run ./try 2>&1 >/dev/null; then
20063                 case "`$run ./try`" in
20064                 "that's all right, then")
20065                         okay=yes
20066                         ;;
20067                 esac
20068         fi
20069         case "$okay" in
20070         yes)    echo "It seems that you don't need va_copy()." >&4
20071                 need_va_copy="$undef"
20072                 ;;
20073         *)      echo "It seems that va_copy() or similar will be needed." >&4
20074                 need_va_copy="$define"
20075                 ;;
20076         esac
20077         $rm_try
20078         ;;
20079 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20080         ;;
20081 esac
20082
20083 : see what type is used for size_t
20084 rp="What is the type used for the length parameter for string functions?"
20085 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20086 eval $typedef_ask
20087
20088 : check for type of arguments to gethostbyaddr. 
20089 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20090         case "$d_gethbyaddr" in
20091         $define)
20092                 $cat <<EOM
20093
20094 Checking to see what type of arguments are accepted by gethostbyaddr().
20095 EOM
20096                 hdrs="$define sys/types.h
20097                         $d_socket sys/socket.h 
20098                         $i_niin netinet/in.h 
20099                         $i_netdb netdb.h
20100                         $i_unistd unistd.h"
20101                 : The first arg can 'char *' or 'void *'
20102                 : The second arg is some of integral type
20103                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20104                         for yyy in size_t long int; do
20105                                 case "$netdb_host_type" in
20106                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20107                                         if ./protochk "$try" $hdrs; then
20108                                                 echo "Your system accepts $xxx for the first arg."
20109                                                 echo "...and $yyy for the second arg."
20110                                                 netdb_host_type="$xxx"
20111                                                 netdb_hlen_type="$yyy"
20112                                         fi
20113                                         ;;
20114                                 esac
20115                         done
20116                 done
20117                 : In case none of those worked, prompt the user.
20118                 case "$netdb_host_type" in
20119                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20120                         dflt='char *'
20121                         . ./myread
20122                         netdb_host_type=$ans
20123                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20124                         dflt="$sizetype"
20125                         . ./myread
20126                         netdb_hlen_type=$ans
20127                         ;;
20128                 esac
20129                 ;;
20130         *)      : no gethostbyaddr, so pick harmless defaults
20131                 netdb_host_type='char *'
20132                 netdb_hlen_type="$sizetype"
20133                 ;;
20134         esac
20135         # Remove the "const" if needed. -- but then we'll have a 
20136         # prototype clash!
20137         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20138 fi
20139
20140 : check for type of argument to gethostbyname. 
20141 if test "X$netdb_name_type" = X ; then
20142         case "$d_gethbyname" in
20143         $define)
20144                 $cat <<EOM
20145
20146 Checking to see what type of argument is accepted by gethostbyname().
20147 EOM
20148                 hdrs="$define sys/types.h
20149                         $d_socket sys/socket.h 
20150                         $i_niin netinet/in.h 
20151                         $i_netdb netdb.h
20152                         $i_unistd unistd.h"
20153                 for xxx in "const char *" "char *"; do
20154                         case "$netdb_name_type" in
20155                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20156                                 if ./protochk "$try" $hdrs; then
20157                                         echo "Your system accepts $xxx."
20158                                         netdb_name_type="$xxx"
20159                                 fi
20160                                 ;;
20161                         esac
20162                 done
20163                 : In case none of those worked, prompt the user.
20164                 case "$netdb_name_type" in
20165                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20166                         dflt='char *'
20167                         . ./myread
20168                         netdb_name_type=$ans
20169                         ;;
20170                 esac
20171                 ;;
20172         *)      : no gethostbyname, so pick harmless default
20173                 netdb_name_type='char *'
20174                 ;;
20175         esac
20176 fi
20177
20178 : check for type of 1st argument to getnetbyaddr. 
20179 if test "X$netdb_net_type" = X ; then
20180         case "$d_getnbyaddr" in
20181         $define)
20182                 $cat <<EOM
20183
20184 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20185 EOM
20186                 hdrs="$define sys/types.h
20187                         $d_socket sys/socket.h 
20188                         $i_niin netinet/in.h 
20189                         $i_netdb netdb.h
20190                         $i_unistd unistd.h"
20191                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20192                         case "$netdb_net_type" in
20193                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20194                                 if ./protochk "$try" $hdrs; then
20195                                         echo "Your system accepts $xxx."
20196                                         netdb_net_type="$xxx"
20197                                 fi
20198                                 ;;
20199                         esac
20200                 done
20201                 : In case none of those worked, prompt the user.
20202                 case "$netdb_net_type" in
20203                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20204                         dflt='long'
20205                         . ./myread
20206                         netdb_net_type=$ans
20207                         ;;
20208                 esac
20209                 ;;
20210         *)      : no getnetbyaddr, so pick harmless default
20211                 netdb_net_type='long'
20212                 ;;
20213         esac
20214 fi
20215 : locate the preferred pager for this system
20216 fn=f/
20217 case "$pager" in
20218 '')
20219         dflt=''
20220         case "$pg" in
20221         /*) dflt=$pg;;
20222         [a-zA-Z]:/*) dflt=$pg;;
20223         esac
20224         case "$more" in
20225         /*) dflt=$more;;
20226         [a-zA-Z]:/*) dflt=$more;;
20227         esac
20228         case "$less" in
20229         /*) dflt=$less;;
20230         [a-zA-Z]:/*) dflt=$less;;
20231         esac
20232         case "$dflt" in
20233         '') dflt=/usr/ucb/more;;
20234         esac
20235         ;;
20236 *)      dflt="$pager"
20237         fn="f/($pager)"
20238         ;;
20239 esac
20240 echo " "
20241 rp='What pager is used on your system?'
20242 . ./getfile
20243 pager="$ans"
20244
20245 : see what type pids are declared as in the kernel
20246 rp="What is the type of process ids on this system?"
20247 set pid_t pidtype int stdio.h sys/types.h
20248 eval $typedef_ask
20249
20250 : see if ar generates random libraries by itself
20251 echo " "
20252 echo "Checking how to generate random libraries on your machine..." >&4
20253 echo 'int bar1() { return bar2(); }' > bar1.c
20254 echo 'int bar2() { return 2; }' > bar2.c
20255 $cat > foo.c <<EOP
20256 #$i_stdlib I_STDLIB
20257 #ifdef I_STDLIB
20258 #include <stdlib.h>
20259 #endif
20260 int main() { printf("%d\n", bar1()); exit(0); }
20261 EOP
20262 $cc $ccflags -c bar1.c >/dev/null 2>&1
20263 $cc $ccflags -c bar2.c >/dev/null 2>&1
20264 $cc $ccflags -c foo.c >/dev/null 2>&1
20265 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20266 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20267         $run ./foobar >/dev/null 2>&1; then
20268         echo "$ar appears to generate random libraries itself."
20269         orderlib=false
20270         if [ "X$ranlib" = "X" ]; then
20271             ranlib=":"
20272         fi
20273 elif $ar s bar$_a >/dev/null 2>&1 &&
20274         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20275         $run ./foobar >/dev/null 2>&1; then
20276                 echo "a table of contents needs to be added with '$ar s'."
20277                 orderlib=false
20278                 ranlib="$ar s"
20279 elif $ar ts bar$_a >/dev/null 2>&1 &&
20280         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20281         $run ./foobar >/dev/null 2>&1; then
20282                 echo "a table of contents needs to be added with '$ar ts'."
20283                 orderlib=false
20284                 ranlib="$ar ts"
20285 else
20286         case "$ranlib" in
20287         :) ranlib='';;
20288         '')
20289                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20290                 $test -f $ranlib || ranlib=''
20291                 ;;
20292         esac
20293         if $test -n "$ranlib"; then
20294                 echo "your system has '$ranlib'; we'll use that."
20295                 orderlib=false
20296         else
20297                 echo "your system doesn't seem to support random libraries"
20298                 echo "so we'll use lorder and tsort to order the libraries."
20299                 orderlib=true
20300                 ranlib=":"
20301         fi
20302 fi
20303 $rm -f foo* bar*
20304
20305 : see if this is a values.h system
20306 set values.h i_values
20307 eval $inhdr
20308
20309 : Check the max offset that gmtime and localtime accept
20310 echo "Checking max offsets that gmtime () accepts"
20311
20312 case $i_values in
20313     define) yyy="#include <values.h>" ;;
20314     *)      yyy="" ;;
20315     esac
20316
20317 case "$sGMTIME_min/$sGMTIME_max" in
20318     0/0|/)
20319         $cat >try.c <<EOCP
20320 #include <sys/types.h>
20321 #include <stdio.h>
20322 #include <time.h>
20323 $yyy
20324
20325 int i;
20326 struct tm *tmp;
20327 time_t pt;
20328
20329 void gm_check (time_t t, int min_year, int max_year)
20330 {
20331     tmp = gmtime (&t);
20332     if ( tmp == NULL ||
20333         /* Check tm_year overflow */
20334          tmp->tm_year < min_year || tmp->tm_year > max_year)
20335         tmp = NULL;
20336     else
20337         pt = t;
20338     } /* gm_check */
20339
20340 int check_max ()
20341 {
20342     tmp = NULL;
20343     pt  = 0;
20344 #ifdef MAXLONG
20345     gm_check (MAXLONG, 69, 0x7fffffff);
20346 #endif
20347     if (tmp == NULL || tmp->tm_year < 0) {
20348         for (i = 63; i >= 0; i--) {
20349             time_t x = pt | ((time_t)1 << i);
20350             if (x < 0 || x < pt) continue;
20351             gm_check (x, 69, 0x7fffffff);
20352             }
20353         }
20354     printf ("sGMTIME_max=%ld\n", pt);
20355     return (0);
20356     } /* check_max */
20357
20358 int check_min ()
20359 {
20360     tmp = NULL;
20361     pt  = 0;
20362 #ifdef MINLONG
20363     gm_check (MINLONG, -1900, 70);
20364 #endif
20365     if (tmp == NULL) {
20366         for (i = 36; i >= 0; i--) {
20367             time_t x = pt - ((time_t)1 << i);
20368             if (x > 0) continue;
20369             gm_check (x, -1900, 70);
20370             }
20371         }
20372     printf ("sGMTIME_min=%ld\n", pt);
20373     return (0);
20374     } /* check_min */
20375
20376 int main (int argc, char *argv[])
20377 {
20378     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20379     check_max ();
20380     check_min ();
20381     return (0);
20382     } /* main */
20383 EOCP
20384         set try
20385         if eval $compile; then
20386             eval `$run ./try`
20387         else
20388             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20389             fi
20390         $rm_try
20391         ;;
20392     esac
20393
20394 echo "Checking max offsets that localtime () accepts"
20395
20396 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20397     0/0|/)
20398         $cat >try.c <<EOCP
20399 #include <sys/types.h>
20400 #include <stdio.h>
20401 #include <time.h>
20402 $yyy
20403
20404 int i;
20405 struct tm *tmp;
20406 time_t pt;
20407
20408 void local_check (time_t t, int min_year, int max_year)
20409 {
20410     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20411         tmp = NULL;
20412     else
20413         tmp = localtime (&t);
20414     if ( tmp == NULL ||
20415         /* Check tm_year overflow */
20416          tmp->tm_year < min_year || tmp->tm_year > max_year)
20417         tmp = NULL;
20418     else
20419         pt = t;
20420     } /* local_check */
20421
20422 int check_max ()
20423 {
20424     tmp = NULL;
20425     pt  = 0;
20426 #ifdef MAXLONG
20427     local_check (MAXLONG, 69, 0x7fffffff);
20428 #endif
20429     if (tmp == NULL || tmp->tm_year < 0) {
20430         for (i = 63; i >= 0; i--) {
20431             time_t x = pt | ((time_t)1 << i);
20432             if (x < 0 || x < pt) continue;
20433             local_check (x, 69, 0x7fffffff);
20434             }
20435         }
20436     printf ("sLOCALTIME_max=%ld\n", pt);
20437     return (0);
20438    } /* check_max */
20439
20440 int check_min ()
20441 {
20442     tmp = NULL;
20443     pt  = 0;
20444 #ifdef MINLONG
20445     local_check (MINLONG, -1900, 70);
20446 #endif
20447     if (tmp == NULL) {
20448         for (i = 36; i >= 0; i--) {
20449             time_t x = pt - ((time_t)1 << i);
20450             if (x > 0) continue;
20451             local_check (x, -1900, 70);
20452             }
20453         }
20454     printf ("sLOCALTIME_min=%ld\n", pt);
20455     return (0);
20456     } /* check_min */
20457
20458 int main (int argc, char *argv[])
20459 {
20460     check_max ();
20461     check_min ();
20462     return (0);
20463     } /* main */
20464 EOCP
20465         set try
20466         if eval $compile; then
20467             eval `$run ./try`
20468         else
20469             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20470             fi
20471         $rm_try
20472         ;;
20473     esac
20474
20475 : check for type of arguments to select.
20476 case "$selecttype" in
20477 '') case "$d_select" in
20478         $define)
20479                 echo " "
20480                 $cat <<EOM
20481 Checking to see what type of arguments are accepted by select().
20482 EOM
20483                 hdrs="$define sys/types.h
20484                         $i_systime sys/time.h
20485                         $i_sysselct sys/select.h
20486                         $d_socket sys/socket.h"
20487                 : The first arg can be int, unsigned, or size_t
20488                 : The last arg may or may not be 'const'
20489                 val=''
20490                 : void pointer has been seen but using that
20491                 : breaks the selectminbits test
20492                 for xxx in 'fd_set *' 'int *'; do
20493                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20494                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20495                                         case "$val" in
20496                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20497                                                 if ./protochk "$try" $hdrs; then
20498                                                         echo "Your system accepts $xxx."
20499                                                         val="$xxx"
20500                                                 fi
20501                                                 ;;
20502                                         esac
20503                                 done
20504                         done
20505                 done
20506                 case "$val" in
20507                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20508                         case "$d_fd_set" in
20509                                 $define) dflt="fd_set *" ;;
20510                                 *)              dflt="int *" ;;
20511                         esac
20512                         . ./myread
20513                         val=$ans
20514                         ;;
20515                 esac
20516                 selecttype="$val"
20517                 ;;
20518         *)      : no select, so pick a harmless default
20519                 selecttype='int *'
20520                 ;;
20521         esac
20522         ;;
20523 esac
20524
20525 : check for the select 'width'
20526 case "$selectminbits" in
20527 '') safebits=`expr $ptrsize \* 8`
20528     case "$d_select" in
20529         $define)
20530                 $cat <<EOM
20531
20532 Checking to see on how many bits at a time your select() operates...
20533 EOM
20534                 $cat >try.c <<EOCP
20535 #include <sys/types.h>
20536 #$i_time I_TIME
20537 #$i_systime I_SYS_TIME
20538 #$i_systimek I_SYS_TIME_KERNEL
20539 #ifdef I_TIME
20540 #   include <time.h>
20541 #endif
20542 #ifdef I_SYS_TIME
20543 #   ifdef I_SYS_TIME_KERNEL
20544 #       define KERNEL
20545 #   endif
20546 #   include <sys/time.h>
20547 #   ifdef I_SYS_TIME_KERNEL
20548 #       undef KERNEL
20549 #   endif
20550 #endif
20551 #$i_sysselct I_SYS_SELECT
20552 #ifdef I_SYS_SELECT
20553 #include <sys/select.h>
20554 #endif
20555 #$d_socket HAS_SOCKET
20556 #ifdef HAS_SOCKET
20557 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20558 #endif
20559 #include <stdio.h>
20560 #$i_stdlib I_STDLIB
20561 #ifdef I_STDLIB
20562 #include <stdlib.h>
20563 #endif
20564 $selecttype b;
20565 #define S sizeof(*(b))
20566 #define MINBITS 64
20567 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20568 #define NBITS  (NBYTES * 8)
20569 int main() {
20570     char *s = (char *)malloc(NBYTES);
20571     struct timeval t;
20572     int i;
20573     FILE* fp;
20574     int fd;
20575
20576     if (!s)
20577         exit(1);
20578     fclose(stdin);
20579     fp = fopen("try.c", "r");
20580     if (fp == 0)
20581       exit(2);
20582     fd = fileno(fp);
20583     if (fd < 0)
20584       exit(3);
20585     b = ($selecttype)s;
20586     for (i = 0; i < NBITS; i++)
20587         FD_SET(i, b);
20588     t.tv_sec  = 0;
20589     t.tv_usec = 0;
20590     select(fd + 1, b, 0, 0, &t);
20591     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20592     free(s);
20593     printf("%d\n", i + 1);
20594     return 0;
20595 }
20596 EOCP
20597                 set try
20598                 if eval $compile_ok; then
20599                         selectminbits=`$run ./try`
20600                         case "$selectminbits" in
20601                         '')     cat >&4 <<EOM
20602 Cannot figure out on how many bits at a time your select() operates.
20603 I'll play safe and guess it is $safebits bits.
20604 EOM
20605                                 selectminbits=$safebits
20606                                 bits="$safebits bits"
20607                                 ;;
20608                         1)      bits="1 bit" ;;
20609                         *)      bits="$selectminbits bits" ;;
20610                         esac
20611                         echo "Your select() operates on $bits at a time." >&4
20612                 else
20613                         rp='What is the minimum number of bits your select() operates on?'
20614                         case "$byteorder" in
20615                         12345678)       dflt=64 ;;
20616                         1234)           dflt=32 ;;
20617                         *)              dflt=1  ;;
20618                         esac
20619                         . ./myread
20620                         val=$ans
20621                         selectminbits="$val"
20622                 fi
20623                 $rm_try
20624                 ;;
20625         *)      : no select, so pick a harmless default
20626                 selectminbits=$safebits
20627                 ;;
20628         esac
20629         ;;
20630 esac
20631
20632 : Trace out the files included by signal.h, then look for SIGxxx names.
20633 if [ "X$fieldn" = X ]; then
20634         : Just make some guesses.  We check them later.
20635         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20636 else
20637         xxx=`echo '#include <signal.h>' |
20638         $cppstdin $cppminus $cppflags 2>/dev/null |
20639         $grep '^[       ]*#.*include' |
20640         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20641                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20642 fi
20643 xxxfiles=''
20644 for xx in $xxx /dev/null ; do
20645         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20646 done
20647 case "$xxxfiles" in
20648 '')     xxxfiles=`./findhdr signal.h` ;;
20649 esac
20650 xxx=`awk '
20651 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20652         print substr($2, 4, 20)
20653 }
20654 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20655         print substr($3, 4, 20)
20656 }' $xxxfiles`
20657 : Append some common names just in case the awk scan failed.
20658 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20659 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20660 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20661 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20662 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20663
20664 : generate a few handy files for later
20665 $cat > signal.c <<EOCP
20666 #include <sys/types.h>
20667 #include <signal.h>
20668 #$i_stdlib I_STDLIB
20669 #ifdef I_STDLIB
20670 #include <stdlib.h>
20671 #endif
20672 #include <stdio.h>
20673 int main() {
20674
20675 /* Strange style to avoid deeply-nested #if/#else/#endif */
20676 #ifndef NSIG
20677 #  ifdef _NSIG
20678 #    define NSIG (_NSIG)
20679 #  endif
20680 #endif
20681
20682 #ifndef NSIG
20683 #  ifdef SIGMAX
20684 #    define NSIG (SIGMAX+1)
20685 #  endif
20686 #endif
20687
20688 #ifndef NSIG
20689 #  ifdef SIG_MAX
20690 #    define NSIG (SIG_MAX+1)
20691 #  endif
20692 #endif
20693
20694 #ifndef NSIG
20695 #  ifdef _SIG_MAX
20696 #    define NSIG (_SIG_MAX+1)
20697 #  endif
20698 #endif
20699
20700 #ifndef NSIG
20701 #  ifdef MAXSIG
20702 #    define NSIG (MAXSIG+1)
20703 #  endif
20704 #endif
20705
20706 #ifndef NSIG
20707 #  ifdef MAX_SIG
20708 #    define NSIG (MAX_SIG+1)
20709 #  endif
20710 #endif
20711
20712 #ifndef NSIG
20713 #  ifdef SIGARRAYSIZE
20714 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20715 #  endif
20716 #endif
20717
20718 #ifndef NSIG
20719 #  ifdef _sys_nsig
20720 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20721 #  endif
20722 #endif
20723
20724 /* Default to some arbitrary number that's big enough to get most
20725    of the common signals.
20726 */
20727 #ifndef NSIG
20728 #    define NSIG 50
20729 #endif
20730
20731 printf("NSIG %d\n", NSIG);
20732
20733 #ifndef JUST_NSIG
20734
20735 EOCP
20736
20737 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20738 {
20739         printf "#ifdef SIG"; printf $1; printf "\n"
20740         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20741         printf $1; printf ");\n"
20742         printf "#endif\n"
20743 }
20744 END {
20745         printf "#endif /* JUST_NSIG */\n";
20746         printf "exit(0);\n}\n";
20747 }
20748 ' >>signal.c
20749 $cat >signal.awk <<'EOP'
20750 BEGIN { ndups = 0 }
20751 $1 ~ /^NSIG$/ { nsig = $2 }
20752 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20753     if ($2 > maxsig) { maxsig = $2 }
20754     if (sig_name[$2]) {
20755         dup_name[ndups] = $1
20756         dup_num[ndups] = $2
20757         ndups++
20758     }
20759     else {
20760         sig_name[$2] = $1
20761         sig_num[$2] = $2
20762     }
20763 }
20764 END {
20765     if (nsig == 0) {
20766         nsig = maxsig + 1
20767     }
20768     printf("NSIG %d\n", nsig);
20769     for (n = 1; n < nsig; n++) {
20770         if (sig_name[n]) {
20771             printf("%s %d\n", sig_name[n], sig_num[n])
20772         }
20773         else {
20774             printf("NUM%d %d\n", n, n)
20775         }
20776     }
20777     for (n = 0; n < ndups; n++) {
20778         printf("%s %d\n", dup_name[n], dup_num[n])
20779     }
20780 }
20781 EOP
20782 $cat >signal_cmd <<EOS
20783 $startsh
20784 if $test -s signal.lst; then
20785     echo "Using your existing signal.lst file"
20786         exit 0
20787 fi
20788 xxx="$xxx"
20789 EOS
20790 $cat >>signal_cmd <<'EOS'
20791
20792 set signal
20793 if eval $compile_ok; then
20794         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20795                 $uniq | $awk -f signal.awk >signal.lst
20796 else
20797         echo "(I can't seem be able to compile the whole test program)" >&4
20798         echo "(I'll try it in little pieces.)" >&4
20799         set signal -DJUST_NSIG
20800         if eval $compile_ok; then
20801                 $run ./signal$_exe > signal.nsg
20802                 $cat signal.nsg
20803         else
20804                 echo "I can't seem to figure out how many signals you have." >&4
20805                 echo "Guessing 50." >&4
20806                 echo 'NSIG 50' > signal.nsg
20807         fi
20808         : Now look at all the signal names, one at a time.
20809         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20810                 $cat > signal.c <<EOCP
20811 #include <sys/types.h>
20812 #include <signal.h>
20813 #include <stdio.h>
20814 int main() {
20815 printf("$xx %d\n", SIG${xx});
20816 return 0;
20817 }
20818 EOCP
20819                 set signal
20820                 if eval $compile; then
20821                         echo "SIG${xx} found."
20822                         $run ./signal$_exe  >> signal.ls1
20823                 else
20824                         echo "SIG${xx} NOT found."
20825                 fi
20826         done
20827         if $test -s signal.ls1; then
20828                 $cat signal.nsg signal.ls1 |
20829                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20830         fi
20831
20832 fi
20833 if $test -s signal.lst; then
20834         :
20835 else
20836         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20837         echo 'kill -l' >signal
20838         set X `csh -f <signal`
20839         $rm -f signal
20840         shift
20841         case $# in
20842         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20843         esac
20844         echo $@ | $tr ' ' $trnl | \
20845             $awk '{ printf "%s %d\n", $1, ++s; }
20846                   END { printf "NSIG %d\n", ++s }' >signal.lst
20847 fi
20848 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20849 EOS
20850 chmod a+x signal_cmd
20851 $eunicefix signal_cmd
20852
20853 : generate list of signal names
20854 echo " "
20855 case "$sig_name_init" in
20856 '') doinit=yes ;;
20857 *)  case "$sig_num_init" in
20858     ''|*,*) doinit=yes ;;
20859     esac ;;
20860 esac
20861 case "$doinit" in
20862 yes)
20863         echo "Generating a list of signal names and numbers..." >&4
20864         . ./signal_cmd
20865         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20866         sig_name=`$awk 'BEGIN { printf "ZERO " }
20867                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20868         sig_num=`$awk  'BEGIN { printf "0 " }
20869                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20870         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20871                              !/^NSIG/   { printf "\"%s\", ", $1 }
20872                              END        { printf "0\n" }' signal.lst`
20873         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20874                              !/^NSIG/   { printf "%d, ", $2}
20875                              END        { printf "0\n"}' signal.lst`
20876         ;;
20877 esac
20878 echo "The following $sig_count signals are available:"
20879 echo " "
20880 echo $sig_name | $awk \
20881 'BEGIN { linelen = 0 }
20882 {
20883         for (i = 1; i <= NF; i++) {
20884                 name = "SIG" $i " "
20885                 linelen = linelen + length(name)
20886                 if (linelen > 70) {
20887                         printf "\n"
20888                         linelen = length(name)
20889                 }
20890                 printf "%s", name
20891         }
20892         printf "\n"
20893 }'
20894 sig_size=`echo $sig_name | awk '{print NF}'`
20895 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20896
20897 : Check size of size
20898 echo " "
20899 case "$sizetype" in
20900 *_t) zzz="$sizetype"    ;;
20901 *)   zzz="filesize"     ;;
20902 esac
20903 echo "Checking the size of $zzz..." >&4
20904 cat > try.c <<EOCP
20905 #include <sys/types.h>
20906 #include <stdio.h>
20907 #$i_stdlib I_STDLIB
20908 #ifdef I_STDLIB
20909 #include <stdlib.h>
20910 #endif
20911 int main() {
20912     printf("%d\n", (int)sizeof($sizetype));
20913     exit(0);
20914 }
20915 EOCP
20916 set try
20917 if eval $compile_ok; then
20918         yyy=`$run ./try`
20919         case "$yyy" in
20920         '')     sizesize=4
20921                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20922                 ;;
20923         *)      sizesize=$yyy
20924                 echo "Your $zzz size is $sizesize bytes."
20925                 ;;
20926         esac
20927 else
20928         sizesize=4
20929         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20930 fi
20931
20932
20933 : check for socklen_t
20934 echo " "
20935 echo "Checking to see if you have socklen_t..." >&4
20936 $cat >try.c <<EOCP
20937 #include <sys/types.h>
20938 #$d_socket HAS_SOCKET
20939 #ifdef HAS_SOCKET
20940 #include <sys/socket.h>
20941 #endif
20942 int main() { socklen_t x = 16; }
20943 EOCP
20944 set try
20945 if eval $compile; then
20946         val="$define"
20947         echo "You have socklen_t."
20948 else
20949         val="$undef"
20950         echo "You do not have socklen_t."
20951         case "$sizetype" in
20952         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20953         esac
20954 fi
20955 $rm_try
20956 set d_socklen_t
20957 eval $setvar
20958
20959 : see if this is a socks.h system
20960 set socks.h i_socks
20961 eval $inhdr
20962
20963 : check for type of the size argument to socket calls
20964 case "$d_socket" in
20965 "$define")
20966         $cat <<EOM
20967
20968 Checking to see what type is the last argument of accept().
20969 EOM
20970         yyy=''
20971         case "$d_socklen_t" in
20972         "$define") yyy="$yyy socklen_t"
20973         esac
20974         yyy="$yyy $sizetype int long unsigned"
20975         for xxx in $yyy; do
20976                 case "$socksizetype" in
20977                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20978                         case "$usesocks" in
20979                         "$define")
20980                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20981                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20982                                         socksizetype="$xxx"
20983                                 fi
20984                                 ;;
20985                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20986                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20987                                         socksizetype="$xxx"
20988                                 fi
20989                                 ;;
20990                         esac
20991                         ;;
20992                 esac
20993         done
20994 : In case none of those worked, prompt the user.
20995         case "$socksizetype" in
20996         '')     rp='What is the type for socket address structure sizes?'
20997                 dflt='int'
20998                 . ./myread
20999                 socksizetype=$ans
21000                 ;;
21001         esac
21002         ;;
21003 *)      : no sockets, so pick relatively harmless default
21004         socksizetype='int'
21005         ;;
21006 esac
21007
21008 : see what type is used for signed size_t
21009 set ssize_t ssizetype int stdio.h sys/types.h
21010 eval $typedef
21011 dflt="$ssizetype"
21012 $cat > try.c <<EOM
21013 #include <stdio.h>
21014 #$i_stdlib I_STDLIB
21015 #ifdef I_STDLIB
21016 #include <stdlib.h>
21017 #endif
21018 #include <sys/types.h>
21019 #define Size_t $sizetype
21020 #define SSize_t $dflt
21021 int main()
21022 {
21023         if (sizeof(Size_t) == sizeof(SSize_t))
21024                 printf("$dflt\n");
21025         else if (sizeof(Size_t) == sizeof(int))
21026                 printf("int\n");
21027         else
21028                 printf("long\n");
21029         exit(0);
21030 }
21031 EOM
21032 echo " "
21033 set try
21034 if eval $compile_ok && $run ./try > /dev/null; then
21035         ssizetype=`$run ./try`
21036         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21037 else
21038         $cat >&4 <<EOM
21039 Help! I can't compile and run the ssize_t test program: please enlighten me!
21040 (This is probably a misconfiguration in your system or libraries, and
21041 you really ought to fix it.  Still, I'll try anyway.)
21042
21043 I need a type that is the same size as $sizetype, but is guaranteed to
21044 be signed.  Common values are ssize_t, int and long.
21045
21046 EOM
21047         rp="What signed type is the same size as $sizetype?"
21048         . ./myread
21049         ssizetype="$ans"
21050 fi
21051 $rm_try
21052
21053 : see what type of char stdio uses.
21054 echo " "
21055 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21056 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21057         echo "Your stdio uses unsigned chars." >&4
21058         stdchar="unsigned char"
21059 else
21060         echo "Your stdio uses signed chars." >&4
21061         stdchar="char"
21062 fi
21063 $rm -f stdioh
21064
21065 : see what type uids are declared as in the kernel
21066 echo " "
21067 echo "Looking for the type for user ids returned by getuid()."
21068 set uid_t uidtype xxx stdio.h sys/types.h
21069 eval $typedef
21070 case "$uidtype" in
21071 xxx)
21072         xxx=`./findhdr sys/user.h`
21073         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21074         case $1 in
21075         unsigned) dflt="$1 $2" ;;
21076         *) dflt="$1" ;;
21077         esac
21078         ;;
21079 *) dflt="$uidtype";;
21080 esac
21081 case "$uidtype" in
21082 uid_t)  echo "uid_t found." ;;
21083 *)      rp="What is the type for user ids returned by getuid()?"
21084         . ./myread
21085         uidtype="$ans"
21086         ;;
21087 esac
21088
21089 : Check size of UID
21090 echo " "
21091 case "$uidtype" in
21092 *_t) zzz="$uidtype"     ;;
21093 *)   zzz="uid"          ;;
21094 esac
21095 echo "Checking the size of $zzz..." >&4
21096 cat > try.c <<EOCP
21097 #include <sys/types.h>
21098 #include <stdio.h>
21099 #$i_stdlib I_STDLIB
21100 #ifdef I_STDLIB
21101 #include <stdlib.h>
21102 #endif
21103 int main() {
21104     printf("%d\n", (int)sizeof($uidtype));
21105     exit(0);
21106 }
21107 EOCP
21108 set try
21109 if eval $compile_ok; then
21110         yyy=`$run ./try`
21111         case "$yyy" in
21112         '')     uidsize=4
21113                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21114                 ;;
21115         *)      uidsize=$yyy
21116                 echo "Your $zzz is $uidsize bytes long."
21117                 ;;
21118         esac
21119 else
21120         uidsize=4
21121         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21122 fi
21123
21124 : Check if UID is signed
21125 echo " "
21126 case "$uidtype" in
21127 *_t) zzz="$uidtype"     ;;
21128 *)   zzz="uid"          ;;
21129 esac
21130 echo "Checking the sign of $zzz..." >&4
21131 cat > try.c <<EOCP
21132 #include <sys/types.h>
21133 #include <stdio.h>
21134 int main() {
21135         $uidtype foo = -1;
21136         if (foo < 0)
21137                 printf("-1\n");
21138         else
21139                 printf("1\n");
21140 }
21141 EOCP
21142 set try
21143 if eval $compile; then
21144         yyy=`$run ./try`
21145         case "$yyy" in
21146         '')     uidsign=1
21147                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21148                 ;;
21149         *)      uidsign=$yyy
21150                 case "$uidsign" in
21151                  1) echo "Your $zzz is unsigned." ;;
21152                 -1) echo "Your $zzz is signed."   ;;
21153                 esac
21154                 ;;
21155         esac
21156 else
21157         uidsign=1
21158         echo "(I can't compile the test program--guessing unsigned.)" >&4
21159 fi
21160
21161
21162 : Check format string for UID
21163 echo " "
21164 $echo "Checking the format string to be used for uids..." >&4
21165
21166 case "$uidsign" in
21167 -1)     if $test X"$uidsize" = X"$ivsize"; then
21168                 uidformat="$ivdformat"
21169         else
21170                 if $test X"$uidsize" = X"$longsize"; then
21171                         uidformat='"ld"'
21172                 else
21173                         if $test X"$uidsize" = X"$intsize"; then
21174                                 uidformat='"d"'
21175                         else
21176                                 if $test X"$uidsize" = X"$shortsize"; then
21177                                         uidformat='"hd"'
21178                                 fi
21179                         fi
21180                 fi
21181         fi
21182         ;;
21183 *)      if $test X"$uidsize" = X"$uvsize"; then
21184                 uidformat="$uvuformat"
21185         else
21186                 if $test X"$uidsize" = X"$longsize"; then
21187                         uidformat='"lu"'
21188                 else
21189                         if $test X"$uidsize" = X"$intsize"; then
21190                                 uidformat='"u"'
21191                         else
21192                                 if $test X"$uidsize" = X"$shortsize"; then
21193                                         uidformat='"hu"'
21194                                 fi
21195                         fi
21196                 fi
21197         fi
21198         ;;
21199 esac
21200
21201 : Check if site customization support was requested
21202 case "$usesitecustomize" in
21203     $define|true|[Yy]*)
21204         usesitecustomize="$define"
21205         ;;
21206     *)
21207         usesitecustomize="$undef"
21208         ;;
21209     esac
21210
21211 : determine compiler compiler
21212 case "$yacc" in
21213 '')
21214         dflt=yacc;;
21215 *)
21216         dflt="$yacc";;
21217 esac
21218 echo " "
21219 comp='yacc'
21220 if $test -f "$byacc$_exe"; then
21221         dflt="$byacc"
21222         comp="byacc or $comp"
21223 fi
21224 if $test -f "$bison$_exe"; then
21225         comp="$comp or bison -y"
21226 fi
21227 rp="Which compiler compiler ($comp) shall I use?"
21228 . ./myread
21229 yacc="$ans"
21230 case "$yacc" in
21231 *bis*)
21232         case "$yacc" in
21233         *-y*) ;;
21234         *)
21235                 yacc="$yacc -y"
21236                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21237                 ;;
21238         esac
21239         ;;
21240 esac
21241
21242 : see if this is a assert.h system
21243 set assert.h i_assert
21244 eval $inhdr
21245
21246 : see if this is a fp.h system
21247 set fp.h i_fp
21248 eval $inhdr
21249
21250 : see if this is a fp_class.h system
21251 set fp_class.h i_fp_class
21252 eval $inhdr
21253
21254 : see if gdbm.h is available
21255 set gdbm.h t_gdbm
21256 eval $inhdr
21257 case "$t_gdbm" in
21258 $define)
21259         : see if gdbm_open exists
21260         set gdbm_open d_gdbm_open
21261         eval $inlibc
21262         case "$d_gdbm_open" in
21263         $undef)
21264                 t_gdbm="$undef"
21265                 echo "We won't be including <gdbm.h>"
21266                 ;;
21267         esac
21268         ;;
21269 esac
21270 val="$t_gdbm"
21271 set i_gdbm
21272 eval $setvar
21273
21274 : see if this is a ieeefp.h system
21275 case "$i_ieeefp" in
21276 '' ) set ieeefp.h i_ieeefp
21277      eval $inhdr
21278      ;;
21279 esac
21280
21281 : see if this is a libutil.h system
21282 set libutil.h i_libutil
21283 eval $inhdr
21284
21285 : see if mach cthreads are available
21286 if test "X$usethreads" = "X$define"; then
21287         set mach/cthreads.h i_machcthr
21288         eval $inhdr
21289 else
21290         i_machcthr="$undef"
21291 fi
21292
21293 : see if this is a mntent.h system
21294 set mntent.h i_mntent
21295 eval $inhdr
21296
21297 : see if net/errno.h is available
21298 val=''
21299 set net/errno.h val
21300 eval $inhdr
21301
21302 : Unfortunately, it causes problems on some systems.  Arrgh.
21303 case "$val" in
21304 $define)
21305         cat > try.c <<'EOM'
21306 #include <stdio.h>
21307 #include <errno.h>
21308 #include <net/errno.h>
21309 int func()
21310 {
21311         return ENOTSOCK;
21312 }
21313 EOM
21314         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21315                 echo "We'll be including <net/errno.h>." >&4
21316         else
21317                 echo "We won't be including <net/errno.h>." >&4
21318                 val="$undef"
21319         fi
21320         $rm_try
21321         ;;
21322 esac
21323 set i_neterrno
21324 eval $setvar
21325
21326 : see if netinet/tcp.h is available
21327 set netinet/tcp.h i_netinettcp
21328 eval $inhdr
21329
21330 : see if this is a poll.h system
21331 set poll.h i_poll
21332 eval $inhdr
21333
21334 : see if this is a prot.h system
21335 set prot.h i_prot
21336 eval $inhdr
21337
21338 : Preprocessor symbols
21339 echo " "
21340 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21341 $cat <<'EOSH' > Cppsym.know
21342 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21343 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21344 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21345 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21346 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21347 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21348 bull c cadmus clipper CMU COFF COMPILER_VERSION
21349 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21350 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21351 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21352 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21353 GLIBC GLIBC_MINOR
21354 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21355 H3050R H3050RX hbullx20 hcx host_mips
21356 hp200 hp300 hp700 HP700 hp800 hp9000
21357 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21358 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21359 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21360 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21361 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21362 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21363 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21364 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21365 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21366 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21367 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21368 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21369 MATH_HAS_NO_SIDE_EFFECTS
21370 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21371 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21372 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21373 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21374 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21375 NetBSD news1500 news1700 news1800 news1900 news3700
21376 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21377 ns32016 ns32332 ns32k nsc32000
21378 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21379 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21380 pc532 pdp11 PGC PIC plexus PORTAR posix
21381 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21382 POSIX_C_SOURCE POSIX_SOURCE POWER
21383 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21384 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21385 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21386 sony sony_news sonyrisc sparc sparclite spectrum
21387 stardent stdc STDC_EXT stratos sun sun3 sun386
21388 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21389 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21390 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21391 sysV68 sysV88 Tek4132 Tek4300 titan
21392 TM3200 TM5400 TM5600
21393 tower tower32 tower32_200 tower32_600 tower32_700
21394 tower32_800 tower32_850 tss
21395 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21396 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21397 unix UNIX95 UNIX99 unixpc unos
21398 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21399 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21400 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21401 USGr4 USGr4_2
21402 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21403 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21404 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21405 z8000
21406 EOSH
21407 # Maybe put other stuff here too.
21408 cat <<EOSH >>Cppsym.know
21409 $osname
21410 EOSH
21411 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21412 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21413 $cat Cppsym.know > Cppsym.c
21414 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21415 $rm -f Cppsym.a Cppsym.b Cppsym.c
21416 cat <<EOSH > Cppsym
21417 $startsh
21418 if $test \$# -gt 0; then
21419     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21420     if $test -s Cppsym.got; then
21421         $rm -f Cppsym.got
21422         exit 0
21423     fi
21424     $rm -f Cppsym.got
21425     exit 1
21426 else
21427     $tr " " "$trnl" | ./Cppsym.try
21428     exit 0
21429 fi
21430 EOSH
21431 chmod +x Cppsym
21432 $eunicefix Cppsym
21433 cat <<EOSH > Cppsym.try
21434 $startsh
21435 cat <<'EOCP' > try.c
21436 #include <stdio.h>
21437 #if cpp_stuff == 1
21438 #define STRINGIFY(a)    "a"
21439 #endif
21440 #if cpp_stuff == 42
21441 #define StGiFy(a)  #a
21442 #define STRINGIFY(a)    StGiFy(a)
21443 #endif
21444 #if $cpp_stuff != 1 && $cpp_stuff != 42
21445 #   include "Bletch: How does this C preprocessor stringify macros?"
21446 #endif
21447 int main() {
21448 EOCP
21449 $awk \\
21450 EOSH
21451 cat <<'EOSH' >> Cppsym.try
21452 'length($1) > 0 {
21453     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21454     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21455     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21456     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21457 }'       >> try.c
21458 echo 'return 0;}' >> try.c
21459 EOSH
21460 cat <<EOSH >> Cppsym.try
21461 ccflags="$ccflags"
21462 case "$osname-$gccversion" in
21463 irix-) ccflags="\$ccflags -woff 1178" ;;
21464 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21465 esac
21466 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21467 EOSH
21468 chmod +x Cppsym.try
21469 $eunicefix Cppsym.try
21470 ./Cppsym < Cppsym.know > Cppsym.true
21471 : Add in any linux cpp "predefined macros":
21472 case "$osname::$gccversion" in
21473   *linux*::*.*|*gnukfreebsd*::*.*)
21474     tHdrH=_tmpHdr
21475     rm -f $tHdrH'.h' $tHdrH
21476     touch $tHdrH'.h'
21477     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21478        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21479        if [ -s $tHdrH'_cppsym.real' ]; then
21480           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21481        fi
21482     fi
21483     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21484   ;;
21485 esac
21486 : now check the C compiler for additional symbols
21487 postprocess_cc_v=''
21488 case "$osname" in
21489 aix) postprocess_cc_v="|$tr , ' '" ;;
21490 esac
21491 $cat >ccsym <<EOS
21492 $startsh
21493 $cat >tmp.c <<EOF
21494 extern int foo;
21495 EOF
21496 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21497 do
21498         case "\$i" in
21499         -D*) echo "\$i" | $sed 's/^-D//';;
21500         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21501         esac
21502 done
21503 $rm_try
21504 EOS
21505 postprocess_cc_v=''
21506 chmod +x ccsym
21507 $eunicefix ccsym
21508 ./ccsym > ccsym1.raw
21509 if $test -s ccsym1.raw; then
21510        $sort ccsym1.raw | $uniq >ccsym.raw
21511 else
21512        mv ccsym1.raw ccsym.raw
21513 fi
21514
21515 $awk '/\=/ { print $0; next }
21516         { print $0"=1" }' ccsym.raw >ccsym.list
21517 $comm -13 Cppsym.true ccsym.list >ccsym.own
21518 $comm -12 Cppsym.true ccsym.list >ccsym.com
21519 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21520 also=''
21521 if $test -z ccsym.raw; then
21522         echo "Your C compiler doesn't seem to define any symbols!" >&4
21523         echo " "
21524         echo "However, your C preprocessor defines the following symbols:"
21525         $cat Cppsym.true
21526         ccsymbols=''
21527         cppsymbols=`$cat Cppsym.true`
21528         cppsymbols=`echo $cppsymbols`
21529         cppccsymbols="$cppsymbols"
21530 else
21531         if $test -s ccsym.com; then
21532                 echo "Your C compiler and pre-processor define these symbols:"
21533                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21534                 also='also '
21535                 symbols='ones'
21536                 cppccsymbols=`$cat ccsym.com`
21537                 cppccsymbols=`echo $cppccsymbols`
21538                 $test "$silent" || sleep 1
21539         fi
21540         if $test -s ccsym.cpp; then
21541                 $test "$also" && echo " "
21542                 echo "Your C pre-processor ${also}defines the following symbols:"
21543                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21544                 also='further '
21545                 cppsymbols=`$cat ccsym.cpp`
21546                 cppsymbols=`echo $cppsymbols`
21547                 $test "$silent" || sleep 1
21548         fi
21549         if $test -s ccsym.own; then
21550                 $test "$also" && echo " "
21551                 echo "Your C compiler ${also}defines the following cpp symbols:"
21552                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21553                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21554                 ccsymbols=`$cat ccsym.own`
21555                 ccsymbols=`echo $ccsymbols`
21556                 $test "$silent" || sleep 1
21557         fi
21558 fi
21559
21560 : see if this is a termio system
21561 val="$undef"
21562 val2="$undef"
21563 val3="$undef"
21564 if $test `./findhdr termios.h`; then
21565         set tcsetattr i_termios
21566         eval $inlibc
21567         val3="$i_termios"
21568 fi
21569 echo " "
21570 case "$val3" in
21571 "$define") echo "You have POSIX termios.h... good!" >&4;;
21572 *) if ./Cppsym pyr; then
21573                 case "`/bin/universe`" in
21574                 ucb) if $test `./findhdr sgtty.h`; then
21575                                 val2="$define"
21576                                 echo "<sgtty.h> found." >&4
21577                         else
21578                                 echo "System is pyramid with BSD universe."
21579                                 ./warn "<sgtty.h> not found--you could have problems."
21580                         fi;;
21581                 *) if $test `./findhdr termio.h`; then
21582                                 val="$define"
21583                                 echo "<termio.h> found." >&4
21584                         else
21585                                 echo "System is pyramid with USG universe."
21586                                 ./warn "<termio.h> not found--you could have problems."
21587                         fi;;
21588                 esac
21589         elif ./usg; then
21590                 if $test `./findhdr termio.h`; then
21591                         echo "<termio.h> found." >&4
21592                         val="$define"
21593                 elif $test `./findhdr sgtty.h`; then
21594                         echo "<sgtty.h> found." >&4
21595                         val2="$define"
21596                 else
21597                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21598                 fi
21599         else
21600                 if $test `./findhdr sgtty.h`; then
21601                         echo "<sgtty.h> found." >&4
21602                         val2="$define"
21603                 elif $test `./findhdr termio.h`; then
21604                         echo "<termio.h> found." >&4
21605                         val="$define"
21606                 else
21607                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21608                 fi
21609         fi;;
21610 esac
21611 set i_termio; eval $setvar
21612 val=$val2; set i_sgtty; eval $setvar
21613 val=$val3; set i_termios; eval $setvar
21614
21615 : see if stddef is available
21616 set stddef.h i_stddef
21617 eval $inhdr
21618
21619 : see if sys/access.h is available
21620 set sys/access.h i_sysaccess
21621 eval $inhdr
21622
21623 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21624 set sys/filio.h i_sysfilio
21625 eval $inhdr
21626 echo " "
21627 if $test `./findhdr sys/ioctl.h`; then
21628         val="$define"
21629         echo '<sys/ioctl.h> found.' >&4
21630 else
21631         val="$undef"
21632         if $test $i_sysfilio = "$define"; then
21633             echo '<sys/ioctl.h> NOT found.' >&4
21634         else
21635                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21636                 $test $i_termio = "$define" && xxx="termio.h"
21637                 $test $i_termios = "$define" && xxx="termios.h"
21638 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21639         fi
21640 fi
21641 set i_sysioctl
21642 eval $setvar
21643
21644 : see if socket ioctl defs are in sys/sockio.h
21645 echo " "
21646 xxx=`./findhdr sys/sockio.h`
21647 if $test "$xxx"; then
21648         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21649                 val="$define"
21650                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21651         else
21652                 val="$undef"
21653                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21654         fi
21655 else
21656         val="$undef"
21657         $cat <<EOM
21658 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21659 EOM
21660 fi
21661 set i_syssockio
21662 eval $setvar
21663
21664 : see if this is a syslog.h system
21665 set syslog.h i_syslog
21666 eval $inhdr
21667
21668 : see if this is a sys/mode.h system
21669 set sys/mode.h i_sysmode
21670 eval $inhdr
21671
21672 : see if there is a sys/poll.h file
21673 set sys/poll.h i_syspoll
21674 eval $inhdr
21675
21676 : see if sys/resource.h has to be included
21677 set sys/resource.h i_sysresrc
21678 eval $inhdr
21679
21680 : see if sys/security.h is available
21681 set sys/security.h i_syssecrt
21682 eval $inhdr
21683
21684 : see if this is a sys/statvfs.h system
21685 set sys/statvfs.h i_sysstatvfs
21686 eval $inhdr
21687
21688 : see if this is a sys/un.h system
21689 set sys/un.h i_sysun
21690 eval $inhdr
21691
21692 : see if this is a sys/utsname.h system
21693 set sys/utsname.h i_sysutsname
21694 eval $inhdr
21695
21696 : see if this is a syswait system
21697 set sys/wait.h i_syswait
21698 eval $inhdr
21699
21700 : see if this is a ustat.h system
21701 set ustat.h i_ustat
21702 eval $inhdr
21703
21704 : see if this is an utime system
21705 set utime.h i_utime
21706 eval $inhdr
21707
21708 : see if this is a vfork system
21709 case "$d_vfork" in
21710 "$define")
21711         set vfork.h i_vfork
21712         eval $inhdr
21713         ;;
21714 *)
21715         i_vfork="$undef"
21716         ;;
21717 esac
21718
21719 : Check extensions
21720 echo " "
21721 echo "Looking for extensions..." >&4
21722 : If we are using the old config.sh, known_extensions may contain
21723 : old or inaccurate or duplicate values.
21724 known_extensions=''
21725 nonxs_extensions=''
21726 : We do not use find because it might not be available.
21727 : We do not just use MANIFEST because the user may have dropped
21728 : some additional extensions into the source tree and expect them
21729 : to be built.
21730
21731 : Function to recursively find available extensions, ignoring DynaLoader
21732 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21733 : In 5.10.1 and later, extensions are stored in directories
21734 : like File-Glob instead of the older File/Glob/.  In this scheme,
21735 : IO-Compress does not appear to be an XS extension, but we want
21736 : to install it as one.  A.D.  8/2009.
21737 find_extensions='
21738     for xxx in *; do
21739         case "$xxx" in
21740             DynaLoader|dynaload) ;;
21741             *)
21742             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21743             leaf=`echo $xxx | $sed -e s/.*-//`;
21744             if $test -d File; then
21745                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21746                     known_extensions="$known_extensions $1$this_ext";
21747                 elif $test -f $xxx/Makefile.PL; then
21748                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21749                 else
21750                     if $test -d $xxx -a $# -lt 10; then
21751                         set $1$xxx/ $*;
21752                         cd "$xxx";
21753                         eval $find_extensions;
21754                         cd ..;
21755                         shift;
21756                     fi;
21757                 fi;
21758             else
21759                 $ls -1 $xxx > $$.tmp;
21760                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21761                     known_extensions="$known_extensions $this_ext";
21762                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21763                     known_extensions="$known_extensions $this_ext";
21764                 elif $test "$this_ext" = "IO/Compress"; then
21765                     known_extensions="$known_extensions $this_ext";
21766                 elif $test -d $xxx; then
21767                     nonxs_extensions="$nonxs_extensions $this_ext";
21768                 fi;
21769                 $rm -f $$.tmp;
21770             fi
21771             ;;
21772         esac;
21773     done'
21774 tdir=`pwd`
21775 cd "$rsrc/cpan"
21776 set X
21777 shift
21778 eval $find_extensions
21779 cd "$rsrc/dist"
21780 set X
21781 shift
21782 eval $find_extensions
21783 cd "$rsrc/ext"
21784 set X
21785 shift
21786 eval $find_extensions
21787 if $test -d File-Glob; then
21788     : All ext/ flattened
21789 else
21790     # Special case:  Add in modules that nest beyond the first level.
21791     # Currently threads/shared and Hash/Util/FieldHash, since they are
21792     # not picked up by the recursive find above (and adding in general
21793     # recursive finding breaks SDBM_File/sdbm).
21794     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21795     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21796 fi
21797 set X $known_extensions
21798 shift
21799 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21800 set X $nonxs_extensions
21801 shift
21802 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21803 cd "$tdir"
21804
21805 : Now see which are supported on this system.
21806 avail_ext=''
21807 for xxx in $known_extensions ; do
21808         case "$xxx" in
21809         DB_File|db_file)
21810                 case "$i_db" in
21811                 $define) avail_ext="$avail_ext $xxx" ;;
21812                 esac
21813                 ;;
21814         GDBM_File|gdbm_fil)
21815                 case "$i_gdbm" in
21816                 $define) avail_ext="$avail_ext $xxx" ;;
21817                 esac
21818                 ;;
21819         I18N/Langinfo|i18n_lan)
21820                 case "$i_langinfo$d_nl_langinfo" in
21821                 $define$define) avail_ext="$avail_ext $xxx" ;;
21822                 esac
21823                 ;;
21824         IPC/SysV|ipc/sysv)
21825                 : XXX Do we need a useipcsysv variable here
21826                 case "${d_msg}${d_sem}${d_shm}" in
21827                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21828                 esac
21829                 ;;
21830         NDBM_File|ndbm_fil)
21831                 case "$d_ndbm" in
21832                 $define)
21833                     case "$osname-$use64bitint" in
21834                     hpux-define)
21835                         case "$libs" in
21836                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21837                         esac
21838                         ;;
21839                     *) avail_ext="$avail_ext $xxx" ;;
21840                     esac
21841                     ;;
21842                 esac
21843                 ;;
21844         ODBM_File|odbm_fil)
21845                 case "${i_dbm}${i_rpcsvcdbm}" in
21846                 *"${define}"*)
21847                     case "$d_cplusplus" in
21848                     define) ;; # delete as a function name will not work
21849                     *)  case "$osname-$use64bitint" in
21850                         hpux-define)
21851                             case "$libs" in
21852                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21853                             esac
21854                             ;;
21855                         *) avail_ext="$avail_ext $xxx" ;;
21856                         esac
21857                         ;;
21858                     esac
21859                     ;;
21860                 esac
21861                 ;;
21862         Opcode|opcode)
21863                 case "$useopcode" in
21864                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21865                 esac
21866                 ;;
21867         POSIX|posix)
21868                 case "$useposix" in
21869                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21870                 esac
21871                 ;;
21872         Socket|socket)
21873                 case "$d_socket" in
21874                 true|$define|y)
21875                     case "$osname" in
21876                     beos) ;; # not unless BONE
21877                     *) avail_ext="$avail_ext $xxx" ;;
21878                     esac
21879                     ;;
21880                 esac
21881                 ;;
21882         Sys/Syslog|sys/syslog)
21883                 : XXX syslog requires socket
21884                 case "$d_socket" in
21885                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21886                 esac
21887                 ;;
21888         Thread|thread)
21889                 case "$usethreads" in
21890                 true|$define|y)
21891                         case "$use5005threads" in
21892                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21893                         esac
21894                 esac
21895                 ;;
21896         threads|threads/shared)
21897                 # threads and threads::shared are special cases.
21898                 # To stop people from asking "Perl 5.8.0 was supposed
21899                 # to have this new fancy threads implementation but my
21900                 # perl doesn't have it" and from people trying to
21901                 # (re)install the threads module using CPAN.pm and
21902                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21903                 # the threads.pm and threads/shared.pm will always be
21904                 # there, croaking informatively ("you need to rebuild
21905                 # all of Perl with threads, sorry") when threads haven't
21906                 # been compiled in.
21907                 # --jhi
21908                 avail_ext="$avail_ext $xxx"
21909                 ;;
21910         VMS*)
21911                 ;;
21912         Win32*)
21913                 case "$osname" in
21914                 cygwin) avail_ext="$avail_ext $xxx" ;;
21915                 esac
21916                 ;;
21917         XS/APItest|xs/apitest)
21918                 # This is just for testing.  Skip it unless we have dynamic loading.
21919
21920                 case "$usedl" in
21921                 $define) avail_ext="$avail_ext $xxx" ;;
21922                 esac
21923                 ;;
21924         XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
21925                 # This is just for testing.  Skip it unless we have dynamic loading.
21926
21927                 case "$usedl" in
21928                 $define) avail_ext="$avail_ext $xxx" ;;
21929                 esac
21930                 ;;
21931         XS/Typemap|xs/typemap)
21932                 # This is just for testing.  Skip it unless we have dynamic loading.
21933                 case "$usedl" in
21934                 $define) avail_ext="$avail_ext $xxx" ;;
21935                 esac
21936                 ;;
21937         *)      avail_ext="$avail_ext $xxx"
21938                 ;;
21939         esac
21940 done
21941
21942 set X $avail_ext
21943 shift
21944 avail_ext="$*"
21945
21946 case "$onlyextensions" in
21947 '') ;;
21948 *)  keepextensions=''
21949     echo "You have requested that only certains extensions be included..." >&4
21950     for i in $onlyextensions; do
21951         case " $avail_ext " in
21952         *" $i "*)
21953             echo "Keeping extension $i."
21954             keepextensions="$keepextensions $i"
21955             ;;
21956         *) echo "Ignoring extension $i." ;;
21957         esac
21958     done
21959     avail_ext="$keepextensions"
21960     ;;
21961 esac
21962
21963 case "$noextensions" in
21964 '') ;;
21965 *)  keepextensions=''
21966     echo "You have requested that certain extensions be ignored..." >&4
21967     for i in $avail_ext; do
21968         case " $noextensions " in
21969         *" $i "*) echo "Ignoring extension $i." ;;
21970         *) echo "Keeping extension $i.";
21971            keepextensions="$keepextensions $i"
21972            ;;
21973         esac
21974     done
21975     avail_ext="$keepextensions"
21976     ;;
21977 esac
21978
21979 : Now see which nonxs extensions are supported on this system.
21980 : For now assume all are.
21981 nonxs_ext=''
21982 for xxx in $nonxs_extensions ; do
21983         case "$xxx" in
21984         *)      nonxs_ext="$nonxs_ext $xxx"
21985                 ;;
21986         esac
21987 done
21988
21989 set X $nonxs_ext
21990 shift
21991 nonxs_ext="$*"
21992
21993 case $usedl in
21994 $define)
21995         $cat <<EOM
21996 A number of extensions are supplied with $package.  You may choose to
21997 compile these extensions for dynamic loading (the default), compile
21998 them into the $package executable (static loading), or not include
21999 them at all.  Answer "none" to include no extensions.
22000 Note that DynaLoader is always built and need not be mentioned here.
22001
22002 EOM
22003         case "$dynamic_ext" in
22004         '')
22005                 : Exclude those listed in static_ext
22006                 dflt=''
22007                 for xxx in $avail_ext; do
22008                         case " $static_ext " in
22009                         *" $xxx "*) ;;
22010                         *) dflt="$dflt $xxx" ;;
22011                         esac
22012                 done
22013                 set X $dflt
22014                 shift
22015                 dflt="$*"
22016                 ;;
22017         *)      dflt="$dynamic_ext"
22018                 # Perhaps we are reusing an old out-of-date config.sh.
22019                 case "$hint" in
22020                 previous)
22021                         if test X"$dynamic_ext" != X"$avail_ext"; then
22022                                 $cat <<EOM
22023 NOTICE:  Your previous config.sh list may be incorrect.
22024 The extensions now available to you are
22025         ${avail_ext}
22026 but the default list from your previous config.sh is
22027         ${dynamic_ext}
22028
22029 EOM
22030                         fi
22031                         ;;
22032                 esac
22033                 ;;
22034         esac
22035         case "$dflt" in
22036         '')     dflt=none;;
22037         esac
22038         rp="What extensions do you wish to load dynamically?"
22039         . ./myread
22040         case "$ans" in
22041         none) dynamic_ext=' ' ;;
22042         *) dynamic_ext="$ans" ;;
22043         esac
22044
22045         case "$static_ext" in
22046         '')
22047                 : Exclude those already listed in dynamic linking
22048                 dflt=''
22049                 for xxx in $avail_ext; do
22050                         case " $dynamic_ext " in
22051                         *" $xxx "*) ;;
22052                         *) dflt="$dflt $xxx" ;;
22053                         esac
22054                 done
22055                 set X $dflt
22056                 shift
22057                 dflt="$*"
22058                 ;;
22059         *)  dflt="$static_ext"
22060                 ;;
22061         esac
22062
22063         case "$dflt" in
22064         '')     dflt=none;;
22065         esac
22066         rp="What extensions do you wish to load statically?"
22067         . ./myread
22068         case "$ans" in
22069         none) static_ext=' ' ;;
22070         *) static_ext="$ans" ;;
22071         esac
22072         ;;
22073 *)
22074         $cat <<EOM
22075 A number of extensions are supplied with $package.  Answer "none"
22076 to include no extensions.
22077 Note that DynaLoader is always built and need not be mentioned here.
22078
22079 EOM
22080         case "$static_ext" in
22081         '') dflt="$avail_ext" ;;
22082         *)      dflt="$static_ext"
22083                 # Perhaps we are reusing an old out-of-date config.sh.
22084                 case "$hint" in
22085                 previous)
22086                         if test X"$static_ext" != X"$avail_ext"; then
22087                                 $cat <<EOM
22088 NOTICE:  Your previous config.sh list may be incorrect.
22089 The extensions now available to you are
22090         ${avail_ext}
22091 but the default list from your previous config.sh is
22092         ${static_ext}
22093
22094 EOM
22095                         fi
22096                         ;;
22097                 esac
22098                 ;;
22099         esac
22100         : Exclude those that are not xs extensions
22101         case "$dflt" in
22102         '')     dflt=none;;
22103         esac
22104         rp="What extensions do you wish to include?"
22105         . ./myread
22106         case "$ans" in
22107         none) static_ext=' ' ;;
22108         *) static_ext="$ans" ;;
22109         esac
22110         ;;
22111 esac
22112 #
22113 # Encode is a special case.  If we are building Encode as a static
22114 # extension, we need to explicitly list its subextensions as well.
22115 # For other nested extensions, this is handled automatically by
22116 # the appropriate Makefile.PL.
22117 case " $static_ext " in
22118         *" Encode "*) # Add the subextensions of Encode
22119         cd "$rsrc/ext"
22120         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22121                 static_ext="$static_ext Encode/$xxx"
22122         done
22123         cd "$tdir"
22124         ;;
22125 esac
22126
22127 set X $dynamic_ext $static_ext $nonxs_ext
22128 shift
22129 extensions="$*"
22130
22131 # Sanity check:  We require an extension suitable for use with
22132 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22133 # should show up as failures in the test suite, but it's helpful to
22134 # catch them now.) The 'extensions' list is normally sorted
22135 # alphabetically, so we need to accept either
22136 #    DB_File ... Fcntl ... IO  ....
22137 # or something like
22138 #    Fcntl ... NDBM_File ... IO  ....
22139 case " $extensions"  in
22140 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22141 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22142 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22143 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22144    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22145    ;;
22146 esac
22147
22148 : Remove libraries needed only for extensions
22149 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22150 : The exception is SunOS 4.x, which needs them.
22151 case "${osname}X${osvers}" in
22152 sunos*X4*)
22153     perllibs="$libs"
22154     ;;
22155 *) case "$usedl" in
22156     $define|true|[yY]*)
22157             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22158             shift
22159             perllibs="$*"
22160             ;;
22161     *)  perllibs="$libs"
22162             ;;
22163     esac
22164     ;;
22165 esac
22166
22167 : Remove build directory name from cppstdin so it can be used from
22168 : either the present location or the final installed location.
22169 echo " "
22170 : Get out of the UU directory to get correct path name.
22171 cd ..
22172 case "$cppstdin" in
22173 `pwd`/cppstdin)
22174         echo "Stripping down cppstdin path name"
22175         cppstdin=cppstdin
22176         ;;
22177 esac
22178 cd UU
22179
22180 : end of configuration questions
22181 echo " "
22182 echo "End of configuration questions."
22183 echo " "
22184
22185 : back to where it started
22186 if test -d ../UU; then
22187         cd ..
22188 fi
22189
22190 : configuration may be unconditionally patched via a 'config.arch' file
22191 if $test -f config.arch; then
22192         echo "I see a config.arch file, loading it." >&4
22193         . ./config.arch
22194 fi
22195
22196 : configuration may be patched via a 'config.over' file
22197 if $test -f config.over; then
22198         echo " "
22199         dflt=y
22200         rp='I see a config.over file.  Do you wish to load it?'
22201         . UU/myread
22202         case "$ans" in
22203         n*) echo "OK, I'll ignore it.";;
22204         *)      . ./config.over
22205                 echo "Configuration override changes have been loaded."
22206                 ;;
22207         esac
22208 fi
22209
22210 : in case they want portability, strip down executable paths
22211 case "$d_portable" in
22212 "$define")
22213         echo " "
22214         echo "Stripping down executable paths..." >&4
22215         for file in $loclist $trylist; do
22216                 eval temp=\$$file
22217                 eval $file=`basename $temp`
22218         done
22219         ;;
22220 esac
22221
22222 : create config.sh file
22223 echo " "
22224 echo "Creating config.sh..." >&4
22225 $spitshell <<EOT >config.sh
22226 $startsh
22227 #
22228 # This file was produced by running the Configure script. It holds all the
22229 # definitions figured out by Configure. Should you modify one of these values,
22230 # do not forget to propagate your changes by running "Configure -der". You may
22231 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22232 #
22233
22234 # Package name      : $package
22235 # Source directory  : $src
22236 # Configuration time: $cf_time
22237 # Configured by     : $cf_by
22238 # Target system     : $myuname
22239
22240 EOT
22241 : Add in command line options if available
22242 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22243
22244 $spitshell <<EOT >>config.sh
22245
22246 Author='$Author'
22247 Date='$Date'
22248 Header='$Header'
22249 Id='$Id'
22250 Locker='$Locker'
22251 Log='$Log'
22252 RCSfile='$RCSfile'
22253 Revision='$Revision'
22254 Source='$Source'
22255 State='$State'
22256 _a='$_a'
22257 _exe='$_exe'
22258 _o='$_o'
22259 afs='$afs'
22260 afsroot='$afsroot'
22261 alignbytes='$alignbytes'
22262 ansi2knr='$ansi2knr'
22263 aphostname='$aphostname'
22264 api_revision='$api_revision'
22265 api_subversion='$api_subversion'
22266 api_version='$api_version'
22267 api_versionstring='$api_versionstring'
22268 ar='$ar'
22269 archlib='$archlib'
22270 archlibexp='$archlibexp'
22271 archname64='$archname64'
22272 archname='$archname'
22273 archobjs='$archobjs'
22274 asctime_r_proto='$asctime_r_proto'
22275 awk='$awk'
22276 baserev='$baserev'
22277 bash='$bash'
22278 bin='$bin'
22279 bin_ELF='$bin_ELF'
22280 binexp='$binexp'
22281 bison='$bison'
22282 byacc='$byacc'
22283 byteorder='$byteorder'
22284 c='$c'
22285 castflags='$castflags'
22286 cat='$cat'
22287 cc='$cc'
22288 cccdlflags='$cccdlflags'
22289 ccdlflags='$ccdlflags'
22290 ccflags='$ccflags'
22291 ccflags_uselargefiles='$ccflags_uselargefiles'
22292 ccname='$ccname'
22293 ccsymbols='$ccsymbols'
22294 ccversion='$ccversion'
22295 cf_by='$cf_by'
22296 cf_email='$cf_email'
22297 cf_time='$cf_time'
22298 charbits='$charbits'
22299 charsize='$charsize'
22300 chgrp='$chgrp'
22301 chmod='$chmod'
22302 chown='$chown'
22303 clocktype='$clocktype'
22304 comm='$comm'
22305 compress='$compress'
22306 contains='$contains'
22307 cp='$cp'
22308 cpio='$cpio'
22309 cpp='$cpp'
22310 cpp_stuff='$cpp_stuff'
22311 cppccsymbols='$cppccsymbols'
22312 cppflags='$cppflags'
22313 cpplast='$cpplast'
22314 cppminus='$cppminus'
22315 cpprun='$cpprun'
22316 cppstdin='$cppstdin'
22317 cppsymbols='$cppsymbols'
22318 crypt_r_proto='$crypt_r_proto'
22319 cryptlib='$cryptlib'
22320 csh='$csh'
22321 ctermid_r_proto='$ctermid_r_proto'
22322 ctime_r_proto='$ctime_r_proto'
22323 d_Gconvert='$d_Gconvert'
22324 d_PRIEUldbl='$d_PRIEUldbl'
22325 d_PRIFUldbl='$d_PRIFUldbl'
22326 d_PRIGUldbl='$d_PRIGUldbl'
22327 d_PRIXU64='$d_PRIXU64'
22328 d_PRId64='$d_PRId64'
22329 d_PRIeldbl='$d_PRIeldbl'
22330 d_PRIfldbl='$d_PRIfldbl'
22331 d_PRIgldbl='$d_PRIgldbl'
22332 d_PRIi64='$d_PRIi64'
22333 d_PRIo64='$d_PRIo64'
22334 d_PRIu64='$d_PRIu64'
22335 d_PRIx64='$d_PRIx64'
22336 d_SCNfldbl='$d_SCNfldbl'
22337 d__fwalk='$d__fwalk'
22338 d_access='$d_access'
22339 d_accessx='$d_accessx'
22340 d_aintl='$d_aintl'
22341 d_alarm='$d_alarm'
22342 d_archlib='$d_archlib'
22343 d_asctime64='$d_asctime64'
22344 d_asctime_r='$d_asctime_r'
22345 d_atolf='$d_atolf'
22346 d_atoll='$d_atoll'
22347 d_attribute_deprecated='$d_attribute_deprecated'
22348 d_attribute_format='$d_attribute_format'
22349 d_attribute_malloc='$d_attribute_malloc'
22350 d_attribute_nonnull='$d_attribute_nonnull'
22351 d_attribute_noreturn='$d_attribute_noreturn'
22352 d_attribute_pure='$d_attribute_pure'
22353 d_attribute_unused='$d_attribute_unused'
22354 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22355 d_bcmp='$d_bcmp'
22356 d_bcopy='$d_bcopy'
22357 d_bsd='$d_bsd'
22358 d_bsdgetpgrp='$d_bsdgetpgrp'
22359 d_bsdsetpgrp='$d_bsdsetpgrp'
22360 d_builtin_choose_expr='$d_builtin_choose_expr'
22361 d_builtin_expect='$d_builtin_expect'
22362 d_bzero='$d_bzero'
22363 d_c99_variadic_macros='$d_c99_variadic_macros'
22364 d_casti32='$d_casti32'
22365 d_castneg='$d_castneg'
22366 d_charvspr='$d_charvspr'
22367 d_chown='$d_chown'
22368 d_chroot='$d_chroot'
22369 d_chsize='$d_chsize'
22370 d_class='$d_class'
22371 d_clearenv='$d_clearenv'
22372 d_closedir='$d_closedir'
22373 d_cmsghdr_s='$d_cmsghdr_s'
22374 d_const='$d_const'
22375 d_copysignl='$d_copysignl'
22376 d_cplusplus='$d_cplusplus'
22377 d_crypt='$d_crypt'
22378 d_crypt_r='$d_crypt_r'
22379 d_csh='$d_csh'
22380 d_ctermid='$d_ctermid'
22381 d_ctermid_r='$d_ctermid_r'
22382 d_ctime64='$d_ctime64'
22383 d_ctime_r='$d_ctime_r'
22384 d_cuserid='$d_cuserid'
22385 d_dbl_dig='$d_dbl_dig'
22386 d_dbminitproto='$d_dbminitproto'
22387 d_difftime64='$d_difftime64'
22388 d_difftime='$d_difftime'
22389 d_dir_dd_fd='$d_dir_dd_fd'
22390 d_dirfd='$d_dirfd'
22391 d_dirnamlen='$d_dirnamlen'
22392 d_dlerror='$d_dlerror'
22393 d_dlopen='$d_dlopen'
22394 d_dlsymun='$d_dlsymun'
22395 d_dosuid='$d_dosuid'
22396 d_drand48_r='$d_drand48_r'
22397 d_drand48proto='$d_drand48proto'
22398 d_dup2='$d_dup2'
22399 d_eaccess='$d_eaccess'
22400 d_endgrent='$d_endgrent'
22401 d_endgrent_r='$d_endgrent_r'
22402 d_endhent='$d_endhent'
22403 d_endhostent_r='$d_endhostent_r'
22404 d_endnent='$d_endnent'
22405 d_endnetent_r='$d_endnetent_r'
22406 d_endpent='$d_endpent'
22407 d_endprotoent_r='$d_endprotoent_r'
22408 d_endpwent='$d_endpwent'
22409 d_endpwent_r='$d_endpwent_r'
22410 d_endsent='$d_endsent'
22411 d_endservent_r='$d_endservent_r'
22412 d_eofnblk='$d_eofnblk'
22413 d_eunice='$d_eunice'
22414 d_faststdio='$d_faststdio'
22415 d_fchdir='$d_fchdir'
22416 d_fchmod='$d_fchmod'
22417 d_fchown='$d_fchown'
22418 d_fcntl='$d_fcntl'
22419 d_fcntl_can_lock='$d_fcntl_can_lock'
22420 d_fd_macros='$d_fd_macros'
22421 d_fd_set='$d_fd_set'
22422 d_fds_bits='$d_fds_bits'
22423 d_fgetpos='$d_fgetpos'
22424 d_finite='$d_finite'
22425 d_finitel='$d_finitel'
22426 d_flexfnam='$d_flexfnam'
22427 d_flock='$d_flock'
22428 d_flockproto='$d_flockproto'
22429 d_fork='$d_fork'
22430 d_fp_class='$d_fp_class'
22431 d_fpathconf='$d_fpathconf'
22432 d_fpclass='$d_fpclass'
22433 d_fpclassify='$d_fpclassify'
22434 d_fpclassl='$d_fpclassl'
22435 d_fpos64_t='$d_fpos64_t'
22436 d_frexpl='$d_frexpl'
22437 d_fs_data_s='$d_fs_data_s'
22438 d_fseeko='$d_fseeko'
22439 d_fsetpos='$d_fsetpos'
22440 d_fstatfs='$d_fstatfs'
22441 d_fstatvfs='$d_fstatvfs'
22442 d_fsync='$d_fsync'
22443 d_ftello='$d_ftello'
22444 d_ftime='$d_ftime'
22445 d_futimes='$d_futimes'
22446 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22447 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22448 d_getaddrinfo='$d_getaddrinfo'
22449 d_getcwd='$d_getcwd'
22450 d_getespwnam='$d_getespwnam'
22451 d_getfsstat='$d_getfsstat'
22452 d_getgrent='$d_getgrent'
22453 d_getgrent_r='$d_getgrent_r'
22454 d_getgrgid_r='$d_getgrgid_r'
22455 d_getgrnam_r='$d_getgrnam_r'
22456 d_getgrps='$d_getgrps'
22457 d_gethbyaddr='$d_gethbyaddr'
22458 d_gethbyname='$d_gethbyname'
22459 d_gethent='$d_gethent'
22460 d_gethname='$d_gethname'
22461 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22462 d_gethostbyname_r='$d_gethostbyname_r'
22463 d_gethostent_r='$d_gethostent_r'
22464 d_gethostprotos='$d_gethostprotos'
22465 d_getitimer='$d_getitimer'
22466 d_getlogin='$d_getlogin'
22467 d_getlogin_r='$d_getlogin_r'
22468 d_getmnt='$d_getmnt'
22469 d_getmntent='$d_getmntent'
22470 d_getnameinfo='$d_getnameinfo'
22471 d_getnbyaddr='$d_getnbyaddr'
22472 d_getnbyname='$d_getnbyname'
22473 d_getnent='$d_getnent'
22474 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22475 d_getnetbyname_r='$d_getnetbyname_r'
22476 d_getnetent_r='$d_getnetent_r'
22477 d_getnetprotos='$d_getnetprotos'
22478 d_getpagsz='$d_getpagsz'
22479 d_getpbyname='$d_getpbyname'
22480 d_getpbynumber='$d_getpbynumber'
22481 d_getpent='$d_getpent'
22482 d_getpgid='$d_getpgid'
22483 d_getpgrp2='$d_getpgrp2'
22484 d_getpgrp='$d_getpgrp'
22485 d_getppid='$d_getppid'
22486 d_getprior='$d_getprior'
22487 d_getprotobyname_r='$d_getprotobyname_r'
22488 d_getprotobynumber_r='$d_getprotobynumber_r'
22489 d_getprotoent_r='$d_getprotoent_r'
22490 d_getprotoprotos='$d_getprotoprotos'
22491 d_getprpwnam='$d_getprpwnam'
22492 d_getpwent='$d_getpwent'
22493 d_getpwent_r='$d_getpwent_r'
22494 d_getpwnam_r='$d_getpwnam_r'
22495 d_getpwuid_r='$d_getpwuid_r'
22496 d_getsbyname='$d_getsbyname'
22497 d_getsbyport='$d_getsbyport'
22498 d_getsent='$d_getsent'
22499 d_getservbyname_r='$d_getservbyname_r'
22500 d_getservbyport_r='$d_getservbyport_r'
22501 d_getservent_r='$d_getservent_r'
22502 d_getservprotos='$d_getservprotos'
22503 d_getspnam='$d_getspnam'
22504 d_getspnam_r='$d_getspnam_r'
22505 d_gettimeod='$d_gettimeod'
22506 d_gmtime64='$d_gmtime64'
22507 d_gmtime_r='$d_gmtime_r'
22508 d_gnulibc='$d_gnulibc'
22509 d_grpasswd='$d_grpasswd'
22510 d_hasmntopt='$d_hasmntopt'
22511 d_htonl='$d_htonl'
22512 d_ilogbl='$d_ilogbl'
22513 d_inc_version_list='$d_inc_version_list'
22514 d_index='$d_index'
22515 d_inetaton='$d_inetaton'
22516 d_inetntop='$d_inetntop'
22517 d_inetpton='$d_inetpton'
22518 d_int64_t='$d_int64_t'
22519 d_isascii='$d_isascii'
22520 d_isfinite='$d_isfinite'
22521 d_isinf='$d_isinf'
22522 d_isnan='$d_isnan'
22523 d_isnanl='$d_isnanl'
22524 d_killpg='$d_killpg'
22525 d_lchown='$d_lchown'
22526 d_ldbl_dig='$d_ldbl_dig'
22527 d_libm_lib_version='$d_libm_lib_version'
22528 d_link='$d_link'
22529 d_localtime64='$d_localtime64'
22530 d_localtime_r='$d_localtime_r'
22531 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22532 d_locconv='$d_locconv'
22533 d_lockf='$d_lockf'
22534 d_longdbl='$d_longdbl'
22535 d_longlong='$d_longlong'
22536 d_lseekproto='$d_lseekproto'
22537 d_lstat='$d_lstat'
22538 d_madvise='$d_madvise'
22539 d_malloc_good_size='$d_malloc_good_size'
22540 d_malloc_size='$d_malloc_size'
22541 d_mblen='$d_mblen'
22542 d_mbstowcs='$d_mbstowcs'
22543 d_mbtowc='$d_mbtowc'
22544 d_memchr='$d_memchr'
22545 d_memcmp='$d_memcmp'
22546 d_memcpy='$d_memcpy'
22547 d_memmove='$d_memmove'
22548 d_memset='$d_memset'
22549 d_mkdir='$d_mkdir'
22550 d_mkdtemp='$d_mkdtemp'
22551 d_mkfifo='$d_mkfifo'
22552 d_mkstemp='$d_mkstemp'
22553 d_mkstemps='$d_mkstemps'
22554 d_mktime64='$d_mktime64'
22555 d_mktime='$d_mktime'
22556 d_mmap='$d_mmap'
22557 d_modfl='$d_modfl'
22558 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22559 d_modflproto='$d_modflproto'
22560 d_mprotect='$d_mprotect'
22561 d_msg='$d_msg'
22562 d_msg_ctrunc='$d_msg_ctrunc'
22563 d_msg_dontroute='$d_msg_dontroute'
22564 d_msg_oob='$d_msg_oob'
22565 d_msg_peek='$d_msg_peek'
22566 d_msg_proxy='$d_msg_proxy'
22567 d_msgctl='$d_msgctl'
22568 d_msgget='$d_msgget'
22569 d_msghdr_s='$d_msghdr_s'
22570 d_msgrcv='$d_msgrcv'
22571 d_msgsnd='$d_msgsnd'
22572 d_msync='$d_msync'
22573 d_munmap='$d_munmap'
22574 d_mymalloc='$d_mymalloc'
22575 d_ndbm='$d_ndbm'
22576 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22577 d_nice='$d_nice'
22578 d_nl_langinfo='$d_nl_langinfo'
22579 d_nv_preserves_uv='$d_nv_preserves_uv'
22580 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22581 d_off64_t='$d_off64_t'
22582 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22583 d_oldpthreads='$d_oldpthreads'
22584 d_oldsock='$d_oldsock'
22585 d_open3='$d_open3'
22586 d_pathconf='$d_pathconf'
22587 d_pause='$d_pause'
22588 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22589 d_phostname='$d_phostname'
22590 d_pipe='$d_pipe'
22591 d_poll='$d_poll'
22592 d_portable='$d_portable'
22593 d_printf_format_null='$d_printf_format_null'
22594 d_procselfexe='$d_procselfexe'
22595 d_pseudofork='$d_pseudofork'
22596 d_pthread_atfork='$d_pthread_atfork'
22597 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22598 d_pthread_yield='$d_pthread_yield'
22599 d_pwage='$d_pwage'
22600 d_pwchange='$d_pwchange'
22601 d_pwclass='$d_pwclass'
22602 d_pwcomment='$d_pwcomment'
22603 d_pwexpire='$d_pwexpire'
22604 d_pwgecos='$d_pwgecos'
22605 d_pwpasswd='$d_pwpasswd'
22606 d_pwquota='$d_pwquota'
22607 d_qgcvt='$d_qgcvt'
22608 d_quad='$d_quad'
22609 d_random_r='$d_random_r'
22610 d_readdir64_r='$d_readdir64_r'
22611 d_readdir='$d_readdir'
22612 d_readdir_r='$d_readdir_r'
22613 d_readlink='$d_readlink'
22614 d_readv='$d_readv'
22615 d_recvmsg='$d_recvmsg'
22616 d_rename='$d_rename'
22617 d_rewinddir='$d_rewinddir'
22618 d_rmdir='$d_rmdir'
22619 d_safebcpy='$d_safebcpy'
22620 d_safemcpy='$d_safemcpy'
22621 d_sanemcmp='$d_sanemcmp'
22622 d_sbrkproto='$d_sbrkproto'
22623 d_scalbnl='$d_scalbnl'
22624 d_sched_yield='$d_sched_yield'
22625 d_scm_rights='$d_scm_rights'
22626 d_seekdir='$d_seekdir'
22627 d_select='$d_select'
22628 d_sem='$d_sem'
22629 d_semctl='$d_semctl'
22630 d_semctl_semid_ds='$d_semctl_semid_ds'
22631 d_semctl_semun='$d_semctl_semun'
22632 d_semget='$d_semget'
22633 d_semop='$d_semop'
22634 d_sendmsg='$d_sendmsg'
22635 d_setegid='$d_setegid'
22636 d_seteuid='$d_seteuid'
22637 d_setgrent='$d_setgrent'
22638 d_setgrent_r='$d_setgrent_r'
22639 d_setgrps='$d_setgrps'
22640 d_sethent='$d_sethent'
22641 d_sethostent_r='$d_sethostent_r'
22642 d_setitimer='$d_setitimer'
22643 d_setlinebuf='$d_setlinebuf'
22644 d_setlocale='$d_setlocale'
22645 d_setlocale_r='$d_setlocale_r'
22646 d_setnent='$d_setnent'
22647 d_setnetent_r='$d_setnetent_r'
22648 d_setpent='$d_setpent'
22649 d_setpgid='$d_setpgid'
22650 d_setpgrp2='$d_setpgrp2'
22651 d_setpgrp='$d_setpgrp'
22652 d_setprior='$d_setprior'
22653 d_setproctitle='$d_setproctitle'
22654 d_setprotoent_r='$d_setprotoent_r'
22655 d_setpwent='$d_setpwent'
22656 d_setpwent_r='$d_setpwent_r'
22657 d_setregid='$d_setregid'
22658 d_setresgid='$d_setresgid'
22659 d_setresuid='$d_setresuid'
22660 d_setreuid='$d_setreuid'
22661 d_setrgid='$d_setrgid'
22662 d_setruid='$d_setruid'
22663 d_setsent='$d_setsent'
22664 d_setservent_r='$d_setservent_r'
22665 d_setsid='$d_setsid'
22666 d_setvbuf='$d_setvbuf'
22667 d_sfio='$d_sfio'
22668 d_shm='$d_shm'
22669 d_shmat='$d_shmat'
22670 d_shmatprototype='$d_shmatprototype'
22671 d_shmctl='$d_shmctl'
22672 d_shmdt='$d_shmdt'
22673 d_shmget='$d_shmget'
22674 d_sigaction='$d_sigaction'
22675 d_signbit='$d_signbit'
22676 d_sigprocmask='$d_sigprocmask'
22677 d_sigsetjmp='$d_sigsetjmp'
22678 d_sitearch='$d_sitearch'
22679 d_snprintf='$d_snprintf'
22680 d_sockatmark='$d_sockatmark'
22681 d_sockatmarkproto='$d_sockatmarkproto'
22682 d_socket='$d_socket'
22683 d_socklen_t='$d_socklen_t'
22684 d_sockpair='$d_sockpair'
22685 d_socks5_init='$d_socks5_init'
22686 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22687 d_sqrtl='$d_sqrtl'
22688 d_srand48_r='$d_srand48_r'
22689 d_srandom_r='$d_srandom_r'
22690 d_sresgproto='$d_sresgproto'
22691 d_sresuproto='$d_sresuproto'
22692 d_statblks='$d_statblks'
22693 d_statfs_f_flags='$d_statfs_f_flags'
22694 d_statfs_s='$d_statfs_s'
22695 d_statvfs='$d_statvfs'
22696 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22697 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22698 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22699 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22700 d_stdio_stream_array='$d_stdio_stream_array'
22701 d_stdiobase='$d_stdiobase'
22702 d_stdstdio='$d_stdstdio'
22703 d_strchr='$d_strchr'
22704 d_strcoll='$d_strcoll'
22705 d_strctcpy='$d_strctcpy'
22706 d_strerrm='$d_strerrm'
22707 d_strerror='$d_strerror'
22708 d_strerror_r='$d_strerror_r'
22709 d_strftime='$d_strftime'
22710 d_strlcat='$d_strlcat'
22711 d_strlcpy='$d_strlcpy'
22712 d_strtod='$d_strtod'
22713 d_strtol='$d_strtol'
22714 d_strtold='$d_strtold'
22715 d_strtoll='$d_strtoll'
22716 d_strtoq='$d_strtoq'
22717 d_strtoul='$d_strtoul'
22718 d_strtoull='$d_strtoull'
22719 d_strtouq='$d_strtouq'
22720 d_strxfrm='$d_strxfrm'
22721 d_suidsafe='$d_suidsafe'
22722 d_symlink='$d_symlink'
22723 d_syscall='$d_syscall'
22724 d_syscallproto='$d_syscallproto'
22725 d_sysconf='$d_sysconf'
22726 d_sysernlst='$d_sysernlst'
22727 d_syserrlst='$d_syserrlst'
22728 d_system='$d_system'
22729 d_tcgetpgrp='$d_tcgetpgrp'
22730 d_tcsetpgrp='$d_tcsetpgrp'
22731 d_telldir='$d_telldir'
22732 d_telldirproto='$d_telldirproto'
22733 d_time='$d_time'
22734 d_timegm='$d_timegm'
22735 d_times='$d_times'
22736 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22737 d_tm_tm_zone='$d_tm_tm_zone'
22738 d_tmpnam_r='$d_tmpnam_r'
22739 d_truncate='$d_truncate'
22740 d_ttyname_r='$d_ttyname_r'
22741 d_tzname='$d_tzname'
22742 d_u32align='$d_u32align'
22743 d_ualarm='$d_ualarm'
22744 d_umask='$d_umask'
22745 d_uname='$d_uname'
22746 d_union_semun='$d_union_semun'
22747 d_unordered='$d_unordered'
22748 d_unsetenv='$d_unsetenv'
22749 d_usleep='$d_usleep'
22750 d_usleepproto='$d_usleepproto'
22751 d_ustat='$d_ustat'
22752 d_vendorarch='$d_vendorarch'
22753 d_vendorbin='$d_vendorbin'
22754 d_vendorlib='$d_vendorlib'
22755 d_vendorscript='$d_vendorscript'
22756 d_vfork='$d_vfork'
22757 d_void_closedir='$d_void_closedir'
22758 d_voidsig='$d_voidsig'
22759 d_voidtty='$d_voidtty'
22760 d_volatile='$d_volatile'
22761 d_vprintf='$d_vprintf'
22762 d_vsnprintf='$d_vsnprintf'
22763 d_wait4='$d_wait4'
22764 d_waitpid='$d_waitpid'
22765 d_wcstombs='$d_wcstombs'
22766 d_wctomb='$d_wctomb'
22767 d_writev='$d_writev'
22768 d_xenix='$d_xenix'
22769 date='$date'
22770 db_hashtype='$db_hashtype'
22771 db_prefixtype='$db_prefixtype'
22772 db_version_major='$db_version_major'
22773 db_version_minor='$db_version_minor'
22774 db_version_patch='$db_version_patch'
22775 defvoidused='$defvoidused'
22776 direntrytype='$direntrytype'
22777 dlext='$dlext'
22778 dlsrc='$dlsrc'
22779 doublesize='$doublesize'
22780 drand01='$drand01'
22781 drand48_r_proto='$drand48_r_proto'
22782 dtrace='$dtrace'
22783 dynamic_ext='$dynamic_ext'
22784 eagain='$eagain'
22785 ebcdic='$ebcdic'
22786 echo='$echo'
22787 egrep='$egrep'
22788 emacs='$emacs'
22789 endgrent_r_proto='$endgrent_r_proto'
22790 endhostent_r_proto='$endhostent_r_proto'
22791 endnetent_r_proto='$endnetent_r_proto'
22792 endprotoent_r_proto='$endprotoent_r_proto'
22793 endpwent_r_proto='$endpwent_r_proto'
22794 endservent_r_proto='$endservent_r_proto'
22795 eunicefix='$eunicefix'
22796 exe_ext='$exe_ext'
22797 expr='$expr'
22798 extensions='$extensions'
22799 extern_C='$extern_C'
22800 extras='$extras'
22801 fflushNULL='$fflushNULL'
22802 fflushall='$fflushall'
22803 find='$find'
22804 firstmakefile='$firstmakefile'
22805 flex='$flex'
22806 fpossize='$fpossize'
22807 fpostype='$fpostype'
22808 freetype='$freetype'
22809 from='$from'
22810 full_ar='$full_ar'
22811 full_csh='$full_csh'
22812 full_sed='$full_sed'
22813 gccansipedantic='$gccansipedantic'
22814 gccosandvers='$gccosandvers'
22815 gccversion='$gccversion'
22816 getgrent_r_proto='$getgrent_r_proto'
22817 getgrgid_r_proto='$getgrgid_r_proto'
22818 getgrnam_r_proto='$getgrnam_r_proto'
22819 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22820 gethostbyname_r_proto='$gethostbyname_r_proto'
22821 gethostent_r_proto='$gethostent_r_proto'
22822 getlogin_r_proto='$getlogin_r_proto'
22823 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22824 getnetbyname_r_proto='$getnetbyname_r_proto'
22825 getnetent_r_proto='$getnetent_r_proto'
22826 getprotobyname_r_proto='$getprotobyname_r_proto'
22827 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22828 getprotoent_r_proto='$getprotoent_r_proto'
22829 getpwent_r_proto='$getpwent_r_proto'
22830 getpwnam_r_proto='$getpwnam_r_proto'
22831 getpwuid_r_proto='$getpwuid_r_proto'
22832 getservbyname_r_proto='$getservbyname_r_proto'
22833 getservbyport_r_proto='$getservbyport_r_proto'
22834 getservent_r_proto='$getservent_r_proto'
22835 getspnam_r_proto='$getspnam_r_proto'
22836 gidformat='$gidformat'
22837 gidsign='$gidsign'
22838 gidsize='$gidsize'
22839 gidtype='$gidtype'
22840 glibpth='$glibpth'
22841 gmake='$gmake'
22842 gmtime_r_proto='$gmtime_r_proto'
22843 gnulibc_version='$gnulibc_version'
22844 grep='$grep'
22845 groupcat='$groupcat'
22846 groupstype='$groupstype'
22847 gzip='$gzip'
22848 h_fcntl='$h_fcntl'
22849 h_sysfile='$h_sysfile'
22850 hint='$hint'
22851 hostcat='$hostcat'
22852 html1dir='$html1dir'
22853 html1direxp='$html1direxp'
22854 html3dir='$html3dir'
22855 html3direxp='$html3direxp'
22856 i16size='$i16size'
22857 i16type='$i16type'
22858 i32size='$i32size'
22859 i32type='$i32type'
22860 i64size='$i64size'
22861 i64type='$i64type'
22862 i8size='$i8size'
22863 i8type='$i8type'
22864 i_arpainet='$i_arpainet'
22865 i_assert='$i_assert'
22866 i_bsdioctl='$i_bsdioctl'
22867 i_crypt='$i_crypt'
22868 i_db='$i_db'
22869 i_dbm='$i_dbm'
22870 i_dirent='$i_dirent'
22871 i_dld='$i_dld'
22872 i_dlfcn='$i_dlfcn'
22873 i_fcntl='$i_fcntl'
22874 i_float='$i_float'
22875 i_fp='$i_fp'
22876 i_fp_class='$i_fp_class'
22877 i_gdbm='$i_gdbm'
22878 i_gdbm_ndbm='$i_gdbm_ndbm'
22879 i_gdbmndbm='$i_gdbmndbm'
22880 i_grp='$i_grp'
22881 i_ieeefp='$i_ieeefp'
22882 i_inttypes='$i_inttypes'
22883 i_langinfo='$i_langinfo'
22884 i_libutil='$i_libutil'
22885 i_limits='$i_limits'
22886 i_locale='$i_locale'
22887 i_machcthr='$i_machcthr'
22888 i_malloc='$i_malloc'
22889 i_mallocmalloc='$i_mallocmalloc'
22890 i_math='$i_math'
22891 i_memory='$i_memory'
22892 i_mntent='$i_mntent'
22893 i_ndbm='$i_ndbm'
22894 i_netdb='$i_netdb'
22895 i_neterrno='$i_neterrno'
22896 i_netinettcp='$i_netinettcp'
22897 i_niin='$i_niin'
22898 i_poll='$i_poll'
22899 i_prot='$i_prot'
22900 i_pthread='$i_pthread'
22901 i_pwd='$i_pwd'
22902 i_rpcsvcdbm='$i_rpcsvcdbm'
22903 i_sfio='$i_sfio'
22904 i_sgtty='$i_sgtty'
22905 i_shadow='$i_shadow'
22906 i_socks='$i_socks'
22907 i_stdarg='$i_stdarg'
22908 i_stddef='$i_stddef'
22909 i_stdlib='$i_stdlib'
22910 i_string='$i_string'
22911 i_sunmath='$i_sunmath'
22912 i_sysaccess='$i_sysaccess'
22913 i_sysdir='$i_sysdir'
22914 i_sysfile='$i_sysfile'
22915 i_sysfilio='$i_sysfilio'
22916 i_sysin='$i_sysin'
22917 i_sysioctl='$i_sysioctl'
22918 i_syslog='$i_syslog'
22919 i_sysmman='$i_sysmman'
22920 i_sysmode='$i_sysmode'
22921 i_sysmount='$i_sysmount'
22922 i_sysndir='$i_sysndir'
22923 i_sysparam='$i_sysparam'
22924 i_syspoll='$i_syspoll'
22925 i_sysresrc='$i_sysresrc'
22926 i_syssecrt='$i_syssecrt'
22927 i_sysselct='$i_sysselct'
22928 i_syssockio='$i_syssockio'
22929 i_sysstat='$i_sysstat'
22930 i_sysstatfs='$i_sysstatfs'
22931 i_sysstatvfs='$i_sysstatvfs'
22932 i_systime='$i_systime'
22933 i_systimek='$i_systimek'
22934 i_systimes='$i_systimes'
22935 i_systypes='$i_systypes'
22936 i_sysuio='$i_sysuio'
22937 i_sysun='$i_sysun'
22938 i_sysutsname='$i_sysutsname'
22939 i_sysvfs='$i_sysvfs'
22940 i_syswait='$i_syswait'
22941 i_termio='$i_termio'
22942 i_termios='$i_termios'
22943 i_time='$i_time'
22944 i_unistd='$i_unistd'
22945 i_ustat='$i_ustat'
22946 i_utime='$i_utime'
22947 i_values='$i_values'
22948 i_varargs='$i_varargs'
22949 i_varhdr='$i_varhdr'
22950 i_vfork='$i_vfork'
22951 ignore_versioned_solibs='$ignore_versioned_solibs'
22952 inc_version_list='$inc_version_list'
22953 inc_version_list_init='$inc_version_list_init'
22954 incpath='$incpath'
22955 inews='$inews'
22956 initialinstalllocation='$initialinstalllocation'
22957 installarchlib='$installarchlib'
22958 installbin='$installbin'
22959 installhtml1dir='$installhtml1dir'
22960 installhtml3dir='$installhtml3dir'
22961 installman1dir='$installman1dir'
22962 installman3dir='$installman3dir'
22963 installprefix='$installprefix'
22964 installprefixexp='$installprefixexp'
22965 installprivlib='$installprivlib'
22966 installscript='$installscript'
22967 installsitearch='$installsitearch'
22968 installsitebin='$installsitebin'
22969 installsitehtml1dir='$installsitehtml1dir'
22970 installsitehtml3dir='$installsitehtml3dir'
22971 installsitelib='$installsitelib'
22972 installsiteman1dir='$installsiteman1dir'
22973 installsiteman3dir='$installsiteman3dir'
22974 installsitescript='$installsitescript'
22975 installstyle='$installstyle'
22976 installusrbinperl='$installusrbinperl'
22977 installvendorarch='$installvendorarch'
22978 installvendorbin='$installvendorbin'
22979 installvendorhtml1dir='$installvendorhtml1dir'
22980 installvendorhtml3dir='$installvendorhtml3dir'
22981 installvendorlib='$installvendorlib'
22982 installvendorman1dir='$installvendorman1dir'
22983 installvendorman3dir='$installvendorman3dir'
22984 installvendorscript='$installvendorscript'
22985 intsize='$intsize'
22986 issymlink='$issymlink'
22987 ivdformat='$ivdformat'
22988 ivsize='$ivsize'
22989 ivtype='$ivtype'
22990 known_extensions='$known_extensions'
22991 ksh='$ksh'
22992 ld='$ld'
22993 lddlflags='$lddlflags'
22994 ldflags='$ldflags'
22995 ldflags_uselargefiles='$ldflags_uselargefiles'
22996 ldlibpthname='$ldlibpthname'
22997 less='$less'
22998 lib_ext='$lib_ext'
22999 libc='$libc'
23000 libperl='$libperl'
23001 libpth='$libpth'
23002 libs='$libs'
23003 libsdirs='$libsdirs'
23004 libsfiles='$libsfiles'
23005 libsfound='$libsfound'
23006 libspath='$libspath'
23007 libswanted='$libswanted'
23008 libswanted_uselargefiles='$libswanted_uselargefiles'
23009 line='$line'
23010 lint='$lint'
23011 lkflags='$lkflags'
23012 ln='$ln'
23013 lns='$lns'
23014 localtime_r_proto='$localtime_r_proto'
23015 locincpth='$locincpth'
23016 loclibpth='$loclibpth'
23017 longdblsize='$longdblsize'
23018 longlongsize='$longlongsize'
23019 longsize='$longsize'
23020 lp='$lp'
23021 lpr='$lpr'
23022 ls='$ls'
23023 lseeksize='$lseeksize'
23024 lseektype='$lseektype'
23025 mad='$mad'
23026 madlyh='$madlyh'
23027 madlyobj='$madlyobj'
23028 madlysrc='$madlysrc'
23029 mail='$mail'
23030 mailx='$mailx'
23031 make='$make'
23032 make_set_make='$make_set_make'
23033 mallocobj='$mallocobj'
23034 mallocsrc='$mallocsrc'
23035 malloctype='$malloctype'
23036 man1dir='$man1dir'
23037 man1direxp='$man1direxp'
23038 man1ext='$man1ext'
23039 man3dir='$man3dir'
23040 man3direxp='$man3direxp'
23041 man3ext='$man3ext'
23042 mips_type='$mips_type'
23043 mistrustnm='$mistrustnm'
23044 mkdir='$mkdir'
23045 mmaptype='$mmaptype'
23046 modetype='$modetype'
23047 more='$more'
23048 multiarch='$multiarch'
23049 mv='$mv'
23050 myarchname='$myarchname'
23051 mydomain='$mydomain'
23052 myhostname='$myhostname'
23053 myuname='$myuname'
23054 n='$n'
23055 need_va_copy='$need_va_copy'
23056 netdb_hlen_type='$netdb_hlen_type'
23057 netdb_host_type='$netdb_host_type'
23058 netdb_name_type='$netdb_name_type'
23059 netdb_net_type='$netdb_net_type'
23060 nm='$nm'
23061 nm_opt='$nm_opt'
23062 nm_so_opt='$nm_so_opt'
23063 nonxs_ext='$nonxs_ext'
23064 nroff='$nroff'
23065 nvEUformat='$nvEUformat'
23066 nvFUformat='$nvFUformat'
23067 nvGUformat='$nvGUformat'
23068 nv_overflows_integers_at='$nv_overflows_integers_at'
23069 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23070 nveformat='$nveformat'
23071 nvfformat='$nvfformat'
23072 nvgformat='$nvgformat'
23073 nvsize='$nvsize'
23074 nvtype='$nvtype'
23075 o_nonblock='$o_nonblock'
23076 obj_ext='$obj_ext'
23077 old_pthread_create_joinable='$old_pthread_create_joinable'
23078 optimize='$optimize'
23079 orderlib='$orderlib'
23080 osname='$osname'
23081 osvers='$osvers'
23082 otherlibdirs='$otherlibdirs'
23083 package='$package'
23084 pager='$pager'
23085 passcat='$passcat'
23086 patchlevel='$patchlevel'
23087 path_sep='$path_sep'
23088 perl5='$perl5'
23089 perl='$perl'
23090 perl_patchlevel='$perl_patchlevel'
23091 perladmin='$perladmin'
23092 perllibs='$perllibs'
23093 perlpath='$perlpath'
23094 pg='$pg'
23095 phostname='$phostname'
23096 pidtype='$pidtype'
23097 plibpth='$plibpth'
23098 pmake='$pmake'
23099 pr='$pr'
23100 prefix='$prefix'
23101 prefixexp='$prefixexp'
23102 privlib='$privlib'
23103 privlibexp='$privlibexp'
23104 procselfexe='$procselfexe'
23105 prototype='$prototype'
23106 ptrsize='$ptrsize'
23107 quadkind='$quadkind'
23108 quadtype='$quadtype'
23109 randbits='$randbits'
23110 randfunc='$randfunc'
23111 random_r_proto='$random_r_proto'
23112 randseedtype='$randseedtype'
23113 ranlib='$ranlib'
23114 rd_nodata='$rd_nodata'
23115 readdir64_r_proto='$readdir64_r_proto'
23116 readdir_r_proto='$readdir_r_proto'
23117 revision='$revision'
23118 rm='$rm'
23119 rm_try='$rm_try'
23120 rmail='$rmail'
23121 run='$run'
23122 runnm='$runnm'
23123 sGMTIME_max='$sGMTIME_max'
23124 sGMTIME_min='$sGMTIME_min'
23125 sLOCALTIME_max='$sLOCALTIME_max'
23126 sLOCALTIME_min='$sLOCALTIME_min'
23127 sPRIEUldbl='$sPRIEUldbl'
23128 sPRIFUldbl='$sPRIFUldbl'
23129 sPRIGUldbl='$sPRIGUldbl'
23130 sPRIXU64='$sPRIXU64'
23131 sPRId64='$sPRId64'
23132 sPRIeldbl='$sPRIeldbl'
23133 sPRIfldbl='$sPRIfldbl'
23134 sPRIgldbl='$sPRIgldbl'
23135 sPRIi64='$sPRIi64'
23136 sPRIo64='$sPRIo64'
23137 sPRIu64='$sPRIu64'
23138 sPRIx64='$sPRIx64'
23139 sSCNfldbl='$sSCNfldbl'
23140 sched_yield='$sched_yield'
23141 scriptdir='$scriptdir'
23142 scriptdirexp='$scriptdirexp'
23143 sed='$sed'
23144 seedfunc='$seedfunc'
23145 selectminbits='$selectminbits'
23146 selecttype='$selecttype'
23147 sendmail='$sendmail'
23148 setgrent_r_proto='$setgrent_r_proto'
23149 sethostent_r_proto='$sethostent_r_proto'
23150 setlocale_r_proto='$setlocale_r_proto'
23151 setnetent_r_proto='$setnetent_r_proto'
23152 setprotoent_r_proto='$setprotoent_r_proto'
23153 setpwent_r_proto='$setpwent_r_proto'
23154 setservent_r_proto='$setservent_r_proto'
23155 sh='$sh'
23156 shar='$shar'
23157 sharpbang='$sharpbang'
23158 shmattype='$shmattype'
23159 shortsize='$shortsize'
23160 shrpenv='$shrpenv'
23161 shsharp='$shsharp'
23162 sig_count='$sig_count'
23163 sig_name='$sig_name'
23164 sig_name_init='$sig_name_init'
23165 sig_num='$sig_num'
23166 sig_num_init='$sig_num_init'
23167 sig_size='$sig_size'
23168 signal_t='$signal_t'
23169 sitearch='$sitearch'
23170 sitearchexp='$sitearchexp'
23171 sitebin='$sitebin'
23172 sitebinexp='$sitebinexp'
23173 sitehtml1dir='$sitehtml1dir'
23174 sitehtml1direxp='$sitehtml1direxp'
23175 sitehtml3dir='$sitehtml3dir'
23176 sitehtml3direxp='$sitehtml3direxp'
23177 sitelib='$sitelib'
23178 sitelib_stem='$sitelib_stem'
23179 sitelibexp='$sitelibexp'
23180 siteman1dir='$siteman1dir'
23181 siteman1direxp='$siteman1direxp'
23182 siteman3dir='$siteman3dir'
23183 siteman3direxp='$siteman3direxp'
23184 siteprefix='$siteprefix'
23185 siteprefixexp='$siteprefixexp'
23186 sitescript='$sitescript'
23187 sitescriptexp='$sitescriptexp'
23188 sizesize='$sizesize'
23189 sizetype='$sizetype'
23190 sleep='$sleep'
23191 smail='$smail'
23192 so='$so'
23193 sockethdr='$sockethdr'
23194 socketlib='$socketlib'
23195 socksizetype='$socksizetype'
23196 sort='$sort'
23197 spackage='$spackage'
23198 spitshell='$spitshell'
23199 srand48_r_proto='$srand48_r_proto'
23200 srandom_r_proto='$srandom_r_proto'
23201 src='$src'
23202 ssizetype='$ssizetype'
23203 startperl='$startperl'
23204 startsh='$startsh'
23205 static_ext='$static_ext'
23206 stdchar='$stdchar'
23207 stdio_base='$stdio_base'
23208 stdio_bufsiz='$stdio_bufsiz'
23209 stdio_cnt='$stdio_cnt'
23210 stdio_filbuf='$stdio_filbuf'
23211 stdio_ptr='$stdio_ptr'
23212 stdio_stream_array='$stdio_stream_array'
23213 strerror_r_proto='$strerror_r_proto'
23214 strings='$strings'
23215 submit='$submit'
23216 subversion='$subversion'
23217 sysman='$sysman'
23218 tail='$tail'
23219 tar='$tar'
23220 targetarch='$targetarch'
23221 tbl='$tbl'
23222 tee='$tee'
23223 test='$test'
23224 timeincl='$timeincl'
23225 timetype='$timetype'
23226 tmpnam_r_proto='$tmpnam_r_proto'
23227 to='$to'
23228 touch='$touch'
23229 tr='$tr'
23230 trnl='$trnl'
23231 troff='$troff'
23232 ttyname_r_proto='$ttyname_r_proto'
23233 u16size='$u16size'
23234 u16type='$u16type'
23235 u32size='$u32size'
23236 u32type='$u32type'
23237 u64size='$u64size'
23238 u64type='$u64type'
23239 u8size='$u8size'
23240 u8type='$u8type'
23241 uidformat='$uidformat'
23242 uidsign='$uidsign'
23243 uidsize='$uidsize'
23244 uidtype='$uidtype'
23245 uname='$uname'
23246 uniq='$uniq'
23247 uquadtype='$uquadtype'
23248 use5005threads='$use5005threads'
23249 use64bitall='$use64bitall'
23250 use64bitint='$use64bitint'
23251 usecrosscompile='$usecrosscompile'
23252 usedevel='$usedevel'
23253 usedl='$usedl'
23254 usedtrace='$usedtrace'
23255 usefaststdio='$usefaststdio'
23256 useithreads='$useithreads'
23257 uselargefiles='$uselargefiles'
23258 uselongdouble='$uselongdouble'
23259 usemallocwrap='$usemallocwrap'
23260 usemorebits='$usemorebits'
23261 usemultiplicity='$usemultiplicity'
23262 usemymalloc='$usemymalloc'
23263 usenm='$usenm'
23264 useopcode='$useopcode'
23265 useperlio='$useperlio'
23266 useposix='$useposix'
23267 usereentrant='$usereentrant'
23268 userelocatableinc='$userelocatableinc'
23269 usesfio='$usesfio'
23270 useshrplib='$useshrplib'
23271 usesitecustomize='$usesitecustomize'
23272 usesocks='$usesocks'
23273 usethreads='$usethreads'
23274 usevendorprefix='$usevendorprefix'
23275 usevfork='$usevfork'
23276 usrinc='$usrinc'
23277 uuname='$uuname'
23278 uvXUformat='$uvXUformat'
23279 uvoformat='$uvoformat'
23280 uvsize='$uvsize'
23281 uvtype='$uvtype'
23282 uvuformat='$uvuformat'
23283 uvxformat='$uvxformat'
23284 vendorarch='$vendorarch'
23285 vendorarchexp='$vendorarchexp'
23286 vendorbin='$vendorbin'
23287 vendorbinexp='$vendorbinexp'
23288 vendorhtml1dir='$vendorhtml1dir'
23289 vendorhtml1direxp='$vendorhtml1direxp'
23290 vendorhtml3dir='$vendorhtml3dir'
23291 vendorhtml3direxp='$vendorhtml3direxp'
23292 vendorlib='$vendorlib'
23293 vendorlib_stem='$vendorlib_stem'
23294 vendorlibexp='$vendorlibexp'
23295 vendorman1dir='$vendorman1dir'
23296 vendorman1direxp='$vendorman1direxp'
23297 vendorman3dir='$vendorman3dir'
23298 vendorman3direxp='$vendorman3direxp'
23299 vendorprefix='$vendorprefix'
23300 vendorprefixexp='$vendorprefixexp'
23301 vendorscript='$vendorscript'
23302 vendorscriptexp='$vendorscriptexp'
23303 version='$version'
23304 version_patchlevel_string='$version_patchlevel_string'
23305 versiononly='$versiononly'
23306 vi='$vi'
23307 voidflags='$voidflags'
23308 xlibpth='$xlibpth'
23309 yacc='$yacc'
23310 yaccflags='$yaccflags'
23311 zcat='$zcat'
23312 zip='$zip'
23313 EOT
23314
23315 : add special variables
23316 $test -f $src/patchlevel.h && \
23317 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23318 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23319 echo "PERL_CONFIG_SH=true" >>config.sh
23320
23321 : propagate old symbols
23322 if $test -f UU/config.sh; then
23323         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23324         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23325                 config.sh config.sh UU/oldconfig.sh |\
23326                 $sort | $uniq -u >UU/oldsyms
23327         set X `cat UU/oldsyms`
23328         shift
23329         case $# in
23330         0) ;;
23331         *)
23332                 cat <<EOM
23333 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23334 EOM
23335                 echo ": Variables propagated from previous config.sh file." >>config.sh
23336                 for sym in `cat UU/oldsyms`; do
23337                         echo "    Propagating $hint variable "'$'"$sym..."
23338                         eval 'tmp="$'"${sym}"'"'
23339                         echo "$tmp" | \
23340                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23341                 done
23342                 ;;
23343         esac
23344 fi
23345
23346 : Finish up by extracting the .SH files
23347 case "$alldone" in
23348 exit)
23349         $rm -rf UU
23350         echo "Extraction done."
23351         exit 0
23352         ;;
23353 cont)
23354         ;;
23355 '')
23356         dflt=''
23357         nostick=true
23358         $cat <<EOM
23359
23360 If you'd like to make any changes to the config.sh file before I begin
23361 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23362
23363 EOM
23364         rp="Press return or use a shell escape to edit config.sh:"
23365         . UU/myread
23366         nostick=''
23367         case "$ans" in
23368         '') ;;
23369         *) : in case they cannot read
23370                 sh 1>&4 -c "$ans";;
23371         esac
23372         ;;
23373 esac
23374
23375 : if this fails, just run all the .SH files by hand
23376 . ./config.sh
23377
23378 echo " "
23379 exec 1>&4
23380 pwd=`pwd`
23381 . ./UU/extract
23382 cd "$pwd"
23383
23384 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23385         dflt=y
23386         case "$silent" in
23387         true) ;;
23388         *)
23389                 $cat <<EOM
23390
23391 Now you need to generate make dependencies by running "$make depend".
23392 You might prefer to run it in background: "$make depend > makedepend.out &"
23393 It can take a while, so you might not want to run it right now.
23394
23395 EOM
23396                 ;;
23397         esac
23398         rp="Run $make depend now?"
23399         . UU/myread
23400         case "$ans" in
23401         y*)
23402                 $make depend && echo "Now you must run '$make'."
23403                 ;;
23404         *)
23405                 echo "You must run '$make depend' then '$make'."
23406                 ;;
23407         esac
23408 elif test -f [Mm]akefile; then
23409         echo " "
23410         echo "Now you must run a $make."
23411 else
23412         echo "Configure done."
23413 fi
23414
23415 if $test -f Policy.sh; then
23416     $cat <<EOM
23417
23418 If you compile $package on a different machine or from a different object
23419 directory, copy the Policy.sh file from this object directory to the
23420 new one before you run Configure -- this will help you with most of
23421 the policy defaults.
23422
23423 EOM
23424 fi
23425 if $test -f config.msg; then
23426     echo "Hmm.  I also noted the following information while running:"
23427     echo " "
23428     $cat config.msg >&4
23429     $rm -f config.msg
23430 fi
23431 $rm -f kit*isdone ark*isdone
23432 $rm -rf UU
23433
23434 : End of Configure
23435