This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make entertry a LOGOP, not BASEOP/UNOP
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 # 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 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
32 #
33 # Generated on Fri Dec 10 12:04:58 CET 2010 [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 run=''
212 targetarch=''
213 to=''
214 usecrosscompile=''
215 extern_C=''
216 mistrustnm=''
217 usedevel=''
218 perllibs=''
219 dynamic_ext=''
220 extensions=''
221 known_extensions=''
222 nonxs_ext=''
223 static_ext=''
224 useopcode=''
225 useposix=''
226 extras=''
227 d_bsd=''
228 d_eunice=''
229 d_xenix=''
230 eunicefix=''
231 ar=''
232 awk=''
233 bash=''
234 bison=''
235 byacc=''
236 cat=''
237 chgrp=''
238 chmod=''
239 chown=''
240 comm=''
241 compress=''
242 cp=''
243 cpio=''
244 cpp=''
245 csh=''
246 date=''
247 echo=''
248 egrep=''
249 emacs=''
250 expr=''
251 find=''
252 flex=''
253 gmake=''
254 grep=''
255 gzip=''
256 inews=''
257 ksh=''
258 less=''
259 line=''
260 lint=''
261 ln=''
262 lp=''
263 lpr=''
264 ls=''
265 mail=''
266 mailx=''
267 make=''
268 mkdir=''
269 more=''
270 mv=''
271 nm=''
272 nroff=''
273 perl=''
274 pg=''
275 pmake=''
276 pr=''
277 rm=''
278 rmail=''
279 sed=''
280 sendmail=''
281 shar=''
282 sleep=''
283 smail=''
284 sort=''
285 submit=''
286 tail=''
287 tar=''
288 tbl=''
289 tee=''
290 test=''
291 touch=''
292 tr=''
293 troff=''
294 uname=''
295 uniq=''
296 uuname=''
297 vi=''
298 zcat=''
299 zip=''
300 full_ar=''
301 full_sed=''
302 libswanted=''
303 hint=''
304 myuname=''
305 osname=''
306 osvers=''
307 Author=''
308 Date=''
309 Header=''
310 Id=''
311 Locker=''
312 Log=''
313 RCSfile=''
314 Revision=''
315 Source=''
316 State=''
317 _a=''
318 _exe=''
319 _o=''
320 archobjs=''
321 exe_ext=''
322 firstmakefile=''
323 lib_ext=''
324 obj_ext=''
325 path_sep=''
326 rm_try=''
327 afs=''
328 afsroot=''
329 alignbytes=''
330 ansi2knr=''
331 archlib=''
332 archlibexp=''
333 d_archlib=''
334 installarchlib=''
335 archname=''
336 myarchname=''
337 d_atolf=''
338 d_atoll=''
339 baserev=''
340 bin=''
341 binexp=''
342 initialinstalllocation=''
343 installbin=''
344 userelocatableinc=''
345 byteorder=''
346 cc=''
347 ccflags=''
348 cppflags=''
349 ldflags=''
350 lkflags=''
351 locincpth=''
352 optimize=''
353 cf_email=''
354 cf_by=''
355 cf_time=''
356 charbits=''
357 charsize=''
358 contains=''
359 cpp_stuff=''
360 cpplast=''
361 cppminus=''
362 cpprun=''
363 cppstdin=''
364 d__fwalk=''
365 d_access=''
366 d_accessx=''
367 d_aintl=''
368 d_alarm=''
369 asctime_r_proto=''
370 d_asctime_r=''
371 d_attribute_deprecated=''
372 d_attribute_format=''
373 d_attribute_malloc=''
374 d_attribute_nonnull=''
375 d_attribute_noreturn=''
376 d_attribute_pure=''
377 d_attribute_unused=''
378 d_attribute_warn_unused_result=''
379 d_printf_format_null=''
380 d_bcmp=''
381 d_bcopy=''
382 d_builtin_choose_expr=''
383 d_builtin_expect=''
384 d_bzero=''
385 d_c99_variadic_macros=''
386 d_casti32=''
387 castflags=''
388 d_castneg=''
389 d_chown=''
390 d_chroot=''
391 d_chsize=''
392 d_class=''
393 d_clearenv=''
394 d_closedir=''
395 d_void_closedir=''
396 d_cmsghdr_s=''
397 d_const=''
398 d_copysignl=''
399 d_cplusplus=''
400 cryptlib=''
401 d_crypt=''
402 crypt_r_proto=''
403 d_crypt_r=''
404 d_csh=''
405 full_csh=''
406 d_ctermid=''
407 ctermid_r_proto=''
408 d_ctermid_r=''
409 ctime_r_proto=''
410 d_ctime_r=''
411 d_cuserid=''
412 d_dbl_dig=''
413 d_dbminitproto=''
414 d_difftime=''
415 d_dir_dd_fd=''
416 d_dirfd=''
417 d_dlerror=''
418 d_dlopen=''
419 d_dlsymun=''
420 d_dosuid=''
421 d_suidsafe=''
422 d_drand48_r=''
423 drand48_r_proto=''
424 d_drand48proto=''
425 d_dup2=''
426 d_eaccess=''
427 d_endgrent=''
428 d_endgrent_r=''
429 endgrent_r_proto=''
430 d_endhent=''
431 d_endhostent_r=''
432 endhostent_r_proto=''
433 d_endnent=''
434 d_endnetent_r=''
435 endnetent_r_proto=''
436 d_endpent=''
437 d_endprotoent_r=''
438 endprotoent_r_proto=''
439 d_endpwent=''
440 d_endpwent_r=''
441 endpwent_r_proto=''
442 d_endsent=''
443 d_endservent_r=''
444 endservent_r_proto=''
445 d_faststdio=''
446 d_fchdir=''
447 d_fchmod=''
448 d_fchown=''
449 d_fcntl=''
450 d_fcntl_can_lock=''
451 d_fd_macros=''
452 d_fd_set=''
453 d_fds_bits=''
454 d_fgetpos=''
455 d_finite=''
456 d_finitel=''
457 d_flexfnam=''
458 d_flock=''
459 d_flockproto=''
460 d_fork=''
461 d_fp_class=''
462 d_fpclass=''
463 d_fpclassify=''
464 d_fpclassl=''
465 d_fpos64_t=''
466 d_frexpl=''
467 d_fs_data_s=''
468 d_fseeko=''
469 d_fsetpos=''
470 d_fstatfs=''
471 d_fsync=''
472 d_ftello=''
473 d_ftime=''
474 d_gettimeod=''
475 d_futimes=''
476 d_Gconvert=''
477 d_getaddrinfo=''
478 d_getcwd=''
479 d_getespwnam=''
480 d_getfsstat=''
481 d_getgrent=''
482 d_getgrent_r=''
483 getgrent_r_proto=''
484 d_getgrgid_r=''
485 getgrgid_r_proto=''
486 d_getgrnam_r=''
487 getgrnam_r_proto=''
488 d_getgrps=''
489 d_gethbyaddr=''
490 d_gethbyname=''
491 d_gethent=''
492 aphostname=''
493 d_gethname=''
494 d_phostname=''
495 d_uname=''
496 d_gethostbyaddr_r=''
497 gethostbyaddr_r_proto=''
498 d_gethostbyname_r=''
499 gethostbyname_r_proto=''
500 d_gethostent_r=''
501 gethostent_r_proto=''
502 d_gethostprotos=''
503 d_getitimer=''
504 d_getlogin=''
505 d_getlogin_r=''
506 getlogin_r_proto=''
507 d_getmnt=''
508 d_getmntent=''
509 d_getnameinfo=''
510 d_getnbyaddr=''
511 d_getnbyname=''
512 d_getnent=''
513 d_getnetbyaddr_r=''
514 getnetbyaddr_r_proto=''
515 d_getnetbyname_r=''
516 getnetbyname_r_proto=''
517 d_getnetent_r=''
518 getnetent_r_proto=''
519 d_getnetprotos=''
520 d_getpagsz=''
521 d_getpent=''
522 d_getpgid=''
523 d_getpgrp2=''
524 d_bsdgetpgrp=''
525 d_getpgrp=''
526 d_getppid=''
527 d_getprior=''
528 d_getpbyname=''
529 d_getpbynumber=''
530 d_getprotobyname_r=''
531 getprotobyname_r_proto=''
532 d_getprotobynumber_r=''
533 getprotobynumber_r_proto=''
534 d_getprotoent_r=''
535 getprotoent_r_proto=''
536 d_getprotoprotos=''
537 d_getprpwnam=''
538 d_getpwent=''
539 d_getpwent_r=''
540 getpwent_r_proto=''
541 d_getpwnam_r=''
542 getpwnam_r_proto=''
543 d_getpwuid_r=''
544 getpwuid_r_proto=''
545 d_getsent=''
546 d_getservbyname_r=''
547 getservbyname_r_proto=''
548 d_getservbyport_r=''
549 getservbyport_r_proto=''
550 d_getservent_r=''
551 getservent_r_proto=''
552 d_getservprotos=''
553 d_getspnam=''
554 d_getspnam_r=''
555 getspnam_r_proto=''
556 d_getsbyname=''
557 d_getsbyport=''
558 d_gmtime_r=''
559 gmtime_r_proto=''
560 d_gnulibc=''
561 gnulibc_version=''
562 d_hasmntopt=''
563 d_htonl=''
564 d_ilogbl=''
565 d_inetaton=''
566 d_inetntop=''
567 d_inetpton=''
568 d_int64_t=''
569 d_isascii=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_prctl=''
632 d_prctl_set_name=''
633 d_procselfexe=''
634 procselfexe=''
635 d_old_pthread_create_joinable=''
636 old_pthread_create_joinable=''
637 d_pthread_atfork=''
638 d_pthread_attr_setscope=''
639 d_pthread_yield=''
640 d_sched_yield=''
641 sched_yield=''
642 d_qgcvt=''
643 d_random_r=''
644 random_r_proto=''
645 d_readdir64_r=''
646 readdir64_r_proto=''
647 d_readdir=''
648 d_rewinddir=''
649 d_seekdir=''
650 d_telldir=''
651 d_readdir_r=''
652 readdir_r_proto=''
653 d_readlink=''
654 d_readv=''
655 d_recvmsg=''
656 d_rename=''
657 d_rmdir=''
658 d_safebcpy=''
659 d_safemcpy=''
660 d_sanemcmp=''
661 d_sbrkproto=''
662 d_scalbnl=''
663 d_select=''
664 d_sem=''
665 d_semctl=''
666 d_semget=''
667 d_semop=''
668 d_sendmsg=''
669 d_setegid=''
670 d_seteuid=''
671 d_setgrent=''
672 d_setgrent_r=''
673 setgrent_r_proto=''
674 d_setgrps=''
675 d_sethent=''
676 d_sethostent_r=''
677 sethostent_r_proto=''
678 d_setitimer=''
679 d_setlinebuf=''
680 d_setlocale=''
681 d_setlocale_r=''
682 setlocale_r_proto=''
683 d_setnent=''
684 d_setnetent_r=''
685 setnetent_r_proto=''
686 d_setpent=''
687 d_setpgid=''
688 d_setpgrp2=''
689 d_bsdsetpgrp=''
690 d_setpgrp=''
691 d_setprior=''
692 d_setproctitle=''
693 d_setprotoent_r=''
694 setprotoent_r_proto=''
695 d_setpwent=''
696 d_setpwent_r=''
697 setpwent_r_proto=''
698 d_setregid=''
699 d_setresgid=''
700 d_setresuid=''
701 d_setreuid=''
702 d_setrgid=''
703 d_setruid=''
704 d_setsent=''
705 d_setservent_r=''
706 setservent_r_proto=''
707 d_setsid=''
708 d_setvbuf=''
709 d_sfio=''
710 usesfio=''
711 d_shm=''
712 d_shmat=''
713 d_shmatprototype=''
714 shmattype=''
715 d_shmctl=''
716 d_shmdt=''
717 d_shmget=''
718 d_sigaction=''
719 d_signbit=''
720 d_sigprocmask=''
721 d_sigsetjmp=''
722 usesitecustomize=''
723 d_snprintf=''
724 d_vsnprintf=''
725 d_sockatmark=''
726 d_sockatmarkproto=''
727 d_msg_ctrunc=''
728 d_msg_dontroute=''
729 d_msg_oob=''
730 d_msg_peek=''
731 d_msg_proxy=''
732 d_oldsock=''
733 d_scm_rights=''
734 d_sockaddr_sa_len=''
735 d_socket=''
736 d_sockpair=''
737 sockethdr=''
738 socketlib=''
739 d_socklen_t=''
740 d_socks5_init=''
741 d_sprintf_returns_strlen=''
742 d_sqrtl=''
743 d_srand48_r=''
744 srand48_r_proto=''
745 d_srandom_r=''
746 srandom_r_proto=''
747 d_sresgproto=''
748 d_sresuproto=''
749 d_statblks=''
750 d_statfs_f_flags=''
751 d_statfs_s=''
752 d_static_inline=''
753 perl_static_inline=''
754 d_fstatvfs=''
755 d_statvfs=''
756 d_stdio_cnt_lval=''
757 d_stdio_ptr_lval=''
758 d_stdio_ptr_lval_nochange_cnt=''
759 d_stdio_ptr_lval_sets_cnt=''
760 d_stdiobase=''
761 d_stdstdio=''
762 stdio_base=''
763 stdio_bufsiz=''
764 stdio_cnt=''
765 stdio_filbuf=''
766 stdio_ptr=''
767 d_index=''
768 d_strchr=''
769 d_strcoll=''
770 d_strctcpy=''
771 d_strerrm=''
772 d_strerror=''
773 d_sysernlst=''
774 d_syserrlst=''
775 d_strerror_r=''
776 strerror_r_proto=''
777 d_strftime=''
778 d_strlcat=''
779 d_strlcpy=''
780 d_strtod=''
781 d_strtol=''
782 d_strtold=''
783 d_strtoll=''
784 d_strtoq=''
785 d_strtoul=''
786 d_strtoull=''
787 d_strtouq=''
788 d_strxfrm=''
789 d_symlink=''
790 d_syscall=''
791 d_syscallproto=''
792 d_sysconf=''
793 d_system=''
794 d_tcgetpgrp=''
795 d_tcsetpgrp=''
796 d_telldirproto=''
797 d_time=''
798 timetype=''
799 d_asctime64=''
800 d_ctime64=''
801 d_difftime64=''
802 d_gmtime64=''
803 d_localtime64=''
804 d_mktime64=''
805 d_timegm=''
806 clocktype=''
807 d_times=''
808 d_tmpnam_r=''
809 tmpnam_r_proto=''
810 d_truncate=''
811 d_ttyname_r=''
812 ttyname_r_proto=''
813 d_tzname=''
814 d_u32align=''
815 d_ualarm=''
816 d_umask=''
817 d_semctl_semid_ds=''
818 d_semctl_semun=''
819 d_union_semun=''
820 d_unordered=''
821 d_unsetenv=''
822 d_usleep=''
823 d_usleepproto=''
824 d_ustat=''
825 d_pseudofork=''
826 d_vfork=''
827 usevfork=''
828 d_voidsig=''
829 signal_t=''
830 d_volatile=''
831 d_charvspr=''
832 d_vprintf=''
833 d_wait4=''
834 d_waitpid=''
835 d_wcstombs=''
836 d_wctomb=''
837 d_writev=''
838 dlext=''
839 bin_ELF=''
840 cccdlflags=''
841 ccdlflags=''
842 dlsrc=''
843 ld=''
844 lddlflags=''
845 usedl=''
846 doublesize=''
847 ebcdic=''
848 fflushNULL=''
849 fflushall=''
850 fpossize=''
851 fpostype=''
852 gccansipedantic=''
853 gccosandvers=''
854 gccversion=''
855 gidformat=''
856 gidsign=''
857 gidsize=''
858 gidtype=''
859 groupstype=''
860 h_fcntl=''
861 h_sysfile=''
862 html1dir=''
863 html1direxp=''
864 installhtml1dir=''
865 html3dir=''
866 html3direxp=''
867 installhtml3dir=''
868 i_arpainet=''
869 i_assert=''
870 i_crypt=''
871 db_hashtype=''
872 db_prefixtype=''
873 db_version_major=''
874 db_version_minor=''
875 db_version_patch=''
876 i_db=''
877 i_dbm=''
878 i_rpcsvcdbm=''
879 d_dirnamlen=''
880 direntrytype=''
881 i_dirent=''
882 i_dld=''
883 i_dlfcn=''
884 i_fcntl=''
885 i_float=''
886 i_fp=''
887 i_fp_class=''
888 i_gdbm=''
889 d_grpasswd=''
890 i_grp=''
891 i_ieeefp=''
892 i_inttypes=''
893 i_langinfo=''
894 i_libutil=''
895 i_limits=''
896 i_locale=''
897 i_machcthr=''
898 i_malloc=''
899 i_mallocmalloc=''
900 i_math=''
901 i_memory=''
902 i_mntent=''
903 d_gdbm_ndbm_h_uses_prototypes=''
904 d_gdbmndbm_h_uses_prototypes=''
905 d_ndbm=''
906 d_ndbm_h_uses_prototypes=''
907 i_gdbm_ndbm=''
908 i_gdbmndbm=''
909 i_ndbm=''
910 i_netdb=''
911 i_neterrno=''
912 i_netinettcp=''
913 i_niin=''
914 i_sysin=''
915 i_poll=''
916 i_prot=''
917 i_pthread=''
918 d_pwage=''
919 d_pwchange=''
920 d_pwclass=''
921 d_pwcomment=''
922 d_pwexpire=''
923 d_pwgecos=''
924 d_pwpasswd=''
925 d_pwquota=''
926 i_pwd=''
927 i_sfio=''
928 i_shadow=''
929 i_socks=''
930 i_stddef=''
931 i_stdlib=''
932 i_string=''
933 strings=''
934 i_sunmath=''
935 i_sysaccess=''
936 i_sysdir=''
937 i_sysfile=''
938 d_voidtty=''
939 i_bsdioctl=''
940 i_sysfilio=''
941 i_sysioctl=''
942 i_syssockio=''
943 i_syslog=''
944 i_sysmman=''
945 i_sysmode=''
946 i_sysmount=''
947 i_sysndir=''
948 i_sysparam=''
949 i_syspoll=''
950 i_sysresrc=''
951 i_syssecrt=''
952 i_sysselct=''
953 i_sysstat=''
954 i_sysstatfs=''
955 i_sysstatvfs=''
956 i_systimes=''
957 i_systypes=''
958 i_sysuio=''
959 i_sysun=''
960 i_sysutsname=''
961 i_sysvfs=''
962 i_syswait=''
963 i_sgtty=''
964 i_termio=''
965 i_termios=''
966 d_tm_tm_gmtoff=''
967 d_tm_tm_zone=''
968 i_systime=''
969 i_systimek=''
970 i_time=''
971 timeincl=''
972 i_unistd=''
973 i_ustat=''
974 i_utime=''
975 i_values=''
976 i_stdarg=''
977 i_varargs=''
978 i_varhdr=''
979 i_vfork=''
980 d_inc_version_list=''
981 inc_version_list=''
982 inc_version_list_init=''
983 installprefix=''
984 installprefixexp=''
985 installstyle=''
986 installusrbinperl=''
987 intsize=''
988 longsize=''
989 shortsize=''
990 issymlink=''
991 libc=''
992 ldlibpthname=''
993 libperl=''
994 shrpenv=''
995 useshrplib=''
996 glibpth=''
997 libpth=''
998 loclibpth=''
999 plibpth=''
1000 xlibpth=''
1001 ignore_versioned_solibs=''
1002 libs=''
1003 libsdirs=''
1004 libsfiles=''
1005 libsfound=''
1006 libspath=''
1007 lns=''
1008 d_PRIEUldbl=''
1009 d_PRIFUldbl=''
1010 d_PRIGUldbl=''
1011 d_PRIeldbl=''
1012 d_PRIfldbl=''
1013 d_PRIgldbl=''
1014 d_SCNfldbl=''
1015 sPRIEUldbl=''
1016 sPRIFUldbl=''
1017 sPRIGUldbl=''
1018 sPRIeldbl=''
1019 sPRIfldbl=''
1020 sPRIgldbl=''
1021 sSCNfldbl=''
1022 lseeksize=''
1023 lseektype=''
1024 mad=''
1025 madlyh=''
1026 madlyobj=''
1027 madlysrc=''
1028 make_set_make=''
1029 d_mymalloc=''
1030 freetype=''
1031 mallocobj=''
1032 mallocsrc=''
1033 malloctype=''
1034 usemallocwrap=''
1035 usemymalloc=''
1036 installman1dir=''
1037 man1dir=''
1038 man1direxp=''
1039 man1ext=''
1040 installman3dir=''
1041 man3dir=''
1042 man3direxp=''
1043 man3ext=''
1044 modetype=''
1045 multiarch=''
1046 mydomain=''
1047 myhostname=''
1048 phostname=''
1049 c=''
1050 n=''
1051 d_eofnblk=''
1052 eagain=''
1053 o_nonblock=''
1054 rd_nodata=''
1055 need_va_copy=''
1056 netdb_hlen_type=''
1057 netdb_host_type=''
1058 netdb_name_type=''
1059 netdb_net_type=''
1060 groupcat=''
1061 hostcat=''
1062 passcat=''
1063 orderlib=''
1064 ranlib=''
1065 d_perl_otherlibdirs=''
1066 otherlibdirs=''
1067 package=''
1068 spackage=''
1069 pager=''
1070 api_revision=''
1071 api_subversion=''
1072 api_version=''
1073 api_versionstring=''
1074 patchlevel=''
1075 perl_patchlevel=''
1076 revision=''
1077 subversion=''
1078 version=''
1079 version_patchlevel_string=''
1080 perl5=''
1081 perladmin=''
1082 perlpath=''
1083 d_nv_preserves_uv=''
1084 d_nv_zero_is_allbits_zero=''
1085 i16size=''
1086 i16type=''
1087 i32size=''
1088 i32type=''
1089 i64size=''
1090 i64type=''
1091 i8size=''
1092 i8type=''
1093 ivsize=''
1094 ivtype=''
1095 nv_overflows_integers_at=''
1096 nv_preserves_uv_bits=''
1097 nvsize=''
1098 nvtype=''
1099 u16size=''
1100 u16type=''
1101 u32size=''
1102 u32type=''
1103 u64size=''
1104 u64type=''
1105 u8size=''
1106 u8type=''
1107 uvsize=''
1108 uvtype=''
1109 ivdformat=''
1110 nvEUformat=''
1111 nvFUformat=''
1112 nvGUformat=''
1113 nveformat=''
1114 nvfformat=''
1115 nvgformat=''
1116 uvXUformat=''
1117 uvoformat=''
1118 uvuformat=''
1119 uvxformat=''
1120 pidtype=''
1121 prefix=''
1122 prefixexp=''
1123 installprivlib=''
1124 privlib=''
1125 privlibexp=''
1126 prototype=''
1127 ptrsize=''
1128 d_PRIXU64=''
1129 d_PRId64=''
1130 d_PRIi64=''
1131 d_PRIo64=''
1132 d_PRIu64=''
1133 d_PRIx64=''
1134 sPRIXU64=''
1135 sPRId64=''
1136 sPRIi64=''
1137 sPRIo64=''
1138 sPRIu64=''
1139 sPRIx64=''
1140 d_quad=''
1141 quadkind=''
1142 quadtype=''
1143 uquadtype=''
1144 drand01=''
1145 randbits=''
1146 randfunc=''
1147 randseedtype=''
1148 seedfunc=''
1149 installscript=''
1150 scriptdir=''
1151 scriptdirexp=''
1152 selectminbits=''
1153 selecttype=''
1154 sh=''
1155 sig_count=''
1156 sig_name=''
1157 sig_name_init=''
1158 sig_num=''
1159 sig_num_init=''
1160 sig_size=''
1161 d_sitearch=''
1162 installsitearch=''
1163 sitearch=''
1164 sitearchexp=''
1165 installsitebin=''
1166 sitebin=''
1167 sitebinexp=''
1168 installsitehtml1dir=''
1169 sitehtml1dir=''
1170 sitehtml1direxp=''
1171 installsitehtml3dir=''
1172 sitehtml3dir=''
1173 sitehtml3direxp=''
1174 installsitelib=''
1175 sitelib=''
1176 sitelib_stem=''
1177 sitelibexp=''
1178 installsiteman1dir=''
1179 siteman1dir=''
1180 siteman1direxp=''
1181 installsiteman3dir=''
1182 siteman3dir=''
1183 siteman3direxp=''
1184 siteprefix=''
1185 siteprefixexp=''
1186 installsitescript=''
1187 sitescript=''
1188 sitescriptexp=''
1189 sizesize=''
1190 sizetype=''
1191 so=''
1192 socksizetype=''
1193 sharpbang=''
1194 shsharp=''
1195 spitshell=''
1196 src=''
1197 ssizetype=''
1198 startperl=''
1199 startsh=''
1200 stdchar=''
1201 d_stdio_stream_array=''
1202 stdio_stream_array=''
1203 sysman=''
1204 sGMTIME_max=''
1205 sGMTIME_min=''
1206 sLOCALTIME_max=''
1207 sLOCALTIME_min=''
1208 trnl=''
1209 uidformat=''
1210 uidsign=''
1211 uidsize=''
1212 uidtype=''
1213 archname64=''
1214 use64bitall=''
1215 use64bitint=''
1216 dtrace=''
1217 usedtrace=''
1218 usefaststdio=''
1219 ccflags_uselargefiles=''
1220 ldflags_uselargefiles=''
1221 libswanted_uselargefiles=''
1222 uselargefiles=''
1223 uselongdouble=''
1224 usemorebits=''
1225 usemultiplicity=''
1226 nm_opt=''
1227 nm_so_opt=''
1228 runnm=''
1229 usenm=''
1230 useperlio=''
1231 usesocks=''
1232 d_oldpthreads=''
1233 use5005threads=''
1234 useithreads=''
1235 usereentrant=''
1236 usethreads=''
1237 incpath=''
1238 mips_type=''
1239 usrinc=''
1240 vaproto=''
1241 d_vendorarch=''
1242 installvendorarch=''
1243 vendorarch=''
1244 vendorarchexp=''
1245 d_vendorbin=''
1246 installvendorbin=''
1247 vendorbin=''
1248 vendorbinexp=''
1249 installvendorhtml1dir=''
1250 vendorhtml1dir=''
1251 vendorhtml1direxp=''
1252 installvendorhtml3dir=''
1253 vendorhtml3dir=''
1254 vendorhtml3direxp=''
1255 d_vendorlib=''
1256 installvendorlib=''
1257 vendorlib=''
1258 vendorlib_stem=''
1259 vendorlibexp=''
1260 installvendorman1dir=''
1261 vendorman1dir=''
1262 vendorman1direxp=''
1263 installvendorman3dir=''
1264 vendorman3dir=''
1265 vendorman3direxp=''
1266 usevendorprefix=''
1267 vendorprefix=''
1268 vendorprefixexp=''
1269 d_vendorscript=''
1270 installvendorscript=''
1271 vendorscript=''
1272 vendorscriptexp=''
1273 versiononly=''
1274 defvoidused=''
1275 voidflags=''
1276 yacc=''
1277 yaccflags=''
1278 CONFIG=''
1279
1280 : Detect odd OSs
1281 define='define'
1282 undef='undef'
1283 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1284 rmlist=''
1285
1286 : We must find out about Eunice early
1287 eunicefix=':'
1288 if test -f /etc/unixtovms; then
1289         eunicefix=/etc/unixtovms
1290 fi
1291 if test -f /etc/unixtovms.exe; then
1292         eunicefix=/etc/unixtovms.exe
1293 fi
1294
1295 : Set executable suffix now -- needed before hints available
1296 if test -f "/libs/version.library"; then
1297 : Amiga OS
1298     _exe=""
1299 elif test -f "/system/gnu_library/bin/ar.pm"; then
1300 : Stratus VOS
1301     _exe=".pm"
1302 elif test -n "$DJGPP"; then
1303 : DOS DJGPP
1304     _exe=".exe"
1305 elif test -d c:/. -o -n "$is_os2" ; then
1306 : OS/2 or cygwin
1307     _exe=".exe"
1308 fi
1309
1310 groupstype=''
1311 i_whoami=''
1312 archname=''
1313 : Possible local include directories to search.
1314 : Set locincpth to "" in a hint file to defeat local include searches.
1315 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1316 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1317 :
1318 : no include file wanted by default
1319 inclwanted=''
1320
1321 : Enable -DEBUGGING and -DDEBUGGING from the command line
1322 EBUGGING=''
1323 DEBUGGING=old
1324
1325 : set usethreads on the Configure command line to enable threads.
1326 usereentrant='undef'
1327 : Trailing extension.  Override this in a hint file, if needed.
1328 : Extra object files, if any, needed on this platform.
1329 archobjs=''
1330 libnames=''
1331 : change the next line if compiling for Xenix/286 on Xenix/386
1332 xlibpth='/usr/lib/386 /lib/386'
1333 : Possible local library directories to search.
1334 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1335 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1336
1337 : general looking path for locating libraries
1338 glibpth="/lib /usr/lib $xlibpth"
1339 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1340 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1341 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1342 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1343
1344 : Private path used by Configure to find libraries.  Its value
1345 : is prepended to libpth. This variable takes care of special
1346 : machines, like the mips.  Usually, it should be empty.
1347 plibpth=''
1348
1349 : default library list
1350 libswanted=''
1351 : some systems want to use only the non-versioned libso:s
1352 ignore_versioned_solibs=''
1353 : full support for void wanted by default
1354 defvoidused=15
1355
1356 ccname=''
1357 ccversion=''
1358 perllibs=''
1359 : set useposix=false in your hint file to disable the POSIX extension.
1360 useposix=true
1361 : set useopcode=false in your hint file to disable the Opcode extension.
1362 useopcode=true
1363 archname64=''
1364 ccflags_uselargefiles=''
1365 ldflags_uselargefiles=''
1366 libswanted_uselargefiles=''
1367 : set usemultiplicity on the Configure command line to enable multiplicity.
1368 : set usesocks on the Configure command line to enable socks.
1369 : List of libraries we want.
1370 : If anyone needs extra -lxxx, put those in a hint file.
1371 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1372 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1373 : We probably want to search /usr/shlib before most other libraries.
1374 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1375 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1376 glibpth="/usr/shlib $glibpth"
1377 : Do not use vfork unless overridden by a hint file.
1378 usevfork=false
1379
1380 : Find the basic shell for Bourne shell scripts
1381 case "$sh" in
1382 '')
1383         case "$SYSTYPE" in
1384         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1385         *) xxx='/bin/sh';;
1386         esac
1387         if test -f "$xxx"; then
1388                 sh="$xxx"
1389         else
1390                 : Build up a list and do a single loop so we can 'break' out.
1391                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1392                 for xxx in sh bash ksh pdksh ash; do
1393                         for p in $pth; do
1394                                 try="$try ${p}/${xxx}"
1395                         done
1396                 done
1397                 for xxx in $try; do
1398                         if test -f "$xxx"; then
1399                                 sh="$xxx";
1400                                 break
1401                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1402                                 sh="$xxx";
1403                                 break
1404                         elif test -f "$xxx.exe"; then
1405                                 sh="$xxx";
1406                                 break
1407                         fi
1408                 done
1409         fi
1410         ;;
1411 esac
1412
1413 case "$sh" in
1414 '')     cat >&2 <<EOM
1415 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1416
1417 Usually it's in /bin/sh.  How did you even get this far?
1418 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1419 we'll try to straighten this all out.
1420 EOM
1421         exit 1
1422         ;;
1423 esac
1424
1425 : see if sh knows # comments
1426 if `$sh -c '#' >/dev/null 2>&1`; then
1427         shsharp=true
1428         spitshell=cat
1429         xcat=/bin/cat
1430         test -f $xcat$_exe || xcat=/usr/bin/cat
1431         if test ! -f $xcat$_exe; then
1432                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1433                         if test -f $p/cat$_exe; then
1434                                 xcat=$p/cat
1435                                 break
1436                         fi
1437                 done
1438                 if test ! -f $xcat$_exe; then
1439                         echo "Can't find cat anywhere!"
1440                         exit 1
1441                 fi
1442         fi
1443         echo "#!$xcat" >sharp
1444         $eunicefix sharp
1445         chmod +x sharp
1446         ./sharp > today 2>/dev/null
1447         if test -s today; then
1448                 sharpbang='#!'
1449         else
1450                 echo "#! $xcat" > sharp
1451                 $eunicefix sharp
1452                 chmod +x sharp
1453                 ./sharp > today 2>/dev/null
1454                 if test -s today; then
1455                         sharpbang='#! '
1456                 else
1457                         sharpbang=': use '
1458                 fi
1459         fi
1460 else
1461         echo " "
1462         echo "Your $sh doesn't grok # comments--I will strip them later on."
1463         shsharp=false
1464         cd ..
1465         echo "exec grep -v '^[  ]*#'" >spitshell
1466         chmod +x spitshell
1467         $eunicefix spitshell
1468         spitshell=`pwd`/spitshell
1469         cd UU
1470         echo "I presume that if # doesn't work, #! won't work either!"
1471         sharpbang=': use '
1472 fi
1473 rm -f sharp today
1474
1475 : figure out how to guarantee sh startup
1476 case "$startsh" in
1477 '') startsh=${sharpbang}${sh} ;;
1478 *)
1479 esac
1480 cat >sharp <<EOSS
1481 $startsh
1482 set abc
1483 test "$?abc" != 1
1484 EOSS
1485
1486 chmod +x sharp
1487 $eunicefix sharp
1488 if ./sharp; then
1489         : echo "Yup, it does."
1490 else
1491         echo "Hmm... '$startsh' does not guarantee sh startup..."
1492         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1493 fi
1494 rm -f sharp
1495
1496 : Save command line options in file UU/cmdline.opt for later use in
1497 : generating config.sh.
1498 cat > cmdline.opt <<EOSH
1499 : Configure command line arguments.
1500 config_arg0='$0'
1501 config_args='$*'
1502 config_argc=$#
1503 EOSH
1504 argn=1
1505 args_exp=''
1506 args_sep=''
1507 for arg in "$@"; do
1508         cat >>cmdline.opt <<EOSH
1509 config_arg$argn='$arg'
1510 EOSH
1511         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1512 $arg
1513 EOC
1514         arg_exp=`cat cmdl.opt`
1515         args_exp="$args_exp$args_sep'$arg_exp'"
1516         argn=`expr $argn + 1`
1517         args_sep=' '
1518 done
1519 rm -f cmdl.opt
1520
1521 : produce awk script to parse command line options
1522 cat >options.awk <<'EOF'
1523 BEGIN {
1524         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1525
1526         len = length(optstr);
1527         for (i = 1; i <= len; i++) {
1528                 c = substr(optstr, i, 1);
1529                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1530                 if (a == ":") {
1531                         arg[c] = 1;
1532                         i++;
1533                 }
1534                 opt[c] = 1;
1535         }
1536 }
1537 {
1538         expect = 0;
1539         str = $0;
1540         if (substr(str, 1, 1) != "-") {
1541                 printf("'%s'\n", str);
1542                 next;
1543         }
1544         len = length($0);
1545         for (i = 2; i <= len; i++) {
1546                 c = substr(str, i, 1);
1547                 if (!opt[c]) {
1548                         printf("-%s\n", substr(str, i));
1549                         next;
1550                 }
1551                 printf("-%s\n", c);
1552                 if (arg[c]) {
1553                         if (i < len)
1554                                 printf("'%s'\n", substr(str, i + 1));
1555                         else
1556                                 expect = 1;
1557                         next;
1558                 }
1559         }
1560 }
1561 END {
1562         if (expect)
1563                 print "?";
1564 }
1565 EOF
1566
1567 : process the command line options
1568 set X `for arg in "$@"; do echo "X$arg"; done |
1569         sed -e s/X// | awk -f options.awk`
1570 eval "set $*"
1571 shift
1572 rm -f options.awk
1573
1574 : set up default values
1575 fastread=''
1576 reuseval=false
1577 config_sh=''
1578 alldone=''
1579 error=''
1580 silent=''
1581 extractsh=''
1582 override=''
1583 knowitall=''
1584 rm -f optdef.sh posthint.sh
1585 cat >optdef.sh <<EOS
1586 $startsh
1587 EOS
1588
1589
1590 : option parsing
1591 while test $# -gt 0; do
1592         case "$1" in
1593         -d) shift; fastread=yes;;
1594         -e) shift; alldone=cont;;
1595         -f)
1596                 shift
1597                 cd ..
1598                 if test -r "$1"; then
1599                         config_sh="$1"
1600                 else
1601                         echo "$me: cannot read config file $1." >&2
1602                         error=true
1603                 fi
1604                 cd UU
1605                 shift;;
1606         --help|\
1607         -h) shift; error=true;;
1608         -r) shift; reuseval=true;;
1609         -s) shift; silent=true; realsilent=true;;
1610         -E) shift; alldone=exit;;
1611         -K) shift; knowitall=true;;
1612         -O) shift; override=true;;
1613         -S) shift; silent=true; extractsh=true;;
1614         -D)
1615                 shift
1616                 case "$1" in
1617                 *=)
1618                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1619                         echo "$me: ignoring -D $1" >&2
1620                         ;;
1621                 *=*) echo "$1" | \
1622                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1623                 *) echo "$1='define'" >> optdef.sh;;
1624                 esac
1625                 shift
1626                 ;;
1627         -U)
1628                 shift
1629                 case "$1" in
1630                 *=) echo "$1" >> optdef.sh;;
1631                 *=*)
1632                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1633                         echo "$me: ignoring -U $1" >&2
1634                         ;;
1635                 *) echo "$1='undef'" >> optdef.sh;;
1636                 esac
1637                 shift
1638                 ;;
1639         -A)
1640             shift
1641             xxx=''
1642             yyy="$1"
1643             zzz=''
1644             uuu=undef
1645             case "$yyy" in
1646             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1647                  case "$zzz" in
1648                  *:*) zzz='' ;;
1649                  *)   xxx=append
1650                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1651                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1652                  esac
1653                  ;;
1654             esac
1655             case "$xxx" in
1656             '')  case "$yyy" in
1657                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1658                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1659                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1660                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1661                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1662                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1663                  esac
1664                  ;;
1665             esac
1666             case "$xxx" in
1667             append)
1668                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1669             clear)
1670                 echo "$yyy=''"                  >> posthint.sh ;;
1671             define)
1672                 case "$zzz" in
1673                 '') zzz=define ;;
1674                 esac
1675                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1676             eval)
1677                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1678             prepend)
1679                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1680             undef)
1681                 case "$zzz" in
1682                 '') zzz="$uuu" ;;
1683                 esac
1684                 echo "$yyy=$zzz"                >> posthint.sh ;;
1685             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1686             esac
1687             shift
1688             ;;
1689         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1690             exit 0;;
1691         --) break;;
1692         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1693         *) break;;
1694         esac
1695 done
1696
1697 case "$error" in
1698 true)
1699         cat >&2 <<EOM
1700 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1701                  [-U symbol] [-U symbol=] [-A command:symbol...]
1702   -d : use defaults for all answers.
1703   -e : go on without questioning past the production of config.sh.
1704   -f : specify an alternate default configuration file.
1705   -h : print this help message and exit (with an error status).
1706   -r : reuse C symbols value if possible (skips costly nm extraction).
1707   -s : silent mode, only echoes questions and essential information.
1708   -D : define symbol to have some value:
1709          -D symbol         symbol gets the value 'define'
1710          -D symbol=value   symbol gets the value 'value'
1711        common used examples (see INSTALL for more info):
1712          -Duse64bitint            use 64bit integers
1713          -Duse64bitall            use 64bit integers and pointers
1714          -Dusethreads             use thread support
1715          -Dinc_version_list=none  do not include older perl trees in @INC
1716          -DEBUGGING=none          DEBUGGING options
1717          -Dcc=gcc                 choose your compiler
1718          -Dprefix=/opt/perl5      choose your destination
1719   -E : stop at the end of questions, after having produced config.sh.
1720   -K : do not use unless you know what you are doing.
1721   -O : let -D and -U override definitions from loaded configuration file.
1722   -S : perform variable substitutions on all .SH files (can mix with -f)
1723   -U : undefine symbol:
1724          -U symbol    symbol gets the value 'undef'
1725          -U symbol=   symbol gets completely empty
1726        e.g.:  -Uversiononly
1727   -A : manipulate symbol after the platform specific hints have been applied:
1728          -A append:symbol=value   append value to symbol
1729          -A symbol=value          like append:, but with a separating space
1730          -A define:symbol=value   define symbol to have value
1731          -A clear:symbol          define symbol to be ''
1732          -A define:symbol         define symbol to be 'define'
1733          -A eval:symbol=value     define symbol to be eval of value
1734          -A prepend:symbol=value  prepend value to symbol
1735          -A undef:symbol          define symbol to be 'undef'
1736          -A undef:symbol=         define symbol to be ''
1737        e.g.:  -A prepend:libswanted='cl pthread '
1738               -A ccflags=-DSOME_MACRO
1739   -V : print version number and exit (with a zero status).
1740 EOM
1741         exit 1
1742         ;;
1743 esac
1744
1745 : Sanity checks
1746 case "$fastread$alldone" in
1747 yescont|yesexit) ;;
1748 *)
1749         case "$extractsh" in
1750         true) ;;
1751         *)
1752                 if test ! -t 0; then
1753                         echo "Say 'sh Configure', not 'sh <Configure'"
1754                         exit 1
1755                 fi
1756                 ;;
1757         esac
1758         ;;
1759 esac
1760
1761 exec 4>&1
1762 case "$silent" in
1763 true) exec 1>/dev/null;;
1764 esac
1765
1766 : run the defines and the undefines, if any, but leave the file out there...
1767 touch optdef.sh
1768 . ./optdef.sh
1769 : create the posthint manipulation script and leave the file out there...
1770 touch posthint.sh
1771
1772 : set package name
1773 package='perl5'
1774 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1775 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1776 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1777 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1778 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1779 esac
1780
1781 : Some greps do not return status, grrr.
1782 echo "grimblepritz" >grimble
1783 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1784         contains=contains
1785 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1786         contains=grep
1787 else
1788         contains=contains
1789 fi
1790 rm -f grimble
1791 : the following should work in any shell
1792 case "$contains" in
1793 contains*)
1794         echo " "
1795         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1796         cat >contains <<'EOSS'
1797 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1798 EOSS
1799 chmod +x contains
1800 esac
1801
1802 : Find the path to the source tree
1803 case "$src" in
1804 '') case "$0" in
1805     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1806          case "$src" in
1807          /*)    ;;
1808          .)     ;;
1809          *)     src=`cd ../$src && pwd` ;;
1810          esac
1811          ;;
1812     *)   src='.';;
1813     esac;;
1814 esac
1815 case "$src" in
1816 '')     src=/
1817         rsrc=/
1818         ;;
1819 /*)     rsrc="$src";;
1820 *)      rsrc="../$src";;
1821 esac
1822 if test -f $rsrc/Configure && \
1823         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1824 then
1825    : found it, so we are ok.
1826 else
1827         rsrc=''
1828         for src in . .. ../.. ../../.. ../../../..; do
1829                 if test -f ../$src/Configure && \
1830                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1831                 then
1832                         rsrc=../$src
1833                         break
1834                 fi
1835         done
1836 fi
1837 case "$rsrc" in
1838 '')
1839         cat <<EOM >&4
1840
1841 Sorry, I can't seem to locate the source dir for $package.  Please start
1842 Configure with an explicit path -- i.e. /some/path/Configure.
1843
1844 EOM
1845         exit 1
1846         ;;
1847 ../.)   rsrc='..';;
1848 *)
1849         echo " "
1850         echo "Sources for $package found in \"$src\"." >&4
1851         ;;
1852 esac
1853
1854 : script used to extract .SH files with variable substitutions
1855 cat >extract <<'EOS'
1856 PERL_CONFIG_SH=true
1857 echo "Doing variable substitutions on .SH files..."
1858 if test -f MANIFEST; then
1859         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1860 else
1861         echo "(Looking for .SH files under the source directory.)"
1862         set x `(cd "$src"; find . -name "*.SH" -print)`
1863 fi
1864 shift
1865 case $# in
1866 0) set x `(cd "$src"; echo *.SH)`; shift;;
1867 esac
1868 if test ! -f "$src/$1"; then
1869         shift
1870 fi
1871 mkdir_p='
1872 name=$1;
1873 create="";
1874 while test $name; do
1875         if test ! -d "$name"; then
1876                 create="$name $create";
1877                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1878                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1879         else
1880                 name="";
1881         fi;
1882 done;
1883 for file in $create; do
1884         mkdir $file;
1885 done
1886 '
1887 for file in $*; do
1888         case "$src" in
1889         ".")
1890                 case "$file" in
1891                 */*)
1892                         dir=`expr X$file : 'X\(.*\)/'`
1893                         file=`expr X$file : 'X.*/\(.*\)'`
1894                         (cd "$dir" && . ./$file)
1895                         ;;
1896                 *)
1897                         . ./$file
1898                         ;;
1899                 esac
1900                 ;;
1901         *)
1902                 case "$file" in
1903                 */*)
1904                         dir=`expr X$file : 'X\(.*\)/'`
1905                         file=`expr X$file : 'X.*/\(.*\)'`
1906                         (set x $dir; shift; eval $mkdir_p)
1907                         sh <"$src/$dir/$file"
1908                         ;;
1909                 *)
1910                         sh <"$src/$file"
1911                         ;;
1912                 esac
1913                 ;;
1914         esac
1915 done
1916 if test -f "$src/config_h.SH"; then
1917         if test ! -f config.h; then
1918         : oops, they left it out of MANIFEST, probably, so do it anyway.
1919         . "$src/config_h.SH"
1920         fi
1921 fi
1922 EOS
1923
1924 : extract files and exit if asked to do so
1925 case "$extractsh" in
1926 true)
1927         case "$realsilent" in
1928         true) ;;
1929         *) exec 1>&4;;
1930         esac
1931         case "$config_sh" in
1932         '') config_sh='config.sh';;
1933         esac
1934         echo " "
1935         echo "Fetching answers from $config_sh..."
1936         cd ..
1937         . $config_sh
1938         test "$override" && . ./optdef.sh
1939         echo " "
1940         . UU/extract
1941         rm -rf UU
1942         echo "Extraction done."
1943         exit 0
1944         ;;
1945 esac
1946
1947 : Eunice requires " " instead of "", can you believe it
1948 echo " "
1949 : Here we go...
1950 echo "Beginning of configuration questions for $package."
1951
1952 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1953
1954 : first determine how to suppress newline on echo command
1955 echo " "
1956 echo "Checking echo to see how to suppress newlines..."
1957 (echo "hi there\c" ; echo " ") >.echotmp
1958 if $contains c .echotmp >/dev/null 2>&1 ; then
1959         echo "...using -n."
1960         n='-n'
1961         c=''
1962 else
1963         cat <<'EOM'
1964 ...using \c
1965 EOM
1966         n=''
1967         c='\c'
1968 fi
1969 echo $n "The star should be here-->$c"
1970 echo '*'
1971 rm -f .echotmp
1972
1973 : Now test for existence of everything in MANIFEST
1974 echo " "
1975 if test -f "$rsrc/MANIFEST"; then
1976         echo "First let's make sure your kit is complete.  Checking..." >&4
1977         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1978                 (split -l 50 2>/dev/null || split -50)
1979         rm -f missing
1980         tmppwd=`pwd`
1981         for filelist in x??; do
1982                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1983                         >/dev/null 2>>"$tmppwd/missing")
1984         done
1985         if test -s missing; then
1986                 cat missing >&4
1987                 cat >&4 <<'EOM'
1988
1989 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1990
1991 You have the option of continuing the configuration process, despite the
1992 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1993 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1994 and contact the author (perlbug@perl.org).
1995
1996 EOM
1997                 echo $n "Continue? [n] $c" >&4
1998                 read ans
1999                 case "$ans" in
2000                 y*)
2001                         echo "Continuing..." >&4
2002                         rm -f missing
2003                         ;;
2004                 *)
2005                         echo "ABORTING..." >&4
2006                         kill $$
2007                         ;;
2008                 esac
2009         else
2010                 echo "Looks good..."
2011         fi
2012 else
2013         echo "There is no MANIFEST file.  I hope your kit is complete !"
2014 fi
2015 rm -f missing x??
2016
2017 : Find the appropriate value for a newline for tr
2018 echo " "
2019 if test -n "$DJGPP"; then
2020        trnl='\012'
2021 fi
2022 if test X"$trnl" = X; then
2023         case "`echo foo|tr '\n' x 2>/dev/null`" in
2024         foox) trnl='\n' ;;
2025         esac
2026 fi
2027 if test X"$trnl" = X; then
2028         case "`echo foo|tr '\012' x 2>/dev/null`" in
2029         foox) trnl='\012' ;;
2030         esac
2031 fi
2032 if test X"$trnl" = X; then
2033        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2034        fooxy) trnl='\n\r' ;;
2035        esac
2036 fi
2037 if test X"$trnl" = X; then
2038         cat <<EOM >&2
2039
2040 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2041
2042 EOM
2043         exit 1
2044 fi
2045
2046 : compute the number of columns on the terminal for proper question formatting
2047 case "$COLUMNS" in
2048 '') COLUMNS='80';;
2049 esac
2050
2051 : set up the echo used in my read
2052 myecho="case \"\$xxxm\" in
2053 '') echo $n \"\$rp $c\" >&4;;
2054 *) case \"\$rp\" in
2055         '') echo $n \"[\$xxxm] $c\";;
2056         *)
2057                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2058                         echo \"\$rp\" >&4
2059                         echo $n \"[\$xxxm] $c\" >&4
2060                 else
2061                         echo $n \"\$rp [\$xxxm] $c\" >&4
2062                 fi
2063                 ;;
2064         esac;;
2065 esac"
2066
2067 : now set up to do reads with possible shell escape and default assignment
2068 cat <<EOSC >myread
2069 $startsh
2070 xxxm=\$dflt
2071 $myecho
2072 ans='!'
2073 case "\$fastread" in
2074 yes) case "\$dflt" in
2075         '') ;;
2076         *) ans='';
2077                 case "\$silent-\$rp" in
2078                 true-) ;;
2079                 *) echo " " >&4;;
2080                 esac;;
2081         esac;;
2082 *) case "\$silent" in
2083         true) case "\$rp" in
2084                 '') ans='';;
2085                 esac;;
2086         esac;;
2087 esac
2088 while expr "X\$ans" : "X!" >/dev/null; do
2089         read answ
2090         set x \$xxxm
2091         shift
2092         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2093         case  "\$answ" in
2094         "!")
2095                 sh 1>&4
2096                 echo " "
2097                 $myecho
2098                 ;;
2099         !*)
2100                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2101                 shift
2102                 sh 1>&4 -c "\$*"
2103                 echo " "
2104                 $myecho
2105                 ;;
2106         "\$ans")
2107                 case "\$ans" in
2108                 \\&*)
2109                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2110                         shift
2111                         case "\$1" in
2112                         -d)
2113                                 fastread=yes
2114                                 echo "(OK, I'll run with -d after this question.)" >&4
2115                                 ;;
2116                         -*)
2117                                 echo "*** Sorry, \$1 not supported yet." >&4
2118                                 ;;
2119                         esac
2120                         $myecho
2121                         ans=!
2122                         ;;
2123                 esac;;
2124         *)
2125                 case "\$aok" in
2126                 y)
2127                         echo "*** Substitution done -- please confirm."
2128                         xxxm="\$ans"
2129                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2130                         xxxm="\$ans"
2131                         ans=!
2132                         ;;
2133                 *)
2134                         echo "*** Error -- try again."
2135                         ans=!
2136                         ;;
2137                 esac
2138                 $myecho
2139                 ;;
2140         esac
2141         case "\$ans\$xxxm\$nostick" in
2142         '')
2143                 ans=!
2144                 $myecho
2145                 ;;
2146         esac
2147 done
2148 case "\$ans" in
2149 '') ans="\$xxxm";;
2150 esac
2151 EOSC
2152
2153 : create .config dir to save info across Configure sessions
2154 test -d ../.config || mkdir ../.config
2155 cat >../.config/README <<EOF
2156 This directory created by Configure to save information that should
2157 persist across sessions for $package.
2158
2159 You may safely delete it if you wish.
2160 EOF
2161
2162 : See if we are using a devel version and want that
2163 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2164 case "$usedevel" in
2165 $define|true|[yY]*)
2166     usedevel="$define" ;;
2167 *) case "$xversion" in
2168    *[13579])
2169         cat >&4 <<EOH
2170 *** WHOA THERE!!! ***
2171
2172     This is an UNSTABLE DEVELOPMENT release.
2173     The version of this $package distribution is $xversion, that is, odd,
2174     (as opposed to even) and that signifies a development release.
2175     If you want a maintenance release, you want an even-numbered version.
2176
2177     Do ***NOT*** install this into production use.
2178     Data corruption and crashes are possible.
2179
2180     It is most seriously suggested that you do not continue any further
2181     unless you want to help in developing and debugging Perl.
2182
2183     If you *still* want to build perl, you can answer 'y' now,
2184     or pass -Dusedevel to Configure.
2185
2186 EOH
2187         rp='Do you really want to continue?'
2188         dflt='n'
2189         . ./myread
2190         case "$ans" in
2191         [yY]) echo >&4 "Okay, continuing."
2192               usedevel="$define" ;;
2193         *) echo >&4 "Okay, bye."
2194            exit 1
2195            ;;
2196         esac
2197         ;;
2198     esac
2199     usedevel="$undef"
2200     ;;
2201 esac
2202 case "$usedevel" in
2203 $define|true|[yY]*)
2204         case "$versiononly" in
2205         '') versiononly="$define" ;;
2206         esac
2207         case "$installusrbinperl" in
2208         '') installusrbinperl="$undef" ;;
2209         esac
2210         ;;
2211 esac
2212
2213 : general instructions
2214 needman=true
2215 firsttime=true
2216 user=`(logname) 2>/dev/null`
2217 case "$user" in
2218 '') user=`whoami 2>&1`;;
2219 esac
2220 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2221         firsttime=false
2222         echo " "
2223         rp='Would you like to see the instructions?'
2224         dflt=n
2225         . ./myread
2226         case "$ans" in
2227         [yY]*) ;;
2228         *) needman=false;;
2229         esac
2230 fi
2231 if $needman; then
2232         cat <<EOH
2233
2234 This installation shell script will examine your system and ask you questions
2235 to determine how the perl5 package should be installed. If you get
2236 stuck on a question, you may use a ! shell escape to start a subshell or
2237 execute a command.  Many of the questions will have default answers in square
2238 brackets; typing carriage return will give you the default.
2239
2240 On some of the questions which ask for file or directory names you are allowed
2241 to use the ~name construct to specify the login directory belonging to "name",
2242 even if you don't have a shell which knows about that.  Questions where this is
2243 allowed will be marked "(~name ok)".
2244
2245 EOH
2246         rp=''
2247         dflt='Type carriage return to continue'
2248         . ./myread
2249         cat <<'EOH'
2250
2251 The prompter used in this script allows you to use shell variables and
2252 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2253 in the default answer, as if the default line was a set of arguments given to a
2254 script shell.  This means you may also use $* to repeat the whole default line,
2255 so you do not have to re-type everything to add something to the default.
2256
2257 Everytime there is a substitution, you will have to confirm.  If there is an
2258 error (e.g. an unmatched backtick), the default answer will remain unchanged
2259 and you will be prompted again.
2260
2261 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2262 the questions and use the computed defaults (or the previous answers if there
2263 was already a config.sh file). Type 'Configure -h' for a list of options.
2264 You may also start interactively and then answer '& -d' at any prompt to turn
2265 on the non-interactive behaviour for the remainder of the execution.
2266
2267 EOH
2268         . ./myread
2269         cat <<EOH
2270
2271 Much effort has been expended to ensure that this shell script will run on any
2272 Unix system.  If despite that it blows up on yours, your best bet is to edit
2273 Configure and run it again.  If you can't run Configure for some reason,
2274 you'll have to generate a config.sh file by hand.  Whatever problems you
2275 have, let me (perlbug@perl.org) know how I blew it.
2276
2277 This installation script affects things in two ways:
2278
2279 1) it may do direct variable substitutions on some of the files included
2280    in this kit.
2281 2) it builds a config.h file for inclusion in C programs.  You may edit
2282    any of these files as the need arises after running this script.
2283
2284 If you make a mistake on a question, there is no easy way to back up to it
2285 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2286 files.  Configure will offer to let you do this before it runs the SH files.
2287
2288 EOH
2289         dflt='Type carriage return to continue'
2290         . ./myread
2291         case "$firsttime" in
2292         true) echo $user >>../.config/instruct;;
2293         esac
2294 fi
2295
2296 : find out where common programs are
2297 echo " "
2298 echo "Locating common programs..." >&4
2299 cat <<EOSC >loc
2300 $startsh
2301 case \$# in
2302 0) exit 1;;
2303 esac
2304 thing=\$1
2305 shift
2306 dflt=\$1
2307 shift
2308 for dir in \$*; do
2309         case "\$thing" in
2310         .)
2311         if test -d \$dir/\$thing; then
2312                 echo \$dir
2313                 exit 0
2314         fi
2315         ;;
2316         *)
2317         for thisthing in \$dir/\$thing; do
2318                 : just loop through to pick last item
2319         done
2320         if test -f \$thisthing; then
2321                 echo \$thisthing
2322                 exit 0
2323         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2324                 echo \$thisthing
2325                 exit 0
2326         elif test -f \$dir/\$thing.exe; then
2327                 if test -n "$DJGPP"; then
2328                         echo \$dir/\$thing.exe
2329                 elif test "$eunicefix" != ":"; then
2330                         : on Eunice apparently
2331                         echo \$dir/\$thing
2332                 fi
2333                 exit 0
2334         fi
2335         ;;
2336         esac
2337 done
2338 echo \$dflt
2339 exit 1
2340 EOSC
2341 chmod +x loc
2342 $eunicefix loc
2343 loclist="
2344 awk
2345 cat
2346 chmod
2347 comm
2348 cp
2349 echo
2350 expr
2351 grep
2352 ls
2353 mkdir
2354 rm
2355 sed
2356 sort
2357 touch
2358 tr
2359 uniq
2360 "
2361 trylist="
2362 ar
2363 bison
2364 byacc
2365 cpp
2366 csh
2367 date
2368 egrep
2369 gmake
2370 gzip
2371 less
2372 ln
2373 make
2374 more
2375 nm
2376 nroff
2377 perl
2378 pg
2379 test
2380 uname
2381 zip
2382 "
2383 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2384 pth="$pth /lib /usr/lib"
2385 for file in $loclist; do
2386         eval xxx=\$$file
2387         case "$xxx" in
2388         /*|?:[\\/]*)
2389                 if test -f "$xxx"; then
2390                         : ok
2391                 else
2392                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2393                         xxx=`./loc $file $file $pth`
2394                 fi
2395                 ;;
2396         '') xxx=`./loc $file $file $pth`;;
2397         *) xxx=`./loc $xxx $xxx $pth`;;
2398         esac
2399         eval $file=$xxx$_exe
2400         eval _$file=$xxx
2401         case "$xxx" in
2402         /*)
2403                 echo $file is in $xxx.
2404                 ;;
2405         ?:[\\/]*)
2406                 echo $file is in $xxx.
2407                 ;;
2408         *)
2409                 echo "I don't know where '$file' is, and my life depends on it." >&4
2410                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2411                 exit 1
2412                 ;;
2413         esac
2414 done
2415 echo " "
2416 echo "Don't worry if any of the following aren't found..."
2417 say=offhand
2418 for file in $trylist; do
2419         eval xxx=\$$file
2420         case "$xxx" in
2421         /*|?:[\\/]*)
2422                 if test -f "$xxx"; then
2423                         : ok
2424                 else
2425                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2426                         xxx=`./loc $file $file $pth`
2427                 fi
2428                 ;;
2429         '') xxx=`./loc $file $file $pth`;;
2430         *) xxx=`./loc $xxx $xxx $pth`;;
2431         esac
2432         eval $file=$xxx$_exe
2433         eval _$file=$xxx
2434         case "$xxx" in
2435         /*)
2436                 echo $file is in $xxx.
2437                 ;;
2438         ?:[\\/]*)
2439                 echo $file is in $xxx.
2440                 ;;
2441         *)
2442                 echo "I don't see $file out there, $say."
2443                 say=either
2444                 ;;
2445         esac
2446 done
2447 case "$egrep" in
2448 egrep)
2449         echo "Substituting grep for egrep."
2450         egrep=$grep
2451         _egrep=$grep
2452         ;;
2453 esac
2454 case "$less" in
2455 '')     ;;
2456 *)      if $less -R </dev/null >/dev/null; then
2457                echo "Substituting less -R for less."
2458                less="$less -R"
2459                _less=$less
2460         fi
2461         ;;
2462 esac
2463 case "$ln" in
2464 ln)
2465         echo "Substituting cp for ln."
2466         ln=$cp
2467         _ln=$cp
2468         ;;
2469 esac
2470 case "$make" in
2471 make)
2472         case "$gmake" in
2473         gmake)
2474         echo "I can't find make or gmake, and my life depends on it." >&4
2475         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2476         exit 1
2477         ;;
2478         esac
2479         ;;
2480 esac
2481 case "$gmake" in
2482 gmake)  ;;
2483 *)      # We can't have osname yet.
2484         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2485                 # Assume that gmake, if found, is definitely GNU make
2486                 # and prefer it over the system make.
2487                 echo "Substituting gmake for make."
2488                 make=$gmake
2489                 _make=$gmake
2490         fi
2491         ;;
2492 esac
2493 case "$test" in
2494 test)
2495         echo "Hopefully test is built into your sh."
2496         ;;
2497 *)
2498         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2499                 echo "Using the test built into your sh."
2500                 test=test
2501                 _test=test
2502         fi
2503         ;;
2504 esac
2505 case "$echo" in
2506 echo)
2507         echo "Hopefully echo is built into your sh."
2508         ;;
2509 '') ;;
2510 *)
2511         echo " "
2512 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2513         $echo $n "hi there$c" >foo1
2514         echo $n "hi there$c" >foo2
2515         if cmp foo1 foo2 >/dev/null 2>&1; then
2516                 echo "They are compatible.  In fact, they may be identical."
2517         else
2518                 case "$n" in
2519                 '-n') n='' c='\c';;
2520                 *) n='-n' c='';;
2521                 esac
2522                 cat <<FOO
2523 They are not compatible!  You are probably running ksh on a non-USG system.
2524 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2525 have echo built in and we may have to run some Bourne shell scripts.  That
2526 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2527
2528 FOO
2529                 $echo $n "The star should be here-->$c"
2530                 $echo "*"
2531         fi
2532         $rm -f foo1 foo2
2533         ;;
2534 esac
2535
2536 # This question was auctioned at YAPC::Europe-2007 in Vienna
2537 # I never promised you could answer it. I only auctioned the question.
2538 cat <<FOO
2539 The following message is sponsored by
2540
2541   Dresden.pm<--The stars should be here.
2542
2543 Dear Perl user, system administrator or package
2544 maintainer, the Perl community sends greetings to
2545 you. Do you (emblematical) greet back [Y/n]? n
2546
2547 FOO
2548
2549 : Check what type of C compiler we use
2550 cat <<EOS >trygcc
2551 $startsh
2552 EOS
2553 cat <<'EOSC' >>trygcc
2554 case "$cc" in
2555 '') ;;
2556 *)  $rm -f try try.*
2557     $cat >try.c <<EOM
2558 int main(int argc, char *argv[]) {
2559   return 0;
2560 }
2561 EOM
2562     if $cc -o try $ccflags $ldflags try.c; then
2563        :
2564     else
2565         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2566         despair=yes
2567         trygcc=yes
2568         case "$cc" in
2569         *gcc*) trygcc=no ;;
2570         esac
2571         # Skip this test because it gives a false match on output like:
2572         #    ./trygcc: line 23: cc: command not found
2573         # case "`$cc -v -c try.c 2>&1`" in
2574         # *gcc*) trygcc=no ;;
2575         # esac
2576         if $test X"$trygcc" = Xyes; then
2577             if gcc -o try -c try.c; then
2578                 echo " "
2579                 echo "You seem to have a working gcc, though." >&4
2580                 # Switching compilers may undo the work of hints files.
2581                 # The most common problem is -D_REENTRANT for threads.
2582                 # This heuristic catches that case, but gets false positives
2583                 # if -Dusethreads was not actually specified.  Better to
2584                 # bail out here with a useful message than fail 
2585                 # mysteriously later. Should we perhaps just try to
2586                 # re-invoke Configure -Dcc=gcc config_args ?
2587                 if $test -f usethreads.cbu; then
2588                         $cat >&4 <<EOM 
2589
2590 *** However, any setting of the C compiler flags (e.g. for thread support)
2591 *** will be lost.  It may be necessary for you to restart Configure and
2592 *** add -Dcc=gcc to your Configure command line.
2593
2594 EOM
2595                         rp="Would you like to go ahead and try gcc anyway?"
2596                         dflt=n
2597                 else
2598                         rp="Would you like to use it?"
2599                         dflt=y
2600                 fi
2601                 if $test -f myread; then
2602                     . ./myread
2603                 else
2604                     if $test -f UU/myread; then
2605                         . ./UU/myread
2606                     else
2607                         echo "Cannot find myread, sorry.  Aborting." >&2
2608                         exit 1
2609                     fi
2610                 fi  
2611                 case "$ans" in
2612                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2613                 esac
2614             fi
2615         fi
2616     fi
2617     $rm -f try try.*
2618     ;;
2619 esac
2620 EOSC
2621
2622 cat <<EOS >checkcc
2623 $startsh
2624 EOS
2625 cat <<'EOSC' >>checkcc
2626 case "$cc" in        
2627 '') ;;
2628 *)  $rm -f try try.*              
2629     $cat >try.c <<EOM
2630 int main(int argc, char *argv[]) {
2631   return 0;
2632 }
2633 EOM
2634     if $cc -o try $ccflags $ldflags try.c; then
2635        :
2636     else
2637         if $test X"$despair" = Xyes; then
2638            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2639         fi
2640         $cat >&4 <<EOM         
2641 You need to find a working C compiler.
2642 Either (purchase and) install the C compiler supplied by your OS vendor,
2643 or for a free C compiler try http://gcc.gnu.org/
2644 I cannot continue any further, aborting.
2645 EOM
2646         exit 1
2647     fi
2648     $rm -f try try.*
2649     ;;
2650 esac
2651 EOSC
2652
2653 : determine whether symbolic links are supported
2654 echo " "
2655 $touch blurfl
2656 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2657         echo "Symbolic links are supported." >&4
2658         lns="$ln -s"
2659 else
2660         echo "Symbolic links are NOT supported." >&4
2661         lns="$ln"
2662 fi
2663 $rm -f blurfl sym
2664
2665 : determine whether symbolic links are supported
2666 echo " "
2667 case "$lns" in
2668 *"ln"*" -s")
2669         echo "Checking how to test for symbolic links..." >&4
2670         $lns blurfl sym
2671         if $test "X$issymlink" = X; then
2672                 case "$newsh" in
2673                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2674                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2675                 esac
2676                 if test $? = 0; then
2677                         issymlink="test -h"
2678                 else
2679                         echo "Your builtin 'test -h' may be broken." >&4
2680                         case "$test" in
2681                         /*)     ;;
2682                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2683                                 for p in $pth
2684                                 do
2685                                         if test -f "$p/$test"; then
2686                                                 test="$p/$test"
2687                                                 break
2688                                         fi
2689                                 done
2690                                 ;;
2691                         esac
2692                         case "$test" in
2693                         /*)
2694                                 echo "Trying external '$test -h'." >&4
2695                                 issymlink="$test -h"
2696                                 if $test ! -h sym >/dev/null 2>&1; then
2697                                         echo "External '$test -h' is broken, too." >&4
2698                                         issymlink=''
2699                                 fi
2700                                 ;;
2701                         *)      issymlink='' ;;
2702                         esac
2703                 fi              
2704         fi
2705         if $test "X$issymlink" = X; then
2706                 if $test -L sym 2>/dev/null; then
2707                         issymlink="$test -L"
2708                         echo "The builtin '$test -L' worked." >&4
2709                 fi
2710         fi
2711         if $test "X$issymlink" != X; then
2712                 echo "You can test for symbolic links with '$issymlink'." >&4
2713         else
2714                 echo "I do not know how you can test for symbolic links." >&4
2715         fi
2716         $rm -f blurfl sym
2717         ;;
2718 *)      echo "No symbolic links, so not testing for their testing..." >&4
2719         ;;
2720 esac
2721 echo " "
2722
2723 : Make symlinks util
2724 case "$mksymlinks" in
2725 $define|true|[yY]*)
2726         case "$src" in
2727         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2728                 exit 1
2729                 ;;
2730         *)      case "$lns:$issymlink" in
2731                 *"ln"*" -s:"*"test -"?)
2732                         echo "Creating the symbolic links..." >&4
2733                         echo "(First creating the subdirectories...)" >&4
2734                         cd ..
2735                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2736                                 read directory
2737                                 test -z "$directory" && break
2738                                 mkdir -p $directory
2739                         done
2740                         # Sanity check 1.
2741                         if test ! -d t/base; then
2742                                 echo "Failed to create the subdirectories.  Aborting." >&4
2743                                 exit 1
2744                         fi
2745                         echo "(Then creating the symlinks...)" >&4
2746                         awk '{print $1}' $src/MANIFEST | while true; do
2747                                 read filename
2748                                 test -z "$filename" && break
2749                                 if test -f $filename; then
2750                                         if $issymlink $filename; then
2751                                                 rm -f $filename
2752                                         fi
2753                                 fi
2754                                 if test -f $filename; then
2755                                         echo "$filename already exists, not symlinking."
2756                                 else
2757                                         ln -s $src/$filename $filename
2758                                 fi
2759                         done
2760                         # Sanity check 2.
2761                         if test ! -f t/base/lex.t; then
2762                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2763                                 exit 1
2764                         fi
2765                         cd UU
2766                         ;;
2767                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2768                         ;;
2769                 esac
2770                 ;;
2771         esac
2772         ;;
2773 esac
2774
2775 : Check for Cross-Compilation
2776 case "$usecrosscompile" in
2777 $define|true|[yY]*)
2778         $echo "Cross-compiling..."
2779         croak=''
2780         case "$cc" in
2781         *-*-gcc) # A cross-compiling gcc, probably.
2782             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2783             ar=$targetarch-ar
2784             # leave out ld, choosing it is more complex
2785             nm=$targetarch-nm
2786             ranlib=$targetarch-ranlib
2787             $echo 'extern int foo;' > try.c
2788             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2789             shift
2790             if $test $# -gt 0; then
2791                 incpth="$incpth $*"
2792                 incpth="`$echo $incpth|$sed 's/^ //'`"
2793                 echo "Guessing incpth '$incpth'." >&4
2794                 for i in $*; do
2795                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2796                     if $test -d $j; then
2797                         libpth="$libpth $j"
2798                     fi
2799                 done   
2800                 libpth="`$echo $libpth|$sed 's/^ //'`"
2801                 echo "Guessing libpth '$libpth'." >&4
2802             fi
2803             $rm -f try.c
2804             ;;
2805         esac
2806         case "$targetarch" in
2807         '') echo "Targetarch not defined." >&4; croak=y ;;
2808         *)  echo "Using targetarch $targetarch." >&4 ;;
2809         esac
2810         case "$incpth" in
2811         '') echo "Incpth not defined." >&4; croak=y ;;
2812         *)  echo "Using incpth '$incpth'." >&4 ;;
2813         esac
2814         case "$libpth" in
2815         '') echo "Libpth not defined." >&4; croak=y ;;
2816         *)  echo "Using libpth '$libpth'." >&4 ;;
2817         esac
2818         case "$usrinc" in
2819         '') for i in $incpth; do
2820                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2821                     usrinc=$i
2822                     echo "Guessing usrinc $usrinc." >&4
2823                     break
2824                 fi
2825             done
2826             case "$usrinc" in
2827             '') echo "Usrinc not defined." >&4; croak=y ;;
2828             esac
2829             ;;
2830         *)  echo "Using usrinc $usrinc." >&4 ;;
2831         esac
2832         case "$targethost" in
2833         '') echo "Targethost not defined." >&4; croak=y ;;
2834         *)  echo "Using targethost $targethost." >&4
2835         esac
2836         locincpth=' '
2837         loclibpth=' '
2838         case "$croak" in
2839         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2840         esac
2841         case "$src" in
2842         /*) run=$src/Cross/run
2843             targetmkdir=$src/Cross/mkdir
2844             to=$src/Cross/to
2845             from=$src/Cross/from
2846             ;;
2847         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2848             run=$pwd/Cross/run
2849             targetmkdir=$pwd/Cross/mkdir
2850             to=$pwd/Cross/to
2851             from=$pwd/Cross/from
2852             ;;
2853         esac
2854         case "$targetrun" in
2855         '') targetrun=ssh ;;
2856         esac
2857         case "$targetto" in
2858         '') targetto=scp ;;
2859         esac
2860         case "$targetfrom" in
2861         '') targetfrom=scp ;;
2862         esac
2863         run=$run-$targetrun
2864         to=$to-$targetto
2865         from=$from-$targetfrom
2866         case "$targetdir" in
2867         '')  targetdir=/tmp
2868              echo "Guessing targetdir $targetdir." >&4
2869              ;;
2870         esac
2871         case "$targetuser" in
2872         '')  targetuser=root
2873              echo "Guessing targetuser $targetuser." >&4
2874              ;;
2875         esac
2876         case "$targetfrom" in
2877         scp)    q=-q ;;
2878         *)      q='' ;;
2879         esac
2880         case "$targetrun" in
2881         ssh|rsh)
2882             cat >$run <<EOF
2883 #!/bin/sh
2884 case "\$1" in
2885 -cwd)
2886   shift
2887   cwd=\$1
2888   shift
2889   ;;
2890 esac
2891 case "\$cwd" in
2892 '') cwd=$targetdir ;;
2893 esac
2894 exe=\$1
2895 shift
2896 if $test ! -f \$exe.xok; then
2897   $to \$exe
2898   $touch \$exe.xok
2899 fi
2900 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2901 EOF
2902             ;;
2903         *)  echo "Unknown targetrun '$targetrun'" >&4
2904             exit 1
2905             ;;
2906         esac
2907         case "$targetmkdir" in
2908         */Cross/mkdir)
2909             cat >$targetmkdir <<EOF
2910 #!/bin/sh
2911 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2912 EOF
2913             $chmod a+rx $targetmkdir
2914             ;;
2915         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2916             exit 1
2917             ;;
2918         esac
2919         case "$targetto" in
2920         scp|rcp)
2921             cat >$to <<EOF
2922 #!/bin/sh
2923 for f in \$@
2924 do
2925   case "\$f" in
2926   /*)
2927     $targetmkdir \`dirname \$f\`
2928     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2929     ;;
2930   *)
2931     $targetmkdir $targetdir/\`dirname \$f\`
2932     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2933     ;;
2934   esac
2935 done
2936 exit 0
2937 EOF
2938             ;;
2939         cp) cat >$to <<EOF
2940 #!/bin/sh
2941 for f in \$@
2942 do
2943   case "\$f" in
2944   /*)
2945     $mkdir -p $targetdir/\`dirname \$f\`
2946     $cp \$f $targetdir/\$f || exit 1
2947     ;;
2948   *)
2949     $targetmkdir $targetdir/\`dirname \$f\`
2950     $cp \$f $targetdir/\$f || exit 1
2951     ;;
2952   esac
2953 done
2954 exit 0
2955 EOF
2956             ;;
2957         *)  echo "Unknown targetto '$targetto'" >&4
2958             exit 1
2959             ;;
2960         esac
2961         case "$targetfrom" in
2962         scp|rcp)
2963           cat >$from <<EOF
2964 #!/bin/sh
2965 for f in \$@
2966 do
2967   $rm -f \$f
2968   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2969 done
2970 exit 0
2971 EOF
2972             ;;
2973         cp) cat >$from <<EOF
2974 #!/bin/sh
2975 for f in \$@
2976 do
2977   $rm -f \$f
2978   cp $targetdir/\$f . || exit 1
2979 done
2980 exit 0
2981 EOF
2982             ;;
2983         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2984             exit 1
2985             ;;
2986         esac
2987         if $test ! -f $run; then
2988             echo "Target 'run' script '$run' not found." >&4
2989         else
2990             $chmod a+rx $run
2991         fi
2992         if $test ! -f $to; then
2993             echo "Target 'to' script '$to' not found." >&4
2994         else
2995             $chmod a+rx $to
2996         fi
2997         if $test ! -f $from; then
2998             echo "Target 'from' script '$from' not found." >&4
2999         else
3000             $chmod a+rx $from
3001         fi
3002         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3003             exit 1
3004         fi
3005         cat >&4 <<EOF
3006 Using '$run' for remote execution,
3007 and '$from' and '$to'
3008 for remote file transfer.
3009 EOF
3010         ;;
3011 *)      run=''
3012         to=:
3013         from=:
3014         usecrosscompile='undef'
3015         targetarch=''
3016         ;;
3017 esac
3018
3019 : see whether [:lower:] and [:upper:] are supported character classes
3020 echo " "
3021 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3022 ABYZ)
3023         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3024         up='[:upper:]'
3025         low='[:lower:]'
3026         ;;
3027 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3028         # (0xd9 and 0xe2), therefore that is a nice testing point.
3029         if test "X$up" = X -o "X$low" = X; then
3030             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3031             rs) up='[A-Z]'
3032                 low='[a-z]'
3033                 ;;
3034             esac
3035         fi
3036         if test "X$up" = X -o "X$low" = X; then
3037             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3038             rs) up='A-Z'
3039                 low='a-z'
3040                 ;;
3041             esac
3042         fi
3043         if test "X$up" = X -o "X$low" = X; then
3044             case "`echo RS | od -x 2>/dev/null`" in
3045             *D9E2*|*d9e2*)
3046                 echo "Hey, this might be EBCDIC." >&4
3047                 if test "X$up" = X -o "X$low" = X; then
3048                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3049                     rs) up='[A-IJ-RS-Z]'
3050                         low='[a-ij-rs-z]'
3051                         ;;
3052                     esac
3053                 fi
3054                 if test "X$up" = X -o "X$low" = X; then
3055                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3056                     rs) up='A-IJ-RS-Z'
3057                         low='a-ij-rs-z'
3058                         ;;
3059                     esac
3060                 fi
3061                 ;;
3062             esac
3063         fi
3064 esac
3065 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3066 rs)
3067     echo "Using $up and $low to convert case." >&4
3068     ;;
3069 *)
3070     echo "I don't know how to translate letters from upper to lower case." >&4
3071     echo "Your tr is not acting any way I know of." >&4
3072     exit 1
3073     ;;
3074 esac
3075 : set up the translation script tr, must be called with ./tr of course
3076 cat >tr <<EOSC
3077 $startsh
3078 case "\$1\$2" in
3079 '[A-Z][a-z]') exec $tr '$up' '$low';;
3080 '[a-z][A-Z]') exec $tr '$low' '$up';;
3081 esac
3082 exec $tr "\$@"
3083 EOSC
3084 chmod +x tr
3085 $eunicefix tr
3086
3087 : Try to determine whether config.sh was made on this system
3088 case "$config_sh" in
3089 '')
3090 myuname=`$uname -a 2>/dev/null`
3091 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3092 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3093 # because the A-Z/a-z are not consecutive.
3094 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3095         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3096 newmyuname="$myuname"
3097 dflt=n
3098 case "$knowitall" in
3099 '')
3100         if test -f ../config.sh; then
3101                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3102                         eval "`grep myuname= ../config.sh`"
3103                 fi
3104                 if test "X$myuname" = "X$newmyuname"; then
3105                         dflt=y
3106                 fi
3107         fi
3108         ;;
3109 *) dflt=y;;
3110 esac
3111
3112 : Get old answers from old config file if Configure was run on the
3113 : same system, otherwise use the hints.
3114 hint=default
3115 cd ..
3116 if test -f config.sh; then
3117         echo " "
3118         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3119         . UU/myread
3120         case "$ans" in
3121         n*|N*) echo "OK, I'll ignore it."
3122                 mv config.sh config.sh.old
3123                 myuname="$newmyuname"
3124                 ;;
3125         *)  echo "Fetching default answers from your old config.sh file..." >&4
3126                 tmp_n="$n"
3127                 tmp_c="$c"
3128                 tmp_sh="$sh"
3129                 . ./config.sh
3130                 cp config.sh UU
3131                 n="$tmp_n"
3132                 c="$tmp_c"
3133                 : Older versions did not always set $sh.  Catch re-use of such
3134                 : an old config.sh.
3135                 case "$sh" in
3136                 '') sh="$tmp_sh" ;;
3137                 esac
3138                 hint=previous
3139                 ;;
3140         esac
3141 fi
3142 . ./UU/checkcc
3143 if test ! -f config.sh; then
3144         $cat <<EOM
3145
3146 First time through, eh?  I have some defaults handy for some systems
3147 that need some extra help getting the Configure answers right:
3148
3149 EOM
3150         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3151         dflt=''
3152         : Half the following guesses are probably wrong... If you have better
3153         : tests or hints, please send them to perlbug@perl.org
3154         : The metaconfig authors would also appreciate a copy...
3155         $test -f /irix && osname=irix
3156         $test -f /xenix && osname=sco_xenix
3157         $test -f /dynix && osname=dynix
3158         $test -f /dnix && osname=dnix
3159         $test -f /lynx.os && osname=lynxos
3160         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3161         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3162         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3163         $test -f /bin/mips && /bin/mips && osname=mips
3164         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3165                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3166         $test -d /usr/apollo/bin && osname=apollo
3167         $test -f /etc/saf/_sactab && osname=svr4
3168         $test -d /usr/include/minix && osname=minix
3169         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3170         if $test -d /MachTen -o -d /MachTen_Folder; then
3171                 osname=machten
3172                 if $test -x /sbin/version; then
3173                         osvers=`/sbin/version | $awk '{print $2}' |
3174                         $sed -e 's/[A-Za-z]$//'`
3175                 elif $test -x /usr/etc/version; then
3176                         osvers=`/usr/etc/version | $awk '{print $2}' |
3177                         $sed -e 's/[A-Za-z]$//'`
3178                 else
3179                         osvers="$2.$3"
3180                 fi
3181         fi
3182
3183         $test -f /sys/posix.dll &&
3184                 $test -f /usr/bin/what &&
3185                 set X `/usr/bin/what /sys/posix.dll` &&
3186                 $test "$3" = UWIN &&
3187                 osname=uwin &&
3188                 osvers="$5"
3189
3190         if $test -f $uname; then
3191                 set X $myuname
3192                 shift
3193
3194                 case "$5" in
3195                 fps*) osname=fps ;;
3196                 mips*)
3197                         case "$4" in
3198                         umips) osname=umips ;;
3199                         *) osname=mips ;;
3200                         esac;;
3201                 [23]100) osname=mips ;;
3202                 next*) osname=next ;;
3203                 i386*)
3204                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3205                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3206                                 osname='sco'
3207                                 osvers=$tmp
3208                         elif $test -f /etc/kconfig; then
3209                                 osname=isc
3210                                 if test "$lns" = "$ln -s"; then
3211                                         osvers=4
3212                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3213                                         osvers=3
3214                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3215                                         osvers=2
3216                                 fi
3217                         fi
3218                         tmp=''
3219                         ;;
3220                 pc*)
3221                         if test -n "$DJGPP"; then
3222                                 osname=dos
3223                                 osvers=djgpp
3224                         fi
3225                         ;;
3226                 esac
3227
3228                 case "$1" in
3229                 aix) osname=aix
3230                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3231                         case "$tmp" in
3232                         # oslevel can fail with:
3233                         # oslevel: Unable to acquire lock.
3234                         *not\ found) osvers="$4"."$3" ;;
3235                         '<3240'|'<>3240') osvers=3.2.0 ;;
3236                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3237                         '=3250'|'>3250') osvers=3.2.5 ;;
3238                         *) osvers=$tmp;;
3239                         esac
3240                         ;;
3241                 bsd386) osname=bsd386
3242                         osvers=`$uname -r`
3243                         ;;
3244                 cygwin*) osname=cygwin
3245                         osvers="$3"
3246                         ;;
3247                 *dc.osx) osname=dcosx
3248                         osvers="$3"
3249                         ;;
3250                 dnix) osname=dnix
3251                         osvers="$3"
3252                         ;;
3253                 domainos) osname=apollo
3254                         osvers="$3"
3255                         ;;
3256                 dgux)   osname=dgux
3257                         osvers="$3"
3258                         ;;
3259                 dragonfly) osname=dragonfly
3260                         osvers="$3"
3261                         ;;
3262                 dynixptx*) osname=dynixptx
3263                         osvers=`echo "$4"|sed 's/^v//'`
3264                         ;;
3265                 freebsd) osname=freebsd
3266                         osvers="$3" ;;
3267                 genix)  osname=genix ;;
3268                 gnu)    osname=gnu
3269                         osvers="$3" ;;
3270                 hp*)    osname=hpux
3271                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3272                         ;;
3273                 irix*)  osname=irix
3274                         case "$3" in
3275                         4*) osvers=4 ;;
3276                         5*) osvers=5 ;;
3277                         *)      osvers="$3" ;;
3278                         esac
3279                         ;;
3280                 linux)  osname=linux
3281                         case "$3" in
3282                         *)      osvers="$3" ;;
3283                         esac
3284                         ;;
3285                 MiNT)   osname=mint
3286                         ;;
3287                 netbsd*) osname=netbsd
3288                         osvers="$3"
3289                         ;;
3290                 news-os) osvers="$3"
3291                         case "$3" in
3292                         4*) osname=newsos4 ;;
3293                         *) osname=newsos ;;
3294                         esac
3295                         ;;
3296                 next*) osname=next ;;
3297                 nonstop-ux) osname=nonstopux ;;
3298                 openbsd) osname=openbsd
3299                         osvers="$3"
3300                         ;;
3301                 os2)    osname=os2
3302                         osvers="$4"
3303                         ;;
3304                 POSIX-BC | posix-bc ) osname=posix-bc
3305                         osvers="$3"
3306                         ;;
3307                 powerux | power_ux | powermax_os | powermaxos | \
3308                 powerunix | power_unix) osname=powerux
3309                         osvers="$3"
3310                         ;;
3311                 qnx) osname=qnx
3312                         osvers="$4"
3313                         ;;
3314                 solaris) osname=solaris
3315                         case "$3" in
3316                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3317                         *)      osvers="$3" ;;
3318                         esac
3319                         ;;
3320                 sunos) osname=sunos
3321                         case "$3" in
3322                         5*) osname=solaris
3323                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3324                         *)      osvers="$3" ;;
3325                         esac
3326                         ;;
3327                 titanos) osname=titanos
3328                         case "$3" in
3329                         1*) osvers=1 ;;
3330                         2*) osvers=2 ;;
3331                         3*) osvers=3 ;;
3332                         4*) osvers=4 ;;
3333                         *)      osvers="$3" ;;
3334                         esac
3335                         ;;
3336                 ultrix) osname=ultrix
3337                         osvers="$3"
3338                         ;;
3339                 osf1|mls+)      case "$5" in
3340                                 alpha)
3341                                         osname=dec_osf
3342                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3343                                         case "$osvers" in
3344                                         [1-9].[0-9]*) ;;
3345                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3346                                         esac
3347                                         ;;
3348                         hp*)    osname=hp_osf1  ;;
3349                         mips)   osname=mips_osf1 ;;
3350                         esac
3351                         ;;
3352                 # UnixWare 7.1.2 is known as Open UNIX 8
3353                 openunix|unixware) osname=svr5
3354                         osvers="$4"
3355                         ;;
3356                 uts)    osname=uts
3357                         osvers="$3"
3358                         ;;
3359                 vos) osvers="$3"
3360                         ;;
3361                 $2) case "$osname" in
3362                         *isc*) ;;
3363                         *freebsd*) ;;
3364                         svr*)
3365                                 : svr4.x or possibly later
3366                                 case "svr$3" in
3367                                 ${osname}*)
3368                                         osname=svr$3
3369                                         osvers=$4
3370                                         ;;
3371                                 esac
3372                                 case "$osname" in
3373                                 svr4.0)
3374                                         : Check for ESIX
3375                                         if test -f /stand/boot ; then
3376                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3377                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3378                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3379                                                         if test -n "$isesix"; then
3380                                                                 osname=esix4
3381                                                         fi
3382                                                 fi
3383                                         fi
3384                                         ;;
3385                                 esac
3386                                 ;;
3387                         *)      if test -f /etc/systemid; then
3388                                         osname=sco
3389                                         set `echo $3 | $sed 's/\./ /g'` $4
3390                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3391                                                 osvers=$1.$2.$3
3392                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3393                                                 osvers=$1.$2
3394                                         elif $test -f $src/hints/sco_$1.sh; then
3395                                                 osvers=$1
3396                                         fi
3397                                 else
3398                                         case "$osname" in
3399                                         '') : Still unknown.  Probably a generic Sys V.
3400                                                 osname="sysv"
3401                                                 osvers="$3"
3402                                                 ;;
3403                                         esac
3404                                 fi
3405                                 ;;
3406                         esac
3407                         ;;
3408                 *)      case "$osname" in
3409                         '') : Still unknown.  Probably a generic BSD.
3410                                 osname="$1"
3411                                 osvers="$3"
3412                                 ;;
3413                         esac
3414                         ;;
3415                 esac
3416         else
3417                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3418                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3419                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3420                                 osname=news_os
3421                         fi
3422                         $rm -f UU/kernel.what
3423                 elif test -d c:/. -o -n "$is_os2" ; then
3424                         set X $myuname
3425                         osname=os2
3426                         osvers="$5"
3427                 fi
3428         fi
3429
3430         case "$targetarch" in
3431         '') ;;
3432         *)  hostarch=$osname
3433             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3434             osvers=''
3435             ;;
3436         esac
3437
3438         : Now look for a hint file osname_osvers, unless one has been
3439         : specified already.
3440         case "$hintfile" in
3441         ''|' ')
3442                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3443                 : Also try without trailing minor version numbers.
3444                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3445                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3446                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3447                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3448                 case "$file" in
3449                 '') dflt=none ;;
3450                 *)  case "$osvers" in
3451                         '') dflt=$file
3452                                 ;;
3453                         *)  if $test -f $src/hints/$file.sh ; then
3454                                         dflt=$file
3455                                 elif $test -f $src/hints/$xfile.sh ; then
3456                                         dflt=$xfile
3457                                 elif $test -f $src/hints/$xxfile.sh ; then
3458                                         dflt=$xxfile
3459                                 elif $test -f $src/hints/$xxxfile.sh ; then
3460                                         dflt=$xxxfile
3461                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3462                                         dflt=$xxxxfile
3463                                 elif $test -f "$src/hints/${osname}.sh" ; then
3464                                         dflt="${osname}"
3465                                 else
3466                                         dflt=none
3467                                 fi
3468                                 ;;
3469                         esac
3470                         ;;
3471                 esac
3472                 if $test -f Policy.sh ; then
3473                         case "$dflt" in
3474                         *Policy*) ;;
3475                         none) dflt="Policy" ;;
3476                         *) dflt="Policy $dflt" ;;
3477                         esac
3478                 fi
3479                 ;;
3480         *)
3481                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3482                 ;;
3483         esac
3484
3485         if $test -f Policy.sh ; then
3486                 $cat <<EOM
3487
3488 There's also a Policy hint file available, which should make the
3489 site-specific (policy) questions easier to answer.
3490 EOM
3491
3492         fi
3493
3494         $cat <<EOM
3495
3496 You may give one or more space-separated answers, or "none" if appropriate.
3497 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3498 previous run of Configure, you may specify it as well as or instead of
3499 OS-specific hints.  If hints are provided for your OS, you should use them:
3500 although Perl can probably be built without hints on many platforms, using
3501 hints often improve performance and may enable features that Configure can't
3502 set up on its own. If there are no hints that match your OS, specify "none";
3503 DO NOT give a wrong version or a wrong OS.
3504
3505 EOM
3506
3507         rp="Which of these apply, if any?"
3508         . UU/myread
3509         tans=$ans
3510         for file in $tans; do
3511                 if $test X$file = XPolicy -a -f Policy.sh; then
3512                         . Policy.sh
3513                         $cat Policy.sh >> UU/config.sh
3514                 elif $test -f $src/hints/$file.sh; then
3515                         . $src/hints/$file.sh
3516                         $cat $src/hints/$file.sh >> UU/config.sh
3517                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3518                         : nothing
3519                 else
3520                         : Give one chance to correct a possible typo.
3521                         echo "$file.sh does not exist"
3522                         dflt=$file
3523                         rp="hint to use instead?"
3524                         . UU/myread
3525                         for file in $ans; do
3526                                 if $test -f "$src/hints/$file.sh"; then
3527                                         . $src/hints/$file.sh
3528                                         $cat $src/hints/$file.sh >> UU/config.sh
3529                                 elif $test X$ans = X -o X$ans = Xnone ; then
3530                                         : nothing
3531                                 else
3532                                         echo "$file.sh does not exist -- ignored."
3533                                 fi
3534                         done
3535                 fi
3536         done
3537
3538         hint=recommended
3539         : Remember our hint file for later.
3540         if $test -f "$src/hints/$file.sh" ; then
3541                 hintfile="$file"
3542         else
3543                 hintfile=''
3544         fi
3545 fi
3546 cd UU
3547 ;;
3548 *)
3549         echo " "
3550         echo "Fetching default answers from $config_sh..." >&4
3551         tmp_n="$n"
3552         tmp_c="$c"
3553         cd ..
3554         cp $config_sh config.sh 2>/dev/null
3555         chmod +w config.sh
3556         . ./config.sh
3557         cd UU
3558         cp ../config.sh .
3559         n="$tmp_n"
3560         c="$tmp_c"
3561         hint=previous
3562         ;;
3563 esac
3564 test "$override" && . ./optdef.sh
3565
3566 : Restore computed paths
3567 for file in $loclist $trylist; do
3568         eval $file="\$_$file"
3569 done
3570
3571 cat << EOM
3572
3573 Configure uses the operating system name and version to set some defaults.
3574 The default value is probably right if the name rings a bell. Otherwise,
3575 since spelling matters for me, either accept the default or answer "none"
3576 to leave it blank.
3577
3578 EOM
3579 case "$osname" in
3580         ''|' ')
3581                 case "$hintfile" in
3582                 ''|' '|none) dflt=none ;;
3583                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3584                 esac
3585                 ;;
3586         *) dflt="$osname" ;;
3587 esac
3588 rp="Operating system name?"
3589 . ./myread
3590 case "$ans" in
3591 none)  osname='' ;;
3592 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3593 esac
3594 echo " "
3595 case "$osvers" in
3596         ''|' ')
3597                 case "$hintfile" in
3598                 ''|' '|none) dflt=none ;;
3599                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3600                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3601                         case "$dflt" in
3602                         ''|' ') dflt=none ;;
3603                         esac
3604                         ;;
3605                 esac
3606                 ;;
3607         *) dflt="$osvers" ;;
3608 esac
3609 rp="Operating system version?"
3610 . ./myread
3611 case "$ans" in
3612 none)  osvers='' ;;
3613 *) osvers="$ans" ;;
3614 esac
3615
3616
3617 . ./posthint.sh
3618
3619 : who configured the system
3620 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3621 case "$cf_by" in
3622 "")
3623         cf_by=`(logname) 2>/dev/null`
3624         case "$cf_by" in
3625         "")
3626                 cf_by=`(whoami) 2>/dev/null`
3627                 case "$cf_by" in
3628                 "") cf_by=unknown ;;
3629                 esac ;;
3630         esac ;;
3631 esac
3632
3633 : decide how portable to be.  Allow command line overrides.
3634 case "$d_portable" in
3635 "$undef") ;;
3636 *)      d_portable="$define" ;;
3637 esac
3638
3639 : set up shell script to do ~ expansion
3640 cat >filexp <<EOSS
3641 $startsh
3642 : expand filename
3643 case "\$1" in
3644  \~/*|\~)
3645         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3646         ;;
3647  \~*)
3648         if $test -f /bin/csh; then
3649                 /bin/csh -f -c "glob \$1"
3650                 failed=\$?
3651                 echo ""
3652                 exit \$failed
3653         else
3654                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3655                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3656                 if $test ! -d "\$dir"; then
3657                         me=\`basename \$0\`
3658                         echo "\$me: can't locate home directory for: \$name" >&2
3659                         exit 1
3660                 fi
3661                 case "\$1" in
3662                 */*)
3663                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3664                         ;;
3665                 *)
3666                         echo \$dir
3667                         ;;
3668                 esac
3669         fi
3670         ;;
3671 *)
3672         echo \$1
3673         ;;
3674 esac
3675 EOSS
3676 chmod +x filexp
3677 $eunicefix filexp
3678
3679 : now set up to get a file name
3680 cat <<EOS >getfile
3681 $startsh
3682 EOS
3683 cat <<'EOSC' >>getfile
3684 tilde=''
3685 fullpath=''
3686 already=''
3687 skip=''
3688 none_ok=''
3689 exp_file=''
3690 nopath_ok=''
3691 orig_rp="$rp"
3692 orig_dflt="$dflt"
3693 case "$gfpth" in
3694 '') gfpth='.' ;;
3695 esac
3696
3697 case "$fn" in
3698 *\(*)
3699         : getfile will accept an answer from the comma-separated list
3700         : enclosed in parentheses even if it does not meet other criteria.
3701         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3702         fn=`echo $fn | sed 's/(.*)//'`
3703         ;;
3704 esac
3705
3706 case "$fn" in
3707 *:*)
3708         loc_file=`expr $fn : '.*:\(.*\)'`
3709         fn=`expr $fn : '\(.*\):.*'`
3710         ;;
3711 esac
3712
3713 case "$fn" in
3714 *~*) tilde=true;;
3715 esac
3716 case "$fn" in
3717 */*) fullpath=true;;
3718 esac
3719 case "$fn" in
3720 *+*) skip=true;;
3721 esac
3722 case "$fn" in
3723 *n*) none_ok=true;;
3724 esac
3725 case "$fn" in
3726 *e*) exp_file=true;;
3727 esac
3728 case "$fn" in
3729 *p*) nopath_ok=true;;
3730 esac
3731
3732 case "$fn" in
3733 *f*) type='File';;
3734 *d*) type='Directory';;
3735 *l*) type='Locate';;
3736 esac
3737
3738 what="$type"
3739 case "$what" in
3740 Locate) what='File';;
3741 esac
3742
3743 case "$exp_file" in
3744 '')
3745         case "$d_portable" in
3746         "$define") ;;
3747         *) exp_file=true;;
3748         esac
3749         ;;
3750 esac
3751
3752 cd ..
3753 while test "$type"; do
3754         redo=''
3755         rp="$orig_rp"
3756         dflt="$orig_dflt"
3757         case "$tilde" in
3758         true) rp="$rp (~name ok)";;
3759         esac
3760         . UU/myread
3761         if test -f UU/getfile.ok && \
3762                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3763         then
3764                 value="$ans"
3765                 ansexp="$ans"
3766                 break
3767         fi
3768         case "$ans" in
3769         none)
3770                 value=''
3771                 ansexp=''
3772                 case "$none_ok" in
3773                 true) type='';;
3774                 esac
3775                 ;;
3776         *)
3777                 case "$tilde" in
3778                 '') value="$ans"
3779                         ansexp="$ans";;
3780                 *)
3781                         value=`UU/filexp $ans`
3782                         case $? in
3783                         0)
3784                                 if test "$ans" != "$value"; then
3785                                         echo "(That expands to $value on this system.)"
3786                                 fi
3787                                 ;;
3788                         *) value="$ans";;
3789                         esac
3790                         ansexp="$value"
3791                         case "$exp_file" in
3792                         '') value="$ans";;
3793                         esac
3794                         ;;
3795                 esac
3796                 case "$fullpath" in
3797                 true)
3798                         case "$ansexp" in
3799                         /*) value="$ansexp" ;;
3800                         [a-zA-Z]:/*) value="$ansexp" ;;
3801                         *)
3802                                 redo=true
3803                                 case "$already" in
3804                                 true)
3805                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3806                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3807                                         ;;
3808                                 *)
3809                                 echo "Please give a full path name, starting with slash." >&4
3810                                         case "$tilde" in
3811                                         true)
3812                                 echo "Note that using ~name is ok provided it expands well." >&4
3813                                                 already=true
3814                                                 ;;
3815                                         esac
3816                                 esac
3817                                 ;;
3818                         esac
3819                         ;;
3820                 esac
3821                 case "$redo" in
3822                 '')
3823                         case "$type" in
3824                         File)
3825                                 for fp in $gfpth; do
3826                                         if test "X$fp" = X.; then
3827                                             pf="$ansexp"
3828                                         else    
3829                                             pf="$fp/$ansexp"
3830                                         fi
3831                                         if test -f "$pf"; then
3832                                                 type=''
3833                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3834                                         then
3835                                                 echo "($value is not a plain file, but that's ok.)"
3836                                                 type=''
3837                                         fi
3838                                         if test X"$type" = X; then
3839                                             value="$pf"
3840                                             break
3841                                         fi
3842                                 done
3843                                 ;;
3844                         Directory)
3845                                 for fp in $gfpth; do
3846                                         if test "X$fp" = X.; then
3847                                             dir="$ans"
3848                                             direxp="$ansexp"
3849                                         else    
3850                                             dir="$fp/$ansexp"
3851                                             direxp="$fp/$ansexp"
3852                                         fi
3853                                         if test -d "$direxp"; then
3854                                                 type=''
3855                                                 value="$dir"
3856                                                 break
3857                                         fi
3858                                 done
3859                                 ;;
3860                         Locate)
3861                                 if test -d "$ansexp"; then
3862                                         echo "(Looking for $loc_file in directory $value.)"
3863                                         value="$value/$loc_file"
3864                                         ansexp="$ansexp/$loc_file"
3865                                 fi
3866                                 if test -f "$ansexp"; then
3867                                         type=''
3868                                 fi
3869                                 case "$nopath_ok" in
3870                                 true)   case "$value" in
3871                                         */*) ;;
3872                                         *)      echo "Assuming $value will be in people's path."
3873                                                 type=''
3874                                                 ;;
3875                                         esac
3876                                         ;;
3877                                 esac
3878                                 ;;
3879                         esac
3880
3881                         case "$skip" in
3882                         true) type='';
3883                         esac
3884
3885                         case "$type" in
3886                         '') ;;
3887                         *)
3888                                 if test "$fastread" = yes; then
3889                                         dflt=y
3890                                 else
3891                                         dflt=n
3892                                 fi
3893                                 rp="$what $value doesn't exist.  Use that name anyway?"
3894                                 . UU/myread
3895                                 dflt=''
3896                                 case "$ans" in
3897                                 y*) type='';;
3898                                 *) echo " ";;
3899                                 esac
3900                                 ;;
3901                         esac
3902                         ;;
3903                 esac
3904                 ;;
3905         esac
3906 done
3907 cd UU
3908 ans="$value"
3909 rp="$orig_rp"
3910 dflt="$orig_dflt"
3911 rm -f getfile.ok
3912 test "X$gfpthkeep" != Xy && gfpth=""
3913 EOSC
3914
3915 : determine root of directory hierarchy where package will be installed.
3916 case "$prefix" in
3917 '')
3918         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3919         ;;
3920 *?/)
3921         dflt=`echo "$prefix" | sed 's/.$//'`
3922         ;;
3923 *)
3924         dflt="$prefix"
3925         ;;
3926 esac
3927 $cat <<EOM
3928
3929 By default, $package will be installed in $dflt/bin, manual pages
3930 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3931 installation directories. Typically this is something like /usr/local.
3932 If you wish to have binaries under /usr/bin but other parts of the
3933 installation under /usr/local, that's ok: you will be prompted
3934 separately for each of the installation directories, the prefix being
3935 only used to set the defaults.
3936
3937 EOM
3938 fn=d~
3939 rp='Installation prefix to use?'
3940 . ./getfile
3941 oldprefix=''
3942 case "$prefix" in
3943 '') ;;
3944 *)
3945         case "$ans" in
3946         "$prefix") ;;
3947         *) oldprefix="$prefix";;
3948         esac
3949         ;;
3950 esac
3951 prefix="$ans"
3952 prefixexp="$ansexp"
3953
3954 : allow them to override the AFS root
3955 case "$afsroot" in
3956 '')     afsroot=/afs ;;
3957 *)      afsroot=$afsroot ;;
3958 esac
3959
3960 : is AFS running?
3961 echo " "
3962 case "$afs" in
3963 $define|true)   afs=true ;;
3964 $undef|false)   afs=false ;;
3965 *)      if $test -d $afsroot; then
3966                 afs=true
3967         else
3968                 afs=false
3969         fi
3970         ;;
3971 esac
3972 if $afs; then
3973         echo "AFS may be running... I'll be extra cautious then..." >&4
3974 else
3975         echo "AFS does not seem to be running..." >&4
3976 fi
3977
3978 : determine installation prefix for where package is to be installed.
3979 if $afs; then 
3980 $cat <<EOM
3981
3982 Since you are running AFS, I need to distinguish the directory in which
3983 files will reside from the directory in which they are installed (and from
3984 which they are presumably copied to the former directory by occult means).
3985
3986 EOM
3987         case "$installprefix" in
3988         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3989         *) dflt="$installprefix";;
3990         esac
3991 else
3992 $cat <<EOM
3993
3994 In some special cases, particularly when building $package for distribution,
3995 it is convenient to distinguish the directory in which files should be
3996 installed from the directory ($prefix) in which they will
3997 eventually reside.  For most users, these two directories are the same.
3998
3999 EOM
4000         case "$installprefix" in
4001         '') dflt=$prefix ;;
4002         *) dflt=$installprefix;;
4003         esac
4004 fi
4005 fn=d~
4006 rp='What installation prefix should I use for installing files?'
4007 . ./getfile
4008 installprefix="$ans"
4009 installprefixexp="$ansexp"
4010
4011 : Perform the prefixexp/installprefixexp correction if necessary
4012 cat <<EOS >installprefix
4013 $startsh
4014 EOS
4015 cat <<'EOSC' >>installprefix
4016 : Change installation prefix, if necessary.
4017 if $test X"$prefix" != X"$installprefix"; then
4018     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4019 else
4020     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4021 fi
4022 EOSC
4023 chmod +x installprefix
4024 $eunicefix installprefix
4025
4026 : Set variables such as privlib and privlibexp from the output of ./getfile
4027 : performing the prefixexp/installprefixexp correction if necessary.
4028 cat <<EOS >setprefixvar
4029 $startsh
4030 EOS
4031 cat <<'EOSC' >>setprefixvar
4032 eval "${prefixvar}=\"\$ans\""
4033 eval "${prefixvar}exp=\"\$ansexp\""
4034 . ./installprefix
4035 EOSC
4036 chmod +x setprefixvar
4037 $eunicefix setprefixvar
4038
4039 : set up the script used to warn in case of inconsistency
4040 cat <<EOS >whoa
4041 $startsh
4042 EOS
4043 cat <<'EOSC' >>whoa
4044 dflt=y
4045 case "$hint" in
4046     recommended)
4047         case "$hintfile" in
4048         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4049                 ;;
4050         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4051                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4052                 ;;
4053         esac
4054         ;;
4055     *)  echo " "
4056         echo "*** WHOA THERE!!! ***" >&4
4057         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4058         ;;
4059 esac
4060 rp="    Keep the $hint value?"
4061 . ./myread
4062 case "$ans" in
4063 y) td=$was; tu=$was;;
4064 esac
4065 EOSC
4066
4067 : function used to set '$1' to '$val'
4068 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4069 case "$val$was" in
4070 $define$undef) . ./whoa; eval "$var=\$td";;
4071 $undef$define) . ./whoa; eval "$var=\$tu";;
4072 *) eval "$var=$val";;
4073 esac'
4074
4075 : Check is we will use socks
4076 case "$usesocks" in
4077 $define|true|[yY]*)     dflt='y';;
4078 *) dflt='n';;
4079 esac
4080 cat <<EOM
4081
4082 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4083 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4084 to use the PerlIO abstraction layer, this will be implicitly selected.
4085
4086 If this doesn't make any sense to you, just accept the default '$dflt'.
4087 EOM
4088 rp='Build Perl for SOCKS?'
4089 . ./myread
4090 case "$ans" in
4091 y|Y)    val="$define" ;;
4092 *)      val="$undef" ;;
4093 esac
4094 set usesocks
4095 eval $setvar
4096
4097 case "$usesocks" in
4098 $define|true|[yY]*) useperlio="$define";;
4099 esac
4100
4101 : Check if we want perlio
4102 case "$useperlio" in
4103 $define|true|[yY]*|'')  dflt='y';;
4104 *) dflt='n';;
4105 esac
4106 cat <<EOM
4107
4108 Previous version of $package used the standard IO mechanisms as
4109 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4110 alternate IO mechanisms via the PerlIO abstraction layer, but the
4111 stdio mechanism is still available if needed.  The abstraction layer
4112 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4113 Using PerlIO with sfio may cause problems with some extension modules.
4114
4115 If this doesn't make any sense to you, just accept the default '$dflt'.
4116 EOM
4117 rp='Use the PerlIO abstraction layer?'
4118 . ./myread
4119 case "$ans" in
4120 y|Y)
4121         val="$define"
4122         ;;
4123 *)
4124         echo "Ok, doing things the stdio way."
4125         val="$undef"
4126         ;;
4127 esac
4128 set useperlio
4129 eval $setvar
4130
4131 case "$usesocks" in
4132 $define|true|[yY]*)
4133         case "$useperlio" in
4134         $define|true|[yY]*) ;;
4135         *)      cat >&4 <<EOM
4136
4137 You are using the SOCKS proxy protocol library which means that you
4138 should also use the PerlIO layer.  You may be headed for trouble.
4139
4140 EOM
4141                 ;;
4142         esac
4143         ;;
4144 esac
4145
4146 : get the patchlevel
4147 echo " "
4148 echo "Getting the current patchlevel..." >&4
4149 if $test -r $rsrc/patchlevel.h;then
4150         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4151         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4152         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4153         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4154         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4155         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4156         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4157 else
4158         revision=0
4159         patchlevel=0
4160         subversion=0
4161         api_revision=0
4162         api_version=0
4163         api_subversion=0
4164         perl_patchlevel=0
4165         $echo "(You do not have patchlevel.h.  Eek.)"
4166 fi
4167 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4168 version_patchlevel_string="version $patchlevel subversion $subversion"
4169 case "$perl_patchlevel" in
4170 0|'') ;;
4171 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4172     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4173     ;;
4174 esac
4175
4176 $echo "(You have $package $version_patchlevel_string.)"
4177
4178 case "$osname" in
4179 dos|vms)
4180         : XXX Should be a Configure test for double-dots in filenames.
4181         version=`echo $revision $patchlevel $subversion | \
4182                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4183         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4184                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4185         ;;
4186 *)
4187         version=`echo $revision $patchlevel $subversion | \
4188                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4189         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4190                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4191         ;;
4192 esac
4193 : Special case the 5.005_xx maintenance series, which used 5.005
4194 : without any subversion label as a subdirectory in $sitelib
4195 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4196         api_versionstring='5.005'
4197 fi
4198
4199 : Do we want threads support and if so, what type
4200 case "$usethreads" in
4201 $define|true|[yY]*)     dflt='y';;
4202 *)     # Catch case where user specified ithreads or 5005threads but
4203        # forgot -Dusethreads (A.D. 4/2002)
4204        case "$useithreads$use5005threads" in
4205        *$define*)
4206                 case "$useperlio" in
4207                 "$define")      dflt='y' ;;
4208                 *)              dflt='n' ;;
4209                 esac
4210                 ;;
4211        *)       dflt='n';;
4212        esac
4213        ;;
4214 esac
4215 cat <<EOM
4216
4217 Perl can be built to take advantage of threads on some systems.
4218 To do so, Configure can be run with -Dusethreads.
4219
4220 Note that Perl built with threading support runs slightly slower
4221 and uses more memory than plain Perl. The current implementation
4222 is believed to be stable, but it is fairly new, and so should be
4223 treated with caution.
4224
4225 If this doesn't make any sense to you, just accept the default '$dflt'.
4226 EOM
4227 rp='Build a threading Perl?'
4228 . ./myread
4229 case "$ans" in
4230 y|Y)    val="$define" ;;
4231 *)      val="$undef" ;;
4232 esac
4233 set usethreads
4234 eval $setvar
4235
4236 if $test $patchlevel -lt 9; then
4237     case "$usethreads" in
4238     $define)
4239         $cat <<EOM
4240
4241 Since release 5.6, Perl has had two different threading implementations,
4242 the newer interpreter-based version (ithreads) with one interpreter per
4243 thread, and the older 5.005 version (5005threads).
4244 The 5005threads version is effectively unmaintained and will probably be
4245 removed in Perl 5.10, so there should be no need to build a Perl using it
4246 unless needed for backwards compatibility with some existing 5.005threads
4247 code.
4248
4249 EOM
4250         : Default to ithreads unless overridden on command line or with
4251         : old config.sh
4252         dflt='y'
4253         case "$use5005threads" in
4254                 $define|true|[yY]*) dflt='n';;
4255         esac
4256         case "$useithreads" in
4257                 $undef|false|[nN]*) dflt='n';;
4258         esac
4259         rp='Use the newer interpreter-based ithreads?'
4260         . ./myread
4261         case "$ans" in
4262         y|Y)    val="$define" ;;
4263         *)      val="$undef" ;;
4264         esac
4265         set useithreads
4266         eval $setvar
4267         : Now set use5005threads to the opposite value.
4268         case "$useithreads" in
4269         $define) val="$undef" ;;
4270         *) val="$define" ;;
4271         esac
4272         set use5005threads
4273         eval $setvar
4274         ;;
4275     *)
4276         useithreads="$undef"
4277         use5005threads="$undef"
4278         ;;
4279     esac
4280
4281     case "$useithreads$use5005threads" in
4282     "$define$define")
4283         $cat >&4 <<EOM
4284
4285 You cannot have both the ithreads and the 5.005 threads enabled
4286 at the same time.  Disabling the 5.005 threads since they are
4287 much less stable than the ithreads.
4288
4289 EOM
4290         use5005threads="$undef"
4291         ;;
4292     esac
4293
4294 else
4295 : perl-5.9.x and later
4296
4297     if test X"$usethreads" = "X$define"; then
4298         case "$use5005threads" in
4299             $define|true|[yY]*)
4300                 $cat >&4 <<EOM
4301
4302 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4303
4304 EOM
4305             ;;
4306         esac
4307     fi
4308
4309     use5005threads="$undef"
4310     useithreads="$usethreads"
4311 fi
4312
4313 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4314         cat >&4 <<EOF
4315 ***
4316 *** To build with ithreads you must also use the PerlIO layer.
4317 *** Cannot continue, aborting.
4318 ***
4319 EOF
4320         exit 1
4321 fi
4322
4323 case "$d_oldpthreads" in
4324 '')     : Configure tests would be welcome here.  For now, assume undef.
4325         val="$undef" ;;
4326 *)      val="$d_oldpthreads" ;;
4327 esac
4328 set d_oldpthreads
4329 eval $setvar
4330
4331
4332 : Look for a hint-file generated 'call-back-unit'.  If the
4333 : user has specified that a threading perl is to be built,
4334 : we may need to set or change some other defaults.
4335 if $test -f usethreads.cbu; then
4336     echo "Your platform has some specific hints regarding threaded builds, using them..."
4337     . ./usethreads.cbu
4338 else
4339     case "$usethreads" in
4340         "$define"|true|[yY]*)
4341                 $cat <<EOM
4342 (Your platform does not have any specific hints for threaded builds.
4343  Assuming POSIX threads, then.)
4344 EOM
4345         ;;
4346     esac
4347 fi
4348
4349 : Check if multiplicity is required
4350 cat <<EOM
4351
4352 Perl can be built so that multiple Perl interpreters can coexist
4353 within the same Perl executable.
4354 EOM
4355
4356 case "$useithreads" in
4357 $define)
4358         cat <<EOM
4359 This multiple interpreter support is required for interpreter-based threads.
4360 EOM
4361         val="$define"
4362         ;;
4363 *)      case "$usemultiplicity" in
4364         $define|true|[yY]*)     dflt='y';;
4365         *) dflt='n';;
4366         esac
4367         echo " "
4368         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4369         rp='Build Perl for multiplicity?'
4370         . ./myread
4371         case "$ans" in
4372         y|Y)    val="$define" ;;
4373         *)      val="$undef" ;;
4374         esac
4375         ;;
4376 esac
4377 set usemultiplicity
4378 eval $setvar
4379
4380 : Check if morebits is requested
4381 case "$usemorebits" in
4382 "$define"|true|[yY]*)
4383         use64bitint="$define"
4384         uselongdouble="$define"
4385         usemorebits="$define"
4386         ;;
4387 *)      usemorebits="$undef"
4388         ;;
4389 esac
4390
4391 : Determine the C compiler to be used
4392 echo " "
4393 case "$cc" in
4394 '') dflt=cc;;
4395 *) dflt="$cc";;
4396 esac
4397 rp="Use which C compiler?"
4398 . ./myread
4399 cc="$ans"
4400
4401 : See whether they have no cc but they do have gcc
4402 . ./trygcc
4403 if $test -f cc.cbu; then
4404     . ./cc.cbu
4405 fi
4406 . ./checkcc
4407
4408 : make some quick guesses about what we are up against
4409 echo " "
4410 $echo $n "Hmm...  $c"
4411 echo exit 1 >bsd
4412 echo exit 1 >usg
4413 echo exit 1 >v7
4414 echo exit 1 >osf1
4415 echo exit 1 >eunice
4416 echo exit 1 >xenix
4417 echo exit 1 >venix
4418 echo exit 1 >os2
4419 d_bsd="$undef"
4420 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4421 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4422 then
4423         echo "Looks kind of like an OSF/1 system, but we'll see..."
4424         echo exit 0 >osf1
4425 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4426         xxx=`./loc addbib blurfl $pth`
4427         if $test -f $xxx; then
4428         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4429                 echo exit 0 >bsd
4430                 echo exit 0 >usg
4431         else
4432                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4433                         echo "Looks kind of like an extended USG system, but we'll see..."
4434                 else
4435                         echo "Looks kind of like a USG system, but we'll see..."
4436                 fi
4437                 echo exit 0 >usg
4438         fi
4439 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4440         echo "Looks kind of like a BSD system, but we'll see..."
4441         d_bsd="$define"
4442         echo exit 0 >bsd
4443 else
4444         echo "Looks kind of like a Version 7 system, but we'll see..."
4445         echo exit 0 >v7
4446 fi
4447 case "$eunicefix" in
4448 *unixtovms*)
4449         $cat <<'EOI'
4450 There is, however, a strange, musty smell in the air that reminds me of
4451 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4452 EOI
4453         echo exit 0 >eunice
4454         d_eunice="$define"
4455 : it so happens the Eunice I know will not run shell scripts in Unix format
4456         ;;
4457 *)
4458         echo " "
4459         echo "Congratulations.  You aren't running Eunice."
4460         d_eunice="$undef"
4461         ;;
4462 esac
4463 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4464 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4465 : semicolon as a patch separator
4466 case "$p_" in
4467 :) ;;
4468 *)
4469         $cat <<'EOI'
4470 I have the feeling something is not exactly right, however...don't tell me...
4471 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4472 (Or you may be running DOS with DJGPP.)
4473 EOI
4474         echo exit 0 >os2
4475         ;;
4476 esac
4477 if test -f /xenix; then
4478         echo "Actually, this looks more like a XENIX system..."
4479         echo exit 0 >xenix
4480         d_xenix="$define"
4481 else
4482         echo " "
4483         echo "It's not Xenix..."
4484         d_xenix="$undef"
4485 fi
4486 chmod +x xenix
4487 $eunicefix xenix
4488 if test -f /venix; then
4489         echo "Actually, this looks more like a VENIX system..."
4490         echo exit 0 >venix
4491 else
4492         echo " "
4493         if ./xenix; then
4494                 : null
4495         else
4496                 echo "Nor is it Venix..."
4497         fi
4498 fi
4499 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4500 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4501 $rm -f foo
4502
4503 : Check if we are using GNU gcc and what its version is
4504 echo " "
4505 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4506 $cat >try.c <<EOM
4507 #include <stdio.h>
4508 int main() {
4509 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4510 #ifdef __VERSION__
4511         printf("%s\n", __VERSION__);
4512 #else
4513         printf("%s\n", "1");
4514 #endif
4515 #endif
4516         return(0);
4517 }
4518 EOM
4519 if $cc -o try $ccflags $ldflags try.c; then
4520         gccversion=`$run ./try`
4521         case "$gccversion" in
4522         '') echo "You are not using GNU cc." ;;
4523         *)  echo "You are using GNU cc $gccversion."
4524             ccname=gcc
4525             ;;
4526         esac
4527 else
4528         echo " "
4529         echo "*** WHOA THERE!!! ***" >&4
4530         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4531         case "$knowitall" in
4532         '')
4533         echo "    You'd better start hunting for one and let me know about it." >&4
4534                 exit 1
4535                 ;;
4536         esac
4537 fi
4538 $rm -f try try.*
4539 case "$gccversion" in
4540 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4541 esac
4542 case "$gccversion" in
4543 '') gccosandvers='' ;;
4544 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4545    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4546    gccshortvers=''
4547    case "$gccosandvers" in
4548    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4549    $osname$osvers) ;; # looking good
4550    $osname*) cat <<EOM >&4
4551
4552 *** WHOA THERE!!! ***
4553
4554     Your gcc has not been compiled for the exact release of
4555     your operating system ($gccosandvers versus $osname$osvers).
4556
4557     In general it is a good idea to keep gcc synchronized with
4558     the operating system because otherwise serious problems
4559     may ensue when trying to compile software, like Perl.
4560
4561     I'm trying to be optimistic here, though, and will continue.
4562     If later during the configuration and build icky compilation
4563     problems appear (headerfile conflicts being the most common
4564     manifestation), I suggest reinstalling the gcc to match
4565     your operating system release.
4566
4567 EOM
4568       ;;
4569    *) gccosandvers='' ;; # failed to parse, better be silent
4570    esac
4571    ;;
4572 esac
4573 case "$ccname" in
4574 '') ccname="$cc" ;;
4575 esac
4576
4577 # gcc 3.* complain about adding -Idirectories that they already know about,
4578 # so we will take those off from locincpth.
4579 case "$gccversion" in
4580 3*)
4581     echo "main(){}">try.c
4582     for incdir in $locincpth; do
4583        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4584              grep '^c[cp]p*[01]: warning: changing search order '`
4585        if test "X$warn" != X; then
4586            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4587        fi
4588     done
4589     $rm -f try try.*
4590 esac
4591
4592 : What should the include directory be ?
4593 echo " "
4594 $echo $n "Hmm...  $c"
4595 dflt='/usr/include'
4596 incpath=''
4597 mips_type=''
4598 if $test -f /bin/mips && /bin/mips; then
4599         echo "Looks like a MIPS system..."
4600         $cat >usr.c <<'EOCP'
4601 #ifdef SYSTYPE_BSD43
4602 /bsd43
4603 #endif
4604 EOCP
4605         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4606                 dflt='/bsd43/usr/include'
4607                 incpath='/bsd43'
4608                 mips_type='BSD 4.3'
4609         else
4610                 mips_type='System V'
4611         fi
4612         $rm -f usr.c usr.out
4613         echo "and you're compiling with the $mips_type compiler and libraries."
4614         xxx_prompt=y
4615         echo "exit 0" >mips
4616 else
4617         echo "Doesn't look like a MIPS system."
4618         xxx_prompt=n
4619         echo "exit 1" >mips
4620 fi
4621 chmod +x mips
4622 $eunicefix mips
4623 case "$usrinc" in
4624 '') ;;
4625 *) dflt="$usrinc";;
4626 esac
4627 case "$xxx_prompt" in
4628 y)      fn=d/
4629         echo " "
4630         rp='Where are the include files you want to use?'
4631         . ./getfile
4632         usrinc="$ans"
4633         ;;
4634 *)      usrinc="$dflt"
4635         ;;
4636 esac
4637
4638 : see how we invoke the C preprocessor
4639 echo " "
4640 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4641 cat <<'EOT' >testcpp.c
4642 #define ABC abc
4643 #define XYZ xyz
4644 ABC.XYZ
4645 EOT
4646 cd ..
4647 if test ! -f cppstdin; then
4648         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4649                 # AIX cc -E doesn't show the absolute headerfile
4650                 # locations but we'll cheat by using the -M flag.
4651                 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
4652         else
4653                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4654         fi
4655 else
4656         echo "Keeping your $hint cppstdin wrapper."
4657 fi
4658 chmod 755 cppstdin
4659 wrapper=`pwd`/cppstdin
4660 ok='false'
4661 cd UU
4662
4663 if $test "X$cppstdin" != "X" && \
4664         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4665         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4666 then
4667         echo "You used to use $cppstdin $cppminus so we'll use that again."
4668         case "$cpprun" in
4669         '') echo "But let's see if we can live without a wrapper..." ;;
4670         *)
4671                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4672                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4673                 then
4674                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4675                         ok='true'
4676                 else
4677                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4678                 fi
4679                 ;;
4680         esac
4681 else
4682         case "$cppstdin" in
4683         '') ;;
4684         *)
4685                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4686                 ;;
4687         esac
4688 fi
4689
4690 if $ok; then
4691         : nothing
4692 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4693         $cc -E <testcpp.c >testcpp.out 2>&1; \
4694         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4695         echo "Yup, it does."
4696         x_cpp="$cc -E"
4697         x_minus='';
4698 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4699         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4700         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4701         echo "Yup, it does."
4702         x_cpp="$cc -E"
4703         x_minus='-';
4704 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4705         $cc -P <testcpp.c >testcpp.out 2>&1; \
4706         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4707         echo "Yipee, that works!"
4708         x_cpp="$cc -P"
4709         x_minus='';
4710 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4711         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4712         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4713         echo "At long last!"
4714         x_cpp="$cc -P"
4715         x_minus='-';
4716 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4717         $cpp <testcpp.c >testcpp.out 2>&1; \
4718         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4719         echo "It works!"
4720         x_cpp="$cpp"
4721         x_minus='';
4722 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4723         $cpp - <testcpp.c >testcpp.out 2>&1; \
4724         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4725         echo "Hooray, it works!  I was beginning to wonder."
4726         x_cpp="$cpp"
4727         x_minus='-';
4728 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4729         $wrapper <testcpp.c >testcpp.out 2>&1; \
4730         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4731         x_cpp="$wrapper"
4732         x_minus=''
4733         echo "Eureka!"
4734 else
4735         dflt=''
4736         rp="No dice.  I can't find a C preprocessor.  Name one:"
4737         . ./myread
4738         x_cpp="$ans"
4739         x_minus=''
4740         $x_cpp <testcpp.c >testcpp.out 2>&1
4741         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4742                 echo "OK, that will do." >&4
4743         else
4744 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4745                 exit 1
4746         fi
4747 fi
4748
4749 case "$ok" in
4750 false)
4751         cppstdin="$x_cpp"
4752         cppminus="$x_minus"
4753         cpprun="$x_cpp"
4754         cpplast="$x_minus"
4755         set X $x_cpp
4756         shift
4757         case "$1" in
4758         "$cpp")
4759                 echo "Perhaps can we force $cc -E using a wrapper..."
4760                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4761                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4762                 then
4763                         echo "Yup, we can."
4764                         cppstdin="$wrapper"
4765                         cppminus='';
4766                 else
4767                         echo "Nope, we'll have to live without it..."
4768                 fi
4769                 ;;
4770         esac
4771         case "$cpprun" in
4772         "$wrapper")
4773                 cpprun=''
4774                 cpplast=''
4775                 ;;
4776         esac
4777         ;;
4778 esac
4779
4780 case "$cppstdin" in
4781 "$wrapper"|'cppstdin') ;;
4782 *) $rm -f $wrapper;;
4783 esac
4784 $rm -f testcpp.c testcpp.out
4785
4786 : Set private lib path
4787 case "$plibpth" in
4788 '') if ./mips; then
4789                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4790         fi;;
4791 esac
4792 case "$libpth" in
4793 ' ') dlist='';;
4794 '') dlist="$loclibpth $plibpth $glibpth";;
4795 *) dlist="$libpth";;
4796 esac
4797
4798 : Now check and see which directories actually exist, avoiding duplicates
4799 libpth=''
4800 for xxx in $dlist
4801 do
4802     if $test -d $xxx; then
4803                 case " $libpth " in
4804                 *" $xxx "*) ;;
4805                 *) libpth="$libpth $xxx";;
4806                 esac
4807     fi
4808 done
4809 $cat <<'EOM'
4810
4811 Some systems have incompatible or broken versions of libraries.  Among
4812 the directories listed in the question below, please remove any you
4813 know not to be holding relevant libraries, and add any that are needed.
4814 Say "none" for none.
4815
4816 EOM
4817 case "$libpth" in
4818 '') dflt='none';;
4819 *)
4820         set X $libpth
4821         shift
4822         dflt=${1+"$@"}
4823         ;;
4824 esac
4825 rp="Directories to use for library searches?"
4826 . ./myread
4827 case "$ans" in
4828 none) libpth=' ';;
4829 *) libpth="$ans";;
4830 esac
4831
4832 : compute shared library extension
4833 case "$so" in
4834 '')
4835         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4836                 dflt='sl'
4837         else
4838                 dflt='so'
4839         fi
4840         ;;
4841 *) dflt="$so";;
4842 esac
4843 $cat <<EOM
4844
4845 On some systems, shared libraries may be available.  Answer 'none' if
4846 you want to suppress searching of shared libraries for the remainder
4847 of this configuration.
4848
4849 EOM
4850 rp='What is the file extension used for shared libraries?'
4851 . ./myread
4852 so="$ans"
4853
4854 : Define several unixisms.
4855 : Hints files or command line option can be used to override them.
4856 : The convoluted testing is in case hints files set either the old
4857 : or the new name.
4858 case "$_exe" in
4859 '')     case "$exe_ext" in
4860         '')     ;;
4861         *)      _exe="$exe_ext" ;;
4862         esac
4863         ;;
4864 esac
4865 case "$_a" in
4866 '')     case "$lib_ext" in
4867     '') _a='.a';;
4868         *)      _a="$lib_ext" ;;
4869         esac
4870         ;;
4871 esac
4872 case "$_o" in
4873 '') case "$obj_ext" in
4874         '')     _o='.o';;
4875         *)      _o="$obj_ext";;
4876         esac
4877         ;;
4878 esac
4879 case "$p_" in
4880 '') case "$path_sep" in
4881         '')     p_=':';;
4882         *)      p_="$path_sep";;
4883         esac
4884         ;;
4885 esac
4886 exe_ext=$_exe
4887 lib_ext=$_a
4888 obj_ext=$_o
4889 path_sep=$p_
4890
4891 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4892
4893 : Which makefile gets called first.  This is used by make depend.
4894 case "$firstmakefile" in
4895 '') firstmakefile='makefile';;
4896 esac
4897
4898 : Check for uselongdouble support
4899 case "$ccflags" in
4900 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4901 esac
4902
4903 case "$uselongdouble" in
4904 $define|true|[yY]*)     dflt='y';;
4905 *) dflt='n';;
4906 esac
4907 cat <<EOM
4908
4909 Perl can be built to take advantage of long doubles which
4910 (if available) may give more accuracy and range for floating point numbers.
4911
4912 If this doesn't make any sense to you, just accept the default '$dflt'.
4913 EOM
4914 rp='Try to use long doubles if available?'
4915 . ./myread
4916 case "$ans" in
4917 y|Y)    val="$define"   ;;
4918 *)      val="$undef"    ;;
4919 esac
4920 set uselongdouble
4921 eval $setvar
4922
4923 case "$uselongdouble" in
4924 true|[yY]*) uselongdouble="$define" ;;
4925 esac
4926
4927 : Look for a hint-file generated 'call-back-unit'.  If the
4928 : user has specified that long doubles should be used,
4929 : we may need to set or change some other defaults.
4930 if $test -f uselongdouble.cbu; then
4931     echo "Your platform has some specific hints regarding long doubles, using them..."
4932     . ./uselongdouble.cbu
4933 else
4934     case "$uselongdouble" in
4935         $define)
4936                 $cat <<EOM
4937 (Your platform does not have any specific hints for long doubles.)
4938 EOM
4939         ;;
4940     esac
4941 fi
4942
4943 : Looking for optional libraries
4944 echo " "
4945 echo "Checking for optional libraries..." >&4
4946 case "$libs" in
4947 ' '|'') dflt='';;
4948 *) dflt="$libs";;
4949 esac
4950 case "$libswanted" in
4951 '') libswanted='c_s';;
4952 esac
4953 case "$usesocks" in
4954 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4955 esac
4956 libsfound=''
4957 libsfiles=''
4958 libsdirs=''
4959 libspath=''
4960 for thisdir in $libpth $xlibpth; do
4961   test -d $thisdir && libspath="$libspath $thisdir"
4962 done
4963 for thislib in $libswanted; do
4964         for thisdir in $libspath; do
4965             xxx=''
4966             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4967                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4968                 $test -f "$xxx" && eval $libscheck
4969                 $test -f "$xxx" && libstyle=shared
4970             fi
4971             if test ! -f "$xxx"; then
4972                 xxx=$thisdir/lib$thislib.$so
4973                 $test -f "$xxx" && eval $libscheck
4974                 $test -f "$xxx" && libstyle=shared
4975             fi
4976             if test ! -f "$xxx"; then
4977                 xxx=$thisdir/lib$thislib$_a
4978                 $test -f "$xxx" && eval $libscheck
4979                 $test -f "$xxx" && libstyle=static
4980             fi
4981             if test ! -f "$xxx"; then
4982                 xxx=$thisdir/$thislib$_a
4983                 $test -f "$xxx" && eval $libscheck
4984                 $test -f "$xxx" && libstyle=static
4985             fi
4986             if test ! -f "$xxx"; then
4987                 xxx=$thisdir/lib${thislib}_s$_a
4988                 $test -f "$xxx" && eval $libscheck
4989                 $test -f "$xxx" && libstyle=static
4990                 $test -f "$xxx" && thislib=${thislib}_s
4991             fi
4992             if test ! -f "$xxx"; then
4993                 xxx=$thisdir/Slib$thislib$_a
4994                 $test -f "$xxx" && eval $libscheck
4995                 $test -f "$xxx" && libstyle=static
4996             fi
4997             if $test -f "$xxx"; then
4998                 case "$libstyle" in
4999                 shared) echo "Found -l$thislib (shared)." ;;
5000                 static) echo "Found -l$thislib." ;;
5001                 *)      echo "Found -l$thislib ($libstyle)." ;;
5002                 esac
5003                 case " $dflt " in
5004                 *"-l$thislib "*);;
5005                 *) dflt="$dflt -l$thislib"
5006                    libsfound="$libsfound $xxx"
5007                    yyy=`basename $xxx`
5008                    libsfiles="$libsfiles $yyy"
5009                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5010                    case " $libsdirs " in
5011                    *" $yyy "*) ;;
5012                    *) libsdirs="$libsdirs $yyy" ;;
5013                    esac
5014                    ;;
5015                 esac
5016                 break
5017             fi
5018         done
5019         if $test ! -f "$xxx"; then
5020             echo "No -l$thislib."
5021         fi
5022 done
5023 set X $dflt
5024 shift
5025 dflt="$*"
5026 case "$libs" in
5027 '') dflt="$dflt";;
5028 *) dflt="$libs";;
5029 esac
5030 case "$dflt" in
5031 ' '|'') dflt='none';;
5032 esac
5033
5034 $cat <<EOM
5035
5036 In order to compile $package on your machine, a number of libraries
5037 are usually needed.  Include any other special libraries here as well.
5038 Say "none" for none.  The default list is almost always right.
5039 EOM
5040
5041 echo " "
5042 rp="What libraries to use?"
5043 . ./myread
5044 case "$ans" in
5045 none) libs=' ';;
5046 *) libs="$ans";;
5047 esac
5048
5049 : determine optimization, if desired, or use for debug flag also
5050 case "$optimize" in
5051 ' '|$undef) dflt='none';;
5052 '') dflt='-O';;
5053 *) dflt="$optimize";;
5054 esac
5055 $cat <<EOH
5056
5057 By default, $package compiles with the -O flag to use the optimizer.
5058 Alternately, you might want to use the symbolic debugger, which uses
5059 the -g flag (on traditional Unix systems).  Either flag can be
5060 specified here.  To use neither flag, specify the word "none".
5061
5062 EOH
5063 rp="What optimizer/debugger flag should be used?"
5064 . ./myread
5065 optimize="$ans"
5066 case "$optimize" in
5067 'none') optimize=" ";;
5068 esac
5069
5070 : Check what DEBUGGING is required from the command line
5071 : -DEBUGGING      or -DDEBUGGING or
5072 : -DEBUGGING=both                       = -g + -DDEBUGGING
5073 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5074 : -DEBUGGING=none or -UDEBUGGING        =
5075 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5076 case "$EBUGGING" in
5077 '')     ;;
5078 *)      DEBUGGING=$EBUGGING ;;
5079 esac
5080
5081 case "$DEBUGGING" in
5082 -g|both|$define)
5083     case "$optimize" in
5084         *-g*) ;;
5085         *)    optimize="$optimize -g" ;;
5086     esac ;;
5087 none|$undef)
5088     case "$optimize" in
5089         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5090                 shift
5091                 optimize="$*"
5092                 ;;
5093     esac ;;
5094 esac
5095
5096 dflt=''
5097 case "$DEBUGGING" in
5098 both|$define) dflt='-DDEBUGGING'
5099 esac
5100
5101 : argument order is deliberate, as the flag will start with - which set could
5102 : think is an option
5103 checkccflag='check=$1; flag=$2; callback=$3;
5104 echo " ";
5105 echo "Checking if your compiler accepts $flag" 2>&1;
5106 echo "int main(void) { return 0; }" > gcctest.c;
5107 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5108     echo "Yes, it does." 2>&1;
5109     if $test -s gcctest.out ; then
5110         echo "But your platform does not like it:";
5111         cat gcctest.out;
5112     else
5113         case "$ccflags" in
5114         *$check*)
5115             echo "Leaving current flags $ccflags alone." 2>&1
5116             ;;
5117         *) dflt="$dflt $flag";
5118             eval $callback
5119             ;;
5120         esac
5121     fi
5122 else
5123     echo "Nope, it does not, but that is ok." 2>&1;
5124 fi
5125 '
5126
5127 : We will not override a previous value, but we might want to
5128 : augment a hint file
5129 case "$hint" in
5130 default|recommended)
5131         case "$gccversion" in
5132         1*) dflt="$dflt -fpcc-struct-return" ;;
5133         esac
5134         case "$optimize:$DEBUGGING" in
5135         *-g*:old) dflt="$dflt -DDEBUGGING";;
5136         esac
5137         case "$gccversion" in
5138         2*) if $test -d /etc/conf/kconfig.d &&
5139                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5140                 then
5141                         # Interactive Systems (ISC) POSIX mode.
5142                         dflt="$dflt -posix"
5143                 fi
5144                 ;;
5145         esac
5146         case "$gccversion" in
5147         1*) ;;
5148         2.[0-8]*) ;;
5149         ?*)     set strict-aliasing -fno-strict-aliasing
5150                 eval $checkccflag
5151                 ;;
5152         esac
5153         # For gcc, adding -pipe speeds up compilations for some, but apparently
5154         # some assemblers can't read from stdin.  (It also slows down compilations
5155         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5156         case "$gccversion" in
5157         ?*)     set pipe -pipe
5158                 eval $checkccflag
5159                 ;;
5160         esac
5161
5162         # on x86_64 (at least) we require an extra library (libssp) in the
5163         # link command line. This library is not named, so I infer that it is
5164         # an implementation detail that may change. Hence the safest approach
5165         # is to add the flag to the flags passed to the compiler at link time,
5166         # as that way the compiler can do the right implementation dependant
5167         # thing. (NWC)
5168         case "$gccversion" in
5169         ?*)     set stack-protector -fstack-protector
5170                 eval $checkccflag
5171                 ;;
5172         esac
5173         ;;
5174 esac
5175
5176 case "$mips_type" in
5177 *BSD*|'') inclwanted="$locincpth $usrinc";;
5178 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5179 esac
5180 for thisincl in $inclwanted; do
5181         if $test -d $thisincl; then
5182                 if $test x$thisincl != x$usrinc; then
5183                         case "$dflt" in
5184                         *" -I$thisincl "*);;
5185                         *) dflt="$dflt -I$thisincl ";;
5186                         esac
5187                 fi
5188         fi
5189 done
5190
5191 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5192         xxx=true;
5193 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5194         xxx=true;
5195 else
5196         xxx=false;
5197 fi;
5198 if $xxx; then
5199         case "$dflt" in
5200         *$2*);;
5201         *) dflt="$dflt -D$2";;
5202         esac;
5203 fi'
5204
5205 set signal.h LANGUAGE_C; eval $inctest
5206
5207 case "$usesocks" in
5208 $define)
5209         ccflags="$ccflags -DSOCKS"
5210         ;;
5211 esac
5212
5213 case "$hint" in
5214 default|recommended) dflt="$ccflags $dflt" ;;
5215 *) dflt="$ccflags";;
5216 esac
5217
5218 case "$dflt" in
5219 ''|' ') dflt=none;;
5220 esac
5221
5222 $cat <<EOH
5223
5224 Your C compiler may want other flags.  For this question you should include
5225 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5226 but you should NOT include libraries or ld flags like -lwhatever.  If you
5227 want $package to honor its debug switch, you should include -DDEBUGGING here.
5228 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5229
5230 To use no flags, specify the word "none".
5231
5232 EOH
5233 set X $dflt
5234 shift
5235 dflt=${1+"$@"}
5236 rp="Any additional cc flags?"
5237 . ./myread
5238 case "$ans" in
5239 none) ccflags='';;
5240 *) ccflags="$ans";;
5241 esac
5242
5243 : the following weeds options from ccflags that are of no interest to cpp
5244 case "$cppflags" in
5245 '') cppflags="$ccflags" ;;
5246 *)  cppflags="$cppflags $ccflags" ;;
5247 esac
5248 case "$gccversion" in
5249 1*) cppflags="$cppflags -D__GNUC__"
5250 esac
5251 case "$mips_type" in
5252 '');;
5253 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5254 esac
5255 case "$cppflags" in
5256 '');;
5257 *)
5258         echo " "
5259         echo "Let me guess what the preprocessor flags are..." >&4
5260         set X $cppflags
5261         shift
5262         cppflags=''
5263         $cat >cpp.c <<'EOM'
5264 #define BLURFL foo
5265
5266 BLURFL xx LFRULB
5267 EOM
5268         previous=''
5269         for flag in $*
5270         do
5271                 case "$flag" in
5272                 -*) ftry="$flag";;
5273                 *) ftry="$previous $flag";;
5274                 esac
5275                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5276                         >cpp1.out 2>/dev/null && \
5277                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5278                         >cpp2.out 2>/dev/null && \
5279                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5280                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5281                 then
5282                         cppflags="$cppflags $ftry"
5283                         previous=''
5284                 else
5285                         previous="$flag"
5286                 fi
5287         done
5288         set X $cppflags
5289         shift
5290         cppflags=${1+"$@"}
5291         case "$cppflags" in
5292         *-*)  echo "They appear to be: $cppflags";;
5293         esac
5294         $rm -f cpp.c cpp?.out
5295         ;;
5296 esac
5297
5298 : flags used in final linking phase
5299 case "$ldflags" in
5300 '') if ./venix; then
5301                 dflt='-i -z'
5302         else
5303                 dflt=''
5304         fi
5305         case "$ccflags" in
5306         *-posix*) dflt="$dflt -posix" ;;
5307         esac
5308         ;;
5309 *) dflt="$ldflags";;
5310 esac
5311 # See note above about -fstack-protector
5312 case "$ccflags" in
5313 *-fstack-protector*) 
5314         case "$dflt" in
5315         *-fstack-protector*) ;; # Don't add it again
5316         *) dflt="$dflt -fstack-protector" ;; 
5317         esac
5318         ;;
5319 esac
5320
5321 : Try to guess additional flags to pick up local libraries.
5322 for thislibdir in $libpth; do
5323         case " $loclibpth " in
5324         *" $thislibdir "*)
5325                 case "$dflt " in
5326                 *"-L$thislibdir "*) ;;
5327                 *)  dflt="$dflt -L$thislibdir" ;;
5328                 esac
5329                 ;;
5330         esac
5331 done
5332
5333 case "$dflt" in
5334 '') dflt='none' ;;
5335 esac
5336
5337 $cat <<EOH
5338
5339 Your C linker may need flags.  For this question you should
5340 include -L/whatever and any other flags used by the C linker, but you
5341 should NOT include libraries like -lwhatever.
5342
5343 Make sure you include the appropriate -L/path flags if your C linker
5344 does not normally search all of the directories you specified above,
5345 namely
5346         $libpth
5347 To use no flags, specify the word "none".
5348
5349 EOH
5350
5351 rp="Any additional ld flags (NOT including libraries)?"
5352 . ./myread
5353 case "$ans" in
5354 none) ldflags='';;
5355 *) ldflags="$ans";;
5356 esac
5357 rmlist="$rmlist pdp11"
5358
5359 : coherency check
5360 echo " "
5361 echo "Checking your choice of C compiler and flags for coherency..." >&4
5362 $cat > try.c <<'EOF'
5363 #include <stdio.h>
5364 int main() { printf("Ok\n"); return(0); }
5365 EOF
5366 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5367 shift
5368 $cat >try.msg <<'EOM'
5369 I've tried to compile and run the following simple program:
5370
5371 EOM
5372 $cat try.c >> try.msg
5373
5374 $cat >> try.msg <<EOM
5375
5376 I used the command:
5377
5378         $*
5379         $run ./try
5380
5381 and I got the following output:
5382
5383 EOM
5384 dflt=y
5385 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5386         if $sh -c "$run ./try " >>try.msg 2>&1; then
5387                 xxx=`$run ./try`
5388                 case "$xxx" in
5389                 "Ok") dflt=n ;;
5390                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5391                         case " $libs " in
5392                         *" -lsfio "*)
5393                                 cat >> try.msg <<'EOQS'
5394 If $libs contains -lsfio, and sfio is mis-configured, then it
5395 sometimes (apparently) runs and exits with a 0 status, but with no
5396 output!  It may have to do with sfio's use of _exit vs. exit.
5397
5398 EOQS
5399                                 rp="You have a big problem.  Shall I abort Configure"
5400                                 dflt=y
5401                                 ;;
5402                         esac
5403                         ;;
5404                 esac
5405         else
5406                 echo "The program compiled OK, but exited with status $?." >>try.msg
5407                 rp="You have a problem.  Shall I abort Configure"
5408                 dflt=y
5409         fi
5410 else
5411         echo "I can't compile the test program." >>try.msg
5412         rp="You have a BIG problem.  Shall I abort Configure"
5413         dflt=y
5414 fi
5415 case "$dflt" in
5416 y)
5417         $cat try.msg >&4
5418         case "$knowitall" in
5419         '')
5420                 echo "(The supplied flags or libraries might be incorrect.)"
5421                 ;;
5422         *) dflt=n;;
5423         esac
5424         echo " "
5425         . ./myread
5426         case "$ans" in
5427         n*|N*) ;;
5428         *)      echo "Ok.  Stopping Configure." >&4
5429                 exit 1
5430                 ;;
5431         esac
5432         ;;
5433 n) echo "OK, that should do.";;
5434 esac
5435 $rm_try gcctest gcctest.out
5436
5437 : define a shorthand compile call
5438 compile='
5439 mc_file=$1;
5440 shift;
5441 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5442 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5443 exit 1;
5444 fi;
5445 esac;
5446 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5447 : define a shorthand compile call for compilations that should be ok.
5448 compile_ok='
5449 mc_file=$1;
5450 shift;
5451 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5452
5453 : determine filename position in cpp output
5454 echo " "
5455 echo "Computing filename position in cpp output for #include directives..." >&4
5456 case "$osname" in
5457 vos) testaccess=-e ;;
5458 *)   testaccess=-r ;;
5459 esac
5460 echo '#include <stdio.h>' > foo.c
5461 $cat >fieldn <<EOF
5462 $startsh
5463 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5464 $grep '^[       ]*#.*stdio\.h' | \
5465 while read cline; do
5466         pos=1
5467         set \$cline
5468         while $test \$# -gt 0; do
5469                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5470                         echo "\$pos"
5471                         exit 0
5472                 fi
5473                 shift
5474                 pos=\`expr \$pos + 1\`
5475         done
5476 done
5477 EOF
5478 chmod +x fieldn
5479 fieldn=`./fieldn`
5480 $rm -f foo.c fieldn
5481 case $fieldn in
5482 '') pos='???';;
5483 1) pos=first;;
5484 2) pos=second;;
5485 3) pos=third;;
5486 *) pos="${fieldn}th";;
5487 esac
5488 echo "Your cpp writes the filename in the $pos field of the line."
5489
5490 case "$osname" in
5491 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5492 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5493 *)   cppfilter='' ;;
5494 esac
5495 : locate header file
5496 $cat >findhdr <<EOF
5497 $startsh
5498 wanted=\$1
5499 name=''
5500 for usrincdir in $usrinc
5501 do
5502         if test -f \$usrincdir/\$wanted; then
5503                 echo "\$usrincdir/\$wanted"
5504                 exit 0
5505         fi
5506 done
5507 awkprg='{ print \$$fieldn }'
5508 echo "#include <\$wanted>" > foo\$\$.c
5509 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5510 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5511 while read cline; do
5512         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5513         case "\$name" in
5514         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5515         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5516         *) exit 2;;
5517         esac;
5518 done;
5519 #
5520 # status = 0: grep returned 0 lines, case statement not executed
5521 # status = 1: headerfile found
5522 # status = 2: while loop executed, no headerfile found
5523 #
5524 status=\$?
5525 $rm -f foo\$\$.c;
5526 if test \$status -eq 1; then
5527         exit 0;
5528 fi
5529 exit 1
5530 EOF
5531 chmod +x findhdr
5532
5533 : define an alternate in-header-list? function
5534 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5535 cont=true; xxf="echo \"<\$1> found.\" >&4";
5536 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5537 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5538 esac;
5539 case $# in 4) instead=instead;; *) instead="at last";; esac;
5540 while $test "$cont"; do
5541         xxx=`./findhdr $1`
5542         var=$2; eval "was=\$$2";
5543         if $test "$xxx" && $test -r "$xxx";
5544         then eval $xxf;
5545         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5546                 cont="";
5547         else eval $xxnf;
5548         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5549         set $yyy; shift; shift; yyy=$@;
5550         case $# in 0) cont="";;
5551         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5552                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5553         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5554                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5555         esac;
5556 done;
5557 while $test "$yyy";
5558 do set $yyy; var=$2; eval "was=\$$2";
5559         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5560         set $yyy; shift; shift; yyy=$@;
5561 done'
5562
5563 : see if stdlib is available
5564 set stdlib.h i_stdlib
5565 eval $inhdr
5566
5567 : check for lengths of integral types
5568 echo " "
5569 case "$intsize" in
5570 '')
5571         echo "Checking to see how big your integers are..." >&4
5572         $cat >try.c <<EOCP
5573 #include <stdio.h>
5574 #$i_stdlib I_STDLIB
5575 #ifdef I_STDLIB
5576 #include <stdlib.h>
5577 #endif
5578 int main()
5579 {
5580         printf("intsize=%d;\n", (int)sizeof(int));
5581         printf("longsize=%d;\n", (int)sizeof(long));
5582         printf("shortsize=%d;\n", (int)sizeof(short));
5583         exit(0);
5584 }
5585 EOCP
5586         set try
5587         if eval $compile_ok && $run ./try > /dev/null; then
5588                 eval `$run ./try`
5589                 echo "Your integers are $intsize bytes long."
5590                 echo "Your long integers are $longsize bytes long."
5591                 echo "Your short integers are $shortsize bytes long."
5592         else
5593                 $cat >&4 <<EOM
5594 !
5595 Help! I can't compile and run the intsize test program: please enlighten me!
5596 (This is probably a misconfiguration in your system or libraries, and
5597 you really ought to fix it.  Still, I'll try anyway.)
5598 !
5599 EOM
5600                 dflt=4
5601                 rp="What is the size of an integer (in bytes)?"
5602                 . ./myread
5603                 intsize="$ans"
5604                 dflt=$intsize
5605                 rp="What is the size of a long integer (in bytes)?"
5606                 . ./myread
5607                 longsize="$ans"
5608                 dflt=2
5609                 rp="What is the size of a short integer (in bytes)?"
5610                 . ./myread
5611                 shortsize="$ans"
5612         fi
5613         ;;
5614 esac
5615 $rm_try
5616
5617 : check for long long
5618 echo " "
5619 echo "Checking to see if you have long long..." >&4
5620 echo 'int main() { long long x = 7; return 0; }' > try.c
5621 set try
5622 if eval $compile; then
5623         val="$define"
5624         echo "You have long long."
5625 else
5626         val="$undef"
5627         echo "You do not have long long."
5628 fi
5629 $rm_try
5630 set d_longlong
5631 eval $setvar
5632
5633 : check for length of long long
5634 case "${d_longlong}${longlongsize}" in
5635 $define)
5636         echo " "
5637         echo "Checking to see how big your long longs are..." >&4
5638         $cat >try.c <<'EOCP'
5639 #include <stdio.h>
5640 int main()
5641 {
5642     printf("%d\n", (int)sizeof(long long));
5643     return(0);
5644 }
5645 EOCP
5646         set try
5647         if eval $compile_ok; then
5648                 longlongsize=`$run ./try`
5649                 echo "Your long longs are $longlongsize bytes long."
5650         else
5651                 dflt='8'
5652                 echo " "
5653                 echo "(I can't seem to compile the test program.  Guessing...)"
5654                 rp="What is the size of a long long (in bytes)?"
5655                 . ./myread
5656                 longlongsize="$ans"
5657         fi
5658         if $test "X$longsize" = "X$longlongsize"; then
5659                 echo "(That isn't any different from an ordinary long.)"
5660         fi
5661         ;;
5662 esac
5663 $rm_try
5664
5665 : see if inttypes.h is available
5666 : we want a real compile instead of Inhdr because some systems
5667 : have an inttypes.h which includes non-existent headers
5668 echo " "
5669 $cat >try.c <<EOCP
5670 #include <inttypes.h>
5671 int main() {
5672         static int32_t foo32 = 0x12345678;
5673 }
5674 EOCP
5675 set try
5676 if eval $compile; then
5677         echo "<inttypes.h> found." >&4
5678         val="$define"
5679 else
5680         echo "<inttypes.h> NOT found." >&4
5681         val="$undef"
5682 fi
5683 $rm_try
5684 set i_inttypes
5685 eval $setvar
5686
5687 : check for int64_t
5688 echo " "
5689 echo "Checking to see if you have int64_t..." >&4
5690 $cat >try.c <<EOCP
5691 #include <sys/types.h>
5692 #$i_inttypes I_INTTYPES
5693 #ifdef I_INTTYPES
5694 #include <inttypes.h>
5695 #endif
5696 int main() { int64_t x = 7; }
5697 EOCP
5698 set try
5699 if eval $compile; then
5700         val="$define"
5701         echo "You have int64_t."
5702 else
5703         val="$undef"
5704         echo "You do not have int64_t."
5705 fi
5706 $rm_try
5707 set d_int64_t
5708 eval $setvar
5709
5710 : Check if 64bit ints have a quad type
5711 echo " "
5712 echo "Checking which 64-bit integer type we could use..." >&4
5713
5714 case "$intsize" in
5715 8) val=int
5716    set quadtype
5717    eval $setvar
5718    val='"unsigned int"'
5719    set uquadtype
5720    eval $setvar
5721    quadkind=1
5722    ;;
5723 *) case "$longsize" in
5724    8) val=long
5725       set quadtype
5726       eval $setvar
5727       val='"unsigned long"'
5728       set uquadtype
5729       eval $setvar
5730       quadkind=2
5731       ;;
5732    *) case "$d_longlong:$longlongsize" in
5733       define:8)
5734         val='"long long"'
5735         set quadtype
5736         eval $setvar
5737         val='"unsigned long long"'
5738         set uquadtype
5739         eval $setvar
5740         quadkind=3
5741         ;;
5742       *) case "$d_int64_t" in
5743          define)
5744            val=int64_t
5745            set quadtype
5746            eval $setvar
5747            val=uint64_t
5748            set uquadtype
5749            eval $setvar
5750            quadkind=4
5751            ;;
5752          esac
5753          ;;
5754       esac
5755       ;;
5756    esac
5757    ;;
5758 esac
5759
5760 case "$quadtype" in
5761 '')     echo "Alas, no 64-bit integer types in sight." >&4
5762         d_quad="$undef"
5763         ;;
5764 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5765         d_quad="$define"
5766         ;;
5767 esac
5768
5769 : Do we want 64bit support
5770 case "$uselonglong" in
5771 "$define"|true|[yY]*)
5772         cat <<EOM >&4
5773
5774 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5775 EOM
5776         use64bitint="$define"
5777         ;;
5778 esac
5779 case "$use64bits" in
5780 "$define"|true|[yY]*)
5781         cat <<EOM >&4
5782
5783 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5784 EOM
5785         use64bitint="$define"
5786         ;;
5787 esac
5788 case "$use64bitints" in
5789 "$define"|true|[yY]*)
5790         cat <<EOM >&4
5791
5792 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5793 EOM
5794         use64bitint="$define"
5795         ;;
5796 esac
5797 case "$use64bitsint" in
5798 "$define"|true|[yY]*)
5799         cat <<EOM >&4
5800
5801 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5802 EOM
5803         use64bitint="$define"
5804         ;;
5805 esac
5806 case "$uselonglongs" in
5807 "$define"|true|[yY]*)
5808         cat <<EOM >&4
5809
5810 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5811 EOM
5812         use64bitint="$define"
5813         ;;
5814 esac
5815 case "$use64bitsall" in
5816 "$define"|true|[yY]*)
5817         cat <<EOM >&4
5818
5819 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5820 EOM
5821         use64bitall="$define"
5822         ;;
5823 esac
5824
5825 case "$ccflags" in
5826 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5827 esac
5828 case "$use64bitall" in
5829 "$define"|true|[yY]*) use64bitint="$define" ;;
5830 esac
5831
5832 case "$longsize" in
5833 8) cat <<EOM
5834
5835 You have natively 64-bit long integers.
5836 EOM
5837    val="$define"
5838    ;;
5839 *) case "$use64bitint" in
5840    "$define"|true|[yY]*) dflt='y';;
5841    *) dflt='n';;
5842    esac
5843    case "$d_quad" in
5844    "$define") ;;
5845    *) dflt='n' ;;
5846    esac
5847    cat <<EOM
5848
5849 Perl can be built to take advantage of 64-bit integer types
5850 on some systems.  To do so, Configure can be run with -Duse64bitint.
5851 Choosing this option will most probably introduce binary incompatibilities.
5852
5853 If this doesn't make any sense to you, just accept the default '$dflt'.
5854 (The default has been chosen based on your configuration.)
5855 EOM
5856    rp='Try to use 64-bit integers, if available?'
5857    . ./myread
5858    case "$ans" in
5859    [yY]*) val="$define" ;;
5860    *)     val="$undef"  ;;
5861    esac
5862    ;;
5863 esac
5864 set use64bitint
5865 eval $setvar
5866
5867 case "$use64bitall" in
5868 "$define"|true|[yY]*) dflt='y' ;;
5869 *) case "$longsize" in
5870    8) dflt='y' ;;
5871    *) dflt='n' ;;
5872    esac
5873    ;;
5874 esac
5875 cat <<EOM
5876
5877 You may also choose to try maximal 64-bitness.  It means using as much
5878 64-bitness as possible on the platform.  This in turn means even more
5879 binary incompatibilities.  On the other hand, your platform may not
5880 have any more 64-bitness available than what you already have chosen.
5881
5882 If this doesn't make any sense to you, just accept the default '$dflt'.
5883 (The default has been chosen based on your configuration.)
5884 EOM
5885 rp='Try to use maximal 64-bit support, if available?'
5886 . ./myread
5887 case "$ans" in
5888 [yY]*) val="$define" ;;
5889 *)     val="$undef"  ;;
5890 esac
5891 set use64bitall
5892 eval $setvar
5893 case "$use64bitall" in
5894 "$define")
5895         case "$use64bitint" in
5896         "$undef")
5897                 cat <<EOM
5898
5899 Since you have chosen a maximally 64-bit build, I'm also turning on
5900 the use of 64-bit integers.
5901 EOM
5902                 use64bitint="$define" ;;
5903         esac
5904         ;;
5905 esac
5906
5907 : Look for a hint-file generated 'call-back-unit'.  If the
5908 : user has specified that a 64-bit perl is to be built,
5909 : we may need to set or change some other defaults.
5910 if $test -f use64bitint.cbu; then
5911         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5912         . ./use64bitint.cbu
5913 fi
5914 case "$use64bitint" in
5915 "$define"|true|[yY]*)
5916         case "$longsize" in
5917         4) case "$archname64" in
5918            '') archname64=64int ;;
5919            esac
5920            ;;
5921         esac
5922         ;;
5923 esac
5924
5925 : Look for a hint-file generated 'call-back-unit'.  If the
5926 : user has specified that a maximally 64-bit perl is to be built,
5927 : we may need to set or change some other defaults.
5928 if $test -f use64bitall.cbu; then
5929         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5930         . ./use64bitall.cbu
5931 fi
5932 case "$use64bitall" in
5933 "$define"|true|[yY]*)
5934         case "$longsize" in
5935         4) case "$archname64" in
5936            ''|64int) archname64=64all ;;
5937            esac
5938            ;;
5939         esac
5940         ;;
5941 esac
5942
5943 case "$d_quad:$use64bitint" in
5944 $undef:$define)
5945         cat >&4 <<EOF
5946
5947 *** You have chosen to use 64-bit integers,
5948 *** but none can be found.
5949 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5950 *** Cannot continue, aborting.
5951
5952 EOF
5953         exit 1
5954         ;;
5955 esac
5956
5957 : check for length of double
5958 echo " "
5959 case "$doublesize" in
5960 '')
5961         echo "Checking to see how big your double precision numbers are..." >&4
5962         $cat >try.c <<EOCP
5963 #include <stdio.h>
5964 #$i_stdlib I_STDLIB
5965 #ifdef I_STDLIB
5966 #include <stdlib.h>
5967 #endif
5968 int main()
5969 {
5970     printf("%d\n", (int)sizeof(double));
5971     exit(0);
5972 }
5973 EOCP
5974         set try
5975         if eval $compile_ok; then
5976                 doublesize=`$run ./try`
5977                 echo "Your double is $doublesize bytes long."
5978         else
5979                 dflt='8'
5980                 echo "(I can't seem to compile the test program.  Guessing...)"
5981                 rp="What is the size of a double precision number (in bytes)?"
5982                 . ./myread
5983                 doublesize="$ans"
5984         fi
5985         ;;
5986 esac
5987 $rm_try
5988
5989 : check for long doubles
5990 echo " "
5991 echo "Checking to see if you have long double..." >&4
5992 echo 'int main() { long double x = 7.0; }' > try.c
5993 set try
5994 if eval $compile; then
5995         val="$define"
5996         echo "You have long double."
5997 else
5998         val="$undef"
5999         echo "You do not have long double."
6000 fi
6001 $rm_try
6002 set d_longdbl
6003 eval $setvar
6004
6005 : check for length of long double
6006 case "${d_longdbl}${longdblsize}" in
6007 $define)
6008         echo " "
6009         echo "Checking to see how big your long doubles are..." >&4
6010         $cat >try.c <<'EOCP'
6011 #include <stdio.h>
6012 int main()
6013 {
6014         printf("%d\n", sizeof(long double));
6015 }
6016 EOCP
6017         set try
6018         set try
6019         if eval $compile; then
6020                 longdblsize=`$run ./try`
6021                 echo "Your long doubles are $longdblsize bytes long."
6022         else
6023                 dflt='8'
6024                 echo " "
6025                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6026                 rp="What is the size of a long double (in bytes)?"
6027                 . ./myread
6028                 longdblsize="$ans"
6029         fi
6030         if $test "X$doublesize" = "X$longdblsize"; then
6031                 echo "That isn't any different from an ordinary double."
6032                 echo "I'll keep your setting anyway, but you may see some"
6033                 echo "harmless compilation warnings."
6034         fi
6035         ;;
6036 esac
6037 $rm_try
6038
6039 : determine the architecture name
6040 echo " "
6041 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6042         tarch=`arch`"-$osname"
6043 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6044         if uname -m > tmparch 2>&1 ; then
6045                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6046                         -e 's/$/'"-$osname/" tmparch`
6047         else
6048                 tarch="$osname"
6049         fi
6050         $rm -f tmparch
6051 else
6052         tarch="$osname"
6053 fi
6054 case "$myarchname" in
6055 ''|"$tarch") ;;
6056 *)
6057         echo "(Your architecture name used to be $myarchname.)"
6058         archname=''
6059         ;;
6060 esac
6061 case "$targetarch" in
6062 '') ;;
6063 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6064 esac
6065 myarchname="$tarch"
6066 case "$archname" in
6067 '') dflt="$tarch";;
6068 *) dflt="$archname";;
6069 esac
6070 rp='What is your architecture name'
6071 . ./myread
6072 archname="$ans"
6073 case "$usethreads" in
6074 $define)
6075         echo "Threads selected." >&4
6076         case "$archname" in
6077         *-thread*) echo "...and architecture name already has -thread." >&4
6078                 ;;
6079         *)      archname="$archname-thread"
6080                 echo "...setting architecture name to $archname." >&4
6081                 ;;
6082         esac
6083         ;;
6084 esac
6085 case "$usemultiplicity" in
6086 $define)
6087         echo "Multiplicity selected." >&4
6088         case "$archname" in
6089         *-multi*) echo "...and architecture name already has -multi." >&4
6090                 ;;
6091         *)      archname="$archname-multi"
6092                 echo "...setting architecture name to $archname." >&4
6093                 ;;
6094         esac
6095         ;;
6096 esac
6097 case "$use64bitint$use64bitall" in
6098 *"$define"*)
6099         case "$archname64" in
6100         '')
6101                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6102                 ;;
6103         *)
6104                 case "$use64bitint" in
6105                 "$define") echo "64 bit integers selected." >&4 ;;
6106                 esac
6107                 case "$use64bitall" in
6108                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6109                 esac
6110                 case "$archname" in
6111                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6112                         ;;
6113                 *)      archname="$archname-$archname64"
6114                         echo "...setting architecture name to $archname." >&4
6115                         ;;
6116                 esac
6117                 ;;
6118         esac
6119 esac
6120 case "$uselongdouble" in
6121 $define)
6122         echo "Long doubles selected." >&4
6123         case "$longdblsize" in
6124         $doublesize)
6125                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6126                 ;;
6127         *)
6128                 case "$archname" in
6129                 *-ld*) echo "...and architecture name already has -ld." >&4
6130                         ;;
6131                 *)      archname="$archname-ld"
6132                         echo "...setting architecture name to $archname." >&4
6133                         ;;
6134                 esac
6135                 ;;
6136         esac
6137         ;;
6138 esac
6139 case "$useperlio" in
6140 $define)
6141         echo "Perlio selected." >&4
6142         ;;
6143 *)
6144         echo "Perlio not selected, using stdio." >&4
6145         case "$archname" in
6146         *-stdio*) echo "...and architecture name already has -stdio." >&4
6147                 ;;
6148         *)      archname="$archname-stdio"
6149                 echo "...setting architecture name to $archname." >&4
6150                 ;;
6151         esac
6152         ;;
6153 esac
6154 if $test -f archname.cbu; then
6155         echo "Your platform has some specific hints for architecture name, using them..."
6156         . ./archname.cbu
6157 fi
6158
6159 : set the prefixit variable, to compute a suitable default value
6160 prefixit='case "$3" in
6161 ""|none)
6162         case "$oldprefix" in
6163         "") eval "$1=\"\$$2\"";;
6164         *)
6165                 case "$3" in
6166                 "") eval "$1=";;
6167                 none)
6168                         eval "tp=\"\$$2\"";
6169                         case "$tp" in
6170                         ""|" ") eval "$1=\"\$$2\"";;
6171                         *) eval "$1=";;
6172                         esac;;
6173                 esac;;
6174         esac;;
6175 *)
6176         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6177         case "$tp" in
6178         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6179         /*-$oldprefix/*|\~*-$oldprefix/*)
6180                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6181         *) eval "$1=\"\$$2\"";;
6182         esac;;
6183 esac'
6184
6185 : determine installation style
6186 : For now, try to deduce it from prefix unless it is already set.
6187 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6188 case "$installstyle" in
6189 '')     case "$prefix" in
6190                 *perl*) dflt='lib';;
6191                 *) dflt='lib/perl5' ;;
6192         esac
6193         ;;
6194 *)      dflt="$installstyle" ;;
6195 esac
6196 : Probably not worth prompting for this since we prompt for all
6197 : the directories individually, and the prompt would be too long and
6198 : confusing anyway.
6199 installstyle=$dflt
6200
6201 : determine where public executables go
6202 echo " "
6203 set dflt bin bin
6204 eval $prefixit
6205 fn=d~
6206 rp='Pathname where the public executables will reside?'
6207 . ./getfile
6208 if $test "X$ansexp" != "X$binexp"; then
6209         installbin=''
6210 fi
6211 prefixvar=bin
6212 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6213 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6214 :     this via initialinstalllocation
6215 . ./setprefixvar
6216
6217 case "$userelocatableinc" in
6218 $define|true|[yY]*)     dflt='y' ;;
6219 *)                      dflt='n' ;;
6220 esac
6221 cat <<EOM
6222
6223 Would you like to build Perl so that the installation is relocatable, so that
6224 library paths in @INC are determined relative to the path of the perl binary?
6225 This is not advised for system Perl installs, or if you need to run setid
6226 scripts or scripts under taint mode.
6227
6228 If this doesn't make any sense to you, just accept the default '$dflt'.
6229 EOM
6230 rp='Use relocatable @INC?'
6231 . ./myread
6232 case "$ans" in
6233 y|Y)    val="$define" ;;
6234 *)      val="$undef"  ;;
6235 esac
6236 set userelocatableinc
6237 eval $setvar
6238
6239 initialinstalllocation="$binexp"
6240 : Default prefix is now "up one level from where the binaries are"
6241 case "$userelocatableinc" in
6242 $define|true|[yY]*)
6243     bin=".../"
6244     binexp=".../"
6245     prefix=".../.."
6246     prefixexp=".../.."
6247     installprefixexp=".../.."
6248     ;;
6249 esac
6250
6251 : determine where private library files go
6252 : Usual default is /usr/local/lib/perl5/$version.
6253 : Also allow things like /opt/perl/lib/$version, since
6254 : /opt/perl/lib/perl5... would be redundant.
6255 : The default "style" setting is made in installstyle.U
6256 case "$installstyle" in
6257 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6258 *)       set dflt privlib lib/$version ;;
6259 esac
6260 eval $prefixit
6261 $cat <<EOM
6262
6263 There are some auxiliary files for $package that need to be put into a
6264 private library directory that is accessible by everyone.
6265
6266 EOM
6267 fn=$binexp
6268 fn=d~+
6269 rp='Pathname where the private library files will reside?'
6270 . ./getfile
6271 prefixvar=privlib
6272 . ./setprefixvar
6273
6274 : set the prefixup variable, to restore leading tilda escape
6275 prefixup='case "$prefixexp" in
6276 "$prefix") ;;
6277 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6278 esac'
6279
6280 : determine where public architecture dependent libraries go
6281 set archlib archlib
6282 eval $prefixit
6283 : privlib default is /usr/local/lib/$package/$version
6284 : archlib default is /usr/local/lib/$package/$version/$archname
6285 : privlib may have an optional trailing /share.
6286 tdflt=`echo $privlib | $sed 's,/share$,,'`
6287 tdflt=$tdflt/$archname
6288 case "$archlib" in
6289 '')     dflt=$tdflt
6290         ;;
6291 *)      dflt="$archlib"
6292     ;;
6293 esac
6294 $cat <<EOM
6295
6296 $spackage contains architecture-dependent library files.  If you are
6297 sharing libraries in a heterogeneous environment, you might store
6298 these files in a separate location.  Otherwise, you can just include
6299 them with the rest of the public library files.
6300
6301 EOM
6302 fn=$binexp
6303 fn=d+~
6304 rp='Where do you want to put the public architecture-dependent libraries?'
6305 . ./getfile
6306 prefixvar=archlib
6307 . ./setprefixvar
6308 if $test X"$archlib" = X"$privlib"; then
6309         d_archlib="$undef"
6310 else
6311         d_archlib="$define"
6312 fi
6313
6314 : see if setuid scripts can be secure
6315 $cat <<EOM
6316
6317 Some kernels have a bug that prevents setuid #! scripts from being
6318 secure.  Some sites have disabled setuid #! scripts because of this.
6319
6320 First let's decide if your kernel supports secure setuid #! scripts.
6321 (If setuid #! scripts would be secure but have been disabled anyway,
6322 don't say that they are secure if asked.)
6323
6324 EOM
6325
6326 val="$undef"
6327 if $test -d /dev/fd; then
6328         echo "#!$ls" >reflect
6329         chmod +x,u+s reflect
6330         ./reflect >flect 2>&1
6331         if $contains "/dev/fd" flect >/dev/null; then
6332                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6333                 val="$define"
6334         else
6335                 $cat <<EOM
6336 If you are not sure if they are secure, I can check but I'll need a
6337 username and password different from the one you are using right now.
6338 If you don't have such a username or don't want me to test, simply
6339 enter 'none'.
6340
6341 EOM
6342                 rp='Other username to test security of setuid scripts with?'
6343                 dflt='none'
6344                 . ./myread
6345                 case "$ans" in
6346                 n|none)
6347                         case "$d_suidsafe" in
6348                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6349                                 dflt=n;;
6350                         "$undef")
6351                                 echo "Well, the $hint value is *not* secure." >&4
6352                                 dflt=n;;
6353                         *)      echo "Well, the $hint value *is* secure." >&4
6354                                 dflt=y;;
6355                         esac
6356                         ;;
6357                 *)
6358                         $rm -f reflect flect
6359                         echo "#!$ls" >reflect
6360                         chmod +x,u+s reflect
6361                         echo >flect
6362                         chmod a+w flect
6363                         echo '"su" will (probably) prompt you for '"$ans's password."
6364                         su $ans -c './reflect >flect'
6365                         if $contains "/dev/fd" flect >/dev/null; then
6366                                 echo "Okay, it looks like setuid scripts are secure." >&4
6367                                 dflt=y
6368                         else
6369                                 echo "I don't think setuid scripts are secure." >&4
6370                                 dflt=n
6371                         fi
6372                         ;;
6373                 esac
6374                 rp='Does your kernel have *secure* setuid scripts?'
6375                 . ./myread
6376                 case "$ans" in
6377                 [yY]*)  val="$define";;
6378                 *)      val="$undef";;
6379                 esac
6380         fi
6381 else
6382         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6383         echo "(That's for file descriptors, not floppy disks.)"
6384         val="$undef"
6385 fi
6386 set d_suidsafe
6387 eval $setvar
6388
6389 $rm -f reflect flect
6390
6391 : now see if they want to do setuid emulation
6392 if $test $patchlevel -lt 11; then
6393 echo " "
6394 val="$undef"
6395 case "$d_suidsafe" in
6396 "$define")
6397         val="$undef"
6398         echo "No need to emulate SUID scripts since they are secure here." >&4
6399         ;;
6400 *)
6401         $cat <<EOM
6402 Some systems have disabled setuid scripts, especially systems where
6403 setuid scripts cannot be secure.  On systems where setuid scripts have
6404 been disabled, the setuid/setgid bits on scripts are currently
6405 useless.  It is possible for $package to detect those bits and emulate
6406 setuid/setgid in a secure fashion.  This emulation will only work if
6407 setuid scripts have been disabled in your kernel.
6408
6409 EOM
6410         case "$d_dosuid" in
6411         "$define") dflt=y ;;
6412         *) dflt=n ;;
6413         esac
6414         rp="Do you want to do setuid/setgid emulation?"
6415         . ./myread
6416         case "$ans" in
6417         [yY]*)  val="$define";;
6418         *)      val="$undef";;
6419         esac
6420         ;;
6421 esac
6422 set d_dosuid
6423 eval $setvar
6424 else
6425     case "$d_dosuid" in
6426         "$define")
6427         cat >&4 <<EOH
6428
6429 SUID emulation has been removed for 5.12
6430 Please re-run Configure without -Dd_dosuid
6431
6432 EOH
6433         exit 1;
6434         ;;
6435     esac
6436     d_dosuid=undef
6437 fi
6438
6439 : Find perl5.005 or later.
6440 echo "Looking for a previously installed perl5.005 or later... "
6441 case "$perl5" in
6442 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6443                 : Check if this perl is recent and can load a simple module
6444                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6445                         perl5=$tdir/perl
6446                         break;
6447                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6448                         perl5=$tdir/perl5
6449                         break;
6450                 fi
6451         done
6452         ;;
6453 *)      perl5="$perl5"
6454         ;;
6455 esac
6456 case "$perl5" in
6457 '')     echo "None found.  That's ok.";;
6458 *)      echo "Using $perl5." ;;
6459 esac
6460
6461 : Set the siteprefix variables
6462 $cat <<EOM
6463
6464 After $package is installed, you may wish to install various
6465 add-on modules and utilities.  Typically, these add-ons will
6466 be installed under $prefix with the rest
6467 of this package.  However, you may wish to install such add-ons
6468 elsewhere under a different prefix.
6469
6470 If you do not wish to put everything under a single prefix, that's
6471 ok.  You will be prompted for the individual locations; this siteprefix
6472 is only used to suggest the defaults.
6473
6474 The default should be fine for most people.
6475
6476 EOM
6477 fn=d~+
6478 rp='Installation prefix to use for add-on modules and utilities?'
6479 : XXX Here might be another good place for an installstyle setting.
6480 case "$siteprefix" in
6481 '') dflt=$prefix ;;
6482 *)  dflt=$siteprefix ;;
6483 esac
6484 . ./getfile
6485 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6486 oldsiteprefix=''
6487 case "$siteprefix" in
6488 '') ;;
6489 *)      case "$ans" in
6490         "$prefix") ;;
6491         *) oldsiteprefix="$prefix";;
6492         esac
6493         ;;
6494 esac
6495 siteprefix="$ans"
6496 siteprefixexp="$ansexp"
6497
6498 : determine where site specific libraries go.
6499 : Usual default is /usr/local/lib/perl5/site_perl/$version
6500 : The default "style" setting is made in installstyle.U
6501 : XXX No longer works with Prefixit stuff.
6502 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6503 case "$sitelib" in
6504 '') case "$installstyle" in
6505         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6506         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6507         esac
6508         ;;
6509 *)      dflt="$sitelib"
6510         ;;
6511 esac
6512 $cat <<EOM
6513
6514 The installation process will create a directory for
6515 site-specific extensions and modules.  Most users find it convenient
6516 to place all site-specific files in this directory rather than in the
6517 main distribution directory.
6518
6519 EOM
6520 fn=d~+
6521 rp='Pathname for the site-specific library files?'
6522 . ./getfile
6523 prefixvar=sitelib
6524 . ./setprefixvar
6525 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6526
6527 : Determine list of previous versions to include in @INC
6528 $cat > getverlist <<EOPL
6529 #!$perl5 -w
6530 use File::Basename;
6531 \$api_versionstring = "$api_versionstring";
6532 \$version = "$version";
6533 \$stem = "$sitelib_stem";
6534 \$archname = "$archname";
6535 EOPL
6536         $cat >> getverlist <<'EOPL'
6537 # The list found is store twice for each entry: the original name, and
6538 # the binary broken down version as pack "sss", so sorting is easy and
6539 # unambiguous. This will work for all versions that have a maximum of
6540 # three digit groups, separate by '.'s or '_'s. Names are extended with
6541 # ".0.0" to ensure at least three elements for the pack.
6542 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6543
6544 # Can't have leading @ because metaconfig interprets it as a command!
6545 ;@inc_version_list=();
6546 # XXX Redo to do opendir/readdir?
6547 if (-d $stem) {
6548     chdir($stem);
6549     ;@candidates = map {
6550         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6551     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6552 }
6553 else {
6554     ;@candidates = ();
6555 }
6556
6557 ($pversion, $aversion, $vsn5005) = map {
6558     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6559 foreach $d (@candidates) {
6560     if ($d->[1] lt $pversion) {
6561         if ($d->[1] ge $aversion) {
6562             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6563         }
6564         elsif ($d->[1] ge $vsn5005) {
6565             unshift(@inc_version_list, grep { -d } $d->[0]);
6566         }
6567     }
6568     else {
6569         # Skip newer version.  I.e. don't look in
6570         # 5.7.0 if we're installing 5.6.1.
6571     }
6572 }
6573
6574 if (@inc_version_list) {
6575     print join(' ', @inc_version_list);
6576 }
6577 else {
6578     # Blank space to preserve value for next Configure run.
6579     print " ";
6580 }
6581 EOPL
6582 chmod +x getverlist
6583 case "$inc_version_list" in
6584 '')     if test -x "$perl5$exe_ext"; then
6585                 dflt=`$perl5 getverlist`
6586         else
6587                 dflt='none'
6588         fi
6589         ;;
6590 $undef) dflt='none' ;;
6591 *)  eval dflt=\"$inc_version_list\" ;;
6592 esac
6593 case "$dflt" in
6594 ''|' ') dflt=none ;;
6595 esac
6596 case "$dflt" in
6597 5.005) dflt=none ;;
6598 esac
6599 $cat <<EOM
6600
6601 In order to ease the process of upgrading, this version of perl
6602 can be configured to use modules built and installed with earlier
6603 versions of perl that were installed under $prefix.  Specify here
6604 the list of earlier versions that this version of perl should check.
6605 If Configure detected no earlier versions of perl installed under
6606 $prefix, then the list will be empty.  Answer 'none' to tell perl
6607 to not search earlier versions.
6608
6609 The default should almost always be sensible, so if you're not sure,
6610 just accept the default.
6611 EOM
6612
6613 rp='List of earlier versions to include in @INC?'
6614 . ./myread
6615 case "$ans" in
6616 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6617 *) inc_version_list="$ans" ;;
6618 esac
6619 case "$inc_version_list" in
6620 ''|' ')
6621         inc_version_list_init='0'
6622         d_inc_version_list="$undef"
6623         ;;
6624 *)      inc_version_list_init=`echo $inc_version_list |
6625                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6626         d_inc_version_list="$define"
6627         ;;
6628 esac
6629 $rm -f getverlist
6630
6631 : see if malloc/malloc.h has to be included
6632 set malloc/malloc.h i_mallocmalloc
6633 eval $inhdr
6634
6635 : see if this is a malloc.h system
6636 : we want a real compile instead of Inhdr because some systems have a
6637 : malloc.h that just gives a compile error saying to use stdlib.h instead
6638 echo " "
6639 $cat >try.c <<EOCP
6640 #include <stdlib.h>
6641 #include <malloc.h>
6642 #$i_mallocmalloc I_MALLOCMALLOC
6643 #ifdef I_MALLOCMALLOC
6644 # include <malloc/malloc.h>
6645 #endif
6646
6647 int main () { return 0; }
6648 EOCP
6649 set try
6650 if eval $compile; then
6651     echo "<malloc.h> found." >&4
6652     val="$define"
6653 else
6654     echo "<malloc.h> NOT found." >&4
6655     val="$undef"
6656 fi
6657 $rm_try
6658 set i_malloc
6659 eval $setvar
6660
6661 : check for void type
6662 echo " "
6663 echo "Checking to see how well your C compiler groks the void type..." >&4
6664 case "$voidflags" in
6665 '')
6666         $cat >try.c <<EOCP
6667 #$i_stdlib I_STDLIB
6668 #ifdef I_STDLIB
6669 #include <stdlib.h>
6670 #endif
6671 #if TRY & 1
6672 void sub() {
6673 #else
6674 sub() {
6675 #endif
6676         extern void moo();      /* function returning void */
6677         void (*goo)();          /* ptr to func returning void */
6678 #if TRY & 8
6679         void *hue;              /* generic ptr */
6680 #endif
6681 #if TRY & 2
6682         void (*foo[10])();
6683 #endif
6684
6685 #if TRY & 4
6686         if(goo == moo) {
6687                 exit(0);
6688         }
6689 #endif
6690         exit(0);
6691 }
6692 int main() { sub(); }
6693 EOCP
6694         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6695                 voidflags=$defvoidused
6696         echo "Good.  It appears to support void to the level $package wants.">&4
6697                 if $contains warning .out >/dev/null 2>&1; then
6698                         echo "However, you might get some warnings that look like this:"
6699                         $cat .out
6700                 fi
6701         else
6702 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6703                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6704                         echo "It supports 1..."
6705                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6706                                 echo "It also supports 2..."
6707                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6708                                         voidflags=7
6709                                         echo "And it supports 4 but not 8 definitely."
6710                                 else
6711                                         echo "It doesn't support 4..."
6712                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6713                                                 voidflags=11
6714                                                 echo "But it supports 8."
6715                                         else
6716                                                 voidflags=3
6717                                                 echo "Neither does it support 8."
6718                                         fi
6719                                 fi
6720                         else
6721                                 echo "It does not support 2..."
6722                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6723                                         voidflags=13
6724                                         echo "But it supports 4 and 8."
6725                                 else
6726                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6727                                                 voidflags=5
6728                                                 echo "And it supports 4 but has not heard about 8."
6729                                         else
6730                                                 echo "However it supports 8 but not 4."
6731                                         fi
6732                                 fi
6733                         fi
6734                 else
6735                         echo "There is no support at all for void."
6736                         voidflags=0
6737                 fi
6738         fi
6739 esac
6740 case "$voidflags" in
6741 "$defvoidused") ;;
6742 *)      $cat >&4 <<'EOM'
6743   Support flag bits are:
6744     1: basic void declarations.
6745     2: arrays of pointers to functions returning void.
6746     4: operations between pointers to and addresses of void functions.
6747     8: generic void pointers.
6748 EOM
6749         dflt="$voidflags";
6750         rp="Your void support flags add up to what?"
6751         . ./myread
6752         voidflags="$ans"
6753         ;;
6754 esac
6755 $rm_try
6756
6757 : check for length of pointer
6758 echo " "
6759 case "$ptrsize" in
6760 '')
6761         echo "Checking to see how big your pointers are..." >&4
6762         if test "$voidflags" -gt 7; then
6763                 echo '#define VOID_PTR char *' > try.c
6764         else
6765                 echo '#define VOID_PTR void *' > try.c
6766         fi
6767         $cat >>try.c <<EOCP
6768 #include <stdio.h>
6769 #$i_stdlib I_STDLIB
6770 #ifdef I_STDLIB
6771 #include <stdlib.h>
6772 #endif
6773 int main()
6774 {
6775     printf("%d\n", (int)sizeof(VOID_PTR));
6776     exit(0);
6777 }
6778 EOCP
6779         set try
6780         if eval $compile_ok; then
6781                 ptrsize=`$run ./try`
6782                 echo "Your pointers are $ptrsize bytes long."
6783         else
6784                 dflt='4'
6785                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6786                 rp="What is the size of a pointer (in bytes)?"
6787                 . ./myread
6788                 ptrsize="$ans"
6789         fi
6790         ;;
6791 esac
6792 $rm_try
6793 case "$use64bitall" in
6794 "$define"|true|[yY]*)
6795         case "$ptrsize" in
6796         4)      cat <<EOM >&4
6797
6798 *** You have chosen a maximally 64-bit build,
6799 *** but your pointers are only 4 bytes wide.
6800 *** Please rerun Configure without -Duse64bitall.
6801 EOM
6802                 case "$d_quad" in
6803                 define)
6804                         cat <<EOM >&4
6805 *** Since you have quads, you could possibly try with -Duse64bitint.
6806 EOM
6807                         ;;
6808                 esac
6809                 cat <<EOM >&4
6810 *** Cannot continue, aborting.
6811
6812 EOM
6813
6814                 exit 1
6815                 ;;
6816         esac
6817         ;;
6818 esac
6819
6820
6821 : determine whether to use malloc wrapping
6822 echo " "
6823 case "$usemallocwrap" in
6824 [yY]*|true|$define)     dflt='y' ;;
6825 [nN]*|false|$undef)     dflt='n' ;;
6826 *)      case "$usedevel" in
6827         [yY]*|true|$define)     dflt='y' ;;
6828         *) dflt='n' ;;
6829         esac
6830         ;;
6831 esac
6832 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6833 . ./myread
6834 usemallocwrap="$ans"
6835 case "$ans" in
6836 y*|true)
6837         usemallocwrap="$define" ;;
6838 *)
6839         usemallocwrap="$undef" ;;
6840 esac
6841
6842 : determine which malloc to compile in
6843 echo " "
6844 case "$usemymalloc" in
6845 [yY]*|true|$define)     dflt='y' ;;
6846 [nN]*|false|$undef)     dflt='n' ;;
6847 *)      case "$ptrsize" in
6848         4) dflt='y' ;;
6849         *) dflt='n' ;;
6850         esac
6851         ;;
6852 esac
6853 rp="Do you wish to attempt to use the malloc that comes with $package?"
6854 . ./myread
6855 usemymalloc="$ans"
6856 case "$ans" in
6857 y*|true)
6858         usemymalloc='y'
6859         mallocsrc='malloc.c'
6860         mallocobj="malloc$_o"
6861         d_mymalloc="$define"
6862         case "$libs" in
6863         *-lmalloc*)
6864                 : Remove malloc from list of libraries to use
6865                 echo "Removing unneeded -lmalloc from library list" >&4
6866                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6867                 shift
6868                 libs="$*"
6869                 echo "libs = $libs" >&4
6870                 ;;
6871         esac
6872         ;;
6873 *)
6874         usemymalloc='n'
6875         mallocsrc=''
6876         mallocobj=''
6877         d_mymalloc="$undef"
6878         ;;
6879 esac
6880
6881 : compute the return types of malloc and free
6882 echo " "
6883 $cat >malloc.c <<END
6884 #$i_malloc I_MALLOC
6885 #$i_stdlib I_STDLIB
6886 #include <stdio.h>
6887 #include <sys/types.h>
6888 #ifdef I_MALLOC
6889 #include <malloc.h>
6890 #endif
6891 #ifdef I_STDLIB
6892 #include <stdlib.h>
6893 #endif
6894 #ifdef TRY_MALLOC
6895 void *malloc();
6896 #endif
6897 #ifdef TRY_FREE
6898 void free();
6899 #endif
6900 END
6901 case "$malloctype" in
6902 '')
6903         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6904                 malloctype='void *'
6905         else
6906                 malloctype='char *'
6907         fi
6908         ;;
6909 esac
6910 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6911
6912 case "$freetype" in
6913 '')
6914         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6915                 freetype='void'
6916         else
6917                 freetype='int'
6918         fi
6919         ;;
6920 esac
6921 echo "Your system uses $freetype free(), it would seem." >&4
6922 $rm -f malloc.[co]
6923 : determine where site specific architecture-dependent libraries go.
6924 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6925 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6926 : sitelib may have an optional trailing /share.
6927 case "$sitearch" in
6928 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6929         dflt="$dflt/$archname"
6930         ;;
6931 *)      dflt="$sitearch"
6932         ;;
6933 esac
6934 set sitearch sitearch none
6935 eval $prefixit
6936 $cat <<EOM
6937
6938 The installation process will also create a directory for
6939 architecture-dependent site-specific extensions and modules.
6940
6941 EOM
6942 fn=d~+
6943 rp='Pathname for the site-specific architecture-dependent library files?'
6944 . ./getfile
6945 prefixvar=sitearch
6946 . ./setprefixvar
6947 if $test X"$sitearch" = X"$sitelib"; then
6948         d_sitearch="$undef"
6949 else
6950         d_sitearch="$define"
6951 fi
6952
6953 : Set the vendorprefix variables
6954 $cat <<EOM
6955
6956 The installation process will also create a directory for
6957 vendor-supplied add-ons.  Vendors who supply perl with their system
6958 may find it convenient to place all vendor-supplied files in this
6959 directory rather than in the main distribution directory.  This will
6960 ease upgrades between binary-compatible maintenance versions of perl.
6961
6962 Of course you may also use these directories in whatever way you see
6963 fit.  For example, you might use them to access modules shared over a
6964 company-wide network.
6965
6966 The default answer should be fine for most people.
6967 This causes further questions about vendor add-ons to be skipped
6968 and no vendor-specific directories will be configured for perl.
6969
6970 EOM
6971 rp='Do you want to configure vendor-specific add-on directories?'
6972 case "$usevendorprefix" in
6973 define|true|[yY]*) dflt=y ;;
6974 *)      : User may have set vendorprefix directly on Configure command line.
6975         case "$vendorprefix" in
6976         ''|' ') dflt=n ;;
6977         *)      dflt=y ;;
6978         esac
6979         ;;
6980 esac
6981 . ./myread
6982 case "$ans" in
6983 [yY]*)  fn=d~+
6984         rp='Installation prefix to use for vendor-supplied add-ons?'
6985         case "$vendorprefix" in
6986         '') dflt='' ;;
6987         *)  dflt=$vendorprefix ;;
6988         esac
6989         . ./getfile
6990         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6991         oldvendorprefix=''
6992         case "$vendorprefix" in
6993         '') ;;
6994         *)      case "$ans" in
6995                 "$prefix") ;;
6996                 *) oldvendorprefix="$prefix";;
6997                 esac
6998                 ;;
6999         esac
7000         usevendorprefix="$define"
7001         vendorprefix="$ans"
7002         vendorprefixexp="$ansexp"
7003         ;;
7004 *)      usevendorprefix="$undef"
7005         vendorprefix=''
7006         vendorprefixexp=''
7007         ;;
7008 esac
7009
7010 : Set the vendorlib variables
7011 case "$vendorprefix" in
7012 '')     d_vendorlib="$undef"
7013         vendorlib=''
7014         vendorlibexp=''
7015         ;;
7016 *)      d_vendorlib="$define"
7017         : determine where vendor-supplied modules go.
7018         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7019         case "$vendorlib" in
7020         '')
7021                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7022                 case "$installstyle" in
7023                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7024                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7025                 esac
7026                 ;;
7027         *)      dflt="$vendorlib"
7028                 ;;
7029         esac
7030         fn=d~+
7031         rp='Pathname for the vendor-supplied library files?'
7032         . ./getfile
7033         vendorlib="$ans"
7034         vendorlibexp="$ansexp"
7035         ;;
7036 esac
7037 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7038 prefixvar=vendorlib
7039 . ./installprefix
7040
7041 : Set the vendorarch variables
7042 case "$vendorprefix" in
7043 '')     d_vendorarch="$undef"
7044         vendorarch=''
7045         vendorarchexp=''
7046         ;;
7047 *)      d_vendorarch="$define"
7048         : determine where vendor-supplied architecture-dependent libraries go.
7049         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7050         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7051         : vendorlib may have an optional trailing /share.
7052         case "$vendorarch" in
7053         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7054                 dflt="$dflt/$archname"
7055                 ;;
7056         *)      dflt="$vendorarch" ;;
7057         esac
7058         fn=d~+
7059         rp='Pathname for vendor-supplied architecture-dependent files?'
7060         . ./getfile
7061         vendorarch="$ans"
7062         vendorarchexp="$ansexp"
7063         ;;
7064 esac
7065 prefixvar=vendorarch
7066 . ./installprefix
7067 if $test X"$vendorarch" = X"$vendorlib"; then
7068         d_vendorarch="$undef"
7069 else
7070         d_vendorarch="$define"
7071 fi
7072
7073 : Final catch-all directories to search
7074 $cat <<EOM
7075
7076 Lastly, you can have perl look in other directories for extensions and
7077 modules in addition to those already specified.
7078 These directories will be searched after 
7079         $sitearch 
7080         $sitelib 
7081 EOM
7082 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7083 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7084 echo ' '
7085 case "$otherlibdirs" in
7086 ''|' ') dflt='none' ;;
7087 *)      dflt="$otherlibdirs" ;;
7088 esac
7089 $cat <<EOM
7090 Enter a colon-separated set of extra paths to include in perl's @INC
7091 search path, or enter 'none' for no extra paths.
7092
7093 EOM
7094
7095 rp='Colon-separated list of additional directories for perl to search?'
7096 . ./myread
7097 case "$ans" in
7098 ' '|''|none)    otherlibdirs=' ' ;;     
7099 *)      otherlibdirs="$ans" ;;
7100 esac
7101 case "$otherlibdirs" in
7102 ' ') val=$undef ;;
7103 *)      val=$define ;;
7104 esac
7105 set d_perl_otherlibdirs
7106 eval $setvar
7107
7108 : Cruising for prototypes
7109 echo " "
7110 echo "Checking out function prototypes..." >&4
7111 $cat >prototype.c <<EOCP
7112 #$i_stdlib I_STDLIB
7113 #ifdef I_STDLIB
7114 #include <stdlib.h>
7115 #endif
7116 int main(int argc, char *argv[]) {
7117         exit(0);}
7118 EOCP
7119 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7120         echo "Your C compiler appears to support function prototypes."
7121         val="$define"
7122 else
7123         echo "Your C compiler doesn't seem to understand function prototypes."
7124         val="$undef"
7125 fi
7126 set prototype
7127 eval $setvar
7128 $rm -f prototype*
7129
7130 : Check if ansi2knr is required
7131 case "$prototype" in
7132 "$define") ;;
7133 *)      ansi2knr='ansi2knr'
7134         echo " "
7135         cat <<EOM >&4
7136
7137 $me:  FATAL ERROR:
7138 This version of $package can only be compiled by a compiler that 
7139 understands function prototypes.  Unfortunately, your C compiler 
7140         $cc $ccflags
7141 doesn't seem to understand them.  Sorry about that.
7142
7143 If GNU cc is available for your system, perhaps you could try that instead.  
7144
7145 Eventually, we hope to support building Perl with pre-ANSI compilers.
7146 If you would like to help in that effort, please contact <perlbug@perl.org>.
7147
7148 Aborting Configure now.
7149 EOM
7150         exit 2
7151         ;;
7152 esac
7153
7154 : DTrace support
7155 dflt_dtrace='/usr/sbin/dtrace'
7156 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7157
7158 cat <<EOM
7159
7160 Perl can be built to support DTrace on platforms that support it.
7161 DTrace is a diagnosis and performance analysis tool from Sun.
7162
7163 If this doesn't make any sense to you, just accept the default '$dflt'.
7164 EOM
7165
7166 while $test 1 ; do
7167         case "$usedtrace" in
7168         $define|true|[yY]*)
7169                 dflt='y'
7170                 ;;
7171         ?*)
7172                 dflt='y'
7173                 dflt_dtrace=$usedtrace
7174                 ;;
7175         *)
7176                 dflt='n'
7177                 ;;
7178         esac
7179
7180         rp='Support DTrace if available?'
7181         . ./myread
7182         case "$ans" in
7183         y|Y)    val="$define" ;;
7184         *)      val="$undef" ;;
7185         esac
7186         set usedtrace
7187         eval $setvar
7188
7189         test "X$usedtrace" != "X$define" && break
7190
7191         echo " "
7192         rp='Where is the dtrace executable?'
7193         dflt=$dflt_dtrace
7194         . ./getfile
7195         val="$ans"
7196         set dtrace
7197         eval $setvar
7198
7199         if $test -f $dtrace
7200         then
7201                 if $dtrace -h -s ../perldtrace.d \
7202                         -o perldtrace.tmp >/dev/null 2>&1 \
7203                         && rm -f perldtrace.tmp
7204                 then
7205                         echo " "
7206                         echo "Good: your $dtrace knows about the -h flag."
7207                 else
7208                         cat >&2 <<EOM
7209
7210 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7211 ***
7212 *** Your installed dtrace doesn't support the -h switch to compile a D
7213 *** program into a C header. Can't continue.
7214
7215 EOM
7216                         exit 1
7217                 fi
7218                 break;
7219         fi
7220
7221         case "$fastread" in
7222         yes)
7223                 cat >&2 <<EOM
7224
7225 *** $me:  Fatal Error:  $dtrace not found.
7226 *** Can't continue.
7227
7228 EOM
7229                 exit 1
7230                 ;;
7231         *)
7232                 echo "*** $dtrace was not found."
7233                 echo " "
7234                 ;;
7235         esac
7236 done
7237
7238 : See if we want extra modules installed
7239 echo " "
7240 case "$extras" in
7241 '') dflt='n';;
7242 *) dflt='y';;
7243 esac
7244 cat <<EOM
7245 Perl can be built with extra modules or bundles of modules which
7246 will be fetched from the CPAN and installed alongside Perl.
7247
7248 Notice that you will need access to the CPAN; either via the Internet,
7249 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7250 be asked later to configure the CPAN.pm module which will in turn do
7251 the installation of the rest of the extra modules or bundles.)
7252
7253 Notice also that if the modules require any external software such as
7254 libraries and headers (the libz library and the zlib.h header for the
7255 Compress::Zlib module, for example) you MUST have any such software
7256 already installed, this configuration process will NOT install such
7257 things for you.
7258
7259 If this doesn't make any sense to you, just accept the default '$dflt'.
7260 EOM
7261 rp='Install any extra modules (y or n)?'
7262 . ./myread
7263 case "$ans" in
7264 y|Y)
7265         cat <<EOM
7266
7267 Please list any extra modules or bundles to be installed from CPAN,
7268 with spaces between the names.  The names can be in any format the
7269 'install' command of CPAN.pm will understand.  (Answer 'none',
7270 without the quotes, to install no extra modules or bundles.)
7271 EOM
7272         rp='Extras?'
7273         dflt="$extras"
7274         . ./myread
7275         extras="$ans"
7276 esac
7277 case "$extras" in
7278 ''|'none')
7279         val=''
7280         $rm -f ../extras.lst
7281         ;;
7282 *)      echo "(Saving the list of extras for later...)"
7283         echo "$extras" > ../extras.lst
7284         val="'$extras'"
7285         ;;
7286 esac
7287 set extras
7288 eval $setvar
7289 echo " "
7290
7291 : determine where html pages for programs go
7292 set html1dir html1dir none
7293 eval $prefixit
7294 $cat <<EOM
7295
7296 If you wish to install html files for programs in $spackage, indicate
7297 the appropriate directory here.  To skip installing html files,
7298 answer "none".
7299 EOM
7300 case "$html1dir" in
7301 ''|none|$undef|' ') dflt=none ;;
7302 *) dflt=$html1dir ;;
7303 esac
7304 fn=dn+~
7305 rp="Directory for the main $spackage html pages?"
7306 . ./getfile
7307 prefixvar=html1dir
7308 . ./setprefixvar
7309 : Use ' ' for none so value is preserved next time through Configure
7310 $test X"$html1dir" = "X" && html1dir=' '
7311
7312 : determine where html pages for libraries and modules go
7313 set html3dir html3dir none
7314 eval $prefixit
7315 $cat <<EOM
7316
7317 If you wish to install html files for modules associated with $spackage,
7318 indicate the appropriate directory here.  To skip installing html files,
7319 answer "none".
7320 EOM
7321 : There is no obvious default.  If they have specified html1dir, then
7322 : try to key off that, possibly changing .../html1 into .../html3.
7323 case "$html3dir" in
7324 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7325 *) dflt=$html3dir ;;
7326 esac
7327 fn=dn+~
7328 rp="Directory for the $spackage module html pages?"
7329 . ./getfile
7330 prefixvar=html3dir
7331 . ./setprefixvar
7332 : Use ' ' for none so value is preserved next time through Configure
7333 $test X"$html3dir" = "X" && html3dir=' '
7334
7335 : determine whether to install perl also as /usr/bin/perl
7336
7337 echo " "
7338 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7339         $cat <<EOM
7340 Many scripts expect perl to be installed as /usr/bin/perl.
7341
7342 If you want to, I can install the perl you are about to compile
7343 as /usr/bin/perl (in addition to $bin/perl).
7344 EOM
7345         if test -f /usr/bin/perl; then
7346             $cat <<EOM
7347
7348 However, please note that because you already have a /usr/bin/perl,
7349 overwriting that with a new Perl would very probably cause problems.
7350 Therefore I'm assuming you don't want to do that (unless you insist).
7351
7352 EOM
7353             case "$installusrbinperl" in
7354             "$define"|[yY]*)    dflt='y';;
7355             *)                  dflt='n';;
7356             esac
7357         else
7358             $cat <<EOM
7359
7360 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7361
7362 EOM
7363             case "$installusrbinperl" in
7364             "$undef"|[nN]*)     dflt='n';;
7365             *)                  dflt='y';;
7366             esac
7367         fi
7368         rp="Do you want to install perl as /usr/bin/perl?"
7369         . ./myread
7370         case "$ans" in
7371         [yY]*)  val="$define";;
7372         *)      val="$undef" ;;
7373         esac
7374 else
7375         val="$undef"
7376 fi
7377 set installusrbinperl
7378 eval $setvar
7379
7380 : Check if we are using the GNU C library
7381 echo " "
7382 echo "Checking for GNU C Library..." >&4
7383 cat >try.c <<'EOCP'
7384 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7385    alone are insufficient to distinguish different versions, such as
7386    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7387    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7388 */
7389 #include <stdio.h>
7390 int main(void)
7391 {
7392 #ifdef __GLIBC__
7393 #   ifdef __GLIBC_MINOR__
7394 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7395 #           include <gnu/libc-version.h>
7396             printf("%s\n",  gnu_get_libc_version());
7397 #       else
7398             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7399 #       endif
7400 #   else
7401         printf("%d\n",  __GLIBC__);
7402 #   endif
7403     return 0;
7404 #else
7405     return 1;
7406 #endif
7407 }
7408 EOCP
7409 set try
7410 if eval $compile_ok && $run ./try > glibc.ver; then
7411         val="$define"
7412         gnulibc_version=`$cat glibc.ver`
7413         echo "You are using the GNU C Library version $gnulibc_version"
7414 else
7415         val="$undef"
7416         gnulibc_version=''
7417         echo "You are not using the GNU C Library"
7418 fi
7419 $rm_try glibc.ver
7420 set d_gnulibc
7421 eval $setvar
7422
7423 : see if nm is to be used to determine whether a symbol is defined or not
7424 case "$usenm" in
7425 '')
7426         dflt=''
7427         case "$d_gnulibc" in
7428         "$define")
7429                 echo " "
7430                 echo "nm probably won't work on the GNU C Library." >&4
7431                 dflt=n
7432                 ;;
7433         esac
7434         case "$dflt" in
7435         '') 
7436                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7437                         echo " "
7438                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7439                         echo "'nm' won't be sufficient on this sytem." >&4
7440                         dflt=n
7441                 fi
7442                 ;;
7443         esac
7444         case "$dflt" in
7445         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7446                 if $test $dflt -gt 20; then
7447                         dflt=y
7448                 else
7449                         dflt=n
7450                 fi
7451                 ;;
7452         esac
7453         ;;
7454 *)
7455         case "$usenm" in
7456         true|$define) dflt=y;;
7457         *) dflt=n;;
7458         esac
7459         ;;
7460 esac
7461 $cat <<EOM
7462
7463 I can use $nm to extract the symbols from your C libraries. This
7464 is a time consuming task which may generate huge output on the disk (up
7465 to 3 megabytes) but that should make the symbols extraction faster. The
7466 alternative is to skip the 'nm' extraction part and to compile a small
7467 test program instead to determine whether each symbol is present. If
7468 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7469 this may be the best solution.
7470
7471 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7472
7473 EOM
7474 rp="Shall I use $nm to extract C symbols from the libraries?"
7475 . ./myread
7476 case "$ans" in
7477 [Nn]*) usenm=false;;
7478 *) usenm=true;;
7479 esac
7480
7481 runnm=$usenm
7482 case "$reuseval" in
7483 true) runnm=false;;
7484 esac
7485
7486 : nm options which may be necessary
7487 case "$nm_opt" in
7488 '') if $test -f /mach_boot; then
7489                 nm_opt=''       # Mach
7490         elif $test -d /usr/ccs/lib; then
7491                 nm_opt='-p'     # Solaris (and SunOS?)
7492         elif $test -f /dgux; then
7493                 nm_opt='-p'     # DG-UX
7494         elif $test -f /lib64/rld; then
7495                 nm_opt='-p'     # 64-bit Irix
7496         else
7497                 nm_opt=''
7498         fi;;
7499 esac
7500
7501 : nm options which may be necessary for shared libraries but illegal
7502 : for archive libraries.  Thank you, Linux.
7503 case "$nm_so_opt" in
7504 '')     case "$myuname" in
7505         *linux*|gnu*)
7506                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7507                         nm_so_opt='--dynamic'
7508                 fi
7509                 ;;
7510         esac
7511         ;;
7512 esac
7513
7514 : Figure out where the libc is located
7515 case "$runnm" in
7516 true)
7517 : get list of predefined functions in a handy place
7518 echo " "
7519 case "$libc" in
7520 '') libc=unknown
7521         case "$libs" in
7522         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7523         esac
7524         ;;
7525 esac
7526 case "$libs" in
7527 '') ;;
7528 *)  for thislib in $libs; do
7529         case "$thislib" in
7530         -lc|-lc_s)
7531                 : Handle C library specially below.
7532                 ;;
7533         -l*)
7534                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7535                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7536                         :
7537                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7538                         :
7539                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7540                         :
7541                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7542                         :
7543                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7544                         :
7545                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7546                         :
7547                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7548                         :
7549                 else
7550                         try=''
7551                 fi
7552                 libnames="$libnames $try"
7553                 ;;
7554         *) libnames="$libnames $thislib" ;;
7555         esac
7556         done
7557         ;;
7558 esac
7559 xxx=normal
7560 case "$libc" in
7561 unknown)
7562         set /lib/libc.$so
7563         for xxx in $libpth; do
7564                 $test -r $1 || set $xxx/libc.$so
7565                 : The messy sed command sorts on library version numbers.
7566                 $test -r $1 || \
7567                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7568                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7569                                 h
7570                                 s/[0-9][0-9]*/0000&/g
7571                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7572                                 G
7573                                 s/\n/ /' | \
7574                          $sort | $sed -e 's/^.* //'`
7575                 eval set \$$#
7576         done
7577         $test -r $1 || set /usr/ccs/lib/libc.$so
7578         $test -r $1 || set /lib/libsys_s$_a
7579         ;;
7580 *)
7581         set blurfl
7582         ;;
7583 esac
7584 if $test -r "$1"; then
7585         echo "Your (shared) C library seems to be in $1."
7586         libc="$1"
7587 elif $test -r /lib/libc && $test -r /lib/clib; then
7588         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7589         xxx=apollo
7590         libc='/lib/clib /lib/libc'
7591         if $test -r /lib/syslib; then
7592                 echo "(Your math library is in /lib/syslib.)"
7593                 libc="$libc /lib/syslib"
7594         fi
7595 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7596         echo "Your C library seems to be in $libc, as you said before."
7597 elif $test -r $incpath/usr/lib/libc$_a; then
7598         libc=$incpath/usr/lib/libc$_a;
7599         echo "Your C library seems to be in $libc.  That's fine."
7600 elif $test -r /lib/libc$_a; then
7601         libc=/lib/libc$_a;
7602         echo "Your C library seems to be in $libc.  You're normal."
7603 else
7604         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7605                 :
7606         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7607                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7608         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7609                 :
7610         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7611                 :
7612         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7613                 :
7614         else
7615                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7616         fi
7617         if $test -r "$tans"; then
7618                 echo "Your C library seems to be in $tans, of all places."
7619                 libc=$tans
7620         else
7621                 libc='blurfl'
7622         fi
7623 fi
7624 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7625         dflt="$libc"
7626         cat <<EOM
7627
7628 If the guess above is wrong (which it might be if you're using a strange
7629 compiler, or your machine supports multiple models), you can override it here.
7630
7631 EOM
7632 else
7633         dflt=''
7634         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7635         cat >&4 <<EOM
7636 I can't seem to find your C library.  I've looked in the following places:
7637
7638 EOM
7639         $sed 's/^/      /' libpath
7640         cat <<EOM
7641
7642 None of these seems to contain your C library. I need to get its name...
7643
7644 EOM
7645 fi
7646 fn=f
7647 rp='Where is your C library?'
7648 . ./getfile
7649 libc="$ans"
7650
7651 echo " "
7652 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7653 set X `cat libnames`
7654 shift
7655 xxx=files
7656 case $# in 1) xxx=file; esac
7657 echo "Extracting names from the following $xxx for later perusal:" >&4
7658 echo " "
7659 $sed 's/^/      /' libnames >&4
7660 echo " "
7661 $echo $n "This may take a while...$c" >&4
7662
7663 for file in $*; do
7664         case $file in
7665         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7666         *) $nm $nm_opt $file 2>/dev/null;;
7667         esac
7668 done >libc.tmp
7669
7670 $echo $n ".$c"
7671 $grep fprintf libc.tmp > libc.ptf
7672 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7673 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7674 xxx='[ADTSIWi]'
7675 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7676         eval $xscan;\
7677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7678                 eval $xrun
7679 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7680         eval $xscan;\
7681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7682                 eval $xrun
7683 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7684         eval $xscan;\
7685         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7686                 eval $xrun
7687 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7688         eval $xscan;\
7689         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7690                 eval $xrun
7691 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7692         eval $xscan;\
7693         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7694                 eval $xrun
7695 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7696         eval $xscan;\
7697         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7698                 eval $xrun
7699 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7700                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7701         eval $xscan;\
7702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7703                 eval $xrun
7704 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7705         eval $xscan;\
7706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7707                 eval $xrun
7708 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7709         eval $xscan;\
7710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7711                 eval $xrun
7712 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7713         eval $xscan;\
7714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7715                 eval $xrun
7716 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7717         eval $xscan;\
7718         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7719                 eval $xrun
7720 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7721         eval $xscan;\
7722         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7723                 eval $xrun
7724 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7725         eval $xscan;\
7726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7727                 eval $xrun
7728 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7729         eval $xscan;\
7730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7731                 eval $xrun
7732 else
7733         $nm -p $* 2>/dev/null >libc.tmp
7734         $grep fprintf libc.tmp > libc.ptf
7735         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7736                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7737         then
7738                 nm_opt='-p'
7739                 eval $xrun
7740         else
7741                 echo " "
7742                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7743                 com=''
7744                 if $ar t $libc > libc.tmp && \
7745                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7746                 then
7747                         for thisname in $libnames $libc; do
7748                                 $ar t $thisname >>libc.tmp
7749                         done
7750                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7751                         echo "Ok." >&4
7752                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7753                         for thisname in $libnames $libc; do
7754                                 $ar tv $thisname >>libc.tmp
7755                                 emximp -o tmp.imp $thisname \
7756                                     2>/dev/null && \
7757                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7758                                     < tmp.imp >>libc.tmp
7759                                 $rm -f tmp.imp
7760                         done
7761                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7762                         echo "Ok." >&4
7763                 else
7764                         echo "$ar didn't seem to work right." >&4
7765                         echo "Maybe this is a Cray...trying bld instead..." >&4
7766                         if  bld t $libc | \
7767                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7768                                 $test -s libc.list
7769                         then
7770                                 for thisname in $libnames; do
7771                                         bld t $libnames | \
7772                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7773                                         $ar t $thisname >>libc.tmp
7774                                 done
7775                                 echo "Ok." >&4
7776                         else
7777                                 echo "That didn't work either.  Giving up." >&4
7778                                 exit 1
7779                         fi
7780                 fi
7781         fi
7782 fi
7783 nm_extract="$com"
7784 case "$PASE" in
7785 define)
7786     echo " "
7787     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7788     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7789     ;;
7790 *)  if $test -f /lib/syscalls.exp; then
7791         echo " "
7792         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7793         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7794                 /lib/syscalls.exp >>libc.list
7795     fi
7796     ;;
7797 esac
7798 ;;
7799 esac
7800 $rm -f libnames libpath
7801
7802 : see if dld is available
7803 set dld.h i_dld
7804 eval $inhdr
7805
7806 : Check if we are using C++
7807 echo " "
7808 echo "Checking for C++..." >&4
7809 $cat >try.c <<'EOCP'
7810 #include <stdio.h>
7811 int main(void)
7812 {
7813 #ifdef __cplusplus
7814     return 0;
7815 #else
7816     return 1;
7817 #endif
7818 }
7819 EOCP
7820 set try
7821 if eval $compile_ok && $run ./try; then
7822         val="$define"
7823         echo "You are using a C++ compiler."
7824 else
7825         val="$undef"
7826         echo "You are not using a C++ compiler."
7827 fi
7828 $rm_try cplusplus$$
7829 set d_cplusplus
7830 eval $setvar
7831
7832 : is a C symbol defined?
7833 csym='tlook=$1;
7834 case "$3" in
7835 -v) tf=libc.tmp; tdc="";;
7836 -a) tf=libc.tmp; tdc="[]";;
7837 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7838 esac;
7839 case "$d_cplusplus" in
7840     $define)    extern_C="extern \"C\"" ;;
7841     *)          extern_C="extern"       ;;
7842 esac;
7843 tx=yes;
7844 case "$reuseval-$4" in
7845 true-) ;;
7846 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7847 esac;
7848 case "$tx" in
7849 yes)
7850         tval=false;
7851         if $test "$runnm" = true; then
7852                 if $contains $tlook $tf >/dev/null 2>&1; then
7853                         tval=true;
7854                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7855                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7856                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7857                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7858                         $rm_try;
7859                 fi;
7860         else
7861                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7862                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7863                 $rm_try;
7864         fi;
7865         ;;
7866 *)
7867         case "$tval" in
7868         $define) tval=true;;
7869         *) tval=false;;
7870         esac;
7871         ;;
7872 esac;
7873 eval "$2=$tval"'
7874
7875 : define an is-in-libc? function
7876 inlibc='echo " "; td=$define; tu=$undef;
7877 sym=$1; var=$2; eval "was=\$$2";
7878 tx=yes;
7879 case "$reuseval$was" in
7880 true) ;;
7881 true*) tx=no;;
7882 esac;
7883 case "$tx" in
7884 yes)
7885         set $sym tres -f;
7886         eval $csym;
7887         case "$tres" in
7888         true)
7889                 echo "$sym() found." >&4;
7890                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7891         *)
7892                 echo "$sym() NOT found." >&4;
7893                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7894         esac;;
7895 *)
7896         case "$was" in
7897         $define) echo "$sym() found." >&4;;
7898         *) echo "$sym() NOT found." >&4;;
7899         esac;;
7900 esac'
7901
7902 : see if dlopen exists
7903 xxx_runnm="$runnm"
7904 xxx_ccflags="$ccflags"
7905 runnm=false
7906 : with g++ one needs -shared to get is-in-libc to work for dlopen
7907 case "$gccversion" in
7908 '')     ;;
7909 *)      case "$d_cplusplus" in
7910         "$define") ccflags="$ccflags -shared" ;;
7911         esac
7912         ;;
7913 esac
7914 set dlopen d_dlopen
7915 eval $inlibc
7916 runnm="$xxx_runnm"
7917 ccflags="$xxx_ccflags"
7918
7919 : see if this is a unistd.h system
7920 set unistd.h i_unistd
7921 eval $inhdr
7922
7923 : determine which dynamic loading, if any, to compile in
7924 echo " "
7925 dldir="ext/DynaLoader"
7926 case "$usedl" in
7927 $define|y|true)
7928         dflt='y'
7929         usedl="$define"
7930         ;;
7931 $undef|n|false)
7932         dflt='n'
7933         usedl="$undef"
7934         ;;
7935 *)
7936         dflt='n'
7937         case "$d_dlopen" in
7938             $define) dflt='y' ;;
7939         esac
7940         case "$i_dld" in
7941             $define) dflt='y' ;;
7942         esac
7943         : Does a dl_xxx.xs file exist for this operating system
7944         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7945         ;;
7946 esac
7947 rp="Do you wish to use dynamic loading?"
7948 . ./myread
7949 usedl="$ans"
7950 bin_ELF="$undef"
7951 case "$ans" in
7952 y*) usedl="$define"
7953         case "$dlsrc" in
7954         '')
7955                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7956                         dflt="$dldir/dl_${osname}.xs"
7957                 elif $test "$d_dlopen" = "$define" ; then
7958                         dflt="$dldir/dl_dlopen.xs"
7959                 elif $test "$i_dld" = "$define" ; then
7960                         dflt="$dldir/dl_dld.xs"
7961                 else
7962                         dflt=''
7963                 fi
7964                 ;;
7965         *)      dflt="$dldir/$dlsrc"
7966                 ;;
7967         esac
7968     echo "The following dynamic loading files are available:"
7969         : Can not go over to $dldir because getfile has path hard-coded in.
7970         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7971         rp="Source file to use for dynamic loading"
7972         fn="fne"
7973         gfpth="$src"
7974         . ./getfile
7975         usedl="$define"
7976         : emulate basename
7977         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7978
7979         $cat << EOM
7980
7981 Some systems may require passing special flags to $cc -c to
7982 compile modules that will be used to create a shared library.
7983 To use no flags, say "none".
7984
7985 EOM
7986     case "$cccdlflags" in
7987     '') case "$gccversion" in
7988                 '') case "$osname" in
7989                         hpux)   dflt='+z' ;;
7990                         next)   dflt='none' ;;
7991                         irix*)  dflt='-KPIC' ;;
7992                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7993                         sunos)  dflt='-pic' ;;
7994                         *)      dflt='none' ;;
7995                     esac
7996                         ;;
7997                 *)  case "$osname" in
7998                         darwin) dflt='none' ;;
7999                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8000                         *)      dflt='-fpic' ;;
8001                     esac ;;
8002             esac ;;
8003         ' ') dflt='none' ;;
8004     *)  dflt="$cccdlflags" ;;
8005     esac
8006     rp="Any special flags to pass to $cc -c to compile shared library modules?"
8007     . ./myread
8008     case "$ans" in
8009     none) cccdlflags=' ' ;;
8010     *) cccdlflags="$ans" ;;
8011     esac
8012
8013     cat << EOM
8014
8015 Some systems use ld to create libraries that can be dynamically loaded,
8016 while other systems (such as those using ELF) use $cc.
8017
8018 EOM
8019         case "$ld" in
8020         '')     $cat >try.c <<EOM
8021 /* Test for whether ELF binaries are produced */
8022 #include <fcntl.h>
8023 #$i_stdlib I_STDLIB
8024 #ifdef I_STDLIB
8025 #include <stdlib.h>
8026 #endif
8027 #$i_unistd I_UNISTD
8028 #ifdef I_UNISTD
8029 #include <unistd.h>
8030 #endif
8031 int main() {
8032         char b[4];
8033         int i = open("a.out",O_RDONLY);
8034         if(i == -1)
8035                 exit(1); /* fail */
8036         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8037                 exit(0); /* succeed (yes, it's ELF) */
8038         else
8039                 exit(1); /* fail */
8040 }
8041 EOM
8042                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8043                         cat <<EOM
8044 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8045 EOM
8046                         dflt="$cc"
8047                         bin_ELF="$define"
8048                 else
8049                         echo "I'll use ld to build dynamic libraries."
8050                         dflt='ld'
8051                 fi
8052                 $rm_try
8053                 ;;
8054         *)      dflt="$ld"
8055                 ;;
8056         esac
8057
8058     rp="What command should be used to create dynamic libraries?"
8059     . ./myread
8060         ld="$ans"
8061
8062     cat << EOM
8063
8064 Some systems may require passing special flags to $ld to create a
8065 library that can be dynamically loaded.  If your ld flags include
8066 -L/other/path options to locate libraries outside your loader's normal
8067 search path, you may need to specify those -L options here as well.  To
8068 use no flags, say "none".
8069
8070 EOM
8071     case "$lddlflags" in
8072     '') case "$osname" in
8073                         beos) dflt='-nostart' ;;
8074                         haiku) dflt='-shared' ;;
8075                         hpux) dflt='-b';
8076                               case "$gccversion" in
8077                               '') dflt="$dflt +vnocompatwarnings" ;;
8078                               esac
8079                               ;;
8080                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8081                         next)  dflt='none' ;;
8082                         solaris) dflt='-G' ;;
8083                         sunos) dflt='-assert nodefinitions' ;;
8084                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8085                 *)     dflt='none' ;;
8086                         esac
8087                         ;;
8088     *) dflt="$lddlflags" ;;
8089     esac
8090
8091         : Try to guess additional flags to pick up local libraries.
8092         : Be careful not to append to a plain 'none'
8093         case "$dflt" in
8094         none) dflt='' ;;
8095         esac
8096         for thisflag in $ldflags; do
8097                 case "$thisflag" in
8098                 -L*|-R*|-Wl,-R*)
8099                         case " $dflt " in
8100                         *" $thisflag "*) ;;
8101                         *) dflt="$dflt $thisflag" ;;
8102                         esac
8103                         ;;
8104                 esac
8105         done
8106
8107         case "$dflt" in
8108         ''|' ') dflt='none' ;;
8109         esac
8110
8111         case "$ldflags" in
8112         *-fstack-protector*)
8113             case "$dflt" in
8114                         *-fstack-protector*) ;; # Don't add it again
8115                         *) dflt="$dflt -fstack-protector" ;; 
8116                 esac
8117                 ;;
8118         esac
8119
8120
8121     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8122     . ./myread
8123     case "$ans" in
8124     none) lddlflags=' ' ;;
8125     *) lddlflags="$ans" ;;
8126     esac
8127
8128         cat <<EOM
8129
8130 Some systems may require passing special flags to $cc to indicate that
8131 the resulting executable will use dynamic linking.  To use no flags,
8132 say "none".
8133
8134 EOM
8135     case "$ccdlflags" in
8136     '') case "$osname" in
8137             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8138             next|sunos) dflt='none' ;;
8139             *)          dflt='none' ;;
8140             esac ;;
8141     ' ')  dflt='none' ;;
8142     *)  dflt="$ccdlflags" ;;
8143     esac
8144     rp="Any special flags to pass to $cc to use dynamic linking?"
8145     . ./myread
8146     case "$ans" in
8147     none) ccdlflags=' ' ;;
8148     *) ccdlflags="$ans" ;;
8149     esac
8150     ;;
8151 *)  usedl="$undef"
8152         ld='ld'
8153     dlsrc='dl_none.xs'
8154     lddlflags=''
8155     ccdlflags=''
8156     ;;
8157 esac
8158
8159 : Do we want a shared libperl?
8160 also=''
8161 case "$usedl" in
8162 $undef)
8163         # No dynamic loading being used, so don't bother even to prompt.
8164         useshrplib='false'
8165         ;;
8166 *)      case "$useshrplib" in
8167         '')     case "$osname" in
8168                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8169                         dflt=y
8170                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8171                         ;;
8172                 next*)
8173                         case "$osvers" in
8174                         4*)     dflt=y
8175                                 also='Building a shared libperl is needed for MAB support.'
8176                                 ;;
8177                         *)      dflt=n
8178                                 ;;
8179                         esac
8180                         ;;
8181                 *)      dflt=n
8182                         ;;
8183                 esac
8184                 ;;
8185         $define|true|[Yy]*)
8186                 dflt=y
8187                 ;;
8188         *)      dflt=n
8189                 ;;
8190         esac
8191         $cat << EOM
8192
8193 The perl executable is normally obtained by linking perlmain.c with
8194 libperl${_a}, any static extensions (usually just DynaLoader), and
8195 any other libraries needed on this system (such as -lm, etc.).  Since
8196 your system supports dynamic loading, it is probably possible to build
8197 a shared libperl.$so.  If you will have more than one executable linked
8198 to libperl.$so, this will significantly reduce the size of each
8199 executable, but it may have a noticeable effect on performance.  The
8200 default is probably sensible for your system.
8201 $also
8202
8203 EOM
8204         rp="Build a shared libperl.$so (y/n)"
8205         . ./myread
8206         case "$ans" in
8207         true|$define|[Yy]*)
8208                 useshrplib='true'  ;;
8209         *)      useshrplib='false' ;;
8210         esac
8211         ;;
8212 esac
8213
8214 case "$useshrplib" in
8215 true)
8216         case "$userelocatableinc" in
8217         true|define)
8218                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8219                 echo "See INSTALL for an explanation why that won't work." >&4
8220                 exit 4
8221                 ;;
8222         esac
8223         case "$libperl" in
8224         '')
8225                 # Figure out a good name for libperl.so.  Since it gets stored in
8226                 # a version-specific architecture-dependent library, the version
8227                 # number isn't really that important, except for making cc/ld happy.
8228                 #
8229                 # A name such as libperl.so.10.1
8230                 majmin="libperl.$so.$patchlevel.$subversion"
8231                 # A name such as libperl.so.100
8232                 majonly=`echo $patchlevel $subversion |
8233                         $awk '{printf "%d%02d", $1, $2}'`
8234                 majonly=libperl.$so.$majonly
8235                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8236                 # rely on figuring it out from the naming of libc.
8237                 case "${osname}${osvers}" in
8238                 next4*)
8239                         dflt=libperl.5.$so
8240                         # XXX How handle the --version stuff for MAB?
8241                         ;;
8242                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8243                         dflt=libperl.$so
8244                         ;;
8245                 cygwin*) # ld links now against the dll directly
8246                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8247                         majonly=`echo $patchlevel $subversion |
8248                                 $awk '{printf "%03d%03d", $1, $2}'`
8249                         majonly=cygperl5.$majonly.$so
8250                         dflt=$majmin
8251                         ;;
8252                 *)      # Try to guess based on whether libc has major.minor.
8253                         case "$libc" in
8254                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8255                         *libc.$so.[0-9]*) dflt=$majonly ;;
8256                         *)      dflt=libperl.$so ;;
8257                         esac
8258                         ;;
8259                 esac
8260                 ;;
8261         *)      dflt=$libperl
8262                 ;;
8263         esac
8264         cat << EOM
8265
8266 I need to select a good name for the shared libperl.  If your system uses
8267 library names with major and minor numbers, then you might want something
8268 like $majmin.  Alternatively, if your system uses a single version
8269 number for shared libraries, then you might want to use $majonly.
8270 Or, your system might be quite happy with a simple libperl.$so.
8271
8272 Since the shared libperl will get installed into a version-specific
8273 architecture-dependent directory, the version number of the shared perl
8274 library probably isn't important, so the default should be o.k.
8275
8276 EOM
8277         rp='What name do you want to give to the shared libperl?'
8278         . ./myread
8279         libperl=$ans
8280         echo "Ok, I'll use $libperl"
8281         ;;
8282 *)
8283         libperl="libperl${_a}"
8284         ;;
8285 esac
8286
8287 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8288 case "$shrpdir" in
8289 '') ;;
8290 *)      $cat >&4 <<EOM
8291 WARNING:  Use of the shrpdir variable for the installation location of
8292 the shared $libperl is not supported.  It was never documented and
8293 will not work in this version.  Let me (perlbug@perl.org)
8294 know of any problems this may cause.
8295
8296 EOM
8297         case "$shrpdir" in
8298         "$archlibexp/CORE")
8299                 $cat >&4 <<EOM
8300 But your current setting of $shrpdir is
8301 the default anyway, so it's harmless.
8302 EOM
8303                 ;;
8304         *)
8305                 $cat >&4 <<EOM
8306 Further, your current attempted setting of $shrpdir
8307 conflicts with the value of $archlibexp/CORE
8308 that installperl will use.
8309 EOM
8310                 ;;
8311         esac
8312         ;;
8313 esac
8314
8315 # How will the perl executable find the installed shared $libperl?
8316 # Add $xxx to ccdlflags.
8317 # If we can't figure out a command-line option, use $shrpenv to
8318 # set env LD_RUN_PATH.  The main perl makefile uses this.
8319 shrpdir=$archlibexp/CORE
8320 xxx=''
8321 tmp_shrpenv=''
8322 if "$useshrplib"; then
8323     case "$osname" in
8324         aix)
8325                 # We'll set it in Makefile.SH...
8326                 ;;
8327         solaris)
8328                 xxx="-R $shrpdir"
8329                 ;;
8330         freebsd|netbsd|openbsd|interix|dragonfly)
8331                 xxx="-Wl,-R$shrpdir"
8332                 ;;
8333         bsdos|linux|irix*|dec_osf|gnu*)
8334                 xxx="-Wl,-rpath,$shrpdir"
8335                 ;;
8336         next)
8337                 # next doesn't like the default...
8338                 ;;
8339         beos)
8340                 # beos doesn't like the default, either.
8341                 ;;
8342         haiku)
8343                 # Haiku doesn't like the default, either.
8344                 ;;
8345         hpux*)
8346                 # hpux doesn't like the default, either.
8347                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8348                 ;;
8349         cygwin)
8350                 # cygwin needs only ldlibpth
8351                 ;;
8352         *)
8353                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8354                 ;;
8355         esac
8356         case "$xxx" in
8357         '') ;;
8358         *)
8359                 # Only add $xxx if it isn't already in ccdlflags.
8360                 case " $ccdlflags " in
8361                 *" $xxx "*)     ;;
8362                 *)      ccdlflags="$ccdlflags $xxx"
8363                         cat <<EOM >&4
8364
8365 Adding $xxx to the flags
8366 passed to $ld so that the perl executable will find the
8367 installed shared $libperl.
8368
8369 EOM
8370                         ;;
8371                 esac
8372                 ;;
8373         esac
8374 fi
8375 # Fix ccdlflags in AIX for building external extensions.
8376 # (For building Perl itself bare -bE:perl.exp is needed,
8377 #  Makefile.SH takes care of this.)
8378 case "$osname" in
8379 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8380 esac
8381 # Respect a hint or command-line value.
8382 case "$shrpenv" in
8383 '') shrpenv="$tmp_shrpenv" ;;
8384 esac
8385 case "$ldlibpthname" in
8386 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8387 none)   ldlibpthname='' ;;
8388 esac
8389
8390 : determine where manual pages are on this system
8391 echo " "
8392 case "$sysman" in
8393 '') 
8394         syspath='/usr/share/man/man1 /usr/man/man1'
8395         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8396         syspath="$syspath /usr/man/u_man/man1"
8397         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8398         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8399         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8400         sysman=`./loc . /usr/man/man1 $syspath`
8401         ;;
8402 esac
8403 if $test -d "$sysman"; then
8404         echo "System manual is in $sysman." >&4
8405 else
8406         echo "Could not find manual pages in source form." >&4
8407 fi
8408
8409 : determine where manual pages go
8410 set man1dir man1dir none
8411 eval $prefixit
8412 $cat <<EOM
8413
8414 $spackage has manual pages available in source form.
8415 EOM
8416 case "$nroff" in
8417 nroff)
8418         echo "However, you don't have nroff, so they're probably useless to you."
8419         case "$man1dir" in
8420         '') man1dir="none";;
8421         esac;;
8422 esac
8423 echo "If you don't want the manual sources installed, answer 'none'."
8424 case "$man1dir" in
8425 ' ') dflt=none
8426         ;;
8427 '')
8428         lookpath="$prefixexp/share/man/man1"
8429         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8430         lookpath="$lookpath $prefixexp/man/p_man/man1"
8431         lookpath="$lookpath $prefixexp/man/u_man/man1"
8432         lookpath="$lookpath $prefixexp/man/man.1"
8433         case "$sysman" in
8434         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8435         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8436         esac
8437         set dflt
8438         eval $prefixup
8439         ;;
8440 *)  dflt="$man1dir"
8441         ;;
8442 esac
8443 echo " "
8444 fn=dn+~
8445 rp="Where do the main $spackage manual pages (source) go?"
8446 . ./getfile
8447 if $test "X$man1direxp" != "X$ansexp"; then
8448         installman1dir=''
8449 fi
8450 prefixvar=man1dir
8451 . ./setprefixvar
8452
8453 case "$man1dir" in
8454 '')     man1dir=' '
8455         installman1dir='';;
8456 esac
8457
8458 : What suffix to use on installed man pages
8459
8460 case "$man1dir" in
8461 ' ')
8462         man1ext='0'
8463         ;;
8464 *)
8465         rp="What suffix should be used for the main $spackage man pages?"
8466         case "$man1ext" in
8467         '')     case "$man1dir" in
8468                 *1)  dflt=1 ;;
8469                 *1p) dflt=1p ;;
8470                 *1pm) dflt=1pm ;;
8471                 *l) dflt=l;;
8472                 *n) dflt=n;;
8473                 *o) dflt=o;;
8474                 *p) dflt=p;;
8475                 *C) dflt=C;;
8476                 *L) dflt=L;;
8477                 *L1) dflt=L1;;
8478                 *) dflt=1;;
8479                 esac
8480                 ;;
8481         *)      dflt="$man1ext";;
8482         esac
8483         . ./myread
8484         man1ext="$ans"
8485         ;;
8486 esac
8487
8488 : see if we can have long filenames
8489 echo " "
8490 first=123456789abcdef
8491 $rm -f $first
8492 if (echo hi >$first) 2>/dev/null; then
8493         if $test -f 123456789abcde; then
8494                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8495                 val="$undef"
8496         else
8497                 echo 'You can have filenames longer than 14 characters.'>&4
8498                 val="$define"
8499         fi
8500 else
8501         $cat <<'EOM'
8502 You can't have filenames longer than 14 chars.
8503 You can't even think about them!
8504 EOM
8505         val="$undef"
8506 fi
8507 set d_flexfnam
8508 eval $setvar
8509 $rm -rf 123456789abcde*
8510
8511 : determine where library module manual pages go
8512 set man3dir man3dir none
8513 eval $prefixit
8514 $cat <<EOM
8515
8516 $spackage has manual pages for many of the library modules.
8517 EOM
8518
8519 case "$nroff" in
8520 nroff)
8521         $cat <<'EOM'
8522 However, you don't have nroff, so they're probably useless to you.
8523 EOM
8524         case "$man3dir" in
8525         '') man3dir="none";;
8526         esac;;
8527 esac
8528
8529 case "$d_flexfnam" in
8530 undef)
8531         $cat <<'EOM'
8532 However, your system can't handle the long file names like File::Basename.3.
8533 EOM
8534         case "$man3dir" in
8535         '') man3dir="none";;
8536         esac;;
8537 esac
8538
8539 echo "If you don't want the manual sources installed, answer 'none'."
8540 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8541 case "$man3dir" in
8542 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8543         if $test -d "$privlib/man/man3"; then
8544                 cat <<EOM >&4
8545
8546 WARNING:  Previous versions of perl installed man3 pages into
8547 $privlib/man/man3.  This version will suggest a
8548 new default of $dflt.
8549 EOM
8550                 tdflt=$dflt
8551                 dflt='n'
8552                 rp='Do you wish to preserve the old behavior?(y/n)'
8553                 . ./myread
8554                 case "$ans" in
8555                 y*) dflt="$privlib/man/man3" ;;
8556                 *)  dflt=$tdflt ;;
8557                 esac
8558     fi
8559         ;;
8560 *)      dflt="$man3dir" ;;
8561 esac
8562 case "$dflt" in
8563 ' ') dflt=none ;;
8564 esac
8565 echo " "
8566 fn=dn+~
8567 rp="Where do the $package library man pages (source) go?"
8568 . ./getfile
8569 prefixvar=man3dir
8570 . ./setprefixvar
8571
8572 case "$man3dir" in
8573 '')     man3dir=' '
8574         installman3dir='';;
8575 esac
8576
8577 : What suffix to use on installed man pages
8578 case "$man3dir" in
8579 ' ')
8580         man3ext='0'
8581         ;;
8582 *)
8583         rp="What suffix should be used for the $package library man pages?"
8584         case "$man3ext" in
8585         '')     case "$man3dir" in
8586                 *3)  dflt=3 ;;
8587                 *3p) dflt=3p ;;
8588                 *3pm) dflt=3pm ;;
8589                 *l) dflt=l;;
8590                 *n) dflt=n;;
8591                 *o) dflt=o;;
8592                 *p) dflt=p;;
8593                 *C) dflt=C;;
8594                 *L) dflt=L;;
8595                 *L3) dflt=L3;;
8596                 *) dflt=3;;
8597                 esac
8598                 ;;
8599         *)      dflt="$man3ext";;
8600         esac
8601         . ./myread
8602         man3ext="$ans"
8603         ;;
8604 esac
8605
8606 : see if we have to deal with yellow pages, now NIS.
8607 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8608         if $test -f /usr/etc/nibindd; then
8609                 echo " "
8610                 echo "I'm fairly confident you're on a NeXT."
8611                 echo " "
8612                 rp='Do you get the hosts file via NetInfo?'
8613                 dflt=y
8614                 case "$hostcat" in
8615                 nidump*) ;;
8616                 '') ;;
8617                 *) dflt=n;;
8618                 esac
8619                 . ./myread
8620                 case "$ans" in
8621                 y*) hostcat='nidump hosts .';;
8622                 *)      case "$hostcat" in
8623                         nidump*) hostcat='';;
8624                         esac
8625                         ;;
8626                 esac
8627         fi
8628         case "$hostcat" in
8629         nidump*) ;;
8630         *)
8631                 case "$hostcat" in
8632                 *ypcat*) dflt=y;;
8633                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8634                                 dflt=y
8635                         else
8636                                 dflt=n
8637                         fi;;
8638                 *) dflt=n;;
8639                 esac
8640                 echo " "
8641                 rp='Are you getting the hosts file via yellow pages?'
8642                 . ./myread
8643                 case "$ans" in
8644                 y*) hostcat='ypcat hosts';;
8645                 *) hostcat='cat /etc/hosts';;
8646                 esac
8647                 ;;
8648         esac
8649 fi
8650 case "$hostcat" in
8651 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8652 esac
8653 case "$groupcat" in
8654 '') test -f /etc/group && groupcat='cat /etc/group';;
8655 esac
8656 case "$passcat" in
8657 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8658 esac
8659
8660 : now get the host name
8661 echo " "
8662 echo "Figuring out host name..." >&4
8663 case "$myhostname" in
8664 '') cont=true
8665         echo 'Maybe "hostname" will work...'
8666         if tans=`sh -c hostname 2>&1` ; then
8667                 myhostname=$tans
8668                 phostname=hostname
8669                 cont=''
8670         fi
8671         ;;
8672 *) cont='';;
8673 esac
8674 if $test "$cont"; then
8675         if ./xenix; then
8676                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8677                 if tans=`cat /etc/systemid 2>&1` ; then
8678                         myhostname=$tans
8679                         phostname='cat /etc/systemid'
8680                         echo "Whadyaknow.  Xenix always was a bit strange..."
8681                         cont=''
8682                 fi
8683         elif $test -r /etc/systemid; then
8684                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8685         fi
8686 fi
8687 if $test "$cont"; then
8688         echo 'No, maybe "uuname -l" will work...'
8689         if tans=`sh -c 'uuname -l' 2>&1` ; then
8690                 myhostname=$tans
8691                 phostname='uuname -l'
8692         else
8693                 echo 'Strange.  Maybe "uname -n" will work...'
8694                 if tans=`sh -c 'uname -n' 2>&1` ; then
8695                         myhostname=$tans
8696                         phostname='uname -n'
8697                 else
8698                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8699                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8700                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8701                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8702                         else
8703                                 case "$myhostname" in
8704                                 '') echo "Does this machine have an identity crisis or something?"
8705                                         phostname='';;
8706                                 *)
8707                                         echo "Well, you said $myhostname before..."
8708                                         phostname='echo $myhostname';;
8709                                 esac
8710                         fi
8711                 fi
8712         fi
8713 fi
8714 case "$myhostname" in
8715 '') myhostname=noname ;;
8716 esac
8717 : you do not want to know about this
8718 set $myhostname
8719 myhostname=$1
8720
8721 : verify guess
8722 if $test "$myhostname" ; then
8723         dflt=y
8724         rp='Your host name appears to be "'$myhostname'".'" Right?"
8725         . ./myread
8726         case "$ans" in
8727         y*) ;;
8728         *) myhostname='';;
8729         esac
8730 fi
8731
8732 : bad guess or no guess
8733 while $test "X$myhostname" = X ; do
8734         dflt=''
8735         rp="Please type the (one word) name of your host:"
8736         . ./myread
8737         myhostname="$ans"
8738 done
8739
8740 : translate upper to lower if necessary
8741 case "$myhostname" in
8742 *[A-Z]*)
8743         echo "(Normalizing case in your host name)"
8744         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8745         ;;
8746 esac
8747
8748 case "$myhostname" in
8749 *.*)
8750         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8751         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8752         echo "(Trimming domain name from host name--host name is now $myhostname)"
8753         ;;
8754 *) case "$mydomain" in
8755         '')
8756                 {
8757                         test "X$hostcat" = "Xypcat hosts" &&
8758                         ypmatch "$myhostname" hosts 2>/dev/null |\
8759                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8760                         $test -s hosts
8761                 } || {
8762                         test "X$hostcat" != "X" &&
8763                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8764                                         /[       ]$myhostname[  . ]/p" > hosts
8765                 }
8766                 tmp_re="[       . ]"
8767                 if $test -f hosts; then
8768                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8769                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8770                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8771                                 hosts | $sort | $uniq | \
8772                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8773                         case `$echo X$dflt` in
8774                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8775                                 dflt=.
8776                                 ;;
8777                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8778                                 ;;
8779                         esac
8780                 else
8781                         echo "(I cannot locate a hosts database anywhere)"
8782                         dflt=.
8783                 fi
8784                 case "$dflt" in
8785                 .)
8786                         tans=`./loc resolv.conf X /etc /usr/etc`
8787                         if $test -f "$tans"; then
8788                                 echo "(Attempting domain name extraction from $tans)"
8789                                 dflt=.`$sed -n -e 's/   / /g' \
8790                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8791                                   -e 1q 2>/dev/null`
8792                                 case "$dflt" in
8793                                 .) dflt=.`$sed -n -e 's/        / /g' \
8794                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8795                                      -e 1q 2>/dev/null`
8796                                         ;;
8797                                 esac
8798                         fi
8799                         ;;
8800                 esac
8801                 case "$dflt" in
8802                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8803                         dflt=.`sh -c domainname 2>/dev/null`
8804                         case "$dflt" in
8805                         '') dflt='.';;
8806                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8807                         esac
8808                         ;;
8809                 esac
8810                 case "$dflt$osname" in
8811                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8812                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8813                         ;;
8814                 esac
8815                 case "$dflt" in
8816                 .) echo "(Lost all hope -- silly guess then)"
8817                         dflt='.nonet'
8818                         ;;
8819                 esac
8820                 $rm -f hosts
8821                 ;;
8822         *) dflt="$mydomain";;
8823         esac;;
8824 esac
8825 echo " "
8826 rp="What is your domain name?"
8827 . ./myread
8828 tans="$ans"
8829 case "$ans" in
8830 '') ;;
8831 .*) ;;
8832 *) tans=".$tans";;
8833 esac
8834 mydomain="$tans"
8835
8836 : translate upper to lower if necessary
8837 case "$mydomain" in
8838 *[A-Z]*)
8839         echo "(Normalizing case in your domain name)"
8840         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8841         ;;
8842 esac
8843
8844 : a little sanity check here
8845 case "$phostname" in
8846 '') ;;
8847 *)
8848         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8849         $myhostname$mydomain|$myhostname) ;;
8850         *)
8851                 case "$phostname" in
8852                 sed*)
8853                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8854                         ;;
8855                 *)
8856                         echo "(That doesn't agree with your $phostname command, by the way.)"
8857                         ;;
8858                 esac
8859         ;;
8860         esac
8861         ;;
8862 esac
8863
8864 : determine the e-mail address of the user who is running us
8865 $cat <<EOM
8866
8867 I need to get your e-mail address in Internet format if possible, i.e.
8868 something like user@host.domain. Please answer accurately since I have
8869 no easy means to double check it. The default value provided below
8870 is most probably close to reality but may not be valid from outside
8871 your organization...
8872
8873 EOM
8874 cont=x
8875 while test "$cont"; do
8876         case "$cf_email" in
8877         '') dflt="$cf_by@$myhostname$mydomain";;
8878         *) dflt="$cf_email";;
8879         esac
8880         rp='What is your e-mail address?'
8881         . ./myread
8882         cf_email="$ans"
8883         case "$cf_email" in
8884         *@*.*) cont='' ;;
8885         *)
8886                 rp='Address does not look like an Internet one.  Use it anyway?'
8887                 case "$fastread" in
8888                 yes) dflt=y ;;
8889                 *) dflt=n ;;
8890                 esac
8891                 . ./myread
8892                 case "$ans" in
8893                 y*) cont='' ;;
8894                 *) echo " " ;;
8895                 esac
8896                 ;;
8897         esac
8898 done
8899
8900 : Ask e-mail of administrator
8901 $cat <<EOM
8902
8903 If you or somebody else will be maintaining perl at your site, please
8904 fill in the correct e-mail address here so that they may be contacted
8905 if necessary. Currently, the "perlbug" program included with perl
8906 will send mail to this address in addition to perlbug@perl.org. You may
8907 enter "none" for no administrator.
8908
8909 EOM
8910 case "$perladmin" in
8911 '') dflt="$cf_email";;
8912 *) dflt="$perladmin";;
8913 esac
8914 rp='Perl administrator e-mail address'
8915 . ./myread
8916 perladmin="$ans"
8917
8918 : determine whether to only install version-specific parts.
8919 echo " "
8920 $cat <<EOM
8921 Do you want to install only the version-specific parts of the perl
8922 distribution?  Usually you do *not* want to do this.
8923 EOM
8924 case "$versiononly" in
8925 "$define"|[Yy]*|true) dflt='y' ;;
8926 *) dflt='n';
8927 esac
8928 rp="Do you want to install only the version-specific parts of perl?"
8929 . ./myread
8930 case "$ans" in
8931 [yY]*)  val="$define";;
8932 *)      val="$undef" ;;
8933 esac
8934 set versiononly
8935 eval $setvar
8936
8937 case "$versiononly" in
8938 "$define") inc_version_list=''
8939            inc_version_list_init=0
8940            ;;
8941 esac
8942
8943 : figure out how to guarantee perl startup
8944 : XXX Note that this currently takes advantage of the bug that binexp ignores
8945 :     the Configure -Dinstallprefix setting, which in turn means that under
8946 :     relocatable @INC, initialinstalllocation is what binexp started as.
8947 case "$startperl" in
8948 '')
8949         case "$sharpbang" in
8950         *!)
8951                 $cat <<EOH
8952
8953 I can use the #! construct to start perl on your system. This will
8954 make startup of perl scripts faster, but may cause problems if you
8955 want to share those scripts and perl is not in a standard place
8956 ($initialinstalllocation/perl) on all your platforms. The alternative
8957 is to force a shell by starting the script with a single ':' character.
8958
8959 EOH
8960                 case "$versiononly" in
8961                 "$define")      dflt="$initialinstalllocation/perl$version";;
8962                 *)              dflt="$initialinstalllocation/perl";;
8963                 esac
8964                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8965                 . ./myread
8966                 case "$ans" in
8967                 none)   startperl=": # use perl";;
8968                 *)      startperl="#!$ans"
8969                         if $test 30 -lt `echo "$ans" | wc -c`; then
8970                                 $cat >&4 <<EOM
8971
8972 WARNING:  Some systems limit the #! command to 32 characters.
8973 If you experience difficulty running Perl scripts with #!, try
8974 installing Perl in a directory with a shorter pathname.
8975
8976 EOM
8977                         fi ;;
8978                 esac
8979                 ;;
8980         *) startperl=": # use perl"
8981                 ;;
8982         esac
8983         ;;
8984 esac
8985 echo "I'll use $startperl to start perl scripts."
8986
8987 : figure best path for perl in scripts
8988 case "$perlpath" in
8989 '')
8990         case "$versiononly" in
8991         "$define")      perlpath="$initialinstalllocation/perl$version";;
8992         *)              perlpath="$initialinstalllocation/perl";;
8993         esac
8994         case "$startperl" in
8995         *!*) ;;
8996         *)
8997                 $cat <<EOH
8998
8999 I will use the "eval 'exec'" idiom to start Perl on your system.
9000 I can use the full path of your Perl binary for this purpose, but
9001 doing so may cause problems if you want to share those scripts and
9002 Perl is not always in a standard place ($initialinstalllocation/perl).
9003
9004 EOH
9005                 dflt="$initialinstalllocation/perl"
9006                 rp="What path shall I use in \"eval 'exec'\"?"
9007                 . ./myread
9008                 perlpath="$ans"
9009                 ;;
9010         esac
9011         ;;
9012 esac
9013 case "$startperl" in
9014 *!*)    ;;
9015 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9016 esac
9017
9018 : determine where public executable scripts go
9019 set scriptdir scriptdir
9020 eval $prefixit
9021 case "$scriptdir" in
9022 '')
9023         dflt="$bin"
9024         : guess some guesses
9025         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9026         $test -d /usr/share/bin     && dflt=/usr/share/bin
9027         $test -d /usr/local/script  && dflt=/usr/local/script
9028         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9029         $test -d $prefixexp/script  && dflt=$prefixexp/script
9030         set dflt
9031         eval $prefixup
9032         ;;
9033 *)  dflt="$scriptdir"
9034         ;;
9035 esac
9036 $cat <<EOM
9037
9038 Some installations have a separate directory just for executable scripts so
9039 that they can mount it across multiple architectures but keep the scripts in
9040 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9041 Or you might just lump your scripts in with all your other executables.
9042
9043 EOM
9044 fn=d~
9045 rp='Where do you keep publicly executable scripts?'
9046 . ./getfile
9047 if $test "X$ansexp" != "X$scriptdirexp"; then
9048         installscript=''
9049 fi
9050 installscriptdir=''
9051 prefixvar=scriptdir
9052 . ./setprefixvar
9053 : A little fix up for an irregularly named variable.
9054 installscript="$installscriptdir"
9055
9056 : determine where add-on public executables go
9057 case "$sitebin" in
9058 '')     dflt=$siteprefix/bin ;;
9059 *)      dflt=$sitebin ;;
9060 esac
9061 fn=d~
9062 rp='Pathname where the add-on public executables should be installed?'
9063 . ./getfile
9064 prefixvar=sitebin
9065 . ./setprefixvar
9066
9067 : determine where add-on html pages go
9068 : There is no standard location, so try to copy the previously-selected
9069 : directory structure for the core html pages.
9070 case "$sitehtml1dir" in
9071 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9072 *)     dflt=$sitehtml1dir ;;
9073 esac
9074 case "$dflt" in
9075 ''|' ') dflt=none ;;
9076 esac
9077 fn=dn+~
9078 rp='Pathname where the site-specific html pages should be installed?'
9079 . ./getfile
9080 prefixvar=sitehtml1dir
9081 . ./setprefixvar
9082
9083 : determine where add-on library html pages go
9084 : There is no standard location, so try to copy the previously-selected
9085 : directory structure for the core html pages.
9086 case "$sitehtml3dir" in
9087 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9088 *)     dflt=$sitehtml3dir ;;
9089 esac
9090 case "$dflt" in
9091 ''|' ') dflt=none ;;
9092 esac
9093 fn=dn+~
9094 rp='Pathname where the site-specific library html pages should be installed?'
9095 . ./getfile
9096 prefixvar=sitehtml3dir
9097 . ./setprefixvar
9098
9099 : determine where add-on manual pages go
9100 case "$siteman1dir" in
9101 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9102 *)      dflt=$siteman1dir ;;
9103 esac
9104 case "$dflt" in
9105 ''|' ') dflt=none ;;
9106 esac
9107 fn=dn+~
9108 rp='Pathname where the site-specific manual pages should be installed?'
9109 . ./getfile
9110 prefixvar=siteman1dir
9111 . ./setprefixvar
9112
9113 : determine where add-on library man pages go
9114 case "$siteman3dir" in
9115 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9116 *)      dflt=$siteman3dir ;;
9117 esac
9118 case "$dflt" in
9119 ''|' ') dflt=none ;;
9120 esac
9121 fn=dn+~
9122 rp='Pathname where the site-specific library manual pages should be installed?'
9123 . ./getfile
9124 prefixvar=siteman3dir
9125 . ./setprefixvar
9126
9127 : determine where add-on public executable scripts go
9128 case "$sitescript" in
9129 '')     dflt=$siteprefix/script
9130         $test -d $dflt || dflt=$sitebin ;;
9131 *)  dflt="$sitescript" ;;
9132 esac
9133 fn=d~+
9134 rp='Pathname where add-on public executable scripts should be installed?'
9135 . ./getfile
9136 prefixvar=sitescript
9137 . ./setprefixvar
9138
9139 : Check if faststdio is requested and available
9140 case "$usefaststdio" in
9141 $define|true|[yY]*|'')
9142         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9143         case "$xversion" in
9144         [68])   dflt='y' ;;
9145         *)      dflt='n' ;;
9146         esac
9147         ;;
9148 *) dflt='n';;
9149 esac
9150 cat <<EOM
9151
9152 Perl can be built to use 'fast stdio', which means using the stdio
9153 library but also directly manipulating the stdio buffers to enable
9154 faster I/O.  Using stdio is better for backward compatibility (especially
9155 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9156 interface has been preferred instead of stdio.
9157
9158 If this doesn't make any sense to you, just accept the default '$dflt'.
9159 EOM
9160 rp='Use the "fast stdio" if available?'
9161 . ./myread
9162 case "$ans" in
9163 y|Y)    val="$define" ;;
9164 *)      val="$undef" ;;
9165 esac
9166 set usefaststdio
9167 eval $setvar
9168
9169
9170 : define an is-a-typedef? function
9171 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9172 case "$inclist" in
9173 "") inclist="sys/types.h";;
9174 esac;
9175 eval "varval=\$$var";
9176 case "$varval" in
9177 "")
9178         $rm -f temp.c;
9179         for inc in $inclist; do
9180                 echo "#include <$inc>" >>temp.c;
9181         done;
9182         echo "#ifdef $type" >> temp.c;
9183         echo "printf(\"We have $type\");" >> temp.c;
9184         echo "#endif" >> temp.c;
9185         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9186         if $contains $type temp.E >/dev/null 2>&1; then
9187                 eval "$var=\$type";
9188         else
9189                 eval "$var=\$def";
9190         fi;
9191         $rm -f temp.?;;
9192 *) eval "$var=\$varval";;
9193 esac'
9194
9195 : define an is-a-typedef? function that prompts if the type is not available.
9196 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9197 case "$inclist" in
9198 "") inclist="sys/types.h";;
9199 esac;
9200 eval "varval=\$$var";
9201 case "$varval" in
9202 "")
9203         $rm -f temp.c;
9204         for inc in $inclist; do
9205                 echo "#include <$inc>" >>temp.c;
9206         done;
9207         echo "#ifdef $type" >> temp.c;
9208         echo "printf(\"We have $type\");" >> temp.c;
9209         echo "#endif" >> temp.c;
9210         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9211         echo " " ;
9212         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9213         if $contains $type temp.E >/dev/null 2>&1; then
9214                 echo "$type found." >&4;
9215                 eval "$var=\$type";
9216         else
9217                 echo "$type NOT found." >&4;
9218                 dflt="$def";
9219                 . ./myread ;
9220                 eval "$var=\$ans";
9221         fi;
9222         $rm -f temp.?;;
9223 *) eval "$var=\$varval";;
9224 esac'
9225
9226 : see what type lseek is declared as in the kernel
9227 rp="What is the type used for lseek's offset on this system?"
9228 set off_t lseektype long stdio.h sys/types.h
9229 eval $typedef_ask
9230
9231 echo " "
9232 echo "Checking to see how big your file offsets are..." >&4
9233 $cat >try.c <<EOCP
9234 #include <sys/types.h>
9235 #include <stdio.h>
9236 int main()
9237 {
9238     printf("%d\n", (int)sizeof($lseektype));
9239     return(0);
9240 }
9241 EOCP
9242 set try
9243 if eval $compile_ok; then
9244         lseeksize=`$run ./try`
9245         echo "Your file offsets are $lseeksize bytes long."
9246 else
9247         dflt=$longsize
9248         echo " "
9249         echo "(I can't seem to compile the test program.  Guessing...)"
9250         rp="What is the size of your file offsets (in bytes)?"
9251         . ./myread
9252         lseeksize="$ans"
9253 fi
9254 $rm_try
9255
9256 : see what type file positions are declared as in the library
9257 rp="What is the type for file position used by fsetpos()?"
9258 set fpos_t fpostype long stdio.h sys/types.h
9259 eval $typedef_ask
9260
9261 : Check size for Fpos_t
9262 echo " "
9263 case "$fpostype" in
9264 *_t) zzz="$fpostype"    ;;
9265 *)   zzz="fpos_t"       ;;
9266 esac
9267 echo "Checking the size of $zzz..." >&4
9268 cat > try.c <<EOCP
9269 #include <sys/types.h>
9270 #include <stdio.h>
9271 #$i_stdlib I_STDLIB
9272 #ifdef I_STDLIB
9273 #include <stdlib.h>
9274 #endif
9275 int main() {
9276     printf("%d\n", (int)sizeof($fpostype));
9277     exit(0);
9278 }
9279 EOCP
9280 set try
9281 if eval $compile_ok; then
9282         yyy=`$run ./try`
9283         case "$yyy" in
9284         '')     fpossize=4
9285                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9286                 ;;
9287         *)      fpossize=$yyy
9288                 echo "Your $zzz is $fpossize bytes long."
9289                 ;;
9290         esac
9291 else
9292         dflt="$longsize"
9293         echo " " >&4
9294         echo "(I can't compile the test program.  Guessing...)" >&4
9295         rp="What is the size of your file positions (in bytes)?"
9296         . ./myread
9297         fpossize="$ans"
9298 fi
9299
9300 : Check for large file support
9301 # Backward compatibility (uselfs is deprecated).
9302 case "$uselfs" in
9303 "$define"|true|[yY]*)
9304         cat <<EOM >&4
9305
9306 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9307 EOM
9308         uselargefiles="$define"
9309         ;;
9310 esac
9311
9312 case "$lseeksize:$fpossize" in
9313 8:8) cat <<EOM
9314
9315 You can have files larger than 2 gigabytes.
9316 EOM
9317    val="$define" ;;
9318 *)    case "$uselargefiles" in
9319    "$undef"|false|[nN]*) dflt='n' ;;
9320    *)   dflt='y' ;;
9321    esac
9322    cat <<EOM
9323
9324 Perl can be built to understand large files (files larger than 2 gigabytes)
9325 on some systems.  To do so, Configure can be run with -Duselargefiles.
9326
9327 If this doesn't make any sense to you, just accept the default '$dflt'.
9328 EOM
9329    rp='Try to understand large files, if available?'
9330    . ./myread
9331    case "$ans" in
9332    y|Y)         val="$define" ;;
9333    *)           val="$undef"  ;;
9334    esac
9335    ;;
9336 esac
9337 set uselargefiles
9338 eval $setvar
9339 : Look for a hint-file generated 'call-back-unit'.  If the
9340 : user has specified that a large files perl is to be built,
9341 : we may need to set or change some other defaults.
9342 if $test -f uselargefiles.cbu; then
9343         echo "Your platform has some specific hints regarding large file builds, using them..."
9344         . ./uselargefiles.cbu
9345 fi
9346 case "$uselargefiles" in
9347 "$define")
9348         if $test -f uselargefiles.cbu; then
9349                 echo " "
9350                 echo "Rechecking to see how big your file offsets are..." >&4
9351                 $cat >try.c <<EOCP
9352 #include <sys/types.h>
9353 #include <stdio.h>
9354 int main()
9355 {
9356     printf("%d\n", (int)sizeof($lseektype));
9357     return(0);
9358 }
9359 EOCP
9360                 set try
9361                 if eval $compile_ok; then
9362                         lseeksize=`$run ./try`
9363                         $echo "Your file offsets are now $lseeksize bytes long."
9364                 else
9365                         dflt="$lseeksize"
9366                         echo " "
9367                         echo "(I can't seem to compile the test program.  Guessing...)"
9368                         rp="What is the size of your file offsets (in bytes)?"
9369                         . ./myread
9370                         lseeksize="$ans"
9371                 fi
9372                 case "$fpostype" in
9373                 *_t) zzz="$fpostype"    ;;
9374                 *)   zzz="fpos_t"       ;;
9375                 esac
9376                 $echo $n "Rechecking the size of $zzz...$c" >&4
9377                 $cat > try.c <<EOCP
9378 #include <sys/types.h>
9379 #include <stdio.h>
9380 #$i_stdlib I_STDLIB
9381 #ifdef I_STDLIB
9382 #include <stdlib.h>
9383 #endif
9384 int main() {
9385     printf("%d\n", (int)sizeof($fpostype));
9386     return(0);
9387 }
9388 EOCP
9389                 set try
9390                 if eval $compile_ok; then
9391                         yyy=`$run ./try`
9392                         dflt="$lseeksize"
9393                         case "$yyy" in
9394                         '')     echo " "
9395                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9396                                 ;;
9397                         *)      fpossize=$yyy
9398                                 echo " $fpossize bytes." >&4
9399                                 ;;
9400                         esac
9401                 else
9402                         dflt="$fpossize"
9403                         echo " "
9404                         echo "(I can't compile the test program.  Guessing...)" >&4
9405                         rp="What is the size of your file positions (in bytes)?"
9406                         . ./myread
9407                         fpossize="$ans"
9408                 fi
9409                 $rm_try
9410         fi
9411         ;;
9412 esac
9413
9414 : Set the vendorbin variables
9415 case "$vendorprefix" in
9416 '')     d_vendorbin="$undef"
9417         vendorbin=''
9418         vendorbinexp=''
9419         ;;
9420 *)      d_vendorbin="$define"
9421         : determine where vendor-supplied executables go.
9422         case "$vendorbin" in
9423         '') dflt=$vendorprefix/bin ;;
9424         *)      dflt="$vendorbin" ;;
9425         esac
9426         fn=d~+
9427         rp='Pathname for the vendor-supplied executables directory?'
9428         . ./getfile
9429         vendorbin="$ans"
9430         vendorbinexp="$ansexp"
9431         ;;
9432 esac
9433 prefixvar=vendorbin
9434 . ./installprefix
9435
9436 : Set the vendorhtml1dir variables
9437 case "$vendorprefix" in
9438 '')     vendorhtml1dir=''
9439         vendorhtml1direxp=''
9440         ;;
9441 *)      : determine where vendor-supplied html pages go.
9442         : There is no standard location, so try to copy the previously-selected
9443         : directory structure for the core html pages.
9444         : XXX Better default suggestions would be welcome.
9445         case "$vendorhtml1dir" in
9446         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9447         *)      dflt=$vendorhtml1dir ;;
9448         esac
9449         case "$dflt" in
9450         ''|' ') dflt=none ;;
9451         esac
9452         fn=dn+~
9453         rp='Pathname for the vendor-supplied html pages?'
9454         . ./getfile
9455         vendorhtml1dir="$ans"
9456         vendorhtml1direxp="$ansexp"
9457         ;;
9458 esac
9459 : Use ' ' for none so value is preserved next time through Configure
9460 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9461 prefixvar=vendorhtml1dir
9462 . ./installprefix
9463
9464 : Set the vendorhtml3dir variables
9465 case "$vendorprefix" in
9466 '')     vendorhtml3dir=''
9467         vendorhtml3direxp=''
9468         ;;
9469 *)      : determine where vendor-supplied module html pages go.
9470         : There is no standard location, so try to copy the previously-selected
9471         : directory structure for the core html pages.
9472         : XXX Better default suggestions would be welcome.
9473         case "$vendorhtml3dir" in
9474         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9475         *)      dflt=$vendorhtml3dir ;;
9476         esac
9477         case "$dflt" in
9478         ''|' ') dflt=none ;;
9479         esac
9480         fn=dn+~
9481         rp='Pathname for the vendor-supplied html pages?'
9482         . ./getfile
9483         vendorhtml3dir="$ans"
9484         vendorhtml3direxp="$ansexp"
9485         ;;
9486 esac
9487 : Use ' ' for none so value is preserved next time through Configure
9488 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9489 prefixvar=vendorhtml3dir
9490 . ./installprefix
9491
9492 : Set the vendorman1dir variables
9493 case "$vendorprefix" in
9494 '')     vendorman1dir=''
9495         vendorman1direxp=''
9496         ;;
9497 *)      : determine where vendor-supplied manual pages go.
9498         case "$vendorman1dir" in
9499         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9500         *)      dflt=$vendorman1dir ;;
9501         esac
9502         case "$dflt" in
9503         ''|' ') dflt=none ;;
9504         esac
9505         fn=nd~+
9506         rp='Pathname for the vendor-supplied manual section 1 pages?'
9507         . ./getfile
9508         vendorman1dir="$ans"
9509         vendorman1direxp="$ansexp"
9510         ;;
9511 esac
9512 : Use ' ' for none so value is preserved next time through Configure
9513 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9514 prefixvar=vendorman1dir
9515 . ./installprefix
9516
9517 : Set the vendorman3dir variables
9518 case "$vendorprefix" in
9519 '')     vendorman3dir=''
9520         vendorman3direxp=''
9521         ;;
9522 *)      : determine where vendor-supplied module manual pages go.
9523         case "$vendorman3dir" in
9524         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9525         *)      dflt=$vendorman3dir ;;
9526         esac
9527         case "$dflt" in
9528         ''|' ') dflt=none ;;
9529         esac
9530         fn=nd~+
9531         rp='Pathname for the vendor-supplied manual section 3 pages?'
9532         . ./getfile
9533         vendorman3dir="$ans"
9534         vendorman3direxp="$ansexp"
9535         ;;
9536 esac
9537 : Use ' ' for none so value is preserved next time through Configure
9538 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9539 prefixvar=vendorman3dir
9540 . ./installprefix
9541
9542 : Set the vendorscript variables
9543 case "$vendorprefix" in
9544 '')     d_vendorscript="$undef"
9545         vendorscript=''
9546         vendorscriptexp=''
9547         ;;
9548 *)      d_vendorscript="$define"
9549         : determine where vendor-supplied scripts go.
9550         case "$vendorscript" in
9551         '')     dflt=$vendorprefix/script
9552                 $test -d $dflt || dflt=$vendorbin ;;
9553         *)  dflt="$vendorscript" ;;
9554         esac
9555         $cat <<EOM
9556
9557 The installation process will create a directory for
9558 vendor-supplied scripts.
9559
9560 EOM
9561         fn=d~+
9562         rp='Pathname for the vendor-supplied scripts directory?'
9563         . ./getfile
9564         vendorscript="$ans"
9565         vendorscriptexp="$ansexp"
9566         ;;
9567 esac
9568 prefixvar=vendorscript
9569 . ./installprefix
9570
9571 : script used to emit important warnings
9572 cat >warn <<EOS
9573 $startsh
9574 if test \$# -gt 0; then
9575         echo "\$@" >msg
9576 else
9577         cat >msg
9578 fi
9579 echo "*** WARNING:" >&4
9580 sed -e 's/^/*** /' <msg >&4
9581 echo "*** " >&4
9582 cat msg >>config.msg
9583 echo " " >>config.msg
9584 rm -f msg
9585 EOS
9586 chmod +x warn
9587 $eunicefix warn
9588
9589 : see which of string.h or strings.h is needed
9590 echo " "
9591 strings=`./findhdr string.h`
9592 if $test "$strings" && $test -r "$strings"; then
9593         echo "Using <string.h> instead of <strings.h>." >&4
9594         val="$define"
9595 else
9596         val="$undef"
9597         strings=`./findhdr strings.h`
9598         if $test "$strings" && $test -r "$strings"; then
9599                 echo "Using <strings.h> instead of <string.h>." >&4
9600         else
9601                 ./warn "No string header found -- You'll surely have problems."
9602         fi
9603 fi
9604 set i_string
9605 eval $setvar
9606 case "$i_string" in
9607 "$undef") strings=`./findhdr strings.h`;;
9608 *)        strings=`./findhdr string.h`;;
9609 esac
9610
9611 : see if qgcvt exists
9612 set qgcvt d_qgcvt
9613 eval $inlibc
9614
9615 : Check print/scan long double stuff
9616 echo " "
9617
9618 if $test X"$d_longdbl" = X"$define"; then
9619
9620 echo "Checking how to print long doubles..." >&4
9621
9622 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9623         $cat >try.c <<'EOCP'
9624 #include <sys/types.h>
9625 #include <stdio.h>
9626 int main() {
9627   double d = 123.456;
9628   printf("%.3f\n", d);
9629 }
9630 EOCP
9631         set try
9632         if eval $compile; then
9633                 yyy=`$run ./try`
9634                 case "$yyy" in
9635                 123.456)
9636                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9637                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9638                         echo "We will use %f."
9639                         ;;
9640                 esac
9641         fi
9642 fi
9643
9644 if $test X"$sPRIfldbl" = X; then
9645         $cat >try.c <<'EOCP'
9646 #include <sys/types.h>
9647 #include <stdio.h>
9648 int main() {
9649   long double d = 123.456;
9650   printf("%.3Lf\n", d);
9651 }
9652 EOCP
9653         set try
9654         if eval $compile; then
9655                 yyy=`$run ./try`
9656                 case "$yyy" in
9657                 123.456)
9658                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9659                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9660                         echo "We will use %Lf."
9661                         ;;
9662                 esac
9663         fi
9664 fi
9665
9666 if $test X"$sPRIfldbl" = X; then
9667         $cat >try.c <<'EOCP'
9668 #include <sys/types.h>
9669 #include <stdio.h>
9670 int main() {
9671   long double d = 123.456;
9672   printf("%.3llf\n", d);
9673 }
9674 EOCP
9675         set try
9676         if eval $compile; then
9677                 yyy=`$run ./try`
9678                 case "$yyy" in
9679                 123.456)
9680                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9681                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9682                         echo "We will use %llf."
9683                         ;;
9684                 esac
9685         fi
9686 fi
9687
9688 if $test X"$sPRIfldbl" = X; then
9689         $cat >try.c <<'EOCP'
9690 #include <sys/types.h>
9691 #include <stdio.h>
9692 int main() {
9693   long double d = 123.456;
9694   printf("%.3lf\n", d);
9695 }
9696 EOCP
9697         set try
9698         if eval $compile; then
9699                 yyy=`$run ./try`
9700                 case "$yyy" in
9701                 123.456)
9702                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9703                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9704                         echo "We will use %lf."
9705                         ;;
9706                 esac
9707         fi
9708 fi
9709
9710 if $test X"$sPRIfldbl" = X; then
9711         echo "Cannot figure out how to print long doubles." >&4
9712 else
9713         sSCNfldbl=$sPRIfldbl    # expect consistency
9714 fi
9715
9716 $rm_try
9717
9718 fi # d_longdbl
9719
9720 case "$sPRIfldbl" in
9721 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9722         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9723         d_SCNfldbl="$undef";
9724         ;;
9725 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9726         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9727         d_SCNfldbl="$define";
9728         ;;
9729 esac
9730
9731 : Check how to convert floats to strings.
9732
9733 if test "X$d_Gconvert" = X; then
9734
9735 echo " "
9736 echo "Checking for an efficient way to convert floats to strings."
9737 echo " " > try.c
9738 case "$uselongdouble" in
9739 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9740 esac
9741 case "$d_longdbl" in
9742 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9743 esac
9744 case "$d_PRIgldbl" in
9745 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9746 esac
9747 $cat >>try.c <<EOP
9748 #ifdef TRY_gconvert
9749 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9750 char *myname = "gconvert";
9751 #endif
9752 #ifdef TRY_gcvt
9753 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9754 char *myname = "gcvt";
9755 #endif
9756 #ifdef TRY_qgcvt
9757 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9758 char *myname = "qgcvt";
9759 #define DOUBLETYPE long double
9760 #endif
9761 #ifdef TRY_sprintf
9762 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9763 #ifdef HAS_PRIgldbl
9764 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9765 #else
9766 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9767 #endif
9768 #else
9769 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9770 #endif
9771 char *myname = "sprintf";
9772 #endif
9773
9774 #ifndef DOUBLETYPE
9775 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9776 #define DOUBLETYPE long double
9777 #else
9778 #define DOUBLETYPE double
9779 #endif
9780 #endif
9781
9782 #include <stdio.h>
9783
9784 #$i_stdlib I_STDLIB
9785 #ifdef I_STDLIB
9786 #include <stdlib.h>
9787 #endif
9788 #$i_string I_STRING
9789 #ifdef I_STRING
9790 #  include <string.h>
9791 #else
9792 #  include <strings.h>
9793 #endif
9794
9795 int checkit(char *expect, char *got)
9796 {
9797     if (strcmp(expect, got)) {
9798                 printf("%s oddity:  Expected %s, got %s\n",
9799                         myname, expect, got);
9800                 exit(1);
9801         }
9802 }
9803
9804 int main()
9805 {
9806         char buf[64];
9807         buf[63] = '\0';
9808
9809         /* This must be 1st test on (which?) platform */
9810         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9811         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9812         checkit("0.1", buf);
9813
9814         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9815         checkit("0.01", buf);
9816
9817         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9818         checkit("0.001", buf);
9819
9820         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9821         checkit("0.0001", buf);
9822
9823         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9824         if (strlen(buf) > 5)
9825             checkit("9e-005", buf); /* for Microsoft ?? */
9826         else
9827             checkit("9e-05", buf);
9828
9829         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9830         checkit("1", buf);
9831
9832         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9833         checkit("1.1", buf);
9834
9835         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9836         checkit("1.01", buf);
9837
9838         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9839         checkit("1.001", buf);
9840
9841         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9842         checkit("1.0001", buf);
9843
9844         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9845         checkit("1.00001", buf);
9846
9847         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9848         checkit("1.000001", buf);
9849
9850         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9851         checkit("0", buf);
9852
9853         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9854         checkit("-1", buf);
9855
9856         /* Some Linux gcvt's give 1.e+5 here. */
9857         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9858         checkit("100000", buf);
9859
9860         /* Some Linux gcvt's give -1.e+5 here. */
9861         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9862         checkit("-100000", buf);
9863
9864         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9865         checkit("123.456", buf);
9866
9867         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9868         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9869         /* 34 should be enough to scare even long double
9870          * places into using the e notation. */
9871         if (strlen(buf) > 5)
9872             checkit("1e+034", buf); /* for Microsoft */
9873         else
9874             checkit("1e+34", buf);
9875
9876         /* For Perl, if you add additional tests here, also add them to
9877          * t/base/num.t for benefit of platforms not using Configure or
9878          * overriding d_Gconvert */
9879
9880         exit(0);
9881 }
9882 EOP
9883 : first add preferred functions to our list
9884 xxx_list=""
9885 for xxx_convert in $gconvert_preference; do
9886     case $xxx_convert in
9887     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9888     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9889     esac
9890 done
9891 : then add any others
9892 for xxx_convert in gconvert gcvt sprintf; do
9893     case "$xxx_list" in
9894     *$xxx_convert*) ;;
9895     *) xxx_list="$xxx_list $xxx_convert" ;;
9896     esac
9897 done
9898
9899 case "$d_longdbl$uselongdouble" in
9900 "$define$define")
9901     : again, add prefered functions to our list first
9902     xxx_ld_list=""
9903     for xxx_convert in $gconvert_ld_preference; do
9904         case $xxx_convert in
9905         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9906         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9907         esac
9908     done
9909     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9910     for xxx_convert in qgcvt sprintf $xxx_list; do
9911         case "$xxx_ld_list" in
9912         $xxx_convert*|*" $xxx_convert"*) ;;
9913         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9914         esac
9915     done
9916     : if sprintf cannot do long doubles, move it to the end
9917     if test "$d_PRIgldbl" != "$define"; then
9918         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9919     fi
9920     : if no qgcvt, remove it
9921     if test "$d_qgcvt" != "$define"; then
9922         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9923     fi
9924     : use the ld_list
9925     xxx_list="$xxx_ld_list"
9926     ;;
9927 esac
9928
9929 for xxx_convert in $xxx_list; do
9930         echo "Trying $xxx_convert..."
9931         $rm -f try try$_o core
9932         set try -DTRY_$xxx_convert
9933         if eval $compile; then
9934                 echo "$xxx_convert() found." >&4
9935                 if $run ./try; then
9936                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9937                         break;
9938                 else
9939                         echo "...But $xxx_convert didn't work as I expected."
9940                         xxx_convert=''
9941                 fi
9942         else
9943                 echo "$xxx_convert NOT found." >&4
9944         fi
9945 done
9946
9947 if test X$xxx_convert = X; then
9948     echo "*** WHOA THERE!!! ***" >&4
9949     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9950     xxx_convert=sprintf
9951 fi
9952
9953 case "$xxx_convert" in
9954 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9955 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9956 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9957 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9958    "$define$define$define")
9959       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9960    "$define$define$undef")
9961       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9962    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9963    esac
9964    ;;
9965 esac
9966
9967 fi
9968 $rm_try
9969
9970 : see if _fwalk exists
9971 set fwalk d__fwalk
9972 eval $inlibc
9973
9974 : Initialize h_fcntl
9975 h_fcntl=false
9976
9977 : Initialize h_sysfile
9978 h_sysfile=false
9979
9980 : access call always available on UNIX
9981 set access d_access
9982 eval $inlibc
9983
9984 : locate the flags for 'access()'
9985 case "$d_access" in
9986 "$define")
9987         echo " "
9988         $cat >access.c <<EOCP
9989 #include <sys/types.h>
9990 #ifdef I_FCNTL
9991 #include <fcntl.h>
9992 #endif
9993 #ifdef I_SYS_FILE
9994 #include <sys/file.h>
9995 #endif
9996 #ifdef I_UNISTD
9997 #include <unistd.h>
9998 #endif
9999 #$i_stdlib I_STDLIB
10000 #ifdef I_STDLIB
10001 #include <stdlib.h>
10002 #endif
10003 int main() {
10004         exit(R_OK);
10005 }
10006 EOCP
10007         : check sys/file.h first, no particular reason here
10008         if $test `./findhdr sys/file.h` && \
10009                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10010                 h_sysfile=true;
10011                 echo "<sys/file.h> defines the *_OK access constants." >&4
10012         elif $test `./findhdr fcntl.h` && \
10013                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10014                 h_fcntl=true;
10015                 echo "<fcntl.h> defines the *_OK access constants." >&4
10016         elif $test `./findhdr unistd.h` && \
10017                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10018                 echo "<unistd.h> defines the *_OK access constants." >&4
10019         else
10020                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10021         fi
10022         ;;
10023 esac
10024 $rm -f access*
10025
10026 : see if accessx exists
10027 set accessx d_accessx
10028 eval $inlibc
10029
10030 : see if aintl exists
10031 set aintl d_aintl
10032 eval $inlibc
10033
10034 : see if alarm exists
10035 set alarm d_alarm
10036 eval $inlibc
10037
10038 : see if 64bit time functions exists
10039
10040 set ctime64 d_ctime64
10041 eval $inlibc
10042
10043 set localtime64 d_localtime64
10044 eval $inlibc
10045
10046 set gmtime64 d_gmtime64
10047 eval $inlibc
10048
10049 set mktime64 d_mktime64
10050 eval $inlibc
10051
10052 set difftime64 d_difftime64
10053 eval $inlibc
10054
10055 set asctime64 d_asctime64
10056 eval $inlibc
10057
10058 : see if POSIX threads are available
10059 set pthread.h i_pthread
10060 eval $inhdr
10061
10062 : define a fucntion to check prototypes
10063 $cat > protochk <<EOSH
10064 $startsh
10065 cc="$cc"
10066 optimize="$optimize"
10067 ccflags="$ccflags"
10068 prototype="$prototype"
10069 define="$define"
10070 rm_try="$rm_try"
10071 usethreads=$usethreads
10072 i_pthread=$i_pthread
10073 pthread_h_first=$pthread_h_first
10074 EOSH
10075
10076 $cat >> protochk <<'EOSH'
10077
10078 $rm_try
10079 foo="$1"
10080 shift
10081 while test $# -ge 2; do
10082         case "$1" in
10083                 $define) echo "#include <$2>" >> try.c ;;
10084                 literal) echo "$2" >> try.c ;;
10085         esac
10086     # Extra magic for the benefit of systems that need pthread.h
10087     # to be included early to correctly detect threadsafe functions.
10088     # Such functions must guarantee themselves, though, that the usethreads
10089     # and i_pthread have been defined, before calling protochk.
10090     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10091         echo "#include <pthread.h>" >> try.c
10092         pthread_h_done=yes
10093     fi
10094     shift 2
10095 done
10096 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10097 cat >> try.c <<'EOCP'
10098 #ifdef CAN_PROTOTYPE
10099 #define _(args) args
10100 #else
10101 #define _(args) ()
10102 #endif
10103 EOCP
10104 echo "$foo" >> try.c
10105 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10106 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10107 status=$?
10108 $rm_try
10109 exit $status
10110 EOSH
10111 chmod +x protochk
10112 $eunicefix protochk
10113
10114 : Define hasproto macro for Configure internal use
10115 hasproto='varname=$1; func=$2; shift; shift;
10116 while $test $# -ge 2; do
10117         case "$1" in
10118         $define) echo "#include <$2>";;
10119         esac ;
10120     shift 2;
10121 done > try.c;
10122 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10123 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10124         echo "$func() prototype found.";
10125         val="$define";
10126 else
10127         echo "$func() prototype NOT found.";
10128         val="$undef";
10129 fi;
10130 set $varname;
10131 eval $setvar;
10132 $rm_try tryout.c'
10133
10134 : see if sys/types.h has to be included
10135 set sys/types.h i_systypes
10136 eval $inhdr
10137
10138 : see if sys/select.h has to be included
10139 set sys/select.h i_sysselct
10140 eval $inhdr
10141
10142 : Define hasfield macro for Configure internal use
10143 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10144 while $test $# -ge 2; do
10145         case "$1" in
10146         $define) echo "#include <$2>";;
10147         esac ;
10148     shift 2;
10149 done > try.c;
10150 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10151 set try;
10152 if eval $compile; then
10153         val="$define";
10154 else
10155         val="$undef";
10156 fi;
10157 set $varname;
10158 eval $setvar;
10159 $rm_try'
10160
10161 : see if we should include time.h, sys/time.h, or both
10162 echo " "
10163 if test "X$timeincl" = X; then
10164         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10165         $echo $n "I'm now running the test program...$c"
10166         $cat >try.c <<EOCP
10167 #include <sys/types.h>
10168 #ifdef I_TIME
10169 #include <time.h>
10170 #endif
10171 #ifdef I_SYSTIME
10172 #ifdef SYSTIMEKERNEL
10173 #define KERNEL
10174 #endif
10175 #include <sys/time.h>
10176 #endif
10177 #ifdef I_SYSSELECT
10178 #include <sys/select.h>
10179 #endif
10180 #$i_stdlib I_STDLIB
10181 #ifdef I_STDLIB
10182 #include <stdlib.h>
10183 #endif
10184 int main()
10185 {
10186         struct tm foo;
10187 #ifdef S_TIMEVAL
10188         struct timeval bar;
10189 #endif
10190 #ifdef S_TIMEZONE
10191         struct timezone tzp;
10192 #endif
10193         if (foo.tm_sec == foo.tm_sec)
10194                 exit(0);
10195 #ifdef S_TIMEVAL
10196         if (bar.tv_sec == bar.tv_sec)
10197                 exit(0);
10198 #endif
10199         exit(1);
10200 }
10201 EOCP
10202         flags=''
10203         for s_timezone in '-DS_TIMEZONE' ''; do
10204         sysselect=''
10205         for s_timeval in '-DS_TIMEVAL' ''; do
10206         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10207         for i_time in '' '-DI_TIME'; do
10208         for i_systime in '-DI_SYSTIME' ''; do
10209                 case "$flags" in
10210                 '') $echo $n ".$c"
10211                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10212                         if eval $compile; then
10213                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10214                                 shift
10215                                 flags="$*"
10216                                 echo " "
10217                                 $echo $n "Succeeded with $flags$c"
10218                         fi
10219                         ;;
10220                 esac
10221         done
10222         done
10223         done
10224         done
10225         done
10226         timeincl=''
10227         echo " "
10228         case "$flags" in
10229         *SYSTIMEKERNEL*) i_systimek="$define"
10230                 timeincl=`./findhdr sys/time.h`
10231                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10232         *) i_systimek="$undef";;
10233         esac
10234         case "$flags" in
10235         *I_TIME*) i_time="$define"
10236                 timeincl=`./findhdr time.h`" $timeincl"
10237                 echo "We'll include <time.h>." >&4;;
10238         *) i_time="$undef";;
10239         esac
10240         case "$flags" in
10241         *I_SYSTIME*) i_systime="$define"
10242                 timeincl=`./findhdr sys/time.h`" $timeincl"
10243                 echo "We'll include <sys/time.h>." >&4;;
10244         *) i_systime="$undef";;
10245         esac
10246         $rm_try
10247 fi
10248 : see if struct tm knows about tm_zone
10249 case "$i_systime$i_time" in
10250 *$define*)
10251         echo " "
10252         echo "Checking to see if your struct tm has tm_zone field..." >&4
10253         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10254         eval $hasfield
10255         ;;
10256 *)      val="$undef"
10257         set d_tm_tm_zone
10258         eval $setvar
10259         ;;
10260 esac
10261 case "$d_tm_tm_zone" in
10262 "$define")      echo "Yes, it does."   ;;
10263 *)              echo "No, it doesn't." ;;
10264 esac
10265 : see if struct tm knows about tm_gmtoff
10266 case "$i_systime$i_time" in
10267 *$define*)
10268         echo " "
10269         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10270         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10271         eval $hasfield
10272         ;;
10273 *)      val="$undef"
10274         set d_tm_tm_gmtoff
10275         eval $setvar
10276         ;;
10277 esac
10278 case "$d_tm_tm_gmtoff" in
10279 "$define")      echo "Yes, it does."   ;;
10280 *)              echo "No, it doesn't." ;;
10281 esac
10282
10283 : see if asctime_r exists
10284 set asctime_r d_asctime_r
10285 eval $inlibc
10286 case "$d_asctime_r" in
10287 "$define")
10288         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10289         case "$d_asctime_r_proto:$usethreads" in
10290         ":define")      d_asctime_r_proto=define
10291                 set d_asctime_r_proto asctime_r $hdrs
10292                 eval $hasproto ;;
10293         *)      ;;
10294         esac
10295         case "$d_asctime_r_proto" in
10296         define)
10297         case "$asctime_r_proto" in
10298         ''|0) try='char* asctime_r(const struct tm*, char*);'
10299         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10300         esac
10301         case "$asctime_r_proto" in
10302         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10303         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10304         esac
10305         case "$asctime_r_proto" in
10306         ''|0) try='int asctime_r(const struct tm*, char*);'
10307         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10308         esac
10309         case "$asctime_r_proto" in
10310         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10311         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10312         esac
10313         case "$asctime_r_proto" in
10314         ''|0)   d_asctime_r=undef
10315                 asctime_r_proto=0
10316                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10317         * )     case "$asctime_r_proto" in
10318                 REENTRANT_PROTO*) ;;
10319                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10320                 esac
10321                 echo "Prototype: $try" ;;
10322         esac
10323         ;;
10324         *)      case "$usethreads" in
10325                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10326                 esac
10327                 d_asctime_r=undef
10328                 asctime_r_proto=0
10329                 ;;
10330         esac
10331         ;;
10332 *)      asctime_r_proto=0
10333         ;;
10334 esac
10335
10336 : see if atolf exists
10337 set atolf d_atolf
10338 eval $inlibc
10339
10340 : see if atoll exists
10341 set atoll d_atoll
10342 eval $inlibc
10343
10344 : Look for GCC-style attribute format
10345 case "$d_attribute_format" in
10346 '')
10347 echo " "
10348 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10349 $cat >attrib.c <<'EOCP'
10350 #include <stdio.h>
10351 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10352 EOCP
10353 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10354         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10355                 echo "Your C compiler doesn't support __attribute__((format))."
10356                 val="$undef"
10357         else
10358                 echo "Your C compiler supports __attribute__((format))."
10359                 val="$define"
10360         fi
10361 else
10362         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10363         val="$undef"
10364 fi
10365 ;;
10366 *) val="$d_attribute_format" ;;
10367 esac
10368 set d_attribute_format
10369 eval $setvar
10370 $rm -f attrib*
10371
10372 : Look for GCC-style attribute format with null format allowed
10373 case "$d_printf_format_null" in
10374 '') case "$d_attribute_format" in
10375     $define)
10376         echo " "
10377         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10378 $cat >attrib.c <<EOCP
10379 #include <stdio.h>
10380 #$i_stdlib I_STDLIB
10381 #ifdef I_STDLIB
10382 #include <stdlib.h>
10383 #endif
10384 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10385 int null_printf (char* pat,...) { return (int)pat; }
10386 int main () { exit(null_printf(NULL)); }
10387 EOCP
10388         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10389             : run the executable in case it produces a run-time warning
10390             if $run ./attrib >>attrib.out 2>&1; then
10391                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10392                     echo "Your C compiler doesn't allow __printf__ format to be null."
10393                     val="$undef"
10394                 else
10395                     echo "Your C compiler allows __printf__ format to be null."
10396                     val="$define"
10397                 fi
10398             else
10399             echo "Your C compiler executable failed with __printf__ format null."
10400             val="$undef"
10401         fi
10402     else
10403         echo "Your C compiler fails with __printf__ format null."
10404         val="$undef"
10405     fi
10406     ;;
10407     *)  val="$undef" ;;
10408     esac
10409 ;;
10410 *)  val="$d_printf_format_null" ;;
10411 esac
10412 set d_printf_format_null
10413 eval $setvar
10414 $rm -f attrib*
10415
10416 : Look for GCC-style attribute malloc
10417 case "$d_attribute_malloc" in
10418 '')
10419 echo " "
10420 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10421 $cat >attrib.c <<'EOCP'
10422 #include <stdio.h>
10423 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10424 EOCP
10425 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10426         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10427                 echo "Your C compiler doesn't support __attribute__((malloc))."
10428                 val="$undef"
10429         else
10430                 echo "Your C compiler supports __attribute__((malloc))."
10431                 val="$define"
10432         fi
10433 else
10434         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10435         val="$undef"
10436 fi
10437 ;;
10438 *) val="$d_attribute_malloc" ;;
10439 esac
10440 set d_attribute_malloc
10441 eval $setvar
10442 $rm -f attrib*
10443
10444 : Look for GCC-style attribute nonnull
10445 case "$d_attribute_nonnull" in
10446 '')
10447 echo " "
10448 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10449 $cat >attrib.c <<'EOCP'
10450 #include <stdio.h>
10451 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10452 EOCP
10453 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10454         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10455                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10456                 val="$undef"
10457         else
10458                 echo "Your C compiler supports __attribute__((nonnull))."
10459                 val="$define"
10460         fi
10461 else
10462         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10463         val="$undef"
10464 fi
10465 ;;
10466 *) val="$d_attribute_nonnull" ;;
10467 esac
10468 set d_attribute_nonnull
10469 eval $setvar
10470 $rm -f attrib*
10471
10472 : Look for GCC-style attribute noreturn
10473 case "$d_attribute_noreturn" in
10474 '')
10475 echo " "
10476 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10477 $cat >attrib.c <<'EOCP'
10478 #include <stdio.h>
10479 void fall_over_dead( void ) __attribute__((noreturn));
10480 EOCP
10481 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10482         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10483                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10484                 val="$undef"
10485         else
10486                 echo "Your C compiler supports __attribute__((noreturn))."
10487                 val="$define"
10488         fi
10489 else
10490         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10491         val="$undef"
10492 fi
10493 ;;
10494 *) val="$d_attribute_noreturn" ;;
10495 esac
10496 set d_attribute_noreturn
10497 eval $setvar
10498 $rm -f attrib*
10499
10500 : Look for GCC-style attribute pure
10501 case "$d_attribute_pure" in
10502 '')
10503 echo " "
10504 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10505 $cat >attrib.c <<'EOCP'
10506 #include <stdio.h>
10507 int square( int n ) __attribute__((pure));
10508 EOCP
10509 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10510         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10511                 echo "Your C compiler doesn't support __attribute__((pure))."
10512                 val="$undef"
10513         else
10514                 echo "Your C compiler supports __attribute__((pure))."
10515                 val="$define"
10516         fi
10517 else
10518         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10519         val="$undef"
10520 fi
10521 ;;
10522 *) val="$d_attribute_pure" ;;
10523 esac
10524 set d_attribute_pure
10525 eval $setvar
10526 $rm -f attrib*
10527
10528 : Look for GCC-style attribute unused
10529 case "$d_attribute_unused" in
10530 '')
10531 echo " "
10532 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10533 $cat >attrib.c <<'EOCP'
10534 #include <stdio.h>
10535 int do_something( int dummy __attribute__((unused)), int n );
10536 EOCP
10537 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10538         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10539                 echo "Your C compiler doesn't support __attribute__((unused))."
10540                 val="$undef"
10541         else
10542                 echo "Your C compiler supports __attribute__((unused))."
10543                 val="$define"
10544         fi
10545 else
10546         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10547         val="$undef"
10548 fi
10549 ;;
10550 *) val="$d_attribute_unused" ;;
10551 esac
10552 set d_attribute_unused
10553 eval $setvar
10554 $rm -f attrib*
10555
10556 : Look for GCC-style attribute deprecated
10557 case "$d_attribute_deprecated" in
10558 '')
10559 echo " "
10560 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10561 $cat >attrib.c <<'EOCP'
10562 #include <stdio.h>
10563 int I_am_deprecated(void) __attribute__((deprecated));
10564 EOCP
10565 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10566         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10567                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10568                 val="$undef"
10569         else
10570                 echo "Your C compiler supports __attribute__((deprecated))."
10571                 val="$define"
10572         fi
10573 else
10574         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10575         val="$undef"
10576 fi
10577 ;;
10578 *) val="$d_attribute_deprecated" ;;
10579 esac
10580 set d_attribute_deprecated
10581 eval $setvar
10582 $rm -f attrib*
10583
10584 : Look for GCC-style attribute warn_unused_result
10585 case "$d_attribute_warn_unused_result" in
10586 '')
10587 echo " "
10588 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10589 $cat >attrib.c <<'EOCP'
10590 #include <stdio.h>
10591 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10592 EOCP
10593 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10594         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10595                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10596                 val="$undef"
10597         else
10598                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10599                 val="$define"
10600         fi
10601 else
10602         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10603         val="$undef"
10604 fi
10605 ;;
10606 *) val="$d_attribute_warn_unused_result" ;;
10607 esac
10608 set d_attribute_warn_unused_result
10609 eval $setvar
10610 $rm -f attrib*
10611
10612 : see if bcmp exists
10613 set bcmp d_bcmp
10614 eval $inlibc
10615
10616 : see if bcopy exists
10617 set bcopy d_bcopy
10618 eval $inlibc
10619
10620 : see if getpgrp exists
10621 set getpgrp d_getpgrp
10622 eval $inlibc
10623
10624 case "$d_getpgrp" in
10625 "$define")
10626         echo " "
10627         echo "Checking to see which flavor of getpgrp is in use..."
10628         $cat >try.c <<EOP
10629 #$i_unistd I_UNISTD
10630 #include <sys/types.h>
10631 #ifdef I_UNISTD
10632 #  include <unistd.h>
10633 #endif
10634 #$i_stdlib I_STDLIB
10635 #ifdef I_STDLIB
10636 #include <stdlib.h>
10637 #endif
10638 int main()
10639 {
10640         if (getuid() == 0) {
10641                 printf("(I see you are running Configure as super-user...)\n");
10642                 setuid(1);
10643         }
10644 #ifdef TRY_BSD_PGRP
10645         if (getpgrp(1) == 0)
10646                 exit(0);
10647 #else
10648         if (getpgrp() > 0)
10649                 exit(0);
10650 #endif
10651         exit(1);
10652 }
10653 EOP
10654         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10655                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10656                 val="$define"
10657         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10658                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10659                 val="$undef"
10660         else
10661                 echo "I can't seem to compile and run the test program."
10662                 if ./usg; then
10663                         xxx="a USG one, i.e. you use getpgrp()."
10664                 else
10665                         # SVR4 systems can appear rather BSD-ish.
10666                         case "$i_unistd" in
10667                         $undef)
10668                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10669                                 val="$define"
10670                                 ;;
10671                         $define)
10672                                 xxx="probably a USG one, i.e. you use getpgrp()."
10673                                 val="$undef"
10674                                 ;;
10675                         esac
10676                 fi
10677                 echo "Assuming your getpgrp is $xxx" >&4
10678         fi
10679         ;;
10680 *) val="$undef";;
10681 esac
10682 set d_bsdgetpgrp
10683 eval $setvar
10684 $rm_try
10685
10686 : see if setpgrp exists
10687 set setpgrp d_setpgrp
10688 eval $inlibc
10689
10690 case "$d_setpgrp" in
10691 "$define")
10692         echo " "
10693         echo "Checking to see which flavor of setpgrp is in use..."
10694         $cat >try.c <<EOP
10695 #$i_unistd I_UNISTD
10696 #include <sys/types.h>
10697 #ifdef I_UNISTD
10698 #  include <unistd.h>
10699 #endif
10700 #$i_stdlib I_STDLIB
10701 #ifdef I_STDLIB
10702 #include <stdlib.h>
10703 #endif
10704 int main()
10705 {
10706         if (getuid() == 0) {
10707                 printf("(I see you are running Configure as super-user...)\n");
10708                 setuid(1);
10709         }
10710 #ifdef TRY_BSD_PGRP
10711         if (-1 == setpgrp(1, 1))
10712                 exit(0);
10713 #else
10714         if (setpgrp() != -1)
10715                 exit(0);
10716 #endif
10717         exit(1);
10718 }
10719 EOP
10720         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10721                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10722                 val="$define"
10723         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10724                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10725                 val="$undef"
10726         else
10727                 echo "(I can't seem to compile and run the test program.)"
10728                 if ./usg; then
10729                         xxx="a USG one, i.e. you use setpgrp()."
10730                 else
10731                         # SVR4 systems can appear rather BSD-ish.
10732                         case "$i_unistd" in
10733                         $undef)
10734                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10735                                 val="$define"
10736                                 ;;
10737                         $define)
10738                                 xxx="probably a USG one, i.e. you use setpgrp()."
10739                                 val="$undef"
10740                                 ;;
10741                         esac
10742                 fi
10743                 echo "Assuming your setpgrp is $xxx" >&4
10744         fi
10745         ;;
10746 *) val="$undef";;
10747 esac
10748 set d_bsdsetpgrp
10749 eval $setvar
10750 $rm_try
10751
10752 : Look for GCC-style __builtin_choose_expr
10753 case "$d_builtin_choose_expr" in
10754 '')
10755     echo " "
10756     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10757     $cat >try.c <<'EOCP'
10758 #include <assert.h>
10759 #include <stdlib.h>
10760 #include <stdio.h>
10761
10762 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10763
10764 int main(void) {
10765     assert( SYRINX(1) == 2112 );
10766     assert( SYRINX(1) != 5150 );
10767     assert( SYRINX(0) == 5150 );
10768     assert( SYRINX(0) != 2112 );
10769     puts( "All good!" );
10770     exit(0);
10771 }
10772
10773 EOCP
10774     set try
10775     if eval $compile && $run ./try; then
10776         echo "Your C compiler supports __builtin_choose_expr."
10777         val="$define"
10778     else
10779         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10780         val="$undef"
10781     fi
10782 ;;
10783 *) val="$d_builtin_choose_expr" ;;
10784 esac
10785
10786 set d_builtin_choose_expr
10787 eval $setvar
10788 $rm_try
10789
10790 : Look for GCC-style __builtin_expect
10791 case "$d_builtin_expect" in
10792 '')
10793     echo " "
10794     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10795     $cat >try.c <<'EOCP'
10796 int main(void) {
10797     int n = 50;
10798     if ( __builtin_expect(n, 0) ) n = 1;
10799     /* Remember shell exit code truth is 0, C truth is non-zero */
10800     return !(n == 1);
10801 }
10802 EOCP
10803     set try
10804     if eval $compile && $run ./try; then
10805         echo "Your C compiler supports __builtin_expect."
10806         val="$define"
10807     else
10808         echo "Your C compiler doesn't seem to understand __builtin_expect."
10809         val="$undef"
10810     fi
10811     ;;
10812 *) val="$d_builtin_expect" ;;
10813 esac
10814
10815 set d_builtin_expect
10816 eval $setvar
10817 $rm_try
10818
10819 : see if bzero exists
10820 set bzero d_bzero
10821 eval $inlibc
10822
10823 : see if stdarg is available
10824 echo " "
10825 if $test `./findhdr stdarg.h`; then
10826         echo "<stdarg.h> found." >&4
10827         valstd="$define"
10828 else
10829         echo "<stdarg.h> NOT found." >&4
10830         valstd="$undef"
10831 fi
10832
10833 : see if varags is available
10834 echo " "
10835 if $test `./findhdr varargs.h`; then
10836         echo "<varargs.h> found." >&4
10837 else
10838         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10839 fi
10840
10841 : set up the varargs testing programs
10842 $cat > varargs.c <<EOP
10843 #ifdef I_STDARG
10844 #include <stdarg.h>
10845 #endif
10846 #ifdef I_VARARGS
10847 #include <varargs.h>
10848 #endif
10849
10850 #ifdef I_STDARG
10851 int f(char *p, ...)
10852 #else
10853 int f(va_alist)
10854 va_dcl
10855 #endif
10856 {
10857         va_list ap;
10858 #ifndef I_STDARG
10859         char *p;
10860 #endif
10861 #ifdef I_STDARG
10862         va_start(ap,p);
10863 #else
10864         va_start(ap);
10865         p = va_arg(ap, char *);
10866 #endif
10867         va_end(ap);
10868         return 0;
10869 }
10870 EOP
10871 $cat > varargs <<EOP
10872 $startsh
10873 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10874         echo "true"
10875 else
10876         echo "false"
10877 fi
10878 $rm -f varargs$_o
10879 EOP
10880 chmod +x varargs
10881
10882 : now check which varargs header should be included
10883 echo " "
10884 i_varhdr=''
10885 case "$valstd" in
10886 "$define")
10887         if `./varargs I_STDARG`; then
10888                 val='stdarg.h'
10889         elif `./varargs I_VARARGS`; then
10890                 val='varargs.h'
10891         fi
10892         ;;
10893 *)
10894         if `./varargs I_VARARGS`; then
10895                 val='varargs.h'
10896         fi
10897         ;;
10898 esac
10899 case "$val" in
10900 '')
10901 echo "I could not find the definition for va_dcl... You have problems..." >&4
10902         val="$undef"; set i_stdarg; eval $setvar
10903         val="$undef"; set i_varargs; eval $setvar
10904         ;;
10905 *)
10906         set i_varhdr
10907         eval $setvar
10908         case "$i_varhdr" in
10909         stdarg.h)
10910                 val="$define"; set i_stdarg; eval $setvar
10911                 val="$undef"; set i_varargs; eval $setvar
10912                 ;;
10913         varargs.h)
10914                 val="$undef"; set i_stdarg; eval $setvar
10915                 val="$define"; set i_varargs; eval $setvar
10916                 ;;
10917         esac
10918         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10919 esac
10920 $rm -f varargs*
10921
10922 : see if the Compiler supports C99 variadic macros
10923 case "$i_stdarg$i_stdlib" in
10924     "$define$define")
10925     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10926     $cat >try.c <<EOCP
10927 #include <stdio.h>
10928 #include <stdarg.h>
10929
10930 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10931
10932 int main() {
10933   char buf[20];
10934   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10935   puts(buf);
10936   return 0;
10937 }
10938 EOCP
10939     set try
10940     if eval $compile && $run ./try 2>&1 >/dev/null; then
10941         case "`$run ./try`" in
10942             "123 456 789")
10943             echo "You have C99 variadic macros." >&4
10944             d_c99_variadic_macros="$define"
10945             ;;
10946             *)
10947             echo "You don't have functional C99 variadic macros." >&4
10948             d_c99_variadic_macros="$undef"
10949             ;;
10950         esac
10951     else
10952         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10953         d_c99_variadic_macros="$undef"
10954     fi
10955     $rm_try
10956     ;;
10957     *)
10958     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10959     d_c99_variadic_macros="$undef"
10960     ;;
10961 esac
10962
10963 : see if signal is declared as pointer to function returning int or void
10964 echo " "
10965 xxx=`./findhdr signal.h`
10966 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10967 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10968         echo "You have int (*signal())() instead of void." >&4
10969         val="$undef"
10970 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10971         echo "You have void (*signal())()." >&4
10972         val="$define"
10973 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10974         echo "You have int (*signal())() instead of void." >&4
10975         val="$undef"
10976 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10977         echo "You have void (*signal())()." >&4
10978         val="$define"
10979 else
10980         case "$d_voidsig" in
10981         '')
10982         echo "I can't determine whether signal handler returns void or int..." >&4
10983                 dflt=void
10984                 rp="What type does your signal handler return?"
10985                 . ./myread
10986                 case "$ans" in
10987                 v*) val="$define";;
10988                 *) val="$undef";;
10989                 esac;;
10990         "$define")
10991                 echo "As you already told me, signal handler returns void." >&4
10992                 val="$define"
10993                 ;;
10994         *)      echo "As you already told me, signal handler returns int." >&4
10995                 val="$undef"
10996                 ;;
10997         esac
10998 fi
10999 set d_voidsig
11000 eval $setvar
11001 case "$d_voidsig" in
11002 "$define") signal_t="void";;
11003 *) signal_t="int";;
11004 esac
11005 $rm -f $$.tmp
11006
11007 : check for ability to cast large floats to 32-bit ints.
11008 echo " "
11009 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11010 if $test "$intsize" -ge 4; then
11011         xxx=int
11012 else
11013         xxx=long
11014 fi
11015 $cat >try.c <<EOCP
11016 #include <stdio.h>
11017 #$i_stdlib I_STDLIB
11018 #ifdef I_STDLIB
11019 #include <stdlib.h>
11020 #endif
11021 #include <sys/types.h>
11022 #include <signal.h>
11023 $signal_t blech(int s) { exit(3); }
11024 int main()
11025 {
11026         $xxx i32;
11027         double f, g;
11028         int result = 0;
11029         char str[16];
11030         signal(SIGFPE, blech);
11031
11032         /* Don't let compiler optimize the test away.  Store the number
11033            in a writable string for gcc to pass to sscanf under HP-UX.
11034         */
11035         sprintf(str, "2147483647");
11036         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11037         g = 10 * f;
11038         i32  = ($xxx) g;
11039
11040         /* x86 processors will probably give 0x8000 0000, which is a
11041            sign change.  We don't want that.  We want to mimic SPARC
11042            behavior here, which is to preserve the sign and give
11043            back 0x7fff ffff.
11044         */
11045         if (i32 != ($xxx) f)
11046                 result |= 1;
11047         exit(result);
11048 }
11049 EOCP
11050 set try
11051 if eval $compile_ok; then
11052         $run ./try
11053         yyy=$?
11054 else
11055         echo "(I can't seem to compile the test program--assuming it can't)"
11056         yyy=1
11057 fi
11058 case "$yyy" in
11059 0)      val="$define"
11060         echo "Yup, it can."
11061         ;;
11062 *)      val="$undef"
11063         echo "Nope, it can't."
11064         ;;
11065 esac
11066 set d_casti32
11067 eval $setvar
11068 $rm_try
11069
11070 : check for ability to cast negative floats to unsigned
11071 echo " "
11072 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11073 $cat >try.c <<EOCP
11074 #include <stdio.h>
11075 #$i_stdlib I_STDLIB
11076 #ifdef I_STDLIB
11077 #include <stdlib.h>
11078 #endif
11079 #include <sys/types.h>
11080 #include <signal.h>
11081 $signal_t blech(int s) { exit(7); }
11082 $signal_t blech_in_list(int s) { exit(4); }
11083 unsigned long dummy_long(unsigned long p) { return p; }
11084 unsigned int dummy_int(unsigned int p) { return p; }
11085 unsigned short dummy_short(unsigned short p) { return p; }
11086 int main()
11087 {
11088         double f;
11089         unsigned long along;
11090         unsigned int aint;
11091         unsigned short ashort;
11092         int result = 0;
11093         char str[16];
11094
11095         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11096            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11097            optimized the whole file away
11098         */
11099         /* Store the number in a writable string for gcc to pass to
11100            sscanf under HP-UX.
11101         */
11102         sprintf(str, "-123");
11103         sscanf(str, "%lf", &f);  /* f = -123.; */
11104
11105         signal(SIGFPE, blech);
11106         along = (unsigned long)f;
11107         aint = (unsigned int)f;
11108         ashort = (unsigned short)f;
11109         if (along != (unsigned long)-123)
11110                 result |= 1;
11111         if (aint != (unsigned int)-123)
11112                 result |= 1;
11113         if (ashort != (unsigned short)-123)
11114                 result |= 1;
11115         sprintf(str, "1073741824.");
11116         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11117         f = f + f;
11118         along = 0;
11119         along = (unsigned long)f;
11120         if (along != 0x80000000)
11121                 result |= 2;
11122         f -= 1.;
11123         along = 0;
11124         along = (unsigned long)f;
11125         if (along != 0x7fffffff)
11126                 result |= 1;
11127         f += 2.;
11128         along = 0;
11129         along = (unsigned long)f;
11130         if (along != 0x80000001)
11131                 result |= 2;
11132         if (result)
11133                 exit(result);
11134         signal(SIGFPE, blech_in_list);
11135         sprintf(str, "123.");
11136         sscanf(str, "%lf", &f);  /* f = 123.; */
11137         along = dummy_long((unsigned long)f);
11138         aint = dummy_int((unsigned int)f);
11139         ashort = dummy_short((unsigned short)f);
11140         if (along != (unsigned long)123)
11141                 result |= 4;
11142         if (aint != (unsigned int)123)
11143                 result |= 4;
11144         if (ashort != (unsigned short)123)
11145                 result |= 4;
11146         exit(result);
11147
11148 }
11149 EOCP
11150 set try
11151 if eval $compile_ok; then
11152         $run ./try
11153         castflags=$?
11154 else
11155         echo "(I can't seem to compile the test program--assuming it can't)"
11156         castflags=7
11157 fi
11158 case "$castflags" in
11159 0)      val="$define"
11160         echo "Yup, it can."
11161         ;;
11162 *)      val="$undef"
11163         echo "Nope, it can't."
11164         ;;
11165 esac
11166 set d_castneg
11167 eval $setvar
11168 $rm_try
11169
11170 : see if vprintf exists
11171 echo " "
11172 if set vprintf val -f d_vprintf; eval $csym; $val; then
11173         echo 'vprintf() found.' >&4
11174         val="$define"
11175         $cat >try.c <<EOF
11176 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11177 #$i_varargs I_VARARGS
11178
11179 #$i_stdlib I_STDLIB
11180 #$i_unistd I_UNISTD
11181
11182 #ifdef I_STDARG
11183 #  include <stdarg.h>
11184 #else /* I_VARARGS */
11185 #  include <varargs.h>
11186 #endif
11187
11188 #ifdef I_UNISTD
11189 #  include <unistd.h>
11190 #endif
11191
11192 #ifdef I_STDLIB
11193 #  include <stdlib.h>
11194 #endif
11195
11196 #include <stdio.h> /* vsprintf prototype */
11197
11198 #ifdef I_STDARG
11199 void xxx(int n, ...)
11200 {
11201     va_list args;
11202     char buf[10];
11203     va_start(args, n);
11204     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11205 }
11206 int main() { xxx(1, "foo"); }
11207
11208 #else /* I_VARARGS */
11209
11210 xxx(va_alist)
11211 va_dcl
11212 {
11213     va_list args;
11214     char buf[10];
11215     va_start(args);
11216     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11217 }
11218 int main() { xxx("foo"); }
11219
11220 #endif
11221
11222 EOF
11223         set try
11224         if eval $compile_ok; then
11225                 if $run ./try; then
11226                         echo "Your vsprintf() returns (int)." >&4
11227                         val2="$undef"
11228                 else
11229                         echo "Your vsprintf() returns (char*)." >&4
11230                         val2="$define"
11231                 fi
11232         else
11233                 echo 'I am unable to compile the vsprintf() test program.' >&4
11234                 # We shouldn't get here.  If we do, assume the standard signature,
11235                 # not the old BSD one.
11236                 echo 'Guessing that vsprintf() returns (int).' >&4
11237                 val2="$undef"
11238         fi
11239 else
11240         echo 'vprintf() NOT found.' >&4
11241         val="$undef"
11242         val2="$undef"
11243 fi
11244 $rm_try
11245 set d_vprintf
11246 eval $setvar
11247 val=$val2
11248 set d_charvspr
11249 eval $setvar
11250
11251 : see if chown exists
11252 set chown d_chown
11253 eval $inlibc
11254
11255 : see if chroot exists
11256 set chroot d_chroot
11257 eval $inlibc
11258
11259 : see if chsize exists
11260 set chsize d_chsize
11261 eval $inlibc
11262
11263 : see if class exists
11264 set class d_class
11265 eval $inlibc
11266
11267 : see if clearenv exists
11268 set clearenv d_clearenv
11269 eval $inlibc
11270
11271 : Define hasstruct macro for Configure internal use
11272 hasstruct='varname=$1; struct=$2; shift; shift;
11273 while $test $# -ge 2; do
11274         case "$1" in
11275         $define) echo "#include <$2>";;
11276         esac ;
11277     shift 2;
11278 done > try.c;
11279 echo "int main () { struct $struct foo; }" >> try.c;
11280 set try;
11281 if eval $compile; then
11282         val="$define";
11283 else
11284         val="$undef";
11285 fi;
11286 set $varname;
11287 eval $setvar;
11288 $rm_try'
11289
11290 : see whether socket exists
11291 socketlib=''
11292 sockethdr=''
11293 echo " "
11294 $echo $n "Hmm... $c" >&4
11295 if set socket val -f d_socket; eval $csym; $val; then
11296         echo "Looks like you have Berkeley networking support." >&4
11297         d_socket="$define"
11298         if set setsockopt val -f; eval $csym; $val; then
11299                 d_oldsock="$undef"
11300         else
11301                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11302                 d_oldsock="$define"
11303         fi
11304 else
11305         if $contains socklib libc.list >/dev/null 2>&1; then
11306                 echo "Looks like you have Berkeley networking support." >&4
11307                 d_socket="$define"
11308                 : we will have to assume that it supports the 4.2 BSD interface
11309                 d_oldsock="$undef"
11310         else
11311                 echo "You don't have Berkeley networking in libc$_a..." >&4
11312                 if test "X$d_socket" = "X$define"; then
11313                    echo "...but you seem to believe that you have sockets." >&4
11314                 else
11315                         for net in net socket
11316                         do
11317                                 if test -f /usr/lib/lib$net$_a; then
11318                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11319                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11320                                         if $contains socket libc.list >/dev/null 2>&1; then
11321                                                 d_socket="$define"
11322                                                 socketlib="-l$net"
11323                                                 case "$net" in
11324                                                 net)
11325                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11326                                                         sockethdr="-I/usr/netinclude"
11327                                                         ;;
11328                                                 esac
11329                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11330                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11331                                                         d_oldsock="$undef"
11332                                                 else
11333                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11334                                                         d_oldsock="$define"
11335                                                 fi
11336                                                 break
11337                                         fi
11338                                 fi
11339                         done
11340                         if test "X$d_socket" != "X$define"; then
11341                            echo "or anywhere else I see." >&4
11342                            d_socket="$undef"
11343                            d_oldsock="$undef"
11344                         fi
11345                 fi
11346         fi
11347 fi
11348
11349 : see if socketpair exists
11350 set socketpair d_sockpair
11351 eval $inlibc
11352
11353
11354 echo " "
11355 echo "Checking the availability sa_len in the sock struct ..." >&4
11356 $cat >try.c <<EOF
11357 #include <sys/types.h>
11358 #include <sys/socket.h>
11359 int main() {
11360 struct sockaddr sa;
11361 return (sa.sa_len);
11362 }
11363 EOF
11364 val="$undef"
11365 set try; if eval $compile; then
11366         val="$define"
11367 fi
11368 set d_sockaddr_sa_len; eval $setvar
11369 $rm_try
11370
11371 echo " "
11372 echo "Checking the availability of certain socket constants..." >&4
11373 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11374         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11375         $cat >try.c <<EOF
11376 #include <sys/types.h>
11377 #include <sys/socket.h>
11378 int main() {
11379     int i = $ENUM;
11380 }
11381 EOF
11382         val="$undef"
11383         set try; if eval $compile; then
11384                 val="$define"
11385         fi
11386         set d_${enum}; eval $setvar
11387         $rm_try
11388 done
11389
11390 : see if this is a sys/uio.h system
11391 set sys/uio.h i_sysuio
11392 eval $inhdr
11393
11394 : Check for cmsghdr support
11395 echo " "
11396 echo "Checking to see if your system supports struct cmsghdr..." >&4
11397 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11398 eval $hasstruct
11399 case "$d_cmsghdr_s" in
11400 "$define")      echo "Yes, it does."   ;;
11401 *)              echo "No, it doesn't." ;;
11402 esac
11403
11404
11405 : check for const keyword
11406 echo " "
11407 echo 'Checking to see if your C compiler knows about "const"...' >&4
11408 $cat >const.c <<'EOCP'
11409 typedef struct spug { int drokk; } spug;
11410 int main()
11411 {
11412         const char *foo;
11413         const spug y = { 0 };
11414 }
11415 EOCP
11416 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11417         val="$define"
11418         echo "Yup, it does."
11419 else
11420         val="$undef"
11421         echo "Nope, it doesn't."
11422 fi
11423 set d_const
11424 eval $setvar
11425
11426 : see if copysignl exists
11427 set copysignl d_copysignl
11428 eval $inlibc
11429
11430 : see if crypt exists
11431 echo " "
11432 set crypt d_crypt
11433 eval $inlibc
11434 case "$d_crypt" in
11435 $define) cryptlib='' ;;
11436 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11437                 echo 'crypt() found.' >&4
11438                 val="$define"
11439                 cryptlib=''
11440         else
11441                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11442                 if $test -z "$cryptlib"; then
11443                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11444                 else
11445                         cryptlib=-lcrypt
11446                 fi
11447                 if $test -z "$cryptlib"; then
11448                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11449                 else
11450                         cryptlib=-lcrypt
11451                 fi
11452                 if $test -z "$cryptlib"; then
11453                         cryptlib=`./loc libcrypt$_a "" $libpth`
11454                 else
11455                         cryptlib=-lcrypt
11456                 fi
11457                 if $test -z "$cryptlib"; then
11458                         echo 'crypt() NOT found.' >&4
11459                         val="$undef"
11460                 else
11461                         val="$define"
11462                 fi
11463         fi
11464         set d_crypt
11465         eval $setvar
11466         ;;
11467 esac
11468
11469 : see if this is a crypt.h system
11470 set crypt.h i_crypt
11471 eval $inhdr
11472
11473 : see if crypt_r exists
11474 set crypt_r d_crypt_r
11475 eval $inlibc
11476 case "$d_crypt_r" in
11477 "$define")
11478         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11479         case "$d_crypt_r_proto:$usethreads" in
11480         ":define")      d_crypt_r_proto=define
11481                 set d_crypt_r_proto crypt_r $hdrs
11482                 eval $hasproto ;;
11483         *)      ;;
11484         esac
11485         case "$d_crypt_r_proto" in
11486         define)
11487         case "$crypt_r_proto" in
11488         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11489         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11490         esac
11491         case "$crypt_r_proto" in
11492         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11493         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11494         esac
11495         case "$crypt_r_proto" in
11496         ''|0)   d_crypt_r=undef
11497                 crypt_r_proto=0
11498                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11499         * )     case "$crypt_r_proto" in
11500                 REENTRANT_PROTO*) ;;
11501                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11502                 esac
11503                 echo "Prototype: $try" ;;
11504         esac
11505         ;;
11506         *)      case "$usethreads" in
11507                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11508                 esac
11509                 d_crypt_r=undef
11510                 crypt_r_proto=0
11511                 ;;
11512         esac
11513         ;;
11514 *)      crypt_r_proto=0
11515         ;;
11516 esac
11517
11518 : get csh whereabouts
11519 case "$csh" in
11520 'csh') val="$undef" ;;
11521 *) val="$define" ;;
11522 esac
11523 set d_csh
11524 eval $setvar
11525 : Respect a hint or command line value for full_csh.
11526 case "$full_csh" in
11527 '') full_csh=$csh ;;
11528 esac
11529
11530 : see if ctermid exists
11531 set ctermid d_ctermid
11532 eval $inlibc
11533
11534 : see if ctermid_r exists
11535 set ctermid_r d_ctermid_r
11536 eval $inlibc
11537 case "$d_ctermid_r" in
11538 "$define")
11539         hdrs="$i_systypes sys/types.h define stdio.h "
11540         case "$d_ctermid_r_proto:$usethreads" in
11541         ":define")      d_ctermid_r_proto=define
11542                 set d_ctermid_r_proto ctermid_r $hdrs
11543                 eval $hasproto ;;
11544         *)      ;;
11545         esac
11546         case "$d_ctermid_r_proto" in
11547         define)
11548         case "$ctermid_r_proto" in
11549         ''|0) try='char* ctermid_r(char*);'
11550         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11551         esac
11552         case "$ctermid_r_proto" in
11553         ''|0)   d_ctermid_r=undef
11554                 ctermid_r_proto=0
11555                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11556         * )     case "$ctermid_r_proto" in
11557                 REENTRANT_PROTO*) ;;
11558                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11559                 esac
11560                 echo "Prototype: $try" ;;
11561         esac
11562         ;;
11563         *)      case "$usethreads" in
11564                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11565                 esac
11566                 d_ctermid_r=undef
11567                 ctermid_r_proto=0
11568                 ;;
11569         esac
11570         ;;
11571 *)      ctermid_r_proto=0
11572         ;;
11573 esac
11574
11575 : see if ctime_r exists
11576 set ctime_r d_ctime_r
11577 eval $inlibc
11578 case "$d_ctime_r" in
11579 "$define")
11580         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11581         case "$d_ctime_r_proto:$usethreads" in
11582         ":define")      d_ctime_r_proto=define
11583                 set d_ctime_r_proto ctime_r $hdrs
11584                 eval $hasproto ;;
11585         *)      ;;
11586         esac
11587         case "$d_ctime_r_proto" in
11588         define)
11589         case "$ctime_r_proto" in
11590         ''|0) try='char* ctime_r(const time_t*, char*);'
11591         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11592         esac
11593         case "$ctime_r_proto" in
11594         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11595         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11596         esac
11597         case "$ctime_r_proto" in
11598         ''|0) try='int ctime_r(const time_t*, char*);'
11599         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11600         esac
11601         case "$ctime_r_proto" in
11602         ''|0) try='int ctime_r(const time_t*, char*, int);'
11603         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11604         esac
11605         case "$ctime_r_proto" in
11606         ''|0)   d_ctime_r=undef
11607                 ctime_r_proto=0
11608                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11609         * )     case "$ctime_r_proto" in
11610                 REENTRANT_PROTO*) ;;
11611                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11612                 esac
11613                 echo "Prototype: $try" ;;
11614         esac
11615         ;;
11616         *)      case "$usethreads" in
11617                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11618                 esac
11619                 d_ctime_r=undef
11620                 ctime_r_proto=0
11621                 ;;
11622         esac
11623         ;;
11624 *)      ctime_r_proto=0
11625         ;;
11626 esac
11627
11628 : see if cuserid exists
11629 set cuserid d_cuserid
11630 eval $inlibc
11631
11632 : see if this is a limits.h system
11633 set limits.h i_limits
11634 eval $inhdr
11635
11636 : see if this is a float.h system
11637 set float.h i_float
11638 eval $inhdr
11639
11640 : See if number of significant digits in a double precision number is known
11641 echo " "
11642 $cat >dbl_dig.c <<EOM
11643 #$i_limits I_LIMITS
11644 #$i_float I_FLOAT
11645 #ifdef I_LIMITS
11646 #include <limits.h>
11647 #endif
11648 #ifdef I_FLOAT
11649 #include <float.h>
11650 #endif
11651 #ifdef DBL_DIG
11652 printf("Contains DBL_DIG");
11653 #endif
11654 EOM
11655 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11656 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11657         echo "DBL_DIG found." >&4
11658         val="$define"
11659 else
11660         echo "DBL_DIG NOT found." >&4
11661         val="$undef"
11662 fi
11663 $rm -f dbl_dig.?
11664 set d_dbl_dig
11665 eval $setvar
11666
11667 : see if dbm.h is available
11668 : see if dbmclose exists
11669 set dbmclose d_dbmclose
11670 eval $inlibc
11671
11672 case "$d_dbmclose" in
11673 $define)
11674         set dbm.h i_dbm
11675         eval $inhdr
11676         case "$i_dbm" in
11677         $define)
11678                 val="$undef"
11679                 set i_rpcsvcdbm
11680                 eval $setvar
11681                 ;;
11682         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11683                 eval $inhdr
11684                 ;;
11685         esac
11686         ;;
11687 *)      echo "We won't be including <dbm.h>"
11688         val="$undef"
11689         set i_dbm
11690         eval $setvar
11691         val="$undef"
11692         set i_rpcsvcdbm
11693         eval $setvar
11694         ;;
11695 esac
11696
11697 : see if prototype for dbminit is available
11698 echo " "
11699 set d_dbminitproto dbminit $i_dbm dbm.h
11700 eval $hasproto
11701
11702 : see if difftime exists
11703 set difftime d_difftime
11704 eval $inlibc
11705
11706 : see if this is a dirent system
11707 echo " "
11708 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11709         val="$define"
11710         echo "<dirent.h> found." >&4
11711 else
11712         val="$undef"
11713         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11714                 echo "<sys/dir.h> found." >&4
11715                 echo " "
11716         else
11717                 xinc=`./findhdr sys/ndir.h`
11718         fi
11719         echo "<dirent.h> NOT found." >&4
11720 fi
11721 set i_dirent
11722 eval $setvar
11723
11724 : Look for type of directory structure.
11725 echo " "
11726 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11727
11728 case "$direntrytype" in
11729 ''|' ')
11730         case "$i_dirent" in
11731         $define) guess1='struct dirent' ;;
11732         *) guess1='struct direct'  ;;
11733         esac
11734         ;;
11735 *)      guess1="$direntrytype"
11736         ;;
11737 esac
11738
11739 case "$guess1" in
11740 'struct dirent') guess2='struct direct' ;;
11741 *) guess2='struct dirent' ;;
11742 esac
11743
11744 if $contains "$guess1" try.c >/dev/null 2>&1; then
11745         direntrytype="$guess1"
11746         echo "Your directory entries are $direntrytype." >&4
11747 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11748         direntrytype="$guess2"
11749         echo "Your directory entries seem to be $direntrytype." >&4
11750 else
11751         echo "I don't recognize your system's directory entries." >&4
11752         rp="What type is used for directory entries on this system?"
11753         dflt="$guess1"
11754         . ./myread
11755         direntrytype="$ans"
11756 fi
11757 $rm_try
11758
11759 : see if the directory entry stores field length
11760 echo " "
11761 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11762 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11763         echo "Good, your directory entry keeps length information in d_namlen." >&4
11764         val="$define"
11765 else
11766         echo "Your directory entry does not know about the d_namlen field." >&4
11767         val="$undef"
11768 fi
11769 set d_dirnamlen
11770 eval $setvar
11771 $rm_try
11772
11773 : Look for DIR.dd_fd
11774 case "$i_dirent" in
11775 "$define")
11776     echo "Checking to see if DIR has a dd_fd member variable" >&4
11777     $cat >try.c <<EOCP
11778 #$i_stdlib I_STDLIB
11779 #ifdef I_STDLIB
11780 #include <stdlib.h>
11781 #endif
11782 #include <dirent.h>
11783
11784 int main() {
11785     DIR dir;
11786     dir.dd_fd = 1;
11787     return 0;
11788 }
11789 EOCP
11790     val=$undef
11791     set try
11792     if eval $compile; then
11793         echo "Yes, it does."
11794         val="$define"
11795     else
11796         echo "No, it does not."
11797         val="$undef"
11798     fi
11799     ;;
11800 *)
11801     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11802     val="$undef"
11803     ;;
11804 esac
11805 set d_dir_dd_fd
11806 eval $setvar
11807 $rm_try
11808
11809 : see if this is an sysdir system
11810 set sys/dir.h i_sysdir
11811 eval $inhdr
11812
11813 : see if this is an sysndir system
11814 set sys/ndir.h i_sysndir
11815 eval $inhdr
11816
11817 : Look for dirfd
11818 echo " "
11819 $cat >dirfd.c <<EOM
11820 #include <stdio.h>
11821 #$i_stdlib I_STDLIB
11822 #ifdef I_STDLIB
11823 #include <stdlib.h>
11824 #endif
11825 #$i_dirent I_DIRENT             /**/
11826 #$i_sysdir I_SYS_DIR            /**/
11827 #$i_sysndir I_SYS_NDIR          /**/
11828 #$i_systypes I_SYS_TYPES        /**/
11829 #if defined(I_SYS_TYPES)
11830 #include <sys/types.h>
11831 #endif
11832 #if defined(I_DIRENT)
11833 #include <dirent.h>
11834 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11835 #include <sys/dir.h>
11836 #endif
11837 #else
11838 #ifdef I_SYS_NDIR
11839 #include <sys/ndir.h>
11840 #else
11841 #ifdef I_SYS_DIR
11842 #ifdef hp9000s500
11843 #include <ndir.h>       /* may be wrong in the future */
11844 #else
11845 #include <sys/dir.h>
11846 #endif
11847 #endif
11848 #endif
11849 #endif 
11850 int main() {
11851         DIR *dirp = opendir(".");
11852         if (dirfd(dirp) >= 0)
11853                 exit(0);
11854         else
11855                 exit(1);
11856 }
11857 EOM
11858 val=$undef
11859 set dirfd
11860 if eval $compile; then
11861         val="$define"
11862 fi
11863 case "$val" in
11864 $define)        echo "dirfd() found." >&4       ;;
11865 *)              echo "dirfd() NOT found." >&4   ;;
11866 esac
11867 set d_dirfd
11868 eval $setvar
11869 $rm -f dirfd*
11870
11871 : see if dlerror exists
11872 xxx_runnm="$runnm"
11873 runnm=false
11874 set dlerror d_dlerror
11875 eval $inlibc
11876 runnm="$xxx_runnm"
11877
11878 : see if dlfcn is available
11879 set dlfcn.h i_dlfcn
11880 eval $inhdr
11881
11882 : Check what extension to use for shared libs
11883 case "$usedl" in
11884 $define|y|true)
11885         $cat << EOM
11886
11887 On a few systems, the dynamically loaded modules that perl generates and uses
11888 will need a different extension than shared libs. The default will probably
11889 be appropriate.
11890
11891 EOM
11892         case "$dlext" in
11893         '')     dflt="$so" ;;
11894         *)      dflt="$dlext" ;;
11895         esac
11896         rp='What is the extension of dynamically loaded modules'
11897         . ./myread
11898         dlext="$ans"
11899         ;;
11900 *)
11901         dlext="none"
11902         ;;
11903 esac
11904
11905 : Check if dlsym need a leading underscore
11906 echo " "
11907 val="$undef"
11908
11909 case "$dlsrc" in
11910 dl_dlopen.xs)
11911         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11912         $cat >dyna.c <<'EOM'
11913 fred () { }
11914 EOM
11915
11916 $cat >fred.c<<EOM
11917
11918 #include <stdio.h>
11919 #$i_stdlib I_STDLIB
11920 #ifdef I_STDLIB
11921 #include <stdlib.h>
11922 #endif
11923 #$i_dlfcn I_DLFCN
11924 #ifdef I_DLFCN
11925 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11926 #else
11927 #include <sys/types.h>
11928 #include <nlist.h>
11929 #include <link.h>
11930 #endif
11931
11932 extern int fred() ;
11933
11934 int main()
11935 {
11936     void * handle ;
11937     void * symbol ;
11938 #ifndef RTLD_LAZY
11939     int mode = 1 ;
11940 #else
11941     int mode = RTLD_LAZY ;
11942 #endif
11943     handle = dlopen("./dyna.$dlext", mode) ;
11944     if (handle == NULL) {
11945         printf ("1\n") ;
11946         fflush (stdout) ;
11947         exit(0);
11948     }
11949     symbol = dlsym(handle, "fred") ;
11950     if (symbol == NULL) {
11951         /* try putting a leading underscore */
11952         symbol = dlsym(handle, "_fred") ;
11953         if (symbol == NULL) {
11954             printf ("2\n") ;
11955             fflush (stdout) ;
11956             exit(0);
11957         }
11958         printf ("3\n") ;
11959     }
11960     else
11961         printf ("4\n") ;
11962     fflush (stdout) ;
11963     exit(0);
11964 }
11965 EOM
11966         : Call the object file tmp-dyna.o in case dlext=o.
11967         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11968                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11969                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11970                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11971                 xxx=`$run ./fred`
11972                 case $xxx in
11973                 1)      echo "Test program failed using dlopen." >&4
11974                         echo "Perhaps you should not use dynamic loading." >&4;;
11975                 2)      echo "Test program failed using dlsym." >&4
11976                         echo "Perhaps you should not use dynamic loading." >&4;;
11977                 3)      echo "dlsym needs a leading underscore" >&4
11978                         val="$define" ;;
11979                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11980                 esac
11981         else
11982                 echo "I can't compile and run the test program." >&4
11983                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11984         fi
11985         ;;
11986 esac
11987
11988 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11989
11990 set d_dlsymun
11991 eval $setvar
11992
11993 : see if drand48_r exists
11994 set drand48_r d_drand48_r
11995 eval $inlibc
11996 case "$d_drand48_r" in
11997 "$define")
11998         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11999         case "$d_drand48_r_proto:$usethreads" in
12000         ":define")      d_drand48_r_proto=define
12001                 set d_drand48_r_proto drand48_r $hdrs
12002                 eval $hasproto ;;
12003         *)      ;;
12004         esac
12005         case "$d_drand48_r_proto" in
12006         define)
12007         case "$drand48_r_proto" in
12008         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12009         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12010         esac
12011         case "$drand48_r_proto" in
12012         ''|0)   d_drand48_r=undef
12013                 drand48_r_proto=0
12014                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12015         * )     case "$drand48_r_proto" in
12016                 REENTRANT_PROTO*) ;;
12017                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12018                 esac
12019                 echo "Prototype: $try" ;;
12020         esac
12021         ;;
12022         *)      case "$usethreads" in
12023                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12024                 esac
12025                 d_drand48_r=undef
12026                 drand48_r_proto=0
12027                 ;;
12028         esac
12029         ;;
12030 *)      drand48_r_proto=0
12031         ;;
12032 esac
12033
12034 : see if prototype for drand48 is available
12035 echo " "
12036 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12037 eval $hasproto
12038
12039 : see if dup2 exists
12040 set dup2 d_dup2
12041 eval $inlibc
12042
12043 : see if eaccess exists
12044 set eaccess d_eaccess
12045 eval $inlibc
12046
12047 : see if endgrent exists
12048 set endgrent d_endgrent
12049 eval $inlibc
12050
12051 : see if this is an grp system
12052 set grp.h i_grp
12053 eval $inhdr
12054
12055 case "$i_grp" in
12056 $define)
12057         xxx=`./findhdr grp.h`
12058         $cppstdin $cppflags $cppminus < $xxx >$$.h
12059
12060         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12061                 val="$define"
12062         else
12063                 val="$undef"
12064         fi
12065         set d_grpasswd
12066         eval $setvar
12067
12068         $rm -f $$.h
12069         ;;
12070 *)
12071         val="$undef";
12072         set d_grpasswd; eval $setvar
12073         ;;
12074 esac
12075
12076 : see if endgrent_r exists
12077 set endgrent_r d_endgrent_r
12078 eval $inlibc
12079 case "$d_endgrent_r" in
12080 "$define")
12081         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12082         case "$d_endgrent_r_proto:$usethreads" in
12083         ":define")      d_endgrent_r_proto=define
12084                 set d_endgrent_r_proto endgrent_r $hdrs
12085                 eval $hasproto ;;
12086         *)      ;;
12087         esac
12088         case "$d_endgrent_r_proto" in
12089         define)
12090         case "$endgrent_r_proto" in
12091         ''|0) try='int endgrent_r(FILE**);'
12092         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12093         esac
12094         case "$endgrent_r_proto" in
12095         ''|0) try='void endgrent_r(FILE**);'
12096         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12097         esac
12098         case "$endgrent_r_proto" in
12099         ''|0)   d_endgrent_r=undef
12100                 endgrent_r_proto=0
12101                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12102         * )     case "$endgrent_r_proto" in
12103                 REENTRANT_PROTO*) ;;
12104                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12105                 esac
12106                 echo "Prototype: $try" ;;
12107         esac
12108         ;;
12109         *)      case "$usethreads" in
12110                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12111                 esac
12112                 d_endgrent_r=undef
12113                 endgrent_r_proto=0
12114                 ;;
12115         esac
12116         ;;
12117 *)      endgrent_r_proto=0
12118         ;;
12119 esac
12120
12121 : see if endhostent exists
12122 set endhostent d_endhent
12123 eval $inlibc
12124
12125 : see if this is a netdb.h system
12126 set netdb.h i_netdb
12127 eval $inhdr
12128
12129 : see if endhostent_r exists
12130 set endhostent_r d_endhostent_r
12131 eval $inlibc
12132 case "$d_endhostent_r" in
12133 "$define")
12134         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12135         case "$d_endhostent_r_proto:$usethreads" in
12136         ":define")      d_endhostent_r_proto=define
12137                 set d_endhostent_r_proto endhostent_r $hdrs
12138                 eval $hasproto ;;
12139         *)      ;;
12140         esac
12141         case "$d_endhostent_r_proto" in
12142         define)
12143         case "$endhostent_r_proto" in
12144         ''|0) try='int endhostent_r(struct hostent_data*);'
12145         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12146         esac
12147         case "$endhostent_r_proto" in
12148         ''|0) try='void endhostent_r(struct hostent_data*);'
12149         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12150         esac
12151         case "$endhostent_r_proto" in
12152         ''|0)   d_endhostent_r=undef
12153                 endhostent_r_proto=0
12154                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12155         * )     case "$endhostent_r_proto" in
12156                 REENTRANT_PROTO*) ;;
12157                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12158                 esac
12159                 echo "Prototype: $try" ;;
12160         esac
12161         ;;
12162         *)      case "$usethreads" in
12163                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12164                 esac
12165                 d_endhostent_r=undef
12166                 endhostent_r_proto=0
12167                 ;;
12168         esac
12169         ;;
12170 *)      endhostent_r_proto=0
12171         ;;
12172 esac
12173
12174 : see if endnetent exists
12175 set endnetent d_endnent
12176 eval $inlibc
12177
12178 : see if endnetent_r exists
12179 set endnetent_r d_endnetent_r
12180 eval $inlibc
12181 case "$d_endnetent_r" in
12182 "$define")
12183         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12184         case "$d_endnetent_r_proto:$usethreads" in
12185         ":define")      d_endnetent_r_proto=define
12186                 set d_endnetent_r_proto endnetent_r $hdrs
12187                 eval $hasproto ;;
12188         *)      ;;
12189         esac
12190         case "$d_endnetent_r_proto" in
12191         define)
12192         case "$endnetent_r_proto" in
12193         ''|0) try='int endnetent_r(struct netent_data*);'
12194         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12195         esac
12196         case "$endnetent_r_proto" in
12197         ''|0) try='void endnetent_r(struct netent_data*);'
12198         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12199         esac
12200         case "$endnetent_r_proto" in
12201         ''|0)   d_endnetent_r=undef
12202                 endnetent_r_proto=0
12203                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12204         * )     case "$endnetent_r_proto" in
12205                 REENTRANT_PROTO*) ;;
12206                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12207                 esac
12208                 echo "Prototype: $try" ;;
12209         esac
12210         ;;
12211         *)      case "$usethreads" in
12212                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12213                 esac
12214                 d_endnetent_r=undef
12215                 endnetent_r_proto=0
12216                 ;;
12217         esac
12218         ;;
12219 *)      endnetent_r_proto=0
12220         ;;
12221 esac
12222
12223 : see if endprotoent exists
12224 set endprotoent d_endpent
12225 eval $inlibc
12226
12227 : see if endprotoent_r exists
12228 set endprotoent_r d_endprotoent_r
12229 eval $inlibc
12230 case "$d_endprotoent_r" in
12231 "$define")
12232         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12233         case "$d_endprotoent_r_proto:$usethreads" in
12234         ":define")      d_endprotoent_r_proto=define
12235                 set d_endprotoent_r_proto endprotoent_r $hdrs
12236                 eval $hasproto ;;
12237         *)      ;;
12238         esac
12239         case "$d_endprotoent_r_proto" in
12240         define)
12241         case "$endprotoent_r_proto" in
12242         ''|0) try='int endprotoent_r(struct protoent_data*);'
12243         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12244         esac
12245         case "$endprotoent_r_proto" in
12246         ''|0) try='void endprotoent_r(struct protoent_data*);'
12247         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12248         esac
12249         case "$endprotoent_r_proto" in
12250         ''|0)   d_endprotoent_r=undef
12251                 endprotoent_r_proto=0
12252                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12253         * )     case "$endprotoent_r_proto" in
12254                 REENTRANT_PROTO*) ;;
12255                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12256                 esac
12257                 echo "Prototype: $try" ;;
12258         esac
12259         ;;
12260         *)      case "$usethreads" in
12261                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12262                 esac
12263                 d_endprotoent_r=undef
12264                 endprotoent_r_proto=0
12265                 ;;
12266         esac
12267         ;;
12268 *)      endprotoent_r_proto=0
12269         ;;
12270 esac
12271
12272 : see if endpwent exists
12273 set endpwent d_endpwent
12274 eval $inlibc
12275
12276 : see if this is a pwd.h system
12277 set pwd.h i_pwd
12278 eval $inhdr
12279
12280 case "$i_pwd" in
12281 $define)
12282         xxx=`./findhdr pwd.h`
12283         $cppstdin $cppflags $cppminus < $xxx >$$.h
12284
12285         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12286                 val="$define"
12287         else
12288                 val="$undef"
12289         fi
12290         set d_pwquota
12291         eval $setvar
12292
12293         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12294                 val="$define"
12295         else
12296                 val="$undef"
12297         fi
12298         set d_pwage
12299         eval $setvar
12300
12301         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12302                 val="$define"
12303         else
12304                 val="$undef"
12305         fi
12306         set d_pwchange
12307         eval $setvar
12308
12309         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12310                 val="$define"
12311         else
12312                 val="$undef"
12313         fi
12314         set d_pwclass
12315         eval $setvar
12316
12317         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12318                 val="$define"
12319         else
12320                 val="$undef"
12321         fi
12322         set d_pwexpire
12323         eval $setvar
12324
12325         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12326                 val="$define"
12327         else
12328                 val="$undef"
12329         fi
12330         set d_pwcomment
12331         eval $setvar
12332
12333         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12334                 val="$define"
12335         else
12336                 val="$undef"
12337         fi
12338         set d_pwgecos
12339         eval $setvar
12340
12341         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12342                 val="$define"
12343         else
12344                 val="$undef"
12345         fi
12346         set d_pwpasswd
12347         eval $setvar
12348
12349         $rm -f $$.h
12350         ;;
12351 *)
12352         val="$undef"; 
12353         set d_pwquota; eval $setvar
12354         set d_pwage; eval $setvar
12355         set d_pwchange; eval $setvar
12356         set d_pwclass; eval $setvar
12357         set d_pwexpire; eval $setvar
12358         set d_pwcomment; eval $setvar
12359         set d_pwgecos; eval $setvar
12360         set d_pwpasswd; eval $setvar
12361         ;;
12362 esac
12363
12364 : see if endpwent_r exists
12365 set endpwent_r d_endpwent_r
12366 eval $inlibc
12367 case "$d_endpwent_r" in
12368 "$define")
12369         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12370         case "$d_endpwent_r_proto:$usethreads" in
12371         ":define")      d_endpwent_r_proto=define
12372                 set d_endpwent_r_proto endpwent_r $hdrs
12373                 eval $hasproto ;;
12374         *)      ;;
12375         esac
12376         case "$d_endpwent_r_proto" in
12377         define)
12378         case "$endpwent_r_proto" in
12379         ''|0) try='int endpwent_r(FILE**);'
12380         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12381         esac
12382         case "$endpwent_r_proto" in
12383         ''|0) try='void endpwent_r(FILE**);'
12384         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12385         esac
12386         case "$endpwent_r_proto" in
12387         ''|0)   d_endpwent_r=undef
12388                 endpwent_r_proto=0
12389                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12390         * )     case "$endpwent_r_proto" in
12391                 REENTRANT_PROTO*) ;;
12392                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12393                 esac
12394                 echo "Prototype: $try" ;;
12395         esac
12396         ;;
12397         *)      case "$usethreads" in
12398                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12399                 esac
12400                 d_endpwent_r=undef
12401                 endpwent_r_proto=0
12402                 ;;
12403         esac
12404         ;;
12405 *)      endpwent_r_proto=0
12406         ;;
12407 esac
12408
12409 : see if endservent exists
12410 set endservent d_endsent
12411 eval $inlibc
12412
12413 : see if endservent_r exists
12414 set endservent_r d_endservent_r
12415 eval $inlibc
12416 case "$d_endservent_r" in
12417 "$define")
12418         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12419         case "$d_endservent_r_proto:$usethreads" in
12420         ":define")      d_endservent_r_proto=define
12421                 set d_endservent_r_proto endservent_r $hdrs
12422                 eval $hasproto ;;
12423         *)      ;;
12424         esac
12425         case "$d_endservent_r_proto" in
12426         define)
12427         case "$endservent_r_proto" in
12428         ''|0) try='int endservent_r(struct servent_data*);'
12429         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12430         esac
12431         case "$endservent_r_proto" in
12432         ''|0) try='void endservent_r(struct servent_data*);'
12433         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12434         esac
12435         case "$endservent_r_proto" in
12436         ''|0)   d_endservent_r=undef
12437                 endservent_r_proto=0
12438                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12439         * )     case "$endservent_r_proto" in
12440                 REENTRANT_PROTO*) ;;
12441                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12442                 esac
12443                 echo "Prototype: $try" ;;
12444         esac
12445         ;;
12446         *)      case "$usethreads" in
12447                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12448                 esac
12449                 d_endservent_r=undef
12450                 endservent_r_proto=0
12451                 ;;
12452         esac
12453         ;;
12454 *)      endservent_r_proto=0
12455         ;;
12456 esac
12457
12458 : Locate the flags for 'open()'
12459 echo " "
12460 $cat >try.c <<EOCP
12461 #include <sys/types.h>
12462 #ifdef I_FCNTL
12463 #include <fcntl.h>
12464 #endif
12465 #ifdef I_SYS_FILE
12466 #include <sys/file.h>
12467 #endif
12468 #$i_stdlib I_STDLIB
12469 #ifdef I_STDLIB
12470 #include <stdlib.h>
12471 #endif
12472 int main() {
12473         if(O_RDONLY);
12474 #ifdef O_TRUNC
12475         exit(0);
12476 #else
12477         exit(1);
12478 #endif
12479 }
12480 EOCP
12481 : check sys/file.h first to get FREAD on Sun
12482 if $test `./findhdr sys/file.h` && \
12483                 set try -DI_SYS_FILE && eval $compile; then
12484         h_sysfile=true;
12485         echo "<sys/file.h> defines the O_* constants..." >&4
12486         if $run ./try; then
12487                 echo "and you have the 3 argument form of open()." >&4
12488                 val="$define"
12489         else
12490                 echo "but not the 3 argument form of open().  Oh, well." >&4
12491                 val="$undef"
12492         fi
12493 elif $test `./findhdr fcntl.h` && \
12494                 set try -DI_FCNTL && eval $compile; then
12495         h_fcntl=true;
12496         echo "<fcntl.h> defines the O_* constants..." >&4
12497         if $run ./try; then
12498                 echo "and you have the 3 argument form of open()." >&4
12499                 val="$define"
12500         else
12501                 echo "but not the 3 argument form of open().  Oh, well." >&4
12502                 val="$undef"
12503         fi
12504 else
12505         val="$undef"
12506         echo "I can't find the O_* constant definitions!  You got problems." >&4
12507 fi
12508 set d_open3
12509 eval $setvar
12510 $rm_try
12511
12512 : see if this is a sys/file.h system
12513 val=''
12514 set sys/file.h val
12515 eval $inhdr
12516
12517 : do we need to include sys/file.h ?
12518 case "$val" in
12519 "$define")
12520         echo " "
12521         if $h_sysfile; then
12522                 val="$define"
12523                 echo "We'll be including <sys/file.h>." >&4
12524         else
12525                 val="$undef"
12526                 echo "We won't be including <sys/file.h>." >&4
12527         fi
12528         ;;
12529 *)
12530         h_sysfile=false
12531         ;;
12532 esac
12533 set i_sysfile
12534 eval $setvar
12535
12536 : see if fcntl.h is there
12537 val=''
12538 set fcntl.h val
12539 eval $inhdr
12540
12541 : see if we can include fcntl.h
12542 case "$val" in
12543 "$define")
12544         echo " "
12545         if $h_fcntl; then
12546                 val="$define"
12547                 echo "We'll be including <fcntl.h>." >&4
12548         else
12549                 val="$undef"
12550                 if $h_sysfile; then
12551         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12552                 else
12553                         echo "We won't be including <fcntl.h>." >&4
12554                 fi
12555         fi
12556         ;;
12557 *)
12558         h_fcntl=false
12559         val="$undef"
12560         ;;
12561 esac
12562 set i_fcntl
12563 eval $setvar
12564
12565 : see if fork exists
12566 set fork d_fork
12567 eval $inlibc
12568
12569 : see if pipe exists
12570 set pipe d_pipe
12571 eval $inlibc
12572
12573 : check for non-blocking I/O stuff
12574 case "$h_sysfile" in
12575 true) echo "#include <sys/file.h>" > head.c;;
12576 *)
12577        case "$h_fcntl" in
12578        true) echo "#include <fcntl.h>" > head.c;;
12579        *) echo "#include <sys/fcntl.h>" > head.c;;
12580        esac
12581        ;;
12582 esac
12583 echo " "
12584 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12585 case "$o_nonblock" in
12586 '')
12587         $cat head.c > try.c
12588         $cat >>try.c <<EOCP
12589 #include <stdio.h>
12590 #$i_stdlib I_STDLIB
12591 #ifdef I_STDLIB
12592 #include <stdlib.h>
12593 #endif
12594 #$i_fcntl I_FCNTL
12595 #ifdef I_FCNTL
12596 #include <fcntl.h>
12597 #endif
12598 int main() {
12599 #ifdef O_NONBLOCK
12600         printf("O_NONBLOCK\n");
12601         exit(0);
12602 #endif
12603 #ifdef O_NDELAY
12604         printf("O_NDELAY\n");
12605         exit(0);
12606 #endif
12607 #ifdef FNDELAY
12608         printf("FNDELAY\n");
12609         exit(0);
12610 #endif
12611         exit(0);
12612 }
12613 EOCP
12614         set try
12615         if eval $compile_ok; then
12616                 o_nonblock=`$run ./try`
12617                 case "$o_nonblock" in
12618                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12619                 *) echo "Seems like we can use $o_nonblock.";;
12620                 esac
12621         else
12622                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12623         fi
12624         ;;
12625 *) echo "Using $hint value $o_nonblock.";;
12626 esac
12627 $rm_try
12628
12629 echo " "
12630 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12631 case "$eagain" in
12632 '')
12633         case "$d_fork:$d_pipe" in
12634         define:define)
12635         $cat head.c > try.c
12636         $cat >>try.c <<EOCP
12637 #include <errno.h>
12638 #include <sys/types.h>
12639 #include <signal.h>
12640 #include <stdio.h>
12641 #$i_stdlib I_STDLIB
12642 #ifdef I_STDLIB
12643 #include <stdlib.h>
12644 #endif
12645 #$i_fcntl I_FCNTL
12646 #ifdef I_FCNTL
12647 #include <fcntl.h>
12648 #endif
12649 #define MY_O_NONBLOCK $o_nonblock
12650 #ifndef errno  /* XXX need better Configure test */
12651 extern int errno;
12652 #endif
12653 #$i_unistd I_UNISTD
12654 #ifdef I_UNISTD
12655 #include <unistd.h>
12656 #endif
12657 #$i_string I_STRING
12658 #ifdef I_STRING
12659 #include <string.h>
12660 #else
12661 #include <strings.h>
12662 #endif
12663 $signal_t blech(int x) { exit(3); }
12664 EOCP
12665         $cat >> try.c <<'EOCP'
12666 int main()
12667 {
12668         int pd[2];
12669         int pu[2];
12670         char buf[1];
12671         char string[100];
12672
12673         pipe(pd);       /* Down: child -> parent */
12674         pipe(pu);       /* Up: parent -> child */
12675         if (0 != fork()) {
12676                 int ret;
12677                 close(pd[1]);   /* Parent reads from pd[0] */
12678                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12679 #ifdef F_SETFL
12680                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12681                         exit(1);
12682 #else
12683                 exit(4);
12684 #endif
12685                 signal(SIGALRM, blech);
12686                 alarm(5);
12687                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12688                         exit(2);
12689                 sprintf(string, "%d\n", ret);
12690                 write(2, string, strlen(string));
12691                 alarm(0);
12692 #ifdef EAGAIN
12693                 if (errno == EAGAIN) {
12694                         printf("EAGAIN\n");
12695                         goto ok;
12696                 }
12697 #endif
12698 #ifdef EWOULDBLOCK
12699                 if (errno == EWOULDBLOCK)
12700                         printf("EWOULDBLOCK\n");
12701 #endif
12702         ok:
12703                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12704                 sleep(2);                               /* Give it time to close our pipe */
12705                 alarm(5);
12706                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12707                 alarm(0);
12708                 sprintf(string, "%d\n", ret);
12709                 write(4, string, strlen(string));
12710                 exit(0);
12711         }
12712
12713         close(pd[0]);                   /* We write to pd[1] */
12714         close(pu[1]);                   /* We read from pu[0] */
12715         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12716         close(pd[1]);                   /* Pipe pd is now fully closed! */
12717         exit(0);                                /* Bye bye, thank you for playing! */
12718 }
12719 EOCP
12720         set try
12721         if eval $compile_ok; then
12722                 echo "$startsh" >mtry
12723                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12724                 chmod +x mtry
12725                 ./mtry >/dev/null 2>&1
12726                 case $? in
12727                 0) eagain=`$cat try.out`;;
12728                 1) echo "Could not perform non-blocking setting!";;
12729                 2) echo "I did a successful read() for something that was not there!";;
12730                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12731                 4) echo "Could not find F_SETFL!";;
12732                 *) echo "Something terribly wrong happened during testing.";;
12733                 esac
12734                 rd_nodata=`$cat try.ret`
12735                 echo "A read() system call with no data present returns $rd_nodata."
12736                 case "$rd_nodata" in
12737                 0|-1) ;;
12738                 *)
12739                         echo "(That's peculiar, fixing that to be -1.)"
12740                         rd_nodata=-1
12741                         ;;
12742                 esac
12743                 case "$eagain" in
12744                 '')
12745                         echo "Forcing errno EAGAIN on read() with no data available."
12746                         eagain=EAGAIN
12747                         ;;
12748                 *)
12749                         echo "Your read() sets errno to $eagain when no data is available."
12750                         ;;
12751                 esac
12752                 status=`$cat try.err`
12753                 case "$status" in
12754                 0) echo "And it correctly returns 0 to signal EOF.";;
12755                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12756                 *) echo "However, your read() returns '$status' on EOF??";;
12757                 esac
12758                 val="$define"
12759                 if test "$status" = "$rd_nodata"; then
12760                         echo "WARNING: you can't distinguish between EOF and no data!"
12761                         val="$undef"
12762                 fi
12763         else
12764                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12765                 eagain=EAGAIN
12766         fi
12767         ;;
12768         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12769                 eagain=EAGAIN
12770                 val="$define"
12771                 ;;
12772         esac
12773         set d_eofnblk
12774         eval $setvar
12775         ;;
12776 *)
12777         echo "Using $hint value $eagain."
12778         echo "Your read() returns $rd_nodata when no data is present."
12779         case "$d_eofnblk" in
12780         "$define") echo "And you can see EOF because read() returns 0.";;
12781         "$undef") echo "But you can't see EOF status from read() returned value.";;
12782         *)
12783                 echo "(Assuming you can't see EOF status from read anyway.)"
12784                 d_eofnblk=$undef
12785                 ;;
12786         esac
12787         ;;
12788 esac
12789 $rm_try head.c mtry
12790
12791 : see if _ptr and _cnt from stdio act std
12792 echo " "
12793
12794 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12795         echo "(Looks like you have stdio.h from BSD.)"
12796         case "$stdio_ptr" in
12797         '') stdio_ptr='((fp)->_p)'
12798                 ptr_lval=$define
12799                 ;;
12800         *)      ptr_lval=$d_stdio_ptr_lval;;
12801         esac
12802         case "$stdio_cnt" in
12803         '') stdio_cnt='((fp)->_r)'
12804                 cnt_lval=$define
12805                 ;;
12806         *)      cnt_lval=$d_stdio_cnt_lval;;
12807         esac
12808         case "$stdio_base" in
12809         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12810         esac
12811         case "$stdio_bufsiz" in
12812         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12813         esac
12814 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12815         echo "(Looks like you have stdio.h from Linux.)"
12816         case "$stdio_ptr" in
12817         '') stdio_ptr='((fp)->_IO_read_ptr)'
12818                 ptr_lval=$define
12819                 ;;
12820         *)      ptr_lval=$d_stdio_ptr_lval;;
12821         esac
12822         case "$stdio_cnt" in
12823         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12824                 cnt_lval=$undef
12825                 ;;
12826         *)      cnt_lval=$d_stdio_cnt_lval;;
12827         esac
12828         case "$stdio_base" in
12829         '') stdio_base='((fp)->_IO_read_base)';;
12830         esac
12831         case "$stdio_bufsiz" in
12832         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12833         esac
12834 else
12835         case "$stdio_ptr" in
12836         '') stdio_ptr='((fp)->_ptr)'
12837                 ptr_lval=$define
12838                 ;;
12839         *)      ptr_lval=$d_stdio_ptr_lval;;
12840         esac
12841         case "$stdio_cnt" in
12842         '') stdio_cnt='((fp)->_cnt)'
12843                 cnt_lval=$define
12844                 ;;
12845         *)      cnt_lval=$d_stdio_cnt_lval;;
12846         esac
12847         case "$stdio_base" in
12848         '') stdio_base='((fp)->_base)';;
12849         esac
12850         case "$stdio_bufsiz" in
12851         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12852         esac
12853 fi
12854
12855 : test whether _ptr and _cnt really work
12856 echo "Checking how std your stdio is..." >&4
12857 $cat >try.c <<EOP
12858 #include <stdio.h>
12859 #$i_stdlib I_STDLIB
12860 #ifdef I_STDLIB
12861 #include <stdlib.h>
12862 #endif
12863 #define FILE_ptr(fp)    $stdio_ptr
12864 #define FILE_cnt(fp)    $stdio_cnt
12865 int main() {
12866         FILE *fp = fopen("try.c", "r");
12867         char c = getc(fp);
12868         if (
12869                 18 <= FILE_cnt(fp) &&
12870                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12871         )
12872                 exit(0);
12873         exit(1);
12874 }
12875 EOP
12876 val="$undef"
12877 set try
12878 if eval $compile && $to try.c; then
12879         if $run ./try; then
12880                 echo "Your stdio acts pretty std."
12881                 val="$define"
12882         else
12883                 echo "Your stdio isn't very std."
12884         fi
12885 else
12886         echo "Your stdio doesn't appear very std."
12887 fi
12888 $rm_try
12889
12890 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12891 # direct buffer manipulation no longer works.  The Configure tests
12892 # should be changed to correctly detect this, but until then,
12893 # the following check should at least let perl compile and run.
12894 # (This quick fix should be updated before 5.8.1.)
12895 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12896 # A. Dougherty, June 3, 2002.
12897 case "$d_gnulibc" in
12898 $define)
12899         case "$gnulibc_version" in
12900         2.[01]*)  ;;
12901         2.2) ;;
12902         2.2.[0-9]) ;;
12903         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12904                 val="$undef"
12905                 ;;
12906         esac
12907         ;;
12908 esac
12909 set d_stdstdio
12910 eval $setvar
12911
12912 : Can _ptr be used as an lvalue?
12913 case "$d_stdstdio$ptr_lval" in
12914 $define$define) val=$define ;;
12915 *) val=$undef ;;
12916 esac
12917 set d_stdio_ptr_lval
12918 eval $setvar
12919
12920 : Can _cnt be used as an lvalue?
12921 case "$d_stdstdio$cnt_lval" in
12922 $define$define) val=$define ;;
12923 *) val=$undef ;;
12924 esac
12925 set d_stdio_cnt_lval
12926 eval $setvar
12927
12928
12929 : test whether setting _ptr sets _cnt as a side effect
12930 d_stdio_ptr_lval_sets_cnt="$undef"
12931 d_stdio_ptr_lval_nochange_cnt="$undef"
12932 case "$d_stdio_ptr_lval$d_stdstdio" in
12933 $define$define)
12934         echo "Checking to see what happens if we set the stdio ptr..." >&4
12935 $cat >try.c <<EOP
12936 #include <stdio.h>
12937 /* Can we scream? */
12938 /* Eat dust sed :-) */
12939 /* In the buffer space, no one can hear you scream. */
12940 #$i_stdlib I_STDLIB
12941 #ifdef I_STDLIB
12942 #include <stdlib.h>
12943 #endif
12944 #define FILE_ptr(fp)    $stdio_ptr
12945 #define FILE_cnt(fp)    $stdio_cnt
12946 #include <sys/types.h>
12947 int main() {
12948         FILE *fp = fopen("try.c", "r");
12949         int c;
12950         char *ptr;
12951         size_t cnt;
12952         if (!fp) {
12953             puts("Fail even to read");
12954             exit(1);
12955         }
12956         c = getc(fp); /* Read away the first # */
12957         if (c == EOF) {
12958             puts("Fail even to read");
12959             exit(1);
12960         }
12961         if (!(
12962                 18 <= FILE_cnt(fp) &&
12963                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12964         )) {
12965                 puts("Fail even to read");
12966                 exit (1);
12967         }
12968         ptr = (char*) FILE_ptr(fp);
12969         cnt = (size_t)FILE_cnt(fp);
12970
12971         FILE_ptr(fp) += 42;
12972
12973         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12974                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12975                 exit (1);
12976         }
12977         if (FILE_cnt(fp) <= 20) {
12978                 printf ("Fail (<20 chars to test)");
12979                 exit (1);
12980         }
12981         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12982                 puts("Fail compare");
12983                 exit (1);
12984         }
12985         if (cnt == FILE_cnt(fp)) {
12986                 puts("Pass_unchanged");
12987                 exit (0);
12988         }
12989         if (FILE_cnt(fp) == (cnt - 42)) {
12990                 puts("Pass_changed");
12991                 exit (0);
12992         }
12993         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12994         return 1;
12995
12996 }
12997 EOP
12998         set try
12999         if eval $compile && $to try.c; then
13000                 case `$run ./try` in
13001                 Pass_changed)
13002                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13003                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13004                 Pass_unchanged)
13005                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13006                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13007                 Fail*)
13008                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13009                 *)
13010                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13011         esac
13012         else
13013                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13014         fi
13015         $rm_try
13016         ;;
13017 esac
13018
13019 : see if _base is also standard
13020 val="$undef"
13021 case "$d_stdstdio" in
13022 $define)
13023         $cat >try.c <<EOP
13024 #include <stdio.h>
13025 #$i_stdlib I_STDLIB
13026 #ifdef I_STDLIB
13027 #include <stdlib.h>
13028 #endif
13029 #define FILE_base(fp)   $stdio_base
13030 #define FILE_bufsiz(fp) $stdio_bufsiz
13031 int main() {
13032         FILE *fp = fopen("try.c", "r");
13033         char c = getc(fp);
13034         if (
13035                 19 <= FILE_bufsiz(fp) &&
13036                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13037         )
13038                 exit(0);
13039         exit(1);
13040 }
13041 EOP
13042         set try
13043         if eval $compile && $to try.c; then
13044                 if $run ./try; then
13045                         echo "And its _base field acts std."
13046                         val="$define"
13047                 else
13048                         echo "But its _base field isn't std."
13049                 fi
13050         else
13051                 echo "However, it seems to be lacking the _base field."
13052         fi
13053         $rm_try
13054         ;;
13055 esac
13056 set d_stdiobase
13057 eval $setvar
13058
13059 : see if fast_stdio exists
13060 val="$undef"
13061 case "$d_stdstdio:$d_stdio_ptr_lval" in
13062 "$define:$define")
13063         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13064         *$define*)
13065                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13066                 val="$define"
13067                 ;;
13068         esac
13069         ;;
13070 esac
13071 set d_faststdio
13072 eval $setvar
13073
13074
13075
13076 : see if fchdir exists
13077 set fchdir d_fchdir
13078 eval $inlibc
13079
13080 : see if fchmod exists
13081 set fchmod d_fchmod
13082 eval $inlibc
13083
13084 : see if fchown exists
13085 set fchown d_fchown
13086 eval $inlibc
13087
13088 : see if this is an fcntl system
13089 set fcntl d_fcntl
13090 eval $inlibc
13091
13092 : See if fcntl-based locking works.
13093 echo " "
13094 $cat >try.c <<EOCP
13095 #$i_stdlib I_STDLIB
13096 #ifdef I_STDLIB
13097 #include <stdlib.h>
13098 #endif
13099 #include <unistd.h>
13100 #include <fcntl.h>
13101 #include <signal.h>
13102 $signal_t blech(int x) { exit(3); }
13103 int main() {
13104 #if defined(F_SETLK) && defined(F_SETLKW)
13105      struct flock flock;
13106      int retval, fd;
13107      fd = open("try.c", O_RDONLY);
13108      flock.l_type = F_RDLCK;
13109      flock.l_whence = SEEK_SET;
13110      flock.l_start = flock.l_len = 0;
13111      signal(SIGALRM, blech);
13112      alarm(10);
13113      retval = fcntl(fd, F_SETLK, &flock);
13114      close(fd);
13115      (retval < 0 ? exit(2) : exit(0));
13116 #else
13117      exit(2);
13118 #endif
13119 }
13120 EOCP
13121 echo "Checking if fcntl-based file locking works... "
13122 case "$d_fcntl" in
13123 "$define")
13124         set try
13125         if eval $compile_ok; then
13126                 if $run ./try; then
13127                         echo "Yes, it seems to work."
13128                         val="$define"
13129                 else
13130                         echo "Nope, it didn't work."
13131                         val="$undef"
13132                         case "$?" in
13133                         3) $cat >&4 <<EOM
13134 ***
13135 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13136 *** This is (almost) impossible.
13137 *** If your NFS lock daemons are not feeling well, something like
13138 *** this may happen, please investigate.  Cannot continue, aborting.
13139 ***
13140 EOM
13141                                 exit 1
13142                                 ;;
13143                         esac
13144                 fi
13145         else
13146                 echo "I'm unable to compile the test program, so I'll assume not."
13147                 val="$undef"
13148         fi
13149         ;;
13150 *) val="$undef";
13151         echo "Nope, since you don't even have fcntl()."
13152         ;;
13153 esac
13154 set d_fcntl_can_lock
13155 eval $setvar
13156 $rm_try
13157
13158 : check for fd_set items
13159 $cat <<EOM
13160
13161 Checking to see how well your C compiler handles fd_set and friends ...
13162 EOM
13163 $cat >try.c <<EOCP
13164 #$i_stdlib I_STDLIB
13165 #ifdef I_STDLIB
13166 #include <stdlib.h>
13167 #endif
13168 #$i_systime I_SYS_TIME
13169 #$i_sysselct I_SYS_SELECT
13170 #$d_socket HAS_SOCKET
13171 #include <sys/types.h>
13172 #ifdef HAS_SOCKET
13173 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13174 #endif
13175 #ifdef I_SYS_TIME
13176 #include <sys/time.h>
13177 #endif
13178 #ifdef I_SYS_SELECT
13179 #include <sys/select.h>
13180 #endif
13181 int main() {
13182         fd_set fds;
13183
13184 #ifdef TRYBITS
13185         if(fds.fds_bits);
13186 #endif
13187
13188 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13189         exit(0);
13190 #else
13191         exit(1);
13192 #endif
13193 }
13194 EOCP
13195 set try -DTRYBITS
13196 if eval $compile; then
13197         d_fds_bits="$define"
13198         d_fd_set="$define"
13199         echo "Well, your system knows about the normal fd_set typedef..." >&4
13200         if $run ./try; then
13201                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13202                 d_fd_macros="$define"
13203         else
13204                 $cat >&4 <<'EOM'
13205 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13206 EOM
13207                 d_fd_macros="$undef"
13208         fi
13209 else
13210         $cat <<'EOM'
13211 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13212 EOM
13213         set try
13214         if eval $compile; then
13215                 d_fds_bits="$undef"
13216                 d_fd_set="$define"
13217                 echo "Well, your system has some sort of fd_set available..." >&4
13218                 if $run ./try; then
13219                         echo "and you have the normal fd_set macros." >&4
13220                         d_fd_macros="$define"
13221                 else
13222                         $cat <<'EOM'
13223 but not the normal fd_set macros!  Gross!  More work for me...
13224 EOM
13225                         d_fd_macros="$undef"
13226                 fi
13227         else
13228         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13229                 d_fd_set="$undef"
13230                 d_fds_bits="$undef"
13231                 d_fd_macros="$undef"
13232         fi
13233 fi
13234 $rm_try
13235
13236 : see if fgetpos exists
13237 set fgetpos d_fgetpos
13238 eval $inlibc
13239
13240 : see if finite exists
13241 set finite d_finite
13242 eval $inlibc
13243
13244 : see if finitel exists
13245 set finitel d_finitel
13246 eval $inlibc
13247
13248 : see if flock exists
13249 set flock d_flock
13250 eval $inlibc
13251
13252 : see if prototype for flock is available
13253 echo " "
13254 set d_flockproto flock $i_sysfile sys/file.h
13255 eval $hasproto
13256
13257 : see if fp_class exists
13258 set fp_class d_fp_class
13259 eval $inlibc
13260
13261 : see if pathconf exists
13262 set pathconf d_pathconf
13263 eval $inlibc
13264
13265 : see if fpathconf exists
13266 set fpathconf d_fpathconf
13267 eval $inlibc
13268
13269 : see if fpclass exists
13270 set fpclass d_fpclass
13271 eval $inlibc
13272
13273 : see if fpclassify exists
13274 set fpclassify d_fpclassify
13275 eval $inlibc
13276
13277 : see if fpclassl exists
13278 set fpclassl d_fpclassl
13279 eval $inlibc
13280
13281 : check for fpos64_t
13282 echo " "
13283 echo "Checking to see if you have fpos64_t..." >&4
13284 $cat >try.c <<EOCP
13285 #include <stdio.h>
13286 int main() { fpos64_t x = 7; }
13287 EOCP
13288 set try
13289 if eval $compile; then
13290         val="$define"
13291         echo "You have fpos64_t."
13292 else
13293         val="$undef"
13294         echo "You do not have fpos64_t."
13295         case "$fpossize" in
13296         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13297         esac
13298 fi
13299 $rm_try
13300 set d_fpos64_t
13301 eval $setvar
13302
13303 : see if frexpl exists
13304 set frexpl d_frexpl
13305 eval $inlibc
13306
13307 : see if this is a sys/param system
13308 set sys/param.h i_sysparam
13309 eval $inhdr
13310
13311 : see if this is a sys/mount.h system
13312 set sys/mount.h i_sysmount
13313 eval $inhdr
13314
13315 : Check for fs_data_s
13316 echo " "
13317 echo "Checking to see if your system supports struct fs_data..." >&4
13318 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13319 eval $hasstruct
13320 case "$d_fs_data_s" in
13321 "$define")      echo "Yes, it does."   ;;
13322 *)              echo "No, it doesn't." ;;
13323 esac
13324
13325 : see if fseeko exists
13326 set fseeko d_fseeko
13327 eval $inlibc
13328 case "$longsize" in
13329 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13330 esac
13331
13332 : see if fsetpos exists
13333 set fsetpos d_fsetpos
13334 eval $inlibc
13335
13336 : see if fstatfs exists
13337 set fstatfs d_fstatfs
13338 eval $inlibc
13339
13340 : see if statvfs exists
13341 set statvfs d_statvfs
13342 eval $inlibc
13343
13344 : see if fstatvfs exists
13345 set fstatvfs d_fstatvfs
13346 eval $inlibc
13347
13348
13349 : see if fsync exists
13350 set fsync d_fsync
13351 eval $inlibc
13352
13353 : see if ftello exists
13354 set ftello d_ftello
13355 eval $inlibc
13356 case "$longsize" in
13357 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13358 esac
13359
13360 : check for a working futimes
13361 d_futimes="$undef"
13362 echo " "
13363 echo "Checking if you have a working futimes()" >&4
13364 $cat >try.c <<EOCP
13365 #include <stdio.h>
13366 #include <sys/time.h>
13367 #include <errno.h>
13368 #include <fcntl.h>
13369
13370 int main ()
13371 {
13372     int fd, rv;
13373     fd = open ("try.c", O_RDWR);
13374     if (-1 == fd) exit (1);
13375     rv = futimes (fd, NULL);
13376     exit (rv == -1 ? errno : 0);
13377 }
13378 EOCP
13379 set try
13380 if eval $compile; then
13381     `$run ./try`
13382     rc=$?
13383     case "$rc" in
13384         0)  echo "Yes, you have" >&4
13385             d_futimes="$define"
13386             ;;
13387         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13388             ;;
13389     esac
13390 else
13391     echo "No, it does not (probably harmless)" >&4
13392 fi
13393 $rm_try
13394
13395 : see if ndbm.h is available
13396 set ndbm.h i_ndbm
13397 eval $inhdr
13398 : Compatibility location for RedHat 7.1
13399 set gdbm/ndbm.h i_gdbmndbm
13400 eval $inhdr
13401 : Compatibility location for Debian 4.0
13402 set gdbm-ndbm.h i_gdbm_ndbm
13403 eval $inhdr
13404
13405 val="$undef"
13406 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13407         : see if dbm_open exists
13408         set dbm_open d_dbm_open
13409         eval $inlibc
13410         case "$d_dbm_open" in
13411         $undef)
13412                 i_ndbm="$undef"
13413                 i_gdbmndbm="$undef"
13414                 i_gdbm_ndbm="$undef"
13415                 echo "We won't be including <ndbm.h>"
13416                 val="$undef"
13417                 ;;
13418         *) val="$define"
13419            ;;
13420         esac
13421 fi
13422 set d_ndbm
13423 eval $setvar
13424
13425 ndbm_hdr_protochk='name=$1; hdr=$2;
13426 eval "ihdr=\$""i_$name";
13427 val="$undef";
13428 if $test "$ihdr" = "$define"; then
13429         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13430         case "$d_cplusplus" in
13431         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13432         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13433         esac;
13434         case "$val" in
13435         $define) $echo "Your <$hdr> seems to have prototypes";;
13436         *) $echo "Your <$hdr> does not seem to have prototypes";;
13437         esac;
13438 fi;
13439 set "d_${name}_h_uses_prototypes";
13440 eval $setvar'
13441
13442 set ndbm ndbm.h
13443 eval $ndbm_hdr_protochk
13444 set gdbmndbm gdbm/ndbm.h
13445 eval $ndbm_hdr_protochk
13446 set gdbm_ndbm gdbm-ndbm.h
13447 eval $ndbm_hdr_protochk
13448
13449 : see if getaddrinfo exists
13450 set getaddrinfo d_getaddrinfo
13451 eval $inlibc
13452
13453 : see if getcwd exists
13454 set getcwd d_getcwd
13455 eval $inlibc
13456
13457 : see if getespwnam exists
13458 set getespwnam d_getespwnam
13459 eval $inlibc
13460
13461 : see if getfsstat exists
13462 set getfsstat d_getfsstat
13463 eval $inlibc
13464
13465 : see if getgrent exists
13466 set getgrent d_getgrent
13467 eval $inlibc
13468
13469 : see if getgrent_r exists
13470 set getgrent_r d_getgrent_r
13471 eval $inlibc
13472 case "$d_getgrent_r" in
13473 "$define")
13474         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13475         case "$d_getgrent_r_proto:$usethreads" in
13476         ":define")      d_getgrent_r_proto=define
13477                 set d_getgrent_r_proto getgrent_r $hdrs
13478                 eval $hasproto ;;
13479         *)      ;;
13480         esac
13481         case "$d_getgrent_r_proto" in
13482         define)
13483         case "$getgrent_r_proto" in
13484         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13485         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13486         esac
13487         case "$getgrent_r_proto" in
13488         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13489         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13490         esac
13491         case "$getgrent_r_proto" in
13492         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13493         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13494         esac
13495         case "$getgrent_r_proto" in
13496         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13497         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13498         esac
13499         case "$getgrent_r_proto" in
13500         ''|0) try='int getgrent_r(struct group*, char*, int);'
13501         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13502         esac
13503         case "$getgrent_r_proto" in
13504         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13505         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13506         esac
13507         case "$getgrent_r_proto" in
13508         ''|0)   d_getgrent_r=undef
13509                 getgrent_r_proto=0
13510                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13511         * )     case "$getgrent_r_proto" in
13512                 REENTRANT_PROTO*) ;;
13513                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13514                 esac
13515                 echo "Prototype: $try" ;;
13516         esac
13517         ;;
13518         *)      case "$usethreads" in
13519                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13520                 esac
13521                 d_getgrent_r=undef
13522                 getgrent_r_proto=0
13523                 ;;
13524         esac
13525         ;;
13526 *)      getgrent_r_proto=0
13527         ;;
13528 esac
13529
13530 : see if getgrgid_r exists
13531 set getgrgid_r d_getgrgid_r
13532 eval $inlibc
13533 case "$d_getgrgid_r" in
13534 "$define")
13535         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13536         case "$d_getgrgid_r_proto:$usethreads" in
13537         ":define")      d_getgrgid_r_proto=define
13538                 set d_getgrgid_r_proto getgrgid_r $hdrs
13539                 eval $hasproto ;;
13540         *)      ;;
13541         esac
13542         case "$d_getgrgid_r_proto" in
13543         define)
13544         case "$getgrgid_r_proto" in
13545         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13546         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13547         esac
13548         case "$getgrgid_r_proto" in
13549         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13550         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13551         esac
13552         case "$getgrgid_r_proto" in
13553         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13554         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13555         esac
13556         case "$getgrgid_r_proto" in
13557         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13558         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13559         esac
13560         case "$getgrgid_r_proto" in
13561         ''|0)   d_getgrgid_r=undef
13562                 getgrgid_r_proto=0
13563                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13564         * )     case "$getgrgid_r_proto" in
13565                 REENTRANT_PROTO*) ;;
13566                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13567                 esac
13568                 echo "Prototype: $try" ;;
13569         esac
13570         ;;
13571         *)      case "$usethreads" in
13572                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13573                 esac
13574                 d_getgrgid_r=undef
13575                 getgrgid_r_proto=0
13576                 ;;
13577         esac
13578         ;;
13579 *)      getgrgid_r_proto=0
13580         ;;
13581 esac
13582
13583 : see if getgrnam_r exists
13584 set getgrnam_r d_getgrnam_r
13585 eval $inlibc
13586 case "$d_getgrnam_r" in
13587 "$define")
13588         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13589         case "$d_getgrnam_r_proto:$usethreads" in
13590         ":define")      d_getgrnam_r_proto=define
13591                 set d_getgrnam_r_proto getgrnam_r $hdrs
13592                 eval $hasproto ;;
13593         *)      ;;
13594         esac
13595         case "$d_getgrnam_r_proto" in
13596         define)
13597         case "$getgrnam_r_proto" in
13598         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13599         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13600         esac
13601         case "$getgrnam_r_proto" in
13602         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13603         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13604         esac
13605         case "$getgrnam_r_proto" in
13606         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13607         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13608         esac
13609         case "$getgrnam_r_proto" in
13610         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13611         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13612         esac
13613         case "$getgrnam_r_proto" in
13614         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13615         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13616         esac
13617         case "$getgrnam_r_proto" in
13618         ''|0)   d_getgrnam_r=undef
13619                 getgrnam_r_proto=0
13620                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13621         * )     case "$getgrnam_r_proto" in
13622                 REENTRANT_PROTO*) ;;
13623                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13624                 esac
13625                 echo "Prototype: $try" ;;
13626         esac
13627         ;;
13628         *)      case "$usethreads" in
13629                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13630                 esac
13631                 d_getgrnam_r=undef
13632                 getgrnam_r_proto=0
13633                 ;;
13634         esac
13635         ;;
13636 *)      getgrnam_r_proto=0
13637         ;;
13638 esac
13639
13640 : see if gethostbyaddr exists
13641 set gethostbyaddr d_gethbyaddr
13642 eval $inlibc
13643
13644 : see if gethostbyname exists
13645 set gethostbyname d_gethbyname
13646 eval $inlibc
13647
13648 : see if gethostent exists
13649 set gethostent d_gethent
13650 eval $inlibc
13651
13652 : see how we will look up host name
13653 echo " "
13654 call=''
13655 if set gethostname val -f d_gethname; eval $csym; $val; then
13656         echo 'gethostname() found.' >&4
13657         d_gethname="$define"
13658         call=gethostname
13659 fi
13660 if set uname val -f d_uname; eval $csym; $val; then
13661         if ./xenix; then
13662                 $cat <<'EOM'
13663 uname() was found, but you're running xenix, and older versions of xenix
13664 have a broken uname(). If you don't really know whether your xenix is old
13665 enough to have a broken system call, use the default answer.
13666
13667 EOM
13668                 dflt=y
13669                 case "$d_uname" in
13670                 "$define") dflt=n;;
13671                 esac
13672                 rp='Is your uname() broken?'
13673                 . ./myread
13674                 case "$ans" in
13675                 n*) d_uname="$define"; call=uname;;
13676                 esac
13677         else
13678                 echo 'uname() found.' >&4
13679                 d_uname="$define"
13680                 case "$call" in
13681                 '') call=uname ;;
13682                 esac
13683         fi
13684 fi
13685 case "$d_gethname" in
13686 '') d_gethname="$undef";;
13687 esac
13688 case "$d_uname" in
13689 '') d_uname="$undef";;
13690 esac
13691 case "$d_uname$d_gethname" in
13692 *define*)
13693         dflt=n
13694         cat <<EOM
13695
13696 Every now and then someone has a $call() that lies about the hostname
13697 but can't be fixed for political or economic reasons.  If you wish, I can
13698 pretend $call() isn't there and maybe compute hostname at run-time
13699 thanks to the '$phostname' command.
13700
13701 EOM
13702         rp="Shall I ignore $call() from now on?"
13703         . ./myread
13704         case "$ans" in
13705         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13706         esac;;
13707 esac
13708 case "$phostname" in
13709 '') aphostname='';;
13710 *) case "$aphostname" in
13711         /*) ;;
13712         *) set X $phostname
13713                 shift
13714                 file=$1
13715                 shift
13716                 file=`./loc $file $file $pth`
13717                 aphostname=`echo $file $*`
13718                 ;;
13719         esac
13720         ;;
13721 esac
13722 case "$d_uname$d_gethname" in
13723 *define*) ;;
13724 *)
13725         case "$phostname" in
13726         '')
13727                 echo "There will be no way for $package to get your hostname." >&4;;
13728         *)
13729         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13730                 ;;
13731         esac;;
13732 esac
13733 case "$d_phostname" in
13734 '') d_phostname="$undef";;
13735 esac
13736
13737 : see if gethostbyaddr_r exists
13738 set gethostbyaddr_r d_gethostbyaddr_r
13739 eval $inlibc
13740 case "$d_gethostbyaddr_r" in
13741 "$define")
13742         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13743         case "$d_gethostbyaddr_r_proto:$usethreads" in
13744         ":define")      d_gethostbyaddr_r_proto=define
13745                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13746                 eval $hasproto ;;
13747         *)      ;;
13748         esac
13749         case "$d_gethostbyaddr_r_proto" in
13750         define)
13751         case "$gethostbyaddr_r_proto" in
13752         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13753         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13754         esac
13755         case "$gethostbyaddr_r_proto" in
13756         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13757         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13758         esac
13759         case "$gethostbyaddr_r_proto" in
13760         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13761         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13762         esac
13763         case "$gethostbyaddr_r_proto" in
13764         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13765         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13766         esac
13767         case "$gethostbyaddr_r_proto" in
13768         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13769         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13770         esac
13771         case "$gethostbyaddr_r_proto" in
13772         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13773         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13774         esac
13775         case "$gethostbyaddr_r_proto" in
13776         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13777         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13778         esac
13779         case "$gethostbyaddr_r_proto" in
13780         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13781         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13782         esac
13783         case "$gethostbyaddr_r_proto" in
13784         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13785         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13786         esac
13787         case "$gethostbyaddr_r_proto" in
13788         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13789         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13790         esac
13791         case "$gethostbyaddr_r_proto" in
13792         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13793         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13794         esac
13795         case "$gethostbyaddr_r_proto" in
13796         ''|0)   d_gethostbyaddr_r=undef
13797                 gethostbyaddr_r_proto=0
13798                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13799         * )     case "$gethostbyaddr_r_proto" in
13800                 REENTRANT_PROTO*) ;;
13801                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13802                 esac
13803                 echo "Prototype: $try" ;;
13804         esac
13805         ;;
13806         *)      case "$usethreads" in
13807                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13808                 esac
13809                 d_gethostbyaddr_r=undef
13810                 gethostbyaddr_r_proto=0
13811                 ;;
13812         esac
13813         ;;
13814 *)      gethostbyaddr_r_proto=0
13815         ;;
13816 esac
13817
13818 : see if gethostbyname_r exists
13819 set gethostbyname_r d_gethostbyname_r
13820 eval $inlibc
13821 case "$d_gethostbyname_r" in
13822 "$define")
13823         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13824         case "$d_gethostbyname_r_proto:$usethreads" in
13825         ":define")      d_gethostbyname_r_proto=define
13826                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13827                 eval $hasproto ;;
13828         *)      ;;
13829         esac
13830         case "$d_gethostbyname_r_proto" in
13831         define)
13832         case "$gethostbyname_r_proto" in
13833         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13834         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13835         esac
13836         case "$gethostbyname_r_proto" in
13837         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13838         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13839         esac
13840         case "$gethostbyname_r_proto" in
13841         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13842         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13843         esac
13844         case "$gethostbyname_r_proto" in
13845         ''|0)   d_gethostbyname_r=undef
13846                 gethostbyname_r_proto=0
13847                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13848         * )     case "$gethostbyname_r_proto" in
13849                 REENTRANT_PROTO*) ;;
13850                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13851                 esac
13852                 echo "Prototype: $try" ;;
13853         esac
13854         ;;
13855         *)      case "$usethreads" in
13856                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13857                 esac
13858                 d_gethostbyname_r=undef
13859                 gethostbyname_r_proto=0
13860                 ;;
13861         esac
13862         ;;
13863 *)      gethostbyname_r_proto=0
13864         ;;
13865 esac
13866
13867 : see if gethostent_r exists
13868 set gethostent_r d_gethostent_r
13869 eval $inlibc
13870 case "$d_gethostent_r" in
13871 "$define")
13872         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13873         case "$d_gethostent_r_proto:$usethreads" in
13874         ":define")      d_gethostent_r_proto=define
13875                 set d_gethostent_r_proto gethostent_r $hdrs
13876                 eval $hasproto ;;
13877         *)      ;;
13878         esac
13879         case "$d_gethostent_r_proto" in
13880         define)
13881         case "$gethostent_r_proto" in
13882         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13883         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13884         esac
13885         case "$gethostent_r_proto" in
13886         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13887         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13888         esac
13889         case "$gethostent_r_proto" in
13890         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13891         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13892         esac
13893         case "$gethostent_r_proto" in
13894         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13895         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13896         esac
13897         case "$gethostent_r_proto" in
13898         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13899         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13900         esac
13901         case "$gethostent_r_proto" in
13902         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13903         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13904         esac
13905         case "$gethostent_r_proto" in
13906         ''|0)   d_gethostent_r=undef
13907                 gethostent_r_proto=0
13908                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13909         * )     case "$gethostent_r_proto" in
13910                 REENTRANT_PROTO*) ;;
13911                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13912                 esac
13913                 echo "Prototype: $try" ;;
13914         esac
13915         ;;
13916         *)      case "$usethreads" in
13917                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13918                 esac
13919                 d_gethostent_r=undef
13920                 gethostent_r_proto=0
13921                 ;;
13922         esac
13923         ;;
13924 *)      gethostent_r_proto=0
13925         ;;
13926 esac
13927
13928 : see if prototypes for various gethostxxx netdb.h functions are available
13929 echo " "
13930 set d_gethostprotos gethostent $i_netdb netdb.h
13931 eval $hasproto
13932
13933 : see if getitimer exists
13934 set getitimer d_getitimer
13935 eval $inlibc
13936
13937 : see if getlogin exists
13938 set getlogin d_getlogin
13939 eval $inlibc
13940
13941 : see if getlogin_r exists
13942 set getlogin_r d_getlogin_r
13943 eval $inlibc
13944 case "$d_getlogin_r" in
13945 "$define")
13946         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13947         case "$d_getlogin_r_proto:$usethreads" in
13948         ":define")      d_getlogin_r_proto=define
13949                 set d_getlogin_r_proto getlogin_r $hdrs
13950                 eval $hasproto ;;
13951         *)      ;;
13952         esac
13953         case "$d_getlogin_r_proto" in
13954         define)
13955         case "$getlogin_r_proto" in
13956         ''|0) try='int getlogin_r(char*, size_t);'
13957         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13958         esac
13959         case "$getlogin_r_proto" in
13960         ''|0) try='int getlogin_r(char*, int);'
13961         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13962         esac
13963         case "$getlogin_r_proto" in
13964         ''|0) try='char* getlogin_r(char*, size_t);'
13965         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13966         esac
13967         case "$getlogin_r_proto" in
13968         ''|0) try='char* getlogin_r(char*, int);'
13969         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13970         esac
13971         case "$getlogin_r_proto" in
13972         ''|0)   d_getlogin_r=undef
13973                 getlogin_r_proto=0
13974                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13975         * )     case "$getlogin_r_proto" in
13976                 REENTRANT_PROTO*) ;;
13977                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13978                 esac
13979                 echo "Prototype: $try" ;;
13980         esac
13981         ;;
13982         *)      case "$usethreads" in
13983                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13984                 esac
13985                 d_getlogin_r=undef
13986                 getlogin_r_proto=0
13987                 ;;
13988         esac
13989         ;;
13990 *)      getlogin_r_proto=0
13991         ;;
13992 esac
13993
13994 : see if getmnt exists
13995 set getmnt d_getmnt
13996 eval $inlibc
13997
13998 : see if getmntent exists
13999 set getmntent d_getmntent
14000 eval $inlibc
14001
14002 : see if getnameinfo exists
14003 set getnameinfo d_getnameinfo
14004 eval $inlibc
14005
14006 : see if getnetbyaddr exists
14007 set getnetbyaddr d_getnbyaddr
14008 eval $inlibc
14009
14010 : see if getnetbyname exists
14011 set getnetbyname d_getnbyname
14012 eval $inlibc
14013
14014 : see if getnetent exists
14015 set getnetent d_getnent
14016 eval $inlibc
14017
14018 : see if getnetbyaddr_r exists
14019 set getnetbyaddr_r d_getnetbyaddr_r
14020 eval $inlibc
14021 case "$d_getnetbyaddr_r" in
14022 "$define")
14023         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14024         case "$d_getnetbyaddr_r_proto:$usethreads" in
14025         ":define")      d_getnetbyaddr_r_proto=define
14026                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14027                 eval $hasproto ;;
14028         *)      ;;
14029         esac
14030         case "$d_getnetbyaddr_r_proto" in
14031         define)
14032         case "$getnetbyaddr_r_proto" in
14033         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14034         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14035         esac
14036         case "$getnetbyaddr_r_proto" in
14037         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14038         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14039         esac
14040         case "$getnetbyaddr_r_proto" in
14041         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14042         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14043         esac
14044         case "$getnetbyaddr_r_proto" in
14045         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14046         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14047         esac
14048         case "$getnetbyaddr_r_proto" in
14049         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14050         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14051         esac
14052         case "$getnetbyaddr_r_proto" in
14053         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14054         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14055         esac
14056         case "$getnetbyaddr_r_proto" in
14057         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14058         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14059         esac
14060         case "$getnetbyaddr_r_proto" in
14061         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14062         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14063         esac
14064         case "$getnetbyaddr_r_proto" in
14065         ''|0)   d_getnetbyaddr_r=undef
14066                 getnetbyaddr_r_proto=0
14067                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14068         * )     case "$getnetbyaddr_r_proto" in
14069                 REENTRANT_PROTO*) ;;
14070                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14071                 esac
14072                 echo "Prototype: $try" ;;
14073         esac
14074         ;;
14075         *)      case "$usethreads" in
14076                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14077                 esac
14078                 d_getnetbyaddr_r=undef
14079                 getnetbyaddr_r_proto=0
14080                 ;;
14081         esac
14082         ;;
14083 *)      getnetbyaddr_r_proto=0
14084         ;;
14085 esac
14086
14087 : see if getnetbyname_r exists
14088 set getnetbyname_r d_getnetbyname_r
14089 eval $inlibc
14090 case "$d_getnetbyname_r" in
14091 "$define")
14092         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14093         case "$d_getnetbyname_r_proto:$usethreads" in
14094         ":define")      d_getnetbyname_r_proto=define
14095                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14096                 eval $hasproto ;;
14097         *)      ;;
14098         esac
14099         case "$d_getnetbyname_r_proto" in
14100         define)
14101         case "$getnetbyname_r_proto" in
14102         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14103         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14104         esac
14105         case "$getnetbyname_r_proto" in
14106         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14107         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14108         esac
14109         case "$getnetbyname_r_proto" in
14110         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14111         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14112         esac
14113         case "$getnetbyname_r_proto" in
14114         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14115         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14116         esac
14117         case "$getnetbyname_r_proto" in
14118         ''|0)   d_getnetbyname_r=undef
14119                 getnetbyname_r_proto=0
14120                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14121         * )     case "$getnetbyname_r_proto" in
14122                 REENTRANT_PROTO*) ;;
14123                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14124                 esac
14125                 echo "Prototype: $try" ;;
14126         esac
14127         ;;
14128         *)      case "$usethreads" in
14129                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14130                 esac
14131                 d_getnetbyname_r=undef
14132                 getnetbyname_r_proto=0
14133                 ;;
14134         esac
14135         ;;
14136 *)      getnetbyname_r_proto=0
14137         ;;
14138 esac
14139
14140 : see if getnetent_r exists
14141 set getnetent_r d_getnetent_r
14142 eval $inlibc
14143 case "$d_getnetent_r" in
14144 "$define")
14145         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14146         case "$d_getnetent_r_proto:$usethreads" in
14147         ":define")      d_getnetent_r_proto=define
14148                 set d_getnetent_r_proto getnetent_r $hdrs
14149                 eval $hasproto ;;
14150         *)      ;;
14151         esac
14152         case "$d_getnetent_r_proto" in
14153         define)
14154         case "$getnetent_r_proto" in
14155         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14156         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14157         esac
14158         case "$getnetent_r_proto" in
14159         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14160         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14161         esac
14162         case "$getnetent_r_proto" in
14163         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14164         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14165         esac
14166         case "$getnetent_r_proto" in
14167         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14168         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14169         esac
14170         case "$getnetent_r_proto" in
14171         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14172         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14173         esac
14174         case "$getnetent_r_proto" in
14175         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14176         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14177         esac
14178         case "$getnetent_r_proto" in
14179         ''|0)   d_getnetent_r=undef
14180                 getnetent_r_proto=0
14181                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14182         * )     case "$getnetent_r_proto" in
14183                 REENTRANT_PROTO*) ;;
14184                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14185                 esac
14186                 echo "Prototype: $try" ;;
14187         esac
14188         ;;
14189         *)      case "$usethreads" in
14190                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14191                 esac
14192                 d_getnetent_r=undef
14193                 getnetent_r_proto=0
14194                 ;;
14195         esac
14196         ;;
14197 *)      getnetent_r_proto=0
14198         ;;
14199 esac
14200
14201 : see if prototypes for various getnetxxx netdb.h functions are available
14202 echo " "
14203 set d_getnetprotos getnetent $i_netdb netdb.h
14204 eval $hasproto
14205
14206 : see if getpagesize exists
14207 set getpagesize d_getpagsz
14208 eval $inlibc
14209
14210 : Optional checks for getprotobyname and getprotobynumber
14211
14212 : see if getprotobyname exists
14213 set getprotobyname d_getpbyname
14214 eval $inlibc
14215
14216 : see if getprotobynumber exists
14217 set getprotobynumber d_getpbynumber
14218 eval $inlibc
14219
14220 : see if getprotoent exists
14221 set getprotoent d_getpent
14222 eval $inlibc
14223
14224 : see if getpgid exists
14225 set getpgid d_getpgid
14226 eval $inlibc
14227
14228 : see if getpgrp2 exists
14229 set getpgrp2 d_getpgrp2
14230 eval $inlibc
14231
14232 : see if getppid exists
14233 set getppid d_getppid
14234 eval $inlibc
14235
14236 : see if getpriority exists
14237 set getpriority d_getprior
14238 eval $inlibc
14239
14240 : see if getprotobyname_r exists
14241 set getprotobyname_r d_getprotobyname_r
14242 eval $inlibc
14243 case "$d_getprotobyname_r" in
14244 "$define")
14245         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14246         case "$d_getprotobyname_r_proto:$usethreads" in
14247         ":define")      d_getprotobyname_r_proto=define
14248                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14249                 eval $hasproto ;;
14250         *)      ;;
14251         esac
14252         case "$d_getprotobyname_r_proto" in
14253         define)
14254         case "$getprotobyname_r_proto" in
14255         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14256         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14257         esac
14258         case "$getprotobyname_r_proto" in
14259         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14260         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14261         esac
14262         case "$getprotobyname_r_proto" in
14263         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14264         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14265         esac
14266         case "$getprotobyname_r_proto" in
14267         ''|0)   d_getprotobyname_r=undef
14268                 getprotobyname_r_proto=0
14269                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14270         * )     case "$getprotobyname_r_proto" in
14271                 REENTRANT_PROTO*) ;;
14272                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14273                 esac
14274                 echo "Prototype: $try" ;;
14275         esac
14276         ;;
14277         *)      case "$usethreads" in
14278                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14279                 esac
14280                 d_getprotobyname_r=undef
14281                 getprotobyname_r_proto=0
14282                 ;;
14283         esac
14284         ;;
14285 *)      getprotobyname_r_proto=0
14286         ;;
14287 esac
14288
14289 : see if getprotobynumber_r exists
14290 set getprotobynumber_r d_getprotobynumber_r
14291 eval $inlibc
14292 case "$d_getprotobynumber_r" in
14293 "$define")
14294         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14295         case "$d_getprotobynumber_r_proto:$usethreads" in
14296         ":define")      d_getprotobynumber_r_proto=define
14297                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14298                 eval $hasproto ;;
14299         *)      ;;
14300         esac
14301         case "$d_getprotobynumber_r_proto" in
14302         define)
14303         case "$getprotobynumber_r_proto" in
14304         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14305         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14306         esac
14307         case "$getprotobynumber_r_proto" in
14308         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14309         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14310         esac
14311         case "$getprotobynumber_r_proto" in
14312         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14313         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14314         esac
14315         case "$getprotobynumber_r_proto" in
14316         ''|0)   d_getprotobynumber_r=undef
14317                 getprotobynumber_r_proto=0
14318                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14319         * )     case "$getprotobynumber_r_proto" in
14320                 REENTRANT_PROTO*) ;;
14321                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14322                 esac
14323                 echo "Prototype: $try" ;;
14324         esac
14325         ;;
14326         *)      case "$usethreads" in
14327                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14328                 esac
14329                 d_getprotobynumber_r=undef
14330                 getprotobynumber_r_proto=0
14331                 ;;
14332         esac
14333         ;;
14334 *)      getprotobynumber_r_proto=0
14335         ;;
14336 esac
14337
14338 : see if getprotoent_r exists
14339 set getprotoent_r d_getprotoent_r
14340 eval $inlibc
14341 case "$d_getprotoent_r" in
14342 "$define")
14343         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14344         case "$d_getprotoent_r_proto:$usethreads" in
14345         ":define")      d_getprotoent_r_proto=define
14346                 set d_getprotoent_r_proto getprotoent_r $hdrs
14347                 eval $hasproto ;;
14348         *)      ;;
14349         esac
14350         case "$d_getprotoent_r_proto" in
14351         define)
14352         case "$getprotoent_r_proto" in
14353         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14354         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14355         esac
14356         case "$getprotoent_r_proto" in
14357         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14358         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14359         esac
14360         case "$getprotoent_r_proto" in
14361         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14362         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14363         esac
14364         case "$getprotoent_r_proto" in
14365         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14366         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14367         esac
14368         case "$getprotoent_r_proto" in
14369         ''|0)   d_getprotoent_r=undef
14370                 getprotoent_r_proto=0
14371                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14372         * )     case "$getprotoent_r_proto" in
14373                 REENTRANT_PROTO*) ;;
14374                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14375                 esac
14376                 echo "Prototype: $try" ;;
14377         esac
14378         ;;
14379         *)      case "$usethreads" in
14380                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14381                 esac
14382                 d_getprotoent_r=undef
14383                 getprotoent_r_proto=0
14384                 ;;
14385         esac
14386         ;;
14387 *)      getprotoent_r_proto=0
14388         ;;
14389 esac
14390
14391 : see if prototypes for various getprotoxxx netdb.h functions are available
14392 echo " "
14393 set d_getprotoprotos getprotoent $i_netdb netdb.h
14394 eval $hasproto
14395
14396 : see if getprpwnam exists
14397 set getprpwnam d_getprpwnam
14398 eval $inlibc
14399
14400 : see if getpwent exists
14401 set getpwent d_getpwent
14402 eval $inlibc
14403
14404 : see if getpwent_r exists
14405 set getpwent_r d_getpwent_r
14406 eval $inlibc
14407 case "$d_getpwent_r" in
14408 "$define")
14409         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14410         case "$d_getpwent_r_proto:$usethreads" in
14411         ":define")      d_getpwent_r_proto=define
14412                 set d_getpwent_r_proto getpwent_r $hdrs
14413                 eval $hasproto ;;
14414         *)      ;;
14415         esac
14416         case "$d_getpwent_r_proto" in
14417         define)
14418         case "$getpwent_r_proto" in
14419         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14420         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14421         esac
14422         case "$getpwent_r_proto" in
14423         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14424         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14425         esac
14426         case "$getpwent_r_proto" in
14427         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14428         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14429         esac
14430         case "$getpwent_r_proto" in
14431         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14432         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14433         esac
14434         case "$getpwent_r_proto" in
14435         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14436         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14437         esac
14438         case "$getpwent_r_proto" in
14439         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14440         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14441         esac
14442         case "$getpwent_r_proto" in
14443         ''|0)   d_getpwent_r=undef
14444                 getpwent_r_proto=0
14445                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14446         * )     case "$getpwent_r_proto" in
14447                 REENTRANT_PROTO*) ;;
14448                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14449                 esac
14450                 echo "Prototype: $try" ;;
14451         esac
14452         ;;
14453         *)      case "$usethreads" in
14454                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14455                 esac
14456                 d_getpwent_r=undef
14457                 getpwent_r_proto=0
14458                 ;;
14459         esac
14460         ;;
14461 *)      getpwent_r_proto=0
14462         ;;
14463 esac
14464
14465 : see if getpwnam_r exists
14466 set getpwnam_r d_getpwnam_r
14467 eval $inlibc
14468 case "$d_getpwnam_r" in
14469 "$define")
14470         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14471         case "$d_getpwnam_r_proto:$usethreads" in
14472         ":define")      d_getpwnam_r_proto=define
14473                 set d_getpwnam_r_proto getpwnam_r $hdrs
14474                 eval $hasproto ;;
14475         *)      ;;
14476         esac
14477         case "$d_getpwnam_r_proto" in
14478         define)
14479         case "$getpwnam_r_proto" in
14480         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14481         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14482         esac
14483         case "$getpwnam_r_proto" in
14484         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14485         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14486         esac
14487         case "$getpwnam_r_proto" in
14488         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14489         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14490         esac
14491         case "$getpwnam_r_proto" in
14492         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14493         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14494         esac
14495         case "$getpwnam_r_proto" in
14496         ''|0)   d_getpwnam_r=undef
14497                 getpwnam_r_proto=0
14498                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14499         * )     case "$getpwnam_r_proto" in
14500                 REENTRANT_PROTO*) ;;
14501                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14502                 esac
14503                 echo "Prototype: $try" ;;
14504         esac
14505         ;;
14506         *)      case "$usethreads" in
14507                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14508                 esac
14509                 d_getpwnam_r=undef
14510                 getpwnam_r_proto=0
14511                 ;;
14512         esac
14513         ;;
14514 *)      getpwnam_r_proto=0
14515         ;;
14516 esac
14517
14518 : see if getpwuid_r exists
14519 set getpwuid_r d_getpwuid_r
14520 eval $inlibc
14521 case "$d_getpwuid_r" in
14522 "$define")
14523         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14524         case "$d_getpwuid_r_proto:$usethreads" in
14525         ":define")      d_getpwuid_r_proto=define
14526                 set d_getpwuid_r_proto getpwuid_r $hdrs
14527                 eval $hasproto ;;
14528         *)      ;;
14529         esac
14530         case "$d_getpwuid_r_proto" in
14531         define)
14532         case "$getpwuid_r_proto" in
14533         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14534         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14535         esac
14536         case "$getpwuid_r_proto" in
14537         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14538         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14539         esac
14540         case "$getpwuid_r_proto" in
14541         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14542         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14543         esac
14544         case "$getpwuid_r_proto" in
14545         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14546         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14547         esac
14548         case "$getpwuid_r_proto" in
14549         ''|0)   d_getpwuid_r=undef
14550                 getpwuid_r_proto=0
14551                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14552         * )     case "$getpwuid_r_proto" in
14553                 REENTRANT_PROTO*) ;;
14554                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14555                 esac
14556                 echo "Prototype: $try" ;;
14557         esac
14558         ;;
14559         *)      case "$usethreads" in
14560                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14561                 esac
14562                 d_getpwuid_r=undef
14563                 getpwuid_r_proto=0
14564                 ;;
14565         esac
14566         ;;
14567 *)      getpwuid_r_proto=0
14568         ;;
14569 esac
14570
14571 : Optional checks for getsbyname and getsbyport
14572
14573 : see if getservbyname exists
14574 set getservbyname d_getsbyname
14575 eval $inlibc
14576
14577 : see if getservbyport exists
14578 set getservbyport d_getsbyport
14579 eval $inlibc
14580
14581 : see if getservent exists
14582 set getservent d_getsent
14583 eval $inlibc
14584
14585 : see if getservbyname_r exists
14586 set getservbyname_r d_getservbyname_r
14587 eval $inlibc
14588 case "$d_getservbyname_r" in
14589 "$define")
14590         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14591         case "$d_getservbyname_r_proto:$usethreads" in
14592         ":define")      d_getservbyname_r_proto=define
14593                 set d_getservbyname_r_proto getservbyname_r $hdrs
14594                 eval $hasproto ;;
14595         *)      ;;
14596         esac
14597         case "$d_getservbyname_r_proto" in
14598         define)
14599         case "$getservbyname_r_proto" in
14600         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14601         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14602         esac
14603         case "$getservbyname_r_proto" in
14604         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14605         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14606         esac
14607         case "$getservbyname_r_proto" in
14608         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14609         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14610         esac
14611         case "$getservbyname_r_proto" in
14612         ''|0)   d_getservbyname_r=undef
14613                 getservbyname_r_proto=0
14614                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14615         * )     case "$getservbyname_r_proto" in
14616                 REENTRANT_PROTO*) ;;
14617                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14618                 esac
14619                 echo "Prototype: $try" ;;
14620         esac
14621         ;;
14622         *)      case "$usethreads" in
14623                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14624                 esac
14625                 d_getservbyname_r=undef
14626                 getservbyname_r_proto=0
14627                 ;;
14628         esac
14629         ;;
14630 *)      getservbyname_r_proto=0
14631         ;;
14632 esac
14633
14634 : see if getservbyport_r exists
14635 set getservbyport_r d_getservbyport_r
14636 eval $inlibc
14637 case "$d_getservbyport_r" in
14638 "$define")
14639         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14640         case "$d_getservbyport_r_proto:$usethreads" in
14641         ":define")      d_getservbyport_r_proto=define
14642                 set d_getservbyport_r_proto getservbyport_r $hdrs
14643                 eval $hasproto ;;
14644         *)      ;;
14645         esac
14646         case "$d_getservbyport_r_proto" in
14647         define)
14648         case "$getservbyport_r_proto" in
14649         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14650         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14651         esac
14652         case "$getservbyport_r_proto" in
14653         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14654         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14655         esac
14656         case "$getservbyport_r_proto" in
14657         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14658         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14659         esac
14660         case "$getservbyport_r_proto" in
14661         ''|0)   d_getservbyport_r=undef
14662                 getservbyport_r_proto=0
14663                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14664         * )     case "$getservbyport_r_proto" in
14665                 REENTRANT_PROTO*) ;;
14666                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14667                 esac
14668                 echo "Prototype: $try" ;;
14669         esac
14670         ;;
14671         *)      case "$usethreads" in
14672                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14673                 esac
14674                 d_getservbyport_r=undef
14675                 getservbyport_r_proto=0
14676                 ;;
14677         esac
14678         ;;
14679 *)      getservbyport_r_proto=0
14680         ;;
14681 esac
14682
14683 : see if getservent_r exists
14684 set getservent_r d_getservent_r
14685 eval $inlibc
14686 case "$d_getservent_r" in
14687 "$define")
14688         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14689         case "$d_getservent_r_proto:$usethreads" in
14690         ":define")      d_getservent_r_proto=define
14691                 set d_getservent_r_proto getservent_r $hdrs
14692                 eval $hasproto ;;
14693         *)      ;;
14694         esac
14695         case "$d_getservent_r_proto" in
14696         define)
14697         case "$getservent_r_proto" in
14698         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14699         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14700         esac
14701         case "$getservent_r_proto" in
14702         ''|0) try='int getservent_r(struct servent*, char*, int);'
14703         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14704         esac
14705         case "$getservent_r_proto" in
14706         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14707         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14708         esac
14709         case "$getservent_r_proto" in
14710         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14711         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14712         esac
14713         case "$getservent_r_proto" in
14714         ''|0)   d_getservent_r=undef
14715                 getservent_r_proto=0
14716                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14717         * )     case "$getservent_r_proto" in
14718                 REENTRANT_PROTO*) ;;
14719                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14720                 esac
14721                 echo "Prototype: $try" ;;
14722         esac
14723         ;;
14724         *)      case "$usethreads" in
14725                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14726                 esac
14727                 d_getservent_r=undef
14728                 getservent_r_proto=0
14729                 ;;
14730         esac
14731         ;;
14732 *)      getservent_r_proto=0
14733         ;;
14734 esac
14735
14736 : see if prototypes for various getservxxx netdb.h functions are available
14737 echo " "
14738 set d_getservprotos getservent $i_netdb netdb.h
14739 eval $hasproto
14740
14741 : see if getspnam exists
14742 set getspnam d_getspnam
14743 eval $inlibc
14744
14745 : see if this is a shadow.h system
14746 set shadow.h i_shadow
14747 eval $inhdr
14748
14749 : see if getspnam_r exists
14750 set getspnam_r d_getspnam_r
14751 eval $inlibc
14752 case "$d_getspnam_r" in
14753 "$define")
14754         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14755         case "$d_getspnam_r_proto:$usethreads" in
14756         ":define")      d_getspnam_r_proto=define
14757                 set d_getspnam_r_proto getspnam_r $hdrs
14758                 eval $hasproto ;;
14759         *)      ;;
14760         esac
14761         case "$d_getspnam_r_proto" in
14762         define)
14763         case "$getspnam_r_proto" in
14764         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14765         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14766         esac
14767         case "$getspnam_r_proto" in
14768         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14769         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14770         esac
14771         case "$getspnam_r_proto" in
14772         ''|0)   d_getspnam_r=undef
14773                 getspnam_r_proto=0
14774                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14775         * )     case "$getspnam_r_proto" in
14776                 REENTRANT_PROTO*) ;;
14777                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14778                 esac
14779                 echo "Prototype: $try" ;;
14780         esac
14781         ;;
14782         *)      case "$usethreads" in
14783                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14784                 esac
14785                 d_getspnam_r=undef
14786                 getspnam_r_proto=0
14787                 ;;
14788         esac
14789         ;;
14790 *)      getspnam_r_proto=0
14791         ;;
14792 esac
14793
14794 : see if gettimeofday or ftime exists
14795 set gettimeofday d_gettimeod
14796 eval $inlibc
14797 case "$d_gettimeod" in
14798 "$undef")
14799         set ftime d_ftime 
14800         eval $inlibc
14801         ;;
14802 *)
14803         val="$undef"; set d_ftime; eval $setvar
14804         ;;
14805 esac
14806 case "$d_gettimeod$d_ftime" in
14807 "$undef$undef")
14808         echo " "
14809         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14810         ;;
14811 esac
14812
14813 : see if gmtime_r exists
14814 set gmtime_r d_gmtime_r
14815 eval $inlibc
14816 case "$d_gmtime_r" in
14817 "$define")
14818         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14819         case "$d_gmtime_r_proto:$usethreads" in
14820         ":define")      d_gmtime_r_proto=define
14821                 set d_gmtime_r_proto gmtime_r $hdrs
14822                 eval $hasproto ;;
14823         *)      ;;
14824         esac
14825         case "$d_gmtime_r_proto" in
14826         define)
14827         case "$gmtime_r_proto" in
14828         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14829         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14830         esac
14831         case "$gmtime_r_proto" in
14832         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14833         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14834         esac
14835         case "$gmtime_r_proto" in
14836         ''|0)   d_gmtime_r=undef
14837                 gmtime_r_proto=0
14838                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14839         * )     case "$gmtime_r_proto" in
14840                 REENTRANT_PROTO*) ;;
14841                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14842                 esac
14843                 echo "Prototype: $try" ;;
14844         esac
14845         ;;
14846         *)      case "$usethreads" in
14847                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14848                 esac
14849                 d_gmtime_r=undef
14850                 gmtime_r_proto=0
14851                 ;;
14852         esac
14853         ;;
14854 *)      gmtime_r_proto=0
14855         ;;
14856 esac
14857
14858 : see if hasmntopt exists
14859 set hasmntopt d_hasmntopt
14860 eval $inlibc
14861
14862 : see if this is a netinet/in.h or sys/in.h system
14863 set netinet/in.h i_niin sys/in.h i_sysin
14864 eval $inhdr
14865
14866 : see if arpa/inet.h has to be included
14867 set arpa/inet.h i_arpainet
14868 eval $inhdr
14869
14870 : see if htonl --and friends-- exists
14871 val=''
14872 set htonl val
14873 eval $inlibc
14874
14875 : Maybe they are macros.
14876 case "$val" in
14877 $undef)
14878         $cat >htonl.c <<EOM
14879 #include <stdio.h>
14880 #include <sys/types.h>
14881 #$i_niin I_NETINET_IN
14882 #$i_sysin I_SYS_IN
14883 #$i_arpainet I_ARPA_INET
14884 #ifdef I_NETINET_IN
14885 #include <netinet/in.h>
14886 #endif
14887 #ifdef I_SYS_IN
14888 #include <sys/in.h>
14889 #endif
14890 #ifdef I_ARPA_INET
14891 #include <arpa/inet.h>
14892 #endif
14893 #ifdef htonl
14894 printf("Defined as a macro.");
14895 #endif
14896 EOM
14897         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14898         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14899                 val="$define"
14900                 echo "But it seems to be defined as a macro." >&4
14901         fi
14902         $rm -f htonl.?
14903         ;;
14904 esac
14905 set d_htonl
14906 eval $setvar
14907
14908 : see if ilogbl exists
14909 set ilogbl d_ilogbl
14910 eval $inlibc
14911
14912 : index or strchr
14913 echo " "
14914 if set index val -f; eval $csym; $val; then
14915         if set strchr val -f d_strchr; eval $csym; $val; then
14916                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14917                         val="$define"
14918                         vali="$undef"
14919                         echo "strchr() found." >&4
14920                 else
14921                         val="$undef"
14922                         vali="$define"
14923                         echo "index() found." >&4
14924                 fi
14925         else
14926                 val="$undef"
14927                 vali="$define"
14928                 echo "index() found." >&4
14929         fi
14930 else
14931         if set strchr val -f d_strchr; eval $csym; $val; then
14932                 val="$define"
14933                 vali="$undef"
14934                 echo "strchr() found." >&4
14935         else
14936                 echo "No index() or strchr() found!" >&4
14937                 val="$undef"
14938                 vali="$undef"
14939         fi
14940 fi
14941 set d_strchr; eval $setvar
14942 val="$vali"
14943 set d_index; eval $setvar
14944
14945 : check whether inet_aton exists
14946 set inet_aton d_inetaton
14947 eval $inlibc
14948
14949 : see if inet_ntop exists
14950 set inet_ntop d_inetntop
14951 eval $inlibc
14952
14953 : see if inet_pton exists
14954 set inet_pton d_inetpton
14955 eval $inlibc
14956
14957 : Look for isascii
14958 echo " "
14959 $cat >isascii.c <<EOCP
14960 #include <stdio.h>
14961 #include <ctype.h>
14962 #$i_stdlib I_STDLIB
14963 #ifdef I_STDLIB
14964 #include <stdlib.h>
14965 #endif
14966 int main() {
14967         int c = 'A';
14968         if (isascii(c))
14969                 exit(0);
14970         else
14971                 exit(1);
14972 }
14973 EOCP
14974 set isascii
14975 if eval $compile; then
14976         echo "isascii() found." >&4
14977         val="$define"
14978 else
14979         echo "isascii() NOT found." >&4
14980         val="$undef"
14981 fi
14982 set d_isascii
14983 eval $setvar
14984 $rm -f isascii*
14985
14986 : see if isfinite exists
14987 set isfinite d_isfinite
14988 eval $inlibc
14989
14990 : see if isinf exists
14991 set isinf d_isinf
14992 eval $inlibc
14993
14994 : see if isnan exists
14995 set isnan d_isnan
14996 eval $inlibc
14997
14998 : see if isnanl exists
14999 set isnanl d_isnanl
15000 eval $inlibc
15001
15002 : see if killpg exists
15003 set killpg d_killpg
15004 eval $inlibc
15005
15006 : see if lchown exists
15007 echo " "
15008 $cat > try.c <<'EOCP'
15009 /* System header to define __stub macros and hopefully few prototypes,
15010     which can conflict with char lchown(); below.  */
15011 #include <assert.h>
15012 /* Override any gcc2 internal prototype to avoid an error.  */
15013 /* We use char because int might match the return type of a gcc2
15014    builtin and then its argument prototype would still apply.  */
15015 char lchown();
15016 int main() {
15017     /*  The GNU C library defines this for functions which it implements
15018         to always fail with ENOSYS.  Some functions are actually named
15019         something starting with __ and the normal name is an alias.  */
15020 #if defined (__stub_lchown) || defined (__stub___lchown)
15021 choke me
15022 #else
15023 lchown();
15024 #endif
15025 ; return 0; }
15026 EOCP
15027 set try
15028 if eval $compile; then
15029     $echo "lchown() found." >&4
15030     val="$define"
15031 else
15032     $echo "lchown() NOT found." >&4
15033     val="$undef"
15034 fi
15035 set d_lchown
15036 eval $setvar
15037
15038 : See if number of significant digits in a double precision number is known
15039 echo " "
15040 $cat >ldbl_dig.c <<EOM
15041 #$i_limits I_LIMITS
15042 #$i_float I_FLOAT
15043 #ifdef I_LIMITS
15044 #include <limits.h>
15045 #endif
15046 #ifdef I_FLOAT
15047 #include <float.h>
15048 #endif
15049 #ifdef LDBL_DIG
15050 printf("Contains LDBL_DIG");
15051 #endif
15052 EOM
15053 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15054 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15055         echo "LDBL_DIG found." >&4
15056         val="$define"
15057 else
15058         echo "LDBL_DIG NOT found." >&4
15059         val="$undef"
15060 fi
15061 $rm -f ldbl_dig.?
15062 set d_ldbl_dig
15063 eval $setvar
15064
15065 : see if this is a math.h system
15066 set math.h i_math
15067 eval $inhdr
15068
15069 : check to see if math.h defines _LIB_VERSION
15070 d_libm_lib_version="$undef"
15071 case $i_math in
15072     $define)
15073         echo " "
15074         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15075         $cat >try.c <<EOCP
15076 #include <unistd.h>
15077 #include <math.h>
15078 int main (int argc, char *argv[])
15079 {
15080     printf ("%d\n", _LIB_VERSION);
15081     return (0);
15082     } /* main */
15083 EOCP
15084         set try
15085         if eval $compile; then
15086             foo=`$run ./try`
15087             echo "Yes, it does ($foo)" >&4
15088             d_libm_lib_version="$define"
15089         else
15090             echo "No, it does not (probably harmless)" >&4
15091             fi
15092         $rm_try
15093         ;;
15094
15095     esac
15096
15097 : see if link exists
15098 set link d_link
15099 eval $inlibc
15100
15101 : see if localtime_r exists
15102 set localtime_r d_localtime_r
15103 eval $inlibc
15104 case "$d_localtime_r" in
15105 "$define")
15106         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15107         case "$d_localtime_r_proto:$usethreads" in
15108         ":define")      d_localtime_r_proto=define
15109                 set d_localtime_r_proto localtime_r $hdrs
15110                 eval $hasproto ;;
15111         *)      ;;
15112         esac
15113         case "$d_localtime_r_proto" in
15114         define)
15115         case "$localtime_r_proto" in
15116         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15117         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15118         esac
15119         case "$localtime_r_proto" in
15120         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15121         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15122         esac
15123         case "$localtime_r_proto" in
15124         ''|0)   d_localtime_r=undef
15125                 localtime_r_proto=0
15126                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15127         * )     case "$localtime_r_proto" in
15128                 REENTRANT_PROTO*) ;;
15129                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15130                 esac
15131                 echo "Prototype: $try" ;;
15132         esac
15133         ;;
15134         *)      case "$usethreads" in
15135                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15136                 esac
15137                 d_localtime_r=undef
15138                 localtime_r_proto=0
15139                 ;;
15140         esac
15141         ;;
15142 *)      localtime_r_proto=0
15143         ;;
15144 esac
15145
15146 : see if localtime_r calls tzset
15147 case "$localtime_r_proto" in
15148 REENTRANT_PROTO*)
15149         $cat >try.c <<EOCP
15150 /*  Does our libc's localtime_r call tzset ?
15151  *  return 0 if so, 1 otherwise.
15152  */
15153 #$i_systypes    I_SYS_TYPES
15154 #$i_unistd      I_UNISTD
15155 #$i_time        I_TIME
15156 #$i_stdlib      I_STDLIB
15157 #$i_string      I_STRING
15158 #$i_malloc      I_MALLOC
15159 #ifdef I_SYS_TYPES
15160 #  include <sys/types.h>
15161 #endif
15162 #ifdef I_UNISTD
15163 #  include <unistd.h>
15164 #endif
15165 #ifdef I_TIME
15166 #  include <time.h>
15167 #endif
15168 #ifdef I_STDLIB
15169 #include <stdlib.h>
15170 #endif
15171 #ifdef I_STRING
15172 #  include <string.h>
15173 #else
15174 #  include <strings.h>
15175 #endif
15176 #ifdef I_MALLOC
15177 #  include <malloc.h>
15178 #endif
15179 int main()
15180 {
15181     time_t t = time(0L);
15182     char w_tz[]="TZ" "=GMT+5",
15183          e_tz[]="TZ" "=GMT-5",
15184         *tz_e = (char*)malloc(16),
15185         *tz_w = (char*)malloc(16);
15186     struct tm tm_e, tm_w;
15187     memset(&tm_e,'\0',sizeof(struct tm));
15188     memset(&tm_w,'\0',sizeof(struct tm));
15189     strcpy(tz_e,e_tz);
15190     strcpy(tz_w,w_tz);
15191
15192     putenv(tz_e);
15193     localtime_r(&t, &tm_e);
15194
15195     putenv(tz_w);
15196     localtime_r(&t, &tm_w);
15197
15198     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15199         return 1;
15200     return 0;
15201 }
15202 EOCP
15203         set try
15204         if eval $compile; then
15205             if $run ./try; then
15206                 d_localtime_r_needs_tzset=undef;
15207             else
15208                 d_localtime_r_needs_tzset=define;
15209             fi;
15210         else
15211             d_localtime_r_needs_tzset=undef;
15212         fi;
15213      ;;
15214   *)
15215      d_localtime_r_needs_tzset=undef;
15216      ;;
15217 esac
15218 $rm_try
15219
15220 : see if localeconv exists
15221 set localeconv d_locconv
15222 eval $inlibc
15223
15224 : see if lockf exists
15225 set lockf d_lockf
15226 eval $inlibc
15227
15228 : see if prototype for lseek is available
15229 echo " "
15230 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15231 eval $hasproto
15232
15233 : see if lstat exists
15234 set lstat d_lstat
15235 eval $inlibc
15236
15237 : see if madvise exists
15238 set madvise d_madvise
15239 eval $inlibc
15240
15241 : see if malloc_size exists
15242 set malloc_size d_malloc_size
15243 eval $inlibc
15244
15245 : see if malloc_size_good exists
15246 set malloc_good_size d_malloc_good_size
15247 eval $inlibc
15248
15249 : see if mblen exists
15250 set mblen d_mblen
15251 eval $inlibc
15252
15253 : see if mbstowcs exists
15254 set mbstowcs d_mbstowcs
15255 eval $inlibc
15256
15257 : see if mbtowc exists
15258 set mbtowc d_mbtowc
15259 eval $inlibc
15260
15261 : see if memchr exists
15262 set memchr d_memchr
15263 eval $inlibc
15264
15265 : see if memcmp exists
15266 set memcmp d_memcmp
15267 eval $inlibc
15268
15269 : see if memcpy exists
15270 set memcpy d_memcpy
15271 eval $inlibc
15272
15273 : see if memmove exists
15274 set memmove d_memmove
15275 eval $inlibc
15276
15277 : see if memset exists
15278 set memset d_memset
15279 eval $inlibc
15280
15281 : see if mkdir exists
15282 set mkdir d_mkdir
15283 eval $inlibc
15284
15285 : see if mkdtemp exists
15286 set mkdtemp d_mkdtemp
15287 eval $inlibc
15288
15289 : see if mkfifo exists
15290 set mkfifo d_mkfifo
15291 eval $inlibc
15292
15293 : see if mkstemp exists
15294 set mkstemp d_mkstemp
15295 eval $inlibc
15296
15297 : see if mkstemps exists
15298 set mkstemps d_mkstemps
15299 eval $inlibc
15300
15301 : see if mktime exists
15302 set mktime d_mktime
15303 eval $inlibc
15304
15305 : see if this is a sys/mman.h system
15306 set sys/mman.h i_sysmman
15307 eval $inhdr
15308
15309 : see if mmap exists
15310 set mmap d_mmap
15311 eval $inlibc
15312 : see what shmat returns
15313 : default to something harmless
15314 mmaptype='void *'
15315 case "$i_sysmman$d_mmap" in
15316 "$define$define")
15317         $cat >mmap.c <<'END'
15318 #include <sys/mman.h>
15319 void *mmap();
15320 END
15321         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15322                 mmaptype='void *'
15323         else
15324                 mmaptype='caddr_t'
15325         fi
15326         echo "and it returns ($mmaptype)." >&4
15327         ;;
15328 esac
15329
15330
15331
15332 : see if sqrtl exists
15333 set sqrtl d_sqrtl
15334 eval $inlibc
15335
15336 : see if scalbnl exists
15337 set scalbnl d_scalbnl
15338 eval $inlibc
15339
15340 : see if modfl exists
15341 set modfl d_modfl
15342 eval $inlibc
15343
15344 : see if prototype for modfl is available
15345 echo " "
15346 set d_modflproto modfl $i_math math.h
15347 eval $hasproto
15348
15349 d_modfl_pow32_bug="$undef"
15350
15351 case "$d_longdbl$d_modfl" in
15352 $define$define)
15353         $cat <<EOM
15354 Checking to see whether your modfl() is okay for large values...
15355 EOM
15356 $cat >try.c <<EOCP
15357 #include <math.h>
15358 #include <stdio.h>
15359 EOCP
15360 if $test "X$d_modflproto" != "X$define"; then
15361         $cat >>try.c <<EOCP
15362 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15363 long double modfl (long double, long double *);
15364 EOCP
15365 fi
15366 $cat >>try.c <<EOCP
15367 int main() {
15368     long double nv = 4294967303.15;
15369     long double v, w;
15370     v = modfl(nv, &w);
15371 #ifdef __GLIBC__
15372     printf("glibc");
15373 #endif
15374     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15375     return 0;
15376 }
15377 EOCP
15378         case "$osname:$gccversion" in
15379         aix:)   saveccflags="$ccflags"
15380                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15381         esac
15382         set try
15383         if eval $compile; then
15384                 foo=`$run ./try`
15385                 case "$foo" in
15386                 *" 4294967303.150000 1.150000 4294967302.000000")
15387                         echo >&4 "Your modfl() is broken for large values."
15388                         d_modfl_pow32_bug="$define"
15389                         case "$foo" in
15390                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15391                         ;;
15392                         esac
15393                         ;;
15394                 *" 4294967303.150000 0.150000 4294967303.000000")
15395                         echo >&4 "Your modfl() seems okay for large values."
15396                         ;;
15397                 *)      echo >&4 "I don't understand your modfl() at all."
15398                         d_modfl="$undef"
15399                         ;;
15400                 esac
15401                 $rm_try
15402         else
15403                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15404                 d_modfl="$undef"
15405         fi
15406         case "$osname:$gccversion" in
15407         aix:)   ccflags="$saveccflags" ;; # restore
15408         esac
15409         ;;
15410 esac
15411
15412 if $test "$uselongdouble" = "$define"; then
15413     message=""
15414     if $test "$d_sqrtl" != "$define"; then
15415         message="$message sqrtl"
15416     fi
15417     if $test "$d_modfl" != "$define"; then
15418         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15419             echo "You have both aintl and copysignl, so I can emulate modfl."
15420         else
15421             message="$message modfl"
15422         fi
15423     fi
15424     if $test "$d_frexpl" != "$define"; then
15425         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15426             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15427         else
15428             message="$message frexpl"
15429         fi
15430     fi
15431
15432     if $test "$message" != ""; then
15433         $cat <<EOM >&4
15434
15435 *** You requested the use of long doubles but you do not seem to have
15436 *** the following mathematical functions needed for long double support:
15437 ***    $message
15438 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15439 *** Cannot continue, aborting.
15440
15441 EOM
15442
15443         exit 1
15444     fi
15445 fi
15446
15447 : see if mprotect exists
15448 set mprotect d_mprotect
15449 eval $inlibc
15450
15451 : see if msgctl exists
15452 set msgctl d_msgctl
15453 eval $inlibc
15454
15455 : see if msgget exists
15456 set msgget d_msgget
15457 eval $inlibc
15458
15459 : see if msgsnd exists
15460 set msgsnd d_msgsnd
15461 eval $inlibc
15462
15463 : see if msgrcv exists
15464 set msgrcv d_msgrcv
15465 eval $inlibc
15466
15467 : see how much of the 'msg*(2)' library is present.
15468 h_msg=true
15469 echo " "
15470 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15471 *"$undef"*) h_msg=false;;
15472 esac
15473 case "$osname" in
15474 freebsd)
15475     case "`ipcs 2>&1`" in
15476     "SVID messages"*"not configured"*)
15477         echo "Your $osname does not have the msg*(2) configured." >&4
15478         h_msg=false
15479         val="$undef"
15480         set msgctl d_msgctl
15481         eval $setvar
15482         set msgget d_msgget
15483         eval $setvar
15484         set msgsnd d_msgsnd
15485         eval $setvar
15486         set msgrcv d_msgrcv
15487         eval $setvar
15488         ;;
15489     esac
15490     ;;
15491 esac
15492 : we could also check for sys/ipc.h ...
15493 if $h_msg && $test `./findhdr sys/msg.h`; then
15494         echo "You have the full msg*(2) library." >&4
15495         val="$define"
15496 else
15497         echo "You don't have the full msg*(2) library." >&4
15498         val="$undef"
15499 fi
15500 set d_msg
15501 eval $setvar
15502
15503 : Check for msghdr_s
15504 echo " "
15505 echo "Checking to see if your system supports struct msghdr..." >&4
15506 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15507 eval $hasstruct
15508 case "$d_msghdr_s" in
15509 "$define")      echo "Yes, it does."   ;;
15510 *)              echo "No, it doesn't." ;;
15511 esac
15512
15513
15514 : see if msync exists
15515 set msync d_msync
15516 eval $inlibc
15517
15518 : see if munmap exists
15519 set munmap d_munmap
15520 eval $inlibc
15521
15522 : see if nice exists
15523 set nice d_nice
15524 eval $inlibc
15525
15526 : see if this is a langinfo.h system
15527 set langinfo.h i_langinfo
15528 eval $inhdr
15529
15530 : see if nl_langinfo exists
15531 set nl_langinfo d_nl_langinfo
15532 eval $inlibc
15533
15534 : check for volatile keyword
15535 echo " "
15536 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15537 $cat >try.c <<'EOCP'
15538 int main()
15539 {
15540         typedef struct _goo_struct goo_struct;
15541         goo_struct * volatile goo = ((goo_struct *)0);
15542         struct _goo_struct {
15543                 long long_int;
15544                 int reg_int;
15545                 char char_var;
15546         };
15547         typedef unsigned short foo_t;
15548         char *volatile foo;
15549         volatile int bar;
15550         volatile foo_t blech;
15551         foo = foo;
15552 }
15553 EOCP
15554 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15555         val="$define"
15556         echo "Yup, it does."
15557 else
15558         val="$undef"
15559         echo "Nope, it doesn't."
15560 fi
15561 set d_volatile
15562 eval $setvar
15563 $rm_try
15564
15565 : Check basic sizes
15566 echo " "
15567 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15568
15569 case "$use64bitint:$d_quad:$quadtype" in
15570 define:define:?*)
15571         ivtype="$quadtype"
15572         uvtype="$uquadtype"
15573         ivsize=8
15574         uvsize=8
15575         ;;
15576 *)      ivtype="long"
15577         uvtype="unsigned long"
15578         ivsize=$longsize
15579         uvsize=$longsize
15580         ;;
15581 esac
15582
15583 case "$uselongdouble:$d_longdbl" in
15584 define:define)
15585         nvtype="long double"
15586         nvsize=$longdblsize
15587         ;;
15588 *)      nvtype=double
15589         nvsize=$doublesize
15590         ;;
15591 esac
15592
15593 $echo "(IV will be "$ivtype", $ivsize bytes)"
15594 $echo "(UV will be "$uvtype", $uvsize bytes)"
15595 $echo "(NV will be "$nvtype", $nvsize bytes)"
15596
15597 $cat >try.c <<EOCP
15598 #$i_inttypes I_INTTYPES
15599 #ifdef I_INTTYPES
15600 #include <inttypes.h>
15601 #endif
15602 #include <stdio.h>
15603 int main() {
15604 #ifdef INT8
15605    int8_t i =  INT8_MAX;
15606   uint8_t u = UINT8_MAX;
15607   printf("int8_t\n");
15608 #endif
15609 #ifdef INT16
15610    int16_t i =  INT16_MAX;
15611   uint16_t i = UINT16_MAX;
15612   printf("int16_t\n");
15613 #endif
15614 #ifdef INT32
15615    int32_t i =  INT32_MAX;
15616   uint32_t u = UINT32_MAX;
15617   printf("int32_t\n");
15618 #endif
15619 }
15620 EOCP
15621
15622 i8type="signed char"
15623 u8type="unsigned char"
15624 i8size=1
15625 u8size=1
15626
15627 case "$i16type" in
15628 '')     case "$shortsize" in
15629         2)      i16type=short
15630                 u16type="unsigned short"
15631                 i16size=$shortsize
15632                 u16size=$shortsize
15633                 ;;
15634         esac
15635         ;;
15636 esac
15637 case "$i16type" in
15638 '')     set try -DINT16
15639         if eval $compile; then
15640                 case "`$run ./try`" in
15641                 int16_t)
15642                         i16type=int16_t
15643                         u16type=uint16_t
15644                         i16size=2
15645                         u16size=2
15646                         ;;
15647                 esac
15648         fi
15649         ;;
15650 esac
15651 case "$i16type" in
15652 '')     if $test $shortsize -ge 2; then
15653                 i16type=short
15654                 u16type="unsigned short"
15655                 i16size=$shortsize
15656                 u16size=$shortsize
15657         fi
15658         ;;
15659 esac
15660
15661 case "$i32type" in
15662 '')     case "$longsize" in
15663         4)      i32type=long
15664                 u32type="unsigned long"
15665                 i32size=$longsize
15666                 u32size=$longsize
15667                 ;;
15668         *)      case "$intsize" in
15669                 4)      i32type=int
15670                         u32type="unsigned int"
15671                         i32size=$intsize
15672                         u32size=$intsize
15673                         ;;
15674                 esac
15675                 ;;
15676         esac
15677         ;;
15678 esac
15679 case "$i32type" in
15680 '')     set try -DINT32
15681         if eval $compile; then
15682                 case "`$run ./try`" in
15683                 int32_t)
15684                         i32type=int32_t
15685                         u32type=uint32_t
15686                         i32size=4
15687                         u32size=4
15688                         ;;
15689                 esac
15690         fi
15691         ;;
15692 esac
15693 case "$i32type" in
15694 '')     if $test $intsize -ge 4; then
15695                 i32type=int
15696                 u32type="unsigned int"
15697                 i32size=$intsize
15698                 u32size=$intsize
15699         fi
15700         ;;
15701 esac
15702
15703 case "$i64type" in
15704 '')     case "$d_quad:$quadtype" in
15705         define:?*)
15706                 i64type="$quadtype"
15707                 u64type="$uquadtype"
15708                 i64size=8
15709                 u64size=8
15710                 ;;
15711         esac
15712         ;;
15713 esac
15714
15715 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15716 : volatile so that the compiler has to store it out to memory.
15717 if test X"$d_volatile" = X"$define"; then
15718         volatile=volatile
15719 fi
15720 $cat <<EOP >try.c
15721 #include <stdio.h>
15722 #$i_stdlib I_STDLIB
15723 #ifdef I_STDLIB
15724 #include <stdlib.h>
15725 #endif
15726 #include <sys/types.h>
15727 #include <signal.h>
15728 #ifdef SIGFPE
15729 $volatile int bletched = 0;
15730 $signal_t blech(int s) { bletched = 1; }
15731 #endif
15732 int main() {
15733     $uvtype u = 0;
15734     $nvtype d;
15735     int     n = 8 * $uvsize;
15736     int     i;
15737 #ifdef SIGFPE
15738     signal(SIGFPE, blech);
15739 #endif
15740
15741     for (i = 0; i < n; i++) {
15742       u = u << 1 | ($uvtype)1;
15743       d = ($nvtype)u;
15744       if (($uvtype)d != u)
15745         break;
15746       if (d <= 0)
15747         break;
15748       d = ($nvtype)(u - 1);
15749       if (($uvtype)d != (u - 1))
15750         break;
15751 #ifdef SIGFPE
15752       if (bletched)
15753         break;
15754 #endif
15755     }
15756     printf("%d\n", ((i == n) ? -n : i));
15757     exit(0);
15758 }
15759 EOP
15760 set try
15761
15762 d_nv_preserves_uv="$undef"
15763 if eval $compile; then
15764         nv_preserves_uv_bits="`$run ./try`"
15765 fi
15766 case "$nv_preserves_uv_bits" in
15767 \-[1-9]*)
15768         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15769         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15770         d_nv_preserves_uv="$define"
15771         ;;
15772 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15773         d_nv_preserves_uv="$undef" ;;
15774 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15775         nv_preserves_uv_bits="0" ;;
15776 esac
15777 $rm_try
15778
15779 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15780 : volatile so that the compiler has to store it out to memory.
15781 if test X"$d_volatile" = X"$define"; then
15782         volatile=volatile
15783 fi
15784 $cat <<EOP >try.c
15785 #include <stdio.h>
15786
15787 typedef $nvtype NV;
15788
15789 int
15790 main() {
15791   NV value = 2;
15792   int count = 1;
15793
15794   while(count < 256) {
15795     $volatile NV up = value + 1.0;
15796     $volatile NV negated = -value;
15797     $volatile NV down = negated - 1.0;
15798     $volatile NV got_up = up - value;
15799     int up_good = got_up == 1.0;
15800     int got_down = down - negated;
15801     int down_good = got_down == -1.0;
15802
15803     if (down_good != up_good) {
15804       fprintf(stderr,
15805               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15806               up_good, (double) got_up, down_good, (double) got_down,
15807               count, (double) value);
15808       return 1;
15809     }
15810     if (!up_good) {
15811       while (1) {
15812         if (count > 8) {
15813           count -= 8;
15814           fputs("256.0", stdout);
15815         } else {
15816           count--;
15817           fputs("2.0", stdout);
15818         }
15819         if (!count) {
15820           puts("");
15821           return 0;
15822         }
15823         fputs("*", stdout);
15824       }
15825     }
15826     value *= 2;
15827     ++count;
15828   }
15829   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15830           count, (double) value);
15831   return 1;
15832 }
15833 EOP
15834 set try
15835
15836 nv_overflows_integers_at='0'
15837 if eval $compile; then
15838     xxx="`$run ./try`"
15839     case "$?" in
15840         0)
15841             case "$xxx" in
15842                 2*)  cat >&4 <<EOM
15843 The largest integer your NVs can preserve is equal to $xxx
15844 EOM
15845                     nv_overflows_integers_at="$xxx"
15846                     ;;
15847                 *)  cat >&4 <<EOM
15848 Cannot determine the largest integer value your NVs can hold, unexpected output
15849 '$xxx'
15850 EOM
15851                     ;;
15852             esac
15853             ;;
15854         *)  cat >&4 <<EOM
15855 Cannot determine the largest integer value your NVs can hold
15856 EOM
15857             ;;
15858     esac
15859 fi
15860 $rm_try
15861
15862 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15863 : volatile so that the compiler has to store it out to memory.
15864 if test X"$d_volatile" = X"$define"; then
15865         volatile=volatile
15866 fi
15867 $cat <<EOP >try.c
15868 #include <stdio.h>
15869 #$i_stdlib I_STDLIB
15870 #ifdef I_STDLIB
15871 #include <stdlib.h>
15872 #endif
15873 #$i_string I_STRING
15874 #ifdef I_STRING
15875 #  include <string.h>
15876 #else
15877 #  include <strings.h>
15878 #endif
15879 #include <sys/types.h>
15880 #include <signal.h>
15881 #ifdef SIGFPE
15882 $volatile int bletched = 0;
15883 $signal_t blech(int s) { bletched = 1; }
15884 #endif
15885
15886 int checkit($nvtype d, char *where) {
15887     unsigned char *p = (char *)&d;
15888     unsigned char *end = p + sizeof(d);
15889     int fail = 0;
15890
15891     while (p < end)
15892         fail += *p++;
15893
15894     if (!fail)
15895         return 0;
15896
15897     p = (char *)&d;
15898     printf("No - %s: 0x", where);
15899     while (p < end)
15900         printf ("%02X", *p++);
15901     printf("\n");
15902     return 1;
15903 }
15904
15905 int main(int argc, char **argv) {
15906     $nvtype d = 0.0;
15907     int fail = 0;
15908     fail += checkit(d, "0.0");
15909
15910     /* The compiler shouldn't be assuming that bletched is 0  */
15911     d = bletched;
15912
15913     fail += checkit(d, "bleched");
15914
15915 #ifdef SIGFPE
15916     signal(SIGFPE, blech);
15917 #endif
15918
15919     /* Paranoia - the compiler should have no way of knowing that ANSI says
15920        that argv[argc] will always be NULL.  Actually, if it did assume this it
15921        would be buggy, as this is C and main() can be called from elsewhere in
15922        the program.  */
15923     d = argv[argc] ? 1 : 0;
15924
15925     if (d) {
15926         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15927     }
15928
15929     fail += checkit(d, "ternary");
15930
15931     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15932
15933     if (d != 0.0) {
15934         printf("No - memset doesn't give 0.0\n");
15935         /* This might just blow up:  */
15936         printf("(gives %g)\n", d);
15937         return 1;
15938     }
15939
15940 #ifdef SIGFPE
15941     if (bletched) {
15942         printf("No - something bleched\n");
15943         return 1;
15944     }
15945 #endif
15946     if (fail) {
15947       printf("No - %d fail(s)\n", fail);
15948       return 1;
15949     }
15950     printf("Yes\n");
15951     return 0;
15952 }
15953 EOP
15954 set try
15955
15956 d_nv_zero_is_allbits_zero="$undef"
15957 if eval $compile; then
15958     xxx="`$run ./try`"
15959     case "$?" in
15960         0)
15961             case "$xxx" in
15962                 Yes)  cat >&4 <<EOM
15963 0.0 is represented as all bits zero in memory
15964 EOM
15965                     d_nv_zero_is_allbits_zero="$define"
15966                     ;;
15967                 *)  cat >&4 <<EOM
15968 0.0 is not represented as all bits zero in memory
15969 EOM
15970                     d_nv_zero_is_allbits_zero="$undef"
15971                     ;;
15972             esac
15973             ;;
15974         *)  cat >&4 <<EOM
15975 0.0 is not represented as all bits zero in memory
15976 EOM
15977             d_nv_zero_is_allbits_zero="$undef"
15978             ;;
15979     esac
15980 fi
15981 $rm_try
15982
15983 : check for off64_t
15984 echo " "
15985 echo "Checking to see if you have off64_t..." >&4
15986 $cat >try.c <<EOCP
15987 #include <sys/types.h>
15988 #include <unistd.h>
15989 int main() { off64_t x = 7; }
15990 EOCP
15991 set try
15992 if eval $compile; then
15993         val="$define"
15994         echo "You have off64_t."
15995 else
15996         val="$undef"
15997         echo "You do not have off64_t."
15998         case "$lseeksize" in
15999         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16000         esac
16001 fi
16002 $rm_try
16003 set d_off64_t
16004 eval $setvar
16005
16006 : how to create joinable pthreads
16007 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16008         echo " "
16009         echo "Checking what constant to use for creating joinable pthreads..." >&4
16010         $cat >try.c <<'EOCP'
16011 #include <pthread.h>
16012 int main() {
16013     int detachstate = JOINABLE;
16014 }
16015 EOCP
16016         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16017         if eval $compile; then
16018                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16019                 val="$undef" # Yes, undef.
16020                 set d_old_pthread_create_joinable
16021                 eval $setvar
16022                 val=""
16023                 set old_pthread_create_joinable
16024                 eval $setvar
16025         else
16026                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16027                 if eval $compile; then
16028                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16029                         val="$define"
16030                         set d_old_pthread_create_joinable
16031                         eval $setvar
16032                         val=PTHREAD_CREATE_UNDETACHED
16033                         set old_pthread_create_joinable
16034                         eval $setvar
16035                 else
16036                         set try -DJOINABLE=__UNDETACHED
16037                         if eval $compile; then
16038                                 echo "You seem to use __UNDETACHED." >&4
16039                                 val="$define"
16040                                 set d_old_pthread_create_joinable
16041                                 eval $setvar
16042                                 val=__UNDETACHED
16043                                 set old_pthread_create_joinable
16044                                 eval $setvar
16045                         else
16046                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16047                                 val="$define"
16048                                 set d_old_pthread_create_joinable
16049                                 eval $setvar
16050                                 val=0
16051                                 set old_pthread_create_joinable
16052                                 eval $setvar
16053                         fi
16054                 fi
16055         fi
16056         $rm_try
16057 else
16058     d_old_pthread_create_joinable="$undef"
16059     old_pthread_create_joinable=""
16060 fi
16061
16062 : see if pause exists
16063 set pause d_pause
16064 eval $inlibc
16065
16066 : see if poll exists
16067 set poll d_poll
16068 eval $inlibc
16069
16070 : see if prctl exists
16071 set prctl d_prctl
16072 eval $inlibc
16073
16074 : see if prctl supports PR_SET_NAME
16075 d_prctl_set_name=$undef
16076 case $d_prctl in
16077     $define)
16078         $cat >try.c <<EOM
16079 #include <sys/prctl.h>
16080
16081 int main (int argc, char *argv[])
16082 {
16083     return (prctl (PR_SET_NAME, "Test"));
16084     } /* main */
16085 EOM
16086         set try
16087         if eval $compile_ok && $run ./try; then
16088             echo "Your prctl (PR_SET_NAME, ...) works"
16089             d_prctl_set_name=$define
16090             fi
16091         $rm_try
16092         ;;
16093     esac
16094
16095 : see if readlink exists
16096 set readlink d_readlink
16097 eval $inlibc
16098
16099 : Check if exe is symlink to abs path of executing program
16100 echo " "
16101 procselfexe=''
16102 val="$undef"
16103 case "$d_readlink" in
16104 "$define")
16105         if $issymlink /proc/self/exe ; then
16106                 $ls -l /proc/self/exe > reflect
16107                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16108                         echo "You have Linux-like /proc/self/exe."
16109                         procselfexe='"/proc/self/exe"'
16110                         val="$define"
16111                 fi
16112         fi
16113         if $issymlink /proc/curproc/file ; then
16114                 $ls -l /proc/curproc/file > reflect
16115                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16116                         echo "You have BSD-like /proc/curproc/file."
16117                         procselfexe='"/proc/curproc/file"'
16118                         val="$define"
16119                 fi
16120         fi
16121         ;;
16122 esac
16123 $rm -f reflect
16124 set d_procselfexe
16125 eval $setvar
16126
16127 : backward compatibility for d_hvfork
16128 if test X$d_hvfork != X; then
16129         d_vfork="$d_hvfork"
16130         d_hvfork=''
16131 fi
16132 : see if there is a vfork
16133 val=''
16134 set vfork val
16135 eval $inlibc
16136
16137 d_pseudofork=$undef
16138
16139 : Ok, but do we want to use it. vfork is reportedly unreliable in
16140 : perl on Solaris 2.x, and probably elsewhere.
16141 case "$val" in
16142 $define)
16143         echo " "
16144         case "$usevfork" in
16145         false) dflt='n';;
16146         *) dflt='y';;
16147         esac
16148         cat <<'EOM'
16149
16150 Perl can only use a vfork() that doesn't suffer from strict
16151 restrictions on calling functions or modifying global data in
16152 the child.  For example, glibc-2.1 contains such a vfork()
16153 that is unsuitable.  If your system provides a proper fork()
16154 call, chances are that you do NOT want perl to use vfork().
16155
16156 EOM
16157         rp="Do you still want to use vfork()?"
16158         . ./myread
16159         case "$ans" in
16160         y|Y) ;;
16161         *)
16162                 echo "Ok, we won't use vfork()."
16163                 val="$undef"
16164                 ;;
16165         esac
16166         ;;
16167 esac
16168 set d_vfork
16169 eval $setvar
16170 case "$d_vfork" in
16171 $define) usevfork='true';;
16172 *) usevfork='false';;
16173 esac
16174
16175 : see whether the pthread_atfork exists
16176 $cat >try.c <<EOP
16177 #include <pthread.h>
16178 #include <stdio.h>
16179 int main() {
16180 #ifdef  PTHREAD_ATFORK
16181         pthread_atfork(NULL,NULL,NULL);
16182 #endif
16183 }
16184 EOP
16185
16186 : see if pthread_atfork exists
16187 set try -DPTHREAD_ATFORK
16188 if eval $compile; then
16189     val="$define"
16190 else
16191     val="$undef"
16192 fi
16193 case "$usethreads" in
16194 $define)
16195         case "$val" in
16196         $define) echo 'pthread_atfork found.' >&4        ;;
16197         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16198         esac
16199 esac
16200 set d_pthread_atfork
16201 eval $setvar
16202
16203 : see if pthread_attr_setscope exists
16204 set pthread_attr_setscope d_pthread_attr_setscope
16205 eval $inlibc
16206
16207 : see whether the various POSIXish _yields exist
16208 $cat >try.c <<EOP
16209 #include <pthread.h>
16210 #include <stdio.h>
16211 int main() {
16212 #ifdef SCHED_YIELD
16213         sched_yield();
16214 #else
16215 #ifdef PTHREAD_YIELD
16216         pthread_yield();
16217 #else
16218 #ifdef PTHREAD_YIELD_NULL
16219         pthread_yield(NULL);
16220 #endif
16221 #endif
16222 #endif
16223 }
16224 EOP
16225 : see if sched_yield exists
16226 set try -DSCHED_YIELD
16227 if eval $compile; then
16228     val="$define"
16229     sched_yield='sched_yield()'
16230 else
16231     val="$undef"
16232 fi
16233 case "$usethreads" in
16234 $define)
16235         case "$val" in
16236         $define) echo 'sched_yield() found.' >&4        ;;
16237         *)       echo 'sched_yield() NOT found.' >&4    ;;
16238         esac
16239 esac
16240 set d_sched_yield
16241 eval $setvar
16242
16243 : see if pthread_yield exists
16244 set try -DPTHREAD_YIELD
16245 if eval $compile; then
16246     val="$define"
16247     case "$sched_yield" in
16248     '') sched_yield='pthread_yield()' ;;
16249     esac
16250 else
16251     set try -DPTHREAD_YIELD_NULL
16252     if eval $compile; then
16253         val="$define"
16254         case "$sched_yield" in
16255         '') sched_yield='pthread_yield(NULL)' ;;
16256         esac
16257     else
16258         val="$undef"
16259     fi
16260 fi
16261 case "$usethreads" in
16262 $define)
16263         case "$val" in
16264         $define) echo 'pthread_yield() found.' >&4      ;;
16265         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16266         esac
16267         ;;
16268 esac
16269 set d_pthread_yield
16270 eval $setvar
16271 case "$sched_yield" in
16272 '') sched_yield=undef ;;
16273 esac
16274 $rm_try
16275
16276 : see if random_r exists
16277 set random_r d_random_r
16278 eval $inlibc
16279 case "$d_random_r" in
16280 "$define")
16281         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16282         case "$d_random_r_proto:$usethreads" in
16283         ":define")      d_random_r_proto=define
16284                 set d_random_r_proto random_r $hdrs
16285                 eval $hasproto ;;
16286         *)      ;;
16287         esac
16288         case "$d_random_r_proto" in
16289         define)
16290         case "$random_r_proto" in
16291         ''|0) try='int random_r(int*, struct random_data*);'
16292         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16293         esac
16294         case "$random_r_proto" in
16295         ''|0) try='int random_r(long*, struct random_data*);'
16296         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16297         esac
16298         case "$random_r_proto" in
16299         ''|0) try='int random_r(struct random_data*, int32_t*);'
16300         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16301         esac
16302         case "$random_r_proto" in
16303         ''|0)   d_random_r=undef
16304                 random_r_proto=0
16305                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16306         * )     case "$random_r_proto" in
16307                 REENTRANT_PROTO*) ;;
16308                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16309                 esac
16310                 echo "Prototype: $try" ;;
16311         esac
16312         ;;
16313         *)      case "$usethreads" in
16314                 define) echo "random_r has no prototype, not using it." >&4 ;;
16315                 esac
16316                 d_random_r=undef
16317                 random_r_proto=0
16318                 ;;
16319         esac
16320         ;;
16321 *)      random_r_proto=0
16322         ;;
16323 esac
16324
16325 : see if readdir and friends exist
16326 set readdir d_readdir
16327 eval $inlibc
16328 set seekdir d_seekdir
16329 eval $inlibc
16330 set telldir d_telldir
16331 eval $inlibc
16332 set rewinddir d_rewinddir
16333 eval $inlibc
16334
16335 : see if readdir64_r exists
16336 set readdir64_r d_readdir64_r
16337 eval $inlibc
16338 case "$d_readdir64_r" in
16339 "$define")
16340         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16341         case "$d_readdir64_r_proto:$usethreads" in
16342         ":define")      d_readdir64_r_proto=define
16343                 set d_readdir64_r_proto readdir64_r $hdrs
16344                 eval $hasproto ;;
16345         *)      ;;
16346         esac
16347         case "$d_readdir64_r_proto" in
16348         define)
16349         case "$readdir64_r_proto" in
16350         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16351         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16352         esac
16353         case "$readdir64_r_proto" in
16354         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16355         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16356         esac
16357         case "$readdir64_r_proto" in
16358         ''|0)   d_readdir64_r=undef
16359                 readdir64_r_proto=0
16360                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16361         * )     case "$readdir64_r_proto" in
16362                 REENTRANT_PROTO*) ;;
16363                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16364                 esac
16365                 echo "Prototype: $try" ;;
16366         esac
16367         ;;
16368         *)      case "$usethreads" in
16369                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16370                 esac
16371                 d_readdir64_r=undef
16372                 readdir64_r_proto=0
16373                 ;;
16374         esac
16375         ;;
16376 *)      readdir64_r_proto=0
16377         ;;
16378 esac
16379
16380 : see if readdir_r exists
16381 set readdir_r d_readdir_r
16382 eval $inlibc
16383 case "$d_readdir_r" in
16384 "$define")
16385         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16386         case "$d_readdir_r_proto:$usethreads" in
16387         ":define")      d_readdir_r_proto=define
16388                 set d_readdir_r_proto readdir_r $hdrs
16389                 eval $hasproto ;;
16390         *)      ;;
16391         esac
16392         case "$d_readdir_r_proto" in
16393         define)
16394         case "$readdir_r_proto" in
16395         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16396         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16397         esac
16398         case "$readdir_r_proto" in
16399         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16400         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16401         esac
16402         case "$readdir_r_proto" in
16403         ''|0)   d_readdir_r=undef
16404                 readdir_r_proto=0
16405                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16406         * )     case "$readdir_r_proto" in
16407                 REENTRANT_PROTO*) ;;
16408                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16409                 esac
16410                 echo "Prototype: $try" ;;
16411         esac
16412         ;;
16413         *)      case "$usethreads" in
16414                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16415                 esac
16416                 d_readdir_r=undef
16417                 readdir_r_proto=0
16418                 ;;
16419         esac
16420         ;;
16421 *)      readdir_r_proto=0
16422         ;;
16423 esac
16424
16425 : see if readv exists
16426 set readv d_readv
16427 eval $inlibc
16428
16429 : see if recvmsg exists
16430 set recvmsg d_recvmsg
16431 eval $inlibc
16432
16433 : see if rename exists
16434 set rename d_rename
16435 eval $inlibc
16436
16437 : see if rmdir exists
16438 set rmdir d_rmdir
16439 eval $inlibc
16440
16441 : see if memory.h is available.
16442 val=''
16443 set memory.h val
16444 eval $inhdr
16445
16446 : See if it conflicts with string.h
16447 case "$val" in
16448 $define)
16449         case "$strings" in
16450         '') ;;
16451         *)
16452                 $cppstdin $cppflags $cppminus < $strings > mem.h
16453                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16454                         echo " "
16455                         echo "We won't be including <memory.h>."
16456                         val="$undef"
16457                 fi
16458                 $rm -f mem.h
16459                 ;;
16460         esac
16461 esac
16462 set i_memory
16463 eval $setvar
16464
16465 : can bcopy handle overlapping blocks?
16466 echo " "
16467 val="$undef"
16468 case "$d_memmove" in
16469 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16470 *)      case "$d_bcopy" in
16471         "$define")
16472                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16473                 $cat >try.c <<EOCP
16474 #$i_memory I_MEMORY
16475 #$i_stdlib I_STDLIB
16476 #$i_string I_STRING
16477 #$i_unistd I_UNISTD
16478 EOCP
16479         $cat >>try.c <<'EOCP'
16480 #include <stdio.h>
16481 #ifdef I_MEMORY
16482 #  include <memory.h>
16483 #endif
16484 #ifdef I_STDLIB
16485 #  include <stdlib.h>
16486 #endif
16487 #ifdef I_STRING
16488 #  include <string.h>
16489 #else
16490 #  include <strings.h>
16491 #endif
16492 #ifdef I_UNISTD
16493 #  include <unistd.h>  /* Needed for NetBSD */
16494 #endif
16495 int main()
16496 {
16497 char buf[128], abc[128];
16498 char *b;
16499 int len;
16500 int off;
16501 int align;
16502
16503 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16504    try to store the string in read-only memory. */
16505 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16506
16507 for (align = 7; align >= 0; align--) {
16508         for (len = 36; len; len--) {
16509                 b = buf+align;
16510                 bcopy(abc, b, len);
16511                 for (off = 1; off <= len; off++) {
16512                         bcopy(b, b+off, len);
16513                         bcopy(b+off, b, len);
16514                         if (bcmp(b, abc, len))
16515                                 exit(1);
16516                 }
16517         }
16518 }
16519 exit(0);
16520 }
16521 EOCP
16522                 set try
16523                 if eval $compile_ok; then
16524                         if $run ./try 2>/dev/null; then
16525                                 echo "Yes, it can."
16526                                 val="$define"
16527                         else
16528                                 echo "It can't, sorry."
16529                         fi
16530                 else
16531                         echo "(I can't compile the test program, so we'll assume not...)"
16532                 fi
16533                 ;;
16534         esac
16535         $rm_try
16536         ;;
16537 esac
16538 set d_safebcpy
16539 eval $setvar
16540
16541 : can memcpy handle overlapping blocks?
16542 echo " "
16543 val="$undef"
16544 case "$d_memmove" in
16545 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16546 *)      case "$d_memcpy" in
16547         "$define")
16548                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16549                 $cat >try.c <<EOCP
16550 #$i_memory I_MEMORY
16551 #$i_stdlib I_STDLIB
16552 #$i_string I_STRING
16553 #$i_unistd I_UNISTD
16554 EOCP
16555         $cat >>try.c <<'EOCP'
16556 #include <stdio.h>
16557 #ifdef I_MEMORY
16558 #  include <memory.h>
16559 #endif
16560 #ifdef I_STDLIB
16561 #  include <stdlib.h>
16562 #endif
16563 #ifdef I_STRING
16564 #  include <string.h>
16565 #else
16566 #  include <strings.h>
16567 #endif
16568 #ifdef I_UNISTD
16569 #  include <unistd.h>  /* Needed for NetBSD */
16570 #endif
16571 int main()
16572 {
16573 char buf[128], abc[128];
16574 char *b;
16575 int len;
16576 int off;
16577 int align;
16578
16579 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16580    try to store the string in read-only memory. */
16581 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16582
16583 for (align = 7; align >= 0; align--) {
16584         for (len = 36; len; len--) {
16585                 b = buf+align;
16586                 memcpy(b, abc, len);
16587                 for (off = 1; off <= len; off++) {
16588                         memcpy(b+off, b, len);
16589                         memcpy(b, b+off, len);
16590                         if (memcmp(b, abc, len))
16591                                 exit(1);
16592                 }
16593         }
16594 }
16595 exit(0);
16596 }
16597 EOCP
16598                 set try
16599                 if eval $compile_ok; then
16600                         if $run ./try 2>/dev/null; then
16601                                 echo "Yes, it can."
16602                                 val="$define"
16603                         else
16604                                 echo "It can't, sorry."
16605                         fi
16606                 else
16607                         echo "(I can't compile the test program, so we'll assume not...)"
16608                 fi
16609                 ;;
16610         esac
16611         $rm_try
16612         ;;
16613 esac
16614 set d_safemcpy
16615 eval $setvar
16616
16617 : can memcmp be trusted to compare relative magnitude?
16618 val="$undef"
16619 case "$d_memcmp" in
16620 "$define")
16621         echo " "
16622         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16623         $cat >try.c <<EOCP
16624 #$i_memory I_MEMORY
16625 #$i_stdlib I_STDLIB
16626 #$i_string I_STRING
16627 #$i_unistd I_UNISTD
16628 EOCP
16629         $cat >>try.c <<'EOCP'
16630 #include <stdio.h>
16631 #ifdef I_MEMORY
16632 #  include <memory.h>
16633 #endif
16634 #ifdef I_STDLIB
16635 #  include <stdlib.h>
16636 #endif
16637 #ifdef I_STRING
16638 #  include <string.h>
16639 #else
16640 #  include <strings.h>
16641 #endif
16642 #ifdef I_UNISTD
16643 #  include <unistd.h>  /* Needed for NetBSD */
16644 #endif
16645 int main()
16646 {
16647 char a = -1;
16648 char b = 0;
16649 if ((a < b) && memcmp(&a, &b, 1) < 0)
16650         exit(1);
16651 exit(0);
16652 }
16653 EOCP
16654         set try
16655         if eval $compile_ok; then
16656                 if $run ./try 2>/dev/null; then
16657                         echo "Yes, it can."
16658                         val="$define"
16659                 else
16660                         echo "No, it can't (it uses signed chars)."
16661                 fi
16662         else
16663                 echo "(I can't compile the test program, so we'll assume not...)"
16664         fi
16665         ;;
16666 esac
16667 $rm_try
16668 set d_sanemcmp
16669 eval $setvar
16670
16671 : see if prototype for sbrk is available
16672 echo " "
16673 set d_sbrkproto sbrk $i_unistd unistd.h
16674 eval $hasproto
16675
16676 : see if select exists
16677 set select d_select
16678 eval $inlibc
16679
16680 : see if semctl exists
16681 set semctl d_semctl
16682 eval $inlibc
16683
16684 : see if semget exists
16685 set semget d_semget
16686 eval $inlibc
16687
16688 : see if semop exists
16689 set semop d_semop
16690 eval $inlibc
16691
16692 : see how much of the 'sem*(2)' library is present.
16693 h_sem=true
16694 echo " "
16695 case "$d_semctl$d_semget$d_semop" in
16696 *"$undef"*) h_sem=false;;
16697 esac
16698 case "$osname" in
16699 freebsd)
16700     case "`ipcs 2>&1`" in
16701     "SVID messages"*"not configured"*)
16702         echo "Your $osname does not have the sem*(2) configured." >&4
16703         h_sem=false
16704         val="$undef"
16705         set semctl d_semctl
16706         eval $setvar
16707         set semget d_semget
16708         eval $setvar
16709         set semop d_semop
16710         eval $setvar
16711         ;;
16712     esac
16713     ;;
16714 esac
16715 : we could also check for sys/ipc.h ...
16716 if $h_sem && $test `./findhdr sys/sem.h`; then
16717         echo "You have the full sem*(2) library." >&4
16718         val="$define"
16719 else
16720         echo "You don't have the full sem*(2) library." >&4
16721         val="$undef"
16722 fi
16723 set d_sem
16724 eval $setvar
16725
16726 : see whether sys/sem.h defines union semun
16727 echo " "
16728 $cat > try.c <<'END'
16729 #include <sys/types.h>
16730 #include <sys/ipc.h>
16731 #include <sys/sem.h>
16732 int main () { union semun semun; semun.buf = 0; }
16733 END
16734 set try
16735 if eval $compile; then
16736     echo "You have union semun in <sys/sem.h>." >&4
16737     val="$define"
16738 else
16739     echo "You do not have union semun in <sys/sem.h>." >&4
16740     val="$undef"
16741 fi
16742 $rm_try
16743 set d_union_semun
16744 eval $setvar
16745
16746 : see how to do semctl IPC_STAT
16747 case "$d_sem" in
16748 $define)
16749     echo " "
16750     $cat > tryh.h <<END
16751 #ifndef S_IRUSR
16752 #   ifdef S_IREAD
16753 #       define S_IRUSR S_IREAD
16754 #       define S_IWUSR S_IWRITE
16755 #       define S_IXUSR S_IEXEC
16756 #   else
16757 #       define S_IRUSR 0400
16758 #       define S_IWUSR 0200
16759 #       define S_IXUSR 0100
16760 #   endif
16761 #   define S_IRGRP (S_IRUSR>>3)
16762 #   define S_IWGRP (S_IWUSR>>3)
16763 #   define S_IXGRP (S_IXUSR>>3)
16764 #   define S_IROTH (S_IRUSR>>6)
16765 #   define S_IWOTH (S_IWUSR>>6)
16766 #   define S_IXOTH (S_IXUSR>>6)
16767 #endif
16768 #ifndef S_IRWXU
16769 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16770 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16771 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16772 #endif
16773 END
16774     : see whether semctl IPC_STAT can use union semun
16775     case "$d_semctl_semun" in
16776     '')
16777       val="$undef"
16778       $cat > try.c <<END
16779 #include <sys/types.h>
16780 #include <sys/ipc.h>
16781 #include <sys/sem.h>
16782 #include <sys/stat.h>
16783 #include <stdio.h>
16784 #include <errno.h>
16785 #include "tryh.h"
16786 #ifndef errno
16787 extern int errno;
16788 #endif
16789 #$d_union_semun HAS_UNION_SEMUN
16790 int main() {
16791     union semun
16792 #ifndef HAS_UNION_SEMUN
16793     {
16794         int val;
16795         struct semid_ds *buf;
16796         unsigned short *array;
16797     }
16798 #endif
16799     arg;
16800     int sem, st;
16801
16802 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16803     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16804     if (sem > -1) {
16805         struct semid_ds argbuf;
16806         arg.buf = &argbuf;
16807 #       ifdef IPC_STAT
16808         st = semctl(sem, 0, IPC_STAT, arg);
16809         if (st == 0)
16810             printf("semun\n");
16811         else
16812 #       endif /* IPC_STAT */
16813             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16814 #       ifdef IPC_RMID
16815         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16816 #       endif /* IPC_RMID */
16817             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16818     } else
16819 #endif /* IPC_PRIVATE && ... */
16820         printf("semget failed: errno = %d\n", errno);
16821   return 0;
16822 }
16823 END
16824       set try
16825       if eval $compile; then
16826           xxx=`$run ./try`
16827           case "$xxx" in
16828           semun) val="$define" ;;
16829           esac
16830       fi
16831       $rm_try
16832       set d_semctl_semun
16833       eval $setvar
16834       ;;
16835     esac
16836     case "$d_semctl_semun" in
16837     $define)
16838         echo "You can use union semun for semctl IPC_STAT." >&4
16839         also='also'
16840         ;;
16841     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16842         also=''
16843         ;;
16844     esac
16845
16846     : see whether semctl IPC_STAT can use struct semid_ds pointer
16847     case "$d_semctl_semid_ds" in
16848     '')
16849       val="$undef"
16850       $cat > try.c <<'END'
16851 #include <sys/types.h>
16852 #include <sys/ipc.h>
16853 #include <sys/sem.h>
16854 #include <sys/stat.h>
16855 #include "tryh.h"
16856 #include <stdio.h>
16857 #include <errno.h>
16858 #ifndef errno
16859 extern int errno;
16860 #endif
16861 int main() {
16862     struct semid_ds arg;
16863     int sem, st;
16864
16865 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16866     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16867     if (sem > -1) {
16868 #       ifdef IPC_STAT
16869         st = semctl(sem, 0, IPC_STAT, &arg);
16870         if (st == 0)
16871             printf("semid_ds\n");
16872         else
16873 #       endif /* IPC_STAT */
16874             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16875 #       ifdef IPC_RMID
16876         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16877 #       endif /* IPC_RMID */
16878             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16879     } else
16880 #endif /* IPC_PRIVATE && ... */
16881         printf("semget failed: errno = %d\n", errno);
16882
16883     return 0;
16884 }
16885 END
16886       set try
16887       if eval $compile; then
16888           xxx=`$run ./try`
16889           case "$xxx" in
16890           semid_ds) val="$define" ;;
16891           esac
16892       fi
16893       $rm_try
16894       set d_semctl_semid_ds
16895       eval $setvar
16896       ;;
16897     esac
16898     case "$d_semctl_semid_ds" in
16899     $define)
16900         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16901         ;;
16902     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16903         ;;
16904     esac
16905     ;;
16906 *)  val="$undef"
16907
16908     # We do not have the full sem*(2) library, so assume we can not
16909     # use either.
16910
16911     set d_semctl_semun
16912     eval $setvar
16913
16914     set d_semctl_semid_ds
16915     eval $setvar
16916     ;;
16917 esac
16918 $rm_try tryh.h
16919
16920 : see if sendmsg exists
16921 set sendmsg d_sendmsg
16922 eval $inlibc
16923
16924 : see if setegid exists
16925 set setegid d_setegid
16926 eval $inlibc
16927
16928 : see if seteuid exists
16929 set seteuid d_seteuid
16930 eval $inlibc
16931
16932 : see if setgrent exists
16933 set setgrent d_setgrent
16934 eval $inlibc
16935
16936 : see if setgrent_r exists
16937 set setgrent_r d_setgrent_r
16938 eval $inlibc
16939 case "$d_setgrent_r" in
16940 "$define")
16941         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16942         case "$d_setgrent_r_proto:$usethreads" in
16943         ":define")      d_setgrent_r_proto=define
16944                 set d_setgrent_r_proto setgrent_r $hdrs
16945                 eval $hasproto ;;
16946         *)      ;;
16947         esac
16948         case "$d_setgrent_r_proto" in
16949         define)
16950         case "$setgrent_r_proto" in
16951         ''|0) try='int setgrent_r(FILE**);'
16952         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16953         esac
16954         case "$setgrent_r_proto" in
16955         ''|0) try='void setgrent_r(FILE**);'
16956         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16957         esac
16958         case "$setgrent_r_proto" in
16959         ''|0)   d_setgrent_r=undef
16960                 setgrent_r_proto=0
16961                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16962         * )     case "$setgrent_r_proto" in
16963                 REENTRANT_PROTO*) ;;
16964                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16965                 esac
16966                 echo "Prototype: $try" ;;
16967         esac
16968         ;;
16969         *)      case "$usethreads" in
16970                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16971                 esac
16972                 d_setgrent_r=undef
16973                 setgrent_r_proto=0
16974                 ;;
16975         esac
16976         ;;
16977 *)      setgrent_r_proto=0
16978         ;;
16979 esac
16980
16981 : see if sethostent exists
16982 set sethostent d_sethent
16983 eval $inlibc
16984
16985 : see if sethostent_r exists
16986 set sethostent_r d_sethostent_r
16987 eval $inlibc
16988 case "$d_sethostent_r" in
16989 "$define")
16990         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16991         case "$d_sethostent_r_proto:$usethreads" in
16992         ":define")      d_sethostent_r_proto=define
16993                 set d_sethostent_r_proto sethostent_r $hdrs
16994                 eval $hasproto ;;
16995         *)      ;;
16996         esac
16997         case "$d_sethostent_r_proto" in
16998         define)
16999         case "$sethostent_r_proto" in
17000         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17001         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17002         esac
17003         case "$sethostent_r_proto" in
17004         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17005         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17006         esac
17007         case "$sethostent_r_proto" in
17008         ''|0)   d_sethostent_r=undef
17009                 sethostent_r_proto=0
17010                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17011         * )     case "$sethostent_r_proto" in
17012                 REENTRANT_PROTO*) ;;
17013                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17014                 esac
17015                 echo "Prototype: $try" ;;
17016         esac
17017         ;;
17018         *)      case "$usethreads" in
17019                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17020                 esac
17021                 d_sethostent_r=undef
17022                 sethostent_r_proto=0
17023                 ;;
17024         esac
17025         ;;
17026 *)      sethostent_r_proto=0
17027         ;;
17028 esac
17029
17030 : see if setitimer exists
17031 set setitimer d_setitimer
17032 eval $inlibc
17033
17034 : see if setlinebuf exists
17035 set setlinebuf d_setlinebuf
17036 eval $inlibc
17037
17038 : see if setlocale exists
17039 set setlocale d_setlocale
17040 eval $inlibc
17041
17042 : see if locale.h is available
17043 set locale.h i_locale
17044 eval $inhdr
17045
17046 : see if setlocale_r exists
17047 set setlocale_r d_setlocale_r
17048 eval $inlibc
17049 case "$d_setlocale_r" in
17050 "$define")
17051         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17052         case "$d_setlocale_r_proto:$usethreads" in
17053         ":define")      d_setlocale_r_proto=define
17054                 set d_setlocale_r_proto setlocale_r $hdrs
17055                 eval $hasproto ;;
17056         *)      ;;
17057         esac
17058         case "$d_setlocale_r_proto" in
17059         define)
17060         case "$setlocale_r_proto" in
17061         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17062         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17063         esac
17064         case "$setlocale_r_proto" in
17065         ''|0)   d_setlocale_r=undef
17066                 setlocale_r_proto=0
17067                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17068         * )     case "$setlocale_r_proto" in
17069                 REENTRANT_PROTO*) ;;
17070                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17071                 esac
17072                 echo "Prototype: $try" ;;
17073         esac
17074         ;;
17075         *)      case "$usethreads" in
17076                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17077                 esac
17078                 d_setlocale_r=undef
17079                 setlocale_r_proto=0
17080                 ;;
17081         esac
17082         ;;
17083 *)      setlocale_r_proto=0
17084         ;;
17085 esac
17086
17087 : see if setnetent exists
17088 set setnetent d_setnent
17089 eval $inlibc
17090
17091 : see if setnetent_r exists
17092 set setnetent_r d_setnetent_r
17093 eval $inlibc
17094 case "$d_setnetent_r" in
17095 "$define")
17096         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17097         case "$d_setnetent_r_proto:$usethreads" in
17098         ":define")      d_setnetent_r_proto=define
17099                 set d_setnetent_r_proto setnetent_r $hdrs
17100                 eval $hasproto ;;
17101         *)      ;;
17102         esac
17103         case "$d_setnetent_r_proto" in
17104         define)
17105         case "$setnetent_r_proto" in
17106         ''|0) try='int setnetent_r(int, struct netent_data*);'
17107         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17108         esac
17109         case "$setnetent_r_proto" in
17110         ''|0) try='void setnetent_r(int, struct netent_data*);'
17111         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17112         esac
17113         case "$setnetent_r_proto" in
17114         ''|0)   d_setnetent_r=undef
17115                 setnetent_r_proto=0
17116                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17117         * )     case "$setnetent_r_proto" in
17118                 REENTRANT_PROTO*) ;;
17119                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17120                 esac
17121                 echo "Prototype: $try" ;;
17122         esac
17123         ;;
17124         *)      case "$usethreads" in
17125                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17126                 esac
17127                 d_setnetent_r=undef
17128                 setnetent_r_proto=0
17129                 ;;
17130         esac
17131         ;;
17132 *)      setnetent_r_proto=0
17133         ;;
17134 esac
17135
17136 : see if setprotoent exists
17137 set setprotoent d_setpent
17138 eval $inlibc
17139
17140 : see if setpgid exists
17141 set setpgid d_setpgid
17142 eval $inlibc
17143
17144 : see if setpgrp2 exists
17145 set setpgrp2 d_setpgrp2
17146 eval $inlibc
17147
17148 : see if setpriority exists
17149 set setpriority d_setprior
17150 eval $inlibc
17151
17152 : see if setproctitle exists
17153 set setproctitle d_setproctitle
17154 eval $inlibc
17155
17156 : see if setprotoent_r exists
17157 set setprotoent_r d_setprotoent_r
17158 eval $inlibc
17159 case "$d_setprotoent_r" in
17160 "$define")
17161         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17162         case "$d_setprotoent_r_proto:$usethreads" in
17163         ":define")      d_setprotoent_r_proto=define
17164                 set d_setprotoent_r_proto setprotoent_r $hdrs
17165                 eval $hasproto ;;
17166         *)      ;;
17167         esac
17168         case "$d_setprotoent_r_proto" in
17169         define)
17170         case "$setprotoent_r_proto" in
17171         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17172         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17173         esac
17174         case "$setprotoent_r_proto" in
17175         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17176         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17177         esac
17178         case "$setprotoent_r_proto" in
17179         ''|0)   d_setprotoent_r=undef
17180                 setprotoent_r_proto=0
17181                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17182         * )     case "$setprotoent_r_proto" in
17183                 REENTRANT_PROTO*) ;;
17184                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17185                 esac
17186                 echo "Prototype: $try" ;;
17187         esac
17188         ;;
17189         *)      case "$usethreads" in
17190                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17191                 esac
17192                 d_setprotoent_r=undef
17193                 setprotoent_r_proto=0
17194                 ;;
17195         esac
17196         ;;
17197 *)      setprotoent_r_proto=0
17198         ;;
17199 esac
17200
17201 : see if setpwent exists
17202 set setpwent d_setpwent
17203 eval $inlibc
17204
17205 : see if setpwent_r exists
17206 set setpwent_r d_setpwent_r
17207 eval $inlibc
17208 case "$d_setpwent_r" in
17209 "$define")
17210         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17211         case "$d_setpwent_r_proto:$usethreads" in
17212         ":define")      d_setpwent_r_proto=define
17213                 set d_setpwent_r_proto setpwent_r $hdrs
17214                 eval $hasproto ;;
17215         *)      ;;
17216         esac
17217         case "$d_setpwent_r_proto" in
17218         define)
17219         case "$setpwent_r_proto" in
17220         ''|0) try='int setpwent_r(FILE**);'
17221         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17222         esac
17223         case "$setpwent_r_proto" in
17224         ''|0) try='void setpwent_r(FILE**);'
17225         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17226         esac
17227         case "$setpwent_r_proto" in
17228         ''|0)   d_setpwent_r=undef
17229                 setpwent_r_proto=0
17230                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17231         * )     case "$setpwent_r_proto" in
17232                 REENTRANT_PROTO*) ;;
17233                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17234                 esac
17235                 echo "Prototype: $try" ;;
17236         esac
17237         ;;
17238         *)      case "$usethreads" in
17239                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17240                 esac
17241                 d_setpwent_r=undef
17242                 setpwent_r_proto=0
17243                 ;;
17244         esac
17245         ;;
17246 *)      setpwent_r_proto=0
17247         ;;
17248 esac
17249
17250 : see if setregid exists
17251 set setregid d_setregid
17252 eval $inlibc
17253 set setresgid d_setresgid
17254 eval $inlibc
17255
17256 : see if setreuid exists
17257 set setreuid d_setreuid
17258 eval $inlibc
17259 set setresuid d_setresuid
17260 eval $inlibc
17261
17262 : see if setrgid exists
17263 set setrgid d_setrgid
17264 eval $inlibc
17265
17266 : see if setruid exists
17267 set setruid d_setruid
17268 eval $inlibc
17269
17270 : see if setservent exists
17271 set setservent d_setsent
17272 eval $inlibc
17273
17274 : see if setservent_r exists
17275 set setservent_r d_setservent_r
17276 eval $inlibc
17277 case "$d_setservent_r" in
17278 "$define")
17279         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17280         case "$d_setservent_r_proto:$usethreads" in
17281         ":define")      d_setservent_r_proto=define
17282                 set d_setservent_r_proto setservent_r $hdrs
17283                 eval $hasproto ;;
17284         *)      ;;
17285         esac
17286         case "$d_setservent_r_proto" in
17287         define)
17288         case "$setservent_r_proto" in
17289         ''|0) try='int setservent_r(int, struct servent_data*);'
17290         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17291         esac
17292         case "$setservent_r_proto" in
17293         ''|0) try='void setservent_r(int, struct servent_data*);'
17294         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17295         esac
17296         case "$setservent_r_proto" in
17297         ''|0)   d_setservent_r=undef
17298                 setservent_r_proto=0
17299                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17300         * )     case "$setservent_r_proto" in
17301                 REENTRANT_PROTO*) ;;
17302                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17303                 esac
17304                 echo "Prototype: $try" ;;
17305         esac
17306         ;;
17307         *)      case "$usethreads" in
17308                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17309                 esac
17310                 d_setservent_r=undef
17311                 setservent_r_proto=0
17312                 ;;
17313         esac
17314         ;;
17315 *)      setservent_r_proto=0
17316         ;;
17317 esac
17318
17319 : see if setsid exists
17320 set setsid d_setsid
17321 eval $inlibc
17322
17323 : see if setvbuf exists
17324 set setvbuf d_setvbuf
17325 eval $inlibc
17326
17327 : see if sfio.h is available
17328 set sfio.h i_sfio
17329 eval $inhdr
17330
17331 : see if sfio library is available
17332 case "$i_sfio" in
17333 $define)
17334         val=''
17335         set sfreserve val
17336         eval $inlibc
17337         ;;
17338 *)
17339         val="$undef"
17340         ;;
17341 esac
17342 : Ok, but do we want to use it.
17343 case "$val" in
17344 $define)
17345         case "$usesfio" in
17346         true|$define|[yY]*) dflt='y';;
17347         *) dflt='n';;
17348         esac
17349         echo "$package can use the sfio library, but it is experimental."
17350         case "$useperlio" in
17351         "$undef")
17352             echo "For sfio also the PerlIO abstraction layer is needed."
17353             echo "Earlier you said you wouldn't want that."
17354             ;;
17355         esac
17356         rp="You seem to have sfio available, do you want to try using it?"
17357         . ./myread
17358         case "$ans" in
17359         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17360                 useperlio="$define"
17361                 val="$define"
17362                 ;;
17363         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17364                 val="$undef"
17365                 ;;
17366         esac
17367         ;;
17368 *)      case "$usesfio" in
17369         true|$define|[yY]*)
17370                 echo "Sorry, cannot find sfio on this machine." >&4
17371                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17372                 val="$undef"
17373                 ;;
17374         esac
17375         ;;
17376 esac
17377 set d_sfio
17378 eval $setvar
17379 case "$d_sfio" in
17380 $define) usesfio='true';;
17381 *) usesfio='false';;
17382 esac
17383 case "$d_sfio" in
17384 $define) ;;
17385 *)      : Remove sfio from list of libraries to use
17386         case "$libs" in
17387         *-lsfio*)
17388                 echo "Removing unneeded -lsfio from library list" >&4
17389                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17390                 shift
17391                 libs="$*"
17392                 echo "libs = $libs" >&4
17393                 ;;
17394         esac
17395 ;;
17396 esac
17397
17398
17399 : see if shmctl exists
17400 set shmctl d_shmctl
17401 eval $inlibc
17402
17403 : see if shmget exists
17404 set shmget d_shmget
17405 eval $inlibc
17406
17407 : see if shmat exists
17408 set shmat d_shmat
17409 eval $inlibc
17410 : see what shmat returns
17411 case "$d_shmat" in
17412 "$define")
17413         $cat >shmat.c <<'END'
17414 #include <sys/shm.h>
17415 void *shmat();
17416 END
17417         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17418                 shmattype='void *'
17419         else
17420                 shmattype='char *'
17421         fi
17422         echo "and it returns ($shmattype)." >&4
17423         : see if a prototype for shmat is available
17424         xxx=`./findhdr sys/shm.h`
17425         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17426         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17427                 val="$define"
17428         else
17429                 val="$undef"
17430         fi
17431         $rm -f shmat.[co]
17432         ;;
17433 *)
17434         val="$undef"
17435         ;;
17436 esac
17437 set d_shmatprototype
17438 eval $setvar
17439
17440 : see if shmdt exists
17441 set shmdt d_shmdt
17442 eval $inlibc
17443
17444 : see how much of the 'shm*(2)' library is present.
17445 h_shm=true
17446 echo " "
17447 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17448 *"$undef"*) h_shm=false;;
17449 esac
17450 case "$osname" in
17451 freebsd)
17452     case "`ipcs 2>&1`" in
17453     "SVID shared memory"*"not configured"*)
17454         echo "Your $osname does not have the shm*(2) configured." >&4
17455         h_shm=false
17456         val="$undef"
17457         set shmctl d_shmctl
17458         evat $setvar
17459         set shmget d_shmget
17460         evat $setvar
17461         set shmat d_shmat
17462         evat $setvar
17463         set shmdt d_shmdt
17464         evat $setvar
17465         ;;
17466     esac
17467     ;;
17468 esac
17469 : we could also check for sys/ipc.h ...
17470 if $h_shm && $test `./findhdr sys/shm.h`; then
17471         echo "You have the full shm*(2) library." >&4
17472         val="$define"
17473 else
17474         echo "You don't have the full shm*(2) library." >&4
17475         val="$undef"
17476 fi
17477 set d_shm
17478 eval $setvar
17479
17480 : see if we have sigaction
17481 echo " "
17482 if set sigaction val -f d_sigaction; eval $csym; $val; then
17483         echo 'sigaction() found.' >&4
17484         $cat > try.c <<EOP
17485 #include <stdio.h>
17486 #include <sys/types.h>
17487 #include <signal.h>
17488 #$i_stdlib I_STDLIB
17489 #ifdef I_STDLIB
17490 #include <stdlib.h>
17491 #endif
17492 int main()
17493 {
17494     struct sigaction act, oact;
17495     act.sa_flags = 0;
17496     oact.sa_handler = 0;
17497     /* so that act and oact are used */
17498     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17499 }
17500 EOP
17501         set try
17502         if eval $compile_ok; then
17503                 val="$define"
17504         else
17505                 echo "But you don't seem to have a useable struct sigaction." >&4
17506                 val="$undef"
17507         fi
17508 else
17509         echo 'sigaction NOT found.' >&4
17510         val="$undef"
17511 fi
17512 set d_sigaction; eval $setvar
17513 $rm_try
17514
17515 : see if this is a sunmath.h system
17516 set sunmath.h i_sunmath
17517 eval $inhdr
17518
17519 : see if signbit exists
17520 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17521 $cat >try.c <<EOCP
17522 #$i_math I_MATH
17523 #$i_sunmath I_SUNMATH
17524 #ifdef I_MATH
17525 #  include <math.h>
17526 #endif
17527 #ifdef I_SUNMATH  /* Solaris special math library */
17528 #  include <sunmath.h>
17529 #endif
17530 #define NV $nvtype
17531 int main(int argc, char **argv)
17532 {
17533     NV x = 0.0;
17534     NV y = -0.0;
17535     if ((signbit(x) == 0) && (signbit(y) != 0))
17536         return 0;
17537     else
17538         return 1;
17539 }
17540 EOCP
17541 val="$undef"
17542 set try
17543 if eval $compile; then
17544     if $run ./try; then
17545         $echo "Yes." >&4
17546         val="$define"
17547     else
17548         $echo "Signbit seems to be available, but doesn't work as I expected."
17549         $echo "I won't use it." >&4
17550         val="$undef"
17551     fi
17552 else
17553     $echo "Nope." >&4
17554     dflt="$undef"
17555 fi
17556 set d_signbit
17557 eval $setvar
17558 $rm_try
17559
17560 : see if sigprocmask exists
17561 set sigprocmask d_sigprocmask
17562 eval $inlibc
17563
17564 : see if sigsetjmp exists
17565 echo " "
17566 case "$d_sigsetjmp" in
17567 '')
17568         $cat >try.c <<EOP
17569 #include <setjmp.h>
17570 #$i_stdlib I_STDLIB
17571 #ifdef I_STDLIB
17572 #include <stdlib.h>
17573 #endif
17574 sigjmp_buf env;
17575 int set = 1;
17576 int main()
17577 {
17578         if (sigsetjmp(env,1))
17579                 exit(set);
17580         set = 0;
17581         siglongjmp(env, 1);
17582         exit(1);
17583 }
17584 EOP
17585         set try
17586         if eval $compile; then
17587                 if $run ./try >/dev/null 2>&1; then
17588                         echo "POSIX sigsetjmp found." >&4
17589                         val="$define"
17590                 else
17591                         $cat >&4 <<EOM
17592 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17593 I'll ignore them.
17594 EOM
17595                         val="$undef"
17596                 fi
17597         else
17598                 echo "sigsetjmp not found." >&4
17599                 val="$undef"
17600         fi
17601         ;;
17602 *) val="$d_sigsetjmp"
17603         case "$d_sigsetjmp" in
17604         $define) echo "POSIX sigsetjmp found." >&4;;
17605         $undef) echo "sigsetjmp not found." >&4;;
17606         esac
17607         ;;
17608 esac
17609 set d_sigsetjmp
17610 eval $setvar
17611 $rm_try
17612
17613 : see if snprintf exists
17614 set snprintf d_snprintf
17615 eval $inlibc
17616
17617 : see if vsnprintf exists
17618 set vsnprintf d_vsnprintf
17619 eval $inlibc
17620
17621 case "$d_snprintf-$d_vsnprintf" in
17622 "$define-$define")
17623     $cat <<EOM
17624 Checking whether your snprintf() and vsnprintf() work okay...
17625 EOM
17626     $cat >try.c <<'EOCP'
17627 /* v?snprintf testing logic courtesy of Russ Allbery.
17628  * According to C99:
17629  * - if the buffer is too short it still must be \0-terminated
17630  * - if the buffer is too short the potentially required length
17631  *   must be returned and not -1
17632  * - if the buffer is NULL the potentially required length
17633  *   must be returned and not -1 or core dump
17634  */
17635 #include <stdio.h>
17636 #include <stdarg.h>
17637
17638 char buf[2];
17639
17640 int test (char *format, ...)
17641 {
17642     va_list args;
17643     int count;
17644
17645     va_start (args, format);
17646     count = vsnprintf (buf, sizeof buf, format, args);
17647     va_end (args);
17648     return count;
17649 }
17650
17651 int main ()
17652 {
17653     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17654              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17655 }
17656 EOCP
17657     set try
17658     if eval $compile; then
17659         `$run ./try`
17660         case "$?" in
17661         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17662         *) cat <<EOM >&4
17663 Your snprintf() and snprintf() don't seem to be working okay.
17664 EOM
17665            d_snprintf="$undef"
17666            d_vsnprintf="$undef"
17667            ;;
17668         esac
17669     else
17670         echo "(I can't seem to compile the test program--assuming they don't)"
17671         d_snprintf="$undef"
17672         d_vsnprintf="$undef"
17673     fi
17674     $rm_try
17675     ;;
17676 esac
17677
17678 : see if sockatmark exists
17679 set sockatmark d_sockatmark
17680 eval $inlibc
17681
17682 : see if prototype for sockatmark is available
17683 echo " "
17684 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17685 eval $hasproto
17686
17687 : see if socks5_init exists
17688 set socks5_init d_socks5_init
17689 eval $inlibc
17690
17691 : see if sprintf returns the length of the string in the buffer as per ANSI
17692 $echo "Checking whether sprintf returns the length of the string..." >&4
17693 $cat <<EOP >try.c
17694 #include <stdio.h>
17695 #$i_stdlib I_STDLIB
17696 #ifdef I_STDLIB
17697 #include <stdlib.h>
17698 #endif
17699 #$i_string I_STRING
17700 #ifdef I_STRING
17701 #  include <string.h>
17702 #else
17703 #  include <strings.h>
17704 #endif
17705 #$i_math I_MATH
17706 #ifdef I_MATH
17707 #include <math.h>
17708 #endif
17709
17710 char buffer[256];
17711
17712 int check (size_t expect, int test) {
17713   size_t got = strlen(buffer);
17714   if (expect == got)
17715     return 0;
17716
17717   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17718        test, buffer);
17719   exit (test);
17720 }
17721
17722 int main(int argc, char **argv) {
17723   int test = 0;
17724
17725   check(sprintf(buffer, ""), ++test);
17726   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17727   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17728
17729   return 0;
17730 }
17731 EOP
17732 set try
17733
17734 if eval $compile; then
17735     xxx="`$run ./try`"
17736     case "$?" in
17737         0) cat >&4 <<EOM
17738 sprintf returns the length of the string (as ANSI says it should)
17739 EOM
17740         d_sprintf_returns_strlen="$define"
17741         ;;
17742         *) cat >&4 <<EOM
17743 sprintf does not return the length of the string (how old is this system?)
17744 EOM
17745         d_sprintf_returns_strlen="$undef"
17746         ;;
17747     esac
17748 else
17749     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17750     d_sprintf_returns_strlen="$undef"
17751 fi
17752 $rm_try
17753
17754 : see if srand48_r exists
17755 set srand48_r d_srand48_r
17756 eval $inlibc
17757 case "$d_srand48_r" in
17758 "$define")
17759         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17760         case "$d_srand48_r_proto:$usethreads" in
17761         ":define")      d_srand48_r_proto=define
17762                 set d_srand48_r_proto srand48_r $hdrs
17763                 eval $hasproto ;;
17764         *)      ;;
17765         esac
17766         case "$d_srand48_r_proto" in
17767         define)
17768         case "$srand48_r_proto" in
17769         ''|0) try='int srand48_r(long, struct drand48_data*);'
17770         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17771         esac
17772         case "$srand48_r_proto" in
17773         ''|0)   d_srand48_r=undef
17774                 srand48_r_proto=0
17775                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17776         * )     case "$srand48_r_proto" in
17777                 REENTRANT_PROTO*) ;;
17778                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17779                 esac
17780                 echo "Prototype: $try" ;;
17781         esac
17782         ;;
17783         *)      case "$usethreads" in
17784                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17785                 esac
17786                 d_srand48_r=undef
17787                 srand48_r_proto=0
17788                 ;;
17789         esac
17790         ;;
17791 *)      srand48_r_proto=0
17792         ;;
17793 esac
17794
17795 : see if srandom_r exists
17796 set srandom_r d_srandom_r
17797 eval $inlibc
17798 case "$d_srandom_r" in
17799 "$define")
17800         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17801         case "$d_srandom_r_proto:$usethreads" in
17802         ":define")      d_srandom_r_proto=define
17803                 set d_srandom_r_proto srandom_r $hdrs
17804                 eval $hasproto ;;
17805         *)      ;;
17806         esac
17807         case "$d_srandom_r_proto" in
17808         define)
17809         case "$srandom_r_proto" in
17810         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17811         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17812         esac
17813         case "$srandom_r_proto" in
17814         ''|0)   d_srandom_r=undef
17815                 srandom_r_proto=0
17816                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17817         * )     case "$srandom_r_proto" in
17818                 REENTRANT_PROTO*) ;;
17819                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17820                 esac
17821                 echo "Prototype: $try" ;;
17822         esac
17823         ;;
17824         *)      case "$usethreads" in
17825                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17826                 esac
17827                 d_srandom_r=undef
17828                 srandom_r_proto=0
17829                 ;;
17830         esac
17831         ;;
17832 *)      srandom_r_proto=0
17833         ;;
17834 esac
17835
17836 : see if prototype for setresgid is available
17837 echo " "
17838 set d_sresgproto setresgid $i_unistd unistd.h
17839 eval $hasproto
17840
17841 : see if prototype for setresuid is available
17842 echo " "
17843 set d_sresuproto setresuid $i_unistd unistd.h
17844 eval $hasproto
17845
17846 : see if sys/stat.h is available
17847 set sys/stat.h i_sysstat
17848 eval $inhdr
17849
17850 : see if stat knows about block sizes
17851 echo " "
17852 echo "Checking to see if your struct stat has st_blocks field..." >&4
17853 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17854 eval $hasfield
17855
17856 : see if this is a sys/vfs.h system
17857 set sys/vfs.h i_sysvfs
17858 eval $inhdr
17859
17860 : see if this is a sys/statfs.h system
17861 set sys/statfs.h i_sysstatfs
17862 eval $inhdr
17863
17864 : Check for statfs_s
17865 echo " "
17866 echo "Checking to see if your system supports struct statfs..." >&4
17867 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
17868 eval $hasstruct
17869 case "$d_statfs_s" in
17870 "$define")      echo "Yes, it does."   ;;
17871 *)              echo "No, it doesn't." ;;
17872 esac
17873
17874
17875 : see if struct statfs knows about f_flags
17876 case "$d_statfs_s" in
17877 define)
17878         echo " "
17879         echo "Checking to see if your struct statfs has f_flags field..." >&4
17880         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
17881         eval $hasfield
17882         ;;
17883 *)      val="$undef"
17884         set d_statfs_f_flags
17885         eval $setvar
17886         ;;
17887 esac
17888 case "$d_statfs_f_flags" in
17889 "$define")      echo "Yes, it does."   ;;
17890 *)              echo "No, it doesn't." ;;
17891 esac
17892
17893 : see what flavor, if any, of static inline is supported
17894 echo " "
17895 echo "Checking to see if your system supports static inline..."
17896 $cat > try.c <<'EOCP'
17897 #include <stdlib.h>
17898 extern int f_via_a(int x);
17899 extern int f_via_b(int x);
17900 int main(int argc, char **argv)
17901 {
17902     int y;
17903
17904     y = f_via_a(0);
17905 #ifdef USE_B
17906     y = f_via_b(0);
17907 #endif
17908     if (y == 42) {
17909         return EXIT_SUCCESS;
17910     }
17911     else {
17912         return EXIT_FAILURE;
17913     }
17914 }
17915 EOCP
17916 $cat > a.c <<'EOCP'
17917 static INLINE int f(int x) {
17918     int y;
17919     y = x + 42;
17920     return y;
17921 }
17922
17923 int f_via_a(int x)
17924 {
17925     return f(x);
17926 }
17927 EOCP
17928 $cat > b.c <<'EOCP'
17929 extern int f(int x);
17930
17931 int f_via_b(int x)
17932 {
17933     return f(x);
17934 }
17935 EOCP
17936
17937 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17938 case "$perl_static_inline" in
17939 '')     # Check the various possibilities, and break out on success.
17940         # For gcc, prefer __inline__, which will still permit 
17941         # cflags.SH to add in -ansi.
17942         case "$gccversion" in
17943                 '') xxx="inline __inline__ __inline _inline";;
17944                 *)  xxx="__inline__ inline __inline _inline";;
17945         esac
17946         for inline in $xxx; do
17947                 set try -DINLINE=$inline a.c
17948                 if eval $compile && $run ./try; then
17949                         # Now make sure there is no external linkage of static
17950                         # functions
17951                         set try -DINLINE=$inline -DUSE_B a.c b.c
17952                         if eval $compile && $run ./try; then
17953                                 $echo "Your compiler supports static $inline, " >&4
17954                                 $echo "but it also creates an external definition," >&4
17955                                 $echo "so I won't use it." >&4
17956                                 val=$undef
17957                         else
17958                                 $echo "Your compiler supports static $inline." >&4
17959                                 val=$define
17960                                 perl_static_inline="static $inline";
17961                                 break;
17962                         fi
17963                 else
17964                         $echo "Your compiler does NOT support static $inline." >&4
17965                         val="$undef"
17966                 fi
17967         done
17968         ;;
17969 *inline*) # Some variant of inline exists.
17970         echo "Keeping your $hint value of $perl_static_inline."
17971         val=$define
17972         ;;
17973 static)  # No inline capabilities
17974         echo "Keeping your $hint value of $perl_static_inline."
17975         val=$undef
17976         ;;
17977 *)  # Unrecognized previous value -- blindly trust the supplied
17978         # value and hope it makes sense.  Use old value for
17979         # d_static_inline, if there is one.
17980         echo "Keeping your $hint value of $perl_static_inline."
17981         case "$d_static_inline" in
17982                 '') val=$define ;;
17983                 *)  val=$d_static_inline ;;
17984         esac
17985         ;;
17986 esac
17987 # Fallback to plain 'static' if nothing worked.
17988 case "$perl_static_inline" in
17989 '')
17990         perl_static_inline="static"
17991         val=$undef
17992         ;;
17993 esac
17994 set d_static_inline
17995 eval $setvar
17996 $rm -f a.[co] b.[co]
17997 $rm_try
17998
17999 : Check stream access
18000 $cat >&4 <<EOM
18001 Checking how to access stdio streams by file descriptor number...
18002 EOM
18003 case "$stdio_stream_array" in
18004 '')     $cat >try.c <<EOCP
18005 #include <stdio.h>
18006 int main() {
18007   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18008     printf("yes\n");
18009 }
18010 EOCP
18011         for s in _iob __iob __sF
18012         do
18013                 set try -DSTDIO_STREAM_ARRAY=$s
18014                 if eval $compile; then
18015                         case "`$run ./try`" in
18016                         yes)    stdio_stream_array=$s; break ;;
18017                         esac
18018                 fi
18019         done
18020         $rm_try
18021 esac
18022 case "$stdio_stream_array" in
18023 '')     $cat >&4 <<EOM
18024 I can't figure out how to access stdio streams by file descriptor number.
18025 EOM
18026         d_stdio_stream_array="$undef"
18027         ;;
18028 *)      $cat >&4 <<EOM
18029 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18030 EOM
18031         d_stdio_stream_array="$define"
18032         ;;
18033 esac
18034
18035 : see if strcoll exists
18036 set strcoll d_strcoll
18037 eval $inlibc
18038
18039 : check for structure copying
18040 echo " "
18041 echo "Checking to see if your C compiler can copy structs..." >&4
18042 $cat >try.c <<'EOCP'
18043 int main()
18044 {
18045         struct blurfl {
18046                 int dyick;
18047         } foo, bar;
18048
18049         foo = bar;
18050 }
18051 EOCP
18052 if $cc -c try.c >/dev/null 2>&1 ; then
18053         val="$define"
18054         echo "Yup, it can."
18055 else
18056         val="$undef"
18057         echo "Nope, it can't."
18058 fi
18059 set d_strctcpy
18060 eval $setvar
18061 $rm_try
18062
18063 : see if strerror and/or sys_errlist[] exist
18064 echo " "
18065 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18066     if set strerror val -f d_strerror; eval $csym; $val; then
18067                 echo 'strerror() found.' >&4
18068                 d_strerror="$define"
18069                 d_strerrm='strerror(e)'
18070                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18071                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18072                         d_syserrlst="$define"
18073                 else
18074                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18075                         d_syserrlst="$undef"
18076                 fi
18077     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18078                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18079                 echo 'strerror() found in string header.' >&4
18080                 d_strerror="$define"
18081                 d_strerrm='strerror(e)'
18082                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18083                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18084                                 d_syserrlst="$define"
18085                 else
18086                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18087                         d_syserrlst="$undef"
18088                 fi
18089     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18090                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18091                 d_strerror="$undef"
18092                 d_syserrlst="$define"
18093                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18094     else
18095                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18096                 d_strerror="$undef"
18097                 d_syserrlst="$undef"
18098                 d_strerrm='"unknown"'
18099     fi
18100 fi
18101
18102 : see if strerror_r exists
18103 set strerror_r d_strerror_r
18104 eval $inlibc
18105 case "$d_strerror_r" in
18106 "$define")
18107         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18108         case "$d_strerror_r_proto:$usethreads" in
18109         ":define")      d_strerror_r_proto=define
18110                 set d_strerror_r_proto strerror_r $hdrs
18111                 eval $hasproto ;;
18112         *)      ;;
18113         esac
18114         case "$d_strerror_r_proto" in
18115         define)
18116         case "$strerror_r_proto" in
18117         ''|0) try='int strerror_r(int, char*, size_t);'
18118         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18119         esac
18120         case "$strerror_r_proto" in
18121         ''|0) try='int strerror_r(int, char*, int);'
18122         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18123         esac
18124         case "$strerror_r_proto" in
18125         ''|0) try='char* strerror_r(int, char*, size_t);'
18126         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18127         esac
18128         case "$strerror_r_proto" in
18129         ''|0)   d_strerror_r=undef
18130                 strerror_r_proto=0
18131                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18132         * )     case "$strerror_r_proto" in
18133                 REENTRANT_PROTO*) ;;
18134                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18135                 esac
18136                 echo "Prototype: $try" ;;
18137         esac
18138         ;;
18139         *)      case "$usethreads" in
18140                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18141                 esac
18142                 d_strerror_r=undef
18143                 strerror_r_proto=0
18144                 ;;
18145         esac
18146         ;;
18147 *)      strerror_r_proto=0
18148         ;;
18149 esac
18150
18151 : see if strftime exists
18152 set strftime d_strftime
18153 eval $inlibc
18154
18155 : see if strlcat exists
18156 set strlcat d_strlcat
18157 eval $inlibc
18158
18159 : see if strlcpy exists
18160 set strlcpy d_strlcpy
18161 eval $inlibc
18162
18163 : see if strtod exists
18164 set strtod d_strtod
18165 eval $inlibc
18166
18167 : see if strtol exists
18168 set strtol d_strtol
18169 eval $inlibc
18170
18171 : see if strtold exists
18172 set strtold d_strtold
18173 eval $inlibc
18174
18175 : see if strtoll exists
18176 set strtoll d_strtoll
18177 eval $inlibc
18178
18179 case "$d_longlong-$d_strtoll" in
18180 "$define-$define")
18181         $cat <<EOM
18182 Checking whether your strtoll() works okay...
18183 EOM
18184         $cat >try.c <<'EOCP'
18185 #include <errno.h>
18186 #ifdef __hpux
18187 #define strtoll __strtoll
18188 #endif
18189 #ifdef __EMX__
18190 #define strtoll _strtoll
18191 #endif
18192 #include <stdio.h>
18193 extern long long int strtoll(char *s, char **, int);
18194 static int bad = 0;
18195 int check(char *s, long long ell, int een) {
18196         long long gll;
18197         errno = 0;
18198         gll = strtoll(s, 0, 10);
18199         if (!((gll == ell) && (errno == een)))
18200                 bad++;
18201 }
18202 int main() {
18203         check(" 1",                                      1LL, 0);
18204         check(" 0",                                      0LL, 0);
18205         check("-1",                                     -1LL, 0);
18206         check("-9223372036854775808", -9223372036854775808LL, 0);
18207         check("-9223372036854775808", -9223372036854775808LL, 0);
18208         check(" 9223372036854775807",  9223372036854775807LL, 0);
18209         check("-9223372036854775808", -9223372036854775808LL, 0);
18210         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18211         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18212         if (!bad)
18213                 printf("ok\n");
18214 }
18215 EOCP
18216         set try
18217         if eval $compile; then
18218                 yyy=`$run ./try`
18219                 case "$yyy" in
18220                 ok) echo "Your strtoll() seems to be working okay." ;;
18221                 *) cat <<EOM >&4
18222 Your strtoll() doesn't seem to be working okay.
18223 EOM
18224                    d_strtoll="$undef"
18225                    ;;
18226                 esac
18227         else
18228                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18229                 d_strtoll="$undef"
18230         fi
18231         ;;
18232 esac
18233
18234 : see if strtoq exists
18235 set strtoq d_strtoq
18236 eval $inlibc
18237
18238 : see if strtoul exists
18239 set strtoul d_strtoul
18240 eval $inlibc
18241
18242 case "$d_strtoul" in
18243 "$define")
18244         $cat <<EOM
18245 Checking whether your strtoul() works okay...
18246 EOM
18247         $cat >try.c <<'EOCP'
18248 #include <errno.h>
18249 #include <stdio.h>
18250 extern unsigned long int strtoul(char *s, char **, int);
18251 static int bad = 0;
18252 void check(char *s, unsigned long eul, int een) {
18253         unsigned long gul;
18254         errno = 0;
18255         gul = strtoul(s, 0, 10);
18256         if (!((gul == eul) && (errno == een)))
18257                 bad++;
18258 }
18259 int main() {
18260         check(" 1", 1L, 0);
18261         check(" 0", 0L, 0);
18262 EOCP
18263         case "$longsize" in
18264         8)
18265             $cat >>try.c <<'EOCP'
18266         check("18446744073709551615", 18446744073709551615UL, 0);
18267         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18268 #if 0 /* strtoul() for /^-/ strings is undefined. */
18269         check("-1", 18446744073709551615UL, 0);
18270         check("-18446744073709551614", 2, 0);
18271         check("-18446744073709551615", 1, 0);
18272         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18273         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18274 #endif
18275 EOCP
18276                 ;;
18277         4)
18278                     $cat >>try.c <<'EOCP'
18279         check("4294967295", 4294967295UL, 0);
18280         check("4294967296", 4294967295UL, ERANGE);
18281 #if 0 /* strtoul() for /^-/ strings is undefined. */
18282         check("-1", 4294967295UL, 0);
18283         check("-4294967294", 2, 0);
18284         check("-4294967295", 1, 0);
18285         check("-4294967296", 4294967295UL, ERANGE);
18286         check("-4294967297", 4294967295UL, ERANGE);
18287 #endif
18288 EOCP
18289                 ;;
18290         *)
18291 : Should we write these tests to be more portable by sprintf-ing
18292 : ~0 and then manipulating that char string as input for strtol?
18293                 ;;
18294         esac
18295         $cat >>try.c <<'EOCP'
18296         if (!bad)
18297                 printf("ok\n");
18298         return 0;
18299 }
18300 EOCP
18301         set try
18302         if eval $compile; then
18303                 case "`$run ./try`" in
18304                 ok) echo "Your strtoul() seems to be working okay." ;;
18305                 *) cat <<EOM >&4
18306 Your strtoul() doesn't seem to be working okay.
18307 EOM
18308                    d_strtoul="$undef"
18309                    ;;
18310                 esac
18311         else
18312                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18313                 d_strtoul="$undef"
18314         fi
18315         ;;
18316 esac
18317
18318 : see if strtoull exists
18319 set strtoull d_strtoull
18320 eval $inlibc
18321
18322 case "$d_longlong-$d_strtoull" in
18323 "$define-$define")
18324         $cat <<EOM
18325 Checking whether your strtoull() works okay...
18326 EOM
18327         $cat >try.c <<'EOCP'
18328 #include <errno.h>
18329 #ifdef __hpux
18330 #define strtoull __strtoull
18331 #endif
18332 #include <stdio.h>
18333 extern unsigned long long int strtoull(char *s, char **, int);
18334 static int bad = 0;
18335 int check(char *s, long long eull, int een) {
18336         long long gull;
18337         errno = 0;
18338         gull = strtoull(s, 0, 10);
18339         if (!((gull == eull) && (errno == een)))
18340                 bad++;
18341 }
18342 int main() {
18343         check(" 1",                                        1LL, 0);
18344         check(" 0",                                        0LL, 0);
18345         check("18446744073709551615",  18446744073709551615ULL, 0);
18346         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18347 #if 0 /* strtoull() for /^-/ strings is undefined. */
18348         check("-1",                    18446744073709551615ULL, 0);
18349         check("-18446744073709551614",                     2LL, 0);
18350         check("-18446744073709551615",                     1LL, 0);
18351         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18352         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18353 #endif
18354         if (!bad)
18355                 printf("ok\n");
18356 }
18357 EOCP
18358         set try
18359         if eval $compile; then
18360                 case "`$run ./try`" in
18361                 ok) echo "Your strtoull() seems to be working okay." ;;
18362                 *) cat <<EOM >&4
18363 Your strtoull() doesn't seem to be working okay.
18364 EOM
18365                    d_strtoull="$undef"
18366                    ;;
18367                 esac
18368         else
18369                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18370                 d_strtoull="$undef"
18371         fi
18372         ;;
18373 esac
18374
18375 : see if strtouq exists
18376 set strtouq d_strtouq
18377 eval $inlibc
18378
18379 case "$d_strtouq" in
18380 "$define")
18381         $cat <<EOM
18382 Checking whether your strtouq() works okay...
18383 EOM
18384         $cat >try.c <<'EOCP'
18385 #include <errno.h>
18386 #include <stdio.h>
18387 extern unsigned long long int strtouq(char *s, char **, int);
18388 static int bad = 0;
18389 void check(char *s, unsigned long long eull, int een) {
18390         unsigned long long gull;
18391         errno = 0;
18392         gull = strtouq(s, 0, 10);
18393         if (!((gull == eull) && (errno == een)))
18394                 bad++;
18395 }
18396 int main() {
18397         check(" 1",                                        1LL, 0);
18398         check(" 0",                                        0LL, 0);
18399         check("18446744073709551615",  18446744073709551615ULL, 0);
18400         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18401 #if 0 /* strtouq() for /^-/ strings is undefined. */
18402         check("-1",                    18446744073709551615ULL, 0);
18403         check("-18446744073709551614",                     2LL, 0);
18404         check("-18446744073709551615",                     1LL, 0);
18405         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18406         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18407 #endif
18408         if (!bad)
18409                 printf("ok\n");
18410         return 0;
18411 }
18412 EOCP
18413         set try
18414         if eval $compile; then
18415                 case "`$run ./try`" in
18416                 ok) echo "Your strtouq() seems to be working okay." ;;
18417                 *) cat <<EOM >&4
18418 Your strtouq() doesn't seem to be working okay.
18419 EOM
18420                    d_strtouq="$undef"
18421                    ;;
18422                 esac
18423         else
18424                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18425                 d_strtouq="$undef"
18426         fi
18427         ;;
18428 esac
18429
18430 : see if strxfrm exists
18431 set strxfrm d_strxfrm
18432 eval $inlibc
18433
18434 : see if symlink exists
18435 set symlink d_symlink
18436 eval $inlibc
18437
18438 : see if syscall exists
18439 set syscall d_syscall
18440 eval $inlibc
18441
18442 : see if prototype for syscall is available
18443 echo " "
18444 set d_syscallproto syscall $i_unistd unistd.h
18445 eval $hasproto
18446
18447 : see if sysconf exists
18448 set sysconf d_sysconf
18449 eval $inlibc
18450
18451 : see if system exists
18452 set system d_system
18453 eval $inlibc
18454
18455 : see if tcgetpgrp exists
18456 set tcgetpgrp d_tcgetpgrp
18457 eval $inlibc
18458
18459 : see if tcsetpgrp exists
18460 set tcsetpgrp d_tcsetpgrp
18461 eval $inlibc
18462
18463 : see if prototype for telldir is available
18464 echo " "
18465 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18466 eval $hasproto
18467
18468 : see if time exists
18469 echo " "
18470 if test "X$d_time" = X -o X"$timetype" = X; then
18471     if set time val -f d_time; eval $csym; $val; then
18472                 echo 'time() found.' >&4
18473                 val="$define"
18474                 rp="What is the type returned by time() on this system?"
18475                 set time_t timetype long stdio.h sys/types.h
18476                 eval $typedef_ask
18477     else
18478                 echo 'time() not found, hope that will do.' >&4
18479                 val="$undef"
18480                 timetype='int';
18481     fi
18482     set d_time
18483     eval $setvar
18484 fi
18485
18486 : see if timegm exists
18487 set timegm d_timegm
18488 eval $inlibc
18489
18490 : see if this is a sys/times.h system
18491 set sys/times.h i_systimes
18492 eval $inhdr
18493
18494 : see if times exists
18495 echo " "
18496 if set times val -f d_times; eval $csym; $val; then
18497         echo 'times() found.' >&4
18498         d_times="$define"
18499         inc=''
18500         case "$i_systimes" in
18501         "$define") inc='sys/times.h';;
18502         esac
18503         rp="What is the type returned by times() on this system?"
18504         set clock_t clocktype long stdio.h sys/types.h $inc
18505         eval $typedef_ask
18506 else
18507         echo 'times() NOT found, hope that will do.' >&4
18508         d_times="$undef"
18509         clocktype='int'
18510 fi
18511
18512 : see if tmpnam_r exists
18513 set tmpnam_r d_tmpnam_r
18514 eval $inlibc
18515 case "$d_tmpnam_r" in
18516 "$define")
18517         hdrs="$i_systypes sys/types.h define stdio.h "
18518         case "$d_tmpnam_r_proto:$usethreads" in
18519         ":define")      d_tmpnam_r_proto=define
18520                 set d_tmpnam_r_proto tmpnam_r $hdrs
18521                 eval $hasproto ;;
18522         *)      ;;
18523         esac
18524         case "$d_tmpnam_r_proto" in
18525         define)
18526         case "$tmpnam_r_proto" in
18527         ''|0) try='char* tmpnam_r(char*);'
18528         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18529         esac
18530         case "$tmpnam_r_proto" in
18531         ''|0)   d_tmpnam_r=undef
18532                 tmpnam_r_proto=0
18533                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18534         * )     case "$tmpnam_r_proto" in
18535                 REENTRANT_PROTO*) ;;
18536                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18537                 esac
18538                 echo "Prototype: $try" ;;
18539         esac
18540         ;;
18541         *)      case "$usethreads" in
18542                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18543                 esac
18544                 d_tmpnam_r=undef
18545                 tmpnam_r_proto=0
18546                 ;;
18547         esac
18548         ;;
18549 *)      tmpnam_r_proto=0
18550         ;;
18551 esac
18552
18553 : see if truncate exists
18554 set truncate d_truncate
18555 eval $inlibc
18556
18557 : see if ttyname_r exists
18558 set ttyname_r d_ttyname_r
18559 eval $inlibc
18560 case "$d_ttyname_r" in
18561 "$define")
18562         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18563         case "$d_ttyname_r_proto:$usethreads" in
18564         ":define")      d_ttyname_r_proto=define
18565                 set d_ttyname_r_proto ttyname_r $hdrs
18566                 eval $hasproto ;;
18567         *)      ;;
18568         esac
18569         case "$d_ttyname_r_proto" in
18570         define)
18571         case "$ttyname_r_proto" in
18572         ''|0) try='int ttyname_r(int, char*, size_t);'
18573         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18574         esac
18575         case "$ttyname_r_proto" in
18576         ''|0) try='int ttyname_r(int, char*, int);'
18577         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18578         esac
18579         case "$ttyname_r_proto" in
18580         ''|0) try='char* ttyname_r(int, char*, int);'
18581         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18582         esac
18583         case "$ttyname_r_proto" in
18584         ''|0)   d_ttyname_r=undef
18585                 ttyname_r_proto=0
18586                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18587         * )     case "$ttyname_r_proto" in
18588                 REENTRANT_PROTO*) ;;
18589                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18590                 esac
18591                 echo "Prototype: $try" ;;
18592         esac
18593         ;;
18594         *)      case "$usethreads" in
18595                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18596                 esac
18597                 d_ttyname_r=undef
18598                 ttyname_r_proto=0
18599                 ;;
18600         esac
18601         ;;
18602 *)      ttyname_r_proto=0
18603         ;;
18604 esac
18605
18606 : see if tzname[] exists
18607 echo " "
18608 if set tzname val -a d_tzname; eval $csym; $val; then
18609         val="$define"
18610         echo 'tzname[] found.' >&4
18611 else
18612         val="$undef"
18613         echo 'tzname[] NOT found.' >&4
18614 fi
18615 set d_tzname
18616 eval $setvar
18617
18618 : Check if is a multiplatform env
18619 case "$osname" in
18620 next|rhapsody|darwin) multiarch="$define" ;;
18621 esac
18622 case "$multiarch" in
18623 ''|[nN]*) multiarch="$undef" ;;
18624 esac
18625
18626 : check for ordering of bytes in a UV
18627 echo " "
18628 case "$usecrosscompile$multiarch" in
18629 *$define*)
18630         $cat <<EOM
18631 You seem to be either cross-compiling or doing a multiarchitecture build,
18632 skipping the byteorder check.
18633
18634 EOM
18635         byteorder='ffff'
18636         ;;
18637 *)
18638         case "$byteorder" in
18639         '')
18640                 $cat <<'EOM'
18641 In the following, larger digits indicate more significance.  A big-endian
18642 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18643 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18644 machines may have weird orders like 3412.  A Cray will report 87654321,
18645 an Alpha will report 12345678. If the test program works the default is
18646 probably right.
18647 I'm now running the test program...
18648 EOM
18649                 $cat >try.c <<EOCP
18650 #include <stdio.h>
18651 #$i_stdlib I_STDLIB
18652 #ifdef I_STDLIB
18653 #include <stdlib.h>
18654 #endif
18655 #include <sys/types.h>
18656 typedef $uvtype UV;
18657 int main()
18658 {
18659         int i;
18660         union {
18661                 UV l;
18662                 char c[$uvsize];
18663         } u;
18664
18665         if ($uvsize > 4)
18666                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18667         else
18668                 u.l = (UV)0x04030201;
18669         for (i = 0; i < $uvsize; i++)
18670                 printf("%c", u.c[i]+'0');
18671         printf("\n");
18672         exit(0);
18673 }
18674 EOCP
18675                 xxx_prompt=y
18676                 set try
18677                 if eval $compile && $run ./try > /dev/null; then
18678                         dflt=`$run ./try`
18679                         case "$dflt" in
18680                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18681                                 echo "(The test program ran ok.)"
18682                                 echo "byteorder=$dflt"
18683                                 xxx_prompt=n
18684                         ;;
18685                         ????|????????) echo "(The test program ran ok.)" ;;
18686                         *) echo "(The test program didn't run right for some reason.)" ;;
18687                         esac
18688                 else
18689                         dflt='4321'
18690                         cat <<'EOM'
18691 (I can't seem to compile the test program.  Guessing big-endian...)
18692 EOM
18693                 fi
18694                 case "$xxx_prompt" in
18695                 y)
18696                         rp="What is the order of bytes in $uvtype?"
18697                         . ./myread
18698                         byteorder="$ans"
18699                         ;;
18700                 *)      byteorder=$dflt
18701                         ;;
18702                 esac
18703                 ;;
18704         esac
18705         $rm_try
18706         ;;
18707 esac
18708
18709 : Checking 32bit aligndness
18710 $cat <<EOM
18711
18712 Checking to see whether you can access character data unalignedly...
18713 EOM
18714 case "$d_u32align" in
18715 '')   $cat >try.c <<EOCP
18716 #include <stdio.h>
18717 #$i_stdlib I_STDLIB
18718 #ifdef I_STDLIB
18719 #include <stdlib.h>
18720 #endif
18721 #define U32 $u32type
18722 #define BYTEORDER 0x$byteorder
18723 #define U8 $u8type
18724 #include <signal.h>
18725 #ifdef SIGBUS
18726 $signal_t bletch(int s) { exit(4); }
18727 #endif
18728 int main() {
18729 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18730     volatile U8 buf[8];
18731     volatile U32 *up;
18732     int i;
18733
18734     if (sizeof(U32) != 4) {
18735         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18736         exit(1);
18737     }
18738
18739     fflush(stdout);
18740
18741 #ifdef SIGBUS
18742     signal(SIGBUS, bletch);
18743 #endif
18744
18745     buf[0] = 0;
18746     buf[1] = 0;
18747     buf[2] = 0;
18748     buf[3] = 1;
18749     buf[4] = 0;
18750     buf[5] = 0;
18751     buf[6] = 0;
18752     buf[7] = 1;
18753
18754     for (i = 0; i < 4; i++) {
18755         up = (U32*)(buf + i);
18756         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18757                (*up == 1 << (8*(3-i)))  /* little-endian */
18758               )
18759            )
18760         {
18761             printf("read failed (%x)\n", *up);
18762             exit(2);
18763         }
18764     }
18765
18766     /* write test */
18767     for (i = 0; i < 4; i++) {
18768         up = (U32*)(buf + i);
18769         *up = 0xBeef;
18770         if (*up != 0xBeef) {
18771             printf("write failed (%x)\n", *up);
18772             exit(3);
18773         }
18774     }
18775
18776     exit(0);
18777 #else
18778     printf("1\n");
18779     exit(1);
18780 #endif
18781     return 0;
18782 }
18783 EOCP
18784 set try
18785 if eval $compile_ok; then
18786         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18787         $run ./try 2>&1 >/dev/null
18788         case "$?" in
18789         0)      cat >&4 <<EOM
18790 You can access character data pretty unalignedly.
18791 EOM
18792                 d_u32align="$undef"
18793                 ;;
18794         *)      cat >&4 <<EOM
18795 It seems that you must access character data in an aligned manner.
18796 EOM
18797                 d_u32align="$define"
18798                 ;;
18799         esac
18800 else
18801         rp='Can you access character data at unaligned addresses?'
18802         dflt='n'
18803         . ./myread
18804         case "$ans" in
18805         [yY]*)  d_u32align="$undef"  ;;
18806         *)      d_u32align="$define" ;;
18807         esac
18808 fi
18809 $rm_try
18810 ;;
18811 esac
18812
18813 : see if ualarm exists
18814 set ualarm d_ualarm
18815 eval $inlibc
18816
18817 : see if umask exists
18818 set umask d_umask
18819 eval $inlibc
18820
18821 : see if unordered exists
18822 set unordered d_unordered
18823 eval $inlibc
18824
18825 : see if unsetenv exists
18826 set unsetenv d_unsetenv
18827 eval $inlibc
18828
18829 : see if usleep exists
18830 set usleep d_usleep
18831 eval $inlibc
18832
18833 : see if prototype for usleep is available
18834 echo " "
18835 set d_usleepproto usleep $i_unistd unistd.h
18836 eval $hasproto
18837
18838 : see if ustat exists
18839 set ustat d_ustat
18840 eval $inlibc
18841
18842 : see if closedir exists
18843 set closedir d_closedir
18844 eval $inlibc
18845
18846 case "$d_closedir" in
18847 "$define")
18848         echo " "
18849         echo "Checking whether closedir() returns a status..." >&4
18850         cat > try.c <<EOM
18851 #$i_dirent I_DIRENT             /**/
18852 #$i_sysdir I_SYS_DIR            /**/
18853 #$i_sysndir I_SYS_NDIR          /**/
18854 #$i_systypes I_SYS_TYPES        /**/
18855
18856 #if defined(I_SYS_TYPES)
18857 #include <sys/types.h>
18858 #endif
18859 #if defined(I_DIRENT)
18860 #include <dirent.h>
18861 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18862 #include <sys/dir.h>
18863 #endif
18864 #else
18865 #ifdef I_SYS_NDIR
18866 #include <sys/ndir.h>
18867 #else
18868 #ifdef I_SYS_DIR
18869 #ifdef hp9000s500
18870 #include <ndir.h>       /* may be wrong in the future */
18871 #else
18872 #include <sys/dir.h>
18873 #endif
18874 #endif
18875 #endif
18876 #endif
18877 int main() { return closedir(opendir(".")); }
18878 EOM
18879         set try
18880         if eval $compile_ok; then
18881                 if $run ./try > /dev/null 2>&1 ; then
18882                         echo "Yes, it does."
18883                         val="$undef"
18884                 else
18885                         echo "No, it doesn't."
18886                         val="$define"
18887                 fi
18888         else
18889                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18890                 val="$define"
18891         fi
18892         ;;
18893 *)
18894         val="$undef";
18895         ;;
18896 esac
18897 set d_void_closedir
18898 eval $setvar
18899 $rm_try
18900
18901 : see if there is a wait4
18902 set wait4 d_wait4
18903 eval $inlibc
18904
18905 : see if waitpid exists
18906 set waitpid d_waitpid
18907 eval $inlibc
18908
18909 : see if wcstombs exists
18910 set wcstombs d_wcstombs
18911 eval $inlibc
18912
18913 : see if wctomb exists
18914 set wctomb d_wctomb
18915 eval $inlibc
18916
18917 : see if writev exists
18918 set writev d_writev
18919 eval $inlibc
18920
18921 : preserve RCS keywords in files with variable substitution, grrr
18922 Date='$Date'
18923 Id='$Id'
18924 Log='$Log'
18925 RCSfile='$RCSfile'
18926 Revision='$Revision'
18927
18928 : check for alignment requirements
18929 echo " "
18930 case "$usecrosscompile$multiarch" in
18931 *$define*)
18932         $cat <<EOM
18933 You seem to be either cross-compiling or doing a multiarchitecture build,
18934 skipping the memory alignment check.
18935
18936 EOM
18937         case "$alignbytes" in
18938         '') alignbytes=8 ;;
18939         esac
18940         ;;
18941 *)
18942         case "$alignbytes" in
18943         '') echo "Checking alignment constraints..." >&4
18944                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18945                         $cat >try.c <<'EOCP'
18946 typedef long double NV;
18947 EOCP
18948                 else
18949                         $cat >try.c <<'EOCP'
18950 typedef double NV;
18951 EOCP
18952                 fi
18953                 $cat >>try.c <<'EOCP'
18954 #include <stdio.h>
18955 struct foobar {
18956         char foo;
18957         NV bar;
18958 } try_algn;
18959 int main()
18960 {
18961     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18962     return(0);
18963 }
18964 EOCP
18965                 set try
18966                 if eval $compile_ok; then
18967                         dflt=`$run ./try`
18968                 else
18969                         dflt='8'
18970                         echo "(I can't seem to compile the test program...)"
18971                 fi
18972                 ;;
18973         *) dflt="$alignbytes"
18974                 ;;
18975         esac
18976         rp="Doubles must be aligned on a how-many-byte boundary?"
18977         . ./myread
18978         alignbytes="$ans"
18979         $rm_try
18980         ;;
18981 esac
18982
18983
18984 : set the base revision
18985 baserev=5.0
18986
18987 : length of character in bytes. Is always 1, otherwise it isnt C
18988 : This used to be a test using sizeof
18989 charsize=1
18990
18991 : Check for the number of bits in a character
18992 case "$charbits" in
18993 '')     echo "Checking how long a character is (in bits)..." >&4
18994         $cat >try.c <<EOCP
18995 #include <stdio.h>
18996 int main ()
18997 {
18998     int n;
18999     unsigned char c;
19000     for (c = 1, n = 0; c; c <<= 1, n++) ;
19001     printf ("%d\n", n);
19002     return (0);
19003     }
19004 EOCP
19005         set try
19006         if eval $compile_ok; then
19007                 dflt=`$run ./try`
19008         else
19009                 dflt='8'
19010                 echo "(I can't seem to compile the test program.  Guessing...)"
19011         fi
19012         ;;
19013 *)
19014         dflt="$charbits"
19015         ;;
19016 esac
19017 rp="What is the length of a character (in bits)?"
19018 . ./myread
19019 charbits="$ans"
19020 $rm_try
19021 case "$charbits" in
19022 8)      ;;
19023 *)      cat >&4 << EOM
19024 Your system has an unsigned character size of $charbits bits, which
19025 is rather unusual (normally it is 8 bits).  Perl likely will not work
19026 correctly on your system, with subtle bugs in various places.
19027 EOM
19028         rp='Do you really want to continue?'
19029         dflt='n'
19030         . ./myread
19031         case "$ans" in
19032                 [yY])   echo >&4 "Okay, continuing."    ;;
19033                 *)      exit 1                          ;;
19034         esac
19035 esac
19036
19037 : how do we concatenate cpp tokens here?
19038 echo " "
19039 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19040 $cat >cpp_stuff.c <<'EOCP'
19041 #define RCAT(a,b)a/**/b
19042 #define ACAT(a,b)a ## b
19043 RCAT(Rei,ser)
19044 ACAT(Cir,cus)
19045 EOCP
19046 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19047 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19048         echo "Oh!  Smells like ANSI's been here." >&4
19049         echo "We can catify or stringify, separately or together!"
19050         cpp_stuff=42
19051 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19052         echo "Ah, yes!  The good old days!" >&4
19053         echo "However, in the good old days we don't know how to stringify and"
19054         echo "catify at the same time."
19055         cpp_stuff=1
19056 else
19057         $cat >&4 <<EOM
19058 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19059 You're going to have to edit the values of CAT[2-5] in config.h...
19060 EOM
19061         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19062 fi
19063 $rm -f cpp_stuff.*
19064
19065 : see if this is a db.h system
19066 set db.h i_db
19067 eval $inhdr
19068
19069 case "$i_db" in
19070 $define)
19071         : Check db version.
19072         echo " "
19073         echo "Checking Berkeley DB version ..." >&4
19074         $cat >try.c <<EOCP
19075 #$d_const HASCONST
19076 #ifndef HASCONST
19077 #define const
19078 #endif
19079 #include <sys/types.h>
19080 #include <stdio.h>
19081 #$i_stdlib I_STDLIB
19082 #ifdef I_STDLIB
19083 #include <stdlib.h>
19084 #endif
19085 #include <db.h>
19086 int main(int argc, char *argv[])
19087 {
19088 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19089     int Major, Minor, Patch ;
19090     unsigned long Version ;
19091     (void)db_version(&Major, &Minor, &Patch) ;
19092     if (argc == 2) {
19093         printf("%d %d %d %d %d %d\n",
19094                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19095                Major, Minor, Patch);
19096         exit(0);
19097     }
19098     printf("You have Berkeley DB Version 2 or greater.\n");
19099
19100     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19101                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19102     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19103                 Major, Minor, Patch) ;
19104
19105     /* check that db.h & libdb are compatible */
19106     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19107         printf("db.h and libdb are incompatible.\n") ;
19108         exit(3);
19109     }
19110
19111     printf("db.h and libdb are compatible.\n") ;
19112
19113     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19114                 + DB_VERSION_PATCH ;
19115
19116     /* needs to be >= 2.3.4 */
19117     if (Version < 2003004) {
19118     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19119         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19120         exit(2);
19121     }
19122
19123     exit(0);
19124 #else
19125 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19126     if (argc == 2) {
19127         printf("1 0 0\n");
19128         exit(0);
19129     }
19130     printf("You have Berkeley DB Version 1.\n");
19131     exit(0);    /* DB version < 2: the coast is clear. */
19132 #else
19133     exit(1);    /* <db.h> not Berkeley DB? */
19134 #endif
19135 #endif
19136 }
19137 EOCP
19138         set try
19139         if eval $compile_ok && $run ./try; then
19140                 echo 'Looks OK.' >&4
19141                 set `$run ./try 1`
19142                 db_version_major=$1
19143                 db_version_minor=$2
19144                 db_version_patch=$3
19145         else
19146                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19147                 i_db=$undef
19148                 case " $libs " in
19149                 *"-ldb "*)
19150                         : Remove db from list of libraries to use
19151                         echo "Removing unusable -ldb from library list" >&4
19152                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19153                         shift
19154                         libs="$*"
19155                         echo "libs = $libs" >&4
19156                         ;;
19157                 esac
19158         fi
19159         $rm_try
19160         ;;
19161 esac
19162
19163 case "$i_db" in
19164 define)
19165         : Check the return type needed for hash
19166         echo " "
19167         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19168         $cat >try.c <<EOCP
19169 #$d_const HASCONST
19170 #ifndef HASCONST
19171 #define const
19172 #endif
19173 #include <sys/types.h>
19174 #include <db.h>
19175
19176 #ifndef DB_VERSION_MAJOR
19177 u_int32_t hash_cb (ptr, size)
19178 const void *ptr;
19179 size_t size;
19180 {
19181 }
19182 HASHINFO info;
19183 int main()
19184 {
19185         info.hash = hash_cb;
19186 }
19187 #endif
19188 EOCP
19189         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19190                 if $contains warning try.out >>/dev/null 2>&1 ; then
19191                         db_hashtype='int'
19192                 else
19193                         db_hashtype='u_int32_t'
19194                 fi
19195         else
19196                 : XXX Maybe we should just give up here.
19197                 db_hashtype=u_int32_t
19198                 $cat try.out >&4
19199                 echo "Help:  I can't seem to compile the db test program." >&4
19200                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19201         fi
19202         $rm_try
19203         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19204         ;;
19205 *)      db_hashtype=u_int32_t
19206         ;;
19207 esac
19208 case "$i_db" in
19209 define)
19210         : Check the return type needed for prefix
19211         echo " "
19212         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19213         cat >try.c <<EOCP
19214 #$d_const HASCONST
19215 #ifndef HASCONST
19216 #define const
19217 #endif
19218 #include <sys/types.h>
19219 #include <db.h>
19220
19221 #ifndef DB_VERSION_MAJOR
19222 size_t prefix_cb (key1, key2)
19223 const DBT *key1;
19224 const DBT *key2;
19225 {
19226 }
19227 BTREEINFO info;
19228 int main()
19229 {
19230         info.prefix = prefix_cb;
19231 }
19232 #endif
19233 EOCP
19234         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19235                 if $contains warning try.out >>/dev/null 2>&1 ; then
19236                         db_prefixtype='int'
19237                 else
19238                         db_prefixtype='size_t'
19239                 fi
19240         else
19241                 db_prefixtype='size_t'
19242                 : XXX Maybe we should just give up here.
19243                 $cat try.out >&4
19244                 echo "Help:  I can't seem to compile the db test program." >&4
19245                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19246         fi
19247         $rm_try
19248         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19249         ;;
19250 *)      db_prefixtype='size_t'
19251         ;;
19252 esac
19253
19254 : How can we generate normalized random numbers ?
19255 echo " "
19256 echo "Looking for a random number function..." >&4
19257 case "$randfunc" in
19258 '')
19259         if set drand48 val -f; eval $csym; $val; then
19260                 dflt="drand48"
19261                 echo "Good, found drand48()." >&4
19262         elif set random val -f; eval $csym; $val; then
19263                 dflt="random"
19264                 echo "OK, found random()." >&4
19265         else
19266                 dflt="rand"
19267                 echo "Yick, looks like I have to use rand()." >&4
19268         fi
19269         echo " "
19270         ;;
19271 *)
19272         dflt="$randfunc"
19273         ;;
19274 esac
19275 cont=true
19276
19277 case "$ccflags" in
19278 *-Dmy_rand=*|*-Dmy_srand=*)
19279         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19280         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19281         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19282         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19283         ;;
19284 esac
19285
19286 while $test "$cont"; do
19287         rp="Use which function to generate random numbers?"
19288         . ./myread
19289         if $test "$ans" = "$dflt"; then
19290                 : null
19291         else
19292                 randbits=''
19293         fi
19294         randfunc="$ans"
19295         if set $ans val -f; eval $csym; $val; then
19296                 cont=''
19297         else
19298                 dflt=y
19299                 rp="I cannot find function $ans. Use that name anyway?"
19300                 . ./myread
19301                 dflt=rand
19302                 case "$ans" in
19303                         [yY]*) cont='';;
19304                 esac
19305         fi
19306         case "$cont" in
19307         '')
19308                 case "$randfunc" in
19309                 drand48)
19310                         drand01="drand48()"
19311                         seedfunc="srand48"
19312                         randbits=48
19313                         randseedtype=long
19314                         ;;
19315                 rand|random)
19316                         case "$randbits" in
19317                         '')
19318 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19319                                 $cat >try.c <<EOCP
19320 #$i_unistd I_UNISTD
19321 #$i_stdlib I_STDLIB
19322 #include <stdio.h>
19323 #ifdef I_UNISTD
19324 #  include <unistd.h>
19325 #endif
19326 #ifdef I_STDLIB
19327 #  include <stdlib.h>
19328 #endif
19329 int main()
19330 {
19331         register int i;
19332         register unsigned long tmp;
19333         register unsigned long max = 0L;
19334
19335         for (i = 1000; i; i--) {
19336                 tmp = (unsigned long) $randfunc();
19337                 if (tmp > max) max = tmp;
19338         }
19339         for (i = 0; max; i++)
19340                 max /= 2;
19341         printf("%d\n",i);
19342 }
19343 EOCP
19344                                 set try
19345                                 if eval $compile_ok; then
19346                                         dflt=`try`
19347                                 else
19348                                         dflt='?'
19349                                         echo "(I can't seem to compile the test program...)"
19350                                 fi
19351                                 ;;
19352                         *)
19353                                 dflt="$randbits"
19354                                 ;;
19355                         esac
19356                         rp="How many bits does your $randfunc() function produce?"
19357                         . ./myread
19358                         randbits="$ans"
19359                         $rm_try
19360                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19361                         seedfunc="s$randfunc"
19362                         randseedtype=unsigned
19363                         ;;
19364                 *)
19365                         dflt="31"
19366                         rp="How many bits does your $randfunc() function produce?"
19367                         . ./myread
19368                         randbits="$ans"
19369                         seedfunc="s$randfunc"
19370                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19371                         if set $seedfunc val -f; eval $csym; $val; then
19372                                 echo "(Using $seedfunc() to seed random generator)"
19373                         else
19374                                 echo "(Warning: no $seedfunc() to seed random generator)"
19375                                 seedfunc=rand
19376                         fi
19377                         randseedtype=unsigned
19378                         ;;
19379                 esac
19380                 ;;
19381         esac
19382 done
19383
19384 : Determine if this is an EBCDIC system
19385 echo " "
19386 echo "Determining whether or not we are on an EBCDIC system..." >&4
19387 $cat >try.c <<'EOM'
19388 int main()
19389 {
19390   if ('M'==0xd4) return 0;
19391   return 1;
19392 }
19393 EOM
19394
19395 val=$undef
19396 set try
19397 if eval $compile_ok; then
19398         if $run ./try; then
19399                 echo "You seem to speak EBCDIC." >&4
19400                 val="$define"
19401         else
19402                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19403         fi
19404 else
19405         echo "I'm unable to compile the test program." >&4
19406         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19407 fi
19408 $rm_try
19409 set ebcdic
19410 eval $setvar
19411
19412 : Check how to flush
19413 echo " "
19414 $cat >&4 <<EOM
19415 Checking how to flush all pending stdio output...
19416 EOM
19417 # I only know how to find the first 32 possibly open files on SunOS.
19418 # See also hints/sunos_4_1.sh and util.c  --AD
19419 case "$osname" in
19420 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19421 esac
19422 $cat >>try.c <<EOCP
19423 #include <stdio.h>
19424 #$i_stdlib I_STDLIB
19425 #ifdef I_STDLIB
19426 #include <stdlib.h>
19427 #endif
19428 #$i_unistd I_UNISTD
19429 #ifdef I_UNISTD
19430 # include <unistd.h>
19431 #endif
19432 #$d_sysconf HAS_SYSCONF
19433 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19434 #ifdef HAS_STDIO_STREAM_ARRAY
19435 # define STDIO_STREAM_ARRAY $stdio_stream_array
19436 #endif
19437 int main() {
19438   FILE* p;
19439   unlink("try.out");
19440   p = fopen("try.out", "w");
19441 #ifdef TRY_FPUTC
19442   fputc('x', p);
19443 #else
19444 # ifdef TRY_FPRINTF
19445   fprintf(p, "x");
19446 # endif
19447 #endif
19448 #ifdef TRY_FFLUSH_NULL
19449   fflush(NULL);
19450 #endif
19451 #ifdef TRY_FFLUSH_ALL
19452   {
19453     long open_max = -1;
19454 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19455     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19456 # else
19457 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19458     open_max = sysconf(_SC_OPEN_MAX);
19459 #  else
19460 #   ifdef FOPEN_MAX
19461     open_max = FOPEN_MAX;
19462 #   else
19463 #    ifdef OPEN_MAX
19464     open_max = OPEN_MAX;
19465 #    else
19466 #     ifdef _NFILE
19467     open_max = _NFILE;
19468 #     endif
19469 #    endif
19470 #   endif
19471 #  endif
19472 # endif
19473 # ifdef HAS_STDIO_STREAM_ARRAY
19474     if (open_max > 0) {
19475       long i;
19476       for (i = 0; i < open_max; i++)
19477             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19478                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19479                 STDIO_STREAM_ARRAY[i]._flag)
19480                 fflush(&STDIO_STREAM_ARRAY[i]);
19481     }
19482   }
19483 # endif
19484 #endif
19485   _exit(42);
19486 }
19487 EOCP
19488 : first we have to find out how _not_ to flush
19489 $to try.c
19490 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19491     output=''
19492     set try -DTRY_FPUTC
19493     if eval $compile; then
19494             $run ./try 2>/dev/null
19495             code="$?"
19496             $from try.out
19497             if $test ! -s try.out -a "X$code" = X42; then
19498                 output=-DTRY_FPUTC
19499             fi
19500     fi
19501     case "$output" in
19502     '')
19503             set try -DTRY_FPRINTF
19504             if eval $compile; then
19505                     $run ./try 2>/dev/null
19506                     code="$?"
19507                     $from try.out
19508                     if $test ! -s try.out -a "X$code" = X42; then
19509                         output=-DTRY_FPRINTF
19510                     fi
19511             fi
19512         ;;
19513     esac
19514 fi
19515 : check for fflush NULL behaviour
19516 case "$fflushNULL" in
19517 '')     set try -DTRY_FFLUSH_NULL $output
19518         if eval $compile; then
19519                 $run ./try 2>/dev/null
19520                 code="$?"
19521                 $from try.out
19522                 if $test -s try.out -a "X$code" = X42; then
19523                         fflushNULL="`$cat try.out`"
19524                 else
19525                         if $test "X$code" != X42; then
19526                                 $cat >&4 <<EOM
19527 (If this test failed, don't worry, we'll try another method shortly.)
19528 EOM
19529                         fi
19530                 fi
19531         fi
19532         $rm -f core try.core core.try.*
19533         case "$fflushNULL" in
19534         x)      $cat >&4 <<EOM
19535 Your fflush(NULL) works okay for output streams.
19536 Let's see if it clobbers input pipes...
19537 EOM
19538 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19539 # bug that improperly flushes the input end of pipes.  So we avoid the
19540 # autoflush on fork/system/exec support for now. :-(
19541 $cat >tryp.c <<EOCP
19542 #include <stdio.h>
19543 int
19544 main(int argc, char **argv)
19545 {
19546     char buf[1024];
19547     int i;
19548     char *bp = buf;
19549     while (1) {
19550         while ((i = getc(stdin)) != -1
19551                && (*bp++ = i) != '\n'
19552                && bp < &buf[1024])
19553         /* DO NOTHING */ ;
19554         *bp = '\0';
19555         fprintf(stdout, "%s", buf);
19556         fflush(NULL);
19557         if (i == -1)
19558             return 0;
19559         bp = buf;
19560     }
19561 }
19562 EOCP
19563                 fflushNULL="$define"
19564                 set tryp
19565                 if eval $compile; then
19566                     $rm -f tryp.out
19567                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19568                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19569                        $cat >&4 <<EOM
19570 fflush(NULL) seems to behave okay with input streams.
19571 EOM
19572                         fflushNULL="$define"
19573                     else
19574                         $cat >&4 <<EOM
19575 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19576 EOM
19577                         fflushNULL="$undef"
19578                     fi
19579                 fi
19580                 $rm -f core tryp.c tryp.core core.tryp.*
19581                 ;;
19582         '')     $cat >&4 <<EOM
19583 Your fflush(NULL) isn't working (contrary to ANSI C).
19584 EOM
19585                 fflushNULL="$undef"
19586                 ;;
19587         *)      $cat >&4 <<EOM
19588 Cannot figure out whether your fflush(NULL) works or not.
19589 I'm assuming it doesn't (contrary to ANSI C).
19590 EOM
19591                 fflushNULL="$undef"
19592                 ;;
19593         esac
19594         ;;
19595 $define|true|[yY]*)
19596         fflushNULL="$define"
19597         ;;
19598 *)
19599         fflushNULL="$undef"
19600         ;;
19601 esac
19602 : check explicit looping only if NULL did not work, and if the pipe
19603 : bug does not show up on an explicit flush too
19604 case "$fflushNULL" in
19605 "$undef")
19606         $cat >tryp.c <<EOCP
19607 #include <stdio.h>
19608 int
19609 main(int argc, char **argv)
19610 {
19611     char buf[1024];
19612     int i;
19613     char *bp = buf;
19614     while (1) {
19615         while ((i = getc(stdin)) != -1
19616                && (*bp++ = i) != '\n'
19617                && bp < &buf[1024])
19618         /* DO NOTHING */ ;
19619         *bp = '\0';
19620         fprintf(stdout, "%s", buf);
19621         fflush(stdin);
19622         if (i == -1)
19623             return 0;
19624         bp = buf;
19625     }
19626 }
19627 EOCP
19628         set tryp
19629         if eval $compile; then
19630             $rm -f tryp.out
19631             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19632             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19633                $cat >&4 <<EOM
19634 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19635 EOM
19636                 : now check for fflushall behaviour
19637                 case "$fflushall" in
19638                 '')     set try -DTRY_FFLUSH_ALL $output
19639                         if eval $compile; then
19640                                 $cat >&4 <<EOM
19641 (Now testing the other method--but note that this also may fail.)
19642 EOM
19643                                 $run ./try 2>/dev/null
19644                                 code=$?
19645                                 $from try.out
19646                                 if $test -s try.out -a "X$code" = X42; then
19647                                         fflushall="`$cat try.out`"
19648                                 fi
19649                         fi
19650                         $rm_try
19651                         case "$fflushall" in
19652                         x)      $cat >&4 <<EOM
19653 Whew. Flushing explicitly all the stdio streams works.
19654 EOM
19655                                 fflushall="$define"
19656                                 ;;
19657                         '')     $cat >&4 <<EOM
19658 Sigh. Flushing explicitly all the stdio streams doesn't work.
19659 EOM
19660                                 fflushall="$undef"
19661                                 ;;
19662                         *)      $cat >&4 <<EOM
19663 Cannot figure out whether flushing stdio streams explicitly works or not.
19664 I'm assuming it doesn't.
19665 EOM
19666                                 fflushall="$undef"
19667                                 ;;
19668                         esac
19669                         ;;
19670                 "$define"|true|[yY]*)
19671                         fflushall="$define"
19672                         ;;
19673                 *)
19674                         fflushall="$undef"
19675                         ;;
19676                 esac
19677             else
19678                 $cat >&4 <<EOM
19679 All is futile.  Even fflush(stdin) clobbers input pipes!
19680 EOM
19681                 fflushall="$undef"
19682             fi
19683         else
19684             fflushall="$undef"
19685         fi
19686         $rm -f core tryp.c tryp.core core.tryp.*
19687         ;;
19688 *)      fflushall="$undef"
19689         ;;
19690 esac
19691
19692 case "$fflushNULL$fflushall" in
19693 undefundef)
19694         $cat <<EOM
19695 OK, I give up.  I cannot figure out how to flush pending stdio output.
19696 We won't be flushing handles at all before fork/exec/popen.
19697 EOM
19698         ;;
19699 esac
19700 $rm_try tryp
19701
19702 : Store the full pathname to the ar program for use in the C program
19703 : Respect a hint or command line value for full_ar.
19704 case "$full_ar" in
19705 '') full_ar=$ar ;;
19706 esac
19707
19708 : Store the full pathname to the sed program for use in the C program
19709 full_sed=$sed
19710
19711 : see what type gids are declared as in the kernel
19712 echo " "
19713 echo "Looking for the type for group ids returned by getgid()."
19714 set gid_t gidtype xxx stdio.h sys/types.h
19715 eval $typedef
19716 case "$gidtype" in
19717 xxx)
19718         xxx=`./findhdr sys/user.h`
19719         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19720         case $1 in
19721         unsigned) dflt="$1 $2" ;;
19722         *) dflt="$1" ;;
19723         esac
19724         ;;
19725 *) dflt="$gidtype";;
19726 esac
19727 case "$gidtype" in
19728 gid_t) echo "gid_t found." ;;
19729 *)      rp="What is the type for group ids returned by getgid()?"
19730         . ./myread
19731         gidtype="$ans"
19732         ;;
19733 esac
19734
19735 : Check the size of GID
19736 echo " "
19737 case "$gidtype" in
19738 *_t) zzz="$gidtype"     ;;
19739 *)   zzz="gid"          ;;
19740 esac
19741 echo "Checking the size of $zzz..." >&4
19742 cat > try.c <<EOCP
19743 #include <sys/types.h>
19744 #include <stdio.h>
19745 #$i_stdlib I_STDLIB
19746 #ifdef I_STDLIB
19747 #include <stdlib.h>
19748 #endif
19749 int main() {
19750     printf("%d\n", (int)sizeof($gidtype));
19751     exit(0);
19752 }
19753 EOCP
19754 set try
19755 if eval $compile_ok; then
19756         yyy=`$run ./try`
19757         case "$yyy" in
19758         '')     gidsize=4
19759                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19760                 ;;
19761         *)      gidsize=$yyy
19762                 echo "Your $zzz is $gidsize bytes long."
19763                 ;;
19764         esac
19765 else
19766         gidsize=4
19767         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19768 fi
19769
19770
19771 : Check if GID is signed
19772 echo " "
19773 case "$gidtype" in
19774 *_t) zzz="$gidtype"     ;;
19775 *)   zzz="gid"          ;;
19776 esac
19777 echo "Checking the sign of $zzz..." >&4
19778 cat > try.c <<EOCP
19779 #include <sys/types.h>
19780 #include <stdio.h>
19781 int main() {
19782         $gidtype foo = -1;
19783         if (foo < 0)
19784                 printf("-1\n");
19785         else
19786                 printf("1\n");
19787 }
19788 EOCP
19789 set try
19790 if eval $compile; then
19791         yyy=`$run ./try`
19792         case "$yyy" in
19793         '')     gidsign=1
19794                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19795                 ;;
19796         *)      gidsign=$yyy
19797                 case "$gidsign" in
19798                  1) echo "Your $zzz is unsigned." ;;
19799                 -1) echo "Your $zzz is signed."   ;;
19800                 esac
19801                 ;;
19802         esac
19803 else
19804         gidsign=1
19805         echo "(I can't compile the test program--guessing unsigned.)" >&4
19806 fi
19807
19808
19809 : Check 64bit sizes
19810 echo " "
19811
19812 if $test X"$quadtype" != X; then
19813
19814 echo "Checking how to print 64-bit integers..." >&4
19815
19816 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19817         $cat >try.c <<'EOCP'
19818 #include <sys/types.h>
19819 #include <stdio.h>
19820 int main() {
19821   int q = 12345678901;
19822   printf("%ld\n", q);
19823 }
19824 EOCP
19825         set try
19826         if eval $compile; then
19827                 yyy=`$run ./try`
19828                 case "$yyy" in
19829                 12345678901)
19830                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19831                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19832                         echo "We will use %d."
19833                         ;;
19834                 esac
19835         fi
19836 fi
19837
19838 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19839         $cat >try.c <<'EOCP'
19840 #include <sys/types.h>
19841 #include <stdio.h>
19842 int main() {
19843   long q = 12345678901;
19844   printf("%ld\n", q);
19845 }
19846 EOCP
19847         set try
19848         if eval $compile; then
19849                 yyy=`$run ./try`
19850                 case "$yyy" in
19851                 12345678901)
19852                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19853                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19854                         echo "We will use %ld."
19855                         ;;
19856                 esac
19857         fi
19858 fi
19859
19860 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19861         $cat >try.c <<'EOCP'
19862 #include <sys/types.h>
19863 #include <inttypes.h>
19864 #include <stdio.h>
19865 int main() {
19866   int64_t q = 12345678901;
19867   printf("%" PRId64 "\n", q);
19868 }
19869 EOCP
19870         set try
19871         if eval $compile; then
19872                 yyy=`$run ./try`
19873                 case "$yyy" in
19874                 12345678901)
19875                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19876                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19877                         echo "We will use the C9X style."
19878                         ;;
19879                 esac
19880         fi
19881 fi
19882
19883 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19884         $cat >try.c <<EOCP
19885 #include <sys/types.h>
19886 #include <stdio.h>
19887 int main() {
19888   $quadtype q = 12345678901;
19889   printf("%Ld\n", q);
19890 }
19891 EOCP
19892         set try
19893         if eval $compile; then
19894                 yyy=`$run ./try`
19895                 case "$yyy" in
19896                 12345678901)
19897                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19898                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19899                         echo "We will use %Ld."
19900                         ;;
19901                 esac
19902         fi
19903 fi
19904
19905 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19906         $cat >try.c <<'EOCP'
19907 #include <sys/types.h>
19908 #include <stdio.h>
19909 int main() {
19910   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19911   printf("%lld\n", q);
19912 }
19913 EOCP
19914         set try
19915         if eval $compile; then
19916                 yyy=`$run ./try`
19917                 case "$yyy" in
19918                 12345678901)
19919                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19920                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19921                         echo "We will use the %lld style."
19922                         ;;
19923                 esac
19924         fi
19925 fi
19926
19927 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19928         $cat >try.c <<EOCP
19929 #include <sys/types.h>
19930 #include <stdio.h>
19931 int main() {
19932   $quadtype q = 12345678901;
19933   printf("%qd\n", q);
19934 }
19935 EOCP
19936         set try
19937         if eval $compile; then
19938                 yyy=`$run ./try`
19939                 case "$yyy" in
19940                 12345678901)
19941                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19942                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19943                         echo "We will use %qd."
19944                         ;;
19945                 esac
19946         fi
19947 fi
19948
19949 if $test X"$sPRId64" = X; then
19950         echo "Cannot figure out how to print 64-bit integers." >&4
19951 fi
19952 $rm_try
19953
19954 fi
19955
19956 case "$sPRId64" in
19957 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19958         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19959         ;;
19960 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19961         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19962         ;;
19963 esac
19964
19965 : Check format strings for internal types
19966 echo " "
19967 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19968
19969 if $test X"$ivsize" = X8; then
19970         ivdformat="$sPRId64"
19971         uvuformat="$sPRIu64"
19972         uvoformat="$sPRIo64"
19973         uvxformat="$sPRIx64"
19974         uvXUformat="$sPRIXU64"
19975 else
19976         if $test X"$ivsize" = X"$longsize"; then
19977                 ivdformat='"ld"'
19978                 uvuformat='"lu"'
19979                 uvoformat='"lo"'
19980                 uvxformat='"lx"'
19981                 uvXUformat='"lX"'
19982         else
19983                 if $test X"$ivsize" = X"$intsize"; then
19984                         ivdformat='"d"'
19985                         uvuformat='"u"'
19986                         uvoformat='"o"'
19987                         uvxformat='"x"'
19988                         uvXUformat='"X"'
19989                 else
19990                         : far out
19991                         if $test X"$ivsize" = X"$shortsize"; then
19992                                 ivdformat='"hd"'
19993                                 uvuformat='"hu"'
19994                                 uvoformat='"ho"'
19995                                 uvxformat='"hx"'
19996                                 uvXUformat='"hX"'
19997                         fi
19998                 fi
19999         fi
20000 fi
20001
20002 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20003         nveformat="$sPRIeldbl"
20004         nvfformat="$sPRIfldbl"
20005         nvgformat="$sPRIgldbl"
20006         nvEUformat="$sPRIEUldbl"
20007         nvFUformat="$sPRIFUldbl"
20008         nvGUformat="$sPRIGUldbl"
20009 else
20010         nveformat='"e"'
20011         nvfformat='"f"'
20012         nvgformat='"g"'
20013         nvEUformat='"E"'
20014         nvFUformat='"F"'
20015         nvGUformat='"G"'
20016 fi
20017
20018 case "$ivdformat" in
20019 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20020     exit 1
20021     ;;
20022 esac
20023
20024 : Check format string for GID
20025
20026 echo " "
20027 $echo "Checking the format string to be used for gids..." >&4
20028
20029 case "$gidsign" in
20030 -1)     if $test X"$gidsize" = X"$ivsize"; then
20031                 gidformat="$ivdformat"
20032         else
20033                 if $test X"$gidsize" = X"$longsize"; then
20034                         gidformat='"ld"'
20035                 else
20036                         if $test X"$gidsize" = X"$intsize"; then
20037                                 gidformat='"d"'
20038                         else
20039                                 if $test X"$gidsize" = X"$shortsize"; then
20040                                         gidformat='"hd"'
20041                                 fi
20042                         fi
20043                 fi
20044         fi
20045         ;;
20046 *)      if $test X"$gidsize" = X"$uvsize"; then
20047                 gidformat="$uvuformat"
20048         else
20049                 if $test X"$gidsize" = X"$longsize"; then
20050                         gidformat='"lu"'
20051                 else
20052                         if $test X"$gidsize" = X"$intsize"; then
20053                                 gidformat='"u"'
20054                         else
20055                                 if $test X"$gidsize" = X"$shortsize"; then
20056                                         gidformat='"hu"'
20057                                 fi
20058                         fi
20059                 fi
20060         fi
20061         ;;
20062 esac
20063
20064 : see if getgroups exists
20065 set getgroups d_getgrps
20066 eval $inlibc
20067
20068 : see if setgroups exists
20069 set setgroups d_setgrps
20070 eval $inlibc
20071
20072 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20073 echo " "
20074 case "$d_getgrps$d_setgrps" in
20075 *define*)
20076         case "$groupstype" in
20077         '') dflt="$gidtype" ;;
20078         *)  dflt="$groupstype" ;;
20079         esac
20080         $cat <<EOM
20081 What type of pointer is the second argument to getgroups() and setgroups()?
20082 Usually this is the same as group ids, $gidtype, but not always.
20083
20084 EOM
20085         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20086         . ./myread
20087         groupstype="$ans"
20088         ;;
20089 *)  groupstype="$gidtype";;
20090 esac
20091
20092 : MAD = Misc Attribute Definition
20093
20094 if $test $patchlevel -lt 9; then
20095 : MAD is not available in 5.8.x or earlier.
20096     ans=n;
20097 else
20098     case "$mad" in
20099     $define|true|[yY]*) dflt='y' ;;
20100     *)                  dflt='n' ;;
20101     esac
20102     cat <<EOM
20103
20104 Would you like to build with Misc Attribute Decoration? This is development
20105 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20106 overhead on the interpreter.
20107
20108 If this doesn't make any sense to you, just accept the default '$dflt'.
20109 EOM
20110     rp='Build Perl with MAD?'
20111     . ./myread
20112 fi
20113 case "$ans" in
20114 y|Y)    val="$define"
20115         madlyh='madly.h madly.act madly.tab'
20116         madlysrc='madly.c'
20117         madlyobj="madly$_o" ;;
20118 *)      val="$undef"
20119         madlyh=''
20120         madlysrc=''
20121         madlyobj='' ;;
20122 esac
20123 set mad
20124 eval $setvar
20125
20126 : check whether make sets MAKE
20127 echo " "
20128 echo "Checking if your $make program sets \$(MAKE)..." >&4
20129 case "$make_set_make" in
20130 '')
20131         $sed 's/^X //' > testmake.mak << 'EOF'
20132 Xall:
20133 X       @echo 'maketemp="$(MAKE)"'
20134 EOF
20135         case "`$make -f testmake.mak 2>/dev/null`" in
20136         *maketemp=*) make_set_make='#' ;;
20137         *)      make_set_make="MAKE=$make" ;;
20138         esac
20139         $rm -f testmake.mak
20140         ;;
20141 esac
20142 case "$make_set_make" in
20143 '#') echo "Yup, it does.";;
20144 *) echo "Nope, it doesn't.";;
20145 esac
20146
20147 : see what type is used for mode_t
20148 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20149 set mode_t modetype int stdio.h sys/types.h
20150 eval $typedef_ask
20151
20152 : see if we need va_copy
20153 echo " "
20154 case "$i_stdarg" in
20155 "$define")
20156         $cat >try.c <<EOCP
20157 #include <stdarg.h>
20158 #include <stdio.h>
20159 #$i_stdlib I_STDLIB
20160 #ifdef I_STDLIB
20161 #include <stdlib.h>
20162 #endif
20163 #include <signal.h>
20164
20165 int
20166 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20167 {
20168   return vfprintf(f, fmt, *valp);
20169 }
20170
20171 int
20172 myvfprintf(FILE *f, const  char *fmt, va_list val)
20173 {
20174   return ivfprintf(f, fmt, &val);
20175 }
20176
20177 int
20178 myprintf(char *fmt, ...)
20179 {
20180   va_list val;
20181   va_start(val, fmt);
20182   return myvfprintf(stdout, fmt, val);
20183 }
20184
20185 int
20186 main(int ac, char **av)
20187 {
20188   signal(SIGSEGV, exit);
20189
20190   myprintf("%s%cs all right, then\n", "that", '\'');
20191   exit(0);
20192 }
20193 EOCP
20194         set try
20195         if eval $compile && $run ./try 2>&1 >/dev/null; then
20196                 case "`$run ./try`" in
20197                 "that's all right, then")
20198                         okay=yes
20199                         ;;
20200                 esac
20201         fi
20202         case "$okay" in
20203         yes)    echo "It seems that you don't need va_copy()." >&4
20204                 need_va_copy="$undef"
20205                 ;;
20206         *)      echo "It seems that va_copy() or similar will be needed." >&4
20207                 need_va_copy="$define"
20208                 ;;
20209         esac
20210         $rm_try
20211         ;;
20212 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20213         ;;
20214 esac
20215
20216 : see what type is used for size_t
20217 rp="What is the type used for the length parameter for string functions?"
20218 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20219 eval $typedef_ask
20220
20221 : check for type of arguments to gethostbyaddr. 
20222 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20223         case "$d_gethbyaddr" in
20224         $define)
20225                 $cat <<EOM
20226
20227 Checking to see what type of arguments are accepted by gethostbyaddr().
20228 EOM
20229                 hdrs="$define sys/types.h
20230                         $d_socket sys/socket.h 
20231                         $i_niin netinet/in.h 
20232                         $i_netdb netdb.h
20233                         $i_unistd unistd.h"
20234                 : The first arg can 'char *' or 'void *'
20235                 : The second arg is some of integral type
20236                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20237                         for yyy in size_t long int; do
20238                                 case "$netdb_host_type" in
20239                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20240                                         if ./protochk "$try" $hdrs; then
20241                                                 echo "Your system accepts $xxx for the first arg."
20242                                                 echo "...and $yyy for the second arg."
20243                                                 netdb_host_type="$xxx"
20244                                                 netdb_hlen_type="$yyy"
20245                                         fi
20246                                         ;;
20247                                 esac
20248                         done
20249                 done
20250                 : In case none of those worked, prompt the user.
20251                 case "$netdb_host_type" in
20252                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20253                         dflt='char *'
20254                         . ./myread
20255                         netdb_host_type=$ans
20256                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20257                         dflt="$sizetype"
20258                         . ./myread
20259                         netdb_hlen_type=$ans
20260                         ;;
20261                 esac
20262                 ;;
20263         *)      : no gethostbyaddr, so pick harmless defaults
20264                 netdb_host_type='char *'
20265                 netdb_hlen_type="$sizetype"
20266                 ;;
20267         esac
20268         # Remove the "const" if needed. -- but then we'll have a 
20269         # prototype clash!
20270         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20271 fi
20272
20273 : check for type of argument to gethostbyname. 
20274 if test "X$netdb_name_type" = X ; then
20275         case "$d_gethbyname" in
20276         $define)
20277                 $cat <<EOM
20278
20279 Checking to see what type of argument is accepted by gethostbyname().
20280 EOM
20281                 hdrs="$define sys/types.h
20282                         $d_socket sys/socket.h 
20283                         $i_niin netinet/in.h 
20284                         $i_netdb netdb.h
20285                         $i_unistd unistd.h"
20286                 for xxx in "const char *" "char *"; do
20287                         case "$netdb_name_type" in
20288                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20289                                 if ./protochk "$try" $hdrs; then
20290                                         echo "Your system accepts $xxx."
20291                                         netdb_name_type="$xxx"
20292                                 fi
20293                                 ;;
20294                         esac
20295                 done
20296                 : In case none of those worked, prompt the user.
20297                 case "$netdb_name_type" in
20298                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20299                         dflt='char *'
20300                         . ./myread
20301                         netdb_name_type=$ans
20302                         ;;
20303                 esac
20304                 ;;
20305         *)      : no gethostbyname, so pick harmless default
20306                 netdb_name_type='char *'
20307                 ;;
20308         esac
20309 fi
20310
20311 : check for type of 1st argument to getnetbyaddr. 
20312 if test "X$netdb_net_type" = X ; then
20313         case "$d_getnbyaddr" in
20314         $define)
20315                 $cat <<EOM
20316
20317 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20318 EOM
20319                 hdrs="$define sys/types.h
20320                         $d_socket sys/socket.h 
20321                         $i_niin netinet/in.h 
20322                         $i_netdb netdb.h
20323                         $i_unistd unistd.h"
20324                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20325                         case "$netdb_net_type" in
20326                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20327                                 if ./protochk "$try" $hdrs; then
20328                                         echo "Your system accepts $xxx."
20329                                         netdb_net_type="$xxx"
20330                                 fi
20331                                 ;;
20332                         esac
20333                 done
20334                 : In case none of those worked, prompt the user.
20335                 case "$netdb_net_type" in
20336                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20337                         dflt='long'
20338                         . ./myread
20339                         netdb_net_type=$ans
20340                         ;;
20341                 esac
20342                 ;;
20343         *)      : no getnetbyaddr, so pick harmless default
20344                 netdb_net_type='long'
20345                 ;;
20346         esac
20347 fi
20348 : locate the preferred pager for this system
20349 fn=f/
20350 case "$pager" in
20351 '')
20352         dflt=''
20353         case "$pg" in
20354         /*) dflt=$pg;;
20355         [a-zA-Z]:/*) dflt=$pg;;
20356         esac
20357         case "$more" in
20358         /*) dflt=$more;;
20359         [a-zA-Z]:/*) dflt=$more;;
20360         esac
20361         case "$less" in
20362         /*) dflt=$less;;
20363         [a-zA-Z]:/*) dflt=$less;;
20364         esac
20365         case "$dflt" in
20366         '') dflt=/usr/ucb/more;;
20367         esac
20368         ;;
20369 *)      dflt="$pager"
20370         fn="f/($pager)"
20371         ;;
20372 esac
20373 echo " "
20374 rp='What pager is used on your system?'
20375 . ./getfile
20376 pager="$ans"
20377
20378 : see what type pids are declared as in the kernel
20379 rp="What is the type of process ids on this system?"
20380 set pid_t pidtype int stdio.h sys/types.h
20381 eval $typedef_ask
20382
20383 : see if ar generates random libraries by itself
20384 echo " "
20385 echo "Checking how to generate random libraries on your machine..." >&4
20386 echo 'int bar1() { return bar2(); }' > bar1.c
20387 echo 'int bar2() { return 2; }' > bar2.c
20388 $cat > foo.c <<EOP
20389 #$i_stdlib I_STDLIB
20390 #ifdef I_STDLIB
20391 #include <stdlib.h>
20392 #endif
20393 int main() { printf("%d\n", bar1()); exit(0); }
20394 EOP
20395 $cc $ccflags -c bar1.c >/dev/null 2>&1
20396 $cc $ccflags -c bar2.c >/dev/null 2>&1
20397 $cc $ccflags -c foo.c >/dev/null 2>&1
20398 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20399 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20400         $run ./foobar >/dev/null 2>&1; then
20401         echo "$ar appears to generate random libraries itself."
20402         orderlib=false
20403         if [ "X$ranlib" = "X" ]; then
20404             ranlib=":"
20405         fi
20406 elif $ar s bar$_a >/dev/null 2>&1 &&
20407         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20408         $run ./foobar >/dev/null 2>&1; then
20409                 echo "a table of contents needs to be added with '$ar s'."
20410                 orderlib=false
20411                 ranlib="$ar s"
20412 elif $ar ts bar$_a >/dev/null 2>&1 &&
20413         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20414         $run ./foobar >/dev/null 2>&1; then
20415                 echo "a table of contents needs to be added with '$ar ts'."
20416                 orderlib=false
20417                 ranlib="$ar ts"
20418 else
20419         case "$ranlib" in
20420         :) ranlib='';;
20421         '')
20422                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20423                 $test -f $ranlib || ranlib=''
20424                 ;;
20425         esac
20426         if $test -n "$ranlib"; then
20427                 echo "your system has '$ranlib'; we'll use that."
20428                 orderlib=false
20429         else
20430                 echo "your system doesn't seem to support random libraries"
20431                 echo "so we'll use lorder and tsort to order the libraries."
20432                 orderlib=true
20433                 ranlib=":"
20434         fi
20435 fi
20436 $rm -f foo* bar*
20437
20438 : see if this is a values.h system
20439 set values.h i_values
20440 eval $inhdr
20441
20442 : Check the max offset that gmtime and localtime accept
20443 echo "Checking max offsets that gmtime () accepts"
20444
20445 case $i_values in
20446     define) yyy="#include <values.h>" ;;
20447     *)      yyy="" ;;
20448     esac
20449
20450 case "$sGMTIME_min/$sGMTIME_max" in
20451     0/0|/)
20452         $cat >try.c <<EOCP
20453 #include <sys/types.h>
20454 #include <stdio.h>
20455 #include <time.h>
20456 $yyy
20457
20458 int i;
20459 struct tm *tmp;
20460 time_t pt;
20461
20462 void gm_check (time_t t, int min_year, int max_year)
20463 {
20464     tmp = gmtime (&t);
20465     if ( tmp == NULL ||
20466         /* Check tm_year overflow */
20467          tmp->tm_year < min_year || tmp->tm_year > max_year)
20468         tmp = NULL;
20469     else
20470         pt = t;
20471     } /* gm_check */
20472
20473 int check_max ()
20474 {
20475     tmp = NULL;
20476     pt  = 0;
20477 #ifdef MAXLONG
20478     gm_check (MAXLONG, 69, 0x7fffffff);
20479 #endif
20480     if (tmp == NULL || tmp->tm_year < 0) {
20481         for (i = 63; i >= 0; i--) {
20482             time_t x = pt | ((time_t)1 << i);
20483             if (x < 0 || x < pt) continue;
20484             gm_check (x, 69, 0x7fffffff);
20485             }
20486         }
20487     printf ("sGMTIME_max=%ld\n", pt);
20488     return (0);
20489     } /* check_max */
20490
20491 int check_min ()
20492 {
20493     tmp = NULL;
20494     pt  = 0;
20495 #ifdef MINLONG
20496     gm_check (MINLONG, -1900, 70);
20497 #endif
20498     if (tmp == NULL) {
20499         for (i = 36; i >= 0; i--) {
20500             time_t x = pt - ((time_t)1 << i);
20501             if (x > 0) continue;
20502             gm_check (x, -1900, 70);
20503             }
20504         }
20505     printf ("sGMTIME_min=%ld\n", pt);
20506     return (0);
20507     } /* check_min */
20508
20509 int main (int argc, char *argv[])
20510 {
20511     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20512     check_max ();
20513     check_min ();
20514     return (0);
20515     } /* main */
20516 EOCP
20517         set try
20518         if eval $compile; then
20519             eval `$run ./try`
20520         else
20521             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20522             fi
20523         $rm_try
20524         ;;
20525     esac
20526
20527 echo "Checking max offsets that localtime () accepts"
20528
20529 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20530     0/0|/)
20531         $cat >try.c <<EOCP
20532 #include <sys/types.h>
20533 #include <stdio.h>
20534 #include <time.h>
20535 $yyy
20536
20537 int i;
20538 struct tm *tmp;
20539 time_t pt;
20540
20541 void local_check (time_t t, int min_year, int max_year)
20542 {
20543     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20544         tmp = NULL;
20545     else
20546         tmp = localtime (&t);
20547     if ( tmp == NULL ||
20548         /* Check tm_year overflow */
20549          tmp->tm_year < min_year || tmp->tm_year > max_year)
20550         tmp = NULL;
20551     else
20552         pt = t;
20553     } /* local_check */
20554
20555 int check_max ()
20556 {
20557     tmp = NULL;
20558     pt  = 0;
20559 #ifdef MAXLONG
20560     local_check (MAXLONG, 69, 0x7fffffff);
20561 #endif
20562     if (tmp == NULL || tmp->tm_year < 0) {
20563         for (i = 63; i >= 0; i--) {
20564             time_t x = pt | ((time_t)1 << i);
20565             if (x < 0 || x < pt) continue;
20566             local_check (x, 69, 0x7fffffff);
20567             }
20568         }
20569     printf ("sLOCALTIME_max=%ld\n", pt);
20570     return (0);
20571    } /* check_max */
20572
20573 int check_min ()
20574 {
20575     tmp = NULL;
20576     pt  = 0;
20577 #ifdef MINLONG
20578     local_check (MINLONG, -1900, 70);
20579 #endif
20580     if (tmp == NULL) {
20581         for (i = 36; i >= 0; i--) {
20582             time_t x = pt - ((time_t)1 << i);
20583             if (x > 0) continue;
20584             local_check (x, -1900, 70);
20585             }
20586         }
20587     printf ("sLOCALTIME_min=%ld\n", pt);
20588     return (0);
20589     } /* check_min */
20590
20591 int main (int argc, char *argv[])
20592 {
20593     check_max ();
20594     check_min ();
20595     return (0);
20596     } /* main */
20597 EOCP
20598         set try
20599         if eval $compile; then
20600             eval `$run ./try`
20601         else
20602             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20603             fi
20604         $rm_try
20605         ;;
20606     esac
20607
20608 : check for type of arguments to select.
20609 case "$selecttype" in
20610 '') case "$d_select" in
20611         $define)
20612                 echo " "
20613                 $cat <<EOM
20614 Checking to see what type of arguments are accepted by select().
20615 EOM
20616                 hdrs="$define sys/types.h
20617                         $i_systime sys/time.h
20618                         $i_sysselct sys/select.h
20619                         $d_socket sys/socket.h"
20620                 : The first arg can be int, unsigned, or size_t
20621                 : The last arg may or may not be 'const'
20622                 val=''
20623                 : void pointer has been seen but using that
20624                 : breaks the selectminbits test
20625                 for xxx in 'fd_set *' 'int *'; do
20626                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20627                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20628                                         case "$val" in
20629                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20630                                                 if ./protochk "$try" $hdrs; then
20631                                                         echo "Your system accepts $xxx."
20632                                                         val="$xxx"
20633                                                 fi
20634                                                 ;;
20635                                         esac
20636                                 done
20637                         done
20638                 done
20639                 case "$val" in
20640                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20641                         case "$d_fd_set" in
20642                                 $define) dflt="fd_set *" ;;
20643                                 *)              dflt="int *" ;;
20644                         esac
20645                         . ./myread
20646                         val=$ans
20647                         ;;
20648                 esac
20649                 selecttype="$val"
20650                 ;;
20651         *)      : no select, so pick a harmless default
20652                 selecttype='int *'
20653                 ;;
20654         esac
20655         ;;
20656 esac
20657
20658 : check for the select 'width'
20659 case "$selectminbits" in
20660 '') safebits=`expr $ptrsize \* 8`
20661     case "$d_select" in
20662         $define)
20663                 $cat <<EOM
20664
20665 Checking to see on how many bits at a time your select() operates...
20666 EOM
20667                 $cat >try.c <<EOCP
20668 #include <sys/types.h>
20669 #$i_time I_TIME
20670 #$i_systime I_SYS_TIME
20671 #$i_systimek I_SYS_TIME_KERNEL
20672 #ifdef I_TIME
20673 #   include <time.h>
20674 #endif
20675 #ifdef I_SYS_TIME
20676 #   ifdef I_SYS_TIME_KERNEL
20677 #       define KERNEL
20678 #   endif
20679 #   include <sys/time.h>
20680 #   ifdef I_SYS_TIME_KERNEL
20681 #       undef KERNEL
20682 #   endif
20683 #endif
20684 #$i_sysselct I_SYS_SELECT
20685 #ifdef I_SYS_SELECT
20686 #include <sys/select.h>
20687 #endif
20688 #$d_socket HAS_SOCKET
20689 #ifdef HAS_SOCKET
20690 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20691 #endif
20692 #include <stdio.h>
20693 #$i_stdlib I_STDLIB
20694 #ifdef I_STDLIB
20695 #include <stdlib.h>
20696 #endif
20697 $selecttype b;
20698 #define S sizeof(*(b))
20699 #define MINBITS 64
20700 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20701 #define NBITS  (NBYTES * 8)
20702 int main() {
20703     char *s = (char *)malloc(NBYTES);
20704     struct timeval t;
20705     int i;
20706     FILE* fp;
20707     int fd;
20708
20709     if (!s)
20710         exit(1);
20711     fclose(stdin);
20712     fp = fopen("try.c", "r");
20713     if (fp == 0)
20714       exit(2);
20715     fd = fileno(fp);
20716     if (fd < 0)
20717       exit(3);
20718     b = ($selecttype)s;
20719     for (i = 0; i < NBITS; i++)
20720         FD_SET(i, b);
20721     t.tv_sec  = 0;
20722     t.tv_usec = 0;
20723     select(fd + 1, b, 0, 0, &t);
20724     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20725     free(s);
20726     printf("%d\n", i + 1);
20727     return 0;
20728 }
20729 EOCP
20730                 set try
20731                 if eval $compile_ok; then
20732                         selectminbits=`$run ./try`
20733                         case "$selectminbits" in
20734                         '')     cat >&4 <<EOM
20735 Cannot figure out on how many bits at a time your select() operates.
20736 I'll play safe and guess it is $safebits bits.
20737 EOM
20738                                 selectminbits=$safebits
20739                                 bits="$safebits bits"
20740                                 ;;
20741                         1)      bits="1 bit" ;;
20742                         *)      bits="$selectminbits bits" ;;
20743                         esac
20744                         echo "Your select() operates on $bits at a time." >&4
20745                 else
20746                         rp='What is the minimum number of bits your select() operates on?'
20747                         case "$byteorder" in
20748                         12345678)       dflt=64 ;;
20749                         1234)           dflt=32 ;;
20750                         *)              dflt=1  ;;
20751                         esac
20752                         . ./myread
20753                         val=$ans
20754                         selectminbits="$val"
20755                 fi
20756                 $rm_try
20757                 ;;
20758         *)      : no select, so pick a harmless default
20759                 selectminbits=$safebits
20760                 ;;
20761         esac
20762         ;;
20763 esac
20764
20765 : Trace out the files included by signal.h, then look for SIGxxx names.
20766 if [ "X$fieldn" = X ]; then
20767         : Just make some guesses.  We check them later.
20768         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20769 else
20770         xxx=`echo '#include <signal.h>' |
20771         $cppstdin $cppminus $cppflags 2>/dev/null |
20772         $grep '^[       ]*#.*include' |
20773         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20774                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20775 fi
20776 xxxfiles=''
20777 for xx in $xxx /dev/null ; do
20778         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20779 done
20780 case "$xxxfiles" in
20781 '')     xxxfiles=`./findhdr signal.h` ;;
20782 esac
20783 xxx=`awk '
20784 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20785         print substr($2, 4, 20)
20786 }
20787 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20788         print substr($3, 4, 20)
20789 }' $xxxfiles`
20790 : Append some common names just in case the awk scan failed.
20791 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20792 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20793 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20794 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20795 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20796
20797 : generate a few handy files for later
20798 $cat > signal.c <<EOCP
20799 #include <sys/types.h>
20800 #include <signal.h>
20801 #$i_stdlib I_STDLIB
20802 #ifdef I_STDLIB
20803 #include <stdlib.h>
20804 #endif
20805 #include <stdio.h>
20806 int main() {
20807
20808 /* Strange style to avoid deeply-nested #if/#else/#endif */
20809 #ifndef NSIG
20810 #  ifdef _NSIG
20811 #    define NSIG (_NSIG)
20812 #  endif
20813 #endif
20814
20815 #ifndef NSIG
20816 #  ifdef SIGMAX
20817 #    define NSIG (SIGMAX+1)
20818 #  endif
20819 #endif
20820
20821 #ifndef NSIG
20822 #  ifdef SIG_MAX
20823 #    define NSIG (SIG_MAX+1)
20824 #  endif
20825 #endif
20826
20827 #ifndef NSIG
20828 #  ifdef _SIG_MAX
20829 #    define NSIG (_SIG_MAX+1)
20830 #  endif
20831 #endif
20832
20833 #ifndef NSIG
20834 #  ifdef MAXSIG
20835 #    define NSIG (MAXSIG+1)
20836 #  endif
20837 #endif
20838
20839 #ifndef NSIG
20840 #  ifdef MAX_SIG
20841 #    define NSIG (MAX_SIG+1)
20842 #  endif
20843 #endif
20844
20845 #ifndef NSIG
20846 #  ifdef SIGARRAYSIZE
20847 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20848 #  endif
20849 #endif
20850
20851 #ifndef NSIG
20852 #  ifdef _sys_nsig
20853 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20854 #  endif
20855 #endif
20856
20857 /* Default to some arbitrary number that's big enough to get most
20858    of the common signals.
20859 */
20860 #ifndef NSIG
20861 #    define NSIG 50
20862 #endif
20863
20864 printf("NSIG %d\n", NSIG);
20865
20866 #ifndef JUST_NSIG
20867
20868 EOCP
20869
20870 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20871 {
20872         printf "#ifdef SIG"; printf $1; printf "\n"
20873         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20874         printf $1; printf ");\n"
20875         printf "#endif\n"
20876 }
20877 END {
20878         printf "#endif /* JUST_NSIG */\n";
20879         printf "exit(0);\n}\n";
20880 }
20881 ' >>signal.c
20882 $cat >signal.awk <<'EOP'
20883 BEGIN { ndups = 0 }
20884 $1 ~ /^NSIG$/ { nsig = $2 }
20885 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20886     if ($2 > maxsig) { maxsig = $2 }
20887     if (sig_name[$2]) {
20888         dup_name[ndups] = $1
20889         dup_num[ndups] = $2
20890         ndups++
20891     }
20892     else {
20893         sig_name[$2] = $1
20894         sig_num[$2] = $2
20895     }
20896 }
20897 END {
20898     if (nsig == 0) {
20899         nsig = maxsig + 1
20900     }
20901     printf("NSIG %d\n", nsig);
20902     for (n = 1; n < nsig; n++) {
20903         if (sig_name[n]) {
20904             printf("%s %d\n", sig_name[n], sig_num[n])
20905         }
20906         else {
20907             printf("NUM%d %d\n", n, n)
20908         }
20909     }
20910     for (n = 0; n < ndups; n++) {
20911         printf("%s %d\n", dup_name[n], dup_num[n])
20912     }
20913 }
20914 EOP
20915 $cat >signal_cmd <<EOS
20916 $startsh
20917 if $test -s signal.lst; then
20918     echo "Using your existing signal.lst file"
20919         exit 0
20920 fi
20921 xxx="$xxx"
20922 EOS
20923 $cat >>signal_cmd <<'EOS'
20924
20925 set signal
20926 if eval $compile_ok; then
20927         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20928                 $uniq | $awk -f signal.awk >signal.lst
20929 else
20930         echo "(I can't seem be able to compile the whole test program)" >&4
20931         echo "(I'll try it in little pieces.)" >&4
20932         set signal -DJUST_NSIG
20933         if eval $compile_ok; then
20934                 $run ./signal$_exe > signal.nsg
20935                 $cat signal.nsg
20936         else
20937                 echo "I can't seem to figure out how many signals you have." >&4
20938                 echo "Guessing 50." >&4
20939                 echo 'NSIG 50' > signal.nsg
20940         fi
20941         : Now look at all the signal names, one at a time.
20942         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20943                 $cat > signal.c <<EOCP
20944 #include <sys/types.h>
20945 #include <signal.h>
20946 #include <stdio.h>
20947 int main() {
20948 printf("$xx %d\n", SIG${xx});
20949 return 0;
20950 }
20951 EOCP
20952                 set signal
20953                 if eval $compile; then
20954                         echo "SIG${xx} found."
20955                         $run ./signal$_exe  >> signal.ls1
20956                 else
20957                         echo "SIG${xx} NOT found."
20958                 fi
20959         done
20960         if $test -s signal.ls1; then
20961                 $cat signal.nsg signal.ls1 |
20962                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20963         fi
20964
20965 fi
20966 if $test -s signal.lst; then
20967         :
20968 else
20969         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20970         echo 'kill -l' >signal
20971         set X `csh -f <signal`
20972         $rm -f signal
20973         shift
20974         case $# in
20975         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20976         esac
20977         echo $@ | $tr ' ' $trnl | \
20978             $awk '{ printf "%s %d\n", $1, ++s; }
20979                   END { printf "NSIG %d\n", ++s }' >signal.lst
20980 fi
20981 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20982 EOS
20983 chmod a+x signal_cmd
20984 $eunicefix signal_cmd
20985
20986 : generate list of signal names
20987 echo " "
20988 case "$sig_name_init" in
20989 '') doinit=yes ;;
20990 *)  case "$sig_num_init" in
20991     ''|*,*) doinit=yes ;;
20992     esac ;;
20993 esac
20994 case "$doinit" in
20995 yes)
20996         echo "Generating a list of signal names and numbers..." >&4
20997         . ./signal_cmd
20998         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20999         sig_name=`$awk 'BEGIN { printf "ZERO " }
21000                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21001         sig_num=`$awk  'BEGIN { printf "0 " }
21002                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21003         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21004                              !/^NSIG/   { printf "\"%s\", ", $1 }
21005                              END        { printf "0\n" }' signal.lst`
21006         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21007                              !/^NSIG/   { printf "%d, ", $2}
21008                              END        { printf "0\n"}' signal.lst`
21009         ;;
21010 esac
21011 echo "The following $sig_count signals are available:"
21012 echo " "
21013 echo $sig_name | $awk \
21014 'BEGIN { linelen = 0 }
21015 {
21016         for (i = 1; i <= NF; i++) {
21017                 name = "SIG" $i " "
21018                 linelen = linelen + length(name)
21019                 if (linelen > 70) {
21020                         printf "\n"
21021                         linelen = length(name)
21022                 }
21023                 printf "%s", name
21024         }
21025         printf "\n"
21026 }'
21027 sig_size=`echo $sig_name | awk '{print NF}'`
21028 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21029
21030 : Check size of size
21031 echo " "
21032 case "$sizetype" in
21033 *_t) zzz="$sizetype"    ;;
21034 *)   zzz="filesize"     ;;
21035 esac
21036 echo "Checking the size of $zzz..." >&4
21037 cat > try.c <<EOCP
21038 #include <sys/types.h>
21039 #include <stdio.h>
21040 #$i_stdlib I_STDLIB
21041 #ifdef I_STDLIB
21042 #include <stdlib.h>
21043 #endif
21044 int main() {
21045     printf("%d\n", (int)sizeof($sizetype));
21046     exit(0);
21047 }
21048 EOCP
21049 set try
21050 if eval $compile_ok; then
21051         yyy=`$run ./try`
21052         case "$yyy" in
21053         '')     sizesize=4
21054                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21055                 ;;
21056         *)      sizesize=$yyy
21057                 echo "Your $zzz size is $sizesize bytes."
21058                 ;;
21059         esac
21060 else
21061         sizesize=4
21062         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21063 fi
21064
21065
21066 : check for socklen_t
21067 echo " "
21068 echo "Checking to see if you have socklen_t..." >&4
21069 $cat >try.c <<EOCP
21070 #include <sys/types.h>
21071 #$d_socket HAS_SOCKET
21072 #ifdef HAS_SOCKET
21073 #include <sys/socket.h>
21074 #endif
21075 int main() { socklen_t x = 16; }
21076 EOCP
21077 set try
21078 if eval $compile; then
21079         val="$define"
21080         echo "You have socklen_t."
21081 else
21082         val="$undef"
21083         echo "You do not have socklen_t."
21084         case "$sizetype" in
21085         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21086         esac
21087 fi
21088 $rm_try
21089 set d_socklen_t
21090 eval $setvar
21091
21092 : see if this is a socks.h system
21093 set socks.h i_socks
21094 eval $inhdr
21095
21096 : check for type of the size argument to socket calls
21097 case "$d_socket" in
21098 "$define")
21099         $cat <<EOM
21100
21101 Checking to see what type is the last argument of accept().
21102 EOM
21103         yyy=''
21104         case "$d_socklen_t" in
21105         "$define") yyy="$yyy socklen_t"
21106         esac
21107         yyy="$yyy $sizetype int long unsigned"
21108         for xxx in $yyy; do
21109                 case "$socksizetype" in
21110                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21111                         case "$usesocks" in
21112                         "$define")
21113                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21114                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21115                                         socksizetype="$xxx"
21116                                 fi
21117                                 ;;
21118                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21119                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21120                                         socksizetype="$xxx"
21121                                 fi
21122                                 ;;
21123                         esac
21124                         ;;
21125                 esac
21126         done
21127 : In case none of those worked, prompt the user.
21128         case "$socksizetype" in
21129         '')     rp='What is the type for socket address structure sizes?'
21130                 dflt='int'
21131                 . ./myread
21132                 socksizetype=$ans
21133                 ;;
21134         esac
21135         ;;
21136 *)      : no sockets, so pick relatively harmless default
21137         socksizetype='int'
21138         ;;
21139 esac
21140
21141 : see what type is used for signed size_t
21142 set ssize_t ssizetype int stdio.h sys/types.h
21143 eval $typedef
21144 dflt="$ssizetype"
21145 $cat > try.c <<EOM
21146 #include <stdio.h>
21147 #$i_stdlib I_STDLIB
21148 #ifdef I_STDLIB
21149 #include <stdlib.h>
21150 #endif
21151 #include <sys/types.h>
21152 #define Size_t $sizetype
21153 #define SSize_t $dflt
21154 int main()
21155 {
21156         if (sizeof(Size_t) == sizeof(SSize_t))
21157                 printf("$dflt\n");
21158         else if (sizeof(Size_t) == sizeof(int))
21159                 printf("int\n");
21160         else
21161                 printf("long\n");
21162         exit(0);
21163 }
21164 EOM
21165 echo " "
21166 set try
21167 if eval $compile_ok && $run ./try > /dev/null; then
21168         ssizetype=`$run ./try`
21169         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21170 else
21171         $cat >&4 <<EOM
21172 Help! I can't compile and run the ssize_t test program: please enlighten me!
21173 (This is probably a misconfiguration in your system or libraries, and
21174 you really ought to fix it.  Still, I'll try anyway.)
21175
21176 I need a type that is the same size as $sizetype, but is guaranteed to
21177 be signed.  Common values are ssize_t, int and long.
21178
21179 EOM
21180         rp="What signed type is the same size as $sizetype?"
21181         . ./myread
21182         ssizetype="$ans"
21183 fi
21184 $rm_try
21185
21186 : see what type of char stdio uses.
21187 echo " "
21188 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21189 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21190         echo "Your stdio uses unsigned chars." >&4
21191         stdchar="unsigned char"
21192 else
21193         echo "Your stdio uses signed chars." >&4
21194         stdchar="char"
21195 fi
21196 $rm -f stdioh
21197
21198 : see what type uids are declared as in the kernel
21199 echo " "
21200 echo "Looking for the type for user ids returned by getuid()."
21201 set uid_t uidtype xxx stdio.h sys/types.h
21202 eval $typedef
21203 case "$uidtype" in
21204 xxx)
21205         xxx=`./findhdr sys/user.h`
21206         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21207         case $1 in
21208         unsigned) dflt="$1 $2" ;;
21209         *) dflt="$1" ;;
21210         esac
21211         ;;
21212 *) dflt="$uidtype";;
21213 esac
21214 case "$uidtype" in
21215 uid_t)  echo "uid_t found." ;;
21216 *)      rp="What is the type for user ids returned by getuid()?"
21217         . ./myread
21218         uidtype="$ans"
21219         ;;
21220 esac
21221
21222 : Check size of UID
21223 echo " "
21224 case "$uidtype" in
21225 *_t) zzz="$uidtype"     ;;
21226 *)   zzz="uid"          ;;
21227 esac
21228 echo "Checking the size of $zzz..." >&4
21229 cat > try.c <<EOCP
21230 #include <sys/types.h>
21231 #include <stdio.h>
21232 #$i_stdlib I_STDLIB
21233 #ifdef I_STDLIB
21234 #include <stdlib.h>
21235 #endif
21236 int main() {
21237     printf("%d\n", (int)sizeof($uidtype));
21238     exit(0);
21239 }
21240 EOCP
21241 set try
21242 if eval $compile_ok; then
21243         yyy=`$run ./try`
21244         case "$yyy" in
21245         '')     uidsize=4
21246                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21247                 ;;
21248         *)      uidsize=$yyy
21249                 echo "Your $zzz is $uidsize bytes long."
21250                 ;;
21251         esac
21252 else
21253         uidsize=4
21254         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21255 fi
21256
21257 : Check if UID is signed
21258 echo " "
21259 case "$uidtype" in
21260 *_t) zzz="$uidtype"     ;;
21261 *)   zzz="uid"          ;;
21262 esac
21263 echo "Checking the sign of $zzz..." >&4
21264 cat > try.c <<EOCP
21265 #include <sys/types.h>
21266 #include <stdio.h>
21267 int main() {
21268         $uidtype foo = -1;
21269         if (foo < 0)
21270                 printf("-1\n");
21271         else
21272                 printf("1\n");
21273 }
21274 EOCP
21275 set try
21276 if eval $compile; then
21277         yyy=`$run ./try`
21278         case "$yyy" in
21279         '')     uidsign=1
21280                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21281                 ;;
21282         *)      uidsign=$yyy
21283                 case "$uidsign" in
21284                  1) echo "Your $zzz is unsigned." ;;
21285                 -1) echo "Your $zzz is signed."   ;;
21286                 esac
21287                 ;;
21288         esac
21289 else
21290         uidsign=1
21291         echo "(I can't compile the test program--guessing unsigned.)" >&4
21292 fi
21293
21294
21295 : Check format string for UID
21296 echo " "
21297 $echo "Checking the format string to be used for uids..." >&4
21298
21299 case "$uidsign" in
21300 -1)     if $test X"$uidsize" = X"$ivsize"; then
21301                 uidformat="$ivdformat"
21302         else
21303                 if $test X"$uidsize" = X"$longsize"; then
21304                         uidformat='"ld"'
21305                 else
21306                         if $test X"$uidsize" = X"$intsize"; then
21307                                 uidformat='"d"'
21308                         else
21309                                 if $test X"$uidsize" = X"$shortsize"; then
21310                                         uidformat='"hd"'
21311                                 fi
21312                         fi
21313                 fi
21314         fi
21315         ;;
21316 *)      if $test X"$uidsize" = X"$uvsize"; then
21317                 uidformat="$uvuformat"
21318         else
21319                 if $test X"$uidsize" = X"$longsize"; then
21320                         uidformat='"lu"'
21321                 else
21322                         if $test X"$uidsize" = X"$intsize"; then
21323                                 uidformat='"u"'
21324                         else
21325                                 if $test X"$uidsize" = X"$shortsize"; then
21326                                         uidformat='"hu"'
21327                                 fi
21328                         fi
21329                 fi
21330         fi
21331         ;;
21332 esac
21333
21334 : Check if site customization support was requested
21335 case "$usesitecustomize" in
21336     $define|true|[Yy]*)
21337         usesitecustomize="$define"
21338         ;;
21339     *)
21340         usesitecustomize="$undef"
21341         ;;
21342     esac
21343
21344 : see if prototypes support variable argument declarations
21345 echo " "
21346 case "$prototype$i_stdarg" in
21347 $define$define)
21348         echo "It appears we'll be able to prototype varargs functions." >&4
21349         val="$define"
21350         ;;
21351 *)
21352         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21353         val="$undef"
21354         ;;
21355 esac
21356 set vaproto
21357 eval $setvar
21358
21359 : determine compiler compiler
21360 case "$yacc" in
21361 '')
21362         dflt=yacc;;
21363 *)
21364         dflt="$yacc";;
21365 esac
21366 echo " "
21367 comp='yacc'
21368 if $test -f "$byacc$_exe"; then
21369         dflt="$byacc"
21370         comp="byacc or $comp"
21371 fi
21372 if $test -f "$bison$_exe"; then
21373         comp="$comp or bison -y"
21374 fi
21375 rp="Which compiler compiler ($comp) shall I use?"
21376 . ./myread
21377 yacc="$ans"
21378 case "$yacc" in
21379 *bis*)
21380         case "$yacc" in
21381         *-y*) ;;
21382         *)
21383                 yacc="$yacc -y"
21384                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21385                 ;;
21386         esac
21387         ;;
21388 esac
21389
21390 : see if this is a assert.h system
21391 set assert.h i_assert
21392 eval $inhdr
21393
21394 : see if this is a fp.h system
21395 set fp.h i_fp
21396 eval $inhdr
21397
21398 : see if this is a fp_class.h system
21399 set fp_class.h i_fp_class
21400 eval $inhdr
21401
21402 : see if gdbm.h is available
21403 set gdbm.h t_gdbm
21404 eval $inhdr
21405 case "$t_gdbm" in
21406 $define)
21407         : see if gdbm_open exists
21408         set gdbm_open d_gdbm_open
21409         eval $inlibc
21410         case "$d_gdbm_open" in
21411         $undef)
21412                 t_gdbm="$undef"
21413                 echo "We won't be including <gdbm.h>"
21414                 ;;
21415         esac
21416         ;;
21417 esac
21418 val="$t_gdbm"
21419 set i_gdbm
21420 eval $setvar
21421
21422 : see if this is a ieeefp.h system
21423 case "$i_ieeefp" in
21424 '' ) set ieeefp.h i_ieeefp
21425      eval $inhdr
21426      ;;
21427 esac
21428
21429 : see if this is a libutil.h system
21430 set libutil.h i_libutil
21431 eval $inhdr
21432
21433 : see if mach cthreads are available
21434 if test "X$usethreads" = "X$define"; then
21435         set mach/cthreads.h i_machcthr
21436         eval $inhdr
21437 else
21438         i_machcthr="$undef"
21439 fi
21440
21441 : see if this is a mntent.h system
21442 set mntent.h i_mntent
21443 eval $inhdr
21444
21445 : see if net/errno.h is available
21446 val=''
21447 set net/errno.h val
21448 eval $inhdr
21449
21450 : Unfortunately, it causes problems on some systems.  Arrgh.
21451 case "$val" in
21452 $define)
21453         cat > try.c <<'EOM'
21454 #include <stdio.h>
21455 #include <errno.h>
21456 #include <net/errno.h>
21457 int func()
21458 {
21459         return ENOTSOCK;
21460 }
21461 EOM
21462         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21463                 echo "We'll be including <net/errno.h>." >&4
21464         else
21465                 echo "We won't be including <net/errno.h>." >&4
21466                 val="$undef"
21467         fi
21468         $rm_try
21469         ;;
21470 esac
21471 set i_neterrno
21472 eval $setvar
21473
21474 : see if netinet/tcp.h is available
21475 set netinet/tcp.h i_netinettcp
21476 eval $inhdr
21477
21478 : see if this is a poll.h system
21479 set poll.h i_poll
21480 eval $inhdr
21481
21482 : see if this is a prot.h system
21483 set prot.h i_prot
21484 eval $inhdr
21485
21486 : Preprocessor symbols
21487 echo " "
21488 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21489 $cat <<'EOSH' > Cppsym.know
21490 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21491 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21492 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21493 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21494 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21495 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21496 bull c cadmus clipper CMU COFF COMPILER_VERSION
21497 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21498 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21499 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21500 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21501 GLIBC GLIBC_MINOR
21502 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21503 H3050R H3050RX hbullx20 hcx host_mips
21504 hp200 hp300 hp700 HP700 hp800 hp9000
21505 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21506 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21507 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21508 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21509 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21510 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21511 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21512 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21513 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21514 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21515 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21516 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21517 MATH_HAS_NO_SIDE_EFFECTS
21518 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21519 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21520 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21521 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21522 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21523 NetBSD news1500 news1700 news1800 news1900 news3700
21524 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21525 ns32016 ns32332 ns32k nsc32000
21526 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21527 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21528 pc532 pdp11 PGC PIC plexus PORTAR posix
21529 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21530 POSIX_C_SOURCE POSIX_SOURCE POWER
21531 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21532 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21533 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21534 sony sony_news sonyrisc sparc sparclite spectrum
21535 stardent stdc STDC_EXT stratos sun sun3 sun386
21536 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21537 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21538 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21539 sysV68 sysV88 Tek4132 Tek4300 titan
21540 TM3200 TM5400 TM5600
21541 tower tower32 tower32_200 tower32_600 tower32_700
21542 tower32_800 tower32_850 tss
21543 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21544 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21545 unix UNIX95 UNIX99 unixpc unos
21546 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21547 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21548 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21549 USGr4 USGr4_2
21550 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21551 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21552 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21553 z8000
21554 EOSH
21555 # Maybe put other stuff here too.
21556 cat <<EOSH >>Cppsym.know
21557 $osname
21558 EOSH
21559 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21560 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21561 $cat Cppsym.know > Cppsym.c
21562 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21563 $rm -f Cppsym.a Cppsym.b Cppsym.c
21564 cat <<EOSH > Cppsym
21565 $startsh
21566 if $test \$# -gt 0; then
21567     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21568     if $test -s Cppsym.got; then
21569         $rm -f Cppsym.got
21570         exit 0
21571     fi
21572     $rm -f Cppsym.got
21573     exit 1
21574 else
21575     $tr " " "$trnl" | ./Cppsym.try
21576     exit 0
21577 fi
21578 EOSH
21579 chmod +x Cppsym
21580 $eunicefix Cppsym
21581 cat <<EOSH > Cppsym.try
21582 $startsh
21583 cat <<'EOCP' > try.c
21584 #include <stdio.h>
21585 #if cpp_stuff == 1
21586 #define STRINGIFY(a)    "a"
21587 #endif
21588 #if cpp_stuff == 42
21589 #define StGiFy(a)  #a
21590 #define STRINGIFY(a)    StGiFy(a)
21591 #endif
21592 #if $cpp_stuff != 1 && $cpp_stuff != 42
21593 #   include "Bletch: How does this C preprocessor stringify macros?"
21594 #endif
21595 int main() {
21596 EOCP
21597 $awk \\
21598 EOSH
21599 cat <<'EOSH' >> Cppsym.try
21600 'length($1) > 0 {
21601     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21602     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21603     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21604     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21605 }'       >> try.c
21606 echo 'return 0;}' >> try.c
21607 EOSH
21608 cat <<EOSH >> Cppsym.try
21609 ccflags="$ccflags"
21610 case "$osname-$gccversion" in
21611 irix-) ccflags="\$ccflags -woff 1178" ;;
21612 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21613 esac
21614 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21615 EOSH
21616 chmod +x Cppsym.try
21617 $eunicefix Cppsym.try
21618 ./Cppsym < Cppsym.know > Cppsym.true
21619 : Add in any linux cpp "predefined macros":
21620 case "$osname::$gccversion" in
21621   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21622     tHdrH=_tmpHdr
21623     rm -f $tHdrH'.h' $tHdrH
21624     touch $tHdrH'.h'
21625     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21626        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21627        if [ -s $tHdrH'_cppsym.real' ]; then
21628           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21629        fi
21630     fi
21631     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21632   ;;
21633 esac
21634 : now check the C compiler for additional symbols
21635 postprocess_cc_v=''
21636 case "$osname" in
21637 aix) postprocess_cc_v="|$tr , ' '" ;;
21638 esac
21639 $cat >ccsym <<EOS
21640 $startsh
21641 $cat >tmp.c <<EOF
21642 extern int foo;
21643 EOF
21644 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21645 do
21646         case "\$i" in
21647         -D*) echo "\$i" | $sed 's/^-D//';;
21648         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21649         esac
21650 done
21651 $rm_try
21652 EOS
21653 postprocess_cc_v=''
21654 chmod +x ccsym
21655 $eunicefix ccsym
21656 ./ccsym > ccsym1.raw
21657 if $test -s ccsym1.raw; then
21658        $sort ccsym1.raw | $uniq >ccsym.raw
21659 else
21660        mv ccsym1.raw ccsym.raw
21661 fi
21662
21663 $awk '/\=/ { print $0; next }
21664         { print $0"=1" }' ccsym.raw >ccsym.list
21665 $comm -13 Cppsym.true ccsym.list >ccsym.own
21666 $comm -12 Cppsym.true ccsym.list >ccsym.com
21667 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21668 also=''
21669 if $test -z ccsym.raw; then
21670         echo "Your C compiler doesn't seem to define any symbols!" >&4
21671         echo " "
21672         echo "However, your C preprocessor defines the following symbols:"
21673         $cat Cppsym.true
21674         ccsymbols=''
21675         cppsymbols=`$cat Cppsym.true`
21676         cppsymbols=`echo $cppsymbols`
21677         cppccsymbols="$cppsymbols"
21678 else
21679         if $test -s ccsym.com; then
21680                 echo "Your C compiler and pre-processor define these symbols:"
21681                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21682                 also='also '
21683                 symbols='ones'
21684                 cppccsymbols=`$cat ccsym.com`
21685                 cppccsymbols=`echo $cppccsymbols`
21686                 $test "$silent" || sleep 1
21687         fi
21688         if $test -s ccsym.cpp; then
21689                 $test "$also" && echo " "
21690                 echo "Your C pre-processor ${also}defines the following symbols:"
21691                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21692                 also='further '
21693                 cppsymbols=`$cat ccsym.cpp`
21694                 cppsymbols=`echo $cppsymbols`
21695                 $test "$silent" || sleep 1
21696         fi
21697         if $test -s ccsym.own; then
21698                 $test "$also" && echo " "
21699                 echo "Your C compiler ${also}defines the following cpp symbols:"
21700                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21701                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21702                 ccsymbols=`$cat ccsym.own`
21703                 ccsymbols=`echo $ccsymbols`
21704                 $test "$silent" || sleep 1
21705         fi
21706 fi
21707
21708 : see if this is a termio system
21709 val="$undef"
21710 val2="$undef"
21711 val3="$undef"
21712 if $test `./findhdr termios.h`; then
21713         set tcsetattr i_termios
21714         eval $inlibc
21715         val3="$i_termios"
21716 fi
21717 echo " "
21718 case "$val3" in
21719 "$define") echo "You have POSIX termios.h... good!" >&4;;
21720 *) if ./Cppsym pyr; then
21721                 case "`/bin/universe`" in
21722                 ucb) if $test `./findhdr sgtty.h`; then
21723                                 val2="$define"
21724                                 echo "<sgtty.h> found." >&4
21725                         else
21726                                 echo "System is pyramid with BSD universe."
21727                                 ./warn "<sgtty.h> not found--you could have problems."
21728                         fi;;
21729                 *) if $test `./findhdr termio.h`; then
21730                                 val="$define"
21731                                 echo "<termio.h> found." >&4
21732                         else
21733                                 echo "System is pyramid with USG universe."
21734                                 ./warn "<termio.h> not found--you could have problems."
21735                         fi;;
21736                 esac
21737         elif ./usg; then
21738                 if $test `./findhdr termio.h`; then
21739                         echo "<termio.h> found." >&4
21740                         val="$define"
21741                 elif $test `./findhdr sgtty.h`; then
21742                         echo "<sgtty.h> found." >&4
21743                         val2="$define"
21744                 else
21745                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21746                 fi
21747         else
21748                 if $test `./findhdr sgtty.h`; then
21749                         echo "<sgtty.h> found." >&4
21750                         val2="$define"
21751                 elif $test `./findhdr termio.h`; then
21752                         echo "<termio.h> found." >&4
21753                         val="$define"
21754                 else
21755                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21756                 fi
21757         fi;;
21758 esac
21759 set i_termio; eval $setvar
21760 val=$val2; set i_sgtty; eval $setvar
21761 val=$val3; set i_termios; eval $setvar
21762
21763 : see if stddef is available
21764 set stddef.h i_stddef
21765 eval $inhdr
21766
21767 : see if sys/access.h is available
21768 set sys/access.h i_sysaccess
21769 eval $inhdr
21770
21771 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21772 set sys/filio.h i_sysfilio
21773 eval $inhdr
21774 echo " "
21775 if $test `./findhdr sys/ioctl.h`; then
21776         val="$define"
21777         echo '<sys/ioctl.h> found.' >&4
21778 else
21779         val="$undef"
21780         if $test $i_sysfilio = "$define"; then
21781             echo '<sys/ioctl.h> NOT found.' >&4
21782         else
21783                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21784                 $test $i_termio = "$define" && xxx="termio.h"
21785                 $test $i_termios = "$define" && xxx="termios.h"
21786 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21787         fi
21788 fi
21789 set i_sysioctl
21790 eval $setvar
21791
21792 : see if socket ioctl defs are in sys/sockio.h
21793 echo " "
21794 xxx=`./findhdr sys/sockio.h`
21795 if $test "$xxx"; then
21796         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21797                 val="$define"
21798                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21799         else
21800                 val="$undef"
21801                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21802         fi
21803 else
21804         val="$undef"
21805         $cat <<EOM
21806 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21807 EOM
21808 fi
21809 set i_syssockio
21810 eval $setvar
21811
21812 : see if this is a syslog.h system
21813 set syslog.h i_syslog
21814 eval $inhdr
21815
21816 : see if this is a sys/mode.h system
21817 set sys/mode.h i_sysmode
21818 eval $inhdr
21819
21820 : see if there is a sys/poll.h file
21821 set sys/poll.h i_syspoll
21822 eval $inhdr
21823
21824 : see if sys/resource.h has to be included
21825 set sys/resource.h i_sysresrc
21826 eval $inhdr
21827
21828 : see if sys/security.h is available
21829 set sys/security.h i_syssecrt
21830 eval $inhdr
21831
21832 : see if this is a sys/statvfs.h system
21833 set sys/statvfs.h i_sysstatvfs
21834 eval $inhdr
21835
21836 : see if this is a sys/un.h system
21837 set sys/un.h i_sysun
21838 eval $inhdr
21839
21840 : see if this is a sys/utsname.h system
21841 set sys/utsname.h i_sysutsname
21842 eval $inhdr
21843
21844 : see if this is a syswait system
21845 set sys/wait.h i_syswait
21846 eval $inhdr
21847
21848 : see if this is a ustat.h system
21849 set ustat.h i_ustat
21850 eval $inhdr
21851
21852 : see if this is an utime system
21853 set utime.h i_utime
21854 eval $inhdr
21855
21856 : see if this is a vfork system
21857 case "$d_vfork" in
21858 "$define")
21859         set vfork.h i_vfork
21860         eval $inhdr
21861         ;;
21862 *)
21863         i_vfork="$undef"
21864         ;;
21865 esac
21866
21867 : Check extensions
21868 echo " "
21869 echo "Looking for extensions..." >&4
21870 : If we are using the old config.sh, known_extensions may contain
21871 : old or inaccurate or duplicate values.
21872 known_extensions=''
21873 nonxs_extensions=''
21874 : We do not use find because it might not be available.
21875 : We do not just use MANIFEST because the user may have dropped
21876 : some additional extensions into the source tree and expect them
21877 : to be built.
21878
21879 : Function to recursively find available extensions, ignoring DynaLoader
21880 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21881 : In 5.10.1 and later, extensions are stored in directories
21882 : like File-Glob instead of the older File/Glob/.
21883 find_extensions='
21884     for xxx in *; do
21885         case "$xxx" in
21886             DynaLoader|dynaload) ;;
21887             *)
21888             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21889             leaf=`echo $xxx | $sed -e s/.*-//`;
21890             if $test -d File; then
21891                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21892                     known_extensions="$known_extensions $1$this_ext";
21893                 elif $test -f $xxx/Makefile.PL; then
21894                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21895                 else
21896                     if $test -d $xxx -a $# -lt 10; then
21897                         set $1$xxx/ $*;
21898                         cd "$xxx";
21899                         eval $find_extensions;
21900                         cd ..;
21901                         shift;
21902                     fi;
21903                 fi;
21904             else
21905                 $ls -1 $xxx > $$.tmp;
21906                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21907                     known_extensions="$known_extensions $this_ext";
21908                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21909                     known_extensions="$known_extensions $this_ext";
21910                 elif $test -d $xxx; then
21911                     nonxs_extensions="$nonxs_extensions $this_ext";
21912                 fi;
21913                 $rm -f $$.tmp;
21914             fi
21915             ;;
21916         esac;
21917     done'
21918 tdir=`pwd`
21919 cd "$rsrc/cpan"
21920 set X
21921 shift
21922 eval $find_extensions
21923 cd "$rsrc/dist"
21924 set X
21925 shift
21926 eval $find_extensions
21927 cd "$rsrc/ext"
21928 set X
21929 shift
21930 eval $find_extensions
21931 if $test -d File-Glob; then
21932     : All ext/ flattened
21933 else
21934     # Special case:  Add in modules that nest beyond the first level.
21935     # Currently threads/shared and Hash/Util/FieldHash, since they are
21936     # not picked up by the recursive find above (and adding in general
21937     # recursive finding breaks SDBM_File/sdbm).
21938     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21939     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21940 fi
21941 set X $known_extensions
21942 shift
21943 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21944 set X $nonxs_extensions
21945 shift
21946 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21947 cd "$tdir"
21948
21949 : Now see which are supported on this system.
21950 avail_ext=''
21951 for xxx in $known_extensions ; do
21952         case "$xxx" in
21953         DB_File|db_file)
21954                 case "$i_db" in
21955                 $define) avail_ext="$avail_ext $xxx" ;;
21956                 esac
21957                 ;;
21958         GDBM_File|gdbm_fil)
21959                 case "$i_gdbm" in
21960                 $define) avail_ext="$avail_ext $xxx" ;;
21961                 esac
21962                 ;;
21963         I18N/Langinfo|i18n_lan)
21964                 case "$i_langinfo$d_nl_langinfo" in
21965                 $define$define) avail_ext="$avail_ext $xxx" ;;
21966                 esac
21967                 ;;
21968         IPC/SysV|ipc/sysv)
21969                 : XXX Do we need a useipcsysv variable here
21970                 case "${d_msg}${d_sem}${d_shm}" in
21971                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21972                 esac
21973                 ;;
21974         NDBM_File|ndbm_fil)
21975                 case "$d_ndbm" in
21976                 $define)
21977                     case "$osname-$use64bitint" in
21978                     hpux-define)
21979                         case "$libs" in
21980                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21981                         esac
21982                         ;;
21983                     *) avail_ext="$avail_ext $xxx" ;;
21984                     esac
21985                     ;;
21986                 esac
21987                 ;;
21988         ODBM_File|odbm_fil)
21989                 case "${i_dbm}${i_rpcsvcdbm}" in
21990                 *"${define}"*)
21991                     case "$d_cplusplus" in
21992                     define) ;; # delete as a function name will not work
21993                     *)  case "$osname-$use64bitint" in
21994                         hpux-define)
21995                             case "$libs" in
21996                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21997                             esac
21998                             ;;
21999                         *) avail_ext="$avail_ext $xxx" ;;
22000                         esac
22001                         ;;
22002                     esac
22003                     ;;
22004                 esac
22005                 ;;
22006         Opcode|opcode)
22007                 case "$useopcode" in
22008                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22009                 esac
22010                 ;;
22011         POSIX|posix)
22012                 case "$useposix" in
22013                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22014                 esac
22015                 ;;
22016         Socket|socket)
22017                 case "$d_socket" in
22018                 true|$define|y)
22019                     case "$osname" in
22020                     beos) ;; # not unless BONE
22021                     *) avail_ext="$avail_ext $xxx" ;;
22022                     esac
22023                     ;;
22024                 esac
22025                 ;;
22026         Sys/Syslog|sys/syslog)
22027                 : XXX syslog requires socket
22028                 case "$d_socket" in
22029                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22030                 esac
22031                 ;;
22032         Thread|thread)
22033                 case "$usethreads" in
22034                 true|$define|y)
22035                         case "$use5005threads" in
22036                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22037                         esac
22038                 esac
22039                 ;;
22040         threads|threads/shared)
22041                 # threads and threads::shared are special cases.
22042                 # To stop people from asking "Perl 5.8.0 was supposed
22043                 # to have this new fancy threads implementation but my
22044                 # perl doesn't have it" and from people trying to
22045                 # (re)install the threads module using CPAN.pm and
22046                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22047                 # the threads.pm and threads/shared.pm will always be
22048                 # there, croaking informatively ("you need to rebuild
22049                 # all of Perl with threads, sorry") when threads haven't
22050                 # been compiled in.
22051                 # --jhi
22052                 avail_ext="$avail_ext $xxx"
22053                 ;;
22054         VMS*)
22055                 ;;
22056         Win32*)
22057                 case "$osname" in
22058                 cygwin) avail_ext="$avail_ext $xxx" ;;
22059                 esac
22060                 ;;
22061         XS/APItest|xs/apitest)
22062                 # This is just for testing.  Skip it unless we have dynamic loading.
22063
22064                 case "$usedl" in
22065                 $define) avail_ext="$avail_ext $xxx" ;;
22066                 esac
22067                 ;;
22068         XS/Typemap|xs/typemap)
22069                 # This is just for testing.  Skip it unless we have dynamic loading.
22070                 case "$usedl" in
22071                 $define) avail_ext="$avail_ext $xxx" ;;
22072                 esac
22073                 ;;
22074         *)      avail_ext="$avail_ext $xxx"
22075                 ;;
22076         esac
22077 done
22078
22079 set X $avail_ext
22080 shift
22081 avail_ext="$*"
22082
22083 case "$onlyextensions" in
22084 '') ;;
22085 *)  keepextensions=''
22086     echo "You have requested that only certains extensions be included..." >&4
22087     for i in $onlyextensions; do
22088         case " $avail_ext " in
22089         *" $i "*)
22090             echo "Keeping extension $i."
22091             keepextensions="$keepextensions $i"
22092             ;;
22093         *) echo "Ignoring extension $i." ;;
22094         esac
22095     done
22096     avail_ext="$keepextensions"
22097     ;;
22098 esac
22099
22100 case "$noextensions" in
22101 '') ;;
22102 *)  keepextensions=''
22103     echo "You have requested that certain extensions be ignored..." >&4
22104     for i in $avail_ext; do
22105         case " $noextensions " in
22106         *" $i "*) echo "Ignoring extension $i." ;;
22107         *) echo "Keeping extension $i.";
22108            keepextensions="$keepextensions $i"
22109            ;;
22110         esac
22111     done
22112     avail_ext="$keepextensions"
22113     ;;
22114 esac
22115
22116 : Now see which nonxs extensions are supported on this system.
22117 : For now assume all are.
22118 nonxs_ext=''
22119 for xxx in $nonxs_extensions ; do
22120         case "$xxx" in
22121         *)      nonxs_ext="$nonxs_ext $xxx"
22122                 ;;
22123         esac
22124 done
22125
22126 set X $nonxs_ext
22127 shift
22128 nonxs_ext="$*"
22129
22130 case $usedl in
22131 $define)
22132         $cat <<EOM
22133 A number of extensions are supplied with $package.  You may choose to
22134 compile these extensions for dynamic loading (the default), compile
22135 them into the $package executable (static loading), or not include
22136 them at all.  Answer "none" to include no extensions.
22137 Note that DynaLoader is always built and need not be mentioned here.
22138
22139 EOM
22140         case "$dynamic_ext" in
22141         '')
22142                 : Exclude those listed in static_ext
22143                 dflt=''
22144                 for xxx in $avail_ext; do
22145                         case " $static_ext " in
22146                         *" $xxx "*) ;;
22147                         *) dflt="$dflt $xxx" ;;
22148                         esac
22149                 done
22150                 set X $dflt
22151                 shift
22152                 dflt="$*"
22153                 ;;
22154         *)      dflt="$dynamic_ext"
22155                 # Perhaps we are reusing an old out-of-date config.sh.
22156                 case "$hint" in
22157                 previous)
22158                         if test X"$dynamic_ext" != X"$avail_ext"; then
22159                                 $cat <<EOM
22160 NOTICE:  Your previous config.sh list may be incorrect.
22161 The extensions now available to you are
22162         ${avail_ext}
22163 but the default list from your previous config.sh is
22164         ${dynamic_ext}
22165
22166 EOM
22167                         fi
22168                         ;;
22169                 esac
22170                 ;;
22171         esac
22172         case "$dflt" in
22173         '')     dflt=none;;
22174         esac
22175         rp="What extensions do you wish to load dynamically?"
22176         . ./myread
22177         case "$ans" in
22178         none) dynamic_ext=' ' ;;
22179         *) dynamic_ext="$ans" ;;
22180         esac
22181
22182         case "$static_ext" in
22183         '')
22184                 : Exclude those already listed in dynamic linking
22185                 dflt=''
22186                 for xxx in $avail_ext; do
22187                         case " $dynamic_ext " in
22188                         *" $xxx "*) ;;
22189                         *) dflt="$dflt $xxx" ;;
22190                         esac
22191                 done
22192                 set X $dflt
22193                 shift
22194                 dflt="$*"
22195                 ;;
22196         *)  dflt="$static_ext"
22197                 ;;
22198         esac
22199
22200         case "$dflt" in
22201         '')     dflt=none;;
22202         esac
22203         rp="What extensions do you wish to load statically?"
22204         . ./myread
22205         case "$ans" in
22206         none) static_ext=' ' ;;
22207         *) static_ext="$ans" ;;
22208         esac
22209         ;;
22210 *)
22211         $cat <<EOM
22212 A number of extensions are supplied with $package.  Answer "none"
22213 to include no extensions.
22214 Note that DynaLoader is always built and need not be mentioned here.
22215
22216 EOM
22217         case "$static_ext" in
22218         '') dflt="$avail_ext" ;;
22219         *)      dflt="$static_ext"
22220                 # Perhaps we are reusing an old out-of-date config.sh.
22221                 case "$hint" in
22222                 previous)
22223                         if test X"$static_ext" != X"$avail_ext"; then
22224                                 $cat <<EOM
22225 NOTICE:  Your previous config.sh list may be incorrect.
22226 The extensions now available to you are
22227         ${avail_ext}
22228 but the default list from your previous config.sh is
22229         ${static_ext}
22230
22231 EOM
22232                         fi
22233                         ;;
22234                 esac
22235                 ;;
22236         esac
22237         : Exclude those that are not xs extensions
22238         case "$dflt" in
22239         '')     dflt=none;;
22240         esac
22241         rp="What extensions do you wish to include?"
22242         . ./myread
22243         case "$ans" in
22244         none) static_ext=' ' ;;
22245         *) static_ext="$ans" ;;
22246         esac
22247         ;;
22248 esac
22249 #
22250 # Encode is a special case.  If we are building Encode as a static
22251 # extension, we need to explicitly list its subextensions as well.
22252 # For other nested extensions, this is handled automatically by
22253 # the appropriate Makefile.PL.
22254 case " $static_ext " in
22255         *" Encode "*) # Add the subextensions of Encode
22256         cd "$rsrc/cpan"
22257         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22258                 static_ext="$static_ext Encode/$xxx"
22259         done
22260         cd "$tdir"
22261         ;;
22262 esac
22263
22264 set X $dynamic_ext $static_ext $nonxs_ext
22265 shift
22266 extensions="$*"
22267
22268 # Sanity check:  We require an extension suitable for use with
22269 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22270 # should show up as failures in the test suite, but it's helpful to
22271 # catch them now.) The 'extensions' list is normally sorted
22272 # alphabetically, so we need to accept either
22273 #    DB_File ... Fcntl ... IO  ....
22274 # or something like
22275 #    Fcntl ... NDBM_File ... IO  ....
22276 case " $extensions"  in
22277 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22278 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22279 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22280 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22281    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22282    ;;
22283 esac
22284
22285 : Remove libraries needed only for extensions
22286 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22287 : The exception is SunOS 4.x, which needs them.
22288 case "${osname}X${osvers}" in
22289 sunos*X4*)
22290     perllibs="$libs"
22291     ;;
22292 *) case "$usedl" in
22293     $define|true|[yY]*)
22294             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22295             shift
22296             perllibs="$*"
22297             ;;
22298     *)  perllibs="$libs"
22299             ;;
22300     esac
22301     ;;
22302 esac
22303
22304 : Remove build directory name from cppstdin so it can be used from
22305 : either the present location or the final installed location.
22306 echo " "
22307 : Get out of the UU directory to get correct path name.
22308 cd ..
22309 case "$cppstdin" in
22310 `pwd`/cppstdin)
22311         echo "Stripping down cppstdin path name"
22312         cppstdin=cppstdin
22313         ;;
22314 esac
22315 cd UU
22316
22317 : end of configuration questions
22318 echo " "
22319 echo "End of configuration questions."
22320 echo " "
22321
22322 : back to where it started
22323 if test -d ../UU; then
22324         cd ..
22325 fi
22326
22327 : configuration may be unconditionally patched via a 'config.arch' file
22328 if $test -f config.arch; then
22329         echo "I see a config.arch file, loading it." >&4
22330         . ./config.arch
22331 fi
22332
22333 : configuration may be patched via a 'config.over' file
22334 if $test -f config.over; then
22335         echo " "
22336         dflt=y
22337         rp='I see a config.over file.  Do you wish to load it?'
22338         . UU/myread
22339         case "$ans" in
22340         n*) echo "OK, I'll ignore it.";;
22341         *)      . ./config.over
22342                 echo "Configuration override changes have been loaded."
22343                 ;;
22344         esac
22345 fi
22346
22347 : in case they want portability, strip down executable paths
22348 case "$d_portable" in
22349 "$define")
22350         echo " "
22351         echo "Stripping down executable paths..." >&4
22352         for file in $loclist $trylist; do
22353                 eval temp=\$$file
22354                 eval $file=`basename $temp`
22355         done
22356         ;;
22357 esac
22358
22359 : create config.sh file
22360 echo " "
22361 echo "Creating config.sh..." >&4
22362 $spitshell <<EOT >config.sh
22363 $startsh
22364 #
22365 # This file was produced by running the Configure script. It holds all the
22366 # definitions figured out by Configure. Should you modify one of these values,
22367 # do not forget to propagate your changes by running "Configure -der". You may
22368 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22369 #
22370
22371 # Package name      : $package
22372 # Source directory  : $src
22373 # Configuration time: $cf_time
22374 # Configured by     : $cf_by
22375 # Target system     : $myuname
22376
22377 EOT
22378 : Add in command line options if available
22379 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22380
22381 $spitshell <<EOT >>config.sh
22382
22383 Author='$Author'
22384 Date='$Date'
22385 Header='$Header'
22386 Id='$Id'
22387 Locker='$Locker'
22388 Log='$Log'
22389 RCSfile='$RCSfile'
22390 Revision='$Revision'
22391 Source='$Source'
22392 State='$State'
22393 _a='$_a'
22394 _exe='$_exe'
22395 _o='$_o'
22396 afs='$afs'
22397 afsroot='$afsroot'
22398 alignbytes='$alignbytes'
22399 ansi2knr='$ansi2knr'
22400 aphostname='$aphostname'
22401 api_revision='$api_revision'
22402 api_subversion='$api_subversion'
22403 api_version='$api_version'
22404 api_versionstring='$api_versionstring'
22405 ar='$ar'
22406 archlib='$archlib'
22407 archlibexp='$archlibexp'
22408 archname64='$archname64'
22409 archname='$archname'
22410 archobjs='$archobjs'
22411 asctime_r_proto='$asctime_r_proto'
22412 awk='$awk'
22413 baserev='$baserev'
22414 bash='$bash'
22415 bin='$bin'
22416 bin_ELF='$bin_ELF'
22417 binexp='$binexp'
22418 bison='$bison'
22419 byacc='$byacc'
22420 byteorder='$byteorder'
22421 c='$c'
22422 castflags='$castflags'
22423 cat='$cat'
22424 cc='$cc'
22425 cccdlflags='$cccdlflags'
22426 ccdlflags='$ccdlflags'
22427 ccflags='$ccflags'
22428 ccflags_uselargefiles='$ccflags_uselargefiles'
22429 ccname='$ccname'
22430 ccsymbols='$ccsymbols'
22431 ccversion='$ccversion'
22432 cf_by='$cf_by'
22433 cf_email='$cf_email'
22434 cf_time='$cf_time'
22435 charbits='$charbits'
22436 charsize='$charsize'
22437 chgrp='$chgrp'
22438 chmod='$chmod'
22439 chown='$chown'
22440 clocktype='$clocktype'
22441 comm='$comm'
22442 compress='$compress'
22443 contains='$contains'
22444 cp='$cp'
22445 cpio='$cpio'
22446 cpp='$cpp'
22447 cpp_stuff='$cpp_stuff'
22448 cppccsymbols='$cppccsymbols'
22449 cppflags='$cppflags'
22450 cpplast='$cpplast'
22451 cppminus='$cppminus'
22452 cpprun='$cpprun'
22453 cppstdin='$cppstdin'
22454 cppsymbols='$cppsymbols'
22455 crypt_r_proto='$crypt_r_proto'
22456 cryptlib='$cryptlib'
22457 csh='$csh'
22458 ctermid_r_proto='$ctermid_r_proto'
22459 ctime_r_proto='$ctime_r_proto'
22460 d_Gconvert='$d_Gconvert'
22461 d_PRIEUldbl='$d_PRIEUldbl'
22462 d_PRIFUldbl='$d_PRIFUldbl'
22463 d_PRIGUldbl='$d_PRIGUldbl'
22464 d_PRIXU64='$d_PRIXU64'
22465 d_PRId64='$d_PRId64'
22466 d_PRIeldbl='$d_PRIeldbl'
22467 d_PRIfldbl='$d_PRIfldbl'
22468 d_PRIgldbl='$d_PRIgldbl'
22469 d_PRIi64='$d_PRIi64'
22470 d_PRIo64='$d_PRIo64'
22471 d_PRIu64='$d_PRIu64'
22472 d_PRIx64='$d_PRIx64'
22473 d_SCNfldbl='$d_SCNfldbl'
22474 d__fwalk='$d__fwalk'
22475 d_access='$d_access'
22476 d_accessx='$d_accessx'
22477 d_aintl='$d_aintl'
22478 d_alarm='$d_alarm'
22479 d_archlib='$d_archlib'
22480 d_asctime64='$d_asctime64'
22481 d_asctime_r='$d_asctime_r'
22482 d_atolf='$d_atolf'
22483 d_atoll='$d_atoll'
22484 d_attribute_deprecated='$d_attribute_deprecated'
22485 d_attribute_format='$d_attribute_format'
22486 d_attribute_malloc='$d_attribute_malloc'
22487 d_attribute_nonnull='$d_attribute_nonnull'
22488 d_attribute_noreturn='$d_attribute_noreturn'
22489 d_attribute_pure='$d_attribute_pure'
22490 d_attribute_unused='$d_attribute_unused'
22491 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22492 d_bcmp='$d_bcmp'
22493 d_bcopy='$d_bcopy'
22494 d_bsd='$d_bsd'
22495 d_bsdgetpgrp='$d_bsdgetpgrp'
22496 d_bsdsetpgrp='$d_bsdsetpgrp'
22497 d_builtin_choose_expr='$d_builtin_choose_expr'
22498 d_builtin_expect='$d_builtin_expect'
22499 d_bzero='$d_bzero'
22500 d_c99_variadic_macros='$d_c99_variadic_macros'
22501 d_casti32='$d_casti32'
22502 d_castneg='$d_castneg'
22503 d_charvspr='$d_charvspr'
22504 d_chown='$d_chown'
22505 d_chroot='$d_chroot'
22506 d_chsize='$d_chsize'
22507 d_class='$d_class'
22508 d_clearenv='$d_clearenv'
22509 d_closedir='$d_closedir'
22510 d_cmsghdr_s='$d_cmsghdr_s'
22511 d_const='$d_const'
22512 d_copysignl='$d_copysignl'
22513 d_cplusplus='$d_cplusplus'
22514 d_crypt='$d_crypt'
22515 d_crypt_r='$d_crypt_r'
22516 d_csh='$d_csh'
22517 d_ctermid='$d_ctermid'
22518 d_ctermid_r='$d_ctermid_r'
22519 d_ctime64='$d_ctime64'
22520 d_ctime_r='$d_ctime_r'
22521 d_cuserid='$d_cuserid'
22522 d_dbl_dig='$d_dbl_dig'
22523 d_dbminitproto='$d_dbminitproto'
22524 d_difftime64='$d_difftime64'
22525 d_difftime='$d_difftime'
22526 d_dir_dd_fd='$d_dir_dd_fd'
22527 d_dirfd='$d_dirfd'
22528 d_dirnamlen='$d_dirnamlen'
22529 d_dlerror='$d_dlerror'
22530 d_dlopen='$d_dlopen'
22531 d_dlsymun='$d_dlsymun'
22532 d_dosuid='$d_dosuid'
22533 d_drand48_r='$d_drand48_r'
22534 d_drand48proto='$d_drand48proto'
22535 d_dup2='$d_dup2'
22536 d_eaccess='$d_eaccess'
22537 d_endgrent='$d_endgrent'
22538 d_endgrent_r='$d_endgrent_r'
22539 d_endhent='$d_endhent'
22540 d_endhostent_r='$d_endhostent_r'
22541 d_endnent='$d_endnent'
22542 d_endnetent_r='$d_endnetent_r'
22543 d_endpent='$d_endpent'
22544 d_endprotoent_r='$d_endprotoent_r'
22545 d_endpwent='$d_endpwent'
22546 d_endpwent_r='$d_endpwent_r'
22547 d_endsent='$d_endsent'
22548 d_endservent_r='$d_endservent_r'
22549 d_eofnblk='$d_eofnblk'
22550 d_eunice='$d_eunice'
22551 d_faststdio='$d_faststdio'
22552 d_fchdir='$d_fchdir'
22553 d_fchmod='$d_fchmod'
22554 d_fchown='$d_fchown'
22555 d_fcntl='$d_fcntl'
22556 d_fcntl_can_lock='$d_fcntl_can_lock'
22557 d_fd_macros='$d_fd_macros'
22558 d_fd_set='$d_fd_set'
22559 d_fds_bits='$d_fds_bits'
22560 d_fgetpos='$d_fgetpos'
22561 d_finite='$d_finite'
22562 d_finitel='$d_finitel'
22563 d_flexfnam='$d_flexfnam'
22564 d_flock='$d_flock'
22565 d_flockproto='$d_flockproto'
22566 d_fork='$d_fork'
22567 d_fp_class='$d_fp_class'
22568 d_fpathconf='$d_fpathconf'
22569 d_fpclass='$d_fpclass'
22570 d_fpclassify='$d_fpclassify'
22571 d_fpclassl='$d_fpclassl'
22572 d_fpos64_t='$d_fpos64_t'
22573 d_frexpl='$d_frexpl'
22574 d_fs_data_s='$d_fs_data_s'
22575 d_fseeko='$d_fseeko'
22576 d_fsetpos='$d_fsetpos'
22577 d_fstatfs='$d_fstatfs'
22578 d_fstatvfs='$d_fstatvfs'
22579 d_fsync='$d_fsync'
22580 d_ftello='$d_ftello'
22581 d_ftime='$d_ftime'
22582 d_futimes='$d_futimes'
22583 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22584 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22585 d_getaddrinfo='$d_getaddrinfo'
22586 d_getcwd='$d_getcwd'
22587 d_getespwnam='$d_getespwnam'
22588 d_getfsstat='$d_getfsstat'
22589 d_getgrent='$d_getgrent'
22590 d_getgrent_r='$d_getgrent_r'
22591 d_getgrgid_r='$d_getgrgid_r'
22592 d_getgrnam_r='$d_getgrnam_r'
22593 d_getgrps='$d_getgrps'
22594 d_gethbyaddr='$d_gethbyaddr'
22595 d_gethbyname='$d_gethbyname'
22596 d_gethent='$d_gethent'
22597 d_gethname='$d_gethname'
22598 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22599 d_gethostbyname_r='$d_gethostbyname_r'
22600 d_gethostent_r='$d_gethostent_r'
22601 d_gethostprotos='$d_gethostprotos'
22602 d_getitimer='$d_getitimer'
22603 d_getlogin='$d_getlogin'
22604 d_getlogin_r='$d_getlogin_r'
22605 d_getmnt='$d_getmnt'
22606 d_getmntent='$d_getmntent'
22607 d_getnameinfo='$d_getnameinfo'
22608 d_getnbyaddr='$d_getnbyaddr'
22609 d_getnbyname='$d_getnbyname'
22610 d_getnent='$d_getnent'
22611 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22612 d_getnetbyname_r='$d_getnetbyname_r'
22613 d_getnetent_r='$d_getnetent_r'
22614 d_getnetprotos='$d_getnetprotos'
22615 d_getpagsz='$d_getpagsz'
22616 d_getpbyname='$d_getpbyname'
22617 d_getpbynumber='$d_getpbynumber'
22618 d_getpent='$d_getpent'
22619 d_getpgid='$d_getpgid'
22620 d_getpgrp2='$d_getpgrp2'
22621 d_getpgrp='$d_getpgrp'
22622 d_getppid='$d_getppid'
22623 d_getprior='$d_getprior'
22624 d_getprotobyname_r='$d_getprotobyname_r'
22625 d_getprotobynumber_r='$d_getprotobynumber_r'
22626 d_getprotoent_r='$d_getprotoent_r'
22627 d_getprotoprotos='$d_getprotoprotos'
22628 d_getprpwnam='$d_getprpwnam'
22629 d_getpwent='$d_getpwent'
22630 d_getpwent_r='$d_getpwent_r'
22631 d_getpwnam_r='$d_getpwnam_r'
22632 d_getpwuid_r='$d_getpwuid_r'
22633 d_getsbyname='$d_getsbyname'
22634 d_getsbyport='$d_getsbyport'
22635 d_getsent='$d_getsent'
22636 d_getservbyname_r='$d_getservbyname_r'
22637 d_getservbyport_r='$d_getservbyport_r'
22638 d_getservent_r='$d_getservent_r'
22639 d_getservprotos='$d_getservprotos'
22640 d_getspnam='$d_getspnam'
22641 d_getspnam_r='$d_getspnam_r'
22642 d_gettimeod='$d_gettimeod'
22643 d_gmtime64='$d_gmtime64'
22644 d_gmtime_r='$d_gmtime_r'
22645 d_gnulibc='$d_gnulibc'
22646 d_grpasswd='$d_grpasswd'
22647 d_hasmntopt='$d_hasmntopt'
22648 d_htonl='$d_htonl'
22649 d_ilogbl='$d_ilogbl'
22650 d_inc_version_list='$d_inc_version_list'
22651 d_index='$d_index'
22652 d_inetaton='$d_inetaton'
22653 d_inetntop='$d_inetntop'
22654 d_inetpton='$d_inetpton'
22655 d_int64_t='$d_int64_t'
22656 d_isascii='$d_isascii'
22657 d_isfinite='$d_isfinite'
22658 d_isinf='$d_isinf'
22659 d_isnan='$d_isnan'
22660 d_isnanl='$d_isnanl'
22661 d_killpg='$d_killpg'
22662 d_lchown='$d_lchown'
22663 d_ldbl_dig='$d_ldbl_dig'
22664 d_libm_lib_version='$d_libm_lib_version'
22665 d_link='$d_link'
22666 d_localtime64='$d_localtime64'
22667 d_localtime_r='$d_localtime_r'
22668 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22669 d_locconv='$d_locconv'
22670 d_lockf='$d_lockf'
22671 d_longdbl='$d_longdbl'
22672 d_longlong='$d_longlong'
22673 d_lseekproto='$d_lseekproto'
22674 d_lstat='$d_lstat'
22675 d_madvise='$d_madvise'
22676 d_malloc_good_size='$d_malloc_good_size'
22677 d_malloc_size='$d_malloc_size'
22678 d_mblen='$d_mblen'
22679 d_mbstowcs='$d_mbstowcs'
22680 d_mbtowc='$d_mbtowc'
22681 d_memchr='$d_memchr'
22682 d_memcmp='$d_memcmp'
22683 d_memcpy='$d_memcpy'
22684 d_memmove='$d_memmove'
22685 d_memset='$d_memset'
22686 d_mkdir='$d_mkdir'
22687 d_mkdtemp='$d_mkdtemp'
22688 d_mkfifo='$d_mkfifo'
22689 d_mkstemp='$d_mkstemp'
22690 d_mkstemps='$d_mkstemps'
22691 d_mktime64='$d_mktime64'
22692 d_mktime='$d_mktime'
22693 d_mmap='$d_mmap'
22694 d_modfl='$d_modfl'
22695 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22696 d_modflproto='$d_modflproto'
22697 d_mprotect='$d_mprotect'
22698 d_msg='$d_msg'
22699 d_msg_ctrunc='$d_msg_ctrunc'
22700 d_msg_dontroute='$d_msg_dontroute'
22701 d_msg_oob='$d_msg_oob'
22702 d_msg_peek='$d_msg_peek'
22703 d_msg_proxy='$d_msg_proxy'
22704 d_msgctl='$d_msgctl'
22705 d_msgget='$d_msgget'
22706 d_msghdr_s='$d_msghdr_s'
22707 d_msgrcv='$d_msgrcv'
22708 d_msgsnd='$d_msgsnd'
22709 d_msync='$d_msync'
22710 d_munmap='$d_munmap'
22711 d_mymalloc='$d_mymalloc'
22712 d_ndbm='$d_ndbm'
22713 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22714 d_nice='$d_nice'
22715 d_nl_langinfo='$d_nl_langinfo'
22716 d_nv_preserves_uv='$d_nv_preserves_uv'
22717 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22718 d_off64_t='$d_off64_t'
22719 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22720 d_oldpthreads='$d_oldpthreads'
22721 d_oldsock='$d_oldsock'
22722 d_open3='$d_open3'
22723 d_pathconf='$d_pathconf'
22724 d_pause='$d_pause'
22725 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22726 d_phostname='$d_phostname'
22727 d_pipe='$d_pipe'
22728 d_poll='$d_poll'
22729 d_portable='$d_portable'
22730 d_prctl='$d_prctl'
22731 d_prctl_set_name='$d_prctl_set_name'
22732 d_printf_format_null='$d_printf_format_null'
22733 d_procselfexe='$d_procselfexe'
22734 d_pseudofork='$d_pseudofork'
22735 d_pthread_atfork='$d_pthread_atfork'
22736 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22737 d_pthread_yield='$d_pthread_yield'
22738 d_pwage='$d_pwage'
22739 d_pwchange='$d_pwchange'
22740 d_pwclass='$d_pwclass'
22741 d_pwcomment='$d_pwcomment'
22742 d_pwexpire='$d_pwexpire'
22743 d_pwgecos='$d_pwgecos'
22744 d_pwpasswd='$d_pwpasswd'
22745 d_pwquota='$d_pwquota'
22746 d_qgcvt='$d_qgcvt'
22747 d_quad='$d_quad'
22748 d_random_r='$d_random_r'
22749 d_readdir64_r='$d_readdir64_r'
22750 d_readdir='$d_readdir'
22751 d_readdir_r='$d_readdir_r'
22752 d_readlink='$d_readlink'
22753 d_readv='$d_readv'
22754 d_recvmsg='$d_recvmsg'
22755 d_rename='$d_rename'
22756 d_rewinddir='$d_rewinddir'
22757 d_rmdir='$d_rmdir'
22758 d_safebcpy='$d_safebcpy'
22759 d_safemcpy='$d_safemcpy'
22760 d_sanemcmp='$d_sanemcmp'
22761 d_sbrkproto='$d_sbrkproto'
22762 d_scalbnl='$d_scalbnl'
22763 d_sched_yield='$d_sched_yield'
22764 d_scm_rights='$d_scm_rights'
22765 d_seekdir='$d_seekdir'
22766 d_select='$d_select'
22767 d_sem='$d_sem'
22768 d_semctl='$d_semctl'
22769 d_semctl_semid_ds='$d_semctl_semid_ds'
22770 d_semctl_semun='$d_semctl_semun'
22771 d_semget='$d_semget'
22772 d_semop='$d_semop'
22773 d_sendmsg='$d_sendmsg'
22774 d_setegid='$d_setegid'
22775 d_seteuid='$d_seteuid'
22776 d_setgrent='$d_setgrent'
22777 d_setgrent_r='$d_setgrent_r'
22778 d_setgrps='$d_setgrps'
22779 d_sethent='$d_sethent'
22780 d_sethostent_r='$d_sethostent_r'
22781 d_setitimer='$d_setitimer'
22782 d_setlinebuf='$d_setlinebuf'
22783 d_setlocale='$d_setlocale'
22784 d_setlocale_r='$d_setlocale_r'
22785 d_setnent='$d_setnent'
22786 d_setnetent_r='$d_setnetent_r'
22787 d_setpent='$d_setpent'
22788 d_setpgid='$d_setpgid'
22789 d_setpgrp2='$d_setpgrp2'
22790 d_setpgrp='$d_setpgrp'
22791 d_setprior='$d_setprior'
22792 d_setproctitle='$d_setproctitle'
22793 d_setprotoent_r='$d_setprotoent_r'
22794 d_setpwent='$d_setpwent'
22795 d_setpwent_r='$d_setpwent_r'
22796 d_setregid='$d_setregid'
22797 d_setresgid='$d_setresgid'
22798 d_setresuid='$d_setresuid'
22799 d_setreuid='$d_setreuid'
22800 d_setrgid='$d_setrgid'
22801 d_setruid='$d_setruid'
22802 d_setsent='$d_setsent'
22803 d_setservent_r='$d_setservent_r'
22804 d_setsid='$d_setsid'
22805 d_setvbuf='$d_setvbuf'
22806 d_sfio='$d_sfio'
22807 d_shm='$d_shm'
22808 d_shmat='$d_shmat'
22809 d_shmatprototype='$d_shmatprototype'
22810 d_shmctl='$d_shmctl'
22811 d_shmdt='$d_shmdt'
22812 d_shmget='$d_shmget'
22813 d_sigaction='$d_sigaction'
22814 d_signbit='$d_signbit'
22815 d_sigprocmask='$d_sigprocmask'
22816 d_sigsetjmp='$d_sigsetjmp'
22817 d_sitearch='$d_sitearch'
22818 d_snprintf='$d_snprintf'
22819 d_sockaddr_sa_len='$d_sockaddr_sa_len'
22820 d_sockatmark='$d_sockatmark'
22821 d_sockatmarkproto='$d_sockatmarkproto'
22822 d_socket='$d_socket'
22823 d_socklen_t='$d_socklen_t'
22824 d_sockpair='$d_sockpair'
22825 d_socks5_init='$d_socks5_init'
22826 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22827 d_sqrtl='$d_sqrtl'
22828 d_srand48_r='$d_srand48_r'
22829 d_srandom_r='$d_srandom_r'
22830 d_sresgproto='$d_sresgproto'
22831 d_sresuproto='$d_sresuproto'
22832 d_statblks='$d_statblks'
22833 d_statfs_f_flags='$d_statfs_f_flags'
22834 d_statfs_s='$d_statfs_s'
22835 d_static_inline='$d_static_inline'
22836 d_statvfs='$d_statvfs'
22837 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22838 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22839 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22840 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22841 d_stdio_stream_array='$d_stdio_stream_array'
22842 d_stdiobase='$d_stdiobase'
22843 d_stdstdio='$d_stdstdio'
22844 d_strchr='$d_strchr'
22845 d_strcoll='$d_strcoll'
22846 d_strctcpy='$d_strctcpy'
22847 d_strerrm='$d_strerrm'
22848 d_strerror='$d_strerror'
22849 d_strerror_r='$d_strerror_r'
22850 d_strftime='$d_strftime'
22851 d_strlcat='$d_strlcat'
22852 d_strlcpy='$d_strlcpy'
22853 d_strtod='$d_strtod'
22854 d_strtol='$d_strtol'
22855 d_strtold='$d_strtold'
22856 d_strtoll='$d_strtoll'
22857 d_strtoq='$d_strtoq'
22858 d_strtoul='$d_strtoul'
22859 d_strtoull='$d_strtoull'
22860 d_strtouq='$d_strtouq'
22861 d_strxfrm='$d_strxfrm'
22862 d_suidsafe='$d_suidsafe'
22863 d_symlink='$d_symlink'
22864 d_syscall='$d_syscall'
22865 d_syscallproto='$d_syscallproto'
22866 d_sysconf='$d_sysconf'
22867 d_sysernlst='$d_sysernlst'
22868 d_syserrlst='$d_syserrlst'
22869 d_system='$d_system'
22870 d_tcgetpgrp='$d_tcgetpgrp'
22871 d_tcsetpgrp='$d_tcsetpgrp'
22872 d_telldir='$d_telldir'
22873 d_telldirproto='$d_telldirproto'
22874 d_time='$d_time'
22875 d_timegm='$d_timegm'
22876 d_times='$d_times'
22877 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22878 d_tm_tm_zone='$d_tm_tm_zone'
22879 d_tmpnam_r='$d_tmpnam_r'
22880 d_truncate='$d_truncate'
22881 d_ttyname_r='$d_ttyname_r'
22882 d_tzname='$d_tzname'
22883 d_u32align='$d_u32align'
22884 d_ualarm='$d_ualarm'
22885 d_umask='$d_umask'
22886 d_uname='$d_uname'
22887 d_union_semun='$d_union_semun'
22888 d_unordered='$d_unordered'
22889 d_unsetenv='$d_unsetenv'
22890 d_usleep='$d_usleep'
22891 d_usleepproto='$d_usleepproto'
22892 d_ustat='$d_ustat'
22893 d_vendorarch='$d_vendorarch'
22894 d_vendorbin='$d_vendorbin'
22895 d_vendorlib='$d_vendorlib'
22896 d_vendorscript='$d_vendorscript'
22897 d_vfork='$d_vfork'
22898 d_void_closedir='$d_void_closedir'
22899 d_voidsig='$d_voidsig'
22900 d_voidtty='$d_voidtty'
22901 d_volatile='$d_volatile'
22902 d_vprintf='$d_vprintf'
22903 d_vsnprintf='$d_vsnprintf'
22904 d_wait4='$d_wait4'
22905 d_waitpid='$d_waitpid'
22906 d_wcstombs='$d_wcstombs'
22907 d_wctomb='$d_wctomb'
22908 d_writev='$d_writev'
22909 d_xenix='$d_xenix'
22910 date='$date'
22911 db_hashtype='$db_hashtype'
22912 db_prefixtype='$db_prefixtype'
22913 db_version_major='$db_version_major'
22914 db_version_minor='$db_version_minor'
22915 db_version_patch='$db_version_patch'
22916 defvoidused='$defvoidused'
22917 direntrytype='$direntrytype'
22918 dlext='$dlext'
22919 dlsrc='$dlsrc'
22920 doublesize='$doublesize'
22921 drand01='$drand01'
22922 drand48_r_proto='$drand48_r_proto'
22923 dtrace='$dtrace'
22924 dynamic_ext='$dynamic_ext'
22925 eagain='$eagain'
22926 ebcdic='$ebcdic'
22927 echo='$echo'
22928 egrep='$egrep'
22929 emacs='$emacs'
22930 endgrent_r_proto='$endgrent_r_proto'
22931 endhostent_r_proto='$endhostent_r_proto'
22932 endnetent_r_proto='$endnetent_r_proto'
22933 endprotoent_r_proto='$endprotoent_r_proto'
22934 endpwent_r_proto='$endpwent_r_proto'
22935 endservent_r_proto='$endservent_r_proto'
22936 eunicefix='$eunicefix'
22937 exe_ext='$exe_ext'
22938 expr='$expr'
22939 extensions='$extensions'
22940 extern_C='$extern_C'
22941 extras='$extras'
22942 fflushNULL='$fflushNULL'
22943 fflushall='$fflushall'
22944 find='$find'
22945 firstmakefile='$firstmakefile'
22946 flex='$flex'
22947 fpossize='$fpossize'
22948 fpostype='$fpostype'
22949 freetype='$freetype'
22950 from='$from'
22951 full_ar='$full_ar'
22952 full_csh='$full_csh'
22953 full_sed='$full_sed'
22954 gccansipedantic='$gccansipedantic'
22955 gccosandvers='$gccosandvers'
22956 gccversion='$gccversion'
22957 getgrent_r_proto='$getgrent_r_proto'
22958 getgrgid_r_proto='$getgrgid_r_proto'
22959 getgrnam_r_proto='$getgrnam_r_proto'
22960 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22961 gethostbyname_r_proto='$gethostbyname_r_proto'
22962 gethostent_r_proto='$gethostent_r_proto'
22963 getlogin_r_proto='$getlogin_r_proto'
22964 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22965 getnetbyname_r_proto='$getnetbyname_r_proto'
22966 getnetent_r_proto='$getnetent_r_proto'
22967 getprotobyname_r_proto='$getprotobyname_r_proto'
22968 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22969 getprotoent_r_proto='$getprotoent_r_proto'
22970 getpwent_r_proto='$getpwent_r_proto'
22971 getpwnam_r_proto='$getpwnam_r_proto'
22972 getpwuid_r_proto='$getpwuid_r_proto'
22973 getservbyname_r_proto='$getservbyname_r_proto'
22974 getservbyport_r_proto='$getservbyport_r_proto'
22975 getservent_r_proto='$getservent_r_proto'
22976 getspnam_r_proto='$getspnam_r_proto'
22977 gidformat='$gidformat'
22978 gidsign='$gidsign'
22979 gidsize='$gidsize'
22980 gidtype='$gidtype'
22981 glibpth='$glibpth'
22982 gmake='$gmake'
22983 gmtime_r_proto='$gmtime_r_proto'
22984 gnulibc_version='$gnulibc_version'
22985 grep='$grep'
22986 groupcat='$groupcat'
22987 groupstype='$groupstype'
22988 gzip='$gzip'
22989 h_fcntl='$h_fcntl'
22990 h_sysfile='$h_sysfile'
22991 hint='$hint'
22992 hostcat='$hostcat'
22993 html1dir='$html1dir'
22994 html1direxp='$html1direxp'
22995 html3dir='$html3dir'
22996 html3direxp='$html3direxp'
22997 i16size='$i16size'
22998 i16type='$i16type'
22999 i32size='$i32size'
23000 i32type='$i32type'
23001 i64size='$i64size'
23002 i64type='$i64type'
23003 i8size='$i8size'
23004 i8type='$i8type'
23005 i_arpainet='$i_arpainet'
23006 i_assert='$i_assert'
23007 i_bsdioctl='$i_bsdioctl'
23008 i_crypt='$i_crypt'
23009 i_db='$i_db'
23010 i_dbm='$i_dbm'
23011 i_dirent='$i_dirent'
23012 i_dld='$i_dld'
23013 i_dlfcn='$i_dlfcn'
23014 i_fcntl='$i_fcntl'
23015 i_float='$i_float'
23016 i_fp='$i_fp'
23017 i_fp_class='$i_fp_class'
23018 i_gdbm='$i_gdbm'
23019 i_gdbm_ndbm='$i_gdbm_ndbm'
23020 i_gdbmndbm='$i_gdbmndbm'
23021 i_grp='$i_grp'
23022 i_ieeefp='$i_ieeefp'
23023 i_inttypes='$i_inttypes'
23024 i_langinfo='$i_langinfo'
23025 i_libutil='$i_libutil'
23026 i_limits='$i_limits'
23027 i_locale='$i_locale'
23028 i_machcthr='$i_machcthr'
23029 i_malloc='$i_malloc'
23030 i_mallocmalloc='$i_mallocmalloc'
23031 i_math='$i_math'
23032 i_memory='$i_memory'
23033 i_mntent='$i_mntent'
23034 i_ndbm='$i_ndbm'
23035 i_netdb='$i_netdb'
23036 i_neterrno='$i_neterrno'
23037 i_netinettcp='$i_netinettcp'
23038 i_niin='$i_niin'
23039 i_poll='$i_poll'
23040 i_prot='$i_prot'
23041 i_pthread='$i_pthread'
23042 i_pwd='$i_pwd'
23043 i_rpcsvcdbm='$i_rpcsvcdbm'
23044 i_sfio='$i_sfio'
23045 i_sgtty='$i_sgtty'
23046 i_shadow='$i_shadow'
23047 i_socks='$i_socks'
23048 i_stdarg='$i_stdarg'
23049 i_stddef='$i_stddef'
23050 i_stdlib='$i_stdlib'
23051 i_string='$i_string'
23052 i_sunmath='$i_sunmath'
23053 i_sysaccess='$i_sysaccess'
23054 i_sysdir='$i_sysdir'
23055 i_sysfile='$i_sysfile'
23056 i_sysfilio='$i_sysfilio'
23057 i_sysin='$i_sysin'
23058 i_sysioctl='$i_sysioctl'
23059 i_syslog='$i_syslog'
23060 i_sysmman='$i_sysmman'
23061 i_sysmode='$i_sysmode'
23062 i_sysmount='$i_sysmount'
23063 i_sysndir='$i_sysndir'
23064 i_sysparam='$i_sysparam'
23065 i_syspoll='$i_syspoll'
23066 i_sysresrc='$i_sysresrc'
23067 i_syssecrt='$i_syssecrt'
23068 i_sysselct='$i_sysselct'
23069 i_syssockio='$i_syssockio'
23070 i_sysstat='$i_sysstat'
23071 i_sysstatfs='$i_sysstatfs'
23072 i_sysstatvfs='$i_sysstatvfs'
23073 i_systime='$i_systime'
23074 i_systimek='$i_systimek'
23075 i_systimes='$i_systimes'
23076 i_systypes='$i_systypes'
23077 i_sysuio='$i_sysuio'
23078 i_sysun='$i_sysun'
23079 i_sysutsname='$i_sysutsname'
23080 i_sysvfs='$i_sysvfs'
23081 i_syswait='$i_syswait'
23082 i_termio='$i_termio'
23083 i_termios='$i_termios'
23084 i_time='$i_time'
23085 i_unistd='$i_unistd'
23086 i_ustat='$i_ustat'
23087 i_utime='$i_utime'
23088 i_values='$i_values'
23089 i_varargs='$i_varargs'
23090 i_varhdr='$i_varhdr'
23091 i_vfork='$i_vfork'
23092 ignore_versioned_solibs='$ignore_versioned_solibs'
23093 inc_version_list='$inc_version_list'
23094 inc_version_list_init='$inc_version_list_init'
23095 incpath='$incpath'
23096 inews='$inews'
23097 initialinstalllocation='$initialinstalllocation'
23098 installarchlib='$installarchlib'
23099 installbin='$installbin'
23100 installhtml1dir='$installhtml1dir'
23101 installhtml3dir='$installhtml3dir'
23102 installman1dir='$installman1dir'
23103 installman3dir='$installman3dir'
23104 installprefix='$installprefix'
23105 installprefixexp='$installprefixexp'
23106 installprivlib='$installprivlib'
23107 installscript='$installscript'
23108 installsitearch='$installsitearch'
23109 installsitebin='$installsitebin'
23110 installsitehtml1dir='$installsitehtml1dir'
23111 installsitehtml3dir='$installsitehtml3dir'
23112 installsitelib='$installsitelib'
23113 installsiteman1dir='$installsiteman1dir'
23114 installsiteman3dir='$installsiteman3dir'
23115 installsitescript='$installsitescript'
23116 installstyle='$installstyle'
23117 installusrbinperl='$installusrbinperl'
23118 installvendorarch='$installvendorarch'
23119 installvendorbin='$installvendorbin'
23120 installvendorhtml1dir='$installvendorhtml1dir'
23121 installvendorhtml3dir='$installvendorhtml3dir'
23122 installvendorlib='$installvendorlib'
23123 installvendorman1dir='$installvendorman1dir'
23124 installvendorman3dir='$installvendorman3dir'
23125 installvendorscript='$installvendorscript'
23126 intsize='$intsize'
23127 issymlink='$issymlink'
23128 ivdformat='$ivdformat'
23129 ivsize='$ivsize'
23130 ivtype='$ivtype'
23131 known_extensions='$known_extensions'
23132 ksh='$ksh'
23133 ld='$ld'
23134 lddlflags='$lddlflags'
23135 ldflags='$ldflags'
23136 ldflags_uselargefiles='$ldflags_uselargefiles'
23137 ldlibpthname='$ldlibpthname'
23138 less='$less'
23139 lib_ext='$lib_ext'
23140 libc='$libc'
23141 libperl='$libperl'
23142 libpth='$libpth'
23143 libs='$libs'
23144 libsdirs='$libsdirs'
23145 libsfiles='$libsfiles'
23146 libsfound='$libsfound'
23147 libspath='$libspath'
23148 libswanted='$libswanted'
23149 libswanted_uselargefiles='$libswanted_uselargefiles'
23150 line='$line'
23151 lint='$lint'
23152 lkflags='$lkflags'
23153 ln='$ln'
23154 lns='$lns'
23155 localtime_r_proto='$localtime_r_proto'
23156 locincpth='$locincpth'
23157 loclibpth='$loclibpth'
23158 longdblsize='$longdblsize'
23159 longlongsize='$longlongsize'
23160 longsize='$longsize'
23161 lp='$lp'
23162 lpr='$lpr'
23163 ls='$ls'
23164 lseeksize='$lseeksize'
23165 lseektype='$lseektype'
23166 mad='$mad'
23167 madlyh='$madlyh'
23168 madlyobj='$madlyobj'
23169 madlysrc='$madlysrc'
23170 mail='$mail'
23171 mailx='$mailx'
23172 make='$make'
23173 make_set_make='$make_set_make'
23174 mallocobj='$mallocobj'
23175 mallocsrc='$mallocsrc'
23176 malloctype='$malloctype'
23177 man1dir='$man1dir'
23178 man1direxp='$man1direxp'
23179 man1ext='$man1ext'
23180 man3dir='$man3dir'
23181 man3direxp='$man3direxp'
23182 man3ext='$man3ext'
23183 mips_type='$mips_type'
23184 mistrustnm='$mistrustnm'
23185 mkdir='$mkdir'
23186 mmaptype='$mmaptype'
23187 modetype='$modetype'
23188 more='$more'
23189 multiarch='$multiarch'
23190 mv='$mv'
23191 myarchname='$myarchname'
23192 mydomain='$mydomain'
23193 myhostname='$myhostname'
23194 myuname='$myuname'
23195 n='$n'
23196 need_va_copy='$need_va_copy'
23197 netdb_hlen_type='$netdb_hlen_type'
23198 netdb_host_type='$netdb_host_type'
23199 netdb_name_type='$netdb_name_type'
23200 netdb_net_type='$netdb_net_type'
23201 nm='$nm'
23202 nm_opt='$nm_opt'
23203 nm_so_opt='$nm_so_opt'
23204 nonxs_ext='$nonxs_ext'
23205 nroff='$nroff'
23206 nvEUformat='$nvEUformat'
23207 nvFUformat='$nvFUformat'
23208 nvGUformat='$nvGUformat'
23209 nv_overflows_integers_at='$nv_overflows_integers_at'
23210 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23211 nveformat='$nveformat'
23212 nvfformat='$nvfformat'
23213 nvgformat='$nvgformat'
23214 nvsize='$nvsize'
23215 nvtype='$nvtype'
23216 o_nonblock='$o_nonblock'
23217 obj_ext='$obj_ext'
23218 old_pthread_create_joinable='$old_pthread_create_joinable'
23219 optimize='$optimize'
23220 orderlib='$orderlib'
23221 osname='$osname'
23222 osvers='$osvers'
23223 otherlibdirs='$otherlibdirs'
23224 package='$package'
23225 pager='$pager'
23226 passcat='$passcat'
23227 patchlevel='$patchlevel'
23228 path_sep='$path_sep'
23229 perl5='$perl5'
23230 perl='$perl'
23231 perl_patchlevel='$perl_patchlevel'
23232 perl_static_inline='$perl_static_inline'
23233 perladmin='$perladmin'
23234 perllibs='$perllibs'
23235 perlpath='$perlpath'
23236 pg='$pg'
23237 phostname='$phostname'
23238 pidtype='$pidtype'
23239 plibpth='$plibpth'
23240 pmake='$pmake'
23241 pr='$pr'
23242 prefix='$prefix'
23243 prefixexp='$prefixexp'
23244 privlib='$privlib'
23245 privlibexp='$privlibexp'
23246 procselfexe='$procselfexe'
23247 prototype='$prototype'
23248 ptrsize='$ptrsize'
23249 quadkind='$quadkind'
23250 quadtype='$quadtype'
23251 randbits='$randbits'
23252 randfunc='$randfunc'
23253 random_r_proto='$random_r_proto'
23254 randseedtype='$randseedtype'
23255 ranlib='$ranlib'
23256 rd_nodata='$rd_nodata'
23257 readdir64_r_proto='$readdir64_r_proto'
23258 readdir_r_proto='$readdir_r_proto'
23259 revision='$revision'
23260 rm='$rm'
23261 rm_try='$rm_try'
23262 rmail='$rmail'
23263 run='$run'
23264 runnm='$runnm'
23265 sGMTIME_max='$sGMTIME_max'
23266 sGMTIME_min='$sGMTIME_min'
23267 sLOCALTIME_max='$sLOCALTIME_max'
23268 sLOCALTIME_min='$sLOCALTIME_min'
23269 sPRIEUldbl='$sPRIEUldbl'
23270 sPRIFUldbl='$sPRIFUldbl'
23271 sPRIGUldbl='$sPRIGUldbl'
23272 sPRIXU64='$sPRIXU64'
23273 sPRId64='$sPRId64'
23274 sPRIeldbl='$sPRIeldbl'
23275 sPRIfldbl='$sPRIfldbl'
23276 sPRIgldbl='$sPRIgldbl'
23277 sPRIi64='$sPRIi64'
23278 sPRIo64='$sPRIo64'
23279 sPRIu64='$sPRIu64'
23280 sPRIx64='$sPRIx64'
23281 sSCNfldbl='$sSCNfldbl'
23282 sched_yield='$sched_yield'
23283 scriptdir='$scriptdir'
23284 scriptdirexp='$scriptdirexp'
23285 sed='$sed'
23286 seedfunc='$seedfunc'
23287 selectminbits='$selectminbits'
23288 selecttype='$selecttype'
23289 sendmail='$sendmail'
23290 setgrent_r_proto='$setgrent_r_proto'
23291 sethostent_r_proto='$sethostent_r_proto'
23292 setlocale_r_proto='$setlocale_r_proto'
23293 setnetent_r_proto='$setnetent_r_proto'
23294 setprotoent_r_proto='$setprotoent_r_proto'
23295 setpwent_r_proto='$setpwent_r_proto'
23296 setservent_r_proto='$setservent_r_proto'
23297 sh='$sh'
23298 shar='$shar'
23299 sharpbang='$sharpbang'
23300 shmattype='$shmattype'
23301 shortsize='$shortsize'
23302 shrpenv='$shrpenv'
23303 shsharp='$shsharp'
23304 sig_count='$sig_count'
23305 sig_name='$sig_name'
23306 sig_name_init='$sig_name_init'
23307 sig_num='$sig_num'
23308 sig_num_init='$sig_num_init'
23309 sig_size='$sig_size'
23310 signal_t='$signal_t'
23311 sitearch='$sitearch'
23312 sitearchexp='$sitearchexp'
23313 sitebin='$sitebin'
23314 sitebinexp='$sitebinexp'
23315 sitehtml1dir='$sitehtml1dir'
23316 sitehtml1direxp='$sitehtml1direxp'
23317 sitehtml3dir='$sitehtml3dir'
23318 sitehtml3direxp='$sitehtml3direxp'
23319 sitelib='$sitelib'
23320 sitelib_stem='$sitelib_stem'
23321 sitelibexp='$sitelibexp'
23322 siteman1dir='$siteman1dir'
23323 siteman1direxp='$siteman1direxp'
23324 siteman3dir='$siteman3dir'
23325 siteman3direxp='$siteman3direxp'
23326 siteprefix='$siteprefix'
23327 siteprefixexp='$siteprefixexp'
23328 sitescript='$sitescript'
23329 sitescriptexp='$sitescriptexp'
23330 sizesize='$sizesize'
23331 sizetype='$sizetype'
23332 sleep='$sleep'
23333 smail='$smail'
23334 so='$so'
23335 sockethdr='$sockethdr'
23336 socketlib='$socketlib'
23337 socksizetype='$socksizetype'
23338 sort='$sort'
23339 spackage='$spackage'
23340 spitshell='$spitshell'
23341 srand48_r_proto='$srand48_r_proto'
23342 srandom_r_proto='$srandom_r_proto'
23343 src='$src'
23344 ssizetype='$ssizetype'
23345 startperl='$startperl'
23346 startsh='$startsh'
23347 static_ext='$static_ext'
23348 stdchar='$stdchar'
23349 stdio_base='$stdio_base'
23350 stdio_bufsiz='$stdio_bufsiz'
23351 stdio_cnt='$stdio_cnt'
23352 stdio_filbuf='$stdio_filbuf'
23353 stdio_ptr='$stdio_ptr'
23354 stdio_stream_array='$stdio_stream_array'
23355 strerror_r_proto='$strerror_r_proto'
23356 strings='$strings'
23357 submit='$submit'
23358 subversion='$subversion'
23359 sysman='$sysman'
23360 tail='$tail'
23361 tar='$tar'
23362 targetarch='$targetarch'
23363 tbl='$tbl'
23364 tee='$tee'
23365 test='$test'
23366 timeincl='$timeincl'
23367 timetype='$timetype'
23368 tmpnam_r_proto='$tmpnam_r_proto'
23369 to='$to'
23370 touch='$touch'
23371 tr='$tr'
23372 trnl='$trnl'
23373 troff='$troff'
23374 ttyname_r_proto='$ttyname_r_proto'
23375 u16size='$u16size'
23376 u16type='$u16type'
23377 u32size='$u32size'
23378 u32type='$u32type'
23379 u64size='$u64size'
23380 u64type='$u64type'
23381 u8size='$u8size'
23382 u8type='$u8type'
23383 uidformat='$uidformat'
23384 uidsign='$uidsign'
23385 uidsize='$uidsize'
23386 uidtype='$uidtype'
23387 uname='$uname'
23388 uniq='$uniq'
23389 uquadtype='$uquadtype'
23390 use5005threads='$use5005threads'
23391 use64bitall='$use64bitall'
23392 use64bitint='$use64bitint'
23393 usecrosscompile='$usecrosscompile'
23394 usedevel='$usedevel'
23395 usedl='$usedl'
23396 usedtrace='$usedtrace'
23397 usefaststdio='$usefaststdio'
23398 useithreads='$useithreads'
23399 uselargefiles='$uselargefiles'
23400 uselongdouble='$uselongdouble'
23401 usemallocwrap='$usemallocwrap'
23402 usemorebits='$usemorebits'
23403 usemultiplicity='$usemultiplicity'
23404 usemymalloc='$usemymalloc'
23405 usenm='$usenm'
23406 useopcode='$useopcode'
23407 useperlio='$useperlio'
23408 useposix='$useposix'
23409 usereentrant='$usereentrant'
23410 userelocatableinc='$userelocatableinc'
23411 usesfio='$usesfio'
23412 useshrplib='$useshrplib'
23413 usesitecustomize='$usesitecustomize'
23414 usesocks='$usesocks'
23415 usethreads='$usethreads'
23416 usevendorprefix='$usevendorprefix'
23417 usevfork='$usevfork'
23418 usrinc='$usrinc'
23419 uuname='$uuname'
23420 uvXUformat='$uvXUformat'
23421 uvoformat='$uvoformat'
23422 uvsize='$uvsize'
23423 uvtype='$uvtype'
23424 uvuformat='$uvuformat'
23425 uvxformat='$uvxformat'
23426 vaproto='$vaproto'
23427 vendorarch='$vendorarch'
23428 vendorarchexp='$vendorarchexp'
23429 vendorbin='$vendorbin'
23430 vendorbinexp='$vendorbinexp'
23431 vendorhtml1dir='$vendorhtml1dir'
23432 vendorhtml1direxp='$vendorhtml1direxp'
23433 vendorhtml3dir='$vendorhtml3dir'
23434 vendorhtml3direxp='$vendorhtml3direxp'
23435 vendorlib='$vendorlib'
23436 vendorlib_stem='$vendorlib_stem'
23437 vendorlibexp='$vendorlibexp'
23438 vendorman1dir='$vendorman1dir'
23439 vendorman1direxp='$vendorman1direxp'
23440 vendorman3dir='$vendorman3dir'
23441 vendorman3direxp='$vendorman3direxp'
23442 vendorprefix='$vendorprefix'
23443 vendorprefixexp='$vendorprefixexp'
23444 vendorscript='$vendorscript'
23445 vendorscriptexp='$vendorscriptexp'
23446 version='$version'
23447 version_patchlevel_string='$version_patchlevel_string'
23448 versiononly='$versiononly'
23449 vi='$vi'
23450 voidflags='$voidflags'
23451 xlibpth='$xlibpth'
23452 yacc='$yacc'
23453 yaccflags='$yaccflags'
23454 zcat='$zcat'
23455 zip='$zip'
23456 EOT
23457
23458 : add special variables
23459 $test -f $src/patchlevel.h && \
23460 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23461 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23462 echo "PERL_CONFIG_SH=true" >>config.sh
23463
23464 : propagate old symbols
23465 if $test -f UU/config.sh; then
23466         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23467         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23468                 config.sh config.sh UU/oldconfig.sh |\
23469                 $sort | $uniq -u >UU/oldsyms
23470         set X `cat UU/oldsyms`
23471         shift
23472         case $# in
23473         0) ;;
23474         *)
23475                 cat <<EOM
23476 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23477 EOM
23478                 echo ": Variables propagated from previous config.sh file." >>config.sh
23479                 for sym in `cat UU/oldsyms`; do
23480                         echo "    Propagating $hint variable "'$'"$sym..."
23481                         eval 'tmp="$'"${sym}"'"'
23482                         echo "$tmp" | \
23483                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23484                 done
23485                 ;;
23486         esac
23487 fi
23488
23489 : Finish up by extracting the .SH files
23490 case "$alldone" in
23491 exit)
23492         $rm -rf UU
23493         echo "Extraction done."
23494         exit 0
23495         ;;
23496 cont)
23497         ;;
23498 '')
23499         dflt=''
23500         nostick=true
23501         $cat <<EOM
23502
23503 If you'd like to make any changes to the config.sh file before I begin
23504 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23505
23506 EOM
23507         rp="Press return or use a shell escape to edit config.sh:"
23508         . UU/myread
23509         nostick=''
23510         case "$ans" in
23511         '') ;;
23512         *) : in case they cannot read
23513                 sh 1>&4 -c "$ans";;
23514         esac
23515         ;;
23516 esac
23517
23518 : if this fails, just run all the .SH files by hand
23519 . ./config.sh
23520
23521 echo " "
23522 exec 1>&4
23523 pwd=`pwd`
23524 . ./UU/extract
23525 cd "$pwd"
23526
23527 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23528         dflt=y
23529         case "$silent" in
23530         true) ;;
23531         *)
23532                 $cat <<EOM
23533
23534 Now you need to generate make dependencies by running "$make depend".
23535 You might prefer to run it in background: "$make depend > makedepend.out &"
23536 It can take a while, so you might not want to run it right now.
23537
23538 EOM
23539                 ;;
23540         esac
23541         rp="Run $make depend now?"
23542         . UU/myread
23543         case "$ans" in
23544         y*)
23545                 $make depend && echo "Now you must run '$make'."
23546                 ;;
23547         *)
23548                 echo "You must run '$make depend' then '$make'."
23549                 ;;
23550         esac
23551 elif test -f [Mm]akefile; then
23552         echo " "
23553         echo "Now you must run a $make."
23554 else
23555         echo "Configure done."
23556 fi
23557
23558 if $test -f Policy.sh; then
23559     $cat <<EOM
23560
23561 If you compile $package on a different machine or from a different object
23562 directory, copy the Policy.sh file from this object directory to the
23563 new one before you run Configure -- this will help you with most of
23564 the policy defaults.
23565
23566 EOM
23567 fi
23568 if $test -f config.msg; then
23569     echo "Hmm.  I also noted the following information while running:"
23570     echo " "
23571     $cat config.msg >&4
23572     $rm -f config.msg
23573 fi
23574 $rm -f kit*isdone ark*isdone
23575 $rm -rf UU
23576
23577 : End of Configure
23578