This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
d9cdd032dfd6142a3f72cc118a66c6ecb5a3feac
[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 # Generated on Sun Jul 31 12:11:29 CEST 2011 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 d_atolf=''
336 d_atoll=''
337 baserev=''
338 bin=''
339 binexp=''
340 initialinstalllocation=''
341 installbin=''
342 userelocatableinc=''
343 byteorder=''
344 cc=''
345 ccflags=''
346 cppflags=''
347 ldflags=''
348 lkflags=''
349 locincpth=''
350 optimize=''
351 cf_email=''
352 cf_by=''
353 cf_time=''
354 charbits=''
355 charsize=''
356 contains=''
357 cpp_stuff=''
358 cpplast=''
359 cppminus=''
360 cpprun=''
361 cppstdin=''
362 d__fwalk=''
363 d_access=''
364 d_accessx=''
365 d_aintl=''
366 d_alarm=''
367 asctime_r_proto=''
368 d_asctime_r=''
369 d_attribute_deprecated=''
370 d_attribute_format=''
371 d_attribute_malloc=''
372 d_attribute_nonnull=''
373 d_attribute_noreturn=''
374 d_attribute_pure=''
375 d_attribute_unused=''
376 d_attribute_warn_unused_result=''
377 d_printf_format_null=''
378 d_bcmp=''
379 d_bcopy=''
380 d_builtin_choose_expr=''
381 d_builtin_expect=''
382 d_bzero=''
383 d_c99_variadic_macros=''
384 d_casti32=''
385 castflags=''
386 d_castneg=''
387 d_chown=''
388 d_chroot=''
389 d_chsize=''
390 d_class=''
391 d_clearenv=''
392 d_closedir=''
393 d_void_closedir=''
394 d_cmsghdr_s=''
395 d_const=''
396 d_copysignl=''
397 d_cplusplus=''
398 cryptlib=''
399 d_crypt=''
400 crypt_r_proto=''
401 d_crypt_r=''
402 d_csh=''
403 full_csh=''
404 d_ctermid=''
405 ctermid_r_proto=''
406 d_ctermid_r=''
407 ctime_r_proto=''
408 d_ctime_r=''
409 d_cuserid=''
410 d_dbl_dig=''
411 d_dbminitproto=''
412 d_difftime=''
413 d_dir_dd_fd=''
414 d_dirfd=''
415 d_dlerror=''
416 d_dlopen=''
417 d_dlsymun=''
418 d_dosuid=''
419 d_suidsafe=''
420 d_drand48_r=''
421 drand48_r_proto=''
422 d_drand48proto=''
423 d_dup2=''
424 d_eaccess=''
425 d_endgrent=''
426 d_endgrent_r=''
427 endgrent_r_proto=''
428 d_endhent=''
429 d_endhostent_r=''
430 endhostent_r_proto=''
431 d_endnent=''
432 d_endnetent_r=''
433 endnetent_r_proto=''
434 d_endpent=''
435 d_endprotoent_r=''
436 endprotoent_r_proto=''
437 d_endpwent=''
438 d_endpwent_r=''
439 endpwent_r_proto=''
440 d_endsent=''
441 d_endservent_r=''
442 endservent_r_proto=''
443 d_faststdio=''
444 d_fchdir=''
445 d_fchmod=''
446 d_fchown=''
447 d_fcntl=''
448 d_fcntl_can_lock=''
449 d_fd_macros=''
450 d_fd_set=''
451 d_fds_bits=''
452 d_fgetpos=''
453 d_finite=''
454 d_finitel=''
455 d_flexfnam=''
456 d_flock=''
457 d_flockproto=''
458 d_fork=''
459 d_fp_class=''
460 d_fpclass=''
461 d_fpclassify=''
462 d_fpclassl=''
463 d_fpos64_t=''
464 d_frexpl=''
465 d_fs_data_s=''
466 d_fseeko=''
467 d_fsetpos=''
468 d_fstatfs=''
469 d_fsync=''
470 d_ftello=''
471 d_ftime=''
472 d_gettimeod=''
473 d_futimes=''
474 d_Gconvert=''
475 d_getaddrinfo=''
476 d_getcwd=''
477 d_getespwnam=''
478 d_getfsstat=''
479 d_getgrent=''
480 d_getgrent_r=''
481 getgrent_r_proto=''
482 d_getgrgid_r=''
483 getgrgid_r_proto=''
484 d_getgrnam_r=''
485 getgrnam_r_proto=''
486 d_getgrps=''
487 d_gethbyaddr=''
488 d_gethbyname=''
489 d_gethent=''
490 aphostname=''
491 d_gethname=''
492 d_phostname=''
493 d_uname=''
494 d_gethostbyaddr_r=''
495 gethostbyaddr_r_proto=''
496 d_gethostbyname_r=''
497 gethostbyname_r_proto=''
498 d_gethostent_r=''
499 gethostent_r_proto=''
500 d_gethostprotos=''
501 d_getitimer=''
502 d_getlogin=''
503 d_getlogin_r=''
504 getlogin_r_proto=''
505 d_getmnt=''
506 d_getmntent=''
507 d_getnameinfo=''
508 d_getnbyaddr=''
509 d_getnbyname=''
510 d_getnent=''
511 d_getnetbyaddr_r=''
512 getnetbyaddr_r_proto=''
513 d_getnetbyname_r=''
514 getnetbyname_r_proto=''
515 d_getnetent_r=''
516 getnetent_r_proto=''
517 d_getnetprotos=''
518 d_getpagsz=''
519 d_getpent=''
520 d_getpgid=''
521 d_getpgrp2=''
522 d_bsdgetpgrp=''
523 d_getpgrp=''
524 d_getppid=''
525 d_getprior=''
526 d_getpbyname=''
527 d_getpbynumber=''
528 d_getprotobyname_r=''
529 getprotobyname_r_proto=''
530 d_getprotobynumber_r=''
531 getprotobynumber_r_proto=''
532 d_getprotoent_r=''
533 getprotoent_r_proto=''
534 d_getprotoprotos=''
535 d_getprpwnam=''
536 d_getpwent=''
537 d_getpwent_r=''
538 getpwent_r_proto=''
539 d_getpwnam_r=''
540 getpwnam_r_proto=''
541 d_getpwuid_r=''
542 getpwuid_r_proto=''
543 d_getsent=''
544 d_getservbyname_r=''
545 getservbyname_r_proto=''
546 d_getservbyport_r=''
547 getservbyport_r_proto=''
548 d_getservent_r=''
549 getservent_r_proto=''
550 d_getservprotos=''
551 d_getspnam=''
552 d_getspnam_r=''
553 getspnam_r_proto=''
554 d_getsbyname=''
555 d_getsbyport=''
556 d_gmtime_r=''
557 gmtime_r_proto=''
558 d_gnulibc=''
559 gnulibc_version=''
560 d_hasmntopt=''
561 d_htonl=''
562 d_ilogbl=''
563 d_inetaton=''
564 d_inetntop=''
565 d_inetpton=''
566 d_int64_t=''
567 d_isascii=''
568 d_isfinite=''
569 d_isinf=''
570 d_isnan=''
571 d_isnanl=''
572 d_killpg=''
573 d_lchown=''
574 d_ldbl_dig=''
575 d_libm_lib_version=''
576 d_link=''
577 d_localtime_r=''
578 d_localtime_r_needs_tzset=''
579 localtime_r_proto=''
580 d_locconv=''
581 d_lockf=''
582 d_longdbl=''
583 longdblsize=''
584 d_longlong=''
585 longlongsize=''
586 d_lseekproto=''
587 d_lstat=''
588 d_madvise=''
589 d_malloc_good_size=''
590 d_malloc_size=''
591 d_mblen=''
592 d_mbstowcs=''
593 d_mbtowc=''
594 d_memchr=''
595 d_memcmp=''
596 d_memcpy=''
597 d_memmove=''
598 d_memset=''
599 d_mkdir=''
600 d_mkdtemp=''
601 d_mkfifo=''
602 d_mkstemp=''
603 d_mkstemps=''
604 d_mktime=''
605 d_mmap=''
606 mmaptype=''
607 d_modfl=''
608 d_modfl_pow32_bug=''
609 d_modflproto=''
610 d_mprotect=''
611 d_msg=''
612 d_msgctl=''
613 d_msgget=''
614 d_msghdr_s=''
615 d_msgrcv=''
616 d_msgsnd=''
617 d_msync=''
618 d_munmap=''
619 d_nice=''
620 d_nl_langinfo=''
621 d_off64_t=''
622 d_open3=''
623 d_fpathconf=''
624 d_pathconf=''
625 d_pause=''
626 d_pipe=''
627 d_poll=''
628 d_portable=''
629 d_prctl=''
630 d_prctl_set_name=''
631 d_procselfexe=''
632 procselfexe=''
633 d_old_pthread_create_joinable=''
634 old_pthread_create_joinable=''
635 d_pthread_atfork=''
636 d_pthread_attr_setscope=''
637 d_pthread_yield=''
638 d_sched_yield=''
639 sched_yield=''
640 d_qgcvt=''
641 d_random_r=''
642 random_r_proto=''
643 d_readdir64_r=''
644 readdir64_r_proto=''
645 d_readdir=''
646 d_rewinddir=''
647 d_seekdir=''
648 d_telldir=''
649 d_readdir_r=''
650 readdir_r_proto=''
651 d_readlink=''
652 d_readv=''
653 d_recvmsg=''
654 d_rename=''
655 d_rmdir=''
656 d_safebcpy=''
657 d_safemcpy=''
658 d_sanemcmp=''
659 d_sbrkproto=''
660 d_scalbnl=''
661 d_select=''
662 d_sem=''
663 d_semctl=''
664 d_semget=''
665 d_semop=''
666 d_sendmsg=''
667 d_setegid=''
668 d_seteuid=''
669 d_setgrent=''
670 d_setgrent_r=''
671 setgrent_r_proto=''
672 d_setgrps=''
673 d_sethent=''
674 d_sethostent_r=''
675 sethostent_r_proto=''
676 d_setitimer=''
677 d_setlinebuf=''
678 d_setlocale=''
679 d_setlocale_r=''
680 setlocale_r_proto=''
681 d_setnent=''
682 d_setnetent_r=''
683 setnetent_r_proto=''
684 d_setpent=''
685 d_setpgid=''
686 d_setpgrp2=''
687 d_bsdsetpgrp=''
688 d_setpgrp=''
689 d_setprior=''
690 d_setproctitle=''
691 d_setprotoent_r=''
692 setprotoent_r_proto=''
693 d_setpwent=''
694 d_setpwent_r=''
695 setpwent_r_proto=''
696 d_setregid=''
697 d_setresgid=''
698 d_setresuid=''
699 d_setreuid=''
700 d_setrgid=''
701 d_setruid=''
702 d_setsent=''
703 d_setservent_r=''
704 setservent_r_proto=''
705 d_setsid=''
706 d_setvbuf=''
707 d_sfio=''
708 usesfio=''
709 d_shm=''
710 d_shmat=''
711 d_shmatprototype=''
712 shmattype=''
713 d_shmctl=''
714 d_shmdt=''
715 d_shmget=''
716 d_sigaction=''
717 d_signbit=''
718 d_sigprocmask=''
719 d_sigsetjmp=''
720 usesitecustomize=''
721 d_snprintf=''
722 d_vsnprintf=''
723 d_sockatmark=''
724 d_sockatmarkproto=''
725 d_msg_ctrunc=''
726 d_msg_dontroute=''
727 d_msg_oob=''
728 d_msg_peek=''
729 d_msg_proxy=''
730 d_oldsock=''
731 d_scm_rights=''
732 d_sin6_scope_id=''
733 d_sockaddr_sa_len=''
734 d_socket=''
735 d_sockpair=''
736 sockethdr=''
737 socketlib=''
738 d_socklen_t=''
739 d_socks5_init=''
740 d_sprintf_returns_strlen=''
741 d_sqrtl=''
742 d_srand48_r=''
743 srand48_r_proto=''
744 d_srandom_r=''
745 srandom_r_proto=''
746 d_sresgproto=''
747 d_sresuproto=''
748 d_statblks=''
749 d_statfs_f_flags=''
750 d_statfs_s=''
751 d_static_inline=''
752 perl_static_inline=''
753 d_fstatvfs=''
754 d_statvfs=''
755 d_stdio_cnt_lval=''
756 d_stdio_ptr_lval=''
757 d_stdio_ptr_lval_nochange_cnt=''
758 d_stdio_ptr_lval_sets_cnt=''
759 d_stdiobase=''
760 d_stdstdio=''
761 stdio_base=''
762 stdio_bufsiz=''
763 stdio_cnt=''
764 stdio_filbuf=''
765 stdio_ptr=''
766 d_index=''
767 d_strchr=''
768 d_strcoll=''
769 d_strctcpy=''
770 d_strerrm=''
771 d_strerror=''
772 d_sysernlst=''
773 d_syserrlst=''
774 d_strerror_r=''
775 strerror_r_proto=''
776 d_strftime=''
777 d_strlcat=''
778 d_strlcpy=''
779 d_strtod=''
780 d_strtol=''
781 d_strtold=''
782 d_strtoll=''
783 d_strtoq=''
784 d_strtoul=''
785 d_strtoull=''
786 d_strtouq=''
787 d_strxfrm=''
788 d_symlink=''
789 d_syscall=''
790 d_syscallproto=''
791 d_sysconf=''
792 d_system=''
793 d_tcgetpgrp=''
794 d_tcsetpgrp=''
795 d_telldirproto=''
796 d_time=''
797 timetype=''
798 d_asctime64=''
799 d_ctime64=''
800 d_difftime64=''
801 d_gmtime64=''
802 d_localtime64=''
803 d_mktime64=''
804 d_timegm=''
805 clocktype=''
806 d_times=''
807 d_tmpnam_r=''
808 tmpnam_r_proto=''
809 d_truncate=''
810 d_ttyname_r=''
811 ttyname_r_proto=''
812 d_tzname=''
813 d_u32align=''
814 d_ualarm=''
815 d_umask=''
816 d_semctl_semid_ds=''
817 d_semctl_semun=''
818 d_union_semun=''
819 d_unordered=''
820 d_unsetenv=''
821 d_usleep=''
822 d_usleepproto=''
823 d_ustat=''
824 d_pseudofork=''
825 d_vfork=''
826 usevfork=''
827 d_voidsig=''
828 signal_t=''
829 d_volatile=''
830 d_charvspr=''
831 d_vprintf=''
832 d_wait4=''
833 d_waitpid=''
834 d_wcstombs=''
835 d_wctomb=''
836 d_writev=''
837 dlext=''
838 bin_ELF=''
839 cccdlflags=''
840 ccdlflags=''
841 dlsrc=''
842 ld=''
843 lddlflags=''
844 usedl=''
845 doublesize=''
846 ebcdic=''
847 fflushNULL=''
848 fflushall=''
849 fpossize=''
850 fpostype=''
851 gccansipedantic=''
852 gccosandvers=''
853 gccversion=''
854 gidformat=''
855 gidsign=''
856 gidsize=''
857 gidtype=''
858 groupstype=''
859 h_fcntl=''
860 h_sysfile=''
861 html1dir=''
862 html1direxp=''
863 installhtml1dir=''
864 html3dir=''
865 html3direxp=''
866 installhtml3dir=''
867 i_arpainet=''
868 i_assert=''
869 i_crypt=''
870 db_hashtype=''
871 db_prefixtype=''
872 db_version_major=''
873 db_version_minor=''
874 db_version_patch=''
875 i_db=''
876 i_dbm=''
877 i_rpcsvcdbm=''
878 d_dirnamlen=''
879 direntrytype=''
880 i_dirent=''
881 i_dld=''
882 i_dlfcn=''
883 i_fcntl=''
884 i_float=''
885 i_fp=''
886 i_fp_class=''
887 i_gdbm=''
888 d_grpasswd=''
889 i_grp=''
890 i_ieeefp=''
891 i_inttypes=''
892 i_langinfo=''
893 i_libutil=''
894 i_limits=''
895 i_locale=''
896 i_machcthr=''
897 i_malloc=''
898 i_mallocmalloc=''
899 i_math=''
900 i_memory=''
901 i_mntent=''
902 d_gdbm_ndbm_h_uses_prototypes=''
903 d_gdbmndbm_h_uses_prototypes=''
904 d_ndbm=''
905 d_ndbm_h_uses_prototypes=''
906 i_gdbm_ndbm=''
907 i_gdbmndbm=''
908 i_ndbm=''
909 i_netdb=''
910 i_neterrno=''
911 i_netinettcp=''
912 i_niin=''
913 i_sysin=''
914 i_poll=''
915 i_prot=''
916 i_pthread=''
917 d_pwage=''
918 d_pwchange=''
919 d_pwclass=''
920 d_pwcomment=''
921 d_pwexpire=''
922 d_pwgecos=''
923 d_pwpasswd=''
924 d_pwquota=''
925 i_pwd=''
926 i_sfio=''
927 i_shadow=''
928 i_socks=''
929 i_stdbool=''
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 st_ino_sign=''
1199 st_ino_size=''
1200 startperl=''
1201 startsh=''
1202 stdchar=''
1203 d_stdio_stream_array=''
1204 stdio_stream_array=''
1205 sysman=''
1206 sGMTIME_max=''
1207 sGMTIME_min=''
1208 sLOCALTIME_max=''
1209 sLOCALTIME_min=''
1210 trnl=''
1211 uidformat=''
1212 uidsign=''
1213 uidsize=''
1214 uidtype=''
1215 archname64=''
1216 use64bitall=''
1217 use64bitint=''
1218 dtrace=''
1219 usedtrace=''
1220 usefaststdio=''
1221 ccflags_uselargefiles=''
1222 ldflags_uselargefiles=''
1223 libswanted_uselargefiles=''
1224 uselargefiles=''
1225 uselongdouble=''
1226 usemorebits=''
1227 usemultiplicity=''
1228 nm_opt=''
1229 nm_so_opt=''
1230 runnm=''
1231 usenm=''
1232 useperlio=''
1233 usesocks=''
1234 d_oldpthreads=''
1235 use5005threads=''
1236 useithreads=''
1237 usereentrant=''
1238 usethreads=''
1239 incpath=''
1240 mips_type=''
1241 usrinc=''
1242 vaproto=''
1243 d_vendorarch=''
1244 installvendorarch=''
1245 vendorarch=''
1246 vendorarchexp=''
1247 d_vendorbin=''
1248 installvendorbin=''
1249 vendorbin=''
1250 vendorbinexp=''
1251 installvendorhtml1dir=''
1252 vendorhtml1dir=''
1253 vendorhtml1direxp=''
1254 installvendorhtml3dir=''
1255 vendorhtml3dir=''
1256 vendorhtml3direxp=''
1257 d_vendorlib=''
1258 installvendorlib=''
1259 vendorlib=''
1260 vendorlib_stem=''
1261 vendorlibexp=''
1262 installvendorman1dir=''
1263 vendorman1dir=''
1264 vendorman1direxp=''
1265 installvendorman3dir=''
1266 vendorman3dir=''
1267 vendorman3direxp=''
1268 usevendorprefix=''
1269 vendorprefix=''
1270 vendorprefixexp=''
1271 d_vendorscript=''
1272 installvendorscript=''
1273 vendorscript=''
1274 vendorscriptexp=''
1275 versiononly=''
1276 defvoidused=''
1277 voidflags=''
1278 yacc=''
1279 yaccflags=''
1280 CONFIG=''
1281
1282 : Detect odd OSs
1283 define='define'
1284 undef='undef'
1285 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1286 rmlist=''
1287
1288 : We must find out about Eunice early
1289 eunicefix=':'
1290 if test -f /etc/unixtovms; then
1291         eunicefix=/etc/unixtovms
1292 fi
1293 if test -f /etc/unixtovms.exe; then
1294         eunicefix=/etc/unixtovms.exe
1295 fi
1296
1297 : Set executable suffix now -- needed before hints available
1298 if test -f "/libs/version.library"; then
1299 : Amiga OS
1300     _exe=""
1301 elif test -f "/system/gnu_library/bin/ar.pm"; then
1302 : Stratus VOS
1303     _exe=".pm"
1304 elif test -n "$DJGPP"; then
1305 : DOS DJGPP
1306     _exe=".exe"
1307 elif test -d c:/. -o -n "$is_os2" ; then
1308 : OS/2 or cygwin
1309     _exe=".exe"
1310 fi
1311
1312 groupstype=''
1313 i_whoami=''
1314 archname=''
1315 : Possible local include directories to search.
1316 : Set locincpth to "" in a hint file to defeat local include searches.
1317 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1318 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1319 :
1320 : no include file wanted by default
1321 inclwanted=''
1322
1323 : Enable -DEBUGGING and -DDEBUGGING from the command line
1324 EBUGGING=''
1325 DEBUGGING=''
1326
1327 : set usethreads on the Configure command line to enable threads.
1328 usereentrant='undef'
1329 : Trailing extension.  Override this in a hint file, if needed.
1330 : Extra object files, if any, needed on this platform.
1331 archobjs=''
1332 libnames=''
1333 : change the next line if compiling for Xenix/286 on Xenix/386
1334 xlibpth='/usr/lib/386 /lib/386'
1335 : Possible local library directories to search.
1336 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1337 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1338
1339 : general looking path for locating libraries
1340 glibpth="/lib /usr/lib $xlibpth"
1341 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1342 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1343 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1344 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1345
1346 : Private path used by Configure to find libraries.  Its value
1347 : is prepended to libpth. This variable takes care of special
1348 : machines, like the mips.  Usually, it should be empty.
1349 plibpth=''
1350
1351 : default library list
1352 libswanted=''
1353 : some systems want to use only the non-versioned libso:s
1354 ignore_versioned_solibs=''
1355 : full support for void wanted by default
1356 defvoidused=15
1357
1358 ccname=''
1359 ccversion=''
1360 perllibs=''
1361 : set useposix=false in your hint file to disable the POSIX extension.
1362 useposix=true
1363 : set useopcode=false in your hint file to disable the Opcode extension.
1364 useopcode=true
1365 archname64=''
1366 ccflags_uselargefiles=''
1367 ldflags_uselargefiles=''
1368 libswanted_uselargefiles=''
1369 : set usemultiplicity on the Configure command line to enable multiplicity.
1370 : set usesocks on the Configure command line to enable socks.
1371 : List of libraries we want.
1372 : If anyone needs extra -lxxx, put those in a hint file.
1373 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1374 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1375 : We probably want to search /usr/shlib before most other libraries.
1376 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1377 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1378 glibpth="/usr/shlib $glibpth"
1379 : Do not use vfork unless overridden by a hint file.
1380 usevfork=false
1381
1382 : Find the basic shell for Bourne shell scripts
1383 case "$sh" in
1384 '')
1385         case "$SYSTYPE" in
1386         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1387         *) xxx='/bin/sh';;
1388         esac
1389         if test -f "$xxx"; then
1390                 sh="$xxx"
1391         else
1392                 : Build up a list and do a single loop so we can 'break' out.
1393                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1394                 for xxx in sh bash ksh pdksh ash; do
1395                         for p in $pth; do
1396                                 try="$try ${p}/${xxx}"
1397                         done
1398                 done
1399                 for xxx in $try; do
1400                         if test -f "$xxx"; then
1401                                 sh="$xxx";
1402                                 break
1403                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1404                                 sh="$xxx";
1405                                 break
1406                         elif test -f "$xxx.exe"; then
1407                                 sh="$xxx";
1408                                 break
1409                         fi
1410                 done
1411         fi
1412         ;;
1413 esac
1414
1415 case "$sh" in
1416 '')     cat >&2 <<EOM
1417 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1418
1419 Usually it's in /bin/sh.  How did you even get this far?
1420 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1421 we'll try to straighten this all out.
1422 EOM
1423         exit 1
1424         ;;
1425 esac
1426
1427 : see if sh knows # comments
1428 if `$sh -c '#' >/dev/null 2>&1`; then
1429         shsharp=true
1430         spitshell=cat
1431         xcat=/bin/cat
1432         test -f $xcat$_exe || xcat=/usr/bin/cat
1433         if test ! -f $xcat$_exe; then
1434                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1435                         if test -f $p/cat$_exe; then
1436                                 xcat=$p/cat
1437                                 break
1438                         fi
1439                 done
1440                 if test ! -f $xcat$_exe; then
1441                         echo "Can't find cat anywhere!"
1442                         exit 1
1443                 fi
1444         fi
1445         echo "#!$xcat" >sharp
1446         $eunicefix sharp
1447         chmod +x sharp
1448         ./sharp > today 2>/dev/null
1449         if test -s today; then
1450                 sharpbang='#!'
1451         else
1452                 echo "#! $xcat" > sharp
1453                 $eunicefix sharp
1454                 chmod +x sharp
1455                 ./sharp > today 2>/dev/null
1456                 if test -s today; then
1457                         sharpbang='#! '
1458                 else
1459                         sharpbang=': use '
1460                 fi
1461         fi
1462 else
1463         echo " "
1464         echo "Your $sh doesn't grok # comments--I will strip them later on."
1465         shsharp=false
1466         cd ..
1467         echo "exec grep -v '^[  ]*#'" >spitshell
1468         chmod +x spitshell
1469         $eunicefix spitshell
1470         spitshell=`pwd`/spitshell
1471         cd UU
1472         echo "I presume that if # doesn't work, #! won't work either!"
1473         sharpbang=': use '
1474 fi
1475 rm -f sharp today
1476
1477 : figure out how to guarantee sh startup
1478 case "$startsh" in
1479 '') startsh=${sharpbang}${sh} ;;
1480 *)
1481 esac
1482 cat >sharp <<EOSS
1483 $startsh
1484 set abc
1485 test "$?abc" != 1
1486 EOSS
1487
1488 chmod +x sharp
1489 $eunicefix sharp
1490 if ./sharp; then
1491         : echo "Yup, it does."
1492 else
1493         echo "Hmm... '$startsh' does not guarantee sh startup..."
1494         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1495 fi
1496 rm -f sharp
1497
1498 : Save command line options in file UU/cmdline.opt for later use in
1499 : generating config.sh.
1500 cat > cmdline.opt <<EOSH
1501 : Configure command line arguments.
1502 config_arg0='$0'
1503 config_args='$*'
1504 config_argc=$#
1505 EOSH
1506 argn=1
1507 args_exp=''
1508 args_sep=''
1509 for arg in "$@"; do
1510         cat >>cmdline.opt <<EOSH
1511 config_arg$argn='$arg'
1512 EOSH
1513         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1514 $arg
1515 EOC
1516         arg_exp=`cat cmdl.opt`
1517         args_exp="$args_exp$args_sep'$arg_exp'"
1518         argn=`expr $argn + 1`
1519         args_sep=' '
1520 done
1521 rm -f cmdl.opt
1522
1523 : produce awk script to parse command line options
1524 cat >options.awk <<'EOF'
1525 BEGIN {
1526         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1527
1528         len = length(optstr);
1529         for (i = 1; i <= len; i++) {
1530                 c = substr(optstr, i, 1);
1531                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1532                 if (a == ":") {
1533                         arg[c] = 1;
1534                         i++;
1535                 }
1536                 opt[c] = 1;
1537         }
1538 }
1539 {
1540         expect = 0;
1541         str = $0;
1542         if (substr(str, 1, 1) != "-") {
1543                 printf("'%s'\n", str);
1544                 next;
1545         }
1546         len = length($0);
1547         for (i = 2; i <= len; i++) {
1548                 c = substr(str, i, 1);
1549                 if (!opt[c]) {
1550                         printf("-%s\n", substr(str, i));
1551                         next;
1552                 }
1553                 printf("-%s\n", c);
1554                 if (arg[c]) {
1555                         if (i < len)
1556                                 printf("'%s'\n", substr(str, i + 1));
1557                         else
1558                                 expect = 1;
1559                         next;
1560                 }
1561         }
1562 }
1563 END {
1564         if (expect)
1565                 print "?";
1566 }
1567 EOF
1568
1569 : process the command line options
1570 set X `for arg in "$@"; do echo "X$arg"; done |
1571         sed -e s/X// | awk -f options.awk`
1572 eval "set $*"
1573 shift
1574 rm -f options.awk
1575
1576 : set up default values
1577 fastread=''
1578 reuseval=false
1579 config_sh=''
1580 alldone=''
1581 error=''
1582 silent=''
1583 extractsh=''
1584 override=''
1585 knowitall=''
1586 rm -f optdef.sh posthint.sh
1587 cat >optdef.sh <<EOS
1588 $startsh
1589 EOS
1590
1591
1592 : option parsing
1593 while test $# -gt 0; do
1594         case "$1" in
1595         -d) shift; fastread=yes;;
1596         -e) shift; alldone=cont;;
1597         -f)
1598                 shift
1599                 cd ..
1600                 if test -r "$1"; then
1601                         config_sh="$1"
1602                 else
1603                         echo "$me: cannot read config file $1." >&2
1604                         error=true
1605                 fi
1606                 cd UU
1607                 shift;;
1608         --help|\
1609         -h) shift; error=true;;
1610         -r) shift; reuseval=true;;
1611         -s) shift; silent=true; realsilent=true;;
1612         -E) shift; alldone=exit;;
1613         -K) shift; knowitall=true;;
1614         -O) shift; override=true;;
1615         -S) shift; silent=true; extractsh=true;;
1616         -D)
1617                 shift
1618                 case "$1" in
1619                 *=)
1620                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1621                         echo "$me: ignoring -D $1" >&2
1622                         ;;
1623                 *=*) echo "$1" | \
1624                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1625                 *) echo "$1='define'" >> optdef.sh;;
1626                 esac
1627                 shift
1628                 ;;
1629         -U)
1630                 shift
1631                 case "$1" in
1632                 *=) echo "$1" >> optdef.sh;;
1633                 *=*)
1634                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1635                         echo "$me: ignoring -U $1" >&2
1636                         ;;
1637                 *) echo "$1='undef'" >> optdef.sh;;
1638                 esac
1639                 shift
1640                 ;;
1641         -A)
1642             shift
1643             xxx=''
1644             yyy="$1"
1645             zzz=''
1646             uuu=undef
1647             case "$yyy" in
1648             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1649                  case "$zzz" in
1650                  *:*) zzz='' ;;
1651                  *)   xxx=append
1652                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1653                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1654                  esac
1655                  ;;
1656             esac
1657             case "$xxx" in
1658             '')  case "$yyy" in
1659                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1660                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1661                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1662                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1663                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1664                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1665                  esac
1666                  ;;
1667             esac
1668             case "$xxx" in
1669             append)
1670                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1671             clear)
1672                 echo "$yyy=''"                  >> posthint.sh ;;
1673             define)
1674                 case "$zzz" in
1675                 '') zzz=define ;;
1676                 esac
1677                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1678             eval)
1679                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1680             prepend)
1681                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1682             undef)
1683                 case "$zzz" in
1684                 '') zzz="$uuu" ;;
1685                 esac
1686                 echo "$yyy=$zzz"                >> posthint.sh ;;
1687             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1688             esac
1689             shift
1690             ;;
1691         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1692             exit 0;;
1693         --) break;;
1694         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1695         *) break;;
1696         esac
1697 done
1698
1699 case "$error" in
1700 true)
1701         cat >&2 <<EOM
1702 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1703                  [-U symbol] [-U symbol=] [-A command:symbol...]
1704   -d : use defaults for all answers.
1705   -e : go on without questioning past the production of config.sh.
1706   -f : specify an alternate default configuration file.
1707   -h : print this help message and exit (with an error status).
1708   -r : reuse C symbols value if possible (skips costly nm extraction).
1709   -s : silent mode, only echoes questions and essential information.
1710   -D : define symbol to have some value:
1711          -D symbol         symbol gets the value 'define'
1712          -D symbol=value   symbol gets the value 'value'
1713        common used examples (see INSTALL for more info):
1714          -Duse64bitint            use 64bit integers
1715          -Duse64bitall            use 64bit integers and pointers
1716          -Dusethreads             use thread support
1717          -Dinc_version_list=none  do not include older perl trees in @INC
1718          -DEBUGGING=none          DEBUGGING options
1719          -Dcc=gcc                 choose your compiler
1720          -Dprefix=/opt/perl5      choose your destination
1721   -E : stop at the end of questions, after having produced config.sh.
1722   -K : do not use unless you know what you are doing.
1723   -O : let -D and -U override definitions from loaded configuration file.
1724   -S : perform variable substitutions on all .SH files (can mix with -f)
1725   -U : undefine symbol:
1726          -U symbol    symbol gets the value 'undef'
1727          -U symbol=   symbol gets completely empty
1728        e.g.:  -Uversiononly
1729   -A : manipulate symbol after the platform specific hints have been applied:
1730          -A append:symbol=value   append value to symbol
1731          -A symbol=value          like append:, but with a separating space
1732          -A define:symbol=value   define symbol to have value
1733          -A clear:symbol          define symbol to be ''
1734          -A define:symbol         define symbol to be 'define'
1735          -A eval:symbol=value     define symbol to be eval of value
1736          -A prepend:symbol=value  prepend value to symbol
1737          -A undef:symbol          define symbol to be 'undef'
1738          -A undef:symbol=         define symbol to be ''
1739        e.g.:  -A prepend:libswanted='cl pthread '
1740               -A ccflags=-DSOME_MACRO
1741   -V : print version number and exit (with a zero status).
1742 EOM
1743         exit 1
1744         ;;
1745 esac
1746
1747 : Sanity checks
1748 case "$fastread$alldone" in
1749 yescont|yesexit) ;;
1750 *)
1751         case "$extractsh" in
1752         true) ;;
1753         *)
1754                 if test ! -t 0; then
1755                         echo "Say 'sh Configure', not 'sh <Configure'"
1756                         exit 1
1757                 fi
1758                 ;;
1759         esac
1760         ;;
1761 esac
1762
1763 exec 4>&1
1764 case "$silent" in
1765 true) exec 1>/dev/null;;
1766 esac
1767
1768 : run the defines and the undefines, if any, but leave the file out there...
1769 touch optdef.sh
1770 . ./optdef.sh
1771 : create the posthint manipulation script and leave the file out there...
1772 touch posthint.sh
1773
1774 : set package name
1775 package='perl5'
1776 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1777 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1778 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1779 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1780 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1781 esac
1782
1783 : Some greps do not return status, grrr.
1784 echo "grimblepritz" >grimble
1785 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1786         contains=contains
1787 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1788         contains=grep
1789 else
1790         contains=contains
1791 fi
1792 rm -f grimble
1793 : the following should work in any shell
1794 case "$contains" in
1795 contains*)
1796         echo " "
1797         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1798         cat >contains <<'EOSS'
1799 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1800 EOSS
1801 chmod +x contains
1802 esac
1803
1804 : Find the path to the source tree
1805 case "$src" in
1806 '') case "$0" in
1807     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1808          case "$src" in
1809          /*)    ;;
1810          .)     ;;
1811          *)     src=`cd ../$src && pwd` ;;
1812          esac
1813          ;;
1814     *)   src='.';;
1815     esac;;
1816 esac
1817 case "$src" in
1818 '')     src=/
1819         rsrc=/
1820         ;;
1821 /*)     rsrc="$src";;
1822 *)      rsrc="../$src";;
1823 esac
1824 if test -f $rsrc/Configure && \
1825         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1826 then
1827    : found it, so we are ok.
1828 else
1829         rsrc=''
1830         for src in . .. ../.. ../../.. ../../../..; do
1831                 if test -f ../$src/Configure && \
1832                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1833                 then
1834                         rsrc=../$src
1835                         break
1836                 fi
1837         done
1838 fi
1839 case "$rsrc" in
1840 '')
1841         cat <<EOM >&4
1842
1843 Sorry, I can't seem to locate the source dir for $package.  Please start
1844 Configure with an explicit path -- i.e. /some/path/Configure.
1845
1846 EOM
1847         exit 1
1848         ;;
1849 ../.)   rsrc='..';;
1850 *)
1851         echo " "
1852         echo "Sources for $package found in \"$src\"." >&4
1853         ;;
1854 esac
1855
1856 : script used to extract .SH files with variable substitutions
1857 cat >extract <<'EOS'
1858 PERL_CONFIG_SH=true
1859 echo "Doing variable substitutions on .SH files..."
1860 if test -f MANIFEST; then
1861         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1862 else
1863         echo "(Looking for .SH files under the source directory.)"
1864         set x `(cd "$src"; find . -name "*.SH" -print)`
1865 fi
1866 shift
1867 case $# in
1868 0) set x `(cd "$src"; echo *.SH)`; shift;;
1869 esac
1870 if test ! -f "$src/$1"; then
1871         shift
1872 fi
1873 mkdir_p='
1874 name=$1;
1875 create="";
1876 while test $name; do
1877         if test ! -d "$name"; then
1878                 create="$name $create";
1879                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1880                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1881         else
1882                 name="";
1883         fi;
1884 done;
1885 for file in $create; do
1886         mkdir $file;
1887 done
1888 '
1889 for file in $*; do
1890         case "$src" in
1891         ".")
1892                 case "$file" in
1893                 */*)
1894                         dir=`expr X$file : 'X\(.*\)/'`
1895                         file=`expr X$file : 'X.*/\(.*\)'`
1896                         (cd "$dir" && . ./$file)
1897                         ;;
1898                 *)
1899                         . ./$file
1900                         ;;
1901                 esac
1902                 ;;
1903         *)
1904                 case "$file" in
1905                 */*)
1906                         dir=`expr X$file : 'X\(.*\)/'`
1907                         file=`expr X$file : 'X.*/\(.*\)'`
1908                         (set x $dir; shift; eval $mkdir_p)
1909                         sh <"$src/$dir/$file"
1910                         ;;
1911                 *)
1912                         sh <"$src/$file"
1913                         ;;
1914                 esac
1915                 ;;
1916         esac
1917 done
1918 if test -f "$src/config_h.SH"; then
1919         if test ! -f config.h; then
1920         : oops, they left it out of MANIFEST, probably, so do it anyway.
1921         . "$src/config_h.SH"
1922         fi
1923 fi
1924 EOS
1925
1926 : extract files and exit if asked to do so
1927 case "$extractsh" in
1928 true)
1929         case "$realsilent" in
1930         true) ;;
1931         *) exec 1>&4;;
1932         esac
1933         case "$config_sh" in
1934         '') config_sh='config.sh';;
1935         esac
1936         echo " "
1937         echo "Fetching answers from $config_sh..."
1938         cd ..
1939         . $config_sh
1940         test "$override" && . ./optdef.sh
1941         echo " "
1942         . UU/extract
1943         rm -rf UU
1944         echo "Extraction done."
1945         exit 0
1946         ;;
1947 esac
1948
1949 : Eunice requires " " instead of "", can you believe it
1950 echo " "
1951 : Here we go...
1952 echo "Beginning of configuration questions for $package."
1953
1954 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1955
1956 : first determine how to suppress newline on echo command
1957 echo " "
1958 echo "Checking echo to see how to suppress newlines..."
1959 (echo "hi there\c" ; echo " ") >.echotmp
1960 if $contains c .echotmp >/dev/null 2>&1 ; then
1961         echo "...using -n."
1962         n='-n'
1963         c=''
1964 else
1965         cat <<'EOM'
1966 ...using \c
1967 EOM
1968         n=''
1969         c='\c'
1970 fi
1971 echo $n "The star should be here-->$c"
1972 echo '*'
1973 rm -f .echotmp
1974
1975 : Now test for existence of everything in MANIFEST
1976 echo " "
1977 if test -f "$rsrc/MANIFEST"; then
1978         echo "First let's make sure your kit is complete.  Checking..." >&4
1979         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1980                 (split -l 50 2>/dev/null || split -50)
1981         rm -f missing
1982         tmppwd=`pwd`
1983         for filelist in x??; do
1984                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1985                         >/dev/null 2>>"$tmppwd/missing")
1986         done
1987         if test -s missing; then
1988                 cat missing >&4
1989                 cat >&4 <<'EOM'
1990
1991 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1992
1993 You have the option of continuing the configuration process, despite the
1994 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1995 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1996 and contact the author (perlbug@perl.org).
1997
1998 EOM
1999                 echo $n "Continue? [n] $c" >&4
2000                 read ans
2001                 case "$ans" in
2002                 y*)
2003                         echo "Continuing..." >&4
2004                         rm -f missing
2005                         ;;
2006                 *)
2007                         echo "ABORTING..." >&4
2008                         kill $$
2009                         ;;
2010                 esac
2011         else
2012                 echo "Looks good..."
2013         fi
2014 else
2015         echo "There is no MANIFEST file.  I hope your kit is complete !"
2016 fi
2017 rm -f missing x??
2018
2019 : Find the appropriate value for a newline for tr
2020 echo " "
2021 if test -n "$DJGPP"; then
2022        trnl='\012'
2023 fi
2024 if test X"$trnl" = X; then
2025         case "`echo foo|tr '\n' x 2>/dev/null`" in
2026         foox) trnl='\n' ;;
2027         esac
2028 fi
2029 if test X"$trnl" = X; then
2030         case "`echo foo|tr '\012' x 2>/dev/null`" in
2031         foox) trnl='\012' ;;
2032         esac
2033 fi
2034 if test X"$trnl" = X; then
2035        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2036        fooxy) trnl='\n\r' ;;
2037        esac
2038 fi
2039 if test X"$trnl" = X; then
2040         cat <<EOM >&2
2041
2042 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2043
2044 EOM
2045         exit 1
2046 fi
2047
2048 : compute the number of columns on the terminal for proper question formatting
2049 case "$COLUMNS" in
2050 '') COLUMNS='80';;
2051 esac
2052
2053 : set up the echo used in my read
2054 myecho="case \"\$xxxm\" in
2055 '') echo $n \"\$rp $c\" >&4;;
2056 *) case \"\$rp\" in
2057         '') echo $n \"[\$xxxm] $c\";;
2058         *)
2059                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2060                         echo \"\$rp\" >&4
2061                         echo $n \"[\$xxxm] $c\" >&4
2062                 else
2063                         echo $n \"\$rp [\$xxxm] $c\" >&4
2064                 fi
2065                 ;;
2066         esac;;
2067 esac"
2068
2069 : now set up to do reads with possible shell escape and default assignment
2070 cat <<EOSC >myread
2071 $startsh
2072 xxxm=\$dflt
2073 $myecho
2074 ans='!'
2075 case "\$fastread" in
2076 yes) case "\$dflt" in
2077         '') ;;
2078         *) ans='';
2079                 case "\$silent-\$rp" in
2080                 true-) ;;
2081                 *) echo " " >&4;;
2082                 esac;;
2083         esac;;
2084 *) case "\$silent" in
2085         true) case "\$rp" in
2086                 '') ans='';;
2087                 esac;;
2088         esac;;
2089 esac
2090 while expr "X\$ans" : "X!" >/dev/null; do
2091         read answ
2092         set x \$xxxm
2093         shift
2094         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2095         case  "\$answ" in
2096         "!")
2097                 sh 1>&4
2098                 echo " "
2099                 $myecho
2100                 ;;
2101         !*)
2102                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2103                 shift
2104                 sh 1>&4 -c "\$*"
2105                 echo " "
2106                 $myecho
2107                 ;;
2108         "\$ans")
2109                 case "\$ans" in
2110                 \\&*)
2111                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2112                         shift
2113                         case "\$1" in
2114                         -d)
2115                                 fastread=yes
2116                                 echo "(OK, I'll run with -d after this question.)" >&4
2117                                 ;;
2118                         -*)
2119                                 echo "*** Sorry, \$1 not supported yet." >&4
2120                                 ;;
2121                         esac
2122                         $myecho
2123                         ans=!
2124                         ;;
2125                 esac;;
2126         *)
2127                 case "\$aok" in
2128                 y)
2129                         echo "*** Substitution done -- please confirm."
2130                         xxxm="\$ans"
2131                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2132                         xxxm="\$ans"
2133                         ans=!
2134                         ;;
2135                 *)
2136                         echo "*** Error -- try again."
2137                         ans=!
2138                         ;;
2139                 esac
2140                 $myecho
2141                 ;;
2142         esac
2143         case "\$ans\$xxxm\$nostick" in
2144         '')
2145                 ans=!
2146                 $myecho
2147                 ;;
2148         esac
2149 done
2150 case "\$ans" in
2151 '') ans="\$xxxm";;
2152 esac
2153 EOSC
2154
2155 : create .config dir to save info across Configure sessions
2156 test -d ../.config || mkdir ../.config
2157 cat >../.config/README <<EOF
2158 This directory created by Configure to save information that should
2159 persist across sessions for $package.
2160
2161 You may safely delete it if you wish.
2162 EOF
2163
2164 : See if we are using a devel version and want that
2165 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2166 case "$usedevel" in
2167 $define|true|[yY]*)
2168     usedevel="$define" ;;
2169 *) case "$xversion" in
2170    *[13579])
2171         cat >&4 <<EOH
2172 *** WHOA THERE!!! ***
2173
2174     This is an UNSTABLE DEVELOPMENT release.
2175     The version of this $package distribution is $xversion, that is, odd,
2176     (as opposed to even) and that signifies a development release.
2177     If you want a maintenance release, you want an even-numbered version.
2178
2179     Do ***NOT*** install this into production use.
2180     Data corruption and crashes are possible.
2181
2182     It is most seriously suggested that you do not continue any further
2183     unless you want to help in developing and debugging Perl.
2184
2185     If you *still* want to build perl, you can answer 'y' now,
2186     or pass -Dusedevel to Configure.
2187
2188 EOH
2189         rp='Do you really want to continue?'
2190         dflt='n'
2191         . ./myread
2192         case "$ans" in
2193         [yY]) echo >&4 "Okay, continuing."
2194               usedevel="$define" ;;
2195         *) echo >&4 "Okay, bye."
2196            exit 1
2197            ;;
2198         esac
2199         ;;
2200     esac
2201     usedevel="$undef"
2202     ;;
2203 esac
2204 case "$usedevel" in
2205 $define|true|[yY]*)
2206         case "$versiononly" in
2207         '') versiononly="$define" ;;
2208         esac
2209         case "$installusrbinperl" in
2210         '') installusrbinperl="$undef" ;;
2211         esac
2212         ;;
2213 esac
2214
2215 : general instructions
2216 needman=true
2217 firsttime=true
2218 user=`(logname) 2>/dev/null`
2219 case "$user" in
2220 '') user=`whoami 2>&1`;;
2221 esac
2222 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2223         firsttime=false
2224         echo " "
2225         rp='Would you like to see the instructions?'
2226         dflt=n
2227         . ./myread
2228         case "$ans" in
2229         [yY]*) ;;
2230         *) needman=false;;
2231         esac
2232 fi
2233 if $needman; then
2234         cat <<EOH
2235
2236 This installation shell script will examine your system and ask you questions
2237 to determine how the perl5 package should be installed. If you get
2238 stuck on a question, you may use a ! shell escape to start a subshell or
2239 execute a command.  Many of the questions will have default answers in square
2240 brackets; typing carriage return will give you the default.
2241
2242 On some of the questions which ask for file or directory names you are allowed
2243 to use the ~name construct to specify the login directory belonging to "name",
2244 even if you don't have a shell which knows about that.  Questions where this is
2245 allowed will be marked "(~name ok)".
2246
2247 EOH
2248         rp=''
2249         dflt='Type carriage return to continue'
2250         . ./myread
2251         cat <<'EOH'
2252
2253 The prompter used in this script allows you to use shell variables and
2254 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2255 in the default answer, as if the default line was a set of arguments given to a
2256 script shell.  This means you may also use $* to repeat the whole default line,
2257 so you do not have to re-type everything to add something to the default.
2258
2259 Every time there is a substitution, you will have to confirm.  If there is an
2260 error (e.g. an unmatched backtick), the default answer will remain unchanged
2261 and you will be prompted again.
2262
2263 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2264 the questions and use the computed defaults (or the previous answers if there
2265 was already a config.sh file). Type 'Configure -h' for a list of options.
2266 You may also start interactively and then answer '& -d' at any prompt to turn
2267 on the non-interactive behaviour for the remainder of the execution.
2268
2269 EOH
2270         . ./myread
2271         cat <<EOH
2272
2273 Much effort has been expended to ensure that this shell script will run on any
2274 Unix system.  If despite that it blows up on yours, your best bet is to edit
2275 Configure and run it again.  If you can't run Configure for some reason,
2276 you'll have to generate a config.sh file by hand.  Whatever problems you
2277 have, let me (perlbug@perl.org) know how I blew it.
2278
2279 This installation script affects things in two ways:
2280
2281 1) it may do direct variable substitutions on some of the files included
2282    in this kit.
2283 2) it builds a config.h file for inclusion in C programs.  You may edit
2284    any of these files as the need arises after running this script.
2285
2286 If you make a mistake on a question, there is no easy way to back up to it
2287 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2288 files.  Configure will offer to let you do this before it runs the SH files.
2289
2290 EOH
2291         dflt='Type carriage return to continue'
2292         . ./myread
2293         case "$firsttime" in
2294         true) echo $user >>../.config/instruct;;
2295         esac
2296 fi
2297
2298 : find out where common programs are
2299 echo " "
2300 echo "Locating common programs..." >&4
2301 cat <<EOSC >loc
2302 $startsh
2303 case \$# in
2304 0) exit 1;;
2305 esac
2306 thing=\$1
2307 shift
2308 dflt=\$1
2309 shift
2310 for dir in \$*; do
2311         case "\$thing" in
2312         .)
2313         if test -d \$dir/\$thing; then
2314                 echo \$dir
2315                 exit 0
2316         fi
2317         ;;
2318         *)
2319         for thisthing in \$dir/\$thing; do
2320                 : just loop through to pick last item
2321         done
2322         if test -f \$thisthing; then
2323                 echo \$thisthing
2324                 exit 0
2325         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2326                 echo \$thisthing
2327                 exit 0
2328         elif test -f \$dir/\$thing.exe; then
2329                 if test -n "$DJGPP"; then
2330                         echo \$dir/\$thing.exe
2331                 elif test "$eunicefix" != ":"; then
2332                         : on Eunice apparently
2333                         echo \$dir/\$thing
2334                 fi
2335                 exit 0
2336         fi
2337         ;;
2338         esac
2339 done
2340 echo \$dflt
2341 exit 1
2342 EOSC
2343 chmod +x loc
2344 $eunicefix loc
2345 loclist="
2346 awk
2347 cat
2348 chmod
2349 comm
2350 cp
2351 echo
2352 expr
2353 grep
2354 ls
2355 mkdir
2356 rm
2357 sed
2358 sort
2359 touch
2360 tr
2361 uniq
2362 "
2363 trylist="
2364 ar
2365 bison
2366 byacc
2367 cpp
2368 csh
2369 date
2370 egrep
2371 gmake
2372 gzip
2373 less
2374 ln
2375 make
2376 more
2377 nm
2378 nroff
2379 perl
2380 pg
2381 test
2382 uname
2383 zip
2384 "
2385 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2386 pth="$pth /lib /usr/lib"
2387 for file in $loclist; do
2388         eval xxx=\$$file
2389         case "$xxx" in
2390         /*|?:[\\/]*)
2391                 if test -f "$xxx"; then
2392                         : ok
2393                 else
2394                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2395                         xxx=`./loc $file $file $pth`
2396                 fi
2397                 ;;
2398         '') xxx=`./loc $file $file $pth`;;
2399         *) xxx=`./loc $xxx $xxx $pth`;;
2400         esac
2401         eval $file=$xxx$_exe
2402         eval _$file=$xxx
2403         case "$xxx" in
2404         /*)
2405                 echo $file is in $xxx.
2406                 ;;
2407         ?:[\\/]*)
2408                 echo $file is in $xxx.
2409                 ;;
2410         *)
2411                 echo "I don't know where '$file' is, and my life depends on it." >&4
2412                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2413                 exit 1
2414                 ;;
2415         esac
2416 done
2417 echo " "
2418 echo "Don't worry if any of the following aren't found..."
2419 say=offhand
2420 for file in $trylist; do
2421         eval xxx=\$$file
2422         case "$xxx" in
2423         /*|?:[\\/]*)
2424                 if test -f "$xxx"; then
2425                         : ok
2426                 else
2427                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2428                         xxx=`./loc $file $file $pth`
2429                 fi
2430                 ;;
2431         '') xxx=`./loc $file $file $pth`;;
2432         *) xxx=`./loc $xxx $xxx $pth`;;
2433         esac
2434         eval $file=$xxx$_exe
2435         eval _$file=$xxx
2436         case "$xxx" in
2437         /*)
2438                 echo $file is in $xxx.
2439                 ;;
2440         ?:[\\/]*)
2441                 echo $file is in $xxx.
2442                 ;;
2443         *)
2444                 echo "I don't see $file out there, $say."
2445                 say=either
2446                 ;;
2447         esac
2448 done
2449 case "$egrep" in
2450 egrep)
2451         echo "Substituting grep for egrep."
2452         egrep=$grep
2453         _egrep=$grep
2454         ;;
2455 esac
2456 case "$less" in
2457 '')     ;;
2458 *)      if $less -R </dev/null >/dev/null; then
2459                echo "Substituting less -R for less."
2460                less="$less -R"
2461                _less=$less
2462         fi
2463         ;;
2464 esac
2465 case "$ln" in
2466 ln)
2467         echo "Substituting cp for ln."
2468         ln=$cp
2469         _ln=$cp
2470         ;;
2471 esac
2472 case "$make" in
2473 make)
2474         case "$gmake" in
2475         gmake)
2476         echo "I can't find make or gmake, and my life depends on it." >&4
2477         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2478         exit 1
2479         ;;
2480         esac
2481         ;;
2482 esac
2483 case "$gmake" in
2484 gmake)  ;;
2485 *)      # We can't have osname yet.
2486         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2487                 # Assume that gmake, if found, is definitely GNU make
2488                 # and prefer it over the system make.
2489                 echo "Substituting gmake for make."
2490                 make=$gmake
2491                 _make=$gmake
2492         fi
2493         ;;
2494 esac
2495 case "$test" in
2496 test)
2497         echo "Hopefully test is built into your sh."
2498         ;;
2499 *)
2500         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2501                 echo "Using the test built into your sh."
2502                 test=test
2503                 _test=test
2504         fi
2505         ;;
2506 esac
2507 case "$echo" in
2508 echo)
2509         echo "Hopefully echo is built into your sh."
2510         ;;
2511 '') ;;
2512 *)
2513         echo " "
2514 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2515         $echo $n "hi there$c" >foo1
2516         echo $n "hi there$c" >foo2
2517         if cmp foo1 foo2 >/dev/null 2>&1; then
2518                 echo "They are compatible.  In fact, they may be identical."
2519         else
2520                 case "$n" in
2521                 '-n') n='' c='\c';;
2522                 *) n='-n' c='';;
2523                 esac
2524                 cat <<FOO
2525 They are not compatible!  You are probably running ksh on a non-USG system.
2526 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2527 have echo built in and we may have to run some Bourne shell scripts.  That
2528 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2529
2530 FOO
2531                 $echo $n "The star should be here-->$c"
2532                 $echo "*"
2533         fi
2534         $rm -f foo1 foo2
2535         ;;
2536 esac
2537
2538 # This question was auctioned at YAPC::Europe-2007 in Vienna
2539 # I never promised you could answer it. I only auctioned the question.
2540 cat <<FOO
2541 The following message is sponsored by
2542
2543   Dresden.pm<--The stars should be here.
2544
2545 Dear Perl user, system administrator or package
2546 maintainer, the Perl community sends greetings to
2547 you. Do you (emblematical) greet back [Y/n]? n
2548
2549 FOO
2550
2551 : Check what type of C compiler we use
2552 cat <<EOS >trygcc
2553 $startsh
2554 EOS
2555 cat <<'EOSC' >>trygcc
2556 case "$cc" in
2557 '') ;;
2558 *)  $rm -f try try.*
2559     $cat >try.c <<EOM
2560 int main(int argc, char *argv[]) {
2561   return 0;
2562 }
2563 EOM
2564     if $cc -o try $ccflags $ldflags try.c; then
2565        :
2566     else
2567         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2568         despair=yes
2569         trygcc=yes
2570         case "$cc" in
2571         *gcc*) trygcc=no ;;
2572         esac
2573         # Skip this test because it gives a false match on output like:
2574         #    ./trygcc: line 23: cc: command not found
2575         # case "`$cc -v -c try.c 2>&1`" in
2576         # *gcc*) trygcc=no ;;
2577         # esac
2578         if $test X"$trygcc" = Xyes; then
2579             if gcc -o try -c try.c; then
2580                 echo " "
2581                 echo "You seem to have a working gcc, though." >&4
2582                 # Switching compilers may undo the work of hints files.
2583                 # The most common problem is -D_REENTRANT for threads.
2584                 # This heuristic catches that case, but gets false positives
2585                 # if -Dusethreads was not actually specified.  Better to
2586                 # bail out here with a useful message than fail 
2587                 # mysteriously later. Should we perhaps just try to
2588                 # re-invoke Configure -Dcc=gcc config_args ?
2589                 if $test -f usethreads.cbu; then
2590                         $cat >&4 <<EOM 
2591
2592 *** However, any setting of the C compiler flags (e.g. for thread support)
2593 *** will be lost.  It may be necessary for you to restart Configure and
2594 *** add -Dcc=gcc to your Configure command line.
2595
2596 EOM
2597                         rp="Would you like to go ahead and try gcc anyway?"
2598                         dflt=n
2599                 else
2600                         rp="Would you like to use it?"
2601                         dflt=y
2602                 fi
2603                 if $test -f myread; then
2604                     . ./myread
2605                 else
2606                     if $test -f UU/myread; then
2607                         . ./UU/myread
2608                     else
2609                         echo "Cannot find myread, sorry.  Aborting." >&2
2610                         exit 1
2611                     fi
2612                 fi  
2613                 case "$ans" in
2614                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2615                 esac
2616             fi
2617         fi
2618     fi
2619     $rm -f try try.*
2620     ;;
2621 esac
2622 EOSC
2623
2624 cat <<EOS >checkcc
2625 $startsh
2626 EOS
2627 cat <<'EOSC' >>checkcc
2628 case "$cc" in        
2629 '') ;;
2630 *)  $rm -f try try.*              
2631     $cat >try.c <<EOM
2632 int main(int argc, char *argv[]) {
2633   return 0;
2634 }
2635 EOM
2636     if $cc -o try $ccflags $ldflags try.c; then
2637        :
2638     else
2639         if $test X"$despair" = Xyes; then
2640            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2641         fi
2642         $cat >&4 <<EOM         
2643 You need to find a working C compiler.
2644 Either (purchase and) install the C compiler supplied by your OS vendor,
2645 or for a free C compiler try http://gcc.gnu.org/
2646 I cannot continue any further, aborting.
2647 EOM
2648         exit 1
2649     fi
2650     $rm -f try try.*
2651     ;;
2652 esac
2653 EOSC
2654
2655 : determine whether symbolic links are supported
2656 echo " "
2657 $touch blurfl
2658 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2659         echo "Symbolic links are supported." >&4
2660         lns="$ln -s"
2661 else
2662         echo "Symbolic links are NOT supported." >&4
2663         lns="$ln"
2664 fi
2665 $rm -f blurfl sym
2666
2667 : determine whether symbolic links are supported
2668 echo " "
2669 case "$lns" in
2670 *"ln"*" -s")
2671         echo "Checking how to test for symbolic links..." >&4
2672         $lns blurfl sym
2673         if $test "X$issymlink" = X; then
2674                 case "$newsh" in
2675                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2676                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2677                 esac
2678                 if test $? = 0; then
2679                         issymlink="test -h"
2680                 else
2681                         echo "Your builtin 'test -h' may be broken." >&4
2682                         case "$test" in
2683                         /*)     ;;
2684                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2685                                 for p in $pth
2686                                 do
2687                                         if test -f "$p/$test"; then
2688                                                 test="$p/$test"
2689                                                 break
2690                                         fi
2691                                 done
2692                                 ;;
2693                         esac
2694                         case "$test" in
2695                         /*)
2696                                 echo "Trying external '$test -h'." >&4
2697                                 issymlink="$test -h"
2698                                 if $test ! -h sym >/dev/null 2>&1; then
2699                                         echo "External '$test -h' is broken, too." >&4
2700                                         issymlink=''
2701                                 fi
2702                                 ;;
2703                         *)      issymlink='' ;;
2704                         esac
2705                 fi              
2706         fi
2707         if $test "X$issymlink" = X; then
2708                 if $test -L sym 2>/dev/null; then
2709                         issymlink="$test -L"
2710                         echo "The builtin '$test -L' worked." >&4
2711                 fi
2712         fi
2713         if $test "X$issymlink" != X; then
2714                 echo "You can test for symbolic links with '$issymlink'." >&4
2715         else
2716                 echo "I do not know how you can test for symbolic links." >&4
2717         fi
2718         $rm -f blurfl sym
2719         ;;
2720 *)      echo "No symbolic links, so not testing for their testing..." >&4
2721         ;;
2722 esac
2723 echo " "
2724
2725 : Make symlinks util
2726 case "$mksymlinks" in
2727 $define|true|[yY]*)
2728         case "$src" in
2729         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2730                 exit 1
2731                 ;;
2732         *)      case "$lns:$issymlink" in
2733                 *"ln"*" -s:"*"test -"?)
2734                         echo "Creating the symbolic links..." >&4
2735                         echo "(First creating the subdirectories...)" >&4
2736                         cd ..
2737                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2738                                 read directory
2739                                 test -z "$directory" && break
2740                                 mkdir -p $directory
2741                         done
2742                         # Sanity check 1.
2743                         if test ! -d t/base; then
2744                                 echo "Failed to create the subdirectories.  Aborting." >&4
2745                                 exit 1
2746                         fi
2747                         echo "(Then creating the symlinks...)" >&4
2748                         awk '{print $1}' $src/MANIFEST | while true; do
2749                                 read filename
2750                                 test -z "$filename" && break
2751                                 if test -f $filename; then
2752                                         if $issymlink $filename; then
2753                                                 rm -f $filename
2754                                         fi
2755                                 fi
2756                                 if test -f $filename; then
2757                                         echo "$filename already exists, not symlinking."
2758                                 else
2759                                         ln -s $src/$filename $filename
2760                                 fi
2761                         done
2762                         # Sanity check 2.
2763                         if test ! -f t/base/lex.t; then
2764                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2765                                 exit 1
2766                         fi
2767                         cd UU
2768                         ;;
2769                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2770                         ;;
2771                 esac
2772                 ;;
2773         esac
2774         ;;
2775 esac
2776
2777 : Check for Cross-Compilation
2778 case "$usecrosscompile" in
2779 $define|true|[yY]*)
2780         $echo "Cross-compiling..."
2781         croak=''
2782         case "$cc" in
2783         *-*-gcc) # A cross-compiling gcc, probably.
2784             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2785             ar=$targetarch-ar
2786             # leave out ld, choosing it is more complex
2787             nm=$targetarch-nm
2788             ranlib=$targetarch-ranlib
2789             $echo 'extern int foo;' > try.c
2790             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2791             shift
2792             if $test $# -gt 0; then
2793                 incpth="$incpth $*"
2794                 incpth="`$echo $incpth|$sed 's/^ //'`"
2795                 echo "Guessing incpth '$incpth'." >&4
2796                 for i in $*; do
2797                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2798                     if $test -d $j; then
2799                         libpth="$libpth $j"
2800                     fi
2801                 done   
2802                 libpth="`$echo $libpth|$sed 's/^ //'`"
2803                 echo "Guessing libpth '$libpth'." >&4
2804             fi
2805             $rm -f try.c
2806             ;;
2807         esac
2808         case "$targetarch" in
2809         '') echo "Targetarch not defined." >&4; croak=y ;;
2810         *)  echo "Using targetarch $targetarch." >&4 ;;
2811         esac
2812         case "$incpth" in
2813         '') echo "Incpth not defined." >&4; croak=y ;;
2814         *)  echo "Using incpth '$incpth'." >&4 ;;
2815         esac
2816         case "$libpth" in
2817         '') echo "Libpth not defined." >&4; croak=y ;;
2818         *)  echo "Using libpth '$libpth'." >&4 ;;
2819         esac
2820         case "$usrinc" in
2821         '') for i in $incpth; do
2822                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2823                     usrinc=$i
2824                     echo "Guessing usrinc $usrinc." >&4
2825                     break
2826                 fi
2827             done
2828             case "$usrinc" in
2829             '') echo "Usrinc not defined." >&4; croak=y ;;
2830             esac
2831             ;;
2832         *)  echo "Using usrinc $usrinc." >&4 ;;
2833         esac
2834         case "$targethost" in
2835         '') echo "Targethost not defined." >&4; croak=y ;;
2836         *)  echo "Using targethost $targethost." >&4
2837         esac
2838         locincpth=' '
2839         loclibpth=' '
2840         case "$croak" in
2841         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2842         esac
2843         case "$src" in
2844         /*) run=$src/Cross/run
2845             targetmkdir=$src/Cross/mkdir
2846             to=$src/Cross/to
2847             from=$src/Cross/from
2848             ;;
2849         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2850             run=$pwd/Cross/run
2851             targetmkdir=$pwd/Cross/mkdir
2852             to=$pwd/Cross/to
2853             from=$pwd/Cross/from
2854             ;;
2855         esac
2856         case "$targetrun" in
2857         '') targetrun=ssh ;;
2858         esac
2859         case "$targetto" in
2860         '') targetto=scp ;;
2861         esac
2862         case "$targetfrom" in
2863         '') targetfrom=scp ;;
2864         esac
2865         run=$run-$targetrun
2866         to=$to-$targetto
2867         from=$from-$targetfrom
2868         case "$targetdir" in
2869         '')  targetdir=/tmp
2870              echo "Guessing targetdir $targetdir." >&4
2871              ;;
2872         esac
2873         case "$targetuser" in
2874         '')  targetuser=root
2875              echo "Guessing targetuser $targetuser." >&4
2876              ;;
2877         esac
2878         case "$targetfrom" in
2879         scp)    q=-q ;;
2880         *)      q='' ;;
2881         esac
2882         case "$targetrun" in
2883         ssh|rsh)
2884             cat >$run <<EOF
2885 #!/bin/sh
2886 case "\$1" in
2887 -cwd)
2888   shift
2889   cwd=\$1
2890   shift
2891   ;;
2892 esac
2893 case "\$cwd" in
2894 '') cwd=$targetdir ;;
2895 esac
2896 exe=\$1
2897 shift
2898 if $test ! -f \$exe.xok; then
2899   $to \$exe
2900   $touch \$exe.xok
2901 fi
2902 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2903 EOF
2904             ;;
2905         *)  echo "Unknown targetrun '$targetrun'" >&4
2906             exit 1
2907             ;;
2908         esac
2909         case "$targetmkdir" in
2910         */Cross/mkdir)
2911             cat >$targetmkdir <<EOF
2912 #!/bin/sh
2913 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2914 EOF
2915             $chmod a+rx $targetmkdir
2916             ;;
2917         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2918             exit 1
2919             ;;
2920         esac
2921         case "$targetto" in
2922         scp|rcp)
2923             cat >$to <<EOF
2924 #!/bin/sh
2925 for f in \$@
2926 do
2927   case "\$f" in
2928   /*)
2929     $targetmkdir \`dirname \$f\`
2930     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2931     ;;
2932   *)
2933     $targetmkdir $targetdir/\`dirname \$f\`
2934     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2935     ;;
2936   esac
2937 done
2938 exit 0
2939 EOF
2940             ;;
2941         cp) cat >$to <<EOF
2942 #!/bin/sh
2943 for f in \$@
2944 do
2945   case "\$f" in
2946   /*)
2947     $mkdir -p $targetdir/\`dirname \$f\`
2948     $cp \$f $targetdir/\$f || exit 1
2949     ;;
2950   *)
2951     $targetmkdir $targetdir/\`dirname \$f\`
2952     $cp \$f $targetdir/\$f || exit 1
2953     ;;
2954   esac
2955 done
2956 exit 0
2957 EOF
2958             ;;
2959         *)  echo "Unknown targetto '$targetto'" >&4
2960             exit 1
2961             ;;
2962         esac
2963         case "$targetfrom" in
2964         scp|rcp)
2965           cat >$from <<EOF
2966 #!/bin/sh
2967 for f in \$@
2968 do
2969   $rm -f \$f
2970   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2971 done
2972 exit 0
2973 EOF
2974             ;;
2975         cp) cat >$from <<EOF
2976 #!/bin/sh
2977 for f in \$@
2978 do
2979   $rm -f \$f
2980   cp $targetdir/\$f . || exit 1
2981 done
2982 exit 0
2983 EOF
2984             ;;
2985         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2986             exit 1
2987             ;;
2988         esac
2989         if $test ! -f $run; then
2990             echo "Target 'run' script '$run' not found." >&4
2991         else
2992             $chmod a+rx $run
2993         fi
2994         if $test ! -f $to; then
2995             echo "Target 'to' script '$to' not found." >&4
2996         else
2997             $chmod a+rx $to
2998         fi
2999         if $test ! -f $from; then
3000             echo "Target 'from' script '$from' not found." >&4
3001         else
3002             $chmod a+rx $from
3003         fi
3004         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3005             exit 1
3006         fi
3007         cat >&4 <<EOF
3008 Using '$run' for remote execution,
3009 and '$from' and '$to'
3010 for remote file transfer.
3011 EOF
3012         ;;
3013 *)      run=''
3014         to=:
3015         from=:
3016         usecrosscompile='undef'
3017         targetarch=''
3018         ;;
3019 esac
3020
3021 : see whether [:lower:] and [:upper:] are supported character classes
3022 echo " "
3023 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3024 ABYZ)
3025         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3026         up='[:upper:]'
3027         low='[:lower:]'
3028         ;;
3029 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3030         # (0xd9 and 0xe2), therefore that is a nice testing point.
3031         if test "X$up" = X -o "X$low" = X; then
3032             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3033             rs) up='[A-Z]'
3034                 low='[a-z]'
3035                 ;;
3036             esac
3037         fi
3038         if test "X$up" = X -o "X$low" = X; then
3039             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3040             rs) up='A-Z'
3041                 low='a-z'
3042                 ;;
3043             esac
3044         fi
3045         if test "X$up" = X -o "X$low" = X; then
3046             case "`echo RS | od -x 2>/dev/null`" in
3047             *D9E2*|*d9e2*)
3048                 echo "Hey, this might be EBCDIC." >&4
3049                 if test "X$up" = X -o "X$low" = X; then
3050                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3051                     rs) up='[A-IJ-RS-Z]'
3052                         low='[a-ij-rs-z]'
3053                         ;;
3054                     esac
3055                 fi
3056                 if test "X$up" = X -o "X$low" = X; then
3057                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3058                     rs) up='A-IJ-RS-Z'
3059                         low='a-ij-rs-z'
3060                         ;;
3061                     esac
3062                 fi
3063                 ;;
3064             esac
3065         fi
3066 esac
3067 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3068 rs)
3069     echo "Using $up and $low to convert case." >&4
3070     ;;
3071 *)
3072     echo "I don't know how to translate letters from upper to lower case." >&4
3073     echo "Your tr is not acting any way I know of." >&4
3074     exit 1
3075     ;;
3076 esac
3077 : set up the translation script tr, must be called with ./tr of course
3078 cat >tr <<EOSC
3079 $startsh
3080 case "\$1\$2" in
3081 '[A-Z][a-z]') exec $tr '$up' '$low';;
3082 '[a-z][A-Z]') exec $tr '$low' '$up';;
3083 esac
3084 exec $tr "\$@"
3085 EOSC
3086 chmod +x tr
3087 $eunicefix tr
3088
3089 : Try to determine whether config.sh was made on this system
3090 case "$config_sh" in
3091 '')
3092 myuname=`$uname -a 2>/dev/null`
3093 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3094 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3095 # because the A-Z/a-z are not consecutive.
3096 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3097         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3098 newmyuname="$myuname"
3099 dflt=n
3100 case "$knowitall" in
3101 '')
3102         if test -f ../config.sh; then
3103                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3104                         eval "`grep myuname= ../config.sh`"
3105                 fi
3106                 if test "X$myuname" = "X$newmyuname"; then
3107                         dflt=y
3108                 fi
3109         fi
3110         ;;
3111 *) dflt=y;;
3112 esac
3113
3114 : Get old answers from old config file if Configure was run on the
3115 : same system, otherwise use the hints.
3116 hint=default
3117 cd ..
3118 if test -f config.sh; then
3119         echo " "
3120         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3121         . UU/myread
3122         case "$ans" in
3123         n*|N*) echo "OK, I'll ignore it."
3124                 mv config.sh config.sh.old
3125                 myuname="$newmyuname"
3126                 ;;
3127         *)  echo "Fetching default answers from your old config.sh file..." >&4
3128                 tmp_n="$n"
3129                 tmp_c="$c"
3130                 tmp_sh="$sh"
3131                 . ./config.sh
3132                 cp config.sh UU
3133                 n="$tmp_n"
3134                 c="$tmp_c"
3135                 : Older versions did not always set $sh.  Catch re-use of such
3136                 : an old config.sh.
3137                 case "$sh" in
3138                 '') sh="$tmp_sh" ;;
3139                 esac
3140                 hint=previous
3141                 ;;
3142         esac
3143 fi
3144 . ./UU/checkcc
3145 if test ! -f config.sh; then
3146         $cat <<EOM
3147
3148 First time through, eh?  I have some defaults handy for some systems
3149 that need some extra help getting the Configure answers right:
3150
3151 EOM
3152         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3153         dflt=''
3154         : Half the following guesses are probably wrong... If you have better
3155         : tests or hints, please send them to perlbug@perl.org
3156         : The metaconfig authors would also appreciate a copy...
3157         $test -f /irix && osname=irix
3158         $test -f /xenix && osname=sco_xenix
3159         $test -f /dynix && osname=dynix
3160         $test -f /dnix && osname=dnix
3161         $test -f /lynx.os && osname=lynxos
3162         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3163         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3164         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3165         $test -f /bin/mips && /bin/mips && osname=mips
3166         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3167                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3168         $test -d /usr/apollo/bin && osname=apollo
3169         $test -f /etc/saf/_sactab && osname=svr4
3170         $test -d /usr/include/minix && osname=minix
3171         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3172         if $test -d /MachTen -o -d /MachTen_Folder; then
3173                 osname=machten
3174                 if $test -x /sbin/version; then
3175                         osvers=`/sbin/version | $awk '{print $2}' |
3176                         $sed -e 's/[A-Za-z]$//'`
3177                 elif $test -x /usr/etc/version; then
3178                         osvers=`/usr/etc/version | $awk '{print $2}' |
3179                         $sed -e 's/[A-Za-z]$//'`
3180                 else
3181                         osvers="$2.$3"
3182                 fi
3183         fi
3184
3185         $test -f /sys/posix.dll &&
3186                 $test -f /usr/bin/what &&
3187                 set X `/usr/bin/what /sys/posix.dll` &&
3188                 $test "$3" = UWIN &&
3189                 osname=uwin &&
3190                 osvers="$5"
3191
3192         if $test -f $uname; then
3193                 set X $myuname
3194                 shift
3195
3196                 case "$5" in
3197                 fps*) osname=fps ;;
3198                 mips*)
3199                         case "$4" in
3200                         umips) osname=umips ;;
3201                         *) osname=mips ;;
3202                         esac;;
3203                 [23]100) osname=mips ;;
3204                 next*) osname=next ;;
3205                 i386*)
3206                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3207                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3208                                 osname='sco'
3209                                 osvers=$tmp
3210                         elif $test -f /etc/kconfig; then
3211                                 osname=isc
3212                                 if test "$lns" = "$ln -s"; then
3213                                         osvers=4
3214                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3215                                         osvers=3
3216                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3217                                         osvers=2
3218                                 fi
3219                         fi
3220                         tmp=''
3221                         ;;
3222                 pc*)
3223                         if test -n "$DJGPP"; then
3224                                 osname=dos
3225                                 osvers=djgpp
3226                         fi
3227                         ;;
3228                 esac
3229
3230                 case "$1" in
3231                 aix) osname=aix
3232                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3233                         case "$tmp" in
3234                         # oslevel can fail with:
3235                         # oslevel: Unable to acquire lock.
3236                         *not\ found) osvers="$4"."$3" ;;
3237                         '<3240'|'<>3240') osvers=3.2.0 ;;
3238                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3239                         '=3250'|'>3250') osvers=3.2.5 ;;
3240                         *) osvers=$tmp;;
3241                         esac
3242                         ;;
3243                 bsd386) osname=bsd386
3244                         osvers=`$uname -r`
3245                         ;;
3246                 cygwin*) osname=cygwin
3247                         osvers="$3"
3248                         ;;
3249                 *dc.osx) osname=dcosx
3250                         osvers="$3"
3251                         ;;
3252                 dnix) osname=dnix
3253                         osvers="$3"
3254                         ;;
3255                 domainos) osname=apollo
3256                         osvers="$3"
3257                         ;;
3258                 dgux)   osname=dgux
3259                         osvers="$3"
3260                         ;;
3261                 dragonfly) osname=dragonfly
3262                         osvers="$3"
3263                         ;;
3264                 dynixptx*) osname=dynixptx
3265                         osvers=`echo "$4"|sed 's/^v//'`
3266                         ;;
3267                 freebsd) osname=freebsd
3268                         osvers="$3" ;;
3269                 genix)  osname=genix ;;
3270                 gnu)    osname=gnu
3271                         osvers="$3" ;;
3272                 hp*)    osname=hpux
3273                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3274                         ;;
3275                 irix*)  osname=irix
3276                         case "$3" in
3277                         4*) osvers=4 ;;
3278                         5*) osvers=5 ;;
3279                         *)      osvers="$3" ;;
3280                         esac
3281                         ;;
3282                 linux)  osname=linux
3283                         case "$3" in
3284                         *)      osvers="$3" ;;
3285                         esac
3286                         ;;
3287                 MiNT)   osname=mint
3288                         ;;
3289                 netbsd*) osname=netbsd
3290                         osvers="$3"
3291                         ;;
3292                 news-os) osvers="$3"
3293                         case "$3" in
3294                         4*) osname=newsos4 ;;
3295                         *) osname=newsos ;;
3296                         esac
3297                         ;;
3298                 next*) osname=next ;;
3299                 nonstop-ux) osname=nonstopux ;;
3300                 openbsd) osname=openbsd
3301                         osvers="$3"
3302                         ;;
3303                 os2)    osname=os2
3304                         osvers="$4"
3305                         ;;
3306                 POSIX-BC | posix-bc ) osname=posix-bc
3307                         osvers="$3"
3308                         ;;
3309                 powerux | power_ux | powermax_os | powermaxos | \
3310                 powerunix | power_unix) osname=powerux
3311                         osvers="$3"
3312                         ;;
3313                 qnx) osname=qnx
3314                         osvers="$4"
3315                         ;;
3316                 solaris) osname=solaris
3317                         case "$3" in
3318                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3319                         *)      osvers="$3" ;;
3320                         esac
3321                         ;;
3322                 sunos) osname=sunos
3323                         case "$3" in
3324                         5*) osname=solaris
3325                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3326                         *)      osvers="$3" ;;
3327                         esac
3328                         ;;
3329                 titanos) osname=titanos
3330                         case "$3" in
3331                         1*) osvers=1 ;;
3332                         2*) osvers=2 ;;
3333                         3*) osvers=3 ;;
3334                         4*) osvers=4 ;;
3335                         *)      osvers="$3" ;;
3336                         esac
3337                         ;;
3338                 ultrix) osname=ultrix
3339                         osvers="$3"
3340                         ;;
3341                 osf1|mls+)      case "$5" in
3342                                 alpha)
3343                                         osname=dec_osf
3344                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3345                                         case "$osvers" in
3346                                         [1-9].[0-9]*) ;;
3347                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3348                                         esac
3349                                         ;;
3350                         hp*)    osname=hp_osf1  ;;
3351                         mips)   osname=mips_osf1 ;;
3352                         esac
3353                         ;;
3354                 # UnixWare 7.1.2 is known as Open UNIX 8
3355                 openunix|unixware) osname=svr5
3356                         osvers="$4"
3357                         ;;
3358                 uts)    osname=uts
3359                         osvers="$3"
3360                         ;;
3361                 vos) osvers="$3"
3362                         ;;
3363                 $2) case "$osname" in
3364                         *isc*) ;;
3365                         *freebsd*) ;;
3366                         svr*)
3367                                 : svr4.x or possibly later
3368                                 case "svr$3" in
3369                                 ${osname}*)
3370                                         osname=svr$3
3371                                         osvers=$4
3372                                         ;;
3373                                 esac
3374                                 case "$osname" in
3375                                 svr4.0)
3376                                         : Check for ESIX
3377                                         if test -f /stand/boot ; then
3378                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3379                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3380                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3381                                                         if test -n "$isesix"; then
3382                                                                 osname=esix4
3383                                                         fi
3384                                                 fi
3385                                         fi
3386                                         ;;
3387                                 esac
3388                                 ;;
3389                         *)      if test -f /etc/systemid; then
3390                                         osname=sco
3391                                         set `echo $3 | $sed 's/\./ /g'` $4
3392                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3393                                                 osvers=$1.$2.$3
3394                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3395                                                 osvers=$1.$2
3396                                         elif $test -f $src/hints/sco_$1.sh; then
3397                                                 osvers=$1
3398                                         fi
3399                                 else
3400                                         case "$osname" in
3401                                         '') : Still unknown.  Probably a generic Sys V.
3402                                                 osname="sysv"
3403                                                 osvers="$3"
3404                                                 ;;
3405                                         esac
3406                                 fi
3407                                 ;;
3408                         esac
3409                         ;;
3410                 *)      case "$osname" in
3411                         '') : Still unknown.  Probably a generic BSD.
3412                                 osname="$1"
3413                                 osvers="$3"
3414                                 ;;
3415                         esac
3416                         ;;
3417                 esac
3418         else
3419                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3420                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3421                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3422                                 osname=news_os
3423                         fi
3424                         $rm -f UU/kernel.what
3425                 elif test -d c:/. -o -n "$is_os2" ; then
3426                         set X $myuname
3427                         osname=os2
3428                         osvers="$5"
3429                 fi
3430         fi
3431
3432         case "$targetarch" in
3433         '') ;;
3434         *)  hostarch=$osname
3435             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3436             osvers=''
3437             ;;
3438         esac
3439
3440         : Now look for a hint file osname_osvers, unless one has been
3441         : specified already.
3442         case "$hintfile" in
3443         ''|' ')
3444                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3445                 : Also try without trailing minor version numbers.
3446                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3447                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3448                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3449                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3450                 case "$file" in
3451                 '') dflt=none ;;
3452                 *)  case "$osvers" in
3453                         '') dflt=$file
3454                                 ;;
3455                         *)  if $test -f $src/hints/$file.sh ; then
3456                                         dflt=$file
3457                                 elif $test -f $src/hints/$xfile.sh ; then
3458                                         dflt=$xfile
3459                                 elif $test -f $src/hints/$xxfile.sh ; then
3460                                         dflt=$xxfile
3461                                 elif $test -f $src/hints/$xxxfile.sh ; then
3462                                         dflt=$xxxfile
3463                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3464                                         dflt=$xxxxfile
3465                                 elif $test -f "$src/hints/${osname}.sh" ; then
3466                                         dflt="${osname}"
3467                                 else
3468                                         dflt=none
3469                                 fi
3470                                 ;;
3471                         esac
3472                         ;;
3473                 esac
3474                 if $test -f Policy.sh ; then
3475                         case "$dflt" in
3476                         *Policy*) ;;
3477                         none) dflt="Policy" ;;
3478                         *) dflt="Policy $dflt" ;;
3479                         esac
3480                 fi
3481                 ;;
3482         *)
3483                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3484                 ;;
3485         esac
3486
3487         if $test -f Policy.sh ; then
3488                 $cat <<EOM
3489
3490 There's also a Policy hint file available, which should make the
3491 site-specific (policy) questions easier to answer.
3492 EOM
3493
3494         fi
3495
3496         $cat <<EOM
3497
3498 You may give one or more space-separated answers, or "none" if appropriate.
3499 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3500 previous run of Configure, you may specify it as well as or instead of
3501 OS-specific hints.  If hints are provided for your OS, you should use them:
3502 although Perl can probably be built without hints on many platforms, using
3503 hints often improve performance and may enable features that Configure can't
3504 set up on its own. If there are no hints that match your OS, specify "none";
3505 DO NOT give a wrong version or a wrong OS.
3506
3507 EOM
3508
3509         rp="Which of these apply, if any?"
3510         . UU/myread
3511         tans=$ans
3512         for file in $tans; do
3513                 if $test X$file = XPolicy -a -f Policy.sh; then
3514                         . Policy.sh
3515                         $cat Policy.sh >> UU/config.sh
3516                 elif $test -f $src/hints/$file.sh; then
3517                         . $src/hints/$file.sh
3518                         $cat $src/hints/$file.sh >> UU/config.sh
3519                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3520                         : nothing
3521                 else
3522                         : Give one chance to correct a possible typo.
3523                         echo "$file.sh does not exist"
3524                         dflt=$file
3525                         rp="hint to use instead?"
3526                         . UU/myread
3527                         for file in $ans; do
3528                                 if $test -f "$src/hints/$file.sh"; then
3529                                         . $src/hints/$file.sh
3530                                         $cat $src/hints/$file.sh >> UU/config.sh
3531                                 elif $test X$ans = X -o X$ans = Xnone ; then
3532                                         : nothing
3533                                 else
3534                                         echo "$file.sh does not exist -- ignored."
3535                                 fi
3536                         done
3537                 fi
3538         done
3539
3540         hint=recommended
3541         : Remember our hint file for later.
3542         if $test -f "$src/hints/$file.sh" ; then
3543                 hintfile="$file"
3544         else
3545                 hintfile=''
3546         fi
3547 fi
3548 cd UU
3549 ;;
3550 *)
3551         echo " "
3552         echo "Fetching default answers from $config_sh..." >&4
3553         tmp_n="$n"
3554         tmp_c="$c"
3555         cd ..
3556         cp $config_sh config.sh 2>/dev/null
3557         chmod +w config.sh
3558         . ./config.sh
3559         cd UU
3560         cp ../config.sh .
3561         n="$tmp_n"
3562         c="$tmp_c"
3563         hint=previous
3564         ;;
3565 esac
3566 test "$override" && . ./optdef.sh
3567
3568 : Restore computed paths
3569 for file in $loclist $trylist; do
3570         eval $file="\$_$file"
3571 done
3572
3573 cat << EOM
3574
3575 Configure uses the operating system name and version to set some defaults.
3576 The default value is probably right if the name rings a bell. Otherwise,
3577 since spelling matters for me, either accept the default or answer "none"
3578 to leave it blank.
3579
3580 EOM
3581 case "$osname" in
3582         ''|' ')
3583                 case "$hintfile" in
3584                 ''|' '|none) dflt=none ;;
3585                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3586                 esac
3587                 ;;
3588         *) dflt="$osname" ;;
3589 esac
3590 rp="Operating system name?"
3591 . ./myread
3592 case "$ans" in
3593 none)  osname='' ;;
3594 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3595 esac
3596 echo " "
3597 case "$osvers" in
3598         ''|' ')
3599                 case "$hintfile" in
3600                 ''|' '|none) dflt=none ;;
3601                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3602                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3603                         case "$dflt" in
3604                         ''|' ') dflt=none ;;
3605                         esac
3606                         ;;
3607                 esac
3608                 ;;
3609         *) dflt="$osvers" ;;
3610 esac
3611 rp="Operating system version?"
3612 . ./myread
3613 case "$ans" in
3614 none)  osvers='' ;;
3615 *) osvers="$ans" ;;
3616 esac
3617
3618
3619 . ./posthint.sh
3620
3621 : who configured the system
3622 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3623 case "$cf_by" in
3624 "")
3625         cf_by=`(logname) 2>/dev/null`
3626         case "$cf_by" in
3627         "")
3628                 cf_by=`(whoami) 2>/dev/null`
3629                 case "$cf_by" in
3630                 "") cf_by=unknown ;;
3631                 esac ;;
3632         esac ;;
3633 esac
3634
3635 : decide how portable to be.  Allow command line overrides.
3636 case "$d_portable" in
3637 "$undef") ;;
3638 *)      d_portable="$define" ;;
3639 esac
3640
3641 : set up shell script to do ~ expansion
3642 cat >filexp <<EOSS
3643 $startsh
3644 : expand filename
3645 case "\$1" in
3646  \~/*|\~)
3647         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3648         ;;
3649  \~*)
3650         if $test -f /bin/csh; then
3651                 /bin/csh -f -c "glob \$1"
3652                 failed=\$?
3653                 echo ""
3654                 exit \$failed
3655         else
3656                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3657                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3658                 if $test ! -d "\$dir"; then
3659                         me=\`basename \$0\`
3660                         echo "\$me: can't locate home directory for: \$name" >&2
3661                         exit 1
3662                 fi
3663                 case "\$1" in
3664                 */*)
3665                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3666                         ;;
3667                 *)
3668                         echo \$dir
3669                         ;;
3670                 esac
3671         fi
3672         ;;
3673 *)
3674         echo \$1
3675         ;;
3676 esac
3677 EOSS
3678 chmod +x filexp
3679 $eunicefix filexp
3680
3681 : now set up to get a file name
3682 cat <<EOS >getfile
3683 $startsh
3684 EOS
3685 cat <<'EOSC' >>getfile
3686 tilde=''
3687 fullpath=''
3688 already=''
3689 skip=''
3690 none_ok=''
3691 exp_file=''
3692 nopath_ok=''
3693 orig_rp="$rp"
3694 orig_dflt="$dflt"
3695 case "$gfpth" in
3696 '') gfpth='.' ;;
3697 esac
3698
3699 case "$fn" in
3700 *\(*)
3701         : getfile will accept an answer from the comma-separated list
3702         : enclosed in parentheses even if it does not meet other criteria.
3703         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3704         fn=`echo $fn | sed 's/(.*)//'`
3705         ;;
3706 esac
3707
3708 case "$fn" in
3709 *:*)
3710         loc_file=`expr $fn : '.*:\(.*\)'`
3711         fn=`expr $fn : '\(.*\):.*'`
3712         ;;
3713 esac
3714
3715 case "$fn" in
3716 *~*) tilde=true;;
3717 esac
3718 case "$fn" in
3719 */*) fullpath=true;;
3720 esac
3721 case "$fn" in
3722 *+*) skip=true;;
3723 esac
3724 case "$fn" in
3725 *n*) none_ok=true;;
3726 esac
3727 case "$fn" in
3728 *e*) exp_file=true;;
3729 esac
3730 case "$fn" in
3731 *p*) nopath_ok=true;;
3732 esac
3733
3734 case "$fn" in
3735 *f*) type='File';;
3736 *d*) type='Directory';;
3737 *l*) type='Locate';;
3738 esac
3739
3740 what="$type"
3741 case "$what" in
3742 Locate) what='File';;
3743 esac
3744
3745 case "$exp_file" in
3746 '')
3747         case "$d_portable" in
3748         "$define") ;;
3749         *) exp_file=true;;
3750         esac
3751         ;;
3752 esac
3753
3754 cd ..
3755 while test "$type"; do
3756         redo=''
3757         rp="$orig_rp"
3758         dflt="$orig_dflt"
3759         case "$tilde" in
3760         true) rp="$rp (~name ok)";;
3761         esac
3762         . UU/myread
3763         if test -f UU/getfile.ok && \
3764                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3765         then
3766                 value="$ans"
3767                 ansexp="$ans"
3768                 break
3769         fi
3770         case "$ans" in
3771         none)
3772                 value=''
3773                 ansexp=''
3774                 case "$none_ok" in
3775                 true) type='';;
3776                 esac
3777                 ;;
3778         *)
3779                 case "$tilde" in
3780                 '') value="$ans"
3781                         ansexp="$ans";;
3782                 *)
3783                         value=`UU/filexp $ans`
3784                         case $? in
3785                         0)
3786                                 if test "$ans" != "$value"; then
3787                                         echo "(That expands to $value on this system.)"
3788                                 fi
3789                                 ;;
3790                         *) value="$ans";;
3791                         esac
3792                         ansexp="$value"
3793                         case "$exp_file" in
3794                         '') value="$ans";;
3795                         esac
3796                         ;;
3797                 esac
3798                 case "$fullpath" in
3799                 true)
3800                         case "$ansexp" in
3801                         /*) value="$ansexp" ;;
3802                         [a-zA-Z]:/*) value="$ansexp" ;;
3803                         *)
3804                                 redo=true
3805                                 case "$already" in
3806                                 true)
3807                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3808                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3809                                         ;;
3810                                 *)
3811                                 echo "Please give a full path name, starting with slash." >&4
3812                                         case "$tilde" in
3813                                         true)
3814                                 echo "Note that using ~name is ok provided it expands well." >&4
3815                                                 already=true
3816                                                 ;;
3817                                         esac
3818                                 esac
3819                                 ;;
3820                         esac
3821                         ;;
3822                 esac
3823                 case "$redo" in
3824                 '')
3825                         case "$type" in
3826                         File)
3827                                 for fp in $gfpth; do
3828                                         if test "X$fp" = X.; then
3829                                             pf="$ansexp"
3830                                         else    
3831                                             pf="$fp/$ansexp"
3832                                         fi
3833                                         if test -f "$pf"; then
3834                                                 type=''
3835                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3836                                         then
3837                                                 echo "($value is not a plain file, but that's ok.)"
3838                                                 type=''
3839                                         fi
3840                                         if test X"$type" = X; then
3841                                             value="$pf"
3842                                             break
3843                                         fi
3844                                 done
3845                                 ;;
3846                         Directory)
3847                                 for fp in $gfpth; do
3848                                         if test "X$fp" = X.; then
3849                                             dir="$ans"
3850                                             direxp="$ansexp"
3851                                         else    
3852                                             dir="$fp/$ansexp"
3853                                             direxp="$fp/$ansexp"
3854                                         fi
3855                                         if test -d "$direxp"; then
3856                                                 type=''
3857                                                 value="$dir"
3858                                                 break
3859                                         fi
3860                                 done
3861                                 ;;
3862                         Locate)
3863                                 if test -d "$ansexp"; then
3864                                         echo "(Looking for $loc_file in directory $value.)"
3865                                         value="$value/$loc_file"
3866                                         ansexp="$ansexp/$loc_file"
3867                                 fi
3868                                 if test -f "$ansexp"; then
3869                                         type=''
3870                                 fi
3871                                 case "$nopath_ok" in
3872                                 true)   case "$value" in
3873                                         */*) ;;
3874                                         *)      echo "Assuming $value will be in people's path."
3875                                                 type=''
3876                                                 ;;
3877                                         esac
3878                                         ;;
3879                                 esac
3880                                 ;;
3881                         esac
3882
3883                         case "$skip" in
3884                         true) type='';
3885                         esac
3886
3887                         case "$type" in
3888                         '') ;;
3889                         *)
3890                                 if test "$fastread" = yes; then
3891                                         dflt=y
3892                                 else
3893                                         dflt=n
3894                                 fi
3895                                 rp="$what $value doesn't exist.  Use that name anyway?"
3896                                 . UU/myread
3897                                 dflt=''
3898                                 case "$ans" in
3899                                 y*) type='';;
3900                                 *) echo " ";;
3901                                 esac
3902                                 ;;
3903                         esac
3904                         ;;
3905                 esac
3906                 ;;
3907         esac
3908 done
3909 cd UU
3910 ans="$value"
3911 rp="$orig_rp"
3912 dflt="$orig_dflt"
3913 rm -f getfile.ok
3914 test "X$gfpthkeep" != Xy && gfpth=""
3915 EOSC
3916
3917 : determine root of directory hierarchy where package will be installed.
3918 case "$prefix" in
3919 '')
3920         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3921         ;;
3922 *?/)
3923         dflt=`echo "$prefix" | sed 's/.$//'`
3924         ;;
3925 *)
3926         dflt="$prefix"
3927         ;;
3928 esac
3929 $cat <<EOM
3930
3931 By default, $package will be installed in $dflt/bin, manual pages
3932 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3933 installation directories. Typically this is something like /usr/local.
3934 If you wish to have binaries under /usr/bin but other parts of the
3935 installation under /usr/local, that's ok: you will be prompted
3936 separately for each of the installation directories, the prefix being
3937 only used to set the defaults.
3938
3939 EOM
3940 fn=d~
3941 rp='Installation prefix to use?'
3942 . ./getfile
3943 oldprefix=''
3944 case "$prefix" in
3945 '') ;;
3946 *)
3947         case "$ans" in
3948         "$prefix") ;;
3949         *) oldprefix="$prefix";;
3950         esac
3951         ;;
3952 esac
3953 prefix="$ans"
3954 prefixexp="$ansexp"
3955
3956 : allow them to override the AFS root
3957 case "$afsroot" in
3958 '')     afsroot=/afs ;;
3959 *)      afsroot=$afsroot ;;
3960 esac
3961
3962 : is AFS running?
3963 echo " "
3964 case "$afs" in
3965 $define|true)   afs=true ;;
3966 $undef|false)   afs=false ;;
3967 *)      if $test -d $afsroot; then
3968                 afs=true
3969         else
3970                 afs=false
3971         fi
3972         ;;
3973 esac
3974 if $afs; then
3975         echo "AFS may be running... I'll be extra cautious then..." >&4
3976 else
3977         echo "AFS does not seem to be running..." >&4
3978 fi
3979
3980 : determine installation prefix for where package is to be installed.
3981 if $afs; then 
3982 $cat <<EOM
3983
3984 Since you are running AFS, I need to distinguish the directory in which
3985 files will reside from the directory in which they are installed (and from
3986 which they are presumably copied to the former directory by occult means).
3987
3988 EOM
3989         case "$installprefix" in
3990         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3991         *) dflt="$installprefix";;
3992         esac
3993 else
3994 $cat <<EOM
3995
3996 In some special cases, particularly when building $package for distribution,
3997 it is convenient to distinguish the directory in which files should be
3998 installed from the directory ($prefix) in which they will
3999 eventually reside.  For most users, these two directories are the same.
4000
4001 EOM
4002         case "$installprefix" in
4003         '') dflt=$prefix ;;
4004         *) dflt=$installprefix;;
4005         esac
4006 fi
4007 fn=d~
4008 rp='What installation prefix should I use for installing files?'
4009 . ./getfile
4010 installprefix="$ans"
4011 installprefixexp="$ansexp"
4012
4013 : Perform the prefixexp/installprefixexp correction if necessary
4014 cat <<EOS >installprefix
4015 $startsh
4016 EOS
4017 cat <<'EOSC' >>installprefix
4018 : Change installation prefix, if necessary.
4019 if $test X"$prefix" != X"$installprefix"; then
4020     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4021 else
4022     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4023 fi
4024 EOSC
4025 chmod +x installprefix
4026 $eunicefix installprefix
4027
4028 : Set variables such as privlib and privlibexp from the output of ./getfile
4029 : performing the prefixexp/installprefixexp correction if necessary.
4030 cat <<EOS >setprefixvar
4031 $startsh
4032 EOS
4033 cat <<'EOSC' >>setprefixvar
4034 eval "${prefixvar}=\"\$ans\""
4035 eval "${prefixvar}exp=\"\$ansexp\""
4036 . ./installprefix
4037 EOSC
4038 chmod +x setprefixvar
4039 $eunicefix setprefixvar
4040
4041 : set up the script used to warn in case of inconsistency
4042 cat <<EOS >whoa
4043 $startsh
4044 EOS
4045 cat <<'EOSC' >>whoa
4046 dflt=y
4047 case "$hint" in
4048     recommended)
4049         case "$hintfile" in
4050         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4051                 ;;
4052         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4053                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4054                 ;;
4055         esac
4056         ;;
4057     *)  echo " "
4058         echo "*** WHOA THERE!!! ***" >&4
4059         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4060         ;;
4061 esac
4062 rp="    Keep the $hint value?"
4063 . ./myread
4064 case "$ans" in
4065 y) td=$was; tu=$was;;
4066 esac
4067 EOSC
4068
4069 : function used to set '$1' to '$val'
4070 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4071 case "$val$was" in
4072 $define$undef) . ./whoa; eval "$var=\$td";;
4073 $undef$define) . ./whoa; eval "$var=\$tu";;
4074 *) eval "$var=$val";;
4075 esac'
4076
4077 : get the patchlevel
4078 echo " "
4079 echo "Getting the current patchlevel..." >&4
4080 if $test -r $rsrc/patchlevel.h;then
4081         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4082         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4083         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4084         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4085         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4086         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4087         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4088 else
4089         revision=0
4090         patchlevel=0
4091         subversion=0
4092         api_revision=0
4093         api_version=0
4094         api_subversion=0
4095         perl_patchlevel=0
4096         $echo "(You do not have patchlevel.h.  Eek.)"
4097 fi
4098 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4099 version_patchlevel_string="version $patchlevel subversion $subversion"
4100 case "$perl_patchlevel" in
4101 0|'') ;;
4102 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4103     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4104     ;;
4105 esac
4106
4107 $echo "(You have $package $version_patchlevel_string.)"
4108
4109 case "$osname" in
4110 dos|vms)
4111         : XXX Should be a Configure test for double-dots in filenames.
4112         version=`echo $revision $patchlevel $subversion | \
4113                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4114         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4115                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4116         ;;
4117 *)
4118         version=`echo $revision $patchlevel $subversion | \
4119                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4120         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4121                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4122         ;;
4123 esac
4124 : Special case the 5.005_xx maintenance series, which used 5.005
4125 : without any subversion label as a subdirectory in $sitelib
4126 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4127         api_versionstring='5.005'
4128 fi
4129
4130 : Do we want threads support and if so, what type
4131 case "$usethreads" in
4132 $define|true|[yY]*)     dflt='y';;
4133 *)     # Catch case where user specified ithreads or 5005threads but
4134        # forgot -Dusethreads (A.D. 4/2002)
4135        case "$useithreads$use5005threads" in
4136        *$define*)       dflt='y';;
4137        *)               dflt='n';;
4138        esac
4139        ;;
4140 esac
4141 cat <<EOM
4142
4143 Perl can be built to take advantage of threads on some systems.
4144 To do so, Configure can be run with -Dusethreads.
4145
4146 Note that Perl built with threading support runs slightly slower
4147 and uses more memory than plain Perl. The current implementation
4148 is believed to be stable, but it is fairly new, and so should be
4149 treated with caution.
4150
4151 If this doesn't make any sense to you, just accept the default '$dflt'.
4152 EOM
4153 rp='Build a threading Perl?'
4154 . ./myread
4155 case "$ans" in
4156 y|Y)    val="$define" ;;
4157 *)      val="$undef" ;;
4158 esac
4159 set usethreads
4160 eval $setvar
4161
4162 if $test $patchlevel -lt 9; then
4163     case "$usethreads" in
4164     $define)
4165         $cat <<EOM
4166
4167 Since release 5.6, Perl has had two different threading implementations,
4168 the newer interpreter-based version (ithreads) with one interpreter per
4169 thread, and the older 5.005 version (5005threads).
4170 The 5005threads version is effectively unmaintained and will probably be
4171 removed in Perl 5.10, so there should be no need to build a Perl using it
4172 unless needed for backwards compatibility with some existing 5.005threads
4173 code.
4174
4175 EOM
4176         : Default to ithreads unless overridden on command line or with
4177         : old config.sh
4178         dflt='y'
4179         case "$use5005threads" in
4180                 $define|true|[yY]*) dflt='n';;
4181         esac
4182         case "$useithreads" in
4183                 $undef|false|[nN]*) dflt='n';;
4184         esac
4185         rp='Use the newer interpreter-based ithreads?'
4186         . ./myread
4187         case "$ans" in
4188         y|Y)    val="$define" ;;
4189         *)      val="$undef" ;;
4190         esac
4191         set useithreads
4192         eval $setvar
4193         : Now set use5005threads to the opposite value.
4194         case "$useithreads" in
4195         $define) val="$undef" ;;
4196         *) val="$define" ;;
4197         esac
4198         set use5005threads
4199         eval $setvar
4200         ;;
4201     *)
4202         useithreads="$undef"
4203         use5005threads="$undef"
4204         ;;
4205     esac
4206
4207     case "$useithreads$use5005threads" in
4208     "$define$define")
4209         $cat >&4 <<EOM
4210
4211 You cannot have both the ithreads and the 5.005 threads enabled
4212 at the same time.  Disabling the 5.005 threads since they are
4213 much less stable than the ithreads.
4214
4215 EOM
4216         use5005threads="$undef"
4217         ;;
4218     esac
4219
4220 else
4221 : perl-5.9.x and later
4222
4223     if test X"$usethreads" = "X$define"; then
4224         case "$use5005threads" in
4225             $define|true|[yY]*)
4226                 $cat >&4 <<EOM
4227
4228 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4229
4230 EOM
4231             ;;
4232         esac
4233     fi
4234
4235     use5005threads="$undef"
4236     useithreads="$usethreads"
4237 fi
4238
4239 case "$d_oldpthreads" in
4240 '')     : Configure tests would be welcome here.  For now, assume undef.
4241         val="$undef" ;;
4242 *)      val="$d_oldpthreads" ;;
4243 esac
4244 set d_oldpthreads
4245 eval $setvar
4246
4247
4248 : Look for a hint-file generated 'call-back-unit'.  If the
4249 : user has specified that a threading perl is to be built,
4250 : we may need to set or change some other defaults.
4251 if $test -f usethreads.cbu; then
4252     echo "Your platform has some specific hints regarding threaded builds, using them..."
4253     . ./usethreads.cbu
4254 else
4255     case "$usethreads" in
4256         "$define"|true|[yY]*)
4257                 $cat <<EOM
4258 (Your platform does not have any specific hints for threaded builds.
4259  Assuming POSIX threads, then.)
4260 EOM
4261         ;;
4262     esac
4263 fi
4264
4265 : Check if multiplicity is required
4266 cat <<EOM
4267
4268 Perl can be built so that multiple Perl interpreters can coexist
4269 within the same Perl executable.
4270 EOM
4271
4272 case "$useithreads" in
4273 $define)
4274         cat <<EOM
4275 This multiple interpreter support is required for interpreter-based threads.
4276 EOM
4277         val="$define"
4278         ;;
4279 *)      case "$usemultiplicity" in
4280         $define|true|[yY]*)     dflt='y';;
4281         *) dflt='n';;
4282         esac
4283         echo " "
4284         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4285         rp='Build Perl for multiplicity?'
4286         . ./myread
4287         case "$ans" in
4288         y|Y)    val="$define" ;;
4289         *)      val="$undef" ;;
4290         esac
4291         ;;
4292 esac
4293 set usemultiplicity
4294 eval $setvar
4295
4296 : Check if morebits is requested
4297 case "$usemorebits" in
4298 "$define"|true|[yY]*)
4299         use64bitint="$define"
4300         uselongdouble="$define"
4301         usemorebits="$define"
4302         ;;
4303 *)      usemorebits="$undef"
4304         ;;
4305 esac
4306
4307 : Determine the C compiler to be used
4308 echo " "
4309 case "$cc" in
4310 '') dflt=cc;;
4311 *) dflt="$cc";;
4312 esac
4313 rp="Use which C compiler?"
4314 . ./myread
4315 cc="$ans"
4316
4317 : See whether they have no cc but they do have gcc
4318 . ./trygcc
4319 if $test -f cc.cbu; then
4320     . ./cc.cbu
4321 fi
4322 . ./checkcc
4323
4324 : make some quick guesses about what we are up against
4325 echo " "
4326 $echo $n "Hmm...  $c"
4327 echo exit 1 >bsd
4328 echo exit 1 >usg
4329 echo exit 1 >v7
4330 echo exit 1 >osf1
4331 echo exit 1 >eunice
4332 echo exit 1 >xenix
4333 echo exit 1 >venix
4334 echo exit 1 >os2
4335 d_bsd="$undef"
4336 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4337 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4338 then
4339         echo "Looks kind of like an OSF/1 system, but we'll see..."
4340         echo exit 0 >osf1
4341 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4342         xxx=`./loc addbib blurfl $pth`
4343         if $test -f $xxx; then
4344         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4345                 echo exit 0 >bsd
4346                 echo exit 0 >usg
4347         else
4348                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4349                         echo "Looks kind of like an extended USG system, but we'll see..."
4350                 else
4351                         echo "Looks kind of like a USG system, but we'll see..."
4352                 fi
4353                 echo exit 0 >usg
4354         fi
4355 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4356         echo "Looks kind of like a BSD system, but we'll see..."
4357         d_bsd="$define"
4358         echo exit 0 >bsd
4359 else
4360         echo "Looks kind of like a Version 7 system, but we'll see..."
4361         echo exit 0 >v7
4362 fi
4363 case "$eunicefix" in
4364 *unixtovms*)
4365         $cat <<'EOI'
4366 There is, however, a strange, musty smell in the air that reminds me of
4367 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4368 EOI
4369         echo exit 0 >eunice
4370         d_eunice="$define"
4371 : it so happens the Eunice I know will not run shell scripts in Unix format
4372         ;;
4373 *)
4374         echo " "
4375         echo "Congratulations.  You aren't running Eunice."
4376         d_eunice="$undef"
4377         ;;
4378 esac
4379 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4380 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4381 : semicolon as a patch separator
4382 case "$p_" in
4383 :) ;;
4384 *)
4385         $cat <<'EOI'
4386 I have the feeling something is not exactly right, however...don't tell me...
4387 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4388 (Or you may be running DOS with DJGPP.)
4389 EOI
4390         echo exit 0 >os2
4391         ;;
4392 esac
4393 if test -f /xenix; then
4394         echo "Actually, this looks more like a XENIX system..."
4395         echo exit 0 >xenix
4396         d_xenix="$define"
4397 else
4398         echo " "
4399         echo "It's not Xenix..."
4400         d_xenix="$undef"
4401 fi
4402 chmod +x xenix
4403 $eunicefix xenix
4404 if test -f /venix; then
4405         echo "Actually, this looks more like a VENIX system..."
4406         echo exit 0 >venix
4407 else
4408         echo " "
4409         if ./xenix; then
4410                 : null
4411         else
4412                 echo "Nor is it Venix..."
4413         fi
4414 fi
4415 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4416 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4417 $rm -f foo
4418
4419 : Check if we are using GNU gcc and what its version is
4420 echo " "
4421 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4422 $cat >try.c <<EOM
4423 #include <stdio.h>
4424 int main() {
4425 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4426 #ifdef __VERSION__
4427         printf("%s\n", __VERSION__);
4428 #else
4429         printf("%s\n", "1");
4430 #endif
4431 #endif
4432         return(0);
4433 }
4434 EOM
4435 if $cc -o try $ccflags $ldflags try.c; then
4436         gccversion=`$run ./try`
4437         case "$gccversion" in
4438         '') echo "You are not using GNU cc." ;;
4439         *)  echo "You are using GNU cc $gccversion."
4440             ccname=gcc
4441             ;;
4442         esac
4443 else
4444         echo " "
4445         echo "*** WHOA THERE!!! ***" >&4
4446         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4447         case "$knowitall" in
4448         '')
4449         echo "    You'd better start hunting for one and let me know about it." >&4
4450                 exit 1
4451                 ;;
4452         esac
4453 fi
4454 $rm -f try try.*
4455 case "$gccversion" in
4456 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4457 esac
4458 case "$gccversion" in
4459 '') gccosandvers='' ;;
4460 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4461    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4462    gccshortvers=''
4463    case "$gccosandvers" in
4464    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4465    $osname$osvers) ;; # looking good
4466    $osname*) cat <<EOM >&4
4467
4468 *** WHOA THERE!!! ***
4469
4470     Your gcc has not been compiled for the exact release of
4471     your operating system ($gccosandvers versus $osname$osvers).
4472
4473     In general it is a good idea to keep gcc synchronized with
4474     the operating system because otherwise serious problems
4475     may ensue when trying to compile software, like Perl.
4476
4477     I'm trying to be optimistic here, though, and will continue.
4478     If later during the configuration and build icky compilation
4479     problems appear (headerfile conflicts being the most common
4480     manifestation), I suggest reinstalling the gcc to match
4481     your operating system release.
4482
4483 EOM
4484       ;;
4485    *) gccosandvers='' ;; # failed to parse, better be silent
4486    esac
4487    ;;
4488 esac
4489 case "$ccname" in
4490 '') ccname="$cc" ;;
4491 esac
4492
4493 # gcc 3.* complain about adding -Idirectories that they already know about,
4494 # so we will take those off from locincpth.
4495 case "$gccversion" in
4496 3*)
4497     echo "main(){}">try.c
4498     for incdir in $locincpth; do
4499        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4500              grep '^c[cp]p*[01]: warning: changing search order '`
4501        if test "X$warn" != X; then
4502            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4503        fi
4504     done
4505     $rm -f try try.*
4506 esac
4507
4508 : What should the include directory be ?
4509 echo " "
4510 $echo $n "Hmm...  $c"
4511 dflt='/usr/include'
4512 incpath=''
4513 mips_type=''
4514 if $test -f /bin/mips && /bin/mips; then
4515         echo "Looks like a MIPS system..."
4516         $cat >usr.c <<'EOCP'
4517 #ifdef SYSTYPE_BSD43
4518 /bsd43
4519 #endif
4520 EOCP
4521         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4522                 dflt='/bsd43/usr/include'
4523                 incpath='/bsd43'
4524                 mips_type='BSD 4.3'
4525         else
4526                 mips_type='System V'
4527         fi
4528         $rm -f usr.c usr.out
4529         echo "and you're compiling with the $mips_type compiler and libraries."
4530         xxx_prompt=y
4531         echo "exit 0" >mips
4532 else
4533         echo "Doesn't look like a MIPS system."
4534         xxx_prompt=n
4535         echo "exit 1" >mips
4536 fi
4537 chmod +x mips
4538 $eunicefix mips
4539 case "$usrinc" in
4540 '') ;;
4541 *) dflt="$usrinc";;
4542 esac
4543 case "$xxx_prompt" in
4544 y)      fn=d/
4545         echo " "
4546         rp='Where are the include files you want to use?'
4547         . ./getfile
4548         usrinc="$ans"
4549         ;;
4550 *)      usrinc="$dflt"
4551         ;;
4552 esac
4553
4554 : see how we invoke the C preprocessor
4555 echo " "
4556 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4557 cat <<'EOT' >testcpp.c
4558 #define ABC abc
4559 #define XYZ xyz
4560 ABC.XYZ
4561 EOT
4562 cd ..
4563 if test ! -f cppstdin; then
4564         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4565                 # AIX cc -E doesn't show the absolute headerfile
4566                 # locations but we'll cheat by using the -M flag.
4567                 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
4568         else
4569                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4570         fi
4571 else
4572         echo "Keeping your $hint cppstdin wrapper."
4573 fi
4574 chmod 755 cppstdin
4575 wrapper=`pwd`/cppstdin
4576 ok='false'
4577 cd UU
4578
4579 if $test "X$cppstdin" != "X" && \
4580         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4581         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4582 then
4583         echo "You used to use $cppstdin $cppminus so we'll use that again."
4584         case "$cpprun" in
4585         '') echo "But let's see if we can live without a wrapper..." ;;
4586         *)
4587                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4588                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4589                 then
4590                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4591                         ok='true'
4592                 else
4593                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4594                 fi
4595                 ;;
4596         esac
4597 else
4598         case "$cppstdin" in
4599         '') ;;
4600         *)
4601                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4602                 ;;
4603         esac
4604 fi
4605
4606 if $ok; then
4607         : nothing
4608 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4609         $cc -E <testcpp.c >testcpp.out 2>&1; \
4610         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4611         echo "Yup, it does."
4612         x_cpp="$cc -E"
4613         x_minus='';
4614 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4615         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4616         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4617         echo "Yup, it does."
4618         x_cpp="$cc -E"
4619         x_minus='-';
4620 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4621         $cc -P <testcpp.c >testcpp.out 2>&1; \
4622         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4623         echo "Yipee, that works!"
4624         x_cpp="$cc -P"
4625         x_minus='';
4626 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4627         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4628         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4629         echo "At long last!"
4630         x_cpp="$cc -P"
4631         x_minus='-';
4632 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4633         $cpp <testcpp.c >testcpp.out 2>&1; \
4634         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4635         echo "It works!"
4636         x_cpp="$cpp"
4637         x_minus='';
4638 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4639         $cpp - <testcpp.c >testcpp.out 2>&1; \
4640         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4641         echo "Hooray, it works!  I was beginning to wonder."
4642         x_cpp="$cpp"
4643         x_minus='-';
4644 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4645         $wrapper <testcpp.c >testcpp.out 2>&1; \
4646         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4647         x_cpp="$wrapper"
4648         x_minus=''
4649         echo "Eureka!"
4650 else
4651         dflt=''
4652         rp="No dice.  I can't find a C preprocessor.  Name one:"
4653         . ./myread
4654         x_cpp="$ans"
4655         x_minus=''
4656         $x_cpp <testcpp.c >testcpp.out 2>&1
4657         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4658                 echo "OK, that will do." >&4
4659         else
4660 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4661                 exit 1
4662         fi
4663 fi
4664
4665 case "$ok" in
4666 false)
4667         cppstdin="$x_cpp"
4668         cppminus="$x_minus"
4669         cpprun="$x_cpp"
4670         cpplast="$x_minus"
4671         set X $x_cpp
4672         shift
4673         case "$1" in
4674         "$cpp")
4675                 echo "Perhaps can we force $cc -E using a wrapper..."
4676                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4677                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4678                 then
4679                         echo "Yup, we can."
4680                         cppstdin="$wrapper"
4681                         cppminus='';
4682                 else
4683                         echo "Nope, we'll have to live without it..."
4684                 fi
4685                 ;;
4686         esac
4687         case "$cpprun" in
4688         "$wrapper")
4689                 cpprun=''
4690                 cpplast=''
4691                 ;;
4692         esac
4693         ;;
4694 esac
4695
4696 case "$cppstdin" in
4697 "$wrapper"|'cppstdin') ;;
4698 *) $rm -f $wrapper;;
4699 esac
4700 $rm -f testcpp.c testcpp.out
4701
4702 : Set private lib path
4703 case "$plibpth" in
4704 '') if ./mips; then
4705                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4706         fi;;
4707 esac
4708 case "$libpth" in
4709 ' ') dlist='';;
4710 '') dlist="$loclibpth $plibpth $glibpth";;
4711 *) dlist="$libpth";;
4712 esac
4713
4714 : Now check and see which directories actually exist, avoiding duplicates
4715 libpth=''
4716 for xxx in $dlist
4717 do
4718     if $test -d $xxx; then
4719                 case " $libpth " in
4720                 *" $xxx "*) ;;
4721                 *) libpth="$libpth $xxx";;
4722                 esac
4723     fi
4724 done
4725 $cat <<'EOM'
4726
4727 Some systems have incompatible or broken versions of libraries.  Among
4728 the directories listed in the question below, please remove any you
4729 know not to be holding relevant libraries, and add any that are needed.
4730 Say "none" for none.
4731
4732 EOM
4733 case "$libpth" in
4734 '') dflt='none';;
4735 *)
4736         set X $libpth
4737         shift
4738         dflt=${1+"$@"}
4739         ;;
4740 esac
4741 rp="Directories to use for library searches?"
4742 . ./myread
4743 case "$ans" in
4744 none) libpth=' ';;
4745 *) libpth="$ans";;
4746 esac
4747
4748 : compute shared library extension
4749 case "$so" in
4750 '')
4751         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4752                 dflt='sl'
4753         else
4754                 dflt='so'
4755         fi
4756         ;;
4757 *) dflt="$so";;
4758 esac
4759 $cat <<EOM
4760
4761 On some systems, shared libraries may be available.  Answer 'none' if
4762 you want to suppress searching of shared libraries for the remainder
4763 of this configuration.
4764
4765 EOM
4766 rp='What is the file extension used for shared libraries?'
4767 . ./myread
4768 so="$ans"
4769
4770 : Define several unixisms.
4771 : Hints files or command line option can be used to override them.
4772 : The convoluted testing is in case hints files set either the old
4773 : or the new name.
4774 case "$_exe" in
4775 '')     case "$exe_ext" in
4776         '')     ;;
4777         *)      _exe="$exe_ext" ;;
4778         esac
4779         ;;
4780 esac
4781 case "$_a" in
4782 '')     case "$lib_ext" in
4783     '') _a='.a';;
4784         *)      _a="$lib_ext" ;;
4785         esac
4786         ;;
4787 esac
4788 case "$_o" in
4789 '') case "$obj_ext" in
4790         '')     _o='.o';;
4791         *)      _o="$obj_ext";;
4792         esac
4793         ;;
4794 esac
4795 case "$p_" in
4796 '') case "$path_sep" in
4797         '')     p_=':';;
4798         *)      p_="$path_sep";;
4799         esac
4800         ;;
4801 esac
4802 exe_ext=$_exe
4803 lib_ext=$_a
4804 obj_ext=$_o
4805 path_sep=$p_
4806
4807 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4808
4809 : Which makefile gets called first.  This is used by make depend.
4810 case "$firstmakefile" in
4811 '') firstmakefile='makefile';;
4812 esac
4813
4814 : Check is we will use socks
4815 case "$usesocks" in
4816 $define|true|[yY]*)     dflt='y';;
4817 *) dflt='n';;
4818 esac
4819 cat <<EOM
4820
4821 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4822 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4823 to use the PerlIO abstraction layer, this will be implicitly selected.
4824
4825 If this doesn't make any sense to you, just accept the default '$dflt'.
4826 EOM
4827 rp='Build Perl for SOCKS?'
4828 . ./myread
4829 case "$ans" in
4830 y|Y)    val="$define" ;;
4831 *)      val="$undef" ;;
4832 esac
4833 set usesocks
4834 eval $setvar
4835
4836 : Check for uselongdouble support
4837 case "$ccflags" in
4838 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4839 esac
4840
4841 case "$uselongdouble" in
4842 $define|true|[yY]*)     dflt='y';;
4843 *) dflt='n';;
4844 esac
4845 cat <<EOM
4846
4847 Perl can be built to take advantage of long doubles which
4848 (if available) may give more accuracy and range for floating point numbers.
4849
4850 If this doesn't make any sense to you, just accept the default '$dflt'.
4851 EOM
4852 rp='Try to use long doubles if available?'
4853 . ./myread
4854 case "$ans" in
4855 y|Y)    val="$define"   ;;
4856 *)      val="$undef"    ;;
4857 esac
4858 set uselongdouble
4859 eval $setvar
4860
4861 case "$uselongdouble" in
4862 true|[yY]*) uselongdouble="$define" ;;
4863 esac
4864
4865 : Look for a hint-file generated 'call-back-unit'.  If the
4866 : user has specified that long doubles should be used,
4867 : we may need to set or change some other defaults.
4868 if $test -f uselongdouble.cbu; then
4869     echo "Your platform has some specific hints regarding long doubles, using them..."
4870     . ./uselongdouble.cbu
4871 else
4872     case "$uselongdouble" in
4873         $define)
4874                 $cat <<EOM
4875 (Your platform does not have any specific hints for long doubles.)
4876 EOM
4877         ;;
4878     esac
4879 fi
4880
4881 : Looking for optional libraries
4882 echo " "
4883 echo "Checking for optional libraries..." >&4
4884 case "$libs" in
4885 ' '|'') dflt='';;
4886 *) dflt="$libs";;
4887 esac
4888 case "$libswanted" in
4889 '') libswanted='c_s';;
4890 esac
4891 case "$usesocks" in
4892 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4893 esac
4894 libsfound=''
4895 libsfiles=''
4896 libsdirs=''
4897 libspath=''
4898 for thisdir in $libpth $xlibpth; do
4899   test -d $thisdir && libspath="$libspath $thisdir"
4900 done
4901 for thislib in $libswanted; do
4902         for thisdir in $libspath; do
4903             xxx=''
4904             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4905                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4906                 $test -f "$xxx" && eval $libscheck
4907                 $test -f "$xxx" && libstyle=shared
4908             fi
4909             if test ! -f "$xxx"; then
4910                 xxx=$thisdir/lib$thislib.$so
4911                 $test -f "$xxx" && eval $libscheck
4912                 $test -f "$xxx" && libstyle=shared
4913             fi
4914             if test ! -f "$xxx"; then
4915                 xxx=$thisdir/lib$thislib$_a
4916                 $test -f "$xxx" && eval $libscheck
4917                 $test -f "$xxx" && libstyle=static
4918             fi
4919             if test ! -f "$xxx"; then
4920                 xxx=$thisdir/$thislib$_a
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=static
4923             fi
4924             if test ! -f "$xxx"; then
4925                 xxx=$thisdir/lib${thislib}_s$_a
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=static
4928                 $test -f "$xxx" && thislib=${thislib}_s
4929             fi
4930             if test ! -f "$xxx"; then
4931                 xxx=$thisdir/Slib$thislib$_a
4932                 $test -f "$xxx" && eval $libscheck
4933                 $test -f "$xxx" && libstyle=static
4934             fi
4935             if $test -f "$xxx"; then
4936                 case "$libstyle" in
4937                 shared) echo "Found -l$thislib (shared)." ;;
4938                 static) echo "Found -l$thislib." ;;
4939                 *)      echo "Found -l$thislib ($libstyle)." ;;
4940                 esac
4941                 case " $dflt " in
4942                 *"-l$thislib "*);;
4943                 *) dflt="$dflt -l$thislib"
4944                    libsfound="$libsfound $xxx"
4945                    yyy=`basename $xxx`
4946                    libsfiles="$libsfiles $yyy"
4947                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4948                    case " $libsdirs " in
4949                    *" $yyy "*) ;;
4950                    *) libsdirs="$libsdirs $yyy" ;;
4951                    esac
4952                    ;;
4953                 esac
4954                 break
4955             fi
4956         done
4957         if $test ! -f "$xxx"; then
4958             echo "No -l$thislib."
4959         fi
4960 done
4961 set X $dflt
4962 shift
4963 dflt="$*"
4964 case "$libs" in
4965 '') dflt="$dflt";;
4966 *) dflt="$libs";;
4967 esac
4968 case "$dflt" in
4969 ' '|'') dflt='none';;
4970 esac
4971
4972 $cat <<EOM
4973
4974 In order to compile $package on your machine, a number of libraries
4975 are usually needed.  Include any other special libraries here as well.
4976 Say "none" for none.  The default list is almost always right.
4977 EOM
4978
4979 echo " "
4980 rp="What libraries to use?"
4981 . ./myread
4982 case "$ans" in
4983 none) libs=' ';;
4984 *) libs="$ans";;
4985 esac
4986
4987 : determine optimization, if desired, or use for debug flag also
4988 case "$optimize" in
4989 ' '|$undef) dflt='none';;
4990 '') dflt='-O';;
4991 *) dflt="$optimize";;
4992 esac
4993 $cat <<EOH
4994
4995 By default, $package compiles with the -O flag to use the optimizer.
4996 Alternately, you might want to use the symbolic debugger, which uses
4997 the -g flag (on traditional Unix systems).  Either flag can be
4998 specified here.  To use neither flag, specify the word "none".
4999
5000 EOH
5001 rp="What optimizer/debugger flag should be used?"
5002 . ./myread
5003 optimize="$ans"
5004 case "$optimize" in
5005 'none') optimize=" ";;
5006 esac
5007
5008 : Check what DEBUGGING is required from the command line
5009 : -DEBUGGING      or -DDEBUGGING or
5010 : -DEBUGGING=both                       = -g + -DDEBUGGING
5011 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5012 : -DEBUGGING=none or -UDEBUGGING        =
5013 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5014 case "$EBUGGING" in
5015 '')     ;;
5016 *)      DEBUGGING=$EBUGGING ;;
5017 esac
5018
5019 case "$DEBUGGING" in
5020 -g|both|$define)
5021     case "$optimize" in
5022         *-g*) ;;
5023         *)    optimize="$optimize -g" ;;
5024     esac ;;
5025 none|$undef)
5026     case "$optimize" in
5027         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5028                 shift
5029                 optimize="$*"
5030                 ;;
5031     esac ;;
5032 esac
5033
5034 dflt=''
5035 case "$DEBUGGING" in
5036 both|$define) dflt='-DDEBUGGING'
5037 esac
5038
5039 : argument order is deliberate, as the flag will start with - which set could
5040 : think is an option
5041 checkccflag='check=$1; flag=$2; callback=$3;
5042 echo " ";
5043 echo "Checking if your compiler accepts $flag" 2>&1;
5044 echo "int main(void) { return 0; }" > gcctest.c;
5045 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5046     echo "Yes, it does." 2>&1;
5047     if $test -s gcctest.out ; then
5048         echo "But your platform does not like it:";
5049         cat gcctest.out;
5050     else
5051         case "$ccflags" in
5052         *$check*)
5053             echo "Leaving current flags $ccflags alone." 2>&1
5054             ;;
5055         *) dflt="$dflt $flag";
5056             eval $callback
5057             ;;
5058         esac
5059     fi
5060 else
5061     echo "Nope, it does not, but that is ok." 2>&1;
5062 fi
5063 '
5064
5065 : We will not override a previous value, but we might want to
5066 : augment a hint file
5067 case "$hint" in
5068 default|recommended)
5069         case "$gccversion" in
5070         1*) dflt="$dflt -fpcc-struct-return" ;;
5071         esac
5072         case "$optimize:$DEBUGGING" in
5073         *-g*:old) dflt="$dflt -DDEBUGGING";;
5074         esac
5075         case "$gccversion" in
5076         2*) if $test -d /etc/conf/kconfig.d &&
5077                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5078                 then
5079                         # Interactive Systems (ISC) POSIX mode.
5080                         dflt="$dflt -posix"
5081                 fi
5082                 ;;
5083         esac
5084         case "$gccversion" in
5085         1*) ;;
5086         2.[0-8]*) ;;
5087         ?*)     set strict-aliasing -fno-strict-aliasing
5088                 eval $checkccflag
5089                 ;;
5090         esac
5091         # For gcc, adding -pipe speeds up compilations for some, but apparently
5092         # some assemblers can't read from stdin.  (It also slows down compilations
5093         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5094         case "$gccversion" in
5095         ?*)     set pipe -pipe
5096                 eval $checkccflag
5097                 ;;
5098         esac
5099
5100         # on x86_64 (at least) we require an extra library (libssp) in the
5101         # link command line. This library is not named, so I infer that it is
5102         # an implementation detail that may change. Hence the safest approach
5103         # is to add the flag to the flags passed to the compiler at link time,
5104         # as that way the compiler can do the right implementation dependant
5105         # thing. (NWC)
5106         case "$gccversion" in
5107         ?*)     set stack-protector -fstack-protector
5108                 eval $checkccflag
5109                 ;;
5110         esac
5111         ;;
5112 esac
5113
5114 case "$mips_type" in
5115 *BSD*|'') inclwanted="$locincpth $usrinc";;
5116 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5117 esac
5118 for thisincl in $inclwanted; do
5119         if $test -d $thisincl; then
5120                 if $test x$thisincl != x$usrinc; then
5121                         case "$dflt" in
5122                         *" -I$thisincl "*);;
5123                         *) dflt="$dflt -I$thisincl ";;
5124                         esac
5125                 fi
5126         fi
5127 done
5128
5129 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5130         xxx=true;
5131 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5132         xxx=true;
5133 else
5134         xxx=false;
5135 fi;
5136 if $xxx; then
5137         case "$dflt" in
5138         *$2*);;
5139         *) dflt="$dflt -D$2";;
5140         esac;
5141 fi'
5142
5143 set signal.h LANGUAGE_C; eval $inctest
5144
5145 case "$usesocks" in
5146 $define)
5147         ccflags="$ccflags -DSOCKS"
5148         ;;
5149 esac
5150
5151 case "$hint" in
5152 default|recommended) dflt="$ccflags $dflt" ;;
5153 *) dflt="$ccflags";;
5154 esac
5155
5156 case "$dflt" in
5157 ''|' ') dflt=none;;
5158 esac
5159
5160 $cat <<EOH
5161
5162 Your C compiler may want other flags.  For this question you should include
5163 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5164 but you should NOT include libraries or ld flags like -lwhatever.  If you
5165 want $package to honor its debug switch, you should include -DDEBUGGING here.
5166 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5167
5168 To use no flags, specify the word "none".
5169
5170 EOH
5171 set X $dflt
5172 shift
5173 dflt=${1+"$@"}
5174 rp="Any additional cc flags?"
5175 . ./myread
5176 case "$ans" in
5177 none) ccflags='';;
5178 *) ccflags="$ans";;
5179 esac
5180
5181 : the following weeds options from ccflags that are of no interest to cpp
5182 case "$cppflags" in
5183 '') cppflags="$ccflags" ;;
5184 *)  cppflags="$cppflags $ccflags" ;;
5185 esac
5186 case "$gccversion" in
5187 1*) cppflags="$cppflags -D__GNUC__"
5188 esac
5189 case "$mips_type" in
5190 '');;
5191 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5192 esac
5193 case "$cppflags" in
5194 '');;
5195 *)
5196         echo " "
5197         echo "Let me guess what the preprocessor flags are..." >&4
5198         set X $cppflags
5199         shift
5200         cppflags=''
5201         $cat >cpp.c <<'EOM'
5202 #define BLURFL foo
5203
5204 BLURFL xx LFRULB
5205 EOM
5206         previous=''
5207         for flag in $*
5208         do
5209                 case "$flag" in
5210                 -*) ftry="$flag";;
5211                 *) ftry="$previous $flag";;
5212                 esac
5213                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5214                         >cpp1.out 2>/dev/null && \
5215                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5216                         >cpp2.out 2>/dev/null && \
5217                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5218                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5219                 then
5220                         cppflags="$cppflags $ftry"
5221                         previous=''
5222                 else
5223                         previous="$flag"
5224                 fi
5225         done
5226         set X $cppflags
5227         shift
5228         cppflags=${1+"$@"}
5229         case "$cppflags" in
5230         *-*)  echo "They appear to be: $cppflags";;
5231         esac
5232         $rm -f cpp.c cpp?.out
5233         ;;
5234 esac
5235
5236 : flags used in final linking phase
5237 case "$ldflags" in
5238 '') if ./venix; then
5239                 dflt='-i -z'
5240         else
5241                 dflt=''
5242         fi
5243         case "$ccflags" in
5244         *-posix*) dflt="$dflt -posix" ;;
5245         esac
5246         ;;
5247 *) dflt="$ldflags";;
5248 esac
5249 # See note above about -fstack-protector
5250 case "$ccflags" in
5251 *-fstack-protector*) 
5252         case "$dflt" in
5253         *-fstack-protector*) ;; # Don't add it again
5254         *) dflt="$dflt -fstack-protector" ;; 
5255         esac
5256         ;;
5257 esac
5258
5259 : Try to guess additional flags to pick up local libraries.
5260 for thislibdir in $libpth; do
5261         case " $loclibpth " in
5262         *" $thislibdir "*)
5263                 case "$dflt " in
5264                 *"-L$thislibdir "*) ;;
5265                 *)  dflt="$dflt -L$thislibdir" ;;
5266                 esac
5267                 ;;
5268         esac
5269 done
5270
5271 case "$dflt" in
5272 '') dflt='none' ;;
5273 esac
5274
5275 $cat <<EOH
5276
5277 Your C linker may need flags.  For this question you should
5278 include -L/whatever and any other flags used by the C linker, but you
5279 should NOT include libraries like -lwhatever.
5280
5281 Make sure you include the appropriate -L/path flags if your C linker
5282 does not normally search all of the directories you specified above,
5283 namely
5284         $libpth
5285 To use no flags, specify the word "none".
5286
5287 EOH
5288
5289 rp="Any additional ld flags (NOT including libraries)?"
5290 . ./myread
5291 case "$ans" in
5292 none) ldflags='';;
5293 *) ldflags="$ans";;
5294 esac
5295 rmlist="$rmlist pdp11"
5296
5297 : coherency check
5298 echo " "
5299 echo "Checking your choice of C compiler and flags for coherency..." >&4
5300 $cat > try.c <<'EOF'
5301 #include <stdio.h>
5302 int main() { printf("Ok\n"); return(0); }
5303 EOF
5304 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5305 shift
5306 $cat >try.msg <<'EOM'
5307 I've tried to compile and run the following simple program:
5308
5309 EOM
5310 $cat try.c >> try.msg
5311
5312 $cat >> try.msg <<EOM
5313
5314 I used the command:
5315
5316         $*
5317         $run ./try
5318
5319 and I got the following output:
5320
5321 EOM
5322 dflt=y
5323 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5324         if $sh -c "$run ./try " >>try.msg 2>&1; then
5325                 xxx=`$run ./try`
5326                 case "$xxx" in
5327                 "Ok") dflt=n ;;
5328                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5329                         case " $libs " in
5330                         *" -lsfio "*)
5331                                 cat >> try.msg <<'EOQS'
5332 If $libs contains -lsfio, and sfio is mis-configured, then it
5333 sometimes (apparently) runs and exits with a 0 status, but with no
5334 output!  It may have to do with sfio's use of _exit vs. exit.
5335
5336 EOQS
5337                                 rp="You have a big problem.  Shall I abort Configure"
5338                                 dflt=y
5339                                 ;;
5340                         esac
5341                         ;;
5342                 esac
5343         else
5344                 echo "The program compiled OK, but exited with status $?." >>try.msg
5345                 rp="You have a problem.  Shall I abort Configure"
5346                 dflt=y
5347         fi
5348 else
5349         echo "I can't compile the test program." >>try.msg
5350         rp="You have a BIG problem.  Shall I abort Configure"
5351         dflt=y
5352 fi
5353 case "$dflt" in
5354 y)
5355         $cat try.msg >&4
5356         case "$knowitall" in
5357         '')
5358                 echo "(The supplied flags or libraries might be incorrect.)"
5359                 ;;
5360         *) dflt=n;;
5361         esac
5362         echo " "
5363         . ./myread
5364         case "$ans" in
5365         n*|N*) ;;
5366         *)      echo "Ok.  Stopping Configure." >&4
5367                 exit 1
5368                 ;;
5369         esac
5370         ;;
5371 n) echo "OK, that should do.";;
5372 esac
5373 $rm_try gcctest gcctest.out
5374
5375 : define a shorthand compile call
5376 compile='
5377 mc_file=$1;
5378 shift;
5379 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5380 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5381 exit 1;
5382 fi;
5383 esac;
5384 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5385 : define a shorthand compile call for compilations that should be ok.
5386 compile_ok='
5387 mc_file=$1;
5388 shift;
5389 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5390
5391 : determine filename position in cpp output
5392 echo " "
5393 echo "Computing filename position in cpp output for #include directives..." >&4
5394 case "$osname" in
5395 vos) testaccess=-e ;;
5396 *)   testaccess=-r ;;
5397 esac
5398 echo '#include <stdio.h>' > foo.c
5399 $cat >fieldn <<EOF
5400 $startsh
5401 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5402 $grep '^[       ]*#.*stdio\.h' | \
5403 while read cline; do
5404         pos=1
5405         set \$cline
5406         while $test \$# -gt 0; do
5407                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5408                         echo "\$pos"
5409                         exit 0
5410                 fi
5411                 shift
5412                 pos=\`expr \$pos + 1\`
5413         done
5414 done
5415 EOF
5416 chmod +x fieldn
5417 fieldn=`./fieldn`
5418 $rm -f foo.c fieldn
5419 case $fieldn in
5420 '') pos='???';;
5421 1) pos=first;;
5422 2) pos=second;;
5423 3) pos=third;;
5424 *) pos="${fieldn}th";;
5425 esac
5426 echo "Your cpp writes the filename in the $pos field of the line."
5427
5428 case "$osname" in
5429 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5430 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5431 *)   cppfilter='' ;;
5432 esac
5433 : locate header file
5434 $cat >findhdr <<EOF
5435 $startsh
5436 wanted=\$1
5437 name=''
5438 for usrincdir in $usrinc
5439 do
5440         if test -f \$usrincdir/\$wanted; then
5441                 echo "\$usrincdir/\$wanted"
5442                 exit 0
5443         fi
5444 done
5445 awkprg='{ print \$$fieldn }'
5446 echo "#include <\$wanted>" > foo\$\$.c
5447 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5448 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5449 while read cline; do
5450         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5451         case "\$name" in
5452         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5453         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5454         *) exit 2;;
5455         esac;
5456 done;
5457 #
5458 # status = 0: grep returned 0 lines, case statement not executed
5459 # status = 1: headerfile found
5460 # status = 2: while loop executed, no headerfile found
5461 #
5462 status=\$?
5463 $rm -f foo\$\$.c;
5464 if test \$status -eq 1; then
5465         exit 0;
5466 fi
5467 exit 1
5468 EOF
5469 chmod +x findhdr
5470
5471 : define an alternate in-header-list? function
5472 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5473 cont=true; xxf="echo \"<\$1> found.\" >&4";
5474 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5475 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5476 esac;
5477 case $# in 4) instead=instead;; *) instead="at last";; esac;
5478 while $test "$cont"; do
5479         xxx=`./findhdr $1`
5480         var=$2; eval "was=\$$2";
5481         if $test "$xxx" && $test -r "$xxx";
5482         then eval $xxf;
5483         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5484                 cont="";
5485         else eval $xxnf;
5486         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5487         set $yyy; shift; shift; yyy=$@;
5488         case $# in 0) cont="";;
5489         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5490                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5491         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5492                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5493         esac;
5494 done;
5495 while $test "$yyy";
5496 do set $yyy; var=$2; eval "was=\$$2";
5497         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5498         set $yyy; shift; shift; yyy=$@;
5499 done'
5500
5501 : see if stdlib is available
5502 set stdlib.h i_stdlib
5503 eval $inhdr
5504
5505 : check for lengths of integral types
5506 echo " "
5507 case "$intsize" in
5508 '')
5509         echo "Checking to see how big your integers are..." >&4
5510         $cat >try.c <<EOCP
5511 #include <stdio.h>
5512 #$i_stdlib I_STDLIB
5513 #ifdef I_STDLIB
5514 #include <stdlib.h>
5515 #endif
5516 int main()
5517 {
5518         printf("intsize=%d;\n", (int)sizeof(int));
5519         printf("longsize=%d;\n", (int)sizeof(long));
5520         printf("shortsize=%d;\n", (int)sizeof(short));
5521         exit(0);
5522 }
5523 EOCP
5524         set try
5525         if eval $compile_ok && $run ./try > /dev/null; then
5526                 eval `$run ./try`
5527                 echo "Your integers are $intsize bytes long."
5528                 echo "Your long integers are $longsize bytes long."
5529                 echo "Your short integers are $shortsize bytes long."
5530         else
5531                 $cat >&4 <<EOM
5532 !
5533 Help! I can't compile and run the intsize test program: please enlighten me!
5534 (This is probably a misconfiguration in your system or libraries, and
5535 you really ought to fix it.  Still, I'll try anyway.)
5536 !
5537 EOM
5538                 dflt=4
5539                 rp="What is the size of an integer (in bytes)?"
5540                 . ./myread
5541                 intsize="$ans"
5542                 dflt=$intsize
5543                 rp="What is the size of a long integer (in bytes)?"
5544                 . ./myread
5545                 longsize="$ans"
5546                 dflt=2
5547                 rp="What is the size of a short integer (in bytes)?"
5548                 . ./myread
5549                 shortsize="$ans"
5550         fi
5551         ;;
5552 esac
5553 $rm_try
5554
5555 : check for long long
5556 echo " "
5557 echo "Checking to see if you have long long..." >&4
5558 echo 'int main() { long long x = 7; return 0; }' > try.c
5559 set try
5560 if eval $compile; then
5561         val="$define"
5562         echo "You have long long."
5563 else
5564         val="$undef"
5565         echo "You do not have long long."
5566 fi
5567 $rm_try
5568 set d_longlong
5569 eval $setvar
5570
5571 : check for length of long long
5572 case "${d_longlong}${longlongsize}" in
5573 $define)
5574         echo " "
5575         echo "Checking to see how big your long longs are..." >&4
5576         $cat >try.c <<'EOCP'
5577 #include <stdio.h>
5578 int main()
5579 {
5580     printf("%d\n", (int)sizeof(long long));
5581     return(0);
5582 }
5583 EOCP
5584         set try
5585         if eval $compile_ok; then
5586                 longlongsize=`$run ./try`
5587                 echo "Your long longs are $longlongsize bytes long."
5588         else
5589                 dflt='8'
5590                 echo " "
5591                 echo "(I can't seem to compile the test program.  Guessing...)"
5592                 rp="What is the size of a long long (in bytes)?"
5593                 . ./myread
5594                 longlongsize="$ans"
5595         fi
5596         if $test "X$longsize" = "X$longlongsize"; then
5597                 echo "(That isn't any different from an ordinary long.)"
5598         fi
5599         ;;
5600 esac
5601 $rm_try
5602
5603 : see if inttypes.h is available
5604 : we want a real compile instead of Inhdr because some systems
5605 : have an inttypes.h which includes non-existent headers
5606 echo " "
5607 $cat >try.c <<EOCP
5608 #include <inttypes.h>
5609 int main() {
5610         static int32_t foo32 = 0x12345678;
5611 }
5612 EOCP
5613 set try
5614 if eval $compile; then
5615         echo "<inttypes.h> found." >&4
5616         val="$define"
5617 else
5618         echo "<inttypes.h> NOT found." >&4
5619         val="$undef"
5620 fi
5621 $rm_try
5622 set i_inttypes
5623 eval $setvar
5624
5625 : check for int64_t
5626 echo " "
5627 echo "Checking to see if you have int64_t..." >&4
5628 $cat >try.c <<EOCP
5629 #include <sys/types.h>
5630 #$i_inttypes I_INTTYPES
5631 #ifdef I_INTTYPES
5632 #include <inttypes.h>
5633 #endif
5634 int main() { int64_t x = 7; }
5635 EOCP
5636 set try
5637 if eval $compile; then
5638         val="$define"
5639         echo "You have int64_t."
5640 else
5641         val="$undef"
5642         echo "You do not have int64_t."
5643 fi
5644 $rm_try
5645 set d_int64_t
5646 eval $setvar
5647
5648 : Check if 64bit ints have a quad type
5649 echo " "
5650 echo "Checking which 64-bit integer type we could use..." >&4
5651
5652 case "$intsize" in
5653 8) val=int
5654    set quadtype
5655    eval $setvar
5656    val='"unsigned int"'
5657    set uquadtype
5658    eval $setvar
5659    quadkind=1
5660    ;;
5661 *) case "$longsize" in
5662    8) val=long
5663       set quadtype
5664       eval $setvar
5665       val='"unsigned long"'
5666       set uquadtype
5667       eval $setvar
5668       quadkind=2
5669       ;;
5670    *) case "$d_longlong:$longlongsize" in
5671       define:8)
5672         val='"long long"'
5673         set quadtype
5674         eval $setvar
5675         val='"unsigned long long"'
5676         set uquadtype
5677         eval $setvar
5678         quadkind=3
5679         ;;
5680       *) case "$d_int64_t" in
5681          define)
5682            val=int64_t
5683            set quadtype
5684            eval $setvar
5685            val=uint64_t
5686            set uquadtype
5687            eval $setvar
5688            quadkind=4
5689            ;;
5690          esac
5691          ;;
5692       esac
5693       ;;
5694    esac
5695    ;;
5696 esac
5697
5698 case "$quadtype" in
5699 '')     echo "Alas, no 64-bit integer types in sight." >&4
5700         d_quad="$undef"
5701         ;;
5702 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5703         d_quad="$define"
5704         ;;
5705 esac
5706
5707 : Do we want 64bit support
5708 case "$uselonglong" in
5709 "$define"|true|[yY]*)
5710         cat <<EOM >&4
5711
5712 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5713 EOM
5714         use64bitint="$define"
5715         ;;
5716 esac
5717 case "$use64bits" in
5718 "$define"|true|[yY]*)
5719         cat <<EOM >&4
5720
5721 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5722 EOM
5723         use64bitint="$define"
5724         ;;
5725 esac
5726 case "$use64bitints" in
5727 "$define"|true|[yY]*)
5728         cat <<EOM >&4
5729
5730 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5731 EOM
5732         use64bitint="$define"
5733         ;;
5734 esac
5735 case "$use64bitsint" in
5736 "$define"|true|[yY]*)
5737         cat <<EOM >&4
5738
5739 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5740 EOM
5741         use64bitint="$define"
5742         ;;
5743 esac
5744 case "$uselonglongs" in
5745 "$define"|true|[yY]*)
5746         cat <<EOM >&4
5747
5748 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5749 EOM
5750         use64bitint="$define"
5751         ;;
5752 esac
5753 case "$use64bitsall" in
5754 "$define"|true|[yY]*)
5755         cat <<EOM >&4
5756
5757 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5758 EOM
5759         use64bitall="$define"
5760         ;;
5761 esac
5762
5763 case "$ccflags" in
5764 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5765 esac
5766 case "$use64bitall" in
5767 "$define"|true|[yY]*) use64bitint="$define" ;;
5768 esac
5769
5770 case "$longsize" in
5771 8) cat <<EOM
5772
5773 You have natively 64-bit long integers.
5774 EOM
5775    val="$define"
5776    ;;
5777 *) case "$use64bitint" in
5778    "$define"|true|[yY]*) dflt='y';;
5779    *) dflt='n';;
5780    esac
5781    case "$d_quad" in
5782    "$define") ;;
5783    *) dflt='n' ;;
5784    esac
5785    cat <<EOM
5786
5787 Perl can be built to take advantage of 64-bit integer types
5788 on some systems.  To do so, Configure can be run with -Duse64bitint.
5789 Choosing this option will most probably introduce binary incompatibilities.
5790
5791 If this doesn't make any sense to you, just accept the default '$dflt'.
5792 (The default has been chosen based on your configuration.)
5793 EOM
5794    rp='Try to use 64-bit integers, if available?'
5795    . ./myread
5796    case "$ans" in
5797    [yY]*) val="$define" ;;
5798    *)     val="$undef"  ;;
5799    esac
5800    ;;
5801 esac
5802 set use64bitint
5803 eval $setvar
5804
5805 case "$use64bitall" in
5806 "$define"|true|[yY]*) dflt='y' ;;
5807 *) case "$longsize" in
5808    8) dflt='y' ;;
5809    *) dflt='n' ;;
5810    esac
5811    ;;
5812 esac
5813 cat <<EOM
5814
5815 You may also choose to try maximal 64-bitness.  It means using as much
5816 64-bitness as possible on the platform.  This in turn means even more
5817 binary incompatibilities.  On the other hand, your platform may not
5818 have any more 64-bitness available than what you already have chosen.
5819
5820 If this doesn't make any sense to you, just accept the default '$dflt'.
5821 (The default has been chosen based on your configuration.)
5822 EOM
5823 rp='Try to use maximal 64-bit support, if available?'
5824 . ./myread
5825 case "$ans" in
5826 [yY]*) val="$define" ;;
5827 *)     val="$undef"  ;;
5828 esac
5829 set use64bitall
5830 eval $setvar
5831 case "$use64bitall" in
5832 "$define")
5833         case "$use64bitint" in
5834         "$undef")
5835                 cat <<EOM
5836
5837 Since you have chosen a maximally 64-bit build, I'm also turning on
5838 the use of 64-bit integers.
5839 EOM
5840                 use64bitint="$define" ;;
5841         esac
5842         ;;
5843 esac
5844
5845 : Look for a hint-file generated 'call-back-unit'.  If the
5846 : user has specified that a 64-bit perl is to be built,
5847 : we may need to set or change some other defaults.
5848 if $test -f use64bitint.cbu; then
5849         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5850         . ./use64bitint.cbu
5851 fi
5852 case "$use64bitint" in
5853 "$define"|true|[yY]*)
5854         case "$longsize" in
5855         4) case "$archname64" in
5856            '') archname64=64int ;;
5857            esac
5858            ;;
5859         esac
5860         ;;
5861 esac
5862
5863 : Look for a hint-file generated 'call-back-unit'.  If the
5864 : user has specified that a maximally 64-bit perl is to be built,
5865 : we may need to set or change some other defaults.
5866 if $test -f use64bitall.cbu; then
5867         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5868         . ./use64bitall.cbu
5869 fi
5870 case "$use64bitall" in
5871 "$define"|true|[yY]*)
5872         case "$longsize" in
5873         4) case "$archname64" in
5874            ''|64int) archname64=64all ;;
5875            esac
5876            ;;
5877         esac
5878         ;;
5879 esac
5880
5881 case "$d_quad:$use64bitint" in
5882 $undef:$define)
5883         cat >&4 <<EOF
5884
5885 *** You have chosen to use 64-bit integers,
5886 *** but none can be found.
5887 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5888 *** Cannot continue, aborting.
5889
5890 EOF
5891         exit 1
5892         ;;
5893 esac
5894
5895 : check for length of double
5896 echo " "
5897 case "$doublesize" in
5898 '')
5899         echo "Checking to see how big your double precision numbers are..." >&4
5900         $cat >try.c <<EOCP
5901 #include <stdio.h>
5902 #$i_stdlib I_STDLIB
5903 #ifdef I_STDLIB
5904 #include <stdlib.h>
5905 #endif
5906 int main()
5907 {
5908     printf("%d\n", (int)sizeof(double));
5909     exit(0);
5910 }
5911 EOCP
5912         set try
5913         if eval $compile_ok; then
5914                 doublesize=`$run ./try`
5915                 echo "Your double is $doublesize bytes long."
5916         else
5917                 dflt='8'
5918                 echo "(I can't seem to compile the test program.  Guessing...)"
5919                 rp="What is the size of a double precision number (in bytes)?"
5920                 . ./myread
5921                 doublesize="$ans"
5922         fi
5923         ;;
5924 esac
5925 $rm_try
5926
5927 : check for long doubles
5928 echo " "
5929 echo "Checking to see if you have long double..." >&4
5930 echo 'int main() { long double x = 7.0; }' > try.c
5931 set try
5932 if eval $compile; then
5933         val="$define"
5934         echo "You have long double."
5935 else
5936         val="$undef"
5937         echo "You do not have long double."
5938 fi
5939 $rm_try
5940 set d_longdbl
5941 eval $setvar
5942
5943 : check for length of long double
5944 case "${d_longdbl}${longdblsize}" in
5945 $define)
5946         echo " "
5947         echo "Checking to see how big your long doubles are..." >&4
5948         $cat >try.c <<'EOCP'
5949 #include <stdio.h>
5950 int main()
5951 {
5952         printf("%d\n", sizeof(long double));
5953 }
5954 EOCP
5955         set try
5956         set try
5957         if eval $compile; then
5958                 longdblsize=`$run ./try`
5959                 echo "Your long doubles are $longdblsize bytes long."
5960         else
5961                 dflt='8'
5962                 echo " "
5963                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5964                 rp="What is the size of a long double (in bytes)?"
5965                 . ./myread
5966                 longdblsize="$ans"
5967         fi
5968         if $test "X$doublesize" = "X$longdblsize"; then
5969                 echo "That isn't any different from an ordinary double."
5970                 echo "I'll keep your setting anyway, but you may see some"
5971                 echo "harmless compilation warnings."
5972         fi
5973         ;;
5974 esac
5975 $rm_try
5976
5977 : determine the architecture name
5978 echo " "
5979 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5980         tarch=`arch`"-$osname"
5981 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5982         if uname -m > tmparch 2>&1 ; then
5983                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5984                         -e 's/$/'"-$osname/" tmparch`
5985         else
5986                 tarch="$osname"
5987         fi
5988         $rm -f tmparch
5989 else
5990         tarch="$osname"
5991 fi
5992 case "$myarchname" in
5993 ''|"$tarch") ;;
5994 *)
5995         echo "(Your architecture name used to be $myarchname.)"
5996         archname=''
5997         ;;
5998 esac
5999 case "$targetarch" in
6000 '') ;;
6001 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6002 esac
6003 myarchname="$tarch"
6004 case "$archname" in
6005 '') dflt="$tarch";;
6006 *) dflt="$archname";;
6007 esac
6008 rp='What is your architecture name'
6009 . ./myread
6010 archname="$ans"
6011 case "$usethreads" in
6012 $define)
6013         echo "Threads selected." >&4
6014         case "$archname" in
6015         *-thread*) echo "...and architecture name already has -thread." >&4
6016                 ;;
6017         *)      archname="$archname-thread"
6018                 echo "...setting architecture name to $archname." >&4
6019                 ;;
6020         esac
6021         ;;
6022 esac
6023 case "$usemultiplicity" in
6024 $define)
6025         echo "Multiplicity selected." >&4
6026         case "$archname" in
6027         *-multi*) echo "...and architecture name already has -multi." >&4
6028                 ;;
6029         *)      archname="$archname-multi"
6030                 echo "...setting architecture name to $archname." >&4
6031                 ;;
6032         esac
6033         ;;
6034 esac
6035 case "$use64bitint$use64bitall" in
6036 *"$define"*)
6037         case "$archname64" in
6038         '')
6039                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6040                 ;;
6041         *)
6042                 case "$use64bitint" in
6043                 "$define") echo "64 bit integers selected." >&4 ;;
6044                 esac
6045                 case "$use64bitall" in
6046                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6047                 esac
6048                 case "$archname" in
6049                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6050                         ;;
6051                 *)      archname="$archname-$archname64"
6052                         echo "...setting architecture name to $archname." >&4
6053                         ;;
6054                 esac
6055                 ;;
6056         esac
6057 esac
6058 case "$uselongdouble" in
6059 $define)
6060         echo "Long doubles selected." >&4
6061         case "$longdblsize" in
6062         $doublesize)
6063                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6064                 ;;
6065         *)
6066                 case "$archname" in
6067                 *-ld*) echo "...and architecture name already has -ld." >&4
6068                         ;;
6069                 *)      archname="$archname-ld"
6070                         echo "...setting architecture name to $archname." >&4
6071                         ;;
6072                 esac
6073                 ;;
6074         esac
6075         ;;
6076 esac
6077 if $test -f archname.cbu; then
6078         echo "Your platform has some specific hints for architecture name, using them..."
6079         . ./archname.cbu
6080 fi
6081
6082 : set the prefixit variable, to compute a suitable default value
6083 prefixit='case "$3" in
6084 ""|none)
6085         case "$oldprefix" in
6086         "") eval "$1=\"\$$2\"";;
6087         *)
6088                 case "$3" in
6089                 "") eval "$1=";;
6090                 none)
6091                         eval "tp=\"\$$2\"";
6092                         case "$tp" in
6093                         ""|" ") eval "$1=\"\$$2\"";;
6094                         *) eval "$1=";;
6095                         esac;;
6096                 esac;;
6097         esac;;
6098 *)
6099         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6100         case "$tp" in
6101         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6102         /*-$oldprefix/*|\~*-$oldprefix/*)
6103                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6104         *) eval "$1=\"\$$2\"";;
6105         esac;;
6106 esac'
6107
6108 : determine installation style
6109 : For now, try to deduce it from prefix unless it is already set.
6110 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6111 case "$installstyle" in
6112 '')     case "$prefix" in
6113                 *perl*) dflt='lib';;
6114                 *) dflt='lib/perl5' ;;
6115         esac
6116         ;;
6117 *)      dflt="$installstyle" ;;
6118 esac
6119 : Probably not worth prompting for this since we prompt for all
6120 : the directories individually, and the prompt would be too long and
6121 : confusing anyway.
6122 installstyle=$dflt
6123
6124 : determine where public executables go
6125 echo " "
6126 set dflt bin bin
6127 eval $prefixit
6128 fn=d~
6129 rp='Pathname where the public executables will reside?'
6130 . ./getfile
6131 if $test "X$ansexp" != "X$binexp"; then
6132         installbin=''
6133 fi
6134 prefixvar=bin
6135 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6136 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6137 :     this via initialinstalllocation
6138 . ./setprefixvar
6139
6140 case "$userelocatableinc" in
6141 $define|true|[yY]*)     dflt='y' ;;
6142 *)                      dflt='n' ;;
6143 esac
6144 cat <<EOM
6145
6146 Would you like to build Perl so that the installation is relocatable, so that
6147 library paths in @INC are determined relative to the path of the perl binary?
6148 This is not advised for system Perl installs, or if you need to run setid
6149 scripts or scripts under taint mode.
6150
6151 If this doesn't make any sense to you, just accept the default '$dflt'.
6152 EOM
6153 rp='Use relocatable @INC?'
6154 . ./myread
6155 case "$ans" in
6156 y|Y)    val="$define" ;;
6157 *)      val="$undef"  ;;
6158 esac
6159 set userelocatableinc
6160 eval $setvar
6161
6162 initialinstalllocation="$binexp"
6163 : Default prefix is now "up one level from where the binaries are"
6164 case "$userelocatableinc" in
6165 $define|true|[yY]*)
6166     bin=".../"
6167     binexp=".../"
6168     prefix=".../.."
6169     prefixexp=".../.."
6170     installprefixexp=".../.."
6171     ;;
6172 esac
6173
6174 : determine where private library files go
6175 : Usual default is /usr/local/lib/perl5/$version.
6176 : Also allow things like /opt/perl/lib/$version, since
6177 : /opt/perl/lib/perl5... would be redundant.
6178 : The default "style" setting is made in installstyle.U
6179 case "$installstyle" in
6180 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6181 *)       set dflt privlib lib/$version ;;
6182 esac
6183 eval $prefixit
6184 $cat <<EOM
6185
6186 There are some auxiliary files for $package that need to be put into a
6187 private library directory that is accessible by everyone.
6188
6189 EOM
6190 fn=$binexp
6191 fn=d~+
6192 rp='Pathname where the private library files will reside?'
6193 . ./getfile
6194 prefixvar=privlib
6195 . ./setprefixvar
6196
6197 : set the prefixup variable, to restore leading tilda escape
6198 prefixup='case "$prefixexp" in
6199 "$prefix") ;;
6200 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6201 esac'
6202
6203 : determine where public architecture dependent libraries go
6204 set archlib archlib
6205 eval $prefixit
6206 : privlib default is /usr/local/lib/$package/$version
6207 : archlib default is /usr/local/lib/$package/$version/$archname
6208 : privlib may have an optional trailing /share.
6209 tdflt=`echo $privlib | $sed 's,/share$,,'`
6210 tdflt=$tdflt/$archname
6211 case "$archlib" in
6212 '')     dflt=$tdflt
6213         ;;
6214 *)      dflt="$archlib"
6215     ;;
6216 esac
6217 $cat <<EOM
6218
6219 $spackage contains architecture-dependent library files.  If you are
6220 sharing libraries in a heterogeneous environment, you might store
6221 these files in a separate location.  Otherwise, you can just include
6222 them with the rest of the public library files.
6223
6224 EOM
6225 fn=$binexp
6226 fn=d+~
6227 rp='Where do you want to put the public architecture-dependent libraries?'
6228 . ./getfile
6229 prefixvar=archlib
6230 . ./setprefixvar
6231 if $test X"$archlib" = X"$privlib"; then
6232         d_archlib="$undef"
6233 else
6234         d_archlib="$define"
6235 fi
6236
6237 : see if setuid scripts can be secure
6238 $cat <<EOM
6239
6240 Some kernels have a bug that prevents setuid #! scripts from being
6241 secure.  Some sites have disabled setuid #! scripts because of this.
6242
6243 First let's decide if your kernel supports secure setuid #! scripts.
6244 (If setuid #! scripts would be secure but have been disabled anyway,
6245 don't say that they are secure if asked.)
6246
6247 EOM
6248
6249 val="$undef"
6250 if $test -d /dev/fd; then
6251         echo "#!$ls" >reflect
6252         chmod +x,u+s reflect
6253         ./reflect >flect 2>&1
6254         if $contains "/dev/fd" flect >/dev/null; then
6255                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6256                 val="$define"
6257         else
6258                 $cat <<EOM
6259 If you are not sure if they are secure, I can check but I'll need a
6260 username and password different from the one you are using right now.
6261 If you don't have such a username or don't want me to test, simply
6262 enter 'none'.
6263
6264 EOM
6265                 rp='Other username to test security of setuid scripts with?'
6266                 dflt='none'
6267                 . ./myread
6268                 case "$ans" in
6269                 n|none)
6270                         case "$d_suidsafe" in
6271                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6272                                 dflt=n;;
6273                         "$undef")
6274                                 echo "Well, the $hint value is *not* secure." >&4
6275                                 dflt=n;;
6276                         *)      echo "Well, the $hint value *is* secure." >&4
6277                                 dflt=y;;
6278                         esac
6279                         ;;
6280                 *)
6281                         $rm -f reflect flect
6282                         echo "#!$ls" >reflect
6283                         chmod +x,u+s reflect
6284                         echo >flect
6285                         chmod a+w flect
6286                         echo '"su" will (probably) prompt you for '"$ans's password."
6287                         su $ans -c './reflect >flect'
6288                         if $contains "/dev/fd" flect >/dev/null; then
6289                                 echo "Okay, it looks like setuid scripts are secure." >&4
6290                                 dflt=y
6291                         else
6292                                 echo "I don't think setuid scripts are secure." >&4
6293                                 dflt=n
6294                         fi
6295                         ;;
6296                 esac
6297                 rp='Does your kernel have *secure* setuid scripts?'
6298                 . ./myread
6299                 case "$ans" in
6300                 [yY]*)  val="$define";;
6301                 *)      val="$undef";;
6302                 esac
6303         fi
6304 else
6305         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6306         echo "(That's for file descriptors, not floppy disks.)"
6307         val="$undef"
6308 fi
6309 set d_suidsafe
6310 eval $setvar
6311
6312 $rm -f reflect flect
6313
6314 : now see if they want to do setuid emulation
6315 if $test $patchlevel -lt 11; then
6316 echo " "
6317 val="$undef"
6318 case "$d_suidsafe" in
6319 "$define")
6320         val="$undef"
6321         echo "No need to emulate SUID scripts since they are secure here." >&4
6322         ;;
6323 *)
6324         $cat <<EOM
6325 Some systems have disabled setuid scripts, especially systems where
6326 setuid scripts cannot be secure.  On systems where setuid scripts have
6327 been disabled, the setuid/setgid bits on scripts are currently
6328 useless.  It is possible for $package to detect those bits and emulate
6329 setuid/setgid in a secure fashion.  This emulation will only work if
6330 setuid scripts have been disabled in your kernel.
6331
6332 EOM
6333         case "$d_dosuid" in
6334         "$define") dflt=y ;;
6335         *) dflt=n ;;
6336         esac
6337         rp="Do you want to do setuid/setgid emulation?"
6338         . ./myread
6339         case "$ans" in
6340         [yY]*)  val="$define";;
6341         *)      val="$undef";;
6342         esac
6343         ;;
6344 esac
6345 set d_dosuid
6346 eval $setvar
6347 else
6348     case "$d_dosuid" in
6349         "$define")
6350         cat >&4 <<EOH
6351
6352 SUID emulation has been removed for 5.12
6353 Please re-run Configure without -Dd_dosuid
6354
6355 EOH
6356         exit 1;
6357         ;;
6358     esac
6359     d_dosuid=undef
6360 fi
6361
6362 : Find perl5.005 or later.
6363 echo "Looking for a previously installed perl5.005 or later... "
6364 case "$perl5" in
6365 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6366                 : Check if this perl is recent and can load a simple module
6367                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6368                         perl5=$tdir/perl
6369                         break;
6370                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6371                         perl5=$tdir/perl5
6372                         break;
6373                 fi
6374         done
6375         ;;
6376 *)      perl5="$perl5"
6377         ;;
6378 esac
6379 case "$perl5" in
6380 '')     echo "None found.  That's ok.";;
6381 *)      echo "Using $perl5." ;;
6382 esac
6383
6384 : Set the siteprefix variables
6385 $cat <<EOM
6386
6387 After $package is installed, you may wish to install various
6388 add-on modules and utilities.  Typically, these add-ons will
6389 be installed under $prefix with the rest
6390 of this package.  However, you may wish to install such add-ons
6391 elsewhere under a different prefix.
6392
6393 If you do not wish to put everything under a single prefix, that's
6394 ok.  You will be prompted for the individual locations; this siteprefix
6395 is only used to suggest the defaults.
6396
6397 The default should be fine for most people.
6398
6399 EOM
6400 fn=d~+
6401 rp='Installation prefix to use for add-on modules and utilities?'
6402 : XXX Here might be another good place for an installstyle setting.
6403 case "$siteprefix" in
6404 '') dflt=$prefix ;;
6405 *)  dflt=$siteprefix ;;
6406 esac
6407 . ./getfile
6408 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6409 oldsiteprefix=''
6410 case "$siteprefix" in
6411 '') ;;
6412 *)      case "$ans" in
6413         "$prefix") ;;
6414         *) oldsiteprefix="$prefix";;
6415         esac
6416         ;;
6417 esac
6418 siteprefix="$ans"
6419 siteprefixexp="$ansexp"
6420
6421 : determine where site specific libraries go.
6422 : Usual default is /usr/local/lib/perl5/site_perl/$version
6423 : The default "style" setting is made in installstyle.U
6424 : XXX No longer works with Prefixit stuff.
6425 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6426 case "$sitelib" in
6427 '') case "$installstyle" in
6428         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6429         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6430         esac
6431         ;;
6432 *)      dflt="$sitelib"
6433         ;;
6434 esac
6435 $cat <<EOM
6436
6437 The installation process will create a directory for
6438 site-specific extensions and modules.  Most users find it convenient
6439 to place all site-specific files in this directory rather than in the
6440 main distribution directory.
6441
6442 EOM
6443 fn=d~+
6444 rp='Pathname for the site-specific library files?'
6445 . ./getfile
6446 prefixvar=sitelib
6447 . ./setprefixvar
6448 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6449
6450 : Determine list of previous versions to include in @INC
6451 $cat > getverlist <<EOPL
6452 #!$perl5 -w
6453 use File::Basename;
6454 \$api_versionstring = "$api_versionstring";
6455 \$version = "$version";
6456 \$stem = "$sitelib_stem";
6457 \$archname = "$archname";
6458 EOPL
6459         $cat >> getverlist <<'EOPL'
6460 # The list found is store twice for each entry: the original name, and
6461 # the binary broken down version as pack "sss", so sorting is easy and
6462 # unambiguous. This will work for all versions that have a maximum of
6463 # three digit groups, separate by '.'s or '_'s. Names are extended with
6464 # ".0.0" to ensure at least three elements for the pack.
6465 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6466
6467 # Can't have leading @ because metaconfig interprets it as a command!
6468 ;@inc_version_list=();
6469 # XXX Redo to do opendir/readdir?
6470 if (-d $stem) {
6471     chdir($stem);
6472     ;@candidates = map {
6473         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6474     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6475 }
6476 else {
6477     ;@candidates = ();
6478 }
6479
6480 ($pversion, $aversion, $vsn5005) = map {
6481     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6482 foreach $d (@candidates) {
6483     if ($d->[1] lt $pversion) {
6484         if ($d->[1] ge $aversion) {
6485             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6486         }
6487         elsif ($d->[1] ge $vsn5005) {
6488             unshift(@inc_version_list, grep { -d } $d->[0]);
6489         }
6490     }
6491     else {
6492         # Skip newer version.  I.e. don't look in
6493         # 5.7.0 if we're installing 5.6.1.
6494     }
6495 }
6496
6497 if (@inc_version_list) {
6498     print join(' ', @inc_version_list);
6499 }
6500 else {
6501     # Blank space to preserve value for next Configure run.
6502     print " ";
6503 }
6504 EOPL
6505 chmod +x getverlist
6506 case "$inc_version_list" in
6507 '')     if test -x "$perl5$exe_ext"; then
6508                 dflt=`$perl5 getverlist`
6509         else
6510                 dflt='none'
6511         fi
6512         ;;
6513 $undef) dflt='none' ;;
6514 *)  eval dflt=\"$inc_version_list\" ;;
6515 esac
6516 case "$dflt" in
6517 ''|' ') dflt=none ;;
6518 esac
6519 case "$dflt" in
6520 5.005) dflt=none ;;
6521 esac
6522 $cat <<EOM
6523
6524 In order to ease the process of upgrading, this version of perl
6525 can be configured to use modules built and installed with earlier
6526 versions of perl that were installed under $prefix.  Specify here
6527 the list of earlier versions that this version of perl should check.
6528 If Configure detected no earlier versions of perl installed under
6529 $prefix, then the list will be empty.  Answer 'none' to tell perl
6530 to not search earlier versions.
6531
6532 The default should almost always be sensible, so if you're not sure,
6533 just accept the default.
6534 EOM
6535
6536 rp='List of earlier versions to include in @INC?'
6537 . ./myread
6538 case "$ans" in
6539 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6540 *) inc_version_list="$ans" ;;
6541 esac
6542 case "$inc_version_list" in
6543 ''|' ')
6544         inc_version_list_init='0'
6545         d_inc_version_list="$undef"
6546         ;;
6547 *)      inc_version_list_init=`echo $inc_version_list |
6548                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6549         d_inc_version_list="$define"
6550         ;;
6551 esac
6552 $rm -f getverlist
6553
6554 : see if malloc/malloc.h has to be included
6555 set malloc/malloc.h i_mallocmalloc
6556 eval $inhdr
6557
6558 : see if this is a malloc.h system
6559 : we want a real compile instead of Inhdr because some systems have a
6560 : malloc.h that just gives a compile error saying to use stdlib.h instead
6561 echo " "
6562 $cat >try.c <<EOCP
6563 #include <stdlib.h>
6564 #include <malloc.h>
6565 #$i_mallocmalloc I_MALLOCMALLOC
6566 #ifdef I_MALLOCMALLOC
6567 # include <malloc/malloc.h>
6568 #endif
6569
6570 int main () { return 0; }
6571 EOCP
6572 set try
6573 if eval $compile; then
6574     echo "<malloc.h> found." >&4
6575     val="$define"
6576 else
6577     echo "<malloc.h> NOT found." >&4
6578     val="$undef"
6579 fi
6580 $rm_try
6581 set i_malloc
6582 eval $setvar
6583
6584 : check for void type
6585 echo " "
6586 echo "Checking to see how well your C compiler groks the void type..." >&4
6587 case "$voidflags" in
6588 '')
6589         $cat >try.c <<EOCP
6590 #$i_stdlib I_STDLIB
6591 #ifdef I_STDLIB
6592 #include <stdlib.h>
6593 #endif
6594 #if TRY & 1
6595 void sub() {
6596 #else
6597 sub() {
6598 #endif
6599         extern void moo();      /* function returning void */
6600         void (*goo)();          /* ptr to func returning void */
6601 #if TRY & 8
6602         void *hue;              /* generic ptr */
6603 #endif
6604 #if TRY & 2
6605         void (*foo[10])();
6606 #endif
6607
6608 #if TRY & 4
6609         if(goo == moo) {
6610                 exit(0);
6611         }
6612 #endif
6613         exit(0);
6614 }
6615 int main() { sub(); }
6616 EOCP
6617         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6618                 voidflags=$defvoidused
6619         echo "Good.  It appears to support void to the level $package wants.">&4
6620                 if $contains warning .out >/dev/null 2>&1; then
6621                         echo "However, you might get some warnings that look like this:"
6622                         $cat .out
6623                 fi
6624         else
6625 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6626                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6627                         echo "It supports 1..."
6628                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6629                                 echo "It also supports 2..."
6630                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6631                                         voidflags=7
6632                                         echo "And it supports 4 but not 8 definitely."
6633                                 else
6634                                         echo "It doesn't support 4..."
6635                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6636                                                 voidflags=11
6637                                                 echo "But it supports 8."
6638                                         else
6639                                                 voidflags=3
6640                                                 echo "Neither does it support 8."
6641                                         fi
6642                                 fi
6643                         else
6644                                 echo "It does not support 2..."
6645                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6646                                         voidflags=13
6647                                         echo "But it supports 4 and 8."
6648                                 else
6649                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6650                                                 voidflags=5
6651                                                 echo "And it supports 4 but has not heard about 8."
6652                                         else
6653                                                 echo "However it supports 8 but not 4."
6654                                         fi
6655                                 fi
6656                         fi
6657                 else
6658                         echo "There is no support at all for void."
6659                         voidflags=0
6660                 fi
6661         fi
6662 esac
6663 case "$voidflags" in
6664 "$defvoidused") ;;
6665 *)      $cat >&4 <<'EOM'
6666   Support flag bits are:
6667     1: basic void declarations.
6668     2: arrays of pointers to functions returning void.
6669     4: operations between pointers to and addresses of void functions.
6670     8: generic void pointers.
6671 EOM
6672         dflt="$voidflags";
6673         rp="Your void support flags add up to what?"
6674         . ./myread
6675         voidflags="$ans"
6676         ;;
6677 esac
6678 $rm_try
6679
6680 : check for length of pointer
6681 echo " "
6682 case "$ptrsize" in
6683 '')
6684         echo "Checking to see how big your pointers are..." >&4
6685         if test "$voidflags" -gt 7; then
6686                 echo '#define VOID_PTR char *' > try.c
6687         else
6688                 echo '#define VOID_PTR void *' > try.c
6689         fi
6690         $cat >>try.c <<EOCP
6691 #include <stdio.h>
6692 #$i_stdlib I_STDLIB
6693 #ifdef I_STDLIB
6694 #include <stdlib.h>
6695 #endif
6696 int main()
6697 {
6698     printf("%d\n", (int)sizeof(VOID_PTR));
6699     exit(0);
6700 }
6701 EOCP
6702         set try
6703         if eval $compile_ok; then
6704                 ptrsize=`$run ./try`
6705                 echo "Your pointers are $ptrsize bytes long."
6706         else
6707                 dflt='4'
6708                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6709                 rp="What is the size of a pointer (in bytes)?"
6710                 . ./myread
6711                 ptrsize="$ans"
6712         fi
6713         ;;
6714 esac
6715 $rm_try
6716 case "$use64bitall" in
6717 "$define"|true|[yY]*)
6718         case "$ptrsize" in
6719         4)      cat <<EOM >&4
6720
6721 *** You have chosen a maximally 64-bit build,
6722 *** but your pointers are only 4 bytes wide.
6723 *** Please rerun Configure without -Duse64bitall.
6724 EOM
6725                 case "$d_quad" in
6726                 define)
6727                         cat <<EOM >&4
6728 *** Since you have quads, you could possibly try with -Duse64bitint.
6729 EOM
6730                         ;;
6731                 esac
6732                 cat <<EOM >&4
6733 *** Cannot continue, aborting.
6734
6735 EOM
6736
6737                 exit 1
6738                 ;;
6739         esac
6740         ;;
6741 esac
6742
6743
6744 : determine whether to use malloc wrapping
6745 echo " "
6746 case "$usemallocwrap" in
6747 [yY]*|true|$define)     dflt='y' ;;
6748 [nN]*|false|$undef)     dflt='n' ;;
6749 *)      case "$usedevel" in
6750         [yY]*|true|$define)     dflt='y' ;;
6751         *) dflt='n' ;;
6752         esac
6753         ;;
6754 esac
6755 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6756 . ./myread
6757 usemallocwrap="$ans"
6758 case "$ans" in
6759 y*|true)
6760         usemallocwrap="$define" ;;
6761 *)
6762         usemallocwrap="$undef" ;;
6763 esac
6764
6765 : determine which malloc to compile in
6766 echo " "
6767 case "$usemymalloc" in
6768 [yY]*|true|$define)     dflt='y' ;;
6769 [nN]*|false|$undef)     dflt='n' ;;
6770 *)      case "$ptrsize" in
6771         4) dflt='y' ;;
6772         *) dflt='n' ;;
6773         esac
6774         ;;
6775 esac
6776 rp="Do you wish to attempt to use the malloc that comes with $package?"
6777 . ./myread
6778 usemymalloc="$ans"
6779 case "$ans" in
6780 y*|true)
6781         usemymalloc='y'
6782         mallocsrc='malloc.c'
6783         mallocobj="malloc$_o"
6784         d_mymalloc="$define"
6785         case "$libs" in
6786         *-lmalloc*)
6787                 : Remove malloc from list of libraries to use
6788                 echo "Removing unneeded -lmalloc from library list" >&4
6789                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6790                 shift
6791                 libs="$*"
6792                 echo "libs = $libs" >&4
6793                 ;;
6794         esac
6795         ;;
6796 *)
6797         usemymalloc='n'
6798         mallocsrc=''
6799         mallocobj=''
6800         d_mymalloc="$undef"
6801         ;;
6802 esac
6803
6804 : compute the return types of malloc and free
6805 echo " "
6806 $cat >malloc.c <<END
6807 #$i_malloc I_MALLOC
6808 #$i_stdlib I_STDLIB
6809 #include <stdio.h>
6810 #include <sys/types.h>
6811 #ifdef I_MALLOC
6812 #include <malloc.h>
6813 #endif
6814 #ifdef I_STDLIB
6815 #include <stdlib.h>
6816 #endif
6817 #ifdef TRY_MALLOC
6818 void *malloc();
6819 #endif
6820 #ifdef TRY_FREE
6821 void free();
6822 #endif
6823 END
6824 case "$malloctype" in
6825 '')
6826         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6827                 malloctype='void *'
6828         else
6829                 malloctype='char *'
6830         fi
6831         ;;
6832 esac
6833 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6834
6835 case "$freetype" in
6836 '')
6837         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6838                 freetype='void'
6839         else
6840                 freetype='int'
6841         fi
6842         ;;
6843 esac
6844 echo "Your system uses $freetype free(), it would seem." >&4
6845 $rm -f malloc.[co]
6846 : determine where site specific architecture-dependent libraries go.
6847 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6848 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6849 : sitelib may have an optional trailing /share.
6850 case "$sitearch" in
6851 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6852         dflt="$dflt/$archname"
6853         ;;
6854 *)      dflt="$sitearch"
6855         ;;
6856 esac
6857 set sitearch sitearch none
6858 eval $prefixit
6859 $cat <<EOM
6860
6861 The installation process will also create a directory for
6862 architecture-dependent site-specific extensions and modules.
6863
6864 EOM
6865 fn=d~+
6866 rp='Pathname for the site-specific architecture-dependent library files?'
6867 . ./getfile
6868 prefixvar=sitearch
6869 . ./setprefixvar
6870 if $test X"$sitearch" = X"$sitelib"; then
6871         d_sitearch="$undef"
6872 else
6873         d_sitearch="$define"
6874 fi
6875
6876 : Set the vendorprefix variables
6877 $cat <<EOM
6878
6879 The installation process will also create a directory for
6880 vendor-supplied add-ons.  Vendors who supply perl with their system
6881 may find it convenient to place all vendor-supplied files in this
6882 directory rather than in the main distribution directory.  This will
6883 ease upgrades between binary-compatible maintenance versions of perl.
6884
6885 Of course you may also use these directories in whatever way you see
6886 fit.  For example, you might use them to access modules shared over a
6887 company-wide network.
6888
6889 The default answer should be fine for most people.
6890 This causes further questions about vendor add-ons to be skipped
6891 and no vendor-specific directories will be configured for perl.
6892
6893 EOM
6894 rp='Do you want to configure vendor-specific add-on directories?'
6895 case "$usevendorprefix" in
6896 define|true|[yY]*) dflt=y ;;
6897 *)      : User may have set vendorprefix directly on Configure command line.
6898         case "$vendorprefix" in
6899         ''|' ') dflt=n ;;
6900         *)      dflt=y ;;
6901         esac
6902         ;;
6903 esac
6904 . ./myread
6905 case "$ans" in
6906 [yY]*)  fn=d~+
6907         rp='Installation prefix to use for vendor-supplied add-ons?'
6908         case "$vendorprefix" in
6909         '') dflt='' ;;
6910         *)  dflt=$vendorprefix ;;
6911         esac
6912         . ./getfile
6913         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6914         oldvendorprefix=''
6915         case "$vendorprefix" in
6916         '') ;;
6917         *)      case "$ans" in
6918                 "$prefix") ;;
6919                 *) oldvendorprefix="$prefix";;
6920                 esac
6921                 ;;
6922         esac
6923         usevendorprefix="$define"
6924         vendorprefix="$ans"
6925         vendorprefixexp="$ansexp"
6926         ;;
6927 *)      usevendorprefix="$undef"
6928         vendorprefix=''
6929         vendorprefixexp=''
6930         ;;
6931 esac
6932
6933 : Set the vendorlib variables
6934 case "$vendorprefix" in
6935 '')     d_vendorlib="$undef"
6936         vendorlib=''
6937         vendorlibexp=''
6938         ;;
6939 *)      d_vendorlib="$define"
6940         : determine where vendor-supplied modules go.
6941         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6942         case "$vendorlib" in
6943         '')
6944                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6945                 case "$installstyle" in
6946                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6947                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6948                 esac
6949                 ;;
6950         *)      dflt="$vendorlib"
6951                 ;;
6952         esac
6953         fn=d~+
6954         rp='Pathname for the vendor-supplied library files?'
6955         . ./getfile
6956         vendorlib="$ans"
6957         vendorlibexp="$ansexp"
6958         ;;
6959 esac
6960 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6961 prefixvar=vendorlib
6962 . ./installprefix
6963
6964 : Set the vendorarch variables
6965 case "$vendorprefix" in
6966 '')     d_vendorarch="$undef"
6967         vendorarch=''
6968         vendorarchexp=''
6969         ;;
6970 *)      d_vendorarch="$define"
6971         : determine where vendor-supplied architecture-dependent libraries go.
6972         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6973         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6974         : vendorlib may have an optional trailing /share.
6975         case "$vendorarch" in
6976         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6977                 dflt="$dflt/$archname"
6978                 ;;
6979         *)      dflt="$vendorarch" ;;
6980         esac
6981         fn=d~+
6982         rp='Pathname for vendor-supplied architecture-dependent files?'
6983         . ./getfile
6984         vendorarch="$ans"
6985         vendorarchexp="$ansexp"
6986         ;;
6987 esac
6988 prefixvar=vendorarch
6989 . ./installprefix
6990 if $test X"$vendorarch" = X"$vendorlib"; then
6991         d_vendorarch="$undef"
6992 else
6993         d_vendorarch="$define"
6994 fi
6995
6996 : Final catch-all directories to search
6997 $cat <<EOM
6998
6999 Lastly, you can have perl look in other directories for extensions and
7000 modules in addition to those already specified.
7001 These directories will be searched after 
7002         $sitearch 
7003         $sitelib 
7004 EOM
7005 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7006 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7007 echo ' '
7008 case "$otherlibdirs" in
7009 ''|' ') dflt='none' ;;
7010 *)      dflt="$otherlibdirs" ;;
7011 esac
7012 $cat <<EOM
7013 Enter a colon-separated set of extra paths to include in perl's @INC
7014 search path, or enter 'none' for no extra paths.
7015
7016 EOM
7017
7018 rp='Colon-separated list of additional directories for perl to search?'
7019 . ./myread
7020 case "$ans" in
7021 ' '|''|none)    otherlibdirs=' ' ;;     
7022 *)      otherlibdirs="$ans" ;;
7023 esac
7024 case "$otherlibdirs" in
7025 ' ') val=$undef ;;
7026 *)      val=$define ;;
7027 esac
7028 set d_perl_otherlibdirs
7029 eval $setvar
7030
7031 : Cruising for prototypes
7032 echo " "
7033 echo "Checking out function prototypes..." >&4
7034 $cat >prototype.c <<EOCP
7035 #$i_stdlib I_STDLIB
7036 #ifdef I_STDLIB
7037 #include <stdlib.h>
7038 #endif
7039 int main(int argc, char *argv[]) {
7040         exit(0);}
7041 EOCP
7042 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7043         echo "Your C compiler appears to support function prototypes."
7044         val="$define"
7045 else
7046         echo "Your C compiler doesn't seem to understand function prototypes."
7047         val="$undef"
7048 fi
7049 set prototype
7050 eval $setvar
7051 $rm -f prototype*
7052
7053 : Check if ansi2knr is required
7054 case "$prototype" in
7055 "$define") ;;
7056 *)      ansi2knr='ansi2knr'
7057         echo " "
7058         cat <<EOM >&4
7059
7060 $me:  FATAL ERROR:
7061 This version of $package can only be compiled by a compiler that 
7062 understands function prototypes.  Unfortunately, your C compiler 
7063         $cc $ccflags
7064 doesn't seem to understand them.  Sorry about that.
7065
7066 If GNU cc is available for your system, perhaps you could try that instead.  
7067
7068 Eventually, we hope to support building Perl with pre-ANSI compilers.
7069 If you would like to help in that effort, please contact <perlbug@perl.org>.
7070
7071 Aborting Configure now.
7072 EOM
7073         exit 2
7074         ;;
7075 esac
7076
7077 : DTrace support
7078 dflt_dtrace='/usr/sbin/dtrace'
7079 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7080
7081 cat <<EOM
7082
7083 Perl can be built to support DTrace on platforms that support it.
7084 DTrace is a diagnosis and performance analysis tool from Sun.
7085
7086 If this doesn't make any sense to you, just accept the default '$dflt'.
7087 EOM
7088
7089 while $test 1 ; do
7090         case "$usedtrace" in
7091         $define|true|[yY]*)
7092                 dflt='y'
7093                 ;;
7094         ?*)
7095                 dflt='y'
7096                 dflt_dtrace=$usedtrace
7097                 ;;
7098         *)
7099                 dflt='n'
7100                 ;;
7101         esac
7102
7103         rp='Support DTrace if available?'
7104         . ./myread
7105         case "$ans" in
7106         y|Y)    val="$define" ;;
7107         *)      val="$undef" ;;
7108         esac
7109         set usedtrace
7110         eval $setvar
7111
7112         test "X$usedtrace" != "X$define" && break
7113
7114         echo " "
7115         rp='Where is the dtrace executable?'
7116         dflt=$dflt_dtrace
7117         . ./getfile
7118         val="$ans"
7119         set dtrace
7120         eval $setvar
7121
7122         if $test -f $dtrace
7123         then
7124                 if $dtrace -h -s ../perldtrace.d \
7125                         -o perldtrace.tmp >/dev/null 2>&1 \
7126                         && rm -f perldtrace.tmp
7127                 then
7128                         echo " "
7129                         echo "Good: your $dtrace knows about the -h flag."
7130                 else
7131                         cat >&2 <<EOM
7132
7133 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7134 ***
7135 *** Your installed dtrace doesn't support the -h switch to compile a D
7136 *** program into a C header. Can't continue.
7137
7138 EOM
7139                         exit 1
7140                 fi
7141                 break;
7142         fi
7143
7144         case "$fastread" in
7145         yes)
7146                 cat >&2 <<EOM
7147
7148 *** $me:  Fatal Error:  $dtrace not found.
7149 *** Can't continue.
7150
7151 EOM
7152                 exit 1
7153                 ;;
7154         *)
7155                 echo "*** $dtrace was not found."
7156                 echo " "
7157                 ;;
7158         esac
7159 done
7160
7161 : See if we want extra modules installed
7162 echo " "
7163 case "$extras" in
7164 '') dflt='n';;
7165 *) dflt='y';;
7166 esac
7167 cat <<EOM
7168 Perl can be built with extra modules or bundles of modules which
7169 will be fetched from the CPAN and installed alongside Perl.
7170
7171 Notice that you will need access to the CPAN; either via the Internet,
7172 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7173 be asked later to configure the CPAN.pm module which will in turn do
7174 the installation of the rest of the extra modules or bundles.)
7175
7176 Notice also that if the modules require any external software such as
7177 libraries and headers (the libz library and the zlib.h header for the
7178 Compress::Zlib module, for example) you MUST have any such software
7179 already installed, this configuration process will NOT install such
7180 things for you.
7181
7182 If this doesn't make any sense to you, just accept the default '$dflt'.
7183 EOM
7184 rp='Install any extra modules (y or n)?'
7185 . ./myread
7186 case "$ans" in
7187 y|Y)
7188         cat <<EOM
7189
7190 Please list any extra modules or bundles to be installed from CPAN,
7191 with spaces between the names.  The names can be in any format the
7192 'install' command of CPAN.pm will understand.  (Answer 'none',
7193 without the quotes, to install no extra modules or bundles.)
7194 EOM
7195         rp='Extras?'
7196         dflt="$extras"
7197         . ./myread
7198         extras="$ans"
7199 esac
7200 case "$extras" in
7201 ''|'none')
7202         val=''
7203         $rm -f ../extras.lst
7204         ;;
7205 *)      echo "(Saving the list of extras for later...)"
7206         echo "$extras" > ../extras.lst
7207         val="'$extras'"
7208         ;;
7209 esac
7210 set extras
7211 eval $setvar
7212 echo " "
7213
7214 : determine where html pages for programs go
7215 set html1dir html1dir none
7216 eval $prefixit
7217 $cat <<EOM
7218
7219 If you wish to install html files for programs in $spackage, indicate
7220 the appropriate directory here.  To skip installing html files,
7221 answer "none".
7222 EOM
7223 case "$html1dir" in
7224 ''|none|$undef|' ') dflt=none ;;
7225 *) dflt=$html1dir ;;
7226 esac
7227 fn=dn+~
7228 rp="Directory for the main $spackage html pages?"
7229 . ./getfile
7230 prefixvar=html1dir
7231 . ./setprefixvar
7232 : Use ' ' for none so value is preserved next time through Configure
7233 $test X"$html1dir" = "X" && html1dir=' '
7234
7235 : determine where html pages for libraries and modules go
7236 set html3dir html3dir none
7237 eval $prefixit
7238 $cat <<EOM
7239
7240 If you wish to install html files for modules associated with $spackage,
7241 indicate the appropriate directory here.  To skip installing html files,
7242 answer "none".
7243 EOM
7244 : There is no obvious default.  If they have specified html1dir, then
7245 : try to key off that, possibly changing .../html1 into .../html3.
7246 case "$html3dir" in
7247 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7248 *) dflt=$html3dir ;;
7249 esac
7250 fn=dn+~
7251 rp="Directory for the $spackage module html pages?"
7252 . ./getfile
7253 prefixvar=html3dir
7254 . ./setprefixvar
7255 : Use ' ' for none so value is preserved next time through Configure
7256 $test X"$html3dir" = "X" && html3dir=' '
7257
7258 : determine whether to install perl also as /usr/bin/perl
7259
7260 echo " "
7261 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7262         $cat <<EOM
7263 Many scripts expect perl to be installed as /usr/bin/perl.
7264
7265 If you want to, I can install the perl you are about to compile
7266 as /usr/bin/perl (in addition to $bin/perl).
7267 EOM
7268         if test -f /usr/bin/perl; then
7269             $cat <<EOM
7270
7271 However, please note that because you already have a /usr/bin/perl,
7272 overwriting that with a new Perl would very probably cause problems.
7273 Therefore I'm assuming you don't want to do that (unless you insist).
7274
7275 EOM
7276             case "$installusrbinperl" in
7277             "$define"|[yY]*)    dflt='y';;
7278             *)                  dflt='n';;
7279             esac
7280         else
7281             $cat <<EOM
7282
7283 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7284
7285 EOM
7286             case "$installusrbinperl" in
7287             "$undef"|[nN]*)     dflt='n';;
7288             *)                  dflt='y';;
7289             esac
7290         fi
7291         rp="Do you want to install perl as /usr/bin/perl?"
7292         . ./myread
7293         case "$ans" in
7294         [yY]*)  val="$define";;
7295         *)      val="$undef" ;;
7296         esac
7297 else
7298         val="$undef"
7299 fi
7300 set installusrbinperl
7301 eval $setvar
7302
7303 : Check if we are using the GNU C library
7304 echo " "
7305 echo "Checking for GNU C Library..." >&4
7306 cat >try.c <<'EOCP'
7307 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7308    alone are insufficient to distinguish different versions, such as
7309    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7310    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7311 */
7312 #include <stdio.h>
7313 int main(void)
7314 {
7315 #ifdef __GLIBC__
7316 #   ifdef __GLIBC_MINOR__
7317 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7318 #           include <gnu/libc-version.h>
7319             printf("%s\n",  gnu_get_libc_version());
7320 #       else
7321             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7322 #       endif
7323 #   else
7324         printf("%d\n",  __GLIBC__);
7325 #   endif
7326     return 0;
7327 #else
7328     return 1;
7329 #endif
7330 }
7331 EOCP
7332 set try
7333 if eval $compile_ok && $run ./try > glibc.ver; then
7334         val="$define"
7335         gnulibc_version=`$cat glibc.ver`
7336         echo "You are using the GNU C Library version $gnulibc_version"
7337 else
7338         val="$undef"
7339         gnulibc_version=''
7340         echo "You are not using the GNU C Library"
7341 fi
7342 $rm_try glibc.ver
7343 set d_gnulibc
7344 eval $setvar
7345
7346 : see if nm is to be used to determine whether a symbol is defined or not
7347 case "$usenm" in
7348 '')
7349         dflt=''
7350         case "$d_gnulibc" in
7351         "$define")
7352                 echo " "
7353                 echo "nm probably won't work on the GNU C Library." >&4
7354                 dflt=n
7355                 ;;
7356         esac
7357         case "$dflt" in
7358         '') 
7359                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7360                         echo " "
7361                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7362                         echo "'nm' won't be sufficient on this sytem." >&4
7363                         dflt=n
7364                 fi
7365                 ;;
7366         esac
7367         case "$dflt" in
7368         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7369                 if $test $dflt -gt 20; then
7370                         dflt=y
7371                 else
7372                         dflt=n
7373                 fi
7374                 ;;
7375         esac
7376         ;;
7377 *)
7378         case "$usenm" in
7379         true|$define) dflt=y;;
7380         *) dflt=n;;
7381         esac
7382         ;;
7383 esac
7384 $cat <<EOM
7385
7386 I can use $nm to extract the symbols from your C libraries. This
7387 is a time consuming task which may generate huge output on the disk (up
7388 to 3 megabytes) but that should make the symbols extraction faster. The
7389 alternative is to skip the 'nm' extraction part and to compile a small
7390 test program instead to determine whether each symbol is present. If
7391 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7392 this may be the best solution.
7393
7394 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7395
7396 EOM
7397 rp="Shall I use $nm to extract C symbols from the libraries?"
7398 . ./myread
7399 case "$ans" in
7400 [Nn]*) usenm=false;;
7401 *) usenm=true;;
7402 esac
7403
7404 runnm=$usenm
7405 case "$reuseval" in
7406 true) runnm=false;;
7407 esac
7408
7409 : nm options which may be necessary
7410 case "$nm_opt" in
7411 '') if $test -f /mach_boot; then
7412                 nm_opt=''       # Mach
7413         elif $test -d /usr/ccs/lib; then
7414                 nm_opt='-p'     # Solaris (and SunOS?)
7415         elif $test -f /dgux; then
7416                 nm_opt='-p'     # DG-UX
7417         elif $test -f /lib64/rld; then
7418                 nm_opt='-p'     # 64-bit Irix
7419         else
7420                 nm_opt=''
7421         fi;;
7422 esac
7423
7424 : nm options which may be necessary for shared libraries but illegal
7425 : for archive libraries.  Thank you, Linux.
7426 case "$nm_so_opt" in
7427 '')     case "$myuname" in
7428         *linux*|gnu*)
7429                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7430                         nm_so_opt='--dynamic'
7431                 fi
7432                 ;;
7433         esac
7434         ;;
7435 esac
7436
7437 : Figure out where the libc is located
7438 case "$runnm" in
7439 true)
7440 : get list of predefined functions in a handy place
7441 echo " "
7442 case "$libc" in
7443 '') libc=unknown
7444         case "$libs" in
7445         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7446         esac
7447         ;;
7448 esac
7449 case "$libs" in
7450 '') ;;
7451 *)  for thislib in $libs; do
7452         case "$thislib" in
7453         -lc|-lc_s)
7454                 : Handle C library specially below.
7455                 ;;
7456         -l*)
7457                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7458                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7459                         :
7460                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7461                         :
7462                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7463                         :
7464                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7465                         :
7466                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7467                         :
7468                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7469                         :
7470                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7471                         :
7472                 else
7473                         try=''
7474                 fi
7475                 libnames="$libnames $try"
7476                 ;;
7477         *) libnames="$libnames $thislib" ;;
7478         esac
7479         done
7480         ;;
7481 esac
7482 xxx=normal
7483 case "$libc" in
7484 unknown)
7485         set /lib/libc.$so
7486         for xxx in $libpth; do
7487                 $test -r $1 || set $xxx/libc.$so
7488                 : The messy sed command sorts on library version numbers.
7489                 $test -r $1 || \
7490                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7491                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7492                                 h
7493                                 s/[0-9][0-9]*/0000&/g
7494                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7495                                 G
7496                                 s/\n/ /' | \
7497                          $sort | $sed -e 's/^.* //'`
7498                 eval set \$$#
7499         done
7500         $test -r $1 || set /usr/ccs/lib/libc.$so
7501         $test -r $1 || set /lib/libsys_s$_a
7502         ;;
7503 *)
7504         set blurfl
7505         ;;
7506 esac
7507 if $test -r "$1"; then
7508         echo "Your (shared) C library seems to be in $1."
7509         libc="$1"
7510 elif $test -r /lib/libc && $test -r /lib/clib; then
7511         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7512         xxx=apollo
7513         libc='/lib/clib /lib/libc'
7514         if $test -r /lib/syslib; then
7515                 echo "(Your math library is in /lib/syslib.)"
7516                 libc="$libc /lib/syslib"
7517         fi
7518 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7519         echo "Your C library seems to be in $libc, as you said before."
7520 elif $test -r $incpath/usr/lib/libc$_a; then
7521         libc=$incpath/usr/lib/libc$_a;
7522         echo "Your C library seems to be in $libc.  That's fine."
7523 elif $test -r /lib/libc$_a; then
7524         libc=/lib/libc$_a;
7525         echo "Your C library seems to be in $libc.  You're normal."
7526 else
7527         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7528                 :
7529         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7530                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7531         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7532                 :
7533         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7534                 :
7535         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7536                 :
7537         else
7538                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7539         fi
7540         if $test -r "$tans"; then
7541                 echo "Your C library seems to be in $tans, of all places."
7542                 libc=$tans
7543         else
7544                 libc='blurfl'
7545         fi
7546 fi
7547 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7548         dflt="$libc"
7549         cat <<EOM
7550
7551 If the guess above is wrong (which it might be if you're using a strange
7552 compiler, or your machine supports multiple models), you can override it here.
7553
7554 EOM
7555 else
7556         dflt=''
7557         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7558         cat >&4 <<EOM
7559 I can't seem to find your C library.  I've looked in the following places:
7560
7561 EOM
7562         $sed 's/^/      /' libpath
7563         cat <<EOM
7564
7565 None of these seems to contain your C library. I need to get its name...
7566
7567 EOM
7568 fi
7569 fn=f
7570 rp='Where is your C library?'
7571 . ./getfile
7572 libc="$ans"
7573
7574 echo " "
7575 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7576 set X `cat libnames`
7577 shift
7578 xxx=files
7579 case $# in 1) xxx=file; esac
7580 echo "Extracting names from the following $xxx for later perusal:" >&4
7581 echo " "
7582 $sed 's/^/      /' libnames >&4
7583 echo " "
7584 $echo $n "This may take a while...$c" >&4
7585
7586 for file in $*; do
7587         case $file in
7588         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7589         *) $nm $nm_opt $file 2>/dev/null;;
7590         esac
7591 done >libc.tmp
7592
7593 $echo $n ".$c"
7594 $grep fprintf libc.tmp > libc.ptf
7595 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7596 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7597 xxx='[ADTSIWi]'
7598 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7599         eval $xscan;\
7600         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7601                 eval $xrun
7602 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7603         eval $xscan;\
7604         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7605                 eval $xrun
7606 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7607         eval $xscan;\
7608         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7609                 eval $xrun
7610 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7611         eval $xscan;\
7612         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7613                 eval $xrun
7614 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7615         eval $xscan;\
7616         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7617                 eval $xrun
7618 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7619         eval $xscan;\
7620         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7621                 eval $xrun
7622 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7623                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7624         eval $xscan;\
7625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7626                 eval $xrun
7627 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7628         eval $xscan;\
7629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630                 eval $xrun
7631 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7636         eval $xscan;\
7637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638                 eval $xrun
7639 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7640         eval $xscan;\
7641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7642                 eval $xrun
7643 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7644         eval $xscan;\
7645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7646                 eval $xrun
7647 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7648         eval $xscan;\
7649         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7650                 eval $xrun
7651 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7652         eval $xscan;\
7653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7654                 eval $xrun
7655 else
7656         $nm -p $* 2>/dev/null >libc.tmp
7657         $grep fprintf libc.tmp > libc.ptf
7658         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7659                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7660         then
7661                 nm_opt='-p'
7662                 eval $xrun
7663         else
7664                 echo " "
7665                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7666                 com=''
7667                 if $ar t $libc > libc.tmp && \
7668                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7669                 then
7670                         for thisname in $libnames $libc; do
7671                                 $ar t $thisname >>libc.tmp
7672                         done
7673                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7674                         echo "Ok." >&4
7675                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7676                         for thisname in $libnames $libc; do
7677                                 $ar tv $thisname >>libc.tmp
7678                                 emximp -o tmp.imp $thisname \
7679                                     2>/dev/null && \
7680                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7681                                     < tmp.imp >>libc.tmp
7682                                 $rm -f tmp.imp
7683                         done
7684                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7685                         echo "Ok." >&4
7686                 else
7687                         echo "$ar didn't seem to work right." >&4
7688                         echo "Maybe this is a Cray...trying bld instead..." >&4
7689                         if  bld t $libc | \
7690                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7691                                 $test -s libc.list
7692                         then
7693                                 for thisname in $libnames; do
7694                                         bld t $libnames | \
7695                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7696                                         $ar t $thisname >>libc.tmp
7697                                 done
7698                                 echo "Ok." >&4
7699                         else
7700                                 echo "That didn't work either.  Giving up." >&4
7701                                 exit 1
7702                         fi
7703                 fi
7704         fi
7705 fi
7706 nm_extract="$com"
7707 case "$PASE" in
7708 define)
7709     echo " "
7710     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7711     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7712     ;;
7713 *)  if $test -f /lib/syscalls.exp; then
7714         echo " "
7715         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7716         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7717                 /lib/syscalls.exp >>libc.list
7718     fi
7719     ;;
7720 esac
7721 ;;
7722 esac
7723 $rm -f libnames libpath
7724
7725 : see if dld is available
7726 set dld.h i_dld
7727 eval $inhdr
7728
7729 : Check if we are using C++
7730 echo " "
7731 echo "Checking for C++..." >&4
7732 $cat >try.c <<'EOCP'
7733 #include <stdio.h>
7734 int main(void)
7735 {
7736 #ifdef __cplusplus
7737     return 0;
7738 #else
7739     return 1;
7740 #endif
7741 }
7742 EOCP
7743 set try
7744 if eval $compile_ok && $run ./try; then
7745         val="$define"
7746         echo "You are using a C++ compiler."
7747 else
7748         val="$undef"
7749         echo "You are not using a C++ compiler."
7750 fi
7751 $rm_try cplusplus$$
7752 set d_cplusplus
7753 eval $setvar
7754
7755 : is a C symbol defined?
7756 csym='tlook=$1;
7757 case "$3" in
7758 -v) tf=libc.tmp; tdc="";;
7759 -a) tf=libc.tmp; tdc="[]";;
7760 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7761 esac;
7762 case "$d_cplusplus" in
7763     $define)    extern_C="extern \"C\"" ;;
7764     *)          extern_C="extern"       ;;
7765 esac;
7766 tx=yes;
7767 case "$reuseval-$4" in
7768 true-) ;;
7769 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7770 esac;
7771 case "$tx" in
7772 yes)
7773         tval=false;
7774         if $test "$runnm" = true; then
7775                 if $contains $tlook $tf >/dev/null 2>&1; then
7776                         tval=true;
7777                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7778                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7779                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7780                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7781                         $rm_try;
7782                 fi;
7783         else
7784                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7785                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7786                 $rm_try;
7787         fi;
7788         ;;
7789 *)
7790         case "$tval" in
7791         $define) tval=true;;
7792         *) tval=false;;
7793         esac;
7794         ;;
7795 esac;
7796 eval "$2=$tval"'
7797
7798 : define an is-in-libc? function
7799 inlibc='echo " "; td=$define; tu=$undef;
7800 sym=$1; var=$2; eval "was=\$$2";
7801 tx=yes;
7802 case "$reuseval$was" in
7803 true) ;;
7804 true*) tx=no;;
7805 esac;
7806 case "$tx" in
7807 yes)
7808         set $sym tres -f;
7809         eval $csym;
7810         case "$tres" in
7811         true)
7812                 echo "$sym() found." >&4;
7813                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7814         *)
7815                 echo "$sym() NOT found." >&4;
7816                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7817         esac;;
7818 *)
7819         case "$was" in
7820         $define) echo "$sym() found." >&4;;
7821         *) echo "$sym() NOT found." >&4;;
7822         esac;;
7823 esac'
7824
7825 : see if dlopen exists
7826 xxx_runnm="$runnm"
7827 xxx_ccflags="$ccflags"
7828 runnm=false
7829 : with g++ one needs -shared to get is-in-libc to work for dlopen
7830 case "$gccversion" in
7831 '')     ;;
7832 *)      case "$d_cplusplus" in
7833         "$define") ccflags="$ccflags -shared" ;;
7834         esac
7835         ;;
7836 esac
7837 set dlopen d_dlopen
7838 eval $inlibc
7839 runnm="$xxx_runnm"
7840 ccflags="$xxx_ccflags"
7841
7842 : see if this is a unistd.h system
7843 set unistd.h i_unistd
7844 eval $inhdr
7845
7846 : determine which dynamic loading, if any, to compile in
7847 echo " "
7848 dldir="ext/DynaLoader"
7849 case "$usedl" in
7850 $define|y|true)
7851         dflt='y'
7852         usedl="$define"
7853         ;;
7854 $undef|n|false)
7855         dflt='n'
7856         usedl="$undef"
7857         ;;
7858 *)
7859         dflt='n'
7860         case "$d_dlopen" in
7861             $define) dflt='y' ;;
7862         esac
7863         case "$i_dld" in
7864             $define) dflt='y' ;;
7865         esac
7866         : Does a dl_xxx.xs file exist for this operating system
7867         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7868         ;;
7869 esac
7870 rp="Do you wish to use dynamic loading?"
7871 . ./myread
7872 usedl="$ans"
7873 bin_ELF="$undef"
7874 case "$ans" in
7875 y*) usedl="$define"
7876         case "$dlsrc" in
7877         '')
7878                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7879                         dflt="$dldir/dl_${osname}.xs"
7880                 elif $test "$d_dlopen" = "$define" ; then
7881                         dflt="$dldir/dl_dlopen.xs"
7882                 elif $test "$i_dld" = "$define" ; then
7883                         dflt="$dldir/dl_dld.xs"
7884                 else
7885                         dflt=''
7886                 fi
7887                 ;;
7888         *)      dflt="$dldir/$dlsrc"
7889                 ;;
7890         esac
7891     echo "The following dynamic loading files are available:"
7892         : Can not go over to $dldir because getfile has path hard-coded in.
7893         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7894         rp="Source file to use for dynamic loading"
7895         fn="fne"
7896         gfpth="$src"
7897         . ./getfile
7898         usedl="$define"
7899         : emulate basename
7900         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7901
7902         $cat << EOM
7903
7904 Some systems may require passing special flags to $cc -c to
7905 compile modules that will be used to create a shared library.
7906 To use no flags, say "none".
7907
7908 EOM
7909     case "$cccdlflags" in
7910     '') case "$gccversion" in
7911                 '') case "$osname" in
7912                         hpux)   dflt='+z' ;;
7913                         next)   dflt='none' ;;
7914                         irix*)  dflt='-KPIC' ;;
7915                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7916                         sunos)  dflt='-pic' ;;
7917                         *)      dflt='none' ;;
7918                     esac
7919                         ;;
7920                 *)  case "$osname" in
7921                         darwin) dflt='none' ;;
7922                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7923                         *)      dflt='-fpic' ;;
7924                     esac ;;
7925             esac ;;
7926         ' ') dflt='none' ;;
7927     *)  dflt="$cccdlflags" ;;
7928     esac
7929     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7930     . ./myread
7931     case "$ans" in
7932     none) cccdlflags=' ' ;;
7933     *) cccdlflags="$ans" ;;
7934     esac
7935
7936     cat << EOM
7937
7938 Some systems use ld to create libraries that can be dynamically loaded,
7939 while other systems (such as those using ELF) use $cc.
7940
7941 EOM
7942         case "$ld" in
7943         '')     $cat >try.c <<EOM
7944 /* Test for whether ELF binaries are produced */
7945 #include <fcntl.h>
7946 #$i_stdlib I_STDLIB
7947 #ifdef I_STDLIB
7948 #include <stdlib.h>
7949 #endif
7950 #$i_unistd I_UNISTD
7951 #ifdef I_UNISTD
7952 #include <unistd.h>
7953 #endif
7954 int main() {
7955         char b[4];
7956         int i = open("a.out",O_RDONLY);
7957         if(i == -1)
7958                 exit(1); /* fail */
7959         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7960                 exit(0); /* succeed (yes, it's ELF) */
7961         else
7962                 exit(1); /* fail */
7963 }
7964 EOM
7965                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7966                         cat <<EOM
7967 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7968 EOM
7969                         dflt="$cc"
7970                         bin_ELF="$define"
7971                 else
7972                         echo "I'll use ld to build dynamic libraries."
7973                         dflt='ld'
7974                 fi
7975                 $rm_try
7976                 ;;
7977         *)      dflt="$ld"
7978                 ;;
7979         esac
7980
7981     rp="What command should be used to create dynamic libraries?"
7982     . ./myread
7983         ld="$ans"
7984
7985     cat << EOM
7986
7987 Some systems may require passing special flags to $ld to create a
7988 library that can be dynamically loaded.  If your ld flags include
7989 -L/other/path options to locate libraries outside your loader's normal
7990 search path, you may need to specify those -L options here as well.  To
7991 use no flags, say "none".
7992
7993 EOM
7994     case "$lddlflags" in
7995     '') case "$osname" in
7996                         beos) dflt='-nostart' ;;
7997                         haiku) dflt='-shared' ;;
7998                         hpux) dflt='-b';
7999                               case "$gccversion" in
8000                               '') dflt="$dflt +vnocompatwarnings" ;;
8001                               esac
8002                               ;;
8003                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8004                         next)  dflt='none' ;;
8005                         solaris) dflt='-G' ;;
8006                         sunos) dflt='-assert nodefinitions' ;;
8007                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8008                 *)     dflt='none' ;;
8009                         esac
8010                         ;;
8011     *) dflt="$lddlflags" ;;
8012     esac
8013
8014         : Try to guess additional flags to pick up local libraries.
8015         : Be careful not to append to a plain 'none'
8016         case "$dflt" in
8017         none) dflt='' ;;
8018         esac
8019         for thisflag in $ldflags; do
8020                 case "$thisflag" in
8021                 -L*|-R*|-Wl,-R*)
8022                         case " $dflt " in
8023                         *" $thisflag "*) ;;
8024                         *) dflt="$dflt $thisflag" ;;
8025                         esac
8026                         ;;
8027                 esac
8028         done
8029
8030         case "$dflt" in
8031         ''|' ') dflt='none' ;;
8032         esac
8033
8034         case "$ldflags" in
8035         *-fstack-protector*)
8036             case "$dflt" in
8037                         *-fstack-protector*) ;; # Don't add it again
8038                         *) dflt="$dflt -fstack-protector" ;; 
8039                 esac
8040                 ;;
8041         esac
8042
8043
8044     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8045     . ./myread
8046     case "$ans" in
8047     none) lddlflags=' ' ;;
8048     *) lddlflags="$ans" ;;
8049     esac
8050
8051         cat <<EOM
8052
8053 Some systems may require passing special flags to $cc to indicate that
8054 the resulting executable will use dynamic linking.  To use no flags,
8055 say "none".
8056
8057 EOM
8058     case "$ccdlflags" in
8059     '') case "$osname" in
8060             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8061             next|sunos) dflt='none' ;;
8062             *)          dflt='none' ;;
8063             esac ;;
8064     ' ')  dflt='none' ;;
8065     *)  dflt="$ccdlflags" ;;
8066     esac
8067     rp="Any special flags to pass to $cc to use dynamic linking?"
8068     . ./myread
8069     case "$ans" in
8070     none) ccdlflags=' ' ;;
8071     *) ccdlflags="$ans" ;;
8072     esac
8073     ;;
8074 *)  usedl="$undef"
8075         ld='ld'
8076     dlsrc='dl_none.xs'
8077     lddlflags=''
8078     ccdlflags=''
8079     ;;
8080 esac
8081
8082 : Do we want a shared libperl?
8083 also=''
8084 case "$usedl" in
8085 $undef)
8086         # No dynamic loading being used, so don't bother even to prompt.
8087         useshrplib='false'
8088         ;;
8089 *)      case "$useshrplib" in
8090         '')     case "$osname" in
8091                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8092                         dflt=y
8093                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8094                         ;;
8095                 next*)
8096                         case "$osvers" in
8097                         4*)     dflt=y
8098                                 also='Building a shared libperl is needed for MAB support.'
8099                                 ;;
8100                         *)      dflt=n
8101                                 ;;
8102                         esac
8103                         ;;
8104                 *)      dflt=n
8105                         ;;
8106                 esac
8107                 ;;
8108         $define|true|[Yy]*)
8109                 dflt=y
8110                 ;;
8111         *)      dflt=n
8112                 ;;
8113         esac
8114         $cat << EOM
8115
8116 The perl executable is normally obtained by linking perlmain.c with
8117 libperl${_a}, any static extensions (usually just DynaLoader), and
8118 any other libraries needed on this system (such as -lm, etc.).  Since
8119 your system supports dynamic loading, it is probably possible to build
8120 a shared libperl.$so.  If you will have more than one executable linked
8121 to libperl.$so, this will significantly reduce the size of each
8122 executable, but it may have a noticeable effect on performance.  The
8123 default is probably sensible for your system.
8124 $also
8125
8126 EOM
8127         rp="Build a shared libperl.$so (y/n)"
8128         . ./myread
8129         case "$ans" in
8130         true|$define|[Yy]*)
8131                 useshrplib='true'  ;;
8132         *)      useshrplib='false' ;;
8133         esac
8134         ;;
8135 esac
8136
8137 case "$useshrplib" in
8138 true)
8139         case "$userelocatableinc" in
8140         true|define)
8141                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8142                 echo "See INSTALL for an explanation why that won't work." >&4
8143                 exit 4
8144                 ;;
8145         esac
8146         case "$libperl" in
8147         '')
8148                 # Figure out a good name for libperl.so.  Since it gets stored in
8149                 # a version-specific architecture-dependent library, the version
8150                 # number isn't really that important, except for making cc/ld happy.
8151                 #
8152                 # A name such as libperl.so.10.1
8153                 majmin="libperl.$so.$patchlevel.$subversion"
8154                 # A name such as libperl.so.100
8155                 majonly=`echo $patchlevel $subversion |
8156                         $awk '{printf "%d%02d", $1, $2}'`
8157                 majonly=libperl.$so.$majonly
8158                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8159                 # rely on figuring it out from the naming of libc.
8160                 case "${osname}${osvers}" in
8161                 next4*)
8162                         dflt=libperl.5.$so
8163                         # XXX How handle the --version stuff for MAB?
8164                         ;;
8165                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8166                         dflt=libperl.$so
8167                         ;;
8168                 cygwin*) # ld links now against the dll directly
8169                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8170                         majonly=`echo $patchlevel $subversion |
8171                                 $awk '{printf "%03d%03d", $1, $2}'`
8172                         majonly=cygperl5.$majonly.$so
8173                         dflt=$majmin
8174                         ;;
8175                 *)      # Try to guess based on whether libc has major.minor.
8176                         case "$libc" in
8177                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8178                         *libc.$so.[0-9]*) dflt=$majonly ;;
8179                         *)      dflt=libperl.$so ;;
8180                         esac
8181                         ;;
8182                 esac
8183                 ;;
8184         *)      dflt=$libperl
8185                 ;;
8186         esac
8187         cat << EOM
8188
8189 I need to select a good name for the shared libperl.  If your system uses
8190 library names with major and minor numbers, then you might want something
8191 like $majmin.  Alternatively, if your system uses a single version
8192 number for shared libraries, then you might want to use $majonly.
8193 Or, your system might be quite happy with a simple libperl.$so.
8194
8195 Since the shared libperl will get installed into a version-specific
8196 architecture-dependent directory, the version number of the shared perl
8197 library probably isn't important, so the default should be o.k.
8198
8199 EOM
8200         rp='What name do you want to give to the shared libperl?'
8201         . ./myread
8202         libperl=$ans
8203         echo "Ok, I'll use $libperl"
8204         ;;
8205 *)
8206         libperl="libperl${_a}"
8207         ;;
8208 esac
8209
8210 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8211 case "$shrpdir" in
8212 '') ;;
8213 *)      $cat >&4 <<EOM
8214 WARNING:  Use of the shrpdir variable for the installation location of
8215 the shared $libperl is not supported.  It was never documented and
8216 will not work in this version.  Let me (perlbug@perl.org)
8217 know of any problems this may cause.
8218
8219 EOM
8220         case "$shrpdir" in
8221         "$archlibexp/CORE")
8222                 $cat >&4 <<EOM
8223 But your current setting of $shrpdir is
8224 the default anyway, so it's harmless.
8225 EOM
8226                 ;;
8227         *)
8228                 $cat >&4 <<EOM
8229 Further, your current attempted setting of $shrpdir
8230 conflicts with the value of $archlibexp/CORE
8231 that installperl will use.
8232 EOM
8233                 ;;
8234         esac
8235         ;;
8236 esac
8237
8238 # How will the perl executable find the installed shared $libperl?
8239 # Add $xxx to ccdlflags.
8240 # If we can't figure out a command-line option, use $shrpenv to
8241 # set env LD_RUN_PATH.  The main perl makefile uses this.
8242 shrpdir=$archlibexp/CORE
8243 xxx=''
8244 tmp_shrpenv=''
8245 if "$useshrplib"; then
8246     case "$osname" in
8247         aix)
8248                 # We'll set it in Makefile.SH...
8249                 ;;
8250         solaris)
8251                 xxx="-R $shrpdir"
8252                 ;;
8253         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8254                 xxx="-Wl,-R$shrpdir"
8255                 ;;
8256         bsdos|linux|irix*|dec_osf|gnu*)
8257                 xxx="-Wl,-rpath,$shrpdir"
8258                 ;;
8259         next)
8260                 # next doesn't like the default...
8261                 ;;
8262         beos)
8263                 # beos doesn't like the default, either.
8264                 ;;
8265         haiku)
8266                 # Haiku doesn't like the default, either.
8267                 ;;
8268         hpux*)
8269                 # hpux doesn't like the default, either.
8270                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8271                 ;;
8272         cygwin)
8273                 # cygwin needs only ldlibpth
8274                 ;;
8275         *)
8276                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8277                 ;;
8278         esac
8279         case "$xxx" in
8280         '') ;;
8281         *)
8282                 # Only add $xxx if it isn't already in ccdlflags.
8283                 case " $ccdlflags " in
8284                 *" $xxx "*)     ;;
8285                 *)      ccdlflags="$ccdlflags $xxx"
8286                         cat <<EOM >&4
8287
8288 Adding $xxx to the flags
8289 passed to $ld so that the perl executable will find the
8290 installed shared $libperl.
8291
8292 EOM
8293                         ;;
8294                 esac
8295                 ;;
8296         esac
8297 fi
8298 # Fix ccdlflags in AIX for building external extensions.
8299 # (For building Perl itself bare -bE:perl.exp is needed,
8300 #  Makefile.SH takes care of this.)
8301 case "$osname" in
8302 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8303 esac
8304 # Respect a hint or command-line value.
8305 case "$shrpenv" in
8306 '') shrpenv="$tmp_shrpenv" ;;
8307 esac
8308 case "$ldlibpthname" in
8309 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8310 none)   ldlibpthname='' ;;
8311 esac
8312
8313 : determine where manual pages are on this system
8314 echo " "
8315 case "$sysman" in
8316 '') 
8317         syspath='/usr/share/man/man1 /usr/man/man1'
8318         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8319         syspath="$syspath /usr/man/u_man/man1"
8320         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8321         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8322         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8323         sysman=`./loc . /usr/man/man1 $syspath`
8324         ;;
8325 esac
8326 if $test -d "$sysman"; then
8327         echo "System manual is in $sysman." >&4
8328 else
8329         echo "Could not find manual pages in source form." >&4
8330 fi
8331
8332 : determine where manual pages go
8333 set man1dir man1dir none
8334 eval $prefixit
8335 $cat <<EOM
8336
8337 $spackage has manual pages available in source form.
8338 EOM
8339 case "$nroff" in
8340 nroff)
8341         echo "However, you don't have nroff, so they're probably useless to you."
8342         case "$man1dir" in
8343         '') man1dir="none";;
8344         esac;;
8345 esac
8346 echo "If you don't want the manual sources installed, answer 'none'."
8347 case "$man1dir" in
8348 ' ') dflt=none
8349         ;;
8350 '')
8351         lookpath="$prefixexp/share/man/man1"
8352         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8353         lookpath="$lookpath $prefixexp/man/p_man/man1"
8354         lookpath="$lookpath $prefixexp/man/u_man/man1"
8355         lookpath="$lookpath $prefixexp/man/man.1"
8356         case "$sysman" in
8357         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8358         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8359         esac
8360         set dflt
8361         eval $prefixup
8362         ;;
8363 *)  dflt="$man1dir"
8364         ;;
8365 esac
8366 echo " "
8367 fn=dn+~
8368 rp="Where do the main $spackage manual pages (source) go?"
8369 . ./getfile
8370 if $test "X$man1direxp" != "X$ansexp"; then
8371         installman1dir=''
8372 fi
8373 prefixvar=man1dir
8374 . ./setprefixvar
8375
8376 case "$man1dir" in
8377 '')     man1dir=' '
8378         installman1dir='';;
8379 esac
8380
8381 : What suffix to use on installed man pages
8382
8383 case "$man1dir" in
8384 ' ')
8385         man1ext='0'
8386         ;;
8387 *)
8388         rp="What suffix should be used for the main $spackage man pages?"
8389         case "$man1ext" in
8390         '')     case "$man1dir" in
8391                 *1)  dflt=1 ;;
8392                 *1p) dflt=1p ;;
8393                 *1pm) dflt=1pm ;;
8394                 *l) dflt=l;;
8395                 *n) dflt=n;;
8396                 *o) dflt=o;;
8397                 *p) dflt=p;;
8398                 *C) dflt=C;;
8399                 *L) dflt=L;;
8400                 *L1) dflt=L1;;
8401                 *) dflt=1;;
8402                 esac
8403                 ;;
8404         *)      dflt="$man1ext";;
8405         esac
8406         . ./myread
8407         man1ext="$ans"
8408         ;;
8409 esac
8410
8411 : see if we can have long filenames
8412 echo " "
8413 first=123456789abcdef
8414 $rm -f $first
8415 if (echo hi >$first) 2>/dev/null; then
8416         if $test -f 123456789abcde; then
8417                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8418                 val="$undef"
8419         else
8420                 echo 'You can have filenames longer than 14 characters.'>&4
8421                 val="$define"
8422         fi
8423 else
8424         $cat <<'EOM'
8425 You can't have filenames longer than 14 chars.
8426 You can't even think about them!
8427 EOM
8428         val="$undef"
8429 fi
8430 set d_flexfnam
8431 eval $setvar
8432 $rm -rf 123456789abcde*
8433
8434 : determine where library module manual pages go
8435 set man3dir man3dir none
8436 eval $prefixit
8437 $cat <<EOM
8438
8439 $spackage has manual pages for many of the library modules.
8440 EOM
8441
8442 case "$nroff" in
8443 nroff)
8444         $cat <<'EOM'
8445 However, you don't have nroff, so they're probably useless to you.
8446 EOM
8447         case "$man3dir" in
8448         '') man3dir="none";;
8449         esac;;
8450 esac
8451
8452 case "$d_flexfnam" in
8453 undef)
8454         $cat <<'EOM'
8455 However, your system can't handle the long file names like File::Basename.3.
8456 EOM
8457         case "$man3dir" in
8458         '') man3dir="none";;
8459         esac;;
8460 esac
8461
8462 echo "If you don't want the manual sources installed, answer 'none'."
8463 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8464 case "$man3dir" in
8465 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8466         if $test -d "$privlib/man/man3"; then
8467                 cat <<EOM >&4
8468
8469 WARNING:  Previous versions of perl installed man3 pages into
8470 $privlib/man/man3.  This version will suggest a
8471 new default of $dflt.
8472 EOM
8473                 tdflt=$dflt
8474                 dflt='n'
8475                 rp='Do you wish to preserve the old behavior?(y/n)'
8476                 . ./myread
8477                 case "$ans" in
8478                 y*) dflt="$privlib/man/man3" ;;
8479                 *)  dflt=$tdflt ;;
8480                 esac
8481     fi
8482         ;;
8483 *)      dflt="$man3dir" ;;
8484 esac
8485 case "$dflt" in
8486 ' ') dflt=none ;;
8487 esac
8488 echo " "
8489 fn=dn+~
8490 rp="Where do the $package library man pages (source) go?"
8491 . ./getfile
8492 prefixvar=man3dir
8493 . ./setprefixvar
8494
8495 case "$man3dir" in
8496 '')     man3dir=' '
8497         installman3dir='';;
8498 esac
8499
8500 : What suffix to use on installed man pages
8501 case "$man3dir" in
8502 ' ')
8503         man3ext='0'
8504         ;;
8505 *)
8506         rp="What suffix should be used for the $package library man pages?"
8507         case "$man3ext" in
8508         '')     case "$man3dir" in
8509                 *3)  dflt=3 ;;
8510                 *3p) dflt=3p ;;
8511                 *3pm) dflt=3pm ;;
8512                 *l) dflt=l;;
8513                 *n) dflt=n;;
8514                 *o) dflt=o;;
8515                 *p) dflt=p;;
8516                 *C) dflt=C;;
8517                 *L) dflt=L;;
8518                 *L3) dflt=L3;;
8519                 *) dflt=3;;
8520                 esac
8521                 ;;
8522         *)      dflt="$man3ext";;
8523         esac
8524         . ./myread
8525         man3ext="$ans"
8526         ;;
8527 esac
8528
8529 : see if we have to deal with yellow pages, now NIS.
8530 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8531         if $test -f /usr/etc/nibindd; then
8532                 echo " "
8533                 echo "I'm fairly confident you're on a NeXT."
8534                 echo " "
8535                 rp='Do you get the hosts file via NetInfo?'
8536                 dflt=y
8537                 case "$hostcat" in
8538                 nidump*) ;;
8539                 '') ;;
8540                 *) dflt=n;;
8541                 esac
8542                 . ./myread
8543                 case "$ans" in
8544                 y*) hostcat='nidump hosts .';;
8545                 *)      case "$hostcat" in
8546                         nidump*) hostcat='';;
8547                         esac
8548                         ;;
8549                 esac
8550         fi
8551         case "$hostcat" in
8552         nidump*) ;;
8553         *)
8554                 case "$hostcat" in
8555                 *ypcat*) dflt=y;;
8556                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8557                                 dflt=y
8558                         else
8559                                 dflt=n
8560                         fi;;
8561                 *) dflt=n;;
8562                 esac
8563                 echo " "
8564                 rp='Are you getting the hosts file via yellow pages?'
8565                 . ./myread
8566                 case "$ans" in
8567                 y*) hostcat='ypcat hosts';;
8568                 *) hostcat='cat /etc/hosts';;
8569                 esac
8570                 ;;
8571         esac
8572 fi
8573 case "$hostcat" in
8574 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8575 esac
8576 case "$groupcat" in
8577 '') test -f /etc/group && groupcat='cat /etc/group';;
8578 esac
8579 case "$passcat" in
8580 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8581 esac
8582
8583 : now get the host name
8584 echo " "
8585 echo "Figuring out host name..." >&4
8586 case "$myhostname" in
8587 '') cont=true
8588         echo 'Maybe "hostname" will work...'
8589         if tans=`sh -c hostname 2>&1` ; then
8590                 myhostname=$tans
8591                 phostname=hostname
8592                 cont=''
8593         fi
8594         ;;
8595 *) cont='';;
8596 esac
8597 if $test "$cont"; then
8598         if ./xenix; then
8599                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8600                 if tans=`cat /etc/systemid 2>&1` ; then
8601                         myhostname=$tans
8602                         phostname='cat /etc/systemid'
8603                         echo "Whadyaknow.  Xenix always was a bit strange..."
8604                         cont=''
8605                 fi
8606         elif $test -r /etc/systemid; then
8607                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8608         fi
8609 fi
8610 if $test "$cont"; then
8611         echo 'No, maybe "uuname -l" will work...'
8612         if tans=`sh -c 'uuname -l' 2>&1` ; then
8613                 myhostname=$tans
8614                 phostname='uuname -l'
8615         else
8616                 echo 'Strange.  Maybe "uname -n" will work...'
8617                 if tans=`sh -c 'uname -n' 2>&1` ; then
8618                         myhostname=$tans
8619                         phostname='uname -n'
8620                 else
8621                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8622                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8623                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8624                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8625                         else
8626                                 case "$myhostname" in
8627                                 '') echo "Does this machine have an identity crisis or something?"
8628                                         phostname='';;
8629                                 *)
8630                                         echo "Well, you said $myhostname before..."
8631                                         phostname='echo $myhostname';;
8632                                 esac
8633                         fi
8634                 fi
8635         fi
8636 fi
8637 case "$myhostname" in
8638 '') myhostname=noname ;;
8639 esac
8640 : you do not want to know about this
8641 set $myhostname
8642 myhostname=$1
8643
8644 : verify guess
8645 if $test "$myhostname" ; then
8646         dflt=y
8647         rp='Your host name appears to be "'$myhostname'".'" Right?"
8648         . ./myread
8649         case "$ans" in
8650         y*) ;;
8651         *) myhostname='';;
8652         esac
8653 fi
8654
8655 : bad guess or no guess
8656 while $test "X$myhostname" = X ; do
8657         dflt=''
8658         rp="Please type the (one word) name of your host:"
8659         . ./myread
8660         myhostname="$ans"
8661 done
8662
8663 : translate upper to lower if necessary
8664 case "$myhostname" in
8665 *[A-Z]*)
8666         echo "(Normalizing case in your host name)"
8667         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8668         ;;
8669 esac
8670
8671 case "$myhostname" in
8672 *.*)
8673         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8674         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8675         echo "(Trimming domain name from host name--host name is now $myhostname)"
8676         ;;
8677 *) case "$mydomain" in
8678         '')
8679                 {
8680                         test "X$hostcat" = "Xypcat hosts" &&
8681                         ypmatch "$myhostname" hosts 2>/dev/null |\
8682                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8683                         $test -s hosts
8684                 } || {
8685                         test "X$hostcat" != "X" &&
8686                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8687                                         /[       ]$myhostname[  . ]/p" > hosts
8688                 }
8689                 tmp_re="[       . ]"
8690                 if $test -f hosts; then
8691                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8692                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8693                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8694                                 hosts | $sort | $uniq | \
8695                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8696                         case `$echo X$dflt` in
8697                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8698                                 dflt=.
8699                                 ;;
8700                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8701                                 ;;
8702                         esac
8703                 else
8704                         echo "(I cannot locate a hosts database anywhere)"
8705                         dflt=.
8706                 fi
8707                 case "$dflt" in
8708                 .)
8709                         tans=`./loc resolv.conf X /etc /usr/etc`
8710                         if $test -f "$tans"; then
8711                                 echo "(Attempting domain name extraction from $tans)"
8712                                 dflt=.`$sed -n -e 's/   / /g' \
8713                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8714                                   -e 1q 2>/dev/null`
8715                                 case "$dflt" in
8716                                 .) dflt=.`$sed -n -e 's/        / /g' \
8717                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8718                                      -e 1q 2>/dev/null`
8719                                         ;;
8720                                 esac
8721                         fi
8722                         ;;
8723                 esac
8724                 case "$dflt" in
8725                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8726                         dflt=.`sh -c domainname 2>/dev/null`
8727                         case "$dflt" in
8728                         '') dflt='.';;
8729                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8730                         esac
8731                         ;;
8732                 esac
8733                 case "$dflt$osname" in
8734                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8735                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8736                         ;;
8737                 esac
8738                 case "$dflt" in
8739                 .) echo "(Lost all hope -- silly guess then)"
8740                         dflt='.nonet'
8741                         ;;
8742                 esac
8743                 $rm -f hosts
8744                 ;;
8745         *) dflt="$mydomain";;
8746         esac;;
8747 esac
8748 echo " "
8749 rp="What is your domain name?"
8750 . ./myread
8751 tans="$ans"
8752 case "$ans" in
8753 '') ;;
8754 .*) ;;
8755 *) tans=".$tans";;
8756 esac
8757 mydomain="$tans"
8758
8759 : translate upper to lower if necessary
8760 case "$mydomain" in
8761 *[A-Z]*)
8762         echo "(Normalizing case in your domain name)"
8763         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8764         ;;
8765 esac
8766
8767 : a little sanity check here
8768 case "$phostname" in
8769 '') ;;
8770 *)
8771         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8772         $myhostname$mydomain|$myhostname) ;;
8773         *)
8774                 case "$phostname" in
8775                 sed*)
8776                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8777                         ;;
8778                 *)
8779                         echo "(That doesn't agree with your $phostname command, by the way.)"
8780                         ;;
8781                 esac
8782         ;;
8783         esac
8784         ;;
8785 esac
8786
8787 : determine the e-mail address of the user who is running us
8788 $cat <<EOM
8789
8790 I need to get your e-mail address in Internet format if possible, i.e.
8791 something like user@host.domain. Please answer accurately since I have
8792 no easy means to double check it. The default value provided below
8793 is most probably close to reality but may not be valid from outside
8794 your organization...
8795
8796 EOM
8797 cont=x
8798 while test "$cont"; do
8799         case "$cf_email" in
8800         '') dflt="$cf_by@$myhostname$mydomain";;
8801         *) dflt="$cf_email";;
8802         esac
8803         rp='What is your e-mail address?'
8804         . ./myread
8805         cf_email="$ans"
8806         case "$cf_email" in
8807         *@*.*) cont='' ;;
8808         *)
8809                 rp='Address does not look like an Internet one.  Use it anyway?'
8810                 case "$fastread" in
8811                 yes) dflt=y ;;
8812                 *) dflt=n ;;
8813                 esac
8814                 . ./myread
8815                 case "$ans" in
8816                 y*) cont='' ;;
8817                 *) echo " " ;;
8818                 esac
8819                 ;;
8820         esac
8821 done
8822
8823 : Ask e-mail of administrator
8824 $cat <<EOM
8825
8826 If you or somebody else will be maintaining perl at your site, please
8827 fill in the correct e-mail address here so that they may be contacted
8828 if necessary. Currently, the "perlbug" program included with perl
8829 will send mail to this address in addition to perlbug@perl.org. You may
8830 enter "none" for no administrator.
8831
8832 EOM
8833 case "$perladmin" in
8834 '') dflt="$cf_email";;
8835 *) dflt="$perladmin";;
8836 esac
8837 rp='Perl administrator e-mail address'
8838 . ./myread
8839 perladmin="$ans"
8840
8841 : determine whether to only install version-specific parts.
8842 echo " "
8843 $cat <<EOM
8844 Do you want to install only the version-specific parts of the perl
8845 distribution?  Usually you do *not* want to do this.
8846 EOM
8847 case "$versiononly" in
8848 "$define"|[Yy]*|true) dflt='y' ;;
8849 *) dflt='n';
8850 esac
8851 rp="Do you want to install only the version-specific parts of perl?"
8852 . ./myread
8853 case "$ans" in
8854 [yY]*)  val="$define";;
8855 *)      val="$undef" ;;
8856 esac
8857 set versiononly
8858 eval $setvar
8859
8860 case "$versiononly" in
8861 "$define") inc_version_list=''
8862            inc_version_list_init=0
8863            ;;
8864 esac
8865
8866 : figure out how to guarantee perl startup
8867 : XXX Note that this currently takes advantage of the bug that binexp ignores
8868 :     the Configure -Dinstallprefix setting, which in turn means that under
8869 :     relocatable @INC, initialinstalllocation is what binexp started as.
8870 case "$startperl" in
8871 '')
8872         case "$sharpbang" in
8873         *!)
8874                 $cat <<EOH
8875
8876 I can use the #! construct to start perl on your system. This will
8877 make startup of perl scripts faster, but may cause problems if you
8878 want to share those scripts and perl is not in a standard place
8879 ($initialinstalllocation/perl) on all your platforms. The alternative
8880 is to force a shell by starting the script with a single ':' character.
8881
8882 EOH
8883                 case "$versiononly" in
8884                 "$define")      dflt="$initialinstalllocation/perl$version";;
8885                 *)              dflt="$initialinstalllocation/perl";;
8886                 esac
8887                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8888                 . ./myread
8889                 case "$ans" in
8890                 none)   startperl=": # use perl";;
8891                 *)      startperl="#!$ans"
8892                         if $test 30 -lt `echo "$ans" | wc -c`; then
8893                                 $cat >&4 <<EOM
8894
8895 WARNING:  Some systems limit the #! command to 32 characters.
8896 If you experience difficulty running Perl scripts with #!, try
8897 installing Perl in a directory with a shorter pathname.
8898
8899 EOM
8900                         fi ;;
8901                 esac
8902                 ;;
8903         *) startperl=": # use perl"
8904                 ;;
8905         esac
8906         ;;
8907 esac
8908 echo "I'll use $startperl to start perl scripts."
8909
8910 : figure best path for perl in scripts
8911 case "$perlpath" in
8912 '')
8913         case "$versiononly" in
8914         "$define")      perlpath="$initialinstalllocation/perl$version";;
8915         *)              perlpath="$initialinstalllocation/perl";;
8916         esac
8917         case "$startperl" in
8918         *!*) ;;
8919         *)
8920                 $cat <<EOH
8921
8922 I will use the "eval 'exec'" idiom to start Perl on your system.
8923 I can use the full path of your Perl binary for this purpose, but
8924 doing so may cause problems if you want to share those scripts and
8925 Perl is not always in a standard place ($initialinstalllocation/perl).
8926
8927 EOH
8928                 dflt="$initialinstalllocation/perl"
8929                 rp="What path shall I use in \"eval 'exec'\"?"
8930                 . ./myread
8931                 perlpath="$ans"
8932                 ;;
8933         esac
8934         ;;
8935 esac
8936 case "$startperl" in
8937 *!*)    ;;
8938 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8939 esac
8940
8941 : determine where public executable scripts go
8942 set scriptdir scriptdir
8943 eval $prefixit
8944 case "$scriptdir" in
8945 '')
8946         dflt="$bin"
8947         : guess some guesses
8948         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8949         $test -d /usr/share/bin     && dflt=/usr/share/bin
8950         $test -d /usr/local/script  && dflt=/usr/local/script
8951         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8952         $test -d $prefixexp/script  && dflt=$prefixexp/script
8953         set dflt
8954         eval $prefixup
8955         ;;
8956 *)  dflt="$scriptdir"
8957         ;;
8958 esac
8959 $cat <<EOM
8960
8961 Some installations have a separate directory just for executable scripts so
8962 that they can mount it across multiple architectures but keep the scripts in
8963 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8964 Or you might just lump your scripts in with all your other executables.
8965
8966 EOM
8967 fn=d~
8968 rp='Where do you keep publicly executable scripts?'
8969 . ./getfile
8970 if $test "X$ansexp" != "X$scriptdirexp"; then
8971         installscript=''
8972 fi
8973 installscriptdir=''
8974 prefixvar=scriptdir
8975 . ./setprefixvar
8976 : A little fix up for an irregularly named variable.
8977 installscript="$installscriptdir"
8978
8979 : determine where add-on public executables go
8980 case "$sitebin" in
8981 '')     dflt=$siteprefix/bin ;;
8982 *)      dflt=$sitebin ;;
8983 esac
8984 fn=d~
8985 rp='Pathname where the add-on public executables should be installed?'
8986 . ./getfile
8987 prefixvar=sitebin
8988 . ./setprefixvar
8989
8990 : determine where add-on html pages go
8991 : There is no standard location, so try to copy the previously-selected
8992 : directory structure for the core html pages.
8993 case "$sitehtml1dir" in
8994 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8995 *)     dflt=$sitehtml1dir ;;
8996 esac
8997 case "$dflt" in
8998 ''|' ') dflt=none ;;
8999 esac
9000 fn=dn+~
9001 rp='Pathname where the site-specific html pages should be installed?'
9002 . ./getfile
9003 prefixvar=sitehtml1dir
9004 . ./setprefixvar
9005
9006 : determine where add-on library html pages go
9007 : There is no standard location, so try to copy the previously-selected
9008 : directory structure for the core html pages.
9009 case "$sitehtml3dir" in
9010 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9011 *)     dflt=$sitehtml3dir ;;
9012 esac
9013 case "$dflt" in
9014 ''|' ') dflt=none ;;
9015 esac
9016 fn=dn+~
9017 rp='Pathname where the site-specific library html pages should be installed?'
9018 . ./getfile
9019 prefixvar=sitehtml3dir
9020 . ./setprefixvar
9021
9022 : determine where add-on manual pages go
9023 case "$siteman1dir" in
9024 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9025 *)      dflt=$siteman1dir ;;
9026 esac
9027 case "$dflt" in
9028 ''|' ') dflt=none ;;
9029 esac
9030 fn=dn+~
9031 rp='Pathname where the site-specific manual pages should be installed?'
9032 . ./getfile
9033 prefixvar=siteman1dir
9034 . ./setprefixvar
9035
9036 : determine where add-on library man pages go
9037 case "$siteman3dir" in
9038 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9039 *)      dflt=$siteman3dir ;;
9040 esac
9041 case "$dflt" in
9042 ''|' ') dflt=none ;;
9043 esac
9044 fn=dn+~
9045 rp='Pathname where the site-specific library manual pages should be installed?'
9046 . ./getfile
9047 prefixvar=siteman3dir
9048 . ./setprefixvar
9049
9050 : determine where add-on public executable scripts go
9051 case "$sitescript" in
9052 '')     dflt=$siteprefix/script
9053         $test -d $dflt || dflt=$sitebin ;;
9054 *)  dflt="$sitescript" ;;
9055 esac
9056 fn=d~+
9057 rp='Pathname where add-on public executable scripts should be installed?'
9058 . ./getfile
9059 prefixvar=sitescript
9060 . ./setprefixvar
9061
9062 : Check if faststdio is requested and available
9063 case "$usefaststdio" in
9064 $define|true|[yY]*|'')
9065         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9066         case "$xversion" in
9067         [68])   dflt='y' ;;
9068         *)      dflt='n' ;;
9069         esac
9070         ;;
9071 *) dflt='n';;
9072 esac
9073 cat <<EOM
9074
9075 Perl can be built to use 'fast stdio', which means using the stdio
9076 library but also directly manipulating the stdio buffers to enable
9077 faster I/O.  Using stdio is better for backward compatibility (especially
9078 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9079 interface has been preferred instead of stdio.
9080
9081 If this doesn't make any sense to you, just accept the default '$dflt'.
9082 EOM
9083 rp='Use the "fast stdio" if available?'
9084 . ./myread
9085 case "$ans" in
9086 y|Y)    val="$define" ;;
9087 *)      val="$undef" ;;
9088 esac
9089 set usefaststdio
9090 eval $setvar
9091
9092
9093 : define an is-a-typedef? function
9094 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9095 case "$inclist" in
9096 "") inclist="sys/types.h";;
9097 esac;
9098 eval "varval=\$$var";
9099 case "$varval" in
9100 "")
9101         $rm -f temp.c;
9102         for inc in $inclist; do
9103                 echo "#include <$inc>" >>temp.c;
9104         done;
9105         echo "#ifdef $type" >> temp.c;
9106         echo "printf(\"We have $type\");" >> temp.c;
9107         echo "#endif" >> temp.c;
9108         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9109         if $contains $type temp.E >/dev/null 2>&1; then
9110                 eval "$var=\$type";
9111         else
9112                 eval "$var=\$def";
9113         fi;
9114         $rm -f temp.?;;
9115 *) eval "$var=\$varval";;
9116 esac'
9117
9118 : define an is-a-typedef? function that prompts if the type is not available.
9119 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9120 case "$inclist" in
9121 "") inclist="sys/types.h";;
9122 esac;
9123 eval "varval=\$$var";
9124 case "$varval" in
9125 "")
9126         $rm -f temp.c;
9127         for inc in $inclist; do
9128                 echo "#include <$inc>" >>temp.c;
9129         done;
9130         echo "#ifdef $type" >> temp.c;
9131         echo "printf(\"We have $type\");" >> temp.c;
9132         echo "#endif" >> temp.c;
9133         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9134         echo " " ;
9135         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9136         if $contains $type temp.E >/dev/null 2>&1; then
9137                 echo "$type found." >&4;
9138                 eval "$var=\$type";
9139         else
9140                 echo "$type NOT found." >&4;
9141                 dflt="$def";
9142                 . ./myread ;
9143                 eval "$var=\$ans";
9144         fi;
9145         $rm -f temp.?;;
9146 *) eval "$var=\$varval";;
9147 esac'
9148
9149 : see what type lseek is declared as in the kernel
9150 rp="What is the type used for lseek's offset on this system?"
9151 set off_t lseektype long stdio.h sys/types.h
9152 eval $typedef_ask
9153
9154 echo " "
9155 echo "Checking to see how big your file offsets are..." >&4
9156 $cat >try.c <<EOCP
9157 #include <sys/types.h>
9158 #include <stdio.h>
9159 int main()
9160 {
9161     printf("%d\n", (int)sizeof($lseektype));
9162     return(0);
9163 }
9164 EOCP
9165 set try
9166 if eval $compile_ok; then
9167         lseeksize=`$run ./try`
9168         echo "Your file offsets are $lseeksize bytes long."
9169 else
9170         dflt=$longsize
9171         echo " "
9172         echo "(I can't seem to compile the test program.  Guessing...)"
9173         rp="What is the size of your file offsets (in bytes)?"
9174         . ./myread
9175         lseeksize="$ans"
9176 fi
9177 $rm_try
9178
9179 : see what type file positions are declared as in the library
9180 rp="What is the type for file position used by fsetpos()?"
9181 set fpos_t fpostype long stdio.h sys/types.h
9182 eval $typedef_ask
9183
9184 : Check size for Fpos_t
9185 echo " "
9186 case "$fpostype" in
9187 *_t) zzz="$fpostype"    ;;
9188 *)   zzz="fpos_t"       ;;
9189 esac
9190 echo "Checking the size of $zzz..." >&4
9191 cat > try.c <<EOCP
9192 #include <sys/types.h>
9193 #include <stdio.h>
9194 #$i_stdlib I_STDLIB
9195 #ifdef I_STDLIB
9196 #include <stdlib.h>
9197 #endif
9198 int main() {
9199     printf("%d\n", (int)sizeof($fpostype));
9200     exit(0);
9201 }
9202 EOCP
9203 set try
9204 if eval $compile_ok; then
9205         yyy=`$run ./try`
9206         case "$yyy" in
9207         '')     fpossize=4
9208                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9209                 ;;
9210         *)      fpossize=$yyy
9211                 echo "Your $zzz is $fpossize bytes long."
9212                 ;;
9213         esac
9214 else
9215         dflt="$longsize"
9216         echo " " >&4
9217         echo "(I can't compile the test program.  Guessing...)" >&4
9218         rp="What is the size of your file positions (in bytes)?"
9219         . ./myread
9220         fpossize="$ans"
9221 fi
9222
9223 : Check for large file support
9224 # Backward compatibility (uselfs is deprecated).
9225 case "$uselfs" in
9226 "$define"|true|[yY]*)
9227         cat <<EOM >&4
9228
9229 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9230 EOM
9231         uselargefiles="$define"
9232         ;;
9233 esac
9234
9235 case "$lseeksize:$fpossize" in
9236 8:8) cat <<EOM
9237
9238 You can have files larger than 2 gigabytes.
9239 EOM
9240    val="$define" ;;
9241 *)    case "$uselargefiles" in
9242    "$undef"|false|[nN]*) dflt='n' ;;
9243    *)   dflt='y' ;;
9244    esac
9245    cat <<EOM
9246
9247 Perl can be built to understand large files (files larger than 2 gigabytes)
9248 on some systems.  To do so, Configure can be run with -Duselargefiles.
9249
9250 If this doesn't make any sense to you, just accept the default '$dflt'.
9251 EOM
9252    rp='Try to understand large files, if available?'
9253    . ./myread
9254    case "$ans" in
9255    y|Y)         val="$define" ;;
9256    *)           val="$undef"  ;;
9257    esac
9258    ;;
9259 esac
9260 set uselargefiles
9261 eval $setvar
9262 : Look for a hint-file generated 'call-back-unit'.  If the
9263 : user has specified that a large files perl is to be built,
9264 : we may need to set or change some other defaults.
9265 if $test -f uselargefiles.cbu; then
9266         echo "Your platform has some specific hints regarding large file builds, using them..."
9267         . ./uselargefiles.cbu
9268 fi
9269 case "$uselargefiles" in
9270 "$define")
9271         if $test -f uselargefiles.cbu; then
9272                 echo " "
9273                 echo "Rechecking to see how big your file offsets are..." >&4
9274                 $cat >try.c <<EOCP
9275 #include <sys/types.h>
9276 #include <stdio.h>
9277 int main()
9278 {
9279     printf("%d\n", (int)sizeof($lseektype));
9280     return(0);
9281 }
9282 EOCP
9283                 set try
9284                 if eval $compile_ok; then
9285                         lseeksize=`$run ./try`
9286                         $echo "Your file offsets are now $lseeksize bytes long."
9287                 else
9288                         dflt="$lseeksize"
9289                         echo " "
9290                         echo "(I can't seem to compile the test program.  Guessing...)"
9291                         rp="What is the size of your file offsets (in bytes)?"
9292                         . ./myread
9293                         lseeksize="$ans"
9294                 fi
9295                 case "$fpostype" in
9296                 *_t) zzz="$fpostype"    ;;
9297                 *)   zzz="fpos_t"       ;;
9298                 esac
9299                 $echo $n "Rechecking the size of $zzz...$c" >&4
9300                 $cat > try.c <<EOCP
9301 #include <sys/types.h>
9302 #include <stdio.h>
9303 #$i_stdlib I_STDLIB
9304 #ifdef I_STDLIB
9305 #include <stdlib.h>
9306 #endif
9307 int main() {
9308     printf("%d\n", (int)sizeof($fpostype));
9309     return(0);
9310 }
9311 EOCP
9312                 set try
9313                 if eval $compile_ok; then
9314                         yyy=`$run ./try`
9315                         dflt="$lseeksize"
9316                         case "$yyy" in
9317                         '')     echo " "
9318                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9319                                 ;;
9320                         *)      fpossize=$yyy
9321                                 echo " $fpossize bytes." >&4
9322                                 ;;
9323                         esac
9324                 else
9325                         dflt="$fpossize"
9326                         echo " "
9327                         echo "(I can't compile the test program.  Guessing...)" >&4
9328                         rp="What is the size of your file positions (in bytes)?"
9329                         . ./myread
9330                         fpossize="$ans"
9331                 fi
9332                 $rm_try
9333         fi
9334         ;;
9335 esac
9336
9337 : Check if we want perlio
9338 useperlio="$define"
9339
9340 : Set the vendorbin variables
9341 case "$vendorprefix" in
9342 '')     d_vendorbin="$undef"
9343         vendorbin=''
9344         vendorbinexp=''
9345         ;;
9346 *)      d_vendorbin="$define"
9347         : determine where vendor-supplied executables go.
9348         case "$vendorbin" in
9349         '') dflt=$vendorprefix/bin ;;
9350         *)      dflt="$vendorbin" ;;
9351         esac
9352         fn=d~+
9353         rp='Pathname for the vendor-supplied executables directory?'
9354         . ./getfile
9355         vendorbin="$ans"
9356         vendorbinexp="$ansexp"
9357         ;;
9358 esac
9359 prefixvar=vendorbin
9360 . ./installprefix
9361
9362 : Set the vendorhtml1dir variables
9363 case "$vendorprefix" in
9364 '')     vendorhtml1dir=''
9365         vendorhtml1direxp=''
9366         ;;
9367 *)      : determine where vendor-supplied html pages go.
9368         : There is no standard location, so try to copy the previously-selected
9369         : directory structure for the core html pages.
9370         : XXX Better default suggestions would be welcome.
9371         case "$vendorhtml1dir" in
9372         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9373         *)      dflt=$vendorhtml1dir ;;
9374         esac
9375         case "$dflt" in
9376         ''|' ') dflt=none ;;
9377         esac
9378         fn=dn+~
9379         rp='Pathname for the vendor-supplied html pages?'
9380         . ./getfile
9381         vendorhtml1dir="$ans"
9382         vendorhtml1direxp="$ansexp"
9383         ;;
9384 esac
9385 : Use ' ' for none so value is preserved next time through Configure
9386 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9387 prefixvar=vendorhtml1dir
9388 . ./installprefix
9389
9390 : Set the vendorhtml3dir variables
9391 case "$vendorprefix" in
9392 '')     vendorhtml3dir=''
9393         vendorhtml3direxp=''
9394         ;;
9395 *)      : determine where vendor-supplied module html pages go.
9396         : There is no standard location, so try to copy the previously-selected
9397         : directory structure for the core html pages.
9398         : XXX Better default suggestions would be welcome.
9399         case "$vendorhtml3dir" in
9400         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9401         *)      dflt=$vendorhtml3dir ;;
9402         esac
9403         case "$dflt" in
9404         ''|' ') dflt=none ;;
9405         esac
9406         fn=dn+~
9407         rp='Pathname for the vendor-supplied html pages?'
9408         . ./getfile
9409         vendorhtml3dir="$ans"
9410         vendorhtml3direxp="$ansexp"
9411         ;;
9412 esac
9413 : Use ' ' for none so value is preserved next time through Configure
9414 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9415 prefixvar=vendorhtml3dir
9416 . ./installprefix
9417
9418 : Set the vendorman1dir variables
9419 case "$vendorprefix" in
9420 '')     vendorman1dir=''
9421         vendorman1direxp=''
9422         ;;
9423 *)      : determine where vendor-supplied manual pages go.
9424         case "$vendorman1dir" in
9425         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9426         *)      dflt=$vendorman1dir ;;
9427         esac
9428         case "$dflt" in
9429         ''|' ') dflt=none ;;
9430         esac
9431         fn=nd~+
9432         rp='Pathname for the vendor-supplied manual section 1 pages?'
9433         . ./getfile
9434         vendorman1dir="$ans"
9435         vendorman1direxp="$ansexp"
9436         ;;
9437 esac
9438 : Use ' ' for none so value is preserved next time through Configure
9439 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9440 prefixvar=vendorman1dir
9441 . ./installprefix
9442
9443 : Set the vendorman3dir variables
9444 case "$vendorprefix" in
9445 '')     vendorman3dir=''
9446         vendorman3direxp=''
9447         ;;
9448 *)      : determine where vendor-supplied module manual pages go.
9449         case "$vendorman3dir" in
9450         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9451         *)      dflt=$vendorman3dir ;;
9452         esac
9453         case "$dflt" in
9454         ''|' ') dflt=none ;;
9455         esac
9456         fn=nd~+
9457         rp='Pathname for the vendor-supplied manual section 3 pages?'
9458         . ./getfile
9459         vendorman3dir="$ans"
9460         vendorman3direxp="$ansexp"
9461         ;;
9462 esac
9463 : Use ' ' for none so value is preserved next time through Configure
9464 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9465 prefixvar=vendorman3dir
9466 . ./installprefix
9467
9468 : Set the vendorscript variables
9469 case "$vendorprefix" in
9470 '')     d_vendorscript="$undef"
9471         vendorscript=''
9472         vendorscriptexp=''
9473         ;;
9474 *)      d_vendorscript="$define"
9475         : determine where vendor-supplied scripts go.
9476         case "$vendorscript" in
9477         '')     dflt=$vendorprefix/script
9478                 $test -d $dflt || dflt=$vendorbin ;;
9479         *)  dflt="$vendorscript" ;;
9480         esac
9481         $cat <<EOM
9482
9483 The installation process will create a directory for
9484 vendor-supplied scripts.
9485
9486 EOM
9487         fn=d~+
9488         rp='Pathname for the vendor-supplied scripts directory?'
9489         . ./getfile
9490         vendorscript="$ans"
9491         vendorscriptexp="$ansexp"
9492         ;;
9493 esac
9494 prefixvar=vendorscript
9495 . ./installprefix
9496
9497 : script used to emit important warnings
9498 cat >warn <<EOS
9499 $startsh
9500 if test \$# -gt 0; then
9501         echo "\$@" >msg
9502 else
9503         cat >msg
9504 fi
9505 echo "*** WARNING:" >&4
9506 sed -e 's/^/*** /' <msg >&4
9507 echo "*** " >&4
9508 cat msg >>config.msg
9509 echo " " >>config.msg
9510 rm -f msg
9511 EOS
9512 chmod +x warn
9513 $eunicefix warn
9514
9515 : see which of string.h or strings.h is needed
9516 echo " "
9517 strings=`./findhdr string.h`
9518 if $test "$strings" && $test -r "$strings"; then
9519         echo "Using <string.h> instead of <strings.h>." >&4
9520         val="$define"
9521 else
9522         val="$undef"
9523         strings=`./findhdr strings.h`
9524         if $test "$strings" && $test -r "$strings"; then
9525                 echo "Using <strings.h> instead of <string.h>." >&4
9526         else
9527                 ./warn "No string header found -- You'll surely have problems."
9528         fi
9529 fi
9530 set i_string
9531 eval $setvar
9532 case "$i_string" in
9533 "$undef") strings=`./findhdr strings.h`;;
9534 *)        strings=`./findhdr string.h`;;
9535 esac
9536
9537 : see if qgcvt exists
9538 set qgcvt d_qgcvt
9539 eval $inlibc
9540
9541 : Check print/scan long double stuff
9542 echo " "
9543
9544 if $test X"$d_longdbl" = X"$define"; then
9545
9546 echo "Checking how to print long doubles..." >&4
9547
9548 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9549         $cat >try.c <<'EOCP'
9550 #include <sys/types.h>
9551 #include <stdio.h>
9552 int main() {
9553   double d = 123.456;
9554   printf("%.3f\n", d);
9555 }
9556 EOCP
9557         set try
9558         if eval $compile; then
9559                 yyy=`$run ./try`
9560                 case "$yyy" in
9561                 123.456)
9562                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9563                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9564                         echo "We will use %f."
9565                         ;;
9566                 esac
9567         fi
9568 fi
9569
9570 if $test X"$sPRIfldbl" = X; then
9571         $cat >try.c <<'EOCP'
9572 #include <sys/types.h>
9573 #include <stdio.h>
9574 int main() {
9575   long double d = 123.456;
9576   printf("%.3Lf\n", d);
9577 }
9578 EOCP
9579         set try
9580         if eval $compile; then
9581                 yyy=`$run ./try`
9582                 case "$yyy" in
9583                 123.456)
9584                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9585                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9586                         echo "We will use %Lf."
9587                         ;;
9588                 esac
9589         fi
9590 fi
9591
9592 if $test X"$sPRIfldbl" = X; then
9593         $cat >try.c <<'EOCP'
9594 #include <sys/types.h>
9595 #include <stdio.h>
9596 int main() {
9597   long double d = 123.456;
9598   printf("%.3llf\n", d);
9599 }
9600 EOCP
9601         set try
9602         if eval $compile; then
9603                 yyy=`$run ./try`
9604                 case "$yyy" in
9605                 123.456)
9606                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9607                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9608                         echo "We will use %llf."
9609                         ;;
9610                 esac
9611         fi
9612 fi
9613
9614 if $test X"$sPRIfldbl" = X; then
9615         $cat >try.c <<'EOCP'
9616 #include <sys/types.h>
9617 #include <stdio.h>
9618 int main() {
9619   long double d = 123.456;
9620   printf("%.3lf\n", d);
9621 }
9622 EOCP
9623         set try
9624         if eval $compile; then
9625                 yyy=`$run ./try`
9626                 case "$yyy" in
9627                 123.456)
9628                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9629                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9630                         echo "We will use %lf."
9631                         ;;
9632                 esac
9633         fi
9634 fi
9635
9636 if $test X"$sPRIfldbl" = X; then
9637         echo "Cannot figure out how to print long doubles." >&4
9638 else
9639         sSCNfldbl=$sPRIfldbl    # expect consistency
9640 fi
9641
9642 $rm_try
9643
9644 fi # d_longdbl
9645
9646 case "$sPRIfldbl" in
9647 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9648         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9649         d_SCNfldbl="$undef";
9650         ;;
9651 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9652         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9653         d_SCNfldbl="$define";
9654         ;;
9655 esac
9656
9657 : Check how to convert floats to strings.
9658
9659 if test "X$d_Gconvert" = X; then
9660
9661 echo " "
9662 echo "Checking for an efficient way to convert floats to strings."
9663 echo " " > try.c
9664 case "$uselongdouble" in
9665 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9666 esac
9667 case "$d_longdbl" in
9668 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9669 esac
9670 case "$d_PRIgldbl" in
9671 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9672 esac
9673 $cat >>try.c <<EOP
9674 #ifdef TRY_gconvert
9675 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9676 char *myname = "gconvert";
9677 #endif
9678 #ifdef TRY_gcvt
9679 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9680 char *myname = "gcvt";
9681 #endif
9682 #ifdef TRY_qgcvt
9683 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9684 char *myname = "qgcvt";
9685 #define DOUBLETYPE long double
9686 #endif
9687 #ifdef TRY_sprintf
9688 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9689 #ifdef HAS_PRIgldbl
9690 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9691 #else
9692 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9693 #endif
9694 #else
9695 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9696 #endif
9697 char *myname = "sprintf";
9698 #endif
9699
9700 #ifndef DOUBLETYPE
9701 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9702 #define DOUBLETYPE long double
9703 #else
9704 #define DOUBLETYPE double
9705 #endif
9706 #endif
9707
9708 #include <stdio.h>
9709
9710 #$i_stdlib I_STDLIB
9711 #ifdef I_STDLIB
9712 #include <stdlib.h>
9713 #endif
9714 #$i_string I_STRING
9715 #ifdef I_STRING
9716 #  include <string.h>
9717 #else
9718 #  include <strings.h>
9719 #endif
9720
9721 int checkit(char *expect, char *got)
9722 {
9723     if (strcmp(expect, got)) {
9724                 printf("%s oddity:  Expected %s, got %s\n",
9725                         myname, expect, got);
9726                 exit(1);
9727         }
9728 }
9729
9730 int main()
9731 {
9732         char buf[64];
9733         buf[63] = '\0';
9734
9735         /* This must be 1st test on (which?) platform */
9736         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9737         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9738         checkit("0.1", buf);
9739
9740         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9741         checkit("0.01", buf);
9742
9743         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9744         checkit("0.001", buf);
9745
9746         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9747         checkit("0.0001", buf);
9748
9749         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9750         if (strlen(buf) > 5)
9751             checkit("9e-005", buf); /* for Microsoft ?? */
9752         else
9753             checkit("9e-05", buf);
9754
9755         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9756         checkit("1", buf);
9757
9758         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9759         checkit("1.1", buf);
9760
9761         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9762         checkit("1.01", buf);
9763
9764         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9765         checkit("1.001", buf);
9766
9767         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9768         checkit("1.0001", buf);
9769
9770         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9771         checkit("1.00001", buf);
9772
9773         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9774         checkit("1.000001", buf);
9775
9776         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9777         checkit("0", buf);
9778
9779         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9780         checkit("-1", buf);
9781
9782         /* Some Linux gcvt's give 1.e+5 here. */
9783         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9784         checkit("100000", buf);
9785
9786         /* Some Linux gcvt's give -1.e+5 here. */
9787         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9788         checkit("-100000", buf);
9789
9790         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9791         checkit("123.456", buf);
9792
9793         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9794         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9795         /* 34 should be enough to scare even long double
9796          * places into using the e notation. */
9797         if (strlen(buf) > 5)
9798             checkit("1e+034", buf); /* for Microsoft */
9799         else
9800             checkit("1e+34", buf);
9801
9802         /* For Perl, if you add additional tests here, also add them to
9803          * t/base/num.t for benefit of platforms not using Configure or
9804          * overriding d_Gconvert */
9805
9806         exit(0);
9807 }
9808 EOP
9809 : first add preferred functions to our list
9810 xxx_list=""
9811 for xxx_convert in $gconvert_preference; do
9812     case $xxx_convert in
9813     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9814     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9815     esac
9816 done
9817 : then add any others
9818 for xxx_convert in gconvert gcvt sprintf; do
9819     case "$xxx_list" in
9820     *$xxx_convert*) ;;
9821     *) xxx_list="$xxx_list $xxx_convert" ;;
9822     esac
9823 done
9824
9825 case "$d_longdbl$uselongdouble" in
9826 "$define$define")
9827     : again, add preferred functions to our list first
9828     xxx_ld_list=""
9829     for xxx_convert in $gconvert_ld_preference; do
9830         case $xxx_convert in
9831         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9832         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9833         esac
9834     done
9835     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9836     for xxx_convert in qgcvt sprintf $xxx_list; do
9837         case "$xxx_ld_list" in
9838         $xxx_convert*|*" $xxx_convert"*) ;;
9839         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9840         esac
9841     done
9842     : if sprintf cannot do long doubles, move it to the end
9843     if test "$d_PRIgldbl" != "$define"; then
9844         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9845     fi
9846     : if no qgcvt, remove it
9847     if test "$d_qgcvt" != "$define"; then
9848         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9849     fi
9850     : use the ld_list
9851     xxx_list="$xxx_ld_list"
9852     ;;
9853 esac
9854
9855 for xxx_convert in $xxx_list; do
9856         echo "Trying $xxx_convert..."
9857         $rm -f try try$_o core
9858         set try -DTRY_$xxx_convert
9859         if eval $compile; then
9860                 echo "$xxx_convert() found." >&4
9861                 if $run ./try; then
9862                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9863                         break;
9864                 else
9865                         echo "...But $xxx_convert didn't work as I expected."
9866                         xxx_convert=''
9867                 fi
9868         else
9869                 echo "$xxx_convert NOT found." >&4
9870         fi
9871 done
9872
9873 if test X$xxx_convert = X; then
9874     echo "*** WHOA THERE!!! ***" >&4
9875     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9876     xxx_convert=sprintf
9877 fi
9878
9879 case "$xxx_convert" in
9880 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9881 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9882 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9883 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9884    "$define$define$define")
9885       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9886    "$define$define$undef")
9887       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9888    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9889    esac
9890    ;;
9891 esac
9892
9893 fi
9894 $rm_try
9895
9896 : see if _fwalk exists
9897 set fwalk d__fwalk
9898 eval $inlibc
9899
9900 : Initialize h_fcntl
9901 h_fcntl=false
9902
9903 : Initialize h_sysfile
9904 h_sysfile=false
9905
9906 : access call always available on UNIX
9907 set access d_access
9908 eval $inlibc
9909
9910 : locate the flags for 'access()'
9911 case "$d_access" in
9912 "$define")
9913         echo " "
9914         $cat >access.c <<EOCP
9915 #include <sys/types.h>
9916 #ifdef I_FCNTL
9917 #include <fcntl.h>
9918 #endif
9919 #ifdef I_SYS_FILE
9920 #include <sys/file.h>
9921 #endif
9922 #ifdef I_UNISTD
9923 #include <unistd.h>
9924 #endif
9925 #$i_stdlib I_STDLIB
9926 #ifdef I_STDLIB
9927 #include <stdlib.h>
9928 #endif
9929 int main() {
9930         exit(R_OK);
9931 }
9932 EOCP
9933         : check sys/file.h first, no particular reason here
9934         if $test `./findhdr sys/file.h` && \
9935                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9936                 h_sysfile=true;
9937                 echo "<sys/file.h> defines the *_OK access constants." >&4
9938         elif $test `./findhdr fcntl.h` && \
9939                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9940                 h_fcntl=true;
9941                 echo "<fcntl.h> defines the *_OK access constants." >&4
9942         elif $test `./findhdr unistd.h` && \
9943                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9944                 echo "<unistd.h> defines the *_OK access constants." >&4
9945         else
9946                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9947         fi
9948         ;;
9949 esac
9950 $rm -f access*
9951
9952 : see if accessx exists
9953 set accessx d_accessx
9954 eval $inlibc
9955
9956 : see if aintl exists
9957 set aintl d_aintl
9958 eval $inlibc
9959
9960 : see if alarm exists
9961 set alarm d_alarm
9962 eval $inlibc
9963
9964 : see if 64bit time functions exists
9965
9966 set ctime64 d_ctime64
9967 eval $inlibc
9968
9969 set localtime64 d_localtime64
9970 eval $inlibc
9971
9972 set gmtime64 d_gmtime64
9973 eval $inlibc
9974
9975 set mktime64 d_mktime64
9976 eval $inlibc
9977
9978 set difftime64 d_difftime64
9979 eval $inlibc
9980
9981 set asctime64 d_asctime64
9982 eval $inlibc
9983
9984 : see if POSIX threads are available
9985 set pthread.h i_pthread
9986 eval $inhdr
9987
9988 : define a function to check prototypes
9989 $cat > protochk <<EOSH
9990 $startsh
9991 cc="$cc"
9992 optimize="$optimize"
9993 ccflags="$ccflags"
9994 prototype="$prototype"
9995 define="$define"
9996 rm_try="$rm_try"
9997 usethreads=$usethreads
9998 i_pthread=$i_pthread
9999 pthread_h_first=$pthread_h_first
10000 EOSH
10001
10002 $cat >> protochk <<'EOSH'
10003
10004 $rm_try
10005 foo="$1"
10006 shift
10007 while test $# -ge 2; do
10008         case "$1" in
10009                 $define) echo "#include <$2>" >> try.c ;;
10010                 literal) echo "$2" >> try.c ;;
10011         esac
10012     # Extra magic for the benefit of systems that need pthread.h
10013     # to be included early to correctly detect threadsafe functions.
10014     # Such functions must guarantee themselves, though, that the usethreads
10015     # and i_pthread have been defined, before calling protochk.
10016     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10017         echo "#include <pthread.h>" >> try.c
10018         pthread_h_done=yes
10019     fi
10020     shift 2
10021 done
10022 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10023 cat >> try.c <<'EOCP'
10024 #ifdef CAN_PROTOTYPE
10025 #define _(args) args
10026 #else
10027 #define _(args) ()
10028 #endif
10029 EOCP
10030 echo "$foo" >> try.c
10031 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10032 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10033 status=$?
10034 $rm_try
10035 exit $status
10036 EOSH
10037 chmod +x protochk
10038 $eunicefix protochk
10039
10040 : Define hasproto macro for Configure internal use
10041 hasproto='varname=$1; func=$2; shift; shift;
10042 while $test $# -ge 2; do
10043         case "$1" in
10044         $define) echo "#include <$2>";;
10045         esac ;
10046     shift 2;
10047 done > try.c;
10048 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10049 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10050         echo "$func() prototype found.";
10051         val="$define";
10052 else
10053         echo "$func() prototype NOT found.";
10054         val="$undef";
10055 fi;
10056 set $varname;
10057 eval $setvar;
10058 $rm_try tryout.c'
10059
10060 : see if sys/types.h has to be included
10061 set sys/types.h i_systypes
10062 eval $inhdr
10063
10064 : see if sys/select.h has to be included
10065 set sys/select.h i_sysselct
10066 eval $inhdr
10067
10068 : Define hasfield macro for Configure internal use
10069 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10070 while $test $# -ge 2; do
10071         case "$1" in
10072         $define) echo "#include <$2>";;
10073         esac ;
10074     shift 2;
10075 done > try.c;
10076 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10077 set try;
10078 if eval $compile; then
10079         val="$define";
10080 else
10081         val="$undef";
10082 fi;
10083 set $varname;
10084 eval $setvar;
10085 $rm_try'
10086
10087 : see if we should include time.h, sys/time.h, or both
10088 echo " "
10089 if test "X$timeincl" = X; then
10090         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10091         $echo $n "I'm now running the test program...$c"
10092         $cat >try.c <<EOCP
10093 #include <sys/types.h>
10094 #ifdef I_TIME
10095 #include <time.h>
10096 #endif
10097 #ifdef I_SYSTIME
10098 #ifdef SYSTIMEKERNEL
10099 #define KERNEL
10100 #endif
10101 #include <sys/time.h>
10102 #endif
10103 #ifdef I_SYSSELECT
10104 #include <sys/select.h>
10105 #endif
10106 #$i_stdlib I_STDLIB
10107 #ifdef I_STDLIB
10108 #include <stdlib.h>
10109 #endif
10110 int main()
10111 {
10112         struct tm foo;
10113 #ifdef S_TIMEVAL
10114         struct timeval bar;
10115 #endif
10116 #ifdef S_TIMEZONE
10117         struct timezone tzp;
10118 #endif
10119         if (foo.tm_sec == foo.tm_sec)
10120                 exit(0);
10121 #ifdef S_TIMEVAL
10122         if (bar.tv_sec == bar.tv_sec)
10123                 exit(0);
10124 #endif
10125         exit(1);
10126 }
10127 EOCP
10128         flags=''
10129         for s_timezone in '-DS_TIMEZONE' ''; do
10130         sysselect=''
10131         for s_timeval in '-DS_TIMEVAL' ''; do
10132         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10133         for i_time in '' '-DI_TIME'; do
10134         for i_systime in '-DI_SYSTIME' ''; do
10135                 case "$flags" in
10136                 '') $echo $n ".$c"
10137                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10138                         if eval $compile; then
10139                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10140                                 shift
10141                                 flags="$*"
10142                                 echo " "
10143                                 $echo $n "Succeeded with $flags$c"
10144                         fi
10145                         ;;
10146                 esac
10147         done
10148         done
10149         done
10150         done
10151         done
10152         timeincl=''
10153         echo " "
10154         case "$flags" in
10155         *SYSTIMEKERNEL*) i_systimek="$define"
10156                 timeincl=`./findhdr sys/time.h`
10157                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10158         *) i_systimek="$undef";;
10159         esac
10160         case "$flags" in
10161         *I_TIME*) i_time="$define"
10162                 timeincl=`./findhdr time.h`" $timeincl"
10163                 echo "We'll include <time.h>." >&4;;
10164         *) i_time="$undef";;
10165         esac
10166         case "$flags" in
10167         *I_SYSTIME*) i_systime="$define"
10168                 timeincl=`./findhdr sys/time.h`" $timeincl"
10169                 echo "We'll include <sys/time.h>." >&4;;
10170         *) i_systime="$undef";;
10171         esac
10172         $rm_try
10173 fi
10174 : see if struct tm knows about tm_zone
10175 case "$i_systime$i_time" in
10176 *$define*)
10177         echo " "
10178         echo "Checking to see if your struct tm has tm_zone field..." >&4
10179         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10180         eval $hasfield
10181         ;;
10182 *)      val="$undef"
10183         set d_tm_tm_zone
10184         eval $setvar
10185         ;;
10186 esac
10187 case "$d_tm_tm_zone" in
10188 "$define")      echo "Yes, it does."   ;;
10189 *)              echo "No, it doesn't." ;;
10190 esac
10191 : see if struct tm knows about tm_gmtoff
10192 case "$i_systime$i_time" in
10193 *$define*)
10194         echo " "
10195         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10196         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10197         eval $hasfield
10198         ;;
10199 *)      val="$undef"
10200         set d_tm_tm_gmtoff
10201         eval $setvar
10202         ;;
10203 esac
10204 case "$d_tm_tm_gmtoff" in
10205 "$define")      echo "Yes, it does."   ;;
10206 *)              echo "No, it doesn't." ;;
10207 esac
10208
10209 : see if asctime_r exists
10210 set asctime_r d_asctime_r
10211 eval $inlibc
10212 case "$d_asctime_r" in
10213 "$define")
10214         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10215         case "$d_asctime_r_proto:$usethreads" in
10216         ":define")      d_asctime_r_proto=define
10217                 set d_asctime_r_proto asctime_r $hdrs
10218                 eval $hasproto ;;
10219         *)      ;;
10220         esac
10221         case "$d_asctime_r_proto" in
10222         define)
10223         case "$asctime_r_proto" in
10224         ''|0) try='char* asctime_r(const struct tm*, char*);'
10225         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10226         esac
10227         case "$asctime_r_proto" in
10228         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10229         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10230         esac
10231         case "$asctime_r_proto" in
10232         ''|0) try='int asctime_r(const struct tm*, char*);'
10233         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10234         esac
10235         case "$asctime_r_proto" in
10236         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10237         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10238         esac
10239         case "$asctime_r_proto" in
10240         ''|0)   d_asctime_r=undef
10241                 asctime_r_proto=0
10242                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10243         * )     case "$asctime_r_proto" in
10244                 REENTRANT_PROTO*) ;;
10245                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10246                 esac
10247                 echo "Prototype: $try" ;;
10248         esac
10249         ;;
10250         *)      case "$usethreads" in
10251                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10252                 esac
10253                 d_asctime_r=undef
10254                 asctime_r_proto=0
10255                 ;;
10256         esac
10257         ;;
10258 *)      asctime_r_proto=0
10259         ;;
10260 esac
10261
10262 : see if atolf exists
10263 set atolf d_atolf
10264 eval $inlibc
10265
10266 : see if atoll exists
10267 set atoll d_atoll
10268 eval $inlibc
10269
10270 : Look for GCC-style attribute format
10271 case "$d_attribute_format" in
10272 '')
10273 echo " "
10274 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10275 $cat >attrib.c <<'EOCP'
10276 #include <stdio.h>
10277 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10278 EOCP
10279 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10280         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10281                 echo "Your C compiler doesn't support __attribute__((format))."
10282                 val="$undef"
10283         else
10284                 echo "Your C compiler supports __attribute__((format))."
10285                 val="$define"
10286         fi
10287 else
10288         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10289         val="$undef"
10290 fi
10291 ;;
10292 *) val="$d_attribute_format" ;;
10293 esac
10294 set d_attribute_format
10295 eval $setvar
10296 $rm -f attrib*
10297
10298 : Look for GCC-style attribute format with null format allowed
10299 case "$d_printf_format_null" in
10300 '') case "$d_attribute_format" in
10301     $define)
10302         echo " "
10303         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10304 $cat >attrib.c <<EOCP
10305 #include <stdio.h>
10306 #$i_stdlib I_STDLIB
10307 #ifdef I_STDLIB
10308 #include <stdlib.h>
10309 #endif
10310 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10311 int null_printf (char* pat,...) { return (int)pat; }
10312 int main () { exit(null_printf(NULL)); }
10313 EOCP
10314         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10315             : run the executable in case it produces a run-time warning
10316             if $run ./attrib >>attrib.out 2>&1; then
10317                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10318                     echo "Your C compiler doesn't allow __printf__ format to be null."
10319                     val="$undef"
10320                 else
10321                     echo "Your C compiler allows __printf__ format to be null."
10322                     val="$define"
10323                 fi
10324             else
10325             echo "Your C compiler executable failed with __printf__ format null."
10326             val="$undef"
10327         fi
10328     else
10329         echo "Your C compiler fails with __printf__ format null."
10330         val="$undef"
10331     fi
10332     ;;
10333     *)  val="$undef" ;;
10334     esac
10335 ;;
10336 *)  val="$d_printf_format_null" ;;
10337 esac
10338 set d_printf_format_null
10339 eval $setvar
10340 $rm -f attrib*
10341
10342 : Look for GCC-style attribute malloc
10343 case "$d_attribute_malloc" in
10344 '')
10345 echo " "
10346 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10347 $cat >attrib.c <<'EOCP'
10348 #include <stdio.h>
10349 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10350 EOCP
10351 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10352         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10353                 echo "Your C compiler doesn't support __attribute__((malloc))."
10354                 val="$undef"
10355         else
10356                 echo "Your C compiler supports __attribute__((malloc))."
10357                 val="$define"
10358         fi
10359 else
10360         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10361         val="$undef"
10362 fi
10363 ;;
10364 *) val="$d_attribute_malloc" ;;
10365 esac
10366 set d_attribute_malloc
10367 eval $setvar
10368 $rm -f attrib*
10369
10370 : Look for GCC-style attribute nonnull
10371 case "$d_attribute_nonnull" in
10372 '')
10373 echo " "
10374 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10375 $cat >attrib.c <<'EOCP'
10376 #include <stdio.h>
10377 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10378 EOCP
10379 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10380         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10381                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10382                 val="$undef"
10383         else
10384                 echo "Your C compiler supports __attribute__((nonnull))."
10385                 val="$define"
10386         fi
10387 else
10388         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10389         val="$undef"
10390 fi
10391 ;;
10392 *) val="$d_attribute_nonnull" ;;
10393 esac
10394 set d_attribute_nonnull
10395 eval $setvar
10396 $rm -f attrib*
10397
10398 : Look for GCC-style attribute noreturn
10399 case "$d_attribute_noreturn" in
10400 '')
10401 echo " "
10402 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10403 $cat >attrib.c <<'EOCP'
10404 #include <stdio.h>
10405 void fall_over_dead( void ) __attribute__((noreturn));
10406 EOCP
10407 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10408         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10409                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10410                 val="$undef"
10411         else
10412                 echo "Your C compiler supports __attribute__((noreturn))."
10413                 val="$define"
10414         fi
10415 else
10416         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10417         val="$undef"
10418 fi
10419 ;;
10420 *) val="$d_attribute_noreturn" ;;
10421 esac
10422 set d_attribute_noreturn
10423 eval $setvar
10424 $rm -f attrib*
10425
10426 : Look for GCC-style attribute pure
10427 case "$d_attribute_pure" in
10428 '')
10429 echo " "
10430 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10431 $cat >attrib.c <<'EOCP'
10432 #include <stdio.h>
10433 int square( int n ) __attribute__((pure));
10434 EOCP
10435 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10436         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10437                 echo "Your C compiler doesn't support __attribute__((pure))."
10438                 val="$undef"
10439         else
10440                 echo "Your C compiler supports __attribute__((pure))."
10441                 val="$define"
10442         fi
10443 else
10444         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10445         val="$undef"
10446 fi
10447 ;;
10448 *) val="$d_attribute_pure" ;;
10449 esac
10450 set d_attribute_pure
10451 eval $setvar
10452 $rm -f attrib*
10453
10454 : Look for GCC-style attribute unused
10455 case "$d_attribute_unused" in
10456 '')
10457 echo " "
10458 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10459 $cat >attrib.c <<'EOCP'
10460 #include <stdio.h>
10461 int do_something( int dummy __attribute__((unused)), int n );
10462 EOCP
10463 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10464         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10465                 echo "Your C compiler doesn't support __attribute__((unused))."
10466                 val="$undef"
10467         else
10468                 echo "Your C compiler supports __attribute__((unused))."
10469                 val="$define"
10470         fi
10471 else
10472         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10473         val="$undef"
10474 fi
10475 ;;
10476 *) val="$d_attribute_unused" ;;
10477 esac
10478 set d_attribute_unused
10479 eval $setvar
10480 $rm -f attrib*
10481
10482 : Look for GCC-style attribute deprecated
10483 case "$d_attribute_deprecated" in
10484 '')
10485 echo " "
10486 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10487 $cat >attrib.c <<'EOCP'
10488 #include <stdio.h>
10489 int I_am_deprecated(void) __attribute__((deprecated));
10490 EOCP
10491 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10492         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10493                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10494                 val="$undef"
10495         else
10496                 echo "Your C compiler supports __attribute__((deprecated))."
10497                 val="$define"
10498         fi
10499 else
10500         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10501         val="$undef"
10502 fi
10503 ;;
10504 *) val="$d_attribute_deprecated" ;;
10505 esac
10506 set d_attribute_deprecated
10507 eval $setvar
10508 $rm -f attrib*
10509
10510 : Look for GCC-style attribute warn_unused_result
10511 case "$d_attribute_warn_unused_result" in
10512 '')
10513 echo " "
10514 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10515 $cat >attrib.c <<'EOCP'
10516 #include <stdio.h>
10517 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10518 EOCP
10519 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10520         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10521                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10522                 val="$undef"
10523         else
10524                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10525                 val="$define"
10526         fi
10527 else
10528         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10529         val="$undef"
10530 fi
10531 ;;
10532 *) val="$d_attribute_warn_unused_result" ;;
10533 esac
10534 set d_attribute_warn_unused_result
10535 eval $setvar
10536 $rm -f attrib*
10537
10538 : see if bcmp exists
10539 set bcmp d_bcmp
10540 eval $inlibc
10541
10542 : see if bcopy exists
10543 set bcopy d_bcopy
10544 eval $inlibc
10545
10546 : see if getpgrp exists
10547 set getpgrp d_getpgrp
10548 eval $inlibc
10549
10550 case "$d_getpgrp" in
10551 "$define")
10552         echo " "
10553         echo "Checking to see which flavor of getpgrp is in use..."
10554         $cat >try.c <<EOP
10555 #$i_unistd I_UNISTD
10556 #include <sys/types.h>
10557 #ifdef I_UNISTD
10558 #  include <unistd.h>
10559 #endif
10560 #$i_stdlib I_STDLIB
10561 #ifdef I_STDLIB
10562 #include <stdlib.h>
10563 #endif
10564 int main()
10565 {
10566         if (getuid() == 0) {
10567                 printf("(I see you are running Configure as super-user...)\n");
10568                 setuid(1);
10569         }
10570 #ifdef TRY_BSD_PGRP
10571         if (getpgrp(1) == 0)
10572                 exit(0);
10573 #else
10574         if (getpgrp() > 0)
10575                 exit(0);
10576 #endif
10577         exit(1);
10578 }
10579 EOP
10580         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10581                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10582                 val="$define"
10583         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10584                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10585                 val="$undef"
10586         else
10587                 echo "I can't seem to compile and run the test program."
10588                 if ./usg; then
10589                         xxx="a USG one, i.e. you use getpgrp()."
10590                 else
10591                         # SVR4 systems can appear rather BSD-ish.
10592                         case "$i_unistd" in
10593                         $undef)
10594                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10595                                 val="$define"
10596                                 ;;
10597                         $define)
10598                                 xxx="probably a USG one, i.e. you use getpgrp()."
10599                                 val="$undef"
10600                                 ;;
10601                         esac
10602                 fi
10603                 echo "Assuming your getpgrp is $xxx" >&4
10604         fi
10605         ;;
10606 *) val="$undef";;
10607 esac
10608 set d_bsdgetpgrp
10609 eval $setvar
10610 $rm_try
10611
10612 : see if setpgrp exists
10613 set setpgrp d_setpgrp
10614 eval $inlibc
10615
10616 case "$d_setpgrp" in
10617 "$define")
10618         echo " "
10619         echo "Checking to see which flavor of setpgrp is in use..."
10620         $cat >try.c <<EOP
10621 #$i_unistd I_UNISTD
10622 #include <sys/types.h>
10623 #ifdef I_UNISTD
10624 #  include <unistd.h>
10625 #endif
10626 #$i_stdlib I_STDLIB
10627 #ifdef I_STDLIB
10628 #include <stdlib.h>
10629 #endif
10630 int main()
10631 {
10632         if (getuid() == 0) {
10633                 printf("(I see you are running Configure as super-user...)\n");
10634                 setuid(1);
10635         }
10636 #ifdef TRY_BSD_PGRP
10637         if (-1 == setpgrp(1, 1))
10638                 exit(0);
10639 #else
10640         if (setpgrp() != -1)
10641                 exit(0);
10642 #endif
10643         exit(1);
10644 }
10645 EOP
10646         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10647                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10648                 val="$define"
10649         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10650                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10651                 val="$undef"
10652         else
10653                 echo "(I can't seem to compile and run the test program.)"
10654                 if ./usg; then
10655                         xxx="a USG one, i.e. you use setpgrp()."
10656                 else
10657                         # SVR4 systems can appear rather BSD-ish.
10658                         case "$i_unistd" in
10659                         $undef)
10660                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10661                                 val="$define"
10662                                 ;;
10663                         $define)
10664                                 xxx="probably a USG one, i.e. you use setpgrp()."
10665                                 val="$undef"
10666                                 ;;
10667                         esac
10668                 fi
10669                 echo "Assuming your setpgrp is $xxx" >&4
10670         fi
10671         ;;
10672 *) val="$undef";;
10673 esac
10674 set d_bsdsetpgrp
10675 eval $setvar
10676 $rm_try
10677
10678 : Look for GCC-style __builtin_choose_expr
10679 case "$d_builtin_choose_expr" in
10680 '')
10681     echo " "
10682     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10683     $cat >try.c <<'EOCP'
10684 #include <assert.h>
10685 #include <stdlib.h>
10686 #include <stdio.h>
10687
10688 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10689
10690 int main(void) {
10691     assert( SYRINX(1) == 2112 );
10692     assert( SYRINX(1) != 5150 );
10693     assert( SYRINX(0) == 5150 );
10694     assert( SYRINX(0) != 2112 );
10695     puts( "All good!" );
10696     exit(0);
10697 }
10698
10699 EOCP
10700     set try
10701     if eval $compile && $run ./try; then
10702         echo "Your C compiler supports __builtin_choose_expr."
10703         val="$define"
10704     else
10705         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10706         val="$undef"
10707     fi
10708 ;;
10709 *) val="$d_builtin_choose_expr" ;;
10710 esac
10711
10712 set d_builtin_choose_expr
10713 eval $setvar
10714 $rm_try
10715
10716 : Look for GCC-style __builtin_expect
10717 case "$d_builtin_expect" in
10718 '')
10719     echo " "
10720     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10721     $cat >try.c <<'EOCP'
10722 int main(void) {
10723     int n = 50;
10724     if ( __builtin_expect(n, 0) ) n = 1;
10725     /* Remember shell exit code truth is 0, C truth is non-zero */
10726     return !(n == 1);
10727 }
10728 EOCP
10729     set try
10730     if eval $compile && $run ./try; then
10731         echo "Your C compiler supports __builtin_expect."
10732         val="$define"
10733     else
10734         echo "Your C compiler doesn't seem to understand __builtin_expect."
10735         val="$undef"
10736     fi
10737     ;;
10738 *) val="$d_builtin_expect" ;;
10739 esac
10740
10741 set d_builtin_expect
10742 eval $setvar
10743 $rm_try
10744
10745 : see if bzero exists
10746 set bzero d_bzero
10747 eval $inlibc
10748
10749 : see if stdarg is available
10750 echo " "
10751 if $test `./findhdr stdarg.h`; then
10752         echo "<stdarg.h> found." >&4
10753         valstd="$define"
10754 else
10755         echo "<stdarg.h> NOT found." >&4
10756         valstd="$undef"
10757 fi
10758
10759 : see if varags is available
10760 echo " "
10761 if $test `./findhdr varargs.h`; then
10762         echo "<varargs.h> found." >&4
10763 else
10764         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10765 fi
10766
10767 : set up the varargs testing programs
10768 $cat > varargs.c <<EOP
10769 #ifdef I_STDARG
10770 #include <stdarg.h>
10771 #endif
10772 #ifdef I_VARARGS
10773 #include <varargs.h>
10774 #endif
10775
10776 #ifdef I_STDARG
10777 int f(char *p, ...)
10778 #else
10779 int f(va_alist)
10780 va_dcl
10781 #endif
10782 {
10783         va_list ap;
10784 #ifndef I_STDARG
10785         char *p;
10786 #endif
10787 #ifdef I_STDARG
10788         va_start(ap,p);
10789 #else
10790         va_start(ap);
10791         p = va_arg(ap, char *);
10792 #endif
10793         va_end(ap);
10794         return 0;
10795 }
10796 EOP
10797 $cat > varargs <<EOP
10798 $startsh
10799 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10800         echo "true"
10801 else
10802         echo "false"
10803 fi
10804 $rm -f varargs$_o
10805 EOP
10806 chmod +x varargs
10807
10808 : now check which varargs header should be included
10809 echo " "
10810 i_varhdr=''
10811 case "$valstd" in
10812 "$define")
10813         if `./varargs I_STDARG`; then
10814                 val='stdarg.h'
10815         elif `./varargs I_VARARGS`; then
10816                 val='varargs.h'
10817         fi
10818         ;;
10819 *)
10820         if `./varargs I_VARARGS`; then
10821                 val='varargs.h'
10822         fi
10823         ;;
10824 esac
10825 case "$val" in
10826 '')
10827 echo "I could not find the definition for va_dcl... You have problems..." >&4
10828         val="$undef"; set i_stdarg; eval $setvar
10829         val="$undef"; set i_varargs; eval $setvar
10830         ;;
10831 *)
10832         set i_varhdr
10833         eval $setvar
10834         case "$i_varhdr" in
10835         stdarg.h)
10836                 val="$define"; set i_stdarg; eval $setvar
10837                 val="$undef"; set i_varargs; eval $setvar
10838                 ;;
10839         varargs.h)
10840                 val="$undef"; set i_stdarg; eval $setvar
10841                 val="$define"; set i_varargs; eval $setvar
10842                 ;;
10843         esac
10844         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10845 esac
10846 $rm -f varargs*
10847
10848 : see if the Compiler supports C99 variadic macros
10849 case "$i_stdarg$i_stdlib" in
10850     "$define$define")
10851     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10852     $cat >try.c <<EOCP
10853 #include <stdio.h>
10854 #include <stdarg.h>
10855
10856 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10857
10858 int main() {
10859   char buf[20];
10860   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10861   puts(buf);
10862   return 0;
10863 }
10864 EOCP
10865     set try
10866     if eval $compile && $run ./try 2>&1 >/dev/null; then
10867         case "`$run ./try`" in
10868             "123 456 789")
10869             echo "You have C99 variadic macros." >&4
10870             d_c99_variadic_macros="$define"
10871             ;;
10872             *)
10873             echo "You don't have functional C99 variadic macros." >&4
10874             d_c99_variadic_macros="$undef"
10875             ;;
10876         esac
10877     else
10878         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10879         d_c99_variadic_macros="$undef"
10880     fi
10881     $rm_try
10882     ;;
10883     *)
10884     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10885     d_c99_variadic_macros="$undef"
10886     ;;
10887 esac
10888
10889 : see if signal is declared as pointer to function returning int or void
10890 echo " "
10891 xxx=`./findhdr signal.h`
10892 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10893 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10894         echo "You have int (*signal())() instead of void." >&4
10895         val="$undef"
10896 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10897         echo "You have void (*signal())()." >&4
10898         val="$define"
10899 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10900         echo "You have int (*signal())() instead of void." >&4
10901         val="$undef"
10902 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10903         echo "You have void (*signal())()." >&4
10904         val="$define"
10905 else
10906         case "$d_voidsig" in
10907         '')
10908         echo "I can't determine whether signal handler returns void or int..." >&4
10909                 dflt=void
10910                 rp="What type does your signal handler return?"
10911                 . ./myread
10912                 case "$ans" in
10913                 v*) val="$define";;
10914                 *) val="$undef";;
10915                 esac;;
10916         "$define")
10917                 echo "As you already told me, signal handler returns void." >&4
10918                 val="$define"
10919                 ;;
10920         *)      echo "As you already told me, signal handler returns int." >&4
10921                 val="$undef"
10922                 ;;
10923         esac
10924 fi
10925 set d_voidsig
10926 eval $setvar
10927 case "$d_voidsig" in
10928 "$define") signal_t="void";;
10929 *) signal_t="int";;
10930 esac
10931 $rm -f $$.tmp
10932
10933 : check for ability to cast large floats to 32-bit ints.
10934 echo " "
10935 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10936 if $test "$intsize" -ge 4; then
10937         xxx=int
10938 else
10939         xxx=long
10940 fi
10941 $cat >try.c <<EOCP
10942 #include <stdio.h>
10943 #$i_stdlib I_STDLIB
10944 #ifdef I_STDLIB
10945 #include <stdlib.h>
10946 #endif
10947 #include <sys/types.h>
10948 #include <signal.h>
10949 $signal_t blech(int s) { exit(3); }
10950 int main()
10951 {
10952         $xxx i32;
10953         double f, g;
10954         int result = 0;
10955         char str[16];
10956         signal(SIGFPE, blech);
10957
10958         /* Don't let compiler optimize the test away.  Store the number
10959            in a writable string for gcc to pass to sscanf under HP-UX.
10960         */
10961         sprintf(str, "2147483647");
10962         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10963         g = 10 * f;
10964         i32  = ($xxx) g;
10965
10966         /* x86 processors will probably give 0x8000 0000, which is a
10967            sign change.  We don't want that.  We want to mimic SPARC
10968            behavior here, which is to preserve the sign and give
10969            back 0x7fff ffff.
10970         */
10971         if (i32 != ($xxx) f)
10972                 result |= 1;
10973         exit(result);
10974 }
10975 EOCP
10976 set try
10977 if eval $compile_ok; then
10978         $run ./try
10979         yyy=$?
10980 else
10981         echo "(I can't seem to compile the test program--assuming it can't)"
10982         yyy=1
10983 fi
10984 case "$yyy" in
10985 0)      val="$define"
10986         echo "Yup, it can."
10987         ;;
10988 *)      val="$undef"
10989         echo "Nope, it can't."
10990         ;;
10991 esac
10992 set d_casti32
10993 eval $setvar
10994 $rm_try
10995
10996 : check for ability to cast negative floats to unsigned
10997 echo " "
10998 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10999 $cat >try.c <<EOCP
11000 #include <stdio.h>
11001 #$i_stdlib I_STDLIB
11002 #ifdef I_STDLIB
11003 #include <stdlib.h>
11004 #endif
11005 #include <sys/types.h>
11006 #include <signal.h>
11007 $signal_t blech(int s) { exit(7); }
11008 $signal_t blech_in_list(int s) { exit(4); }
11009 unsigned long dummy_long(unsigned long p) { return p; }
11010 unsigned int dummy_int(unsigned int p) { return p; }
11011 unsigned short dummy_short(unsigned short p) { return p; }
11012 int main()
11013 {
11014         double f;
11015         unsigned long along;
11016         unsigned int aint;
11017         unsigned short ashort;
11018         int result = 0;
11019         char str[16];
11020
11021         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11022            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11023            optimized the whole file away
11024         */
11025         /* Store the number in a writable string for gcc to pass to
11026            sscanf under HP-UX.
11027         */
11028         sprintf(str, "-123");
11029         sscanf(str, "%lf", &f);  /* f = -123.; */
11030
11031         signal(SIGFPE, blech);
11032         along = (unsigned long)f;
11033         aint = (unsigned int)f;
11034         ashort = (unsigned short)f;
11035         if (along != (unsigned long)-123)
11036                 result |= 1;
11037         if (aint != (unsigned int)-123)
11038                 result |= 1;
11039         if (ashort != (unsigned short)-123)
11040                 result |= 1;
11041         sprintf(str, "1073741824.");
11042         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11043         f = f + f;
11044         along = 0;
11045         along = (unsigned long)f;
11046         if (along != 0x80000000)
11047                 result |= 2;
11048         f -= 1.;
11049         along = 0;
11050         along = (unsigned long)f;
11051         if (along != 0x7fffffff)
11052                 result |= 1;
11053         f += 2.;
11054         along = 0;
11055         along = (unsigned long)f;
11056         if (along != 0x80000001)
11057                 result |= 2;
11058         if (result)
11059                 exit(result);
11060         signal(SIGFPE, blech_in_list);
11061         sprintf(str, "123.");
11062         sscanf(str, "%lf", &f);  /* f = 123.; */
11063         along = dummy_long((unsigned long)f);
11064         aint = dummy_int((unsigned int)f);
11065         ashort = dummy_short((unsigned short)f);
11066         if (along != (unsigned long)123)
11067                 result |= 4;
11068         if (aint != (unsigned int)123)
11069                 result |= 4;
11070         if (ashort != (unsigned short)123)
11071                 result |= 4;
11072         exit(result);
11073
11074 }
11075 EOCP
11076 set try
11077 if eval $compile_ok; then
11078         $run ./try
11079         castflags=$?
11080 else
11081         echo "(I can't seem to compile the test program--assuming it can't)"
11082         castflags=7
11083 fi
11084 case "$castflags" in
11085 0)      val="$define"
11086         echo "Yup, it can."
11087         ;;
11088 *)      val="$undef"
11089         echo "Nope, it can't."
11090         ;;
11091 esac
11092 set d_castneg
11093 eval $setvar
11094 $rm_try
11095
11096 : see if vprintf exists
11097 echo " "
11098 if set vprintf val -f d_vprintf; eval $csym; $val; then
11099         echo 'vprintf() found.' >&4
11100         val="$define"
11101         $cat >try.c <<EOF
11102 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11103 #$i_varargs I_VARARGS
11104
11105 #$i_stdlib I_STDLIB
11106 #$i_unistd I_UNISTD
11107
11108 #ifdef I_STDARG
11109 #  include <stdarg.h>
11110 #else /* I_VARARGS */
11111 #  include <varargs.h>
11112 #endif
11113
11114 #ifdef I_UNISTD
11115 #  include <unistd.h>
11116 #endif
11117
11118 #ifdef I_STDLIB
11119 #  include <stdlib.h>
11120 #endif
11121
11122 #include <stdio.h> /* vsprintf prototype */
11123
11124 #ifdef I_STDARG
11125 void xxx(int n, ...)
11126 {
11127     va_list args;
11128     char buf[10];
11129     va_start(args, n);
11130     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11131 }
11132 int main() { xxx(1, "foo"); }
11133
11134 #else /* I_VARARGS */
11135
11136 xxx(va_alist)
11137 va_dcl
11138 {
11139     va_list args;
11140     char buf[10];
11141     va_start(args);
11142     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11143 }
11144 int main() { xxx("foo"); }
11145
11146 #endif
11147
11148 EOF
11149         set try
11150         if eval $compile_ok; then
11151                 if $run ./try; then
11152                         echo "Your vsprintf() returns (int)." >&4
11153                         val2="$undef"
11154                 else
11155                         echo "Your vsprintf() returns (char*)." >&4
11156                         val2="$define"
11157                 fi
11158         else
11159                 echo 'I am unable to compile the vsprintf() test program.' >&4
11160                 # We shouldn't get here.  If we do, assume the standard signature,
11161                 # not the old BSD one.
11162                 echo 'Guessing that vsprintf() returns (int).' >&4
11163                 val2="$undef"
11164         fi
11165 else
11166         echo 'vprintf() NOT found.' >&4
11167         val="$undef"
11168         val2="$undef"
11169 fi
11170 $rm_try
11171 set d_vprintf
11172 eval $setvar
11173 val=$val2
11174 set d_charvspr
11175 eval $setvar
11176
11177 : see if chown exists
11178 set chown d_chown
11179 eval $inlibc
11180
11181 : see if chroot exists
11182 set chroot d_chroot
11183 eval $inlibc
11184
11185 : see if chsize exists
11186 set chsize d_chsize
11187 eval $inlibc
11188
11189 : see if class exists
11190 set class d_class
11191 eval $inlibc
11192
11193 : see if clearenv exists
11194 set clearenv d_clearenv
11195 eval $inlibc
11196
11197 : Define hasstruct macro for Configure internal use
11198 hasstruct='varname=$1; struct=$2; shift; shift;
11199 while $test $# -ge 2; do
11200         case "$1" in
11201         $define) echo "#include <$2>";;
11202         esac ;
11203     shift 2;
11204 done > try.c;
11205 echo "int main () { struct $struct foo; }" >> try.c;
11206 set try;
11207 if eval $compile; then
11208         val="$define";
11209 else
11210         val="$undef";
11211 fi;
11212 set $varname;
11213 eval $setvar;
11214 $rm_try'
11215
11216 : see whether socket exists
11217 socketlib=''
11218 sockethdr=''
11219 echo " "
11220 $echo $n "Hmm... $c" >&4
11221 if set socket val -f d_socket; eval $csym; $val; then
11222         echo "Looks like you have Berkeley networking support." >&4
11223         d_socket="$define"
11224         if set setsockopt val -f; eval $csym; $val; then
11225                 d_oldsock="$undef"
11226         else
11227                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11228                 d_oldsock="$define"
11229         fi
11230 else
11231         if $contains socklib libc.list >/dev/null 2>&1; then
11232                 echo "Looks like you have Berkeley networking support." >&4
11233                 d_socket="$define"
11234                 : we will have to assume that it supports the 4.2 BSD interface
11235                 d_oldsock="$undef"
11236         else
11237                 echo "You don't have Berkeley networking in libc$_a..." >&4
11238                 if test "X$d_socket" = "X$define"; then
11239                    echo "...but you seem to believe that you have sockets." >&4
11240                 else
11241                         for net in net socket
11242                         do
11243                                 if test -f /usr/lib/lib$net$_a; then
11244                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11245                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11246                                         if $contains socket libc.list >/dev/null 2>&1; then
11247                                                 d_socket="$define"
11248                                                 socketlib="-l$net"
11249                                                 case "$net" in
11250                                                 net)
11251                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11252                                                         sockethdr="-I/usr/netinclude"
11253                                                         ;;
11254                                                 esac
11255                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11256                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11257                                                         d_oldsock="$undef"
11258                                                 else
11259                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11260                                                         d_oldsock="$define"
11261                                                 fi
11262                                                 break
11263                                         fi
11264                                 fi
11265                         done
11266                         if test "X$d_socket" != "X$define"; then
11267                            echo "or anywhere else I see." >&4
11268                            d_socket="$undef"
11269                            d_oldsock="$undef"
11270                         fi
11271                 fi
11272         fi
11273 fi
11274
11275 : see if socketpair exists
11276 set socketpair d_sockpair
11277 eval $inlibc
11278
11279
11280 echo " "
11281 echo "Checking the availability sa_len in the sock struct ..." >&4
11282 $cat >try.c <<EOF
11283 #include <sys/types.h>
11284 #include <sys/socket.h>
11285 int main() {
11286 struct sockaddr sa;
11287 return (sa.sa_len);
11288 }
11289 EOF
11290 val="$undef"
11291 set try; if eval $compile; then
11292         val="$define"
11293 fi
11294 set d_sockaddr_sa_len; eval $setvar
11295 $rm_try
11296
11297 echo " "
11298 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11299 $cat >try.c <<EOF
11300 #include <sys/types.h>
11301 #include <sys/socket.h>
11302 #include <netinet/in.h>
11303 int main() {
11304 struct sockaddr_in6 sin6;
11305 return (sin6.sin6_scope_id);
11306 }
11307 EOF
11308 val="$undef"
11309 set try; if eval $compile; then
11310         val="$define"
11311 fi
11312 set d_sin6_scope_id; eval $setvar
11313 $rm_try
11314
11315 echo " "
11316 echo "Checking the availability of certain socket constants..." >&4
11317 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11318         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11319         $cat >try.c <<EOF
11320 #include <sys/types.h>
11321 #include <sys/socket.h>
11322 int main() {
11323     int i = $ENUM;
11324 }
11325 EOF
11326         val="$undef"
11327         set try; if eval $compile; then
11328                 val="$define"
11329         fi
11330         set d_${enum}; eval $setvar
11331         $rm_try
11332 done
11333
11334 : see if this is a sys/uio.h system
11335 set sys/uio.h i_sysuio
11336 eval $inhdr
11337
11338 : Check for cmsghdr support
11339 echo " "
11340 echo "Checking to see if your system supports struct cmsghdr..." >&4
11341 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11342 eval $hasstruct
11343 case "$d_cmsghdr_s" in
11344 "$define")      echo "Yes, it does."   ;;
11345 *)              echo "No, it doesn't." ;;
11346 esac
11347
11348
11349 : check for const keyword
11350 echo " "
11351 echo 'Checking to see if your C compiler knows about "const"...' >&4
11352 $cat >const.c <<'EOCP'
11353 typedef struct spug { int drokk; } spug;
11354 int main()
11355 {
11356         const char *foo;
11357         const spug y = { 0 };
11358 }
11359 EOCP
11360 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11361         val="$define"
11362         echo "Yup, it does."
11363 else
11364         val="$undef"
11365         echo "Nope, it doesn't."
11366 fi
11367 set d_const
11368 eval $setvar
11369
11370 : see if copysignl exists
11371 set copysignl d_copysignl
11372 eval $inlibc
11373
11374 : see if crypt exists
11375 echo " "
11376 set crypt d_crypt
11377 eval $inlibc
11378 case "$d_crypt" in
11379 $define) cryptlib='' ;;
11380 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11381                 echo 'crypt() found.' >&4
11382                 val="$define"
11383                 cryptlib=''
11384         else
11385                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11386                 if $test -z "$cryptlib"; then
11387                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11388                 else
11389                         cryptlib=-lcrypt
11390                 fi
11391                 if $test -z "$cryptlib"; then
11392                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11393                 else
11394                         cryptlib=-lcrypt
11395                 fi
11396                 if $test -z "$cryptlib"; then
11397                         cryptlib=`./loc libcrypt$_a "" $libpth`
11398                 else
11399                         cryptlib=-lcrypt
11400                 fi
11401                 if $test -z "$cryptlib"; then
11402                         echo 'crypt() NOT found.' >&4
11403                         val="$undef"
11404                 else
11405                         val="$define"
11406                 fi
11407         fi
11408         set d_crypt
11409         eval $setvar
11410         ;;
11411 esac
11412
11413 : see if this is a crypt.h system
11414 set crypt.h i_crypt
11415 eval $inhdr
11416
11417 : see if crypt_r exists
11418 set crypt_r d_crypt_r
11419 eval $inlibc
11420 case "$d_crypt_r" in
11421 "$define")
11422         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11423         case "$d_crypt_r_proto:$usethreads" in
11424         ":define")      d_crypt_r_proto=define
11425                 set d_crypt_r_proto crypt_r $hdrs
11426                 eval $hasproto ;;
11427         *)      ;;
11428         esac
11429         case "$d_crypt_r_proto" in
11430         define)
11431         case "$crypt_r_proto" in
11432         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11433         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11434         esac
11435         case "$crypt_r_proto" in
11436         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11437         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11438         esac
11439         case "$crypt_r_proto" in
11440         ''|0)   d_crypt_r=undef
11441                 crypt_r_proto=0
11442                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11443         * )     case "$crypt_r_proto" in
11444                 REENTRANT_PROTO*) ;;
11445                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11446                 esac
11447                 echo "Prototype: $try" ;;
11448         esac
11449         ;;
11450         *)      case "$usethreads" in
11451                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11452                 esac
11453                 d_crypt_r=undef
11454                 crypt_r_proto=0
11455                 ;;
11456         esac
11457         ;;
11458 *)      crypt_r_proto=0
11459         ;;
11460 esac
11461
11462 : get csh whereabouts
11463 case "$csh" in
11464 'csh') val="$undef" ;;
11465 *) val="$define" ;;
11466 esac
11467 set d_csh
11468 eval $setvar
11469 : Respect a hint or command line value for full_csh.
11470 case "$full_csh" in
11471 '') full_csh=$csh ;;
11472 esac
11473
11474 : see if ctermid exists
11475 set ctermid d_ctermid
11476 eval $inlibc
11477
11478 : see if ctermid_r exists
11479 set ctermid_r d_ctermid_r
11480 eval $inlibc
11481 case "$d_ctermid_r" in
11482 "$define")
11483         hdrs="$i_systypes sys/types.h define stdio.h "
11484         case "$d_ctermid_r_proto:$usethreads" in
11485         ":define")      d_ctermid_r_proto=define
11486                 set d_ctermid_r_proto ctermid_r $hdrs
11487                 eval $hasproto ;;
11488         *)      ;;
11489         esac
11490         case "$d_ctermid_r_proto" in
11491         define)
11492         case "$ctermid_r_proto" in
11493         ''|0) try='char* ctermid_r(char*);'
11494         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11495         esac
11496         case "$ctermid_r_proto" in
11497         ''|0)   d_ctermid_r=undef
11498                 ctermid_r_proto=0
11499                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11500         * )     case "$ctermid_r_proto" in
11501                 REENTRANT_PROTO*) ;;
11502                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11503                 esac
11504                 echo "Prototype: $try" ;;
11505         esac
11506         ;;
11507         *)      case "$usethreads" in
11508                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11509                 esac
11510                 d_ctermid_r=undef
11511                 ctermid_r_proto=0
11512                 ;;
11513         esac
11514         ;;
11515 *)      ctermid_r_proto=0
11516         ;;
11517 esac
11518
11519 : see if ctime_r exists
11520 set ctime_r d_ctime_r
11521 eval $inlibc
11522 case "$d_ctime_r" in
11523 "$define")
11524         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11525         case "$d_ctime_r_proto:$usethreads" in
11526         ":define")      d_ctime_r_proto=define
11527                 set d_ctime_r_proto ctime_r $hdrs
11528                 eval $hasproto ;;
11529         *)      ;;
11530         esac
11531         case "$d_ctime_r_proto" in
11532         define)
11533         case "$ctime_r_proto" in
11534         ''|0) try='char* ctime_r(const time_t*, char*);'
11535         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11536         esac
11537         case "$ctime_r_proto" in
11538         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11539         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11540         esac
11541         case "$ctime_r_proto" in
11542         ''|0) try='int ctime_r(const time_t*, char*);'
11543         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11544         esac
11545         case "$ctime_r_proto" in
11546         ''|0) try='int ctime_r(const time_t*, char*, int);'
11547         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11548         esac
11549         case "$ctime_r_proto" in
11550         ''|0)   d_ctime_r=undef
11551                 ctime_r_proto=0
11552                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11553         * )     case "$ctime_r_proto" in
11554                 REENTRANT_PROTO*) ;;
11555                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11556                 esac
11557                 echo "Prototype: $try" ;;
11558         esac
11559         ;;
11560         *)      case "$usethreads" in
11561                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11562                 esac
11563                 d_ctime_r=undef
11564                 ctime_r_proto=0
11565                 ;;
11566         esac
11567         ;;
11568 *)      ctime_r_proto=0
11569         ;;
11570 esac
11571
11572 : see if cuserid exists
11573 set cuserid d_cuserid
11574 eval $inlibc
11575
11576 : see if this is a limits.h system
11577 set limits.h i_limits
11578 eval $inhdr
11579
11580 : see if this is a float.h system
11581 set float.h i_float
11582 eval $inhdr
11583
11584 : See if number of significant digits in a double precision number is known
11585 echo " "
11586 $cat >dbl_dig.c <<EOM
11587 #$i_limits I_LIMITS
11588 #$i_float I_FLOAT
11589 #ifdef I_LIMITS
11590 #include <limits.h>
11591 #endif
11592 #ifdef I_FLOAT
11593 #include <float.h>
11594 #endif
11595 #ifdef DBL_DIG
11596 printf("Contains DBL_DIG");
11597 #endif
11598 EOM
11599 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11600 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11601         echo "DBL_DIG found." >&4
11602         val="$define"
11603 else
11604         echo "DBL_DIG NOT found." >&4
11605         val="$undef"
11606 fi
11607 $rm -f dbl_dig.?
11608 set d_dbl_dig
11609 eval $setvar
11610
11611 : see if dbm.h is available
11612 : see if dbmclose exists
11613 set dbmclose d_dbmclose
11614 eval $inlibc
11615
11616 case "$d_dbmclose" in
11617 $define)
11618         set dbm.h i_dbm
11619         eval $inhdr
11620         case "$i_dbm" in
11621         $define)
11622                 val="$undef"
11623                 set i_rpcsvcdbm
11624                 eval $setvar
11625                 ;;
11626         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11627                 eval $inhdr
11628                 ;;
11629         esac
11630         ;;
11631 *)      echo "We won't be including <dbm.h>"
11632         val="$undef"
11633         set i_dbm
11634         eval $setvar
11635         val="$undef"
11636         set i_rpcsvcdbm
11637         eval $setvar
11638         ;;
11639 esac
11640
11641 : see if prototype for dbminit is available
11642 echo " "
11643 set d_dbminitproto dbminit $i_dbm dbm.h
11644 eval $hasproto
11645
11646 : see if difftime exists
11647 set difftime d_difftime
11648 eval $inlibc
11649
11650 : see if this is a dirent system
11651 echo " "
11652 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11653         val="$define"
11654         echo "<dirent.h> found." >&4
11655 else
11656         val="$undef"
11657         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11658                 echo "<sys/dir.h> found." >&4
11659                 echo " "
11660         else
11661                 xinc=`./findhdr sys/ndir.h`
11662         fi
11663         echo "<dirent.h> NOT found." >&4
11664 fi
11665 set i_dirent
11666 eval $setvar
11667
11668 : Look for type of directory structure.
11669 echo " "
11670 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11671
11672 case "$direntrytype" in
11673 ''|' ')
11674         case "$i_dirent" in
11675         $define) guess1='struct dirent' ;;
11676         *) guess1='struct direct'  ;;
11677         esac
11678         ;;
11679 *)      guess1="$direntrytype"
11680         ;;
11681 esac
11682
11683 case "$guess1" in
11684 'struct dirent') guess2='struct direct' ;;
11685 *) guess2='struct dirent' ;;
11686 esac
11687
11688 if $contains "$guess1" try.c >/dev/null 2>&1; then
11689         direntrytype="$guess1"
11690         echo "Your directory entries are $direntrytype." >&4
11691 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11692         direntrytype="$guess2"
11693         echo "Your directory entries seem to be $direntrytype." >&4
11694 else
11695         echo "I don't recognize your system's directory entries." >&4
11696         rp="What type is used for directory entries on this system?"
11697         dflt="$guess1"
11698         . ./myread
11699         direntrytype="$ans"
11700 fi
11701 $rm_try
11702
11703 : see if the directory entry stores field length
11704 echo " "
11705 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11706 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11707         echo "Good, your directory entry keeps length information in d_namlen." >&4
11708         val="$define"
11709 else
11710         echo "Your directory entry does not know about the d_namlen field." >&4
11711         val="$undef"
11712 fi
11713 set d_dirnamlen
11714 eval $setvar
11715 $rm_try
11716
11717 : Look for DIR.dd_fd
11718 case "$i_dirent" in
11719 "$define")
11720     echo "Checking to see if DIR has a dd_fd member variable" >&4
11721     $cat >try.c <<EOCP
11722 #$i_stdlib I_STDLIB
11723 #ifdef I_STDLIB
11724 #include <stdlib.h>
11725 #endif
11726 #include <dirent.h>
11727
11728 int main() {
11729     DIR dir;
11730     dir.dd_fd = 1;
11731     return 0;
11732 }
11733 EOCP
11734     val=$undef
11735     set try
11736     if eval $compile; then
11737         echo "Yes, it does."
11738         val="$define"
11739     else
11740         echo "No, it does not."
11741         val="$undef"
11742     fi
11743     ;;
11744 *)
11745     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11746     val="$undef"
11747     ;;
11748 esac
11749 set d_dir_dd_fd
11750 eval $setvar
11751 $rm_try
11752
11753 : see if this is an sysdir system
11754 set sys/dir.h i_sysdir
11755 eval $inhdr
11756
11757 : see if this is an sysndir system
11758 set sys/ndir.h i_sysndir
11759 eval $inhdr
11760
11761 : Look for dirfd
11762 echo " "
11763 $cat >dirfd.c <<EOM
11764 #include <stdio.h>
11765 #$i_stdlib I_STDLIB
11766 #ifdef I_STDLIB
11767 #include <stdlib.h>
11768 #endif
11769 #$i_dirent I_DIRENT             /**/
11770 #$i_sysdir I_SYS_DIR            /**/
11771 #$i_sysndir I_SYS_NDIR          /**/
11772 #$i_systypes I_SYS_TYPES        /**/
11773 #if defined(I_SYS_TYPES)
11774 #include <sys/types.h>
11775 #endif
11776 #if defined(I_DIRENT)
11777 #include <dirent.h>
11778 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11779 #include <sys/dir.h>
11780 #endif
11781 #else
11782 #ifdef I_SYS_NDIR
11783 #include <sys/ndir.h>
11784 #else
11785 #ifdef I_SYS_DIR
11786 #ifdef hp9000s500
11787 #include <ndir.h>       /* may be wrong in the future */
11788 #else
11789 #include <sys/dir.h>
11790 #endif
11791 #endif
11792 #endif
11793 #endif 
11794 int main() {
11795         DIR *dirp = opendir(".");
11796         if (dirfd(dirp) >= 0)
11797                 exit(0);
11798         else
11799                 exit(1);
11800 }
11801 EOM
11802 val=$undef
11803 set dirfd
11804 if eval $compile; then
11805         val="$define"
11806 fi
11807 case "$val" in
11808 $define)        echo "dirfd() found." >&4       ;;
11809 *)              echo "dirfd() NOT found." >&4   ;;
11810 esac
11811 set d_dirfd
11812 eval $setvar
11813 $rm -f dirfd*
11814
11815 : see if dlerror exists
11816 xxx_runnm="$runnm"
11817 runnm=false
11818 set dlerror d_dlerror
11819 eval $inlibc
11820 runnm="$xxx_runnm"
11821
11822 : see if dlfcn is available
11823 set dlfcn.h i_dlfcn
11824 eval $inhdr
11825
11826 : Check what extension to use for shared libs
11827 case "$usedl" in
11828 $define|y|true)
11829         $cat << EOM
11830
11831 On a few systems, the dynamically loaded modules that perl generates and uses
11832 will need a different extension than shared libs. The default will probably
11833 be appropriate.
11834
11835 EOM
11836         case "$dlext" in
11837         '')     dflt="$so" ;;
11838         *)      dflt="$dlext" ;;
11839         esac
11840         rp='What is the extension of dynamically loaded modules'
11841         . ./myread
11842         dlext="$ans"
11843         ;;
11844 *)
11845         dlext="none"
11846         ;;
11847 esac
11848
11849 : Check if dlsym need a leading underscore
11850 echo " "
11851 val="$undef"
11852
11853 case "$dlsrc" in
11854 dl_dlopen.xs)
11855         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11856         $cat >dyna.c <<'EOM'
11857 fred () { }
11858 EOM
11859
11860 $cat >fred.c<<EOM
11861
11862 #include <stdio.h>
11863 #$i_stdlib I_STDLIB
11864 #ifdef I_STDLIB
11865 #include <stdlib.h>
11866 #endif
11867 #$i_dlfcn I_DLFCN
11868 #ifdef I_DLFCN
11869 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11870 #else
11871 #include <sys/types.h>
11872 #include <nlist.h>
11873 #include <link.h>
11874 #endif
11875
11876 extern int fred() ;
11877
11878 int main()
11879 {
11880     void * handle ;
11881     void * symbol ;
11882 #ifndef RTLD_LAZY
11883     int mode = 1 ;
11884 #else
11885     int mode = RTLD_LAZY ;
11886 #endif
11887     handle = dlopen("./dyna.$dlext", mode) ;
11888     if (handle == NULL) {
11889         printf ("1\n") ;
11890         fflush (stdout) ;
11891         exit(0);
11892     }
11893     symbol = dlsym(handle, "fred") ;
11894     if (symbol == NULL) {
11895         /* try putting a leading underscore */
11896         symbol = dlsym(handle, "_fred") ;
11897         if (symbol == NULL) {
11898             printf ("2\n") ;
11899             fflush (stdout) ;
11900             exit(0);
11901         }
11902         printf ("3\n") ;
11903     }
11904     else
11905         printf ("4\n") ;
11906     fflush (stdout) ;
11907     exit(0);
11908 }
11909 EOM
11910         : Call the object file tmp-dyna.o in case dlext=o.
11911         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11912                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11913                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11914                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11915                 xxx=`$run ./fred`
11916                 case $xxx in
11917                 1)      echo "Test program failed using dlopen." >&4
11918                         echo "Perhaps you should not use dynamic loading." >&4;;
11919                 2)      echo "Test program failed using dlsym." >&4
11920                         echo "Perhaps you should not use dynamic loading." >&4;;
11921                 3)      echo "dlsym needs a leading underscore" >&4
11922                         val="$define" ;;
11923                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11924                 esac
11925         else
11926                 echo "I can't compile and run the test program." >&4
11927                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11928         fi
11929         ;;
11930 esac
11931
11932 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11933
11934 set d_dlsymun
11935 eval $setvar
11936
11937 : see if drand48_r exists
11938 set drand48_r d_drand48_r
11939 eval $inlibc
11940 case "$d_drand48_r" in
11941 "$define")
11942         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11943         case "$d_drand48_r_proto:$usethreads" in
11944         ":define")      d_drand48_r_proto=define
11945                 set d_drand48_r_proto drand48_r $hdrs
11946                 eval $hasproto ;;
11947         *)      ;;
11948         esac
11949         case "$d_drand48_r_proto" in
11950         define)
11951         case "$drand48_r_proto" in
11952         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11953         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11954         esac
11955         case "$drand48_r_proto" in
11956         ''|0)   d_drand48_r=undef
11957                 drand48_r_proto=0
11958                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11959         * )     case "$drand48_r_proto" in
11960                 REENTRANT_PROTO*) ;;
11961                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11962                 esac
11963                 echo "Prototype: $try" ;;
11964         esac
11965         ;;
11966         *)      case "$usethreads" in
11967                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11968                 esac
11969                 d_drand48_r=undef
11970                 drand48_r_proto=0
11971                 ;;
11972         esac
11973         ;;
11974 *)      drand48_r_proto=0
11975         ;;
11976 esac
11977
11978 : see if prototype for drand48 is available
11979 echo " "
11980 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11981 eval $hasproto
11982
11983 : see if dup2 exists
11984 set dup2 d_dup2
11985 eval $inlibc
11986
11987 : see if eaccess exists
11988 set eaccess d_eaccess
11989 eval $inlibc
11990
11991 : see if endgrent exists
11992 set endgrent d_endgrent
11993 eval $inlibc
11994
11995 : see if this is an grp system
11996 set grp.h i_grp
11997 eval $inhdr
11998
11999 case "$i_grp" in
12000 $define)
12001         xxx=`./findhdr grp.h`
12002         $cppstdin $cppflags $cppminus < $xxx >$$.h
12003
12004         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12005                 val="$define"
12006         else
12007                 val="$undef"
12008         fi
12009         set d_grpasswd
12010         eval $setvar
12011
12012         $rm -f $$.h
12013         ;;
12014 *)
12015         val="$undef";
12016         set d_grpasswd; eval $setvar
12017         ;;
12018 esac
12019
12020 : see if endgrent_r exists
12021 set endgrent_r d_endgrent_r
12022 eval $inlibc
12023 case "$d_endgrent_r" in
12024 "$define")
12025         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12026         case "$d_endgrent_r_proto:$usethreads" in
12027         ":define")      d_endgrent_r_proto=define
12028                 set d_endgrent_r_proto endgrent_r $hdrs
12029                 eval $hasproto ;;
12030         *)      ;;
12031         esac
12032         case "$d_endgrent_r_proto" in
12033         define)
12034         case "$endgrent_r_proto" in
12035         ''|0) try='int endgrent_r(FILE**);'
12036         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12037         esac
12038         case "$endgrent_r_proto" in
12039         ''|0) try='void endgrent_r(FILE**);'
12040         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12041         esac
12042         case "$endgrent_r_proto" in
12043         ''|0)   d_endgrent_r=undef
12044                 endgrent_r_proto=0
12045                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12046         * )     case "$endgrent_r_proto" in
12047                 REENTRANT_PROTO*) ;;
12048                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12049                 esac
12050                 echo "Prototype: $try" ;;
12051         esac
12052         ;;
12053         *)      case "$usethreads" in
12054                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12055                 esac
12056                 d_endgrent_r=undef
12057                 endgrent_r_proto=0
12058                 ;;
12059         esac
12060         ;;
12061 *)      endgrent_r_proto=0
12062         ;;
12063 esac
12064
12065 : see if endhostent exists
12066 set endhostent d_endhent
12067 eval $inlibc
12068
12069 : see if this is a netdb.h system
12070 set netdb.h i_netdb
12071 eval $inhdr
12072
12073 : see if endhostent_r exists
12074 set endhostent_r d_endhostent_r
12075 eval $inlibc
12076 case "$d_endhostent_r" in
12077 "$define")
12078         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12079         case "$d_endhostent_r_proto:$usethreads" in
12080         ":define")      d_endhostent_r_proto=define
12081                 set d_endhostent_r_proto endhostent_r $hdrs
12082                 eval $hasproto ;;
12083         *)      ;;
12084         esac
12085         case "$d_endhostent_r_proto" in
12086         define)
12087         case "$endhostent_r_proto" in
12088         ''|0) try='int endhostent_r(struct hostent_data*);'
12089         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12090         esac
12091         case "$endhostent_r_proto" in
12092         ''|0) try='void endhostent_r(struct hostent_data*);'
12093         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12094         esac
12095         case "$endhostent_r_proto" in
12096         ''|0)   d_endhostent_r=undef
12097                 endhostent_r_proto=0
12098                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12099         * )     case "$endhostent_r_proto" in
12100                 REENTRANT_PROTO*) ;;
12101                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12102                 esac
12103                 echo "Prototype: $try" ;;
12104         esac
12105         ;;
12106         *)      case "$usethreads" in
12107                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12108                 esac
12109                 d_endhostent_r=undef
12110                 endhostent_r_proto=0
12111                 ;;
12112         esac
12113         ;;
12114 *)      endhostent_r_proto=0
12115         ;;
12116 esac
12117
12118 : see if endnetent exists
12119 set endnetent d_endnent
12120 eval $inlibc
12121
12122 : see if endnetent_r exists
12123 set endnetent_r d_endnetent_r
12124 eval $inlibc
12125 case "$d_endnetent_r" in
12126 "$define")
12127         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12128         case "$d_endnetent_r_proto:$usethreads" in
12129         ":define")      d_endnetent_r_proto=define
12130                 set d_endnetent_r_proto endnetent_r $hdrs
12131                 eval $hasproto ;;
12132         *)      ;;
12133         esac
12134         case "$d_endnetent_r_proto" in
12135         define)
12136         case "$endnetent_r_proto" in
12137         ''|0) try='int endnetent_r(struct netent_data*);'
12138         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12139         esac
12140         case "$endnetent_r_proto" in
12141         ''|0) try='void endnetent_r(struct netent_data*);'
12142         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12143         esac
12144         case "$endnetent_r_proto" in
12145         ''|0)   d_endnetent_r=undef
12146                 endnetent_r_proto=0
12147                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12148         * )     case "$endnetent_r_proto" in
12149                 REENTRANT_PROTO*) ;;
12150                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12151                 esac
12152                 echo "Prototype: $try" ;;
12153         esac
12154         ;;
12155         *)      case "$usethreads" in
12156                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12157                 esac
12158                 d_endnetent_r=undef
12159                 endnetent_r_proto=0
12160                 ;;
12161         esac
12162         ;;
12163 *)      endnetent_r_proto=0
12164         ;;
12165 esac
12166
12167 : see if endprotoent exists
12168 set endprotoent d_endpent
12169 eval $inlibc
12170
12171 : see if endprotoent_r exists
12172 set endprotoent_r d_endprotoent_r
12173 eval $inlibc
12174 case "$d_endprotoent_r" in
12175 "$define")
12176         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12177         case "$d_endprotoent_r_proto:$usethreads" in
12178         ":define")      d_endprotoent_r_proto=define
12179                 set d_endprotoent_r_proto endprotoent_r $hdrs
12180                 eval $hasproto ;;
12181         *)      ;;
12182         esac
12183         case "$d_endprotoent_r_proto" in
12184         define)
12185         case "$endprotoent_r_proto" in
12186         ''|0) try='int endprotoent_r(struct protoent_data*);'
12187         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12188         esac
12189         case "$endprotoent_r_proto" in
12190         ''|0) try='void endprotoent_r(struct protoent_data*);'
12191         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12192         esac
12193         case "$endprotoent_r_proto" in
12194         ''|0)   d_endprotoent_r=undef
12195                 endprotoent_r_proto=0
12196                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12197         * )     case "$endprotoent_r_proto" in
12198                 REENTRANT_PROTO*) ;;
12199                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12200                 esac
12201                 echo "Prototype: $try" ;;
12202         esac
12203         ;;
12204         *)      case "$usethreads" in
12205                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12206                 esac
12207                 d_endprotoent_r=undef
12208                 endprotoent_r_proto=0
12209                 ;;
12210         esac
12211         ;;
12212 *)      endprotoent_r_proto=0
12213         ;;
12214 esac
12215
12216 : see if endpwent exists
12217 set endpwent d_endpwent
12218 eval $inlibc
12219
12220 : see if this is a pwd.h system
12221 set pwd.h i_pwd
12222 eval $inhdr
12223
12224 case "$i_pwd" in
12225 $define)
12226         xxx=`./findhdr pwd.h`
12227         $cppstdin $cppflags $cppminus < $xxx >$$.h
12228
12229         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12230                 val="$define"
12231         else
12232                 val="$undef"
12233         fi
12234         set d_pwquota
12235         eval $setvar
12236
12237         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12238                 val="$define"
12239         else
12240                 val="$undef"
12241         fi
12242         set d_pwage
12243         eval $setvar
12244
12245         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12246                 val="$define"
12247         else
12248                 val="$undef"
12249         fi
12250         set d_pwchange
12251         eval $setvar
12252
12253         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12254                 val="$define"
12255         else
12256                 val="$undef"
12257         fi
12258         set d_pwclass
12259         eval $setvar
12260
12261         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12262                 val="$define"
12263         else
12264                 val="$undef"
12265         fi
12266         set d_pwexpire
12267         eval $setvar
12268
12269         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12270                 val="$define"
12271         else
12272                 val="$undef"
12273         fi
12274         set d_pwcomment
12275         eval $setvar
12276
12277         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12278                 val="$define"
12279         else
12280                 val="$undef"
12281         fi
12282         set d_pwgecos
12283         eval $setvar
12284
12285         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12286                 val="$define"
12287         else
12288                 val="$undef"
12289         fi
12290         set d_pwpasswd
12291         eval $setvar
12292
12293         $rm -f $$.h
12294         ;;
12295 *)
12296         val="$undef"; 
12297         set d_pwquota; eval $setvar
12298         set d_pwage; eval $setvar
12299         set d_pwchange; eval $setvar
12300         set d_pwclass; eval $setvar
12301         set d_pwexpire; eval $setvar
12302         set d_pwcomment; eval $setvar
12303         set d_pwgecos; eval $setvar
12304         set d_pwpasswd; eval $setvar
12305         ;;
12306 esac
12307
12308 : see if endpwent_r exists
12309 set endpwent_r d_endpwent_r
12310 eval $inlibc
12311 case "$d_endpwent_r" in
12312 "$define")
12313         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12314         case "$d_endpwent_r_proto:$usethreads" in
12315         ":define")      d_endpwent_r_proto=define
12316                 set d_endpwent_r_proto endpwent_r $hdrs
12317                 eval $hasproto ;;
12318         *)      ;;
12319         esac
12320         case "$d_endpwent_r_proto" in
12321         define)
12322         case "$endpwent_r_proto" in
12323         ''|0) try='int endpwent_r(FILE**);'
12324         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12325         esac
12326         case "$endpwent_r_proto" in
12327         ''|0) try='void endpwent_r(FILE**);'
12328         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12329         esac
12330         case "$endpwent_r_proto" in
12331         ''|0)   d_endpwent_r=undef
12332                 endpwent_r_proto=0
12333                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12334         * )     case "$endpwent_r_proto" in
12335                 REENTRANT_PROTO*) ;;
12336                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12337                 esac
12338                 echo "Prototype: $try" ;;
12339         esac
12340         ;;
12341         *)      case "$usethreads" in
12342                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12343                 esac
12344                 d_endpwent_r=undef
12345                 endpwent_r_proto=0
12346                 ;;
12347         esac
12348         ;;
12349 *)      endpwent_r_proto=0
12350         ;;
12351 esac
12352
12353 : see if endservent exists
12354 set endservent d_endsent
12355 eval $inlibc
12356
12357 : see if endservent_r exists
12358 set endservent_r d_endservent_r
12359 eval $inlibc
12360 case "$d_endservent_r" in
12361 "$define")
12362         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12363         case "$d_endservent_r_proto:$usethreads" in
12364         ":define")      d_endservent_r_proto=define
12365                 set d_endservent_r_proto endservent_r $hdrs
12366                 eval $hasproto ;;
12367         *)      ;;
12368         esac
12369         case "$d_endservent_r_proto" in
12370         define)
12371         case "$endservent_r_proto" in
12372         ''|0) try='int endservent_r(struct servent_data*);'
12373         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12374         esac
12375         case "$endservent_r_proto" in
12376         ''|0) try='void endservent_r(struct servent_data*);'
12377         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12378         esac
12379         case "$endservent_r_proto" in
12380         ''|0)   d_endservent_r=undef
12381                 endservent_r_proto=0
12382                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12383         * )     case "$endservent_r_proto" in
12384                 REENTRANT_PROTO*) ;;
12385                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12386                 esac
12387                 echo "Prototype: $try" ;;
12388         esac
12389         ;;
12390         *)      case "$usethreads" in
12391                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12392                 esac
12393                 d_endservent_r=undef
12394                 endservent_r_proto=0
12395                 ;;
12396         esac
12397         ;;
12398 *)      endservent_r_proto=0
12399         ;;
12400 esac
12401
12402 : Locate the flags for 'open()'
12403 echo " "
12404 $cat >try.c <<EOCP
12405 #include <sys/types.h>
12406 #ifdef I_FCNTL
12407 #include <fcntl.h>
12408 #endif
12409 #ifdef I_SYS_FILE
12410 #include <sys/file.h>
12411 #endif
12412 #$i_stdlib I_STDLIB
12413 #ifdef I_STDLIB
12414 #include <stdlib.h>
12415 #endif
12416 int main() {
12417         if(O_RDONLY);
12418 #ifdef O_TRUNC
12419         exit(0);
12420 #else
12421         exit(1);
12422 #endif
12423 }
12424 EOCP
12425 : check sys/file.h first to get FREAD on Sun
12426 if $test `./findhdr sys/file.h` && \
12427                 set try -DI_SYS_FILE && eval $compile; then
12428         h_sysfile=true;
12429         echo "<sys/file.h> defines the O_* constants..." >&4
12430         if $run ./try; then
12431                 echo "and you have the 3 argument form of open()." >&4
12432                 val="$define"
12433         else
12434                 echo "but not the 3 argument form of open().  Oh, well." >&4
12435                 val="$undef"
12436         fi
12437 elif $test `./findhdr fcntl.h` && \
12438                 set try -DI_FCNTL && eval $compile; then
12439         h_fcntl=true;
12440         echo "<fcntl.h> defines the O_* constants..." >&4
12441         if $run ./try; then
12442                 echo "and you have the 3 argument form of open()." >&4
12443                 val="$define"
12444         else
12445                 echo "but not the 3 argument form of open().  Oh, well." >&4
12446                 val="$undef"
12447         fi
12448 else
12449         val="$undef"
12450         echo "I can't find the O_* constant definitions!  You got problems." >&4
12451 fi
12452 set d_open3
12453 eval $setvar
12454 $rm_try
12455
12456 : see if this is a sys/file.h system
12457 val=''
12458 set sys/file.h val
12459 eval $inhdr
12460
12461 : do we need to include sys/file.h ?
12462 case "$val" in
12463 "$define")
12464         echo " "
12465         if $h_sysfile; then
12466                 val="$define"
12467                 echo "We'll be including <sys/file.h>." >&4
12468         else
12469                 val="$undef"
12470                 echo "We won't be including <sys/file.h>." >&4
12471         fi
12472         ;;
12473 *)
12474         h_sysfile=false
12475         ;;
12476 esac
12477 set i_sysfile
12478 eval $setvar
12479
12480 : see if fcntl.h is there
12481 val=''
12482 set fcntl.h val
12483 eval $inhdr
12484
12485 : see if we can include fcntl.h
12486 case "$val" in
12487 "$define")
12488         echo " "
12489         if $h_fcntl; then
12490                 val="$define"
12491                 echo "We'll be including <fcntl.h>." >&4
12492         else
12493                 val="$undef"
12494                 if $h_sysfile; then
12495         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12496                 else
12497                         echo "We won't be including <fcntl.h>." >&4
12498                 fi
12499         fi
12500         ;;
12501 *)
12502         h_fcntl=false
12503         val="$undef"
12504         ;;
12505 esac
12506 set i_fcntl
12507 eval $setvar
12508
12509 : see if fork exists
12510 set fork d_fork
12511 eval $inlibc
12512
12513 : see if pipe exists
12514 set pipe d_pipe
12515 eval $inlibc
12516
12517 : check for non-blocking I/O stuff
12518 case "$h_sysfile" in
12519 true) echo "#include <sys/file.h>" > head.c;;
12520 *)
12521        case "$h_fcntl" in
12522        true) echo "#include <fcntl.h>" > head.c;;
12523        *) echo "#include <sys/fcntl.h>" > head.c;;
12524        esac
12525        ;;
12526 esac
12527 echo " "
12528 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12529 case "$o_nonblock" in
12530 '')
12531         $cat head.c > try.c
12532         $cat >>try.c <<EOCP
12533 #include <stdio.h>
12534 #$i_stdlib I_STDLIB
12535 #ifdef I_STDLIB
12536 #include <stdlib.h>
12537 #endif
12538 #$i_fcntl I_FCNTL
12539 #ifdef I_FCNTL
12540 #include <fcntl.h>
12541 #endif
12542 int main() {
12543 #ifdef O_NONBLOCK
12544         printf("O_NONBLOCK\n");
12545         exit(0);
12546 #endif
12547 #ifdef O_NDELAY
12548         printf("O_NDELAY\n");
12549         exit(0);
12550 #endif
12551 #ifdef FNDELAY
12552         printf("FNDELAY\n");
12553         exit(0);
12554 #endif
12555         exit(0);
12556 }
12557 EOCP
12558         set try
12559         if eval $compile_ok; then
12560                 o_nonblock=`$run ./try`
12561                 case "$o_nonblock" in
12562                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12563                 *) echo "Seems like we can use $o_nonblock.";;
12564                 esac
12565         else
12566                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12567         fi
12568         ;;
12569 *) echo "Using $hint value $o_nonblock.";;
12570 esac
12571 $rm_try
12572
12573 echo " "
12574 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12575 case "$eagain" in
12576 '')
12577         case "$d_fork:$d_pipe" in
12578         define:define)
12579         $cat head.c > try.c
12580         $cat >>try.c <<EOCP
12581 #include <errno.h>
12582 #include <sys/types.h>
12583 #include <signal.h>
12584 #include <stdio.h>
12585 #$i_stdlib I_STDLIB
12586 #ifdef I_STDLIB
12587 #include <stdlib.h>
12588 #endif
12589 #$i_fcntl I_FCNTL
12590 #ifdef I_FCNTL
12591 #include <fcntl.h>
12592 #endif
12593 #define MY_O_NONBLOCK $o_nonblock
12594 #ifndef errno  /* XXX need better Configure test */
12595 extern int errno;
12596 #endif
12597 #$i_unistd I_UNISTD
12598 #ifdef I_UNISTD
12599 #include <unistd.h>
12600 #endif
12601 #$i_string I_STRING
12602 #ifdef I_STRING
12603 #include <string.h>
12604 #else
12605 #include <strings.h>
12606 #endif
12607 $signal_t blech(int x) { exit(3); }
12608 EOCP
12609         $cat >> try.c <<'EOCP'
12610 int main()
12611 {
12612         int pd[2];
12613         int pu[2];
12614         char buf[1];
12615         char string[100];
12616
12617         pipe(pd);       /* Down: child -> parent */
12618         pipe(pu);       /* Up: parent -> child */
12619         if (0 != fork()) {
12620                 int ret;
12621                 close(pd[1]);   /* Parent reads from pd[0] */
12622                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12623 #ifdef F_SETFL
12624                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12625                         exit(1);
12626 #else
12627                 exit(4);
12628 #endif
12629                 signal(SIGALRM, blech);
12630                 alarm(5);
12631                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12632                         exit(2);
12633                 sprintf(string, "%d\n", ret);
12634                 write(2, string, strlen(string));
12635                 alarm(0);
12636 #ifdef EAGAIN
12637                 if (errno == EAGAIN) {
12638                         printf("EAGAIN\n");
12639                         goto ok;
12640                 }
12641 #endif
12642 #ifdef EWOULDBLOCK
12643                 if (errno == EWOULDBLOCK)
12644                         printf("EWOULDBLOCK\n");
12645 #endif
12646         ok:
12647                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12648                 sleep(2);                               /* Give it time to close our pipe */
12649                 alarm(5);
12650                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12651                 alarm(0);
12652                 sprintf(string, "%d\n", ret);
12653                 write(4, string, strlen(string));
12654                 exit(0);
12655         }
12656
12657         close(pd[0]);                   /* We write to pd[1] */
12658         close(pu[1]);                   /* We read from pu[0] */
12659         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12660         close(pd[1]);                   /* Pipe pd is now fully closed! */
12661         exit(0);                                /* Bye bye, thank you for playing! */
12662 }
12663 EOCP
12664         set try
12665         if eval $compile_ok; then
12666                 echo "$startsh" >mtry
12667                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12668                 chmod +x mtry
12669                 ./mtry >/dev/null 2>&1
12670                 case $? in
12671                 0) eagain=`$cat try.out`;;
12672                 1) echo "Could not perform non-blocking setting!";;
12673                 2) echo "I did a successful read() for something that was not there!";;
12674                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12675                 4) echo "Could not find F_SETFL!";;
12676                 *) echo "Something terribly wrong happened during testing.";;
12677                 esac
12678                 rd_nodata=`$cat try.ret`
12679                 echo "A read() system call with no data present returns $rd_nodata."
12680                 case "$rd_nodata" in
12681                 0|-1) ;;
12682                 *)
12683                         echo "(That's peculiar, fixing that to be -1.)"
12684                         rd_nodata=-1
12685                         ;;
12686                 esac
12687                 case "$eagain" in
12688                 '')
12689                         echo "Forcing errno EAGAIN on read() with no data available."
12690                         eagain=EAGAIN
12691                         ;;
12692                 *)
12693                         echo "Your read() sets errno to $eagain when no data is available."
12694                         ;;
12695                 esac
12696                 status=`$cat try.err`
12697                 case "$status" in
12698                 0) echo "And it correctly returns 0 to signal EOF.";;
12699                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12700                 *) echo "However, your read() returns '$status' on EOF??";;
12701                 esac
12702                 val="$define"
12703                 if test "$status" = "$rd_nodata"; then
12704                         echo "WARNING: you can't distinguish between EOF and no data!"
12705                         val="$undef"
12706                 fi
12707         else
12708                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12709                 eagain=EAGAIN
12710         fi
12711         ;;
12712         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12713                 eagain=EAGAIN
12714                 val="$define"
12715                 ;;
12716         esac
12717         set d_eofnblk
12718         eval $setvar
12719         ;;
12720 *)
12721         echo "Using $hint value $eagain."
12722         echo "Your read() returns $rd_nodata when no data is present."
12723         case "$d_eofnblk" in
12724         "$define") echo "And you can see EOF because read() returns 0.";;
12725         "$undef") echo "But you can't see EOF status from read() returned value.";;
12726         *)
12727                 echo "(Assuming you can't see EOF status from read anyway.)"
12728                 d_eofnblk=$undef
12729                 ;;
12730         esac
12731         ;;
12732 esac
12733 $rm_try head.c mtry
12734
12735 : see if _ptr and _cnt from stdio act std
12736 echo " "
12737
12738 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12739         echo "(Looks like you have stdio.h from BSD.)"
12740         case "$stdio_ptr" in
12741         '') stdio_ptr='((fp)->_p)'
12742                 ptr_lval=$define
12743                 ;;
12744         *)      ptr_lval=$d_stdio_ptr_lval;;
12745         esac
12746         case "$stdio_cnt" in
12747         '') stdio_cnt='((fp)->_r)'
12748                 cnt_lval=$define
12749                 ;;
12750         *)      cnt_lval=$d_stdio_cnt_lval;;
12751         esac
12752         case "$stdio_base" in
12753         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12754         esac
12755         case "$stdio_bufsiz" in
12756         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12757         esac
12758 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12759         echo "(Looks like you have stdio.h from Linux.)"
12760         case "$stdio_ptr" in
12761         '') stdio_ptr='((fp)->_IO_read_ptr)'
12762                 ptr_lval=$define
12763                 ;;
12764         *)      ptr_lval=$d_stdio_ptr_lval;;
12765         esac
12766         case "$stdio_cnt" in
12767         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12768                 cnt_lval=$undef
12769                 ;;
12770         *)      cnt_lval=$d_stdio_cnt_lval;;
12771         esac
12772         case "$stdio_base" in
12773         '') stdio_base='((fp)->_IO_read_base)';;
12774         esac
12775         case "$stdio_bufsiz" in
12776         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12777         esac
12778 else
12779         case "$stdio_ptr" in
12780         '') stdio_ptr='((fp)->_ptr)'
12781                 ptr_lval=$define
12782                 ;;
12783         *)      ptr_lval=$d_stdio_ptr_lval;;
12784         esac
12785         case "$stdio_cnt" in
12786         '') stdio_cnt='((fp)->_cnt)'
12787                 cnt_lval=$define
12788                 ;;
12789         *)      cnt_lval=$d_stdio_cnt_lval;;
12790         esac
12791         case "$stdio_base" in
12792         '') stdio_base='((fp)->_base)';;
12793         esac
12794         case "$stdio_bufsiz" in
12795         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12796         esac
12797 fi
12798
12799 : test whether _ptr and _cnt really work
12800 echo "Checking how std your stdio is..." >&4
12801 $cat >try.c <<EOP
12802 #include <stdio.h>
12803 #$i_stdlib I_STDLIB
12804 #ifdef I_STDLIB
12805 #include <stdlib.h>
12806 #endif
12807 #define FILE_ptr(fp)    $stdio_ptr
12808 #define FILE_cnt(fp)    $stdio_cnt
12809 int main() {
12810         FILE *fp = fopen("try.c", "r");
12811         char c = getc(fp);
12812         if (
12813                 18 <= FILE_cnt(fp) &&
12814                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12815         )
12816                 exit(0);
12817         exit(1);
12818 }
12819 EOP
12820 val="$undef"
12821 set try
12822 if eval $compile && $to try.c; then
12823         if $run ./try; then
12824                 echo "Your stdio acts pretty std."
12825                 val="$define"
12826         else
12827                 echo "Your stdio isn't very std."
12828         fi
12829 else
12830         echo "Your stdio doesn't appear very std."
12831 fi
12832 $rm_try
12833
12834 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12835 # direct buffer manipulation no longer works.  The Configure tests
12836 # should be changed to correctly detect this, but until then,
12837 # the following check should at least let perl compile and run.
12838 # (This quick fix should be updated before 5.8.1.)
12839 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12840 # A. Dougherty, June 3, 2002.
12841 case "$d_gnulibc" in
12842 $define)
12843         case "$gnulibc_version" in
12844         2.[01]*)  ;;
12845         2.2) ;;
12846         2.2.[0-9]) ;;
12847         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12848                 val="$undef"
12849                 ;;
12850         esac
12851         ;;
12852 esac
12853 set d_stdstdio
12854 eval $setvar
12855
12856 : Can _ptr be used as an lvalue?
12857 case "$d_stdstdio$ptr_lval" in
12858 $define$define) val=$define ;;
12859 *) val=$undef ;;
12860 esac
12861 set d_stdio_ptr_lval
12862 eval $setvar
12863
12864 : Can _cnt be used as an lvalue?
12865 case "$d_stdstdio$cnt_lval" in
12866 $define$define) val=$define ;;
12867 *) val=$undef ;;
12868 esac
12869 set d_stdio_cnt_lval
12870 eval $setvar
12871
12872
12873 : test whether setting _ptr sets _cnt as a side effect
12874 d_stdio_ptr_lval_sets_cnt="$undef"
12875 d_stdio_ptr_lval_nochange_cnt="$undef"
12876 case "$d_stdio_ptr_lval$d_stdstdio" in
12877 $define$define)
12878         echo "Checking to see what happens if we set the stdio ptr..." >&4
12879 $cat >try.c <<EOP
12880 #include <stdio.h>
12881 /* Can we scream? */
12882 /* Eat dust sed :-) */
12883 /* In the buffer space, no one can hear you scream. */
12884 #$i_stdlib I_STDLIB
12885 #ifdef I_STDLIB
12886 #include <stdlib.h>
12887 #endif
12888 #define FILE_ptr(fp)    $stdio_ptr
12889 #define FILE_cnt(fp)    $stdio_cnt
12890 #include <sys/types.h>
12891 int main() {
12892         FILE *fp = fopen("try.c", "r");
12893         int c;
12894         char *ptr;
12895         size_t cnt;
12896         if (!fp) {
12897             puts("Fail even to read");
12898             exit(1);
12899         }
12900         c = getc(fp); /* Read away the first # */
12901         if (c == EOF) {
12902             puts("Fail even to read");
12903             exit(1);
12904         }
12905         if (!(
12906                 18 <= FILE_cnt(fp) &&
12907                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12908         )) {
12909                 puts("Fail even to read");
12910                 exit (1);
12911         }
12912         ptr = (char*) FILE_ptr(fp);
12913         cnt = (size_t)FILE_cnt(fp);
12914
12915         FILE_ptr(fp) += 42;
12916
12917         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12918                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12919                 exit (1);
12920         }
12921         if (FILE_cnt(fp) <= 20) {
12922                 printf ("Fail (<20 chars to test)");
12923                 exit (1);
12924         }
12925         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12926                 puts("Fail compare");
12927                 exit (1);
12928         }
12929         if (cnt == FILE_cnt(fp)) {
12930                 puts("Pass_unchanged");
12931                 exit (0);
12932         }
12933         if (FILE_cnt(fp) == (cnt - 42)) {
12934                 puts("Pass_changed");
12935                 exit (0);
12936         }
12937         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12938         return 1;
12939
12940 }
12941 EOP
12942         set try
12943         if eval $compile && $to try.c; then
12944                 case `$run ./try` in
12945                 Pass_changed)
12946                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12947                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12948                 Pass_unchanged)
12949                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12950                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12951                 Fail*)
12952                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12953                 *)
12954                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12955         esac
12956         else
12957                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12958         fi
12959         $rm_try
12960         ;;
12961 esac
12962
12963 : see if _base is also standard
12964 val="$undef"
12965 case "$d_stdstdio" in
12966 $define)
12967         $cat >try.c <<EOP
12968 #include <stdio.h>
12969 #$i_stdlib I_STDLIB
12970 #ifdef I_STDLIB
12971 #include <stdlib.h>
12972 #endif
12973 #define FILE_base(fp)   $stdio_base
12974 #define FILE_bufsiz(fp) $stdio_bufsiz
12975 int main() {
12976         FILE *fp = fopen("try.c", "r");
12977         char c = getc(fp);
12978         if (
12979                 19 <= FILE_bufsiz(fp) &&
12980                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12981         )
12982                 exit(0);
12983         exit(1);
12984 }
12985 EOP
12986         set try
12987         if eval $compile && $to try.c; then
12988                 if $run ./try; then
12989                         echo "And its _base field acts std."
12990                         val="$define"
12991                 else
12992                         echo "But its _base field isn't std."
12993                 fi
12994         else
12995                 echo "However, it seems to be lacking the _base field."
12996         fi
12997         $rm_try
12998         ;;
12999 esac
13000 set d_stdiobase
13001 eval $setvar
13002
13003 : see if fast_stdio exists
13004 val="$undef"
13005 case "$d_stdstdio:$d_stdio_ptr_lval" in
13006 "$define:$define")
13007         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13008         *$define*)
13009                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13010                 val="$define"
13011                 ;;
13012         esac
13013         ;;
13014 esac
13015 set d_faststdio
13016 eval $setvar
13017
13018
13019
13020 : see if fchdir exists
13021 set fchdir d_fchdir
13022 eval $inlibc
13023
13024 : see if fchmod exists
13025 set fchmod d_fchmod
13026 eval $inlibc
13027
13028 : see if fchown exists
13029 set fchown d_fchown
13030 eval $inlibc
13031
13032 : see if this is an fcntl system
13033 set fcntl d_fcntl
13034 eval $inlibc
13035
13036 : See if fcntl-based locking works.
13037 echo " "
13038 $cat >try.c <<EOCP
13039 #$i_stdlib I_STDLIB
13040 #ifdef I_STDLIB
13041 #include <stdlib.h>
13042 #endif
13043 #include <unistd.h>
13044 #include <fcntl.h>
13045 #include <signal.h>
13046 $signal_t blech(int x) { exit(3); }
13047 int main() {
13048 #if defined(F_SETLK) && defined(F_SETLKW)
13049      struct flock flock;
13050      int retval, fd;
13051      fd = open("try.c", O_RDONLY);
13052      flock.l_type = F_RDLCK;
13053      flock.l_whence = SEEK_SET;
13054      flock.l_start = flock.l_len = 0;
13055      signal(SIGALRM, blech);
13056      alarm(10);
13057      retval = fcntl(fd, F_SETLK, &flock);
13058      close(fd);
13059      (retval < 0 ? exit(2) : exit(0));
13060 #else
13061      exit(2);
13062 #endif
13063 }
13064 EOCP
13065 echo "Checking if fcntl-based file locking works... "
13066 case "$d_fcntl" in
13067 "$define")
13068         set try
13069         if eval $compile_ok; then
13070                 if $run ./try; then
13071                         echo "Yes, it seems to work."
13072                         val="$define"
13073                 else
13074                         echo "Nope, it didn't work."
13075                         val="$undef"
13076                         case "$?" in
13077                         3) $cat >&4 <<EOM
13078 ***
13079 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13080 *** This is (almost) impossible.
13081 *** If your NFS lock daemons are not feeling well, something like
13082 *** this may happen, please investigate.  Cannot continue, aborting.
13083 ***
13084 EOM
13085                                 exit 1
13086                                 ;;
13087                         esac
13088                 fi
13089         else
13090                 echo "I'm unable to compile the test program, so I'll assume not."
13091                 val="$undef"
13092         fi
13093         ;;
13094 *) val="$undef";
13095         echo "Nope, since you don't even have fcntl()."
13096         ;;
13097 esac
13098 set d_fcntl_can_lock
13099 eval $setvar
13100 $rm_try
13101
13102 : check for fd_set items
13103 $cat <<EOM
13104
13105 Checking to see how well your C compiler handles fd_set and friends ...
13106 EOM
13107 $cat >try.c <<EOCP
13108 #$i_stdlib I_STDLIB
13109 #ifdef I_STDLIB
13110 #include <stdlib.h>
13111 #endif
13112 #$i_systime I_SYS_TIME
13113 #$i_sysselct I_SYS_SELECT
13114 #$d_socket HAS_SOCKET
13115 #include <sys/types.h>
13116 #ifdef HAS_SOCKET
13117 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13118 #endif
13119 #ifdef I_SYS_TIME
13120 #include <sys/time.h>
13121 #endif
13122 #ifdef I_SYS_SELECT
13123 #include <sys/select.h>
13124 #endif
13125 int main() {
13126         fd_set fds;
13127
13128 #ifdef TRYBITS
13129         if(fds.fds_bits);
13130 #endif
13131
13132 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13133         exit(0);
13134 #else
13135         exit(1);
13136 #endif
13137 }
13138 EOCP
13139 set try -DTRYBITS
13140 if eval $compile; then
13141         d_fds_bits="$define"
13142         d_fd_set="$define"
13143         echo "Well, your system knows about the normal fd_set typedef..." >&4
13144         if $run ./try; then
13145                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13146                 d_fd_macros="$define"
13147         else
13148                 $cat >&4 <<'EOM'
13149 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13150 EOM
13151                 d_fd_macros="$undef"
13152         fi
13153 else
13154         $cat <<'EOM'
13155 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13156 EOM
13157         set try
13158         if eval $compile; then
13159                 d_fds_bits="$undef"
13160                 d_fd_set="$define"
13161                 echo "Well, your system has some sort of fd_set available..." >&4
13162                 if $run ./try; then
13163                         echo "and you have the normal fd_set macros." >&4
13164                         d_fd_macros="$define"
13165                 else
13166                         $cat <<'EOM'
13167 but not the normal fd_set macros!  Gross!  More work for me...
13168 EOM
13169                         d_fd_macros="$undef"
13170                 fi
13171         else
13172         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13173                 d_fd_set="$undef"
13174                 d_fds_bits="$undef"
13175                 d_fd_macros="$undef"
13176         fi
13177 fi
13178 $rm_try
13179
13180 : see if fgetpos exists
13181 set fgetpos d_fgetpos
13182 eval $inlibc
13183
13184 : see if finite exists
13185 set finite d_finite
13186 eval $inlibc
13187
13188 : see if finitel exists
13189 set finitel d_finitel
13190 eval $inlibc
13191
13192 : see if flock exists
13193 set flock d_flock
13194 eval $inlibc
13195
13196 : see if prototype for flock is available
13197 echo " "
13198 set d_flockproto flock $i_sysfile sys/file.h
13199 eval $hasproto
13200
13201 : see if fp_class exists
13202 set fp_class d_fp_class
13203 eval $inlibc
13204
13205 : see if pathconf exists
13206 set pathconf d_pathconf
13207 eval $inlibc
13208
13209 : see if fpathconf exists
13210 set fpathconf d_fpathconf
13211 eval $inlibc
13212
13213 : see if fpclass exists
13214 set fpclass d_fpclass
13215 eval $inlibc
13216
13217 : see if fpclassify exists
13218 set fpclassify d_fpclassify
13219 eval $inlibc
13220
13221 : see if fpclassl exists
13222 set fpclassl d_fpclassl
13223 eval $inlibc
13224
13225 : check for fpos64_t
13226 echo " "
13227 echo "Checking to see if you have fpos64_t..." >&4
13228 $cat >try.c <<EOCP
13229 #include <stdio.h>
13230 int main() { fpos64_t x = 7; }
13231 EOCP
13232 set try
13233 if eval $compile; then
13234         val="$define"
13235         echo "You have fpos64_t."
13236 else
13237         val="$undef"
13238         echo "You do not have fpos64_t."
13239         case "$fpossize" in
13240         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13241         esac
13242 fi
13243 $rm_try
13244 set d_fpos64_t
13245 eval $setvar
13246
13247 : see if frexpl exists
13248 set frexpl d_frexpl
13249 eval $inlibc
13250
13251 : see if this is a sys/param system
13252 set sys/param.h i_sysparam
13253 eval $inhdr
13254
13255 : see if this is a sys/mount.h system
13256 set sys/mount.h i_sysmount
13257 eval $inhdr
13258
13259 : Check for fs_data_s
13260 echo " "
13261 echo "Checking to see if your system supports struct fs_data..." >&4
13262 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13263 eval $hasstruct
13264 case "$d_fs_data_s" in
13265 "$define")      echo "Yes, it does."   ;;
13266 *)              echo "No, it doesn't." ;;
13267 esac
13268
13269 : see if fseeko exists
13270 set fseeko d_fseeko
13271 eval $inlibc
13272 case "$longsize" in
13273 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13274 esac
13275
13276 : see if fsetpos exists
13277 set fsetpos d_fsetpos
13278 eval $inlibc
13279
13280 : see if fstatfs exists
13281 set fstatfs d_fstatfs
13282 eval $inlibc
13283
13284 : see if statvfs exists
13285 set statvfs d_statvfs
13286 eval $inlibc
13287
13288 : see if fstatvfs exists
13289 set fstatvfs d_fstatvfs
13290 eval $inlibc
13291
13292
13293 : see if fsync exists
13294 set fsync d_fsync
13295 eval $inlibc
13296
13297 : see if ftello exists
13298 set ftello d_ftello
13299 eval $inlibc
13300 case "$longsize" in
13301 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13302 esac
13303
13304 : check for a working futimes
13305 d_futimes="$undef"
13306 echo " "
13307 echo "Checking if you have a working futimes()" >&4
13308 $cat >try.c <<EOCP
13309 #include <stdio.h>
13310 #include <sys/time.h>
13311 #include <errno.h>
13312 #include <fcntl.h>
13313
13314 int main ()
13315 {
13316     int fd, rv;
13317     fd = open ("try.c", O_RDWR);
13318     if (-1 == fd) exit (1);
13319     rv = futimes (fd, NULL);
13320     exit (rv == -1 ? errno : 0);
13321 }
13322 EOCP
13323 set try
13324 if eval $compile; then
13325     `$run ./try`
13326     rc=$?
13327     case "$rc" in
13328         0)  echo "Yes, you have" >&4
13329             d_futimes="$define"
13330             ;;
13331         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13332             ;;
13333     esac
13334 else
13335     echo "No, it does not (probably harmless)" >&4
13336 fi
13337 $rm_try
13338
13339 : see if ndbm.h is available
13340 set ndbm.h i_ndbm
13341 eval $inhdr
13342 : Compatibility location for RedHat 7.1
13343 set gdbm/ndbm.h i_gdbmndbm
13344 eval $inhdr
13345 : Compatibility location for Debian 4.0
13346 set gdbm-ndbm.h i_gdbm_ndbm
13347 eval $inhdr
13348
13349 val="$undef"
13350 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13351         : see if dbm_open exists
13352         set dbm_open d_dbm_open
13353         eval $inlibc
13354         case "$d_dbm_open" in
13355         $undef)
13356                 i_ndbm="$undef"
13357                 i_gdbmndbm="$undef"
13358                 i_gdbm_ndbm="$undef"
13359                 echo "We won't be including <ndbm.h>"
13360                 val="$undef"
13361                 ;;
13362         *) val="$define"
13363            ;;
13364         esac
13365 fi
13366 set d_ndbm
13367 eval $setvar
13368
13369 ndbm_hdr_protochk='name=$1; hdr=$2;
13370 eval "ihdr=\$""i_$name";
13371 val="$undef";
13372 if $test "$ihdr" = "$define"; then
13373         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13374         case "$d_cplusplus" in
13375         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13376         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13377         esac;
13378         case "$val" in
13379         $define) $echo "Your <$hdr> seems to have prototypes";;
13380         *) $echo "Your <$hdr> does not seem to have prototypes";;
13381         esac;
13382 fi;
13383 set "d_${name}_h_uses_prototypes";
13384 eval $setvar'
13385
13386 set ndbm ndbm.h
13387 eval $ndbm_hdr_protochk
13388 set gdbmndbm gdbm/ndbm.h
13389 eval $ndbm_hdr_protochk
13390 set gdbm_ndbm gdbm-ndbm.h
13391 eval $ndbm_hdr_protochk
13392
13393 : see if getaddrinfo exists
13394 set getaddrinfo d_getaddrinfo
13395 eval $inlibc
13396
13397 : see if getcwd exists
13398 set getcwd d_getcwd
13399 eval $inlibc
13400
13401 : see if getespwnam exists
13402 set getespwnam d_getespwnam
13403 eval $inlibc
13404
13405 : see if getfsstat exists
13406 set getfsstat d_getfsstat
13407 eval $inlibc
13408
13409 : see if getgrent exists
13410 set getgrent d_getgrent
13411 eval $inlibc
13412
13413 : see if getgrent_r exists
13414 set getgrent_r d_getgrent_r
13415 eval $inlibc
13416 case "$d_getgrent_r" in
13417 "$define")
13418         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13419         case "$d_getgrent_r_proto:$usethreads" in
13420         ":define")      d_getgrent_r_proto=define
13421                 set d_getgrent_r_proto getgrent_r $hdrs
13422                 eval $hasproto ;;
13423         *)      ;;
13424         esac
13425         case "$d_getgrent_r_proto" in
13426         define)
13427         case "$getgrent_r_proto" in
13428         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13429         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13430         esac
13431         case "$getgrent_r_proto" in
13432         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13433         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13434         esac
13435         case "$getgrent_r_proto" in
13436         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13437         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13438         esac
13439         case "$getgrent_r_proto" in
13440         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13441         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13442         esac
13443         case "$getgrent_r_proto" in
13444         ''|0) try='int getgrent_r(struct group*, char*, int);'
13445         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13446         esac
13447         case "$getgrent_r_proto" in
13448         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13449         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13450         esac
13451         case "$getgrent_r_proto" in
13452         ''|0)   d_getgrent_r=undef
13453                 getgrent_r_proto=0
13454                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13455         * )     case "$getgrent_r_proto" in
13456                 REENTRANT_PROTO*) ;;
13457                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13458                 esac
13459                 echo "Prototype: $try" ;;
13460         esac
13461         ;;
13462         *)      case "$usethreads" in
13463                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13464                 esac
13465                 d_getgrent_r=undef
13466                 getgrent_r_proto=0
13467                 ;;
13468         esac
13469         ;;
13470 *)      getgrent_r_proto=0
13471         ;;
13472 esac
13473
13474 : see if getgrgid_r exists
13475 set getgrgid_r d_getgrgid_r
13476 eval $inlibc
13477 case "$d_getgrgid_r" in
13478 "$define")
13479         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13480         case "$d_getgrgid_r_proto:$usethreads" in
13481         ":define")      d_getgrgid_r_proto=define
13482                 set d_getgrgid_r_proto getgrgid_r $hdrs
13483                 eval $hasproto ;;
13484         *)      ;;
13485         esac
13486         case "$d_getgrgid_r_proto" in
13487         define)
13488         case "$getgrgid_r_proto" in
13489         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13490         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13491         esac
13492         case "$getgrgid_r_proto" in
13493         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13494         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13495         esac
13496         case "$getgrgid_r_proto" in
13497         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13498         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13499         esac
13500         case "$getgrgid_r_proto" in
13501         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13502         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13503         esac
13504         case "$getgrgid_r_proto" in
13505         ''|0)   d_getgrgid_r=undef
13506                 getgrgid_r_proto=0
13507                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13508         * )     case "$getgrgid_r_proto" in
13509                 REENTRANT_PROTO*) ;;
13510                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13511                 esac
13512                 echo "Prototype: $try" ;;
13513         esac
13514         ;;
13515         *)      case "$usethreads" in
13516                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13517                 esac
13518                 d_getgrgid_r=undef
13519                 getgrgid_r_proto=0
13520                 ;;
13521         esac
13522         ;;
13523 *)      getgrgid_r_proto=0
13524         ;;
13525 esac
13526
13527 : see if getgrnam_r exists
13528 set getgrnam_r d_getgrnam_r
13529 eval $inlibc
13530 case "$d_getgrnam_r" in
13531 "$define")
13532         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13533         case "$d_getgrnam_r_proto:$usethreads" in
13534         ":define")      d_getgrnam_r_proto=define
13535                 set d_getgrnam_r_proto getgrnam_r $hdrs
13536                 eval $hasproto ;;
13537         *)      ;;
13538         esac
13539         case "$d_getgrnam_r_proto" in
13540         define)
13541         case "$getgrnam_r_proto" in
13542         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13543         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13544         esac
13545         case "$getgrnam_r_proto" in
13546         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13547         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13548         esac
13549         case "$getgrnam_r_proto" in
13550         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13551         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13552         esac
13553         case "$getgrnam_r_proto" in
13554         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13555         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13556         esac
13557         case "$getgrnam_r_proto" in
13558         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13559         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13560         esac
13561         case "$getgrnam_r_proto" in
13562         ''|0)   d_getgrnam_r=undef
13563                 getgrnam_r_proto=0
13564                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13565         * )     case "$getgrnam_r_proto" in
13566                 REENTRANT_PROTO*) ;;
13567                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13568                 esac
13569                 echo "Prototype: $try" ;;
13570         esac
13571         ;;
13572         *)      case "$usethreads" in
13573                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13574                 esac
13575                 d_getgrnam_r=undef
13576                 getgrnam_r_proto=0
13577                 ;;
13578         esac
13579         ;;
13580 *)      getgrnam_r_proto=0
13581         ;;
13582 esac
13583
13584 : see if gethostbyaddr exists
13585 set gethostbyaddr d_gethbyaddr
13586 eval $inlibc
13587
13588 : see if gethostbyname exists
13589 set gethostbyname d_gethbyname
13590 eval $inlibc
13591
13592 : see if gethostent exists
13593 set gethostent d_gethent
13594 eval $inlibc
13595
13596 : see how we will look up host name
13597 echo " "
13598 call=''
13599 if set gethostname val -f d_gethname; eval $csym; $val; then
13600         echo 'gethostname() found.' >&4
13601         d_gethname="$define"
13602         call=gethostname
13603 fi
13604 if set uname val -f d_uname; eval $csym; $val; then
13605         if ./xenix; then
13606                 $cat <<'EOM'
13607 uname() was found, but you're running xenix, and older versions of xenix
13608 have a broken uname(). If you don't really know whether your xenix is old
13609 enough to have a broken system call, use the default answer.
13610
13611 EOM
13612                 dflt=y
13613                 case "$d_uname" in
13614                 "$define") dflt=n;;
13615                 esac
13616                 rp='Is your uname() broken?'
13617                 . ./myread
13618                 case "$ans" in
13619                 n*) d_uname="$define"; call=uname;;
13620                 esac
13621         else
13622                 echo 'uname() found.' >&4
13623                 d_uname="$define"
13624                 case "$call" in
13625                 '') call=uname ;;
13626                 esac
13627         fi
13628 fi
13629 case "$d_gethname" in
13630 '') d_gethname="$undef";;
13631 esac
13632 case "$d_uname" in
13633 '') d_uname="$undef";;
13634 esac
13635 case "$d_uname$d_gethname" in
13636 *define*)
13637         dflt=n
13638         cat <<EOM
13639
13640 Every now and then someone has a $call() that lies about the hostname
13641 but can't be fixed for political or economic reasons.  If you wish, I can
13642 pretend $call() isn't there and maybe compute hostname at run-time
13643 thanks to the '$phostname' command.
13644
13645 EOM
13646         rp="Shall I ignore $call() from now on?"
13647         . ./myread
13648         case "$ans" in
13649         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13650         esac;;
13651 esac
13652 case "$phostname" in
13653 '') aphostname='';;
13654 *) case "$aphostname" in
13655         /*) ;;
13656         *) set X $phostname
13657                 shift
13658                 file=$1
13659                 shift
13660                 file=`./loc $file $file $pth`
13661                 aphostname=`echo $file $*`
13662                 ;;
13663         esac
13664         ;;
13665 esac
13666 case "$d_uname$d_gethname" in
13667 *define*) ;;
13668 *)
13669         case "$phostname" in
13670         '')
13671                 echo "There will be no way for $package to get your hostname." >&4;;
13672         *)
13673         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13674                 ;;
13675         esac;;
13676 esac
13677 case "$d_phostname" in
13678 '') d_phostname="$undef";;
13679 esac
13680
13681 : see if gethostbyaddr_r exists
13682 set gethostbyaddr_r d_gethostbyaddr_r
13683 eval $inlibc
13684 case "$d_gethostbyaddr_r" in
13685 "$define")
13686         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13687         case "$d_gethostbyaddr_r_proto:$usethreads" in
13688         ":define")      d_gethostbyaddr_r_proto=define
13689                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13690                 eval $hasproto ;;
13691         *)      ;;
13692         esac
13693         case "$d_gethostbyaddr_r_proto" in
13694         define)
13695         case "$gethostbyaddr_r_proto" in
13696         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13697         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13698         esac
13699         case "$gethostbyaddr_r_proto" in
13700         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13701         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13702         esac
13703         case "$gethostbyaddr_r_proto" in
13704         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13705         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13706         esac
13707         case "$gethostbyaddr_r_proto" in
13708         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13709         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13710         esac
13711         case "$gethostbyaddr_r_proto" in
13712         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13713         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13714         esac
13715         case "$gethostbyaddr_r_proto" in
13716         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13717         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13718         esac
13719         case "$gethostbyaddr_r_proto" in
13720         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13721         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13722         esac
13723         case "$gethostbyaddr_r_proto" in
13724         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13725         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13726         esac
13727         case "$gethostbyaddr_r_proto" in
13728         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13729         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13730         esac
13731         case "$gethostbyaddr_r_proto" in
13732         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13733         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13734         esac
13735         case "$gethostbyaddr_r_proto" in
13736         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13737         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13738         esac
13739         case "$gethostbyaddr_r_proto" in
13740         ''|0)   d_gethostbyaddr_r=undef
13741                 gethostbyaddr_r_proto=0
13742                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13743         * )     case "$gethostbyaddr_r_proto" in
13744                 REENTRANT_PROTO*) ;;
13745                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13746                 esac
13747                 echo "Prototype: $try" ;;
13748         esac
13749         ;;
13750         *)      case "$usethreads" in
13751                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13752                 esac
13753                 d_gethostbyaddr_r=undef
13754                 gethostbyaddr_r_proto=0
13755                 ;;
13756         esac
13757         ;;
13758 *)      gethostbyaddr_r_proto=0
13759         ;;
13760 esac
13761
13762 : see if gethostbyname_r exists
13763 set gethostbyname_r d_gethostbyname_r
13764 eval $inlibc
13765 case "$d_gethostbyname_r" in
13766 "$define")
13767         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13768         case "$d_gethostbyname_r_proto:$usethreads" in
13769         ":define")      d_gethostbyname_r_proto=define
13770                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13771                 eval $hasproto ;;
13772         *)      ;;
13773         esac
13774         case "$d_gethostbyname_r_proto" in
13775         define)
13776         case "$gethostbyname_r_proto" in
13777         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13778         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13779         esac
13780         case "$gethostbyname_r_proto" in
13781         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13782         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13783         esac
13784         case "$gethostbyname_r_proto" in
13785         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13786         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13787         esac
13788         case "$gethostbyname_r_proto" in
13789         ''|0)   d_gethostbyname_r=undef
13790                 gethostbyname_r_proto=0
13791                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13792         * )     case "$gethostbyname_r_proto" in
13793                 REENTRANT_PROTO*) ;;
13794                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13795                 esac
13796                 echo "Prototype: $try" ;;
13797         esac
13798         ;;
13799         *)      case "$usethreads" in
13800                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13801                 esac
13802                 d_gethostbyname_r=undef
13803                 gethostbyname_r_proto=0
13804                 ;;
13805         esac
13806         ;;
13807 *)      gethostbyname_r_proto=0
13808         ;;
13809 esac
13810
13811 : see if gethostent_r exists
13812 set gethostent_r d_gethostent_r
13813 eval $inlibc
13814 case "$d_gethostent_r" in
13815 "$define")
13816         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13817         case "$d_gethostent_r_proto:$usethreads" in
13818         ":define")      d_gethostent_r_proto=define
13819                 set d_gethostent_r_proto gethostent_r $hdrs
13820                 eval $hasproto ;;
13821         *)      ;;
13822         esac
13823         case "$d_gethostent_r_proto" in
13824         define)
13825         case "$gethostent_r_proto" in
13826         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13827         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13828         esac
13829         case "$gethostent_r_proto" in
13830         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13831         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13832         esac
13833         case "$gethostent_r_proto" in
13834         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13835         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13836         esac
13837         case "$gethostent_r_proto" in
13838         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13839         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13840         esac
13841         case "$gethostent_r_proto" in
13842         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13843         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13844         esac
13845         case "$gethostent_r_proto" in
13846         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13847         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13848         esac
13849         case "$gethostent_r_proto" in
13850         ''|0)   d_gethostent_r=undef
13851                 gethostent_r_proto=0
13852                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13853         * )     case "$gethostent_r_proto" in
13854                 REENTRANT_PROTO*) ;;
13855                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13856                 esac
13857                 echo "Prototype: $try" ;;
13858         esac
13859         ;;
13860         *)      case "$usethreads" in
13861                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13862                 esac
13863                 d_gethostent_r=undef
13864                 gethostent_r_proto=0
13865                 ;;
13866         esac
13867         ;;
13868 *)      gethostent_r_proto=0
13869         ;;
13870 esac
13871
13872 : see if prototypes for various gethostxxx netdb.h functions are available
13873 echo " "
13874 set d_gethostprotos gethostent $i_netdb netdb.h
13875 eval $hasproto
13876
13877 : see if getitimer exists
13878 set getitimer d_getitimer
13879 eval $inlibc
13880
13881 : see if getlogin exists
13882 set getlogin d_getlogin
13883 eval $inlibc
13884
13885 : see if getlogin_r exists
13886 set getlogin_r d_getlogin_r
13887 eval $inlibc
13888 case "$d_getlogin_r" in
13889 "$define")
13890         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13891         case "$d_getlogin_r_proto:$usethreads" in
13892         ":define")      d_getlogin_r_proto=define
13893                 set d_getlogin_r_proto getlogin_r $hdrs
13894                 eval $hasproto ;;
13895         *)      ;;
13896         esac
13897         case "$d_getlogin_r_proto" in
13898         define)
13899         case "$getlogin_r_proto" in
13900         ''|0) try='int getlogin_r(char*, size_t);'
13901         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13902         esac
13903         case "$getlogin_r_proto" in
13904         ''|0) try='int getlogin_r(char*, int);'
13905         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13906         esac
13907         case "$getlogin_r_proto" in
13908         ''|0) try='char* getlogin_r(char*, size_t);'
13909         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13910         esac
13911         case "$getlogin_r_proto" in
13912         ''|0) try='char* getlogin_r(char*, int);'
13913         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13914         esac
13915         case "$getlogin_r_proto" in
13916         ''|0)   d_getlogin_r=undef
13917                 getlogin_r_proto=0
13918                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13919         * )     case "$getlogin_r_proto" in
13920                 REENTRANT_PROTO*) ;;
13921                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13922                 esac
13923                 echo "Prototype: $try" ;;
13924         esac
13925         ;;
13926         *)      case "$usethreads" in
13927                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13928                 esac
13929                 d_getlogin_r=undef
13930                 getlogin_r_proto=0
13931                 ;;
13932         esac
13933         ;;
13934 *)      getlogin_r_proto=0
13935         ;;
13936 esac
13937
13938 : see if getmnt exists
13939 set getmnt d_getmnt
13940 eval $inlibc
13941
13942 : see if getmntent exists
13943 set getmntent d_getmntent
13944 eval $inlibc
13945
13946 : see if getnameinfo exists
13947 set getnameinfo d_getnameinfo
13948 eval $inlibc
13949
13950 : see if getnetbyaddr exists
13951 set getnetbyaddr d_getnbyaddr
13952 eval $inlibc
13953
13954 : see if getnetbyname exists
13955 set getnetbyname d_getnbyname
13956 eval $inlibc
13957
13958 : see if getnetent exists
13959 set getnetent d_getnent
13960 eval $inlibc
13961
13962 : see if getnetbyaddr_r exists
13963 set getnetbyaddr_r d_getnetbyaddr_r
13964 eval $inlibc
13965 case "$d_getnetbyaddr_r" in
13966 "$define")
13967         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13968         case "$d_getnetbyaddr_r_proto:$usethreads" in
13969         ":define")      d_getnetbyaddr_r_proto=define
13970                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13971                 eval $hasproto ;;
13972         *)      ;;
13973         esac
13974         case "$d_getnetbyaddr_r_proto" in
13975         define)
13976         case "$getnetbyaddr_r_proto" in
13977         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13978         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13979         esac
13980         case "$getnetbyaddr_r_proto" in
13981         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13982         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13983         esac
13984         case "$getnetbyaddr_r_proto" in
13985         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13986         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13987         esac
13988         case "$getnetbyaddr_r_proto" in
13989         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13990         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13991         esac
13992         case "$getnetbyaddr_r_proto" in
13993         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13994         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13995         esac
13996         case "$getnetbyaddr_r_proto" in
13997         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13998         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13999         esac
14000         case "$getnetbyaddr_r_proto" in
14001         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14002         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14003         esac
14004         case "$getnetbyaddr_r_proto" in
14005         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14006         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14007         esac
14008         case "$getnetbyaddr_r_proto" in
14009         ''|0)   d_getnetbyaddr_r=undef
14010                 getnetbyaddr_r_proto=0
14011                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14012         * )     case "$getnetbyaddr_r_proto" in
14013                 REENTRANT_PROTO*) ;;
14014                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14015                 esac
14016                 echo "Prototype: $try" ;;
14017         esac
14018         ;;
14019         *)      case "$usethreads" in
14020                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14021                 esac
14022                 d_getnetbyaddr_r=undef
14023                 getnetbyaddr_r_proto=0
14024                 ;;
14025         esac
14026         ;;
14027 *)      getnetbyaddr_r_proto=0
14028         ;;
14029 esac
14030
14031 : see if getnetbyname_r exists
14032 set getnetbyname_r d_getnetbyname_r
14033 eval $inlibc
14034 case "$d_getnetbyname_r" in
14035 "$define")
14036         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14037         case "$d_getnetbyname_r_proto:$usethreads" in
14038         ":define")      d_getnetbyname_r_proto=define
14039                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14040                 eval $hasproto ;;
14041         *)      ;;
14042         esac
14043         case "$d_getnetbyname_r_proto" in
14044         define)
14045         case "$getnetbyname_r_proto" in
14046         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14047         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14048         esac
14049         case "$getnetbyname_r_proto" in
14050         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14051         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14052         esac
14053         case "$getnetbyname_r_proto" in
14054         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14055         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14056         esac
14057         case "$getnetbyname_r_proto" in
14058         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14059         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14060         esac
14061         case "$getnetbyname_r_proto" in
14062         ''|0)   d_getnetbyname_r=undef
14063                 getnetbyname_r_proto=0
14064                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14065         * )     case "$getnetbyname_r_proto" in
14066                 REENTRANT_PROTO*) ;;
14067                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14068                 esac
14069                 echo "Prototype: $try" ;;
14070         esac
14071         ;;
14072         *)      case "$usethreads" in
14073                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14074                 esac
14075                 d_getnetbyname_r=undef
14076                 getnetbyname_r_proto=0
14077                 ;;
14078         esac
14079         ;;
14080 *)      getnetbyname_r_proto=0
14081         ;;
14082 esac
14083
14084 : see if getnetent_r exists
14085 set getnetent_r d_getnetent_r
14086 eval $inlibc
14087 case "$d_getnetent_r" in
14088 "$define")
14089         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14090         case "$d_getnetent_r_proto:$usethreads" in
14091         ":define")      d_getnetent_r_proto=define
14092                 set d_getnetent_r_proto getnetent_r $hdrs
14093                 eval $hasproto ;;
14094         *)      ;;
14095         esac
14096         case "$d_getnetent_r_proto" in
14097         define)
14098         case "$getnetent_r_proto" in
14099         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14100         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14101         esac
14102         case "$getnetent_r_proto" in
14103         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14104         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14105         esac
14106         case "$getnetent_r_proto" in
14107         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14108         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14109         esac
14110         case "$getnetent_r_proto" in
14111         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14112         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14113         esac
14114         case "$getnetent_r_proto" in
14115         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14116         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14117         esac
14118         case "$getnetent_r_proto" in
14119         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14120         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14121         esac
14122         case "$getnetent_r_proto" in
14123         ''|0)   d_getnetent_r=undef
14124                 getnetent_r_proto=0
14125                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14126         * )     case "$getnetent_r_proto" in
14127                 REENTRANT_PROTO*) ;;
14128                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14129                 esac
14130                 echo "Prototype: $try" ;;
14131         esac
14132         ;;
14133         *)      case "$usethreads" in
14134                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14135                 esac
14136                 d_getnetent_r=undef
14137                 getnetent_r_proto=0
14138                 ;;
14139         esac
14140         ;;
14141 *)      getnetent_r_proto=0
14142         ;;
14143 esac
14144
14145 : see if prototypes for various getnetxxx netdb.h functions are available
14146 echo " "
14147 set d_getnetprotos getnetent $i_netdb netdb.h
14148 eval $hasproto
14149
14150 : see if getpagesize exists
14151 set getpagesize d_getpagsz
14152 eval $inlibc
14153
14154 : Optional checks for getprotobyname and getprotobynumber
14155
14156 : see if getprotobyname exists
14157 set getprotobyname d_getpbyname
14158 eval $inlibc
14159
14160 : see if getprotobynumber exists
14161 set getprotobynumber d_getpbynumber
14162 eval $inlibc
14163
14164 : see if getprotoent exists
14165 set getprotoent d_getpent
14166 eval $inlibc
14167
14168 : see if getpgid exists
14169 set getpgid d_getpgid
14170 eval $inlibc
14171
14172 : see if getpgrp2 exists
14173 set getpgrp2 d_getpgrp2
14174 eval $inlibc
14175
14176 : see if getppid exists
14177 set getppid d_getppid
14178 eval $inlibc
14179
14180 : see if getpriority exists
14181 set getpriority d_getprior
14182 eval $inlibc
14183
14184 : see if getprotobyname_r exists
14185 set getprotobyname_r d_getprotobyname_r
14186 eval $inlibc
14187 case "$d_getprotobyname_r" in
14188 "$define")
14189         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14190         case "$d_getprotobyname_r_proto:$usethreads" in
14191         ":define")      d_getprotobyname_r_proto=define
14192                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14193                 eval $hasproto ;;
14194         *)      ;;
14195         esac
14196         case "$d_getprotobyname_r_proto" in
14197         define)
14198         case "$getprotobyname_r_proto" in
14199         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14200         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14201         esac
14202         case "$getprotobyname_r_proto" in
14203         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14204         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14205         esac
14206         case "$getprotobyname_r_proto" in
14207         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14208         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14209         esac
14210         case "$getprotobyname_r_proto" in
14211         ''|0)   d_getprotobyname_r=undef
14212                 getprotobyname_r_proto=0
14213                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14214         * )     case "$getprotobyname_r_proto" in
14215                 REENTRANT_PROTO*) ;;
14216                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14217                 esac
14218                 echo "Prototype: $try" ;;
14219         esac
14220         ;;
14221         *)      case "$usethreads" in
14222                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14223                 esac
14224                 d_getprotobyname_r=undef
14225                 getprotobyname_r_proto=0
14226                 ;;
14227         esac
14228         ;;
14229 *)      getprotobyname_r_proto=0
14230         ;;
14231 esac
14232
14233 : see if getprotobynumber_r exists
14234 set getprotobynumber_r d_getprotobynumber_r
14235 eval $inlibc
14236 case "$d_getprotobynumber_r" in
14237 "$define")
14238         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14239         case "$d_getprotobynumber_r_proto:$usethreads" in
14240         ":define")      d_getprotobynumber_r_proto=define
14241                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14242                 eval $hasproto ;;
14243         *)      ;;
14244         esac
14245         case "$d_getprotobynumber_r_proto" in
14246         define)
14247         case "$getprotobynumber_r_proto" in
14248         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14249         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14250         esac
14251         case "$getprotobynumber_r_proto" in
14252         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14253         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14254         esac
14255         case "$getprotobynumber_r_proto" in
14256         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14257         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14258         esac
14259         case "$getprotobynumber_r_proto" in
14260         ''|0)   d_getprotobynumber_r=undef
14261                 getprotobynumber_r_proto=0
14262                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14263         * )     case "$getprotobynumber_r_proto" in
14264                 REENTRANT_PROTO*) ;;
14265                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14266                 esac
14267                 echo "Prototype: $try" ;;
14268         esac
14269         ;;
14270         *)      case "$usethreads" in
14271                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14272                 esac
14273                 d_getprotobynumber_r=undef
14274                 getprotobynumber_r_proto=0
14275                 ;;
14276         esac
14277         ;;
14278 *)      getprotobynumber_r_proto=0
14279         ;;
14280 esac
14281
14282 : see if getprotoent_r exists
14283 set getprotoent_r d_getprotoent_r
14284 eval $inlibc
14285 case "$d_getprotoent_r" in
14286 "$define")
14287         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14288         case "$d_getprotoent_r_proto:$usethreads" in
14289         ":define")      d_getprotoent_r_proto=define
14290                 set d_getprotoent_r_proto getprotoent_r $hdrs
14291                 eval $hasproto ;;
14292         *)      ;;
14293         esac
14294         case "$d_getprotoent_r_proto" in
14295         define)
14296         case "$getprotoent_r_proto" in
14297         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14298         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14299         esac
14300         case "$getprotoent_r_proto" in
14301         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14302         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14303         esac
14304         case "$getprotoent_r_proto" in
14305         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14306         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14307         esac
14308         case "$getprotoent_r_proto" in
14309         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14310         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14311         esac
14312         case "$getprotoent_r_proto" in
14313         ''|0)   d_getprotoent_r=undef
14314                 getprotoent_r_proto=0
14315                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14316         * )     case "$getprotoent_r_proto" in
14317                 REENTRANT_PROTO*) ;;
14318                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14319                 esac
14320                 echo "Prototype: $try" ;;
14321         esac
14322         ;;
14323         *)      case "$usethreads" in
14324                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14325                 esac
14326                 d_getprotoent_r=undef
14327                 getprotoent_r_proto=0
14328                 ;;
14329         esac
14330         ;;
14331 *)      getprotoent_r_proto=0
14332         ;;
14333 esac
14334
14335 : see if prototypes for various getprotoxxx netdb.h functions are available
14336 echo " "
14337 set d_getprotoprotos getprotoent $i_netdb netdb.h
14338 eval $hasproto
14339
14340 : see if getprpwnam exists
14341 set getprpwnam d_getprpwnam
14342 eval $inlibc
14343
14344 : see if getpwent exists
14345 set getpwent d_getpwent
14346 eval $inlibc
14347
14348 : see if getpwent_r exists
14349 set getpwent_r d_getpwent_r
14350 eval $inlibc
14351 case "$d_getpwent_r" in
14352 "$define")
14353         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14354         case "$d_getpwent_r_proto:$usethreads" in
14355         ":define")      d_getpwent_r_proto=define
14356                 set d_getpwent_r_proto getpwent_r $hdrs
14357                 eval $hasproto ;;
14358         *)      ;;
14359         esac
14360         case "$d_getpwent_r_proto" in
14361         define)
14362         case "$getpwent_r_proto" in
14363         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14364         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14365         esac
14366         case "$getpwent_r_proto" in
14367         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14368         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14369         esac
14370         case "$getpwent_r_proto" in
14371         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14372         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14373         esac
14374         case "$getpwent_r_proto" in
14375         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14376         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14377         esac
14378         case "$getpwent_r_proto" in
14379         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14380         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14381         esac
14382         case "$getpwent_r_proto" in
14383         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14384         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14385         esac
14386         case "$getpwent_r_proto" in
14387         ''|0)   d_getpwent_r=undef
14388                 getpwent_r_proto=0
14389                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14390         * )     case "$getpwent_r_proto" in
14391                 REENTRANT_PROTO*) ;;
14392                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14393                 esac
14394                 echo "Prototype: $try" ;;
14395         esac
14396         ;;
14397         *)      case "$usethreads" in
14398                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14399                 esac
14400                 d_getpwent_r=undef
14401                 getpwent_r_proto=0
14402                 ;;
14403         esac
14404         ;;
14405 *)      getpwent_r_proto=0
14406         ;;
14407 esac
14408
14409 : see if getpwnam_r exists
14410 set getpwnam_r d_getpwnam_r
14411 eval $inlibc
14412 case "$d_getpwnam_r" in
14413 "$define")
14414         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14415         case "$d_getpwnam_r_proto:$usethreads" in
14416         ":define")      d_getpwnam_r_proto=define
14417                 set d_getpwnam_r_proto getpwnam_r $hdrs
14418                 eval $hasproto ;;
14419         *)      ;;
14420         esac
14421         case "$d_getpwnam_r_proto" in
14422         define)
14423         case "$getpwnam_r_proto" in
14424         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14425         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14426         esac
14427         case "$getpwnam_r_proto" in
14428         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14429         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14430         esac
14431         case "$getpwnam_r_proto" in
14432         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14433         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14434         esac
14435         case "$getpwnam_r_proto" in
14436         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14437         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14438         esac
14439         case "$getpwnam_r_proto" in
14440         ''|0)   d_getpwnam_r=undef
14441                 getpwnam_r_proto=0
14442                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14443         * )     case "$getpwnam_r_proto" in
14444                 REENTRANT_PROTO*) ;;
14445                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14446                 esac
14447                 echo "Prototype: $try" ;;
14448         esac
14449         ;;
14450         *)      case "$usethreads" in
14451                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14452                 esac
14453                 d_getpwnam_r=undef
14454                 getpwnam_r_proto=0
14455                 ;;
14456         esac
14457         ;;
14458 *)      getpwnam_r_proto=0
14459         ;;
14460 esac
14461
14462 : see if getpwuid_r exists
14463 set getpwuid_r d_getpwuid_r
14464 eval $inlibc
14465 case "$d_getpwuid_r" in
14466 "$define")
14467         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14468         case "$d_getpwuid_r_proto:$usethreads" in
14469         ":define")      d_getpwuid_r_proto=define
14470                 set d_getpwuid_r_proto getpwuid_r $hdrs
14471                 eval $hasproto ;;
14472         *)      ;;
14473         esac
14474         case "$d_getpwuid_r_proto" in
14475         define)
14476         case "$getpwuid_r_proto" in
14477         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14478         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14479         esac
14480         case "$getpwuid_r_proto" in
14481         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14482         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14483         esac
14484         case "$getpwuid_r_proto" in
14485         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14486         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14487         esac
14488         case "$getpwuid_r_proto" in
14489         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14490         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14491         esac
14492         case "$getpwuid_r_proto" in
14493         ''|0)   d_getpwuid_r=undef
14494                 getpwuid_r_proto=0
14495                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14496         * )     case "$getpwuid_r_proto" in
14497                 REENTRANT_PROTO*) ;;
14498                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14499                 esac
14500                 echo "Prototype: $try" ;;
14501         esac
14502         ;;
14503         *)      case "$usethreads" in
14504                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14505                 esac
14506                 d_getpwuid_r=undef
14507                 getpwuid_r_proto=0
14508                 ;;
14509         esac
14510         ;;
14511 *)      getpwuid_r_proto=0
14512         ;;
14513 esac
14514
14515 : Optional checks for getsbyname and getsbyport
14516
14517 : see if getservbyname exists
14518 set getservbyname d_getsbyname
14519 eval $inlibc
14520
14521 : see if getservbyport exists
14522 set getservbyport d_getsbyport
14523 eval $inlibc
14524
14525 : see if getservent exists
14526 set getservent d_getsent
14527 eval $inlibc
14528
14529 : see if getservbyname_r exists
14530 set getservbyname_r d_getservbyname_r
14531 eval $inlibc
14532 case "$d_getservbyname_r" in
14533 "$define")
14534         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14535         case "$d_getservbyname_r_proto:$usethreads" in
14536         ":define")      d_getservbyname_r_proto=define
14537                 set d_getservbyname_r_proto getservbyname_r $hdrs
14538                 eval $hasproto ;;
14539         *)      ;;
14540         esac
14541         case "$d_getservbyname_r_proto" in
14542         define)
14543         case "$getservbyname_r_proto" in
14544         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14545         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14546         esac
14547         case "$getservbyname_r_proto" in
14548         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14549         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14550         esac
14551         case "$getservbyname_r_proto" in
14552         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14553         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14554         esac
14555         case "$getservbyname_r_proto" in
14556         ''|0)   d_getservbyname_r=undef
14557                 getservbyname_r_proto=0
14558                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14559         * )     case "$getservbyname_r_proto" in
14560                 REENTRANT_PROTO*) ;;
14561                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14562                 esac
14563                 echo "Prototype: $try" ;;
14564         esac
14565         ;;
14566         *)      case "$usethreads" in
14567                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14568                 esac
14569                 d_getservbyname_r=undef
14570                 getservbyname_r_proto=0
14571                 ;;
14572         esac
14573         ;;
14574 *)      getservbyname_r_proto=0
14575         ;;
14576 esac
14577
14578 : see if getservbyport_r exists
14579 set getservbyport_r d_getservbyport_r
14580 eval $inlibc
14581 case "$d_getservbyport_r" in
14582 "$define")
14583         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14584         case "$d_getservbyport_r_proto:$usethreads" in
14585         ":define")      d_getservbyport_r_proto=define
14586                 set d_getservbyport_r_proto getservbyport_r $hdrs
14587                 eval $hasproto ;;
14588         *)      ;;
14589         esac
14590         case "$d_getservbyport_r_proto" in
14591         define)
14592         case "$getservbyport_r_proto" in
14593         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14594         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14595         esac
14596         case "$getservbyport_r_proto" in
14597         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14598         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14599         esac
14600         case "$getservbyport_r_proto" in
14601         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14602         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14603         esac
14604         case "$getservbyport_r_proto" in
14605         ''|0)   d_getservbyport_r=undef
14606                 getservbyport_r_proto=0
14607                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14608         * )     case "$getservbyport_r_proto" in
14609                 REENTRANT_PROTO*) ;;
14610                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14611                 esac
14612                 echo "Prototype: $try" ;;
14613         esac
14614         ;;
14615         *)      case "$usethreads" in
14616                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14617                 esac
14618                 d_getservbyport_r=undef
14619                 getservbyport_r_proto=0
14620                 ;;
14621         esac
14622         ;;
14623 *)      getservbyport_r_proto=0
14624         ;;
14625 esac
14626
14627 : see if getservent_r exists
14628 set getservent_r d_getservent_r
14629 eval $inlibc
14630 case "$d_getservent_r" in
14631 "$define")
14632         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14633         case "$d_getservent_r_proto:$usethreads" in
14634         ":define")      d_getservent_r_proto=define
14635                 set d_getservent_r_proto getservent_r $hdrs
14636                 eval $hasproto ;;
14637         *)      ;;
14638         esac
14639         case "$d_getservent_r_proto" in
14640         define)
14641         case "$getservent_r_proto" in
14642         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14643         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14644         esac
14645         case "$getservent_r_proto" in
14646         ''|0) try='int getservent_r(struct servent*, char*, int);'
14647         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14648         esac
14649         case "$getservent_r_proto" in
14650         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14651         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14652         esac
14653         case "$getservent_r_proto" in
14654         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14655         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14656         esac
14657         case "$getservent_r_proto" in
14658         ''|0)   d_getservent_r=undef
14659                 getservent_r_proto=0
14660                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14661         * )     case "$getservent_r_proto" in
14662                 REENTRANT_PROTO*) ;;
14663                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14664                 esac
14665                 echo "Prototype: $try" ;;
14666         esac
14667         ;;
14668         *)      case "$usethreads" in
14669                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14670                 esac
14671                 d_getservent_r=undef
14672                 getservent_r_proto=0
14673                 ;;
14674         esac
14675         ;;
14676 *)      getservent_r_proto=0
14677         ;;
14678 esac
14679
14680 : see if prototypes for various getservxxx netdb.h functions are available
14681 echo " "
14682 set d_getservprotos getservent $i_netdb netdb.h
14683 eval $hasproto
14684
14685 : see if getspnam exists
14686 set getspnam d_getspnam
14687 eval $inlibc
14688
14689 : see if this is a shadow.h system
14690 set shadow.h i_shadow
14691 eval $inhdr
14692
14693 : see if getspnam_r exists
14694 set getspnam_r d_getspnam_r
14695 eval $inlibc
14696 case "$d_getspnam_r" in
14697 "$define")
14698         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14699         case "$d_getspnam_r_proto:$usethreads" in
14700         ":define")      d_getspnam_r_proto=define
14701                 set d_getspnam_r_proto getspnam_r $hdrs
14702                 eval $hasproto ;;
14703         *)      ;;
14704         esac
14705         case "$d_getspnam_r_proto" in
14706         define)
14707         case "$getspnam_r_proto" in
14708         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14709         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14710         esac
14711         case "$getspnam_r_proto" in
14712         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14713         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14714         esac
14715         case "$getspnam_r_proto" in
14716         ''|0)   d_getspnam_r=undef
14717                 getspnam_r_proto=0
14718                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14719         * )     case "$getspnam_r_proto" in
14720                 REENTRANT_PROTO*) ;;
14721                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14722                 esac
14723                 echo "Prototype: $try" ;;
14724         esac
14725         ;;
14726         *)      case "$usethreads" in
14727                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14728                 esac
14729                 d_getspnam_r=undef
14730                 getspnam_r_proto=0
14731                 ;;
14732         esac
14733         ;;
14734 *)      getspnam_r_proto=0
14735         ;;
14736 esac
14737
14738 : see if gettimeofday or ftime exists
14739 set gettimeofday d_gettimeod
14740 eval $inlibc
14741 case "$d_gettimeod" in
14742 "$undef")
14743         set ftime d_ftime 
14744         eval $inlibc
14745         ;;
14746 *)
14747         val="$undef"; set d_ftime; eval $setvar
14748         ;;
14749 esac
14750 case "$d_gettimeod$d_ftime" in
14751 "$undef$undef")
14752         echo " "
14753         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14754         ;;
14755 esac
14756
14757 : see if gmtime_r exists
14758 set gmtime_r d_gmtime_r
14759 eval $inlibc
14760 case "$d_gmtime_r" in
14761 "$define")
14762         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14763         case "$d_gmtime_r_proto:$usethreads" in
14764         ":define")      d_gmtime_r_proto=define
14765                 set d_gmtime_r_proto gmtime_r $hdrs
14766                 eval $hasproto ;;
14767         *)      ;;
14768         esac
14769         case "$d_gmtime_r_proto" in
14770         define)
14771         case "$gmtime_r_proto" in
14772         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14773         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14774         esac
14775         case "$gmtime_r_proto" in
14776         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14777         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14778         esac
14779         case "$gmtime_r_proto" in
14780         ''|0)   d_gmtime_r=undef
14781                 gmtime_r_proto=0
14782                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14783         * )     case "$gmtime_r_proto" in
14784                 REENTRANT_PROTO*) ;;
14785                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14786                 esac
14787                 echo "Prototype: $try" ;;
14788         esac
14789         ;;
14790         *)      case "$usethreads" in
14791                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14792                 esac
14793                 d_gmtime_r=undef
14794                 gmtime_r_proto=0
14795                 ;;
14796         esac
14797         ;;
14798 *)      gmtime_r_proto=0
14799         ;;
14800 esac
14801
14802 : see if hasmntopt exists
14803 set hasmntopt d_hasmntopt
14804 eval $inlibc
14805
14806 : see if this is a netinet/in.h or sys/in.h system
14807 set netinet/in.h i_niin sys/in.h i_sysin
14808 eval $inhdr
14809
14810 : see if arpa/inet.h has to be included
14811 set arpa/inet.h i_arpainet
14812 eval $inhdr
14813
14814 : see if htonl --and friends-- exists
14815 val=''
14816 set htonl val
14817 eval $inlibc
14818
14819 : Maybe they are macros.
14820 case "$val" in
14821 $undef)
14822         $cat >htonl.c <<EOM
14823 #include <stdio.h>
14824 #include <sys/types.h>
14825 #$i_niin I_NETINET_IN
14826 #$i_sysin I_SYS_IN
14827 #$i_arpainet I_ARPA_INET
14828 #ifdef I_NETINET_IN
14829 #include <netinet/in.h>
14830 #endif
14831 #ifdef I_SYS_IN
14832 #include <sys/in.h>
14833 #endif
14834 #ifdef I_ARPA_INET
14835 #include <arpa/inet.h>
14836 #endif
14837 #ifdef htonl
14838 printf("Defined as a macro.");
14839 #endif
14840 EOM
14841         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14842         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14843                 val="$define"
14844                 echo "But it seems to be defined as a macro." >&4
14845         fi
14846         $rm -f htonl.?
14847         ;;
14848 esac
14849 set d_htonl
14850 eval $setvar
14851
14852 : see if ilogbl exists
14853 set ilogbl d_ilogbl
14854 eval $inlibc
14855
14856 : index or strchr
14857 echo " "
14858 if set index val -f; eval $csym; $val; then
14859         if set strchr val -f d_strchr; eval $csym; $val; then
14860                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14861                         val="$define"
14862                         vali="$undef"
14863                         echo "strchr() found." >&4
14864                 else
14865                         val="$undef"
14866                         vali="$define"
14867                         echo "index() found." >&4
14868                 fi
14869         else
14870                 val="$undef"
14871                 vali="$define"
14872                 echo "index() found." >&4
14873         fi
14874 else
14875         if set strchr val -f d_strchr; eval $csym; $val; then
14876                 val="$define"
14877                 vali="$undef"
14878                 echo "strchr() found." >&4
14879         else
14880                 echo "No index() or strchr() found!" >&4
14881                 val="$undef"
14882                 vali="$undef"
14883         fi
14884 fi
14885 set d_strchr; eval $setvar
14886 val="$vali"
14887 set d_index; eval $setvar
14888
14889 : check whether inet_aton exists
14890 set inet_aton d_inetaton
14891 eval $inlibc
14892
14893 : see if inet_ntop exists
14894 set inet_ntop d_inetntop
14895 eval $inlibc
14896
14897 : see if inet_pton exists
14898 set inet_pton d_inetpton
14899 eval $inlibc
14900
14901 : Look for isascii
14902 echo " "
14903 $cat >isascii.c <<EOCP
14904 #include <stdio.h>
14905 #include <ctype.h>
14906 #$i_stdlib I_STDLIB
14907 #ifdef I_STDLIB
14908 #include <stdlib.h>
14909 #endif
14910 int main() {
14911         int c = 'A';
14912         if (isascii(c))
14913                 exit(0);
14914         else
14915                 exit(1);
14916 }
14917 EOCP
14918 set isascii
14919 if eval $compile; then
14920         echo "isascii() found." >&4
14921         val="$define"
14922 else
14923         echo "isascii() NOT found." >&4
14924         val="$undef"
14925 fi
14926 set d_isascii
14927 eval $setvar
14928 $rm -f isascii*
14929
14930 : see if isfinite exists
14931 set isfinite d_isfinite
14932 eval $inlibc
14933
14934 : see if isinf exists
14935 set isinf d_isinf
14936 eval $inlibc
14937
14938 : see if isnan exists
14939 set isnan d_isnan
14940 eval $inlibc
14941
14942 : see if isnanl exists
14943 set isnanl d_isnanl
14944 eval $inlibc
14945
14946 : see if killpg exists
14947 set killpg d_killpg
14948 eval $inlibc
14949
14950 : see if lchown exists
14951 echo " "
14952 $cat > try.c <<'EOCP'
14953 /* System header to define __stub macros and hopefully few prototypes,
14954     which can conflict with char lchown(); below.  */
14955 #include <assert.h>
14956 /* Override any gcc2 internal prototype to avoid an error.  */
14957 /* We use char because int might match the return type of a gcc2
14958    builtin and then its argument prototype would still apply.  */
14959 char lchown();
14960 int main() {
14961     /*  The GNU C library defines this for functions which it implements
14962         to always fail with ENOSYS.  Some functions are actually named
14963         something starting with __ and the normal name is an alias.  */
14964 #if defined (__stub_lchown) || defined (__stub___lchown)
14965 choke me
14966 #else
14967 lchown();
14968 #endif
14969 ; return 0; }
14970 EOCP
14971 set try
14972 if eval $compile; then
14973     $echo "lchown() found." >&4
14974     val="$define"
14975 else
14976     $echo "lchown() NOT found." >&4
14977     val="$undef"
14978 fi
14979 set d_lchown
14980 eval $setvar
14981
14982 : See if number of significant digits in a double precision number is known
14983 echo " "
14984 $cat >ldbl_dig.c <<EOM
14985 #$i_limits I_LIMITS
14986 #$i_float I_FLOAT
14987 #ifdef I_LIMITS
14988 #include <limits.h>
14989 #endif
14990 #ifdef I_FLOAT
14991 #include <float.h>
14992 #endif
14993 #ifdef LDBL_DIG
14994 printf("Contains LDBL_DIG");
14995 #endif
14996 EOM
14997 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14998 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14999         echo "LDBL_DIG found." >&4
15000         val="$define"
15001 else
15002         echo "LDBL_DIG NOT found." >&4
15003         val="$undef"
15004 fi
15005 $rm -f ldbl_dig.?
15006 set d_ldbl_dig
15007 eval $setvar
15008
15009 : see if this is a math.h system
15010 set math.h i_math
15011 eval $inhdr
15012
15013 : check to see if math.h defines _LIB_VERSION
15014 d_libm_lib_version="$undef"
15015 case $i_math in
15016     $define)
15017         echo " "
15018         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15019         $cat >try.c <<EOCP
15020 #include <unistd.h>
15021 #include <math.h>
15022 int main (int argc, char *argv[])
15023 {
15024     printf ("%d\n", _LIB_VERSION);
15025     return (0);
15026     } /* main */
15027 EOCP
15028         set try
15029         if eval $compile; then
15030             foo=`$run ./try`
15031             echo "Yes, it does ($foo)" >&4
15032             d_libm_lib_version="$define"
15033         else
15034             echo "No, it does not (probably harmless)" >&4
15035             fi
15036         $rm_try
15037         ;;
15038
15039     esac
15040
15041 : see if link exists
15042 set link d_link
15043 eval $inlibc
15044
15045 : see if localtime_r exists
15046 set localtime_r d_localtime_r
15047 eval $inlibc
15048 case "$d_localtime_r" in
15049 "$define")
15050         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15051         case "$d_localtime_r_proto:$usethreads" in
15052         ":define")      d_localtime_r_proto=define
15053                 set d_localtime_r_proto localtime_r $hdrs
15054                 eval $hasproto ;;
15055         *)      ;;
15056         esac
15057         case "$d_localtime_r_proto" in
15058         define)
15059         case "$localtime_r_proto" in
15060         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15061         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15062         esac
15063         case "$localtime_r_proto" in
15064         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15065         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15066         esac
15067         case "$localtime_r_proto" in
15068         ''|0)   d_localtime_r=undef
15069                 localtime_r_proto=0
15070                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15071         * )     case "$localtime_r_proto" in
15072                 REENTRANT_PROTO*) ;;
15073                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15074                 esac
15075                 echo "Prototype: $try" ;;
15076         esac
15077         ;;
15078         *)      case "$usethreads" in
15079                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15080                 esac
15081                 d_localtime_r=undef
15082                 localtime_r_proto=0
15083                 ;;
15084         esac
15085         ;;
15086 *)      localtime_r_proto=0
15087         ;;
15088 esac
15089
15090 : see if localtime_r calls tzset
15091 case "$localtime_r_proto" in
15092 REENTRANT_PROTO*)
15093         $cat >try.c <<EOCP
15094 /*  Does our libc's localtime_r call tzset ?
15095  *  return 0 if so, 1 otherwise.
15096  */
15097 #$i_systypes    I_SYS_TYPES
15098 #$i_unistd      I_UNISTD
15099 #$i_time        I_TIME
15100 #$i_stdlib      I_STDLIB
15101 #$i_string      I_STRING
15102 #$i_malloc      I_MALLOC
15103 #ifdef I_SYS_TYPES
15104 #  include <sys/types.h>
15105 #endif
15106 #ifdef I_UNISTD
15107 #  include <unistd.h>
15108 #endif
15109 #ifdef I_TIME
15110 #  include <time.h>
15111 #endif
15112 #ifdef I_STDLIB
15113 #include <stdlib.h>
15114 #endif
15115 #ifdef I_STRING
15116 #  include <string.h>
15117 #else
15118 #  include <strings.h>
15119 #endif
15120 #ifdef I_MALLOC
15121 #  include <malloc.h>
15122 #endif
15123 int main()
15124 {
15125     time_t t = time(0L);
15126     char w_tz[]="TZ" "=GMT+5",
15127          e_tz[]="TZ" "=GMT-5",
15128         *tz_e = (char*)malloc(16),
15129         *tz_w = (char*)malloc(16);
15130     struct tm tm_e, tm_w;
15131     memset(&tm_e,'\0',sizeof(struct tm));
15132     memset(&tm_w,'\0',sizeof(struct tm));
15133     strcpy(tz_e,e_tz);
15134     strcpy(tz_w,w_tz);
15135
15136     putenv(tz_e);
15137     localtime_r(&t, &tm_e);
15138
15139     putenv(tz_w);
15140     localtime_r(&t, &tm_w);
15141
15142     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15143         return 1;
15144     return 0;
15145 }
15146 EOCP
15147         set try
15148         if eval $compile; then
15149             if $run ./try; then
15150                 d_localtime_r_needs_tzset=undef;
15151             else
15152                 d_localtime_r_needs_tzset=define;
15153             fi;
15154         else
15155             d_localtime_r_needs_tzset=undef;
15156         fi;
15157      ;;
15158   *)
15159      d_localtime_r_needs_tzset=undef;
15160      ;;
15161 esac
15162 $rm_try
15163
15164 : see if localeconv exists
15165 set localeconv d_locconv
15166 eval $inlibc
15167
15168 : see if lockf exists
15169 set lockf d_lockf
15170 eval $inlibc
15171
15172 : see if prototype for lseek is available
15173 echo " "
15174 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15175 eval $hasproto
15176
15177 : see if lstat exists
15178 set lstat d_lstat
15179 eval $inlibc
15180
15181 : see if madvise exists
15182 set madvise d_madvise
15183 eval $inlibc
15184
15185 : see if malloc_size exists
15186 set malloc_size d_malloc_size
15187 eval $inlibc
15188
15189 : see if malloc_size_good exists
15190 set malloc_good_size d_malloc_good_size
15191 eval $inlibc
15192
15193 : see if mblen exists
15194 set mblen d_mblen
15195 eval $inlibc
15196
15197 : see if mbstowcs exists
15198 set mbstowcs d_mbstowcs
15199 eval $inlibc
15200
15201 : see if mbtowc exists
15202 set mbtowc d_mbtowc
15203 eval $inlibc
15204
15205 : see if memchr exists
15206 set memchr d_memchr
15207 eval $inlibc
15208
15209 : see if memcmp exists
15210 set memcmp d_memcmp
15211 eval $inlibc
15212
15213 : see if memcpy exists
15214 set memcpy d_memcpy
15215 eval $inlibc
15216
15217 : see if memmove exists
15218 set memmove d_memmove
15219 eval $inlibc
15220
15221 : see if memset exists
15222 set memset d_memset
15223 eval $inlibc
15224
15225 : see if mkdir exists
15226 set mkdir d_mkdir
15227 eval $inlibc
15228
15229 : see if mkdtemp exists
15230 set mkdtemp d_mkdtemp
15231 eval $inlibc
15232
15233 : see if mkfifo exists
15234 set mkfifo d_mkfifo
15235 eval $inlibc
15236
15237 : see if mkstemp exists
15238 set mkstemp d_mkstemp
15239 eval $inlibc
15240
15241 : see if mkstemps exists
15242 set mkstemps d_mkstemps
15243 eval $inlibc
15244
15245 : see if mktime exists
15246 set mktime d_mktime
15247 eval $inlibc
15248
15249 : see if this is a sys/mman.h system
15250 set sys/mman.h i_sysmman
15251 eval $inhdr
15252
15253 : see if mmap exists
15254 set mmap d_mmap
15255 eval $inlibc
15256 : see what shmat returns
15257 : default to something harmless
15258 mmaptype='void *'
15259 case "$i_sysmman$d_mmap" in
15260 "$define$define")
15261         $cat >mmap.c <<'END'
15262 #include <sys/mman.h>
15263 void *mmap();
15264 END
15265         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15266                 mmaptype='void *'
15267         else
15268                 mmaptype='caddr_t'
15269         fi
15270         echo "and it returns ($mmaptype)." >&4
15271         ;;
15272 esac
15273
15274
15275
15276 : see if sqrtl exists
15277 set sqrtl d_sqrtl
15278 eval $inlibc
15279
15280 : see if scalbnl exists
15281 set scalbnl d_scalbnl
15282 eval $inlibc
15283
15284 : see if modfl exists
15285 set modfl d_modfl
15286 eval $inlibc
15287
15288 : see if prototype for modfl is available
15289 echo " "
15290 set d_modflproto modfl $i_math math.h
15291 eval $hasproto
15292
15293 d_modfl_pow32_bug="$undef"
15294
15295 case "$d_longdbl$d_modfl" in
15296 $define$define)
15297         $cat <<EOM
15298 Checking to see whether your modfl() is okay for large values...
15299 EOM
15300 $cat >try.c <<EOCP
15301 #include <math.h>
15302 #include <stdio.h>
15303 EOCP
15304 if $test "X$d_modflproto" != "X$define"; then
15305         $cat >>try.c <<EOCP
15306 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15307 long double modfl (long double, long double *);
15308 EOCP
15309 fi
15310 $cat >>try.c <<EOCP
15311 int main() {
15312     long double nv = 4294967303.15;
15313     long double v, w;
15314     v = modfl(nv, &w);
15315 #ifdef __GLIBC__
15316     printf("glibc");
15317 #endif
15318     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15319     return 0;
15320 }
15321 EOCP
15322         case "$osname:$gccversion" in
15323         aix:)   saveccflags="$ccflags"
15324                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15325         esac
15326         set try
15327         if eval $compile; then
15328                 foo=`$run ./try`
15329                 case "$foo" in
15330                 *" 4294967303.150000 1.150000 4294967302.000000")
15331                         echo >&4 "Your modfl() is broken for large values."
15332                         d_modfl_pow32_bug="$define"
15333                         case "$foo" in
15334                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15335                         ;;
15336                         esac
15337                         ;;
15338                 *" 4294967303.150000 0.150000 4294967303.000000")
15339                         echo >&4 "Your modfl() seems okay for large values."
15340                         ;;
15341                 *)      echo >&4 "I don't understand your modfl() at all."
15342                         d_modfl="$undef"
15343                         ;;
15344                 esac
15345                 $rm_try
15346         else
15347                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15348                 d_modfl="$undef"
15349         fi
15350         case "$osname:$gccversion" in
15351         aix:)   ccflags="$saveccflags" ;; # restore
15352         esac
15353         ;;
15354 esac
15355
15356 if $test "$uselongdouble" = "$define"; then
15357     message=""
15358     if $test "$d_sqrtl" != "$define"; then
15359         message="$message sqrtl"
15360     fi
15361     if $test "$d_modfl" != "$define"; then
15362         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15363             echo "You have both aintl and copysignl, so I can emulate modfl."
15364         else
15365             message="$message modfl"
15366         fi
15367     fi
15368     if $test "$d_frexpl" != "$define"; then
15369         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15370             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15371         else
15372             message="$message frexpl"
15373         fi
15374     fi
15375
15376     if $test "$message" != ""; then
15377         $cat <<EOM >&4
15378
15379 *** You requested the use of long doubles but you do not seem to have
15380 *** the following mathematical functions needed for long double support:
15381 ***    $message
15382 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15383 *** Cannot continue, aborting.
15384
15385 EOM
15386
15387         exit 1
15388     fi
15389 fi
15390
15391 : see if mprotect exists
15392 set mprotect d_mprotect
15393 eval $inlibc
15394
15395 : see if msgctl exists
15396 set msgctl d_msgctl
15397 eval $inlibc
15398
15399 : see if msgget exists
15400 set msgget d_msgget
15401 eval $inlibc
15402
15403 : see if msgsnd exists
15404 set msgsnd d_msgsnd
15405 eval $inlibc
15406
15407 : see if msgrcv exists
15408 set msgrcv d_msgrcv
15409 eval $inlibc
15410
15411 : see how much of the 'msg*(2)' library is present.
15412 h_msg=true
15413 echo " "
15414 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15415 *"$undef"*) h_msg=false;;
15416 esac
15417 case "$osname" in
15418 freebsd)
15419     case "`ipcs 2>&1`" in
15420     "SVID messages"*"not configured"*)
15421         echo "Your $osname does not have the msg*(2) configured." >&4
15422         h_msg=false
15423         val="$undef"
15424         set msgctl d_msgctl
15425         eval $setvar
15426         set msgget d_msgget
15427         eval $setvar
15428         set msgsnd d_msgsnd
15429         eval $setvar
15430         set msgrcv d_msgrcv
15431         eval $setvar
15432         ;;
15433     esac
15434     ;;
15435 esac
15436 : we could also check for sys/ipc.h ...
15437 if $h_msg && $test `./findhdr sys/msg.h`; then
15438         echo "You have the full msg*(2) library." >&4
15439         val="$define"
15440 else
15441         echo "You don't have the full msg*(2) library." >&4
15442         val="$undef"
15443 fi
15444 set d_msg
15445 eval $setvar
15446
15447 : Check for msghdr_s
15448 echo " "
15449 echo "Checking to see if your system supports struct msghdr..." >&4
15450 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15451 eval $hasstruct
15452 case "$d_msghdr_s" in
15453 "$define")      echo "Yes, it does."   ;;
15454 *)              echo "No, it doesn't." ;;
15455 esac
15456
15457
15458 : see if msync exists
15459 set msync d_msync
15460 eval $inlibc
15461
15462 : see if munmap exists
15463 set munmap d_munmap
15464 eval $inlibc
15465
15466 : see if nice exists
15467 set nice d_nice
15468 eval $inlibc
15469
15470 : see if this is a langinfo.h system
15471 set langinfo.h i_langinfo
15472 eval $inhdr
15473
15474 : see if nl_langinfo exists
15475 set nl_langinfo d_nl_langinfo
15476 eval $inlibc
15477
15478 : check for volatile keyword
15479 echo " "
15480 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15481 $cat >try.c <<'EOCP'
15482 int main()
15483 {
15484         typedef struct _goo_struct goo_struct;
15485         goo_struct * volatile goo = ((goo_struct *)0);
15486         struct _goo_struct {
15487                 long long_int;
15488                 int reg_int;
15489                 char char_var;
15490         };
15491         typedef unsigned short foo_t;
15492         char *volatile foo;
15493         volatile int bar;
15494         volatile foo_t blech;
15495         foo = foo;
15496 }
15497 EOCP
15498 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15499         val="$define"
15500         echo "Yup, it does."
15501 else
15502         val="$undef"
15503         echo "Nope, it doesn't."
15504 fi
15505 set d_volatile
15506 eval $setvar
15507 $rm_try
15508
15509 : Check basic sizes
15510 echo " "
15511 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15512
15513 case "$use64bitint:$d_quad:$quadtype" in
15514 define:define:?*)
15515         ivtype="$quadtype"
15516         uvtype="$uquadtype"
15517         ivsize=8
15518         uvsize=8
15519         ;;
15520 *)      ivtype="long"
15521         uvtype="unsigned long"
15522         ivsize=$longsize
15523         uvsize=$longsize
15524         ;;
15525 esac
15526
15527 case "$uselongdouble:$d_longdbl" in
15528 define:define)
15529         nvtype="long double"
15530         nvsize=$longdblsize
15531         ;;
15532 *)      nvtype=double
15533         nvsize=$doublesize
15534         ;;
15535 esac
15536
15537 $echo "(IV will be "$ivtype", $ivsize bytes)"
15538 $echo "(UV will be "$uvtype", $uvsize bytes)"
15539 $echo "(NV will be "$nvtype", $nvsize bytes)"
15540
15541 $cat >try.c <<EOCP
15542 #$i_inttypes I_INTTYPES
15543 #ifdef I_INTTYPES
15544 #include <inttypes.h>
15545 #endif
15546 #include <stdio.h>
15547 int main() {
15548 #ifdef INT8
15549    int8_t i =  INT8_MAX;
15550   uint8_t u = UINT8_MAX;
15551   printf("int8_t\n");
15552 #endif
15553 #ifdef INT16
15554    int16_t i =  INT16_MAX;
15555   uint16_t i = UINT16_MAX;
15556   printf("int16_t\n");
15557 #endif
15558 #ifdef INT32
15559    int32_t i =  INT32_MAX;
15560   uint32_t u = UINT32_MAX;
15561   printf("int32_t\n");
15562 #endif
15563 }
15564 EOCP
15565
15566 i8type="signed char"
15567 u8type="unsigned char"
15568 i8size=1
15569 u8size=1
15570
15571 case "$i16type" in
15572 '')     case "$shortsize" in
15573         2)      i16type=short
15574                 u16type="unsigned short"
15575                 i16size=$shortsize
15576                 u16size=$shortsize
15577                 ;;
15578         esac
15579         ;;
15580 esac
15581 case "$i16type" in
15582 '')     set try -DINT16
15583         if eval $compile; then
15584                 case "`$run ./try`" in
15585                 int16_t)
15586                         i16type=int16_t
15587                         u16type=uint16_t
15588                         i16size=2
15589                         u16size=2
15590                         ;;
15591                 esac
15592         fi
15593         ;;
15594 esac
15595 case "$i16type" in
15596 '')     if $test $shortsize -ge 2; then
15597                 i16type=short
15598                 u16type="unsigned short"
15599                 i16size=$shortsize
15600                 u16size=$shortsize
15601         fi
15602         ;;
15603 esac
15604
15605 case "$i32type" in
15606 '')     case "$longsize" in
15607         4)      i32type=long
15608                 u32type="unsigned long"
15609                 i32size=$longsize
15610                 u32size=$longsize
15611                 ;;
15612         *)      case "$intsize" in
15613                 4)      i32type=int
15614                         u32type="unsigned int"
15615                         i32size=$intsize
15616                         u32size=$intsize
15617                         ;;
15618                 esac
15619                 ;;
15620         esac
15621         ;;
15622 esac
15623 case "$i32type" in
15624 '')     set try -DINT32
15625         if eval $compile; then
15626                 case "`$run ./try`" in
15627                 int32_t)
15628                         i32type=int32_t
15629                         u32type=uint32_t
15630                         i32size=4
15631                         u32size=4
15632                         ;;
15633                 esac
15634         fi
15635         ;;
15636 esac
15637 case "$i32type" in
15638 '')     if $test $intsize -ge 4; then
15639                 i32type=int
15640                 u32type="unsigned int"
15641                 i32size=$intsize
15642                 u32size=$intsize
15643         fi
15644         ;;
15645 esac
15646
15647 case "$i64type" in
15648 '')     case "$d_quad:$quadtype" in
15649         define:?*)
15650                 i64type="$quadtype"
15651                 u64type="$uquadtype"
15652                 i64size=8
15653                 u64size=8
15654                 ;;
15655         esac
15656         ;;
15657 esac
15658
15659 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15660 : volatile so that the compiler has to store it out to memory.
15661 if test X"$d_volatile" = X"$define"; then
15662         volatile=volatile
15663 fi
15664 $cat <<EOP >try.c
15665 #include <stdio.h>
15666 #$i_stdlib I_STDLIB
15667 #ifdef I_STDLIB
15668 #include <stdlib.h>
15669 #endif
15670 #include <sys/types.h>
15671 #include <signal.h>
15672 #ifdef SIGFPE
15673 $volatile int bletched = 0;
15674 $signal_t blech(int s) { bletched = 1; }
15675 #endif
15676 int main() {
15677     $uvtype u = 0;
15678     $nvtype d;
15679     int     n = 8 * $uvsize;
15680     int     i;
15681 #ifdef SIGFPE
15682     signal(SIGFPE, blech);
15683 #endif
15684
15685     for (i = 0; i < n; i++) {
15686       u = u << 1 | ($uvtype)1;
15687       d = ($nvtype)u;
15688       if (($uvtype)d != u)
15689         break;
15690       if (d <= 0)
15691         break;
15692       d = ($nvtype)(u - 1);
15693       if (($uvtype)d != (u - 1))
15694         break;
15695 #ifdef SIGFPE
15696       if (bletched)
15697         break;
15698 #endif
15699     }
15700     printf("%d\n", ((i == n) ? -n : i));
15701     exit(0);
15702 }
15703 EOP
15704 set try
15705
15706 d_nv_preserves_uv="$undef"
15707 if eval $compile; then
15708         nv_preserves_uv_bits="`$run ./try`"
15709 fi
15710 case "$nv_preserves_uv_bits" in
15711 \-[1-9]*)
15712         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15713         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15714         d_nv_preserves_uv="$define"
15715         ;;
15716 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15717         d_nv_preserves_uv="$undef" ;;
15718 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15719         nv_preserves_uv_bits="0" ;;
15720 esac
15721 $rm_try
15722
15723 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15724 : volatile so that the compiler has to store it out to memory.
15725 if test X"$d_volatile" = X"$define"; then
15726         volatile=volatile
15727 fi
15728 $cat <<EOP >try.c
15729 #include <stdio.h>
15730
15731 typedef $nvtype NV;
15732
15733 int
15734 main() {
15735   NV value = 2;
15736   int count = 1;
15737
15738   while(count < 256) {
15739     $volatile NV up = value + 1.0;
15740     $volatile NV negated = -value;
15741     $volatile NV down = negated - 1.0;
15742     $volatile NV got_up = up - value;
15743     int up_good = got_up == 1.0;
15744     int got_down = down - negated;
15745     int down_good = got_down == -1.0;
15746
15747     if (down_good != up_good) {
15748       fprintf(stderr,
15749               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15750               up_good, (double) got_up, down_good, (double) got_down,
15751               count, (double) value);
15752       return 1;
15753     }
15754     if (!up_good) {
15755       while (1) {
15756         if (count > 8) {
15757           count -= 8;
15758           fputs("256.0", stdout);
15759         } else {
15760           count--;
15761           fputs("2.0", stdout);
15762         }
15763         if (!count) {
15764           puts("");
15765           return 0;
15766         }
15767         fputs("*", stdout);
15768       }
15769     }
15770     value *= 2;
15771     ++count;
15772   }
15773   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15774           count, (double) value);
15775   return 1;
15776 }
15777 EOP
15778 set try
15779
15780 nv_overflows_integers_at='0'
15781 if eval $compile; then
15782     xxx="`$run ./try`"
15783     case "$?" in
15784         0)
15785             case "$xxx" in
15786                 2*)  cat >&4 <<EOM
15787 The largest integer your NVs can preserve is equal to $xxx
15788 EOM
15789                     nv_overflows_integers_at="$xxx"
15790                     ;;
15791                 *)  cat >&4 <<EOM
15792 Cannot determine the largest integer value your NVs can hold, unexpected output
15793 '$xxx'
15794 EOM
15795                     ;;
15796             esac
15797             ;;
15798         *)  cat >&4 <<EOM
15799 Cannot determine the largest integer value your NVs can hold
15800 EOM
15801             ;;
15802     esac
15803 fi
15804 $rm_try
15805
15806 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15807 : volatile so that the compiler has to store it out to memory.
15808 if test X"$d_volatile" = X"$define"; then
15809         volatile=volatile
15810 fi
15811 $cat <<EOP >try.c
15812 #include <stdio.h>
15813 #$i_stdlib I_STDLIB
15814 #ifdef I_STDLIB
15815 #include <stdlib.h>
15816 #endif
15817 #$i_string I_STRING
15818 #ifdef I_STRING
15819 #  include <string.h>
15820 #else
15821 #  include <strings.h>
15822 #endif
15823 #include <sys/types.h>
15824 #include <signal.h>
15825 #ifdef SIGFPE
15826 $volatile int bletched = 0;
15827 $signal_t blech(int s) { bletched = 1; }
15828 #endif
15829
15830 int checkit($nvtype d, char *where) {
15831     unsigned char *p = (char *)&d;
15832     unsigned char *end = p + sizeof(d);
15833     int fail = 0;
15834
15835     while (p < end)
15836         fail += *p++;
15837
15838     if (!fail)
15839         return 0;
15840
15841     p = (char *)&d;
15842     printf("No - %s: 0x", where);
15843     while (p < end)
15844         printf ("%02X", *p++);
15845     printf("\n");
15846     return 1;
15847 }
15848
15849 int main(int argc, char **argv) {
15850     $nvtype d = 0.0;
15851     int fail = 0;
15852     fail += checkit(d, "0.0");
15853
15854     /* The compiler shouldn't be assuming that bletched is 0  */
15855     d = bletched;
15856
15857     fail += checkit(d, "bleched");
15858
15859 #ifdef SIGFPE
15860     signal(SIGFPE, blech);
15861 #endif
15862
15863     /* Paranoia - the compiler should have no way of knowing that ANSI says
15864        that argv[argc] will always be NULL.  Actually, if it did assume this it
15865        would be buggy, as this is C and main() can be called from elsewhere in
15866        the program.  */
15867     d = argv[argc] ? 1 : 0;
15868
15869     if (d) {
15870         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15871     }
15872
15873     fail += checkit(d, "ternary");
15874
15875     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15876
15877     if (d != 0.0) {
15878         printf("No - memset doesn't give 0.0\n");
15879         /* This might just blow up:  */
15880         printf("(gives %g)\n", d);
15881         return 1;
15882     }
15883
15884 #ifdef SIGFPE
15885     if (bletched) {
15886         printf("No - something bleched\n");
15887         return 1;
15888     }
15889 #endif
15890     if (fail) {
15891       printf("No - %d fail(s)\n", fail);
15892       return 1;
15893     }
15894     printf("Yes\n");
15895     return 0;
15896 }
15897 EOP
15898 set try
15899
15900 d_nv_zero_is_allbits_zero="$undef"
15901 if eval $compile; then
15902     xxx="`$run ./try`"
15903     case "$?" in
15904         0)
15905             case "$xxx" in
15906                 Yes)  cat >&4 <<EOM
15907 0.0 is represented as all bits zero in memory
15908 EOM
15909                     d_nv_zero_is_allbits_zero="$define"
15910                     ;;
15911                 *)  cat >&4 <<EOM
15912 0.0 is not represented as all bits zero in memory
15913 EOM
15914                     d_nv_zero_is_allbits_zero="$undef"
15915                     ;;
15916             esac
15917             ;;
15918         *)  cat >&4 <<EOM
15919 0.0 is not represented as all bits zero in memory
15920 EOM
15921             d_nv_zero_is_allbits_zero="$undef"
15922             ;;
15923     esac
15924 fi
15925 $rm_try
15926
15927 : check for off64_t
15928 echo " "
15929 echo "Checking to see if you have off64_t..." >&4
15930 $cat >try.c <<EOCP
15931 #include <sys/types.h>
15932 #include <unistd.h>
15933 int main() { off64_t x = 7; }
15934 EOCP
15935 set try
15936 if eval $compile; then
15937         val="$define"
15938         echo "You have off64_t."
15939 else
15940         val="$undef"
15941         echo "You do not have off64_t."
15942         case "$lseeksize" in
15943         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15944         esac
15945 fi
15946 $rm_try
15947 set d_off64_t
15948 eval $setvar
15949
15950 : how to create joinable pthreads
15951 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15952         echo " "
15953         echo "Checking what constant to use for creating joinable pthreads..." >&4
15954         $cat >try.c <<'EOCP'
15955 #include <pthread.h>
15956 int main() {
15957     int detachstate = JOINABLE;
15958 }
15959 EOCP
15960         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15961         if eval $compile; then
15962                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15963                 val="$undef" # Yes, undef.
15964                 set d_old_pthread_create_joinable
15965                 eval $setvar
15966                 val=""
15967                 set old_pthread_create_joinable
15968                 eval $setvar
15969         else
15970                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15971                 if eval $compile; then
15972                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15973                         val="$define"
15974                         set d_old_pthread_create_joinable
15975                         eval $setvar
15976                         val=PTHREAD_CREATE_UNDETACHED
15977                         set old_pthread_create_joinable
15978                         eval $setvar
15979                 else
15980                         set try -DJOINABLE=__UNDETACHED
15981                         if eval $compile; then
15982                                 echo "You seem to use __UNDETACHED." >&4
15983                                 val="$define"
15984                                 set d_old_pthread_create_joinable
15985                                 eval $setvar
15986                                 val=__UNDETACHED
15987                                 set old_pthread_create_joinable
15988                                 eval $setvar
15989                         else
15990                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15991                                 val="$define"
15992                                 set d_old_pthread_create_joinable
15993                                 eval $setvar
15994                                 val=0
15995                                 set old_pthread_create_joinable
15996                                 eval $setvar
15997                         fi
15998                 fi
15999         fi
16000         $rm_try
16001 else
16002     d_old_pthread_create_joinable="$undef"
16003     old_pthread_create_joinable=""
16004 fi
16005
16006 : see if pause exists
16007 set pause d_pause
16008 eval $inlibc
16009
16010 : see if poll exists
16011 set poll d_poll
16012 eval $inlibc
16013
16014 : see if prctl exists
16015 set prctl d_prctl
16016 eval $inlibc
16017
16018 : see if prctl supports PR_SET_NAME
16019 d_prctl_set_name=$undef
16020 case $d_prctl in
16021     $define)
16022         $cat >try.c <<EOM
16023 #include <sys/prctl.h>
16024
16025 int main (int argc, char *argv[])
16026 {
16027     return (prctl (PR_SET_NAME, "Test"));
16028     } /* main */
16029 EOM
16030         set try
16031         if eval $compile_ok && $run ./try; then
16032             echo "Your prctl (PR_SET_NAME, ...) works"
16033             d_prctl_set_name=$define
16034             fi
16035         $rm_try
16036         ;;
16037     esac
16038
16039 : see if readlink exists
16040 set readlink d_readlink
16041 eval $inlibc
16042
16043 : Check if exe is symlink to abs path of executing program
16044 echo " "
16045 procselfexe=''
16046 val="$undef"
16047 case "$d_readlink" in
16048 "$define")
16049         if $issymlink /proc/self/exe ; then
16050                 $ls -l /proc/self/exe > reflect
16051                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16052                         echo "You have Linux-like /proc/self/exe."
16053                         procselfexe='"/proc/self/exe"'
16054                         val="$define"
16055                 fi
16056         fi
16057         if $issymlink /proc/curproc/file ; then
16058                 $ls -l /proc/curproc/file > reflect
16059                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16060                         echo "You have BSD-like /proc/curproc/file."
16061                         procselfexe='"/proc/curproc/file"'
16062                         val="$define"
16063                 fi
16064         fi
16065         ;;
16066 esac
16067 $rm -f reflect
16068 set d_procselfexe
16069 eval $setvar
16070
16071 : backward compatibility for d_hvfork
16072 if test X$d_hvfork != X; then
16073         d_vfork="$d_hvfork"
16074         d_hvfork=''
16075 fi
16076 : see if there is a vfork
16077 val=''
16078 set vfork val
16079 eval $inlibc
16080
16081 d_pseudofork=$undef
16082
16083 : Ok, but do we want to use it. vfork is reportedly unreliable in
16084 : perl on Solaris 2.x, and probably elsewhere.
16085 case "$val" in
16086 $define)
16087         echo " "
16088         case "$usevfork" in
16089         false) dflt='n';;
16090         *) dflt='y';;
16091         esac
16092         cat <<'EOM'
16093
16094 Perl can only use a vfork() that doesn't suffer from strict
16095 restrictions on calling functions or modifying global data in
16096 the child.  For example, glibc-2.1 contains such a vfork()
16097 that is unsuitable.  If your system provides a proper fork()
16098 call, chances are that you do NOT want perl to use vfork().
16099
16100 EOM
16101         rp="Do you still want to use vfork()?"
16102         . ./myread
16103         case "$ans" in
16104         y|Y) ;;
16105         *)
16106                 echo "Ok, we won't use vfork()."
16107                 val="$undef"
16108                 ;;
16109         esac
16110         ;;
16111 esac
16112 set d_vfork
16113 eval $setvar
16114 case "$d_vfork" in
16115 $define) usevfork='true';;
16116 *) usevfork='false';;
16117 esac
16118
16119 : see whether the pthread_atfork exists
16120 $cat >try.c <<EOP
16121 #include <pthread.h>
16122 #include <stdio.h>
16123 int main() {
16124 #ifdef  PTHREAD_ATFORK
16125         pthread_atfork(NULL,NULL,NULL);
16126 #endif
16127 }
16128 EOP
16129
16130 : see if pthread_atfork exists
16131 set try -DPTHREAD_ATFORK
16132 if eval $compile; then
16133     val="$define"
16134 else
16135     val="$undef"
16136 fi
16137 case "$usethreads" in
16138 $define)
16139         case "$val" in
16140         $define) echo 'pthread_atfork found.' >&4        ;;
16141         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16142         esac
16143 esac
16144 set d_pthread_atfork
16145 eval $setvar
16146
16147 : see if pthread_attr_setscope exists
16148 set pthread_attr_setscope d_pthread_attr_setscope
16149 eval $inlibc
16150
16151 : see whether the various POSIXish _yields exist
16152 $cat >try.c <<EOP
16153 #include <pthread.h>
16154 #include <stdio.h>
16155 int main() {
16156 #ifdef SCHED_YIELD
16157         sched_yield();
16158 #else
16159 #ifdef PTHREAD_YIELD
16160         pthread_yield();
16161 #else
16162 #ifdef PTHREAD_YIELD_NULL
16163         pthread_yield(NULL);
16164 #endif
16165 #endif
16166 #endif
16167 }
16168 EOP
16169 : see if sched_yield exists
16170 set try -DSCHED_YIELD
16171 if eval $compile; then
16172     val="$define"
16173     sched_yield='sched_yield()'
16174 else
16175     val="$undef"
16176 fi
16177 case "$usethreads" in
16178 $define)
16179         case "$val" in
16180         $define) echo 'sched_yield() found.' >&4        ;;
16181         *)       echo 'sched_yield() NOT found.' >&4    ;;
16182         esac
16183 esac
16184 set d_sched_yield
16185 eval $setvar
16186
16187 : see if pthread_yield exists
16188 set try -DPTHREAD_YIELD
16189 if eval $compile; then
16190     val="$define"
16191     case "$sched_yield" in
16192     '') sched_yield='pthread_yield()' ;;
16193     esac
16194 else
16195     set try -DPTHREAD_YIELD_NULL
16196     if eval $compile; then
16197         val="$define"
16198         case "$sched_yield" in
16199         '') sched_yield='pthread_yield(NULL)' ;;
16200         esac
16201     else
16202         val="$undef"
16203     fi
16204 fi
16205 case "$usethreads" in
16206 $define)
16207         case "$val" in
16208         $define) echo 'pthread_yield() found.' >&4      ;;
16209         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16210         esac
16211         ;;
16212 esac
16213 set d_pthread_yield
16214 eval $setvar
16215 case "$sched_yield" in
16216 '') sched_yield=undef ;;
16217 esac
16218 $rm_try
16219
16220 : see if random_r exists
16221 set random_r d_random_r
16222 eval $inlibc
16223 case "$d_random_r" in
16224 "$define")
16225         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16226         case "$d_random_r_proto:$usethreads" in
16227         ":define")      d_random_r_proto=define
16228                 set d_random_r_proto random_r $hdrs
16229                 eval $hasproto ;;
16230         *)      ;;
16231         esac
16232         case "$d_random_r_proto" in
16233         define)
16234         case "$random_r_proto" in
16235         ''|0) try='int random_r(int*, struct random_data*);'
16236         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16237         esac
16238         case "$random_r_proto" in
16239         ''|0) try='int random_r(long*, struct random_data*);'
16240         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16241         esac
16242         case "$random_r_proto" in
16243         ''|0) try='int random_r(struct random_data*, int32_t*);'
16244         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16245         esac
16246         case "$random_r_proto" in
16247         ''|0)   d_random_r=undef
16248                 random_r_proto=0
16249                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16250         * )     case "$random_r_proto" in
16251                 REENTRANT_PROTO*) ;;
16252                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16253                 esac
16254                 echo "Prototype: $try" ;;
16255         esac
16256         ;;
16257         *)      case "$usethreads" in
16258                 define) echo "random_r has no prototype, not using it." >&4 ;;
16259                 esac
16260                 d_random_r=undef
16261                 random_r_proto=0
16262                 ;;
16263         esac
16264         ;;
16265 *)      random_r_proto=0
16266         ;;
16267 esac
16268
16269 : see if readdir and friends exist
16270 set readdir d_readdir
16271 eval $inlibc
16272 set seekdir d_seekdir
16273 eval $inlibc
16274 set telldir d_telldir
16275 eval $inlibc
16276 set rewinddir d_rewinddir
16277 eval $inlibc
16278
16279 : see if readdir64_r exists
16280 set readdir64_r d_readdir64_r
16281 eval $inlibc
16282 case "$d_readdir64_r" in
16283 "$define")
16284         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16285         case "$d_readdir64_r_proto:$usethreads" in
16286         ":define")      d_readdir64_r_proto=define
16287                 set d_readdir64_r_proto readdir64_r $hdrs
16288                 eval $hasproto ;;
16289         *)      ;;
16290         esac
16291         case "$d_readdir64_r_proto" in
16292         define)
16293         case "$readdir64_r_proto" in
16294         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16295         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16296         esac
16297         case "$readdir64_r_proto" in
16298         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16299         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16300         esac
16301         case "$readdir64_r_proto" in
16302         ''|0)   d_readdir64_r=undef
16303                 readdir64_r_proto=0
16304                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16305         * )     case "$readdir64_r_proto" in
16306                 REENTRANT_PROTO*) ;;
16307                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16308                 esac
16309                 echo "Prototype: $try" ;;
16310         esac
16311         ;;
16312         *)      case "$usethreads" in
16313                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16314                 esac
16315                 d_readdir64_r=undef
16316                 readdir64_r_proto=0
16317                 ;;
16318         esac
16319         ;;
16320 *)      readdir64_r_proto=0
16321         ;;
16322 esac
16323
16324 : see if readdir_r exists
16325 set readdir_r d_readdir_r
16326 eval $inlibc
16327 case "$d_readdir_r" in
16328 "$define")
16329         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16330         case "$d_readdir_r_proto:$usethreads" in
16331         ":define")      d_readdir_r_proto=define
16332                 set d_readdir_r_proto readdir_r $hdrs
16333                 eval $hasproto ;;
16334         *)      ;;
16335         esac
16336         case "$d_readdir_r_proto" in
16337         define)
16338         case "$readdir_r_proto" in
16339         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16340         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16341         esac
16342         case "$readdir_r_proto" in
16343         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16344         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16345         esac
16346         case "$readdir_r_proto" in
16347         ''|0)   d_readdir_r=undef
16348                 readdir_r_proto=0
16349                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16350         * )     case "$readdir_r_proto" in
16351                 REENTRANT_PROTO*) ;;
16352                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16353                 esac
16354                 echo "Prototype: $try" ;;
16355         esac
16356         ;;
16357         *)      case "$usethreads" in
16358                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16359                 esac
16360                 d_readdir_r=undef
16361                 readdir_r_proto=0
16362                 ;;
16363         esac
16364         ;;
16365 *)      readdir_r_proto=0
16366         ;;
16367 esac
16368
16369 : see if readv exists
16370 set readv d_readv
16371 eval $inlibc
16372
16373 : see if recvmsg exists
16374 set recvmsg d_recvmsg
16375 eval $inlibc
16376
16377 : see if rename exists
16378 set rename d_rename
16379 eval $inlibc
16380
16381 : see if rmdir exists
16382 set rmdir d_rmdir
16383 eval $inlibc
16384
16385 : see if memory.h is available.
16386 val=''
16387 set memory.h val
16388 eval $inhdr
16389
16390 : See if it conflicts with string.h
16391 case "$val" in
16392 $define)
16393         case "$strings" in
16394         '') ;;
16395         *)
16396                 $cppstdin $cppflags $cppminus < $strings > mem.h
16397                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16398                         echo " "
16399                         echo "We won't be including <memory.h>."
16400                         val="$undef"
16401                 fi
16402                 $rm -f mem.h
16403                 ;;
16404         esac
16405 esac
16406 set i_memory
16407 eval $setvar
16408
16409 : can bcopy handle overlapping blocks?
16410 echo " "
16411 val="$undef"
16412 case "$d_memmove" in
16413 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16414 *)      case "$d_bcopy" in
16415         "$define")
16416                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16417                 $cat >try.c <<EOCP
16418 #$i_memory I_MEMORY
16419 #$i_stdlib I_STDLIB
16420 #$i_string I_STRING
16421 #$i_unistd I_UNISTD
16422 EOCP
16423         $cat >>try.c <<'EOCP'
16424 #include <stdio.h>
16425 #ifdef I_MEMORY
16426 #  include <memory.h>
16427 #endif
16428 #ifdef I_STDLIB
16429 #  include <stdlib.h>
16430 #endif
16431 #ifdef I_STRING
16432 #  include <string.h>
16433 #else
16434 #  include <strings.h>
16435 #endif
16436 #ifdef I_UNISTD
16437 #  include <unistd.h>  /* Needed for NetBSD */
16438 #endif
16439 int main()
16440 {
16441 char buf[128], abc[128];
16442 char *b;
16443 int len;
16444 int off;
16445 int align;
16446
16447 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16448    try to store the string in read-only memory. */
16449 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16450
16451 for (align = 7; align >= 0; align--) {
16452         for (len = 36; len; len--) {
16453                 b = buf+align;
16454                 bcopy(abc, b, len);
16455                 for (off = 1; off <= len; off++) {
16456                         bcopy(b, b+off, len);
16457                         bcopy(b+off, b, len);
16458                         if (bcmp(b, abc, len))
16459                                 exit(1);
16460                 }
16461         }
16462 }
16463 exit(0);
16464 }
16465 EOCP
16466                 set try
16467                 if eval $compile_ok; then
16468                         if $run ./try 2>/dev/null; then
16469                                 echo "Yes, it can."
16470                                 val="$define"
16471                         else
16472                                 echo "It can't, sorry."
16473                         fi
16474                 else
16475                         echo "(I can't compile the test program, so we'll assume not...)"
16476                 fi
16477                 ;;
16478         esac
16479         $rm_try
16480         ;;
16481 esac
16482 set d_safebcpy
16483 eval $setvar
16484
16485 : can memcpy handle overlapping blocks?
16486 echo " "
16487 val="$undef"
16488 case "$d_memmove" in
16489 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16490 *)      case "$d_memcpy" in
16491         "$define")
16492                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16493                 $cat >try.c <<EOCP
16494 #$i_memory I_MEMORY
16495 #$i_stdlib I_STDLIB
16496 #$i_string I_STRING
16497 #$i_unistd I_UNISTD
16498 EOCP
16499         $cat >>try.c <<'EOCP'
16500 #include <stdio.h>
16501 #ifdef I_MEMORY
16502 #  include <memory.h>
16503 #endif
16504 #ifdef I_STDLIB
16505 #  include <stdlib.h>
16506 #endif
16507 #ifdef I_STRING
16508 #  include <string.h>
16509 #else
16510 #  include <strings.h>
16511 #endif
16512 #ifdef I_UNISTD
16513 #  include <unistd.h>  /* Needed for NetBSD */
16514 #endif
16515 int main()
16516 {
16517 char buf[128], abc[128];
16518 char *b;
16519 int len;
16520 int off;
16521 int align;
16522
16523 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16524    try to store the string in read-only memory. */
16525 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16526
16527 for (align = 7; align >= 0; align--) {
16528         for (len = 36; len; len--) {
16529                 b = buf+align;
16530                 memcpy(b, abc, len);
16531                 for (off = 1; off <= len; off++) {
16532                         memcpy(b+off, b, len);
16533                         memcpy(b, b+off, len);
16534                         if (memcmp(b, abc, len))
16535                                 exit(1);
16536                 }
16537         }
16538 }
16539 exit(0);
16540 }
16541 EOCP
16542                 set try
16543                 if eval $compile_ok; then
16544                         if $run ./try 2>/dev/null; then
16545                                 echo "Yes, it can."
16546                                 val="$define"
16547                         else
16548                                 echo "It can't, sorry."
16549                         fi
16550                 else
16551                         echo "(I can't compile the test program, so we'll assume not...)"
16552                 fi
16553                 ;;
16554         esac
16555         $rm_try
16556         ;;
16557 esac
16558 set d_safemcpy
16559 eval $setvar
16560
16561 : can memcmp be trusted to compare relative magnitude?
16562 val="$undef"
16563 case "$d_memcmp" in
16564 "$define")
16565         echo " "
16566         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16567         $cat >try.c <<EOCP
16568 #$i_memory I_MEMORY
16569 #$i_stdlib I_STDLIB
16570 #$i_string I_STRING
16571 #$i_unistd I_UNISTD
16572 EOCP
16573         $cat >>try.c <<'EOCP'
16574 #include <stdio.h>
16575 #ifdef I_MEMORY
16576 #  include <memory.h>
16577 #endif
16578 #ifdef I_STDLIB
16579 #  include <stdlib.h>
16580 #endif
16581 #ifdef I_STRING
16582 #  include <string.h>
16583 #else
16584 #  include <strings.h>
16585 #endif
16586 #ifdef I_UNISTD
16587 #  include <unistd.h>  /* Needed for NetBSD */
16588 #endif
16589 int main()
16590 {
16591 char a = -1;
16592 char b = 0;
16593 if ((a < b) && memcmp(&a, &b, 1) < 0)
16594         exit(1);
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 "No, it can't (it uses signed chars)."
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 set d_sanemcmp
16613 eval $setvar
16614
16615 : see if prototype for sbrk is available
16616 echo " "
16617 set d_sbrkproto sbrk $i_unistd unistd.h
16618 eval $hasproto
16619
16620 : see if select exists
16621 set select d_select
16622 eval $inlibc
16623
16624 : see if semctl exists
16625 set semctl d_semctl
16626 eval $inlibc
16627
16628 : see if semget exists
16629 set semget d_semget
16630 eval $inlibc
16631
16632 : see if semop exists
16633 set semop d_semop
16634 eval $inlibc
16635
16636 : see how much of the 'sem*(2)' library is present.
16637 h_sem=true
16638 echo " "
16639 case "$d_semctl$d_semget$d_semop" in
16640 *"$undef"*) h_sem=false;;
16641 esac
16642 case "$osname" in
16643 freebsd)
16644     case "`ipcs 2>&1`" in
16645     "SVID messages"*"not configured"*)
16646         echo "Your $osname does not have the sem*(2) configured." >&4
16647         h_sem=false
16648         val="$undef"
16649         set semctl d_semctl
16650         eval $setvar
16651         set semget d_semget
16652         eval $setvar
16653         set semop d_semop
16654         eval $setvar
16655         ;;
16656     esac
16657     ;;
16658 esac
16659 : we could also check for sys/ipc.h ...
16660 if $h_sem && $test `./findhdr sys/sem.h`; then
16661         echo "You have the full sem*(2) library." >&4
16662         val="$define"
16663 else
16664         echo "You don't have the full sem*(2) library." >&4
16665         val="$undef"
16666 fi
16667 set d_sem
16668 eval $setvar
16669
16670 : see whether sys/sem.h defines union semun
16671 echo " "
16672 $cat > try.c <<'END'
16673 #include <sys/types.h>
16674 #include <sys/ipc.h>
16675 #include <sys/sem.h>
16676 int main () { union semun semun; semun.buf = 0; }
16677 END
16678 set try
16679 if eval $compile; then
16680     echo "You have union semun in <sys/sem.h>." >&4
16681     val="$define"
16682 else
16683     echo "You do not have union semun in <sys/sem.h>." >&4
16684     val="$undef"
16685 fi
16686 $rm_try
16687 set d_union_semun
16688 eval $setvar
16689
16690 : see how to do semctl IPC_STAT
16691 case "$d_sem" in
16692 $define)
16693     echo " "
16694     $cat > tryh.h <<END
16695 #ifndef S_IRUSR
16696 #   ifdef S_IREAD
16697 #       define S_IRUSR S_IREAD
16698 #       define S_IWUSR S_IWRITE
16699 #       define S_IXUSR S_IEXEC
16700 #   else
16701 #       define S_IRUSR 0400
16702 #       define S_IWUSR 0200
16703 #       define S_IXUSR 0100
16704 #   endif
16705 #   define S_IRGRP (S_IRUSR>>3)
16706 #   define S_IWGRP (S_IWUSR>>3)
16707 #   define S_IXGRP (S_IXUSR>>3)
16708 #   define S_IROTH (S_IRUSR>>6)
16709 #   define S_IWOTH (S_IWUSR>>6)
16710 #   define S_IXOTH (S_IXUSR>>6)
16711 #endif
16712 #ifndef S_IRWXU
16713 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16714 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16715 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16716 #endif
16717 END
16718     : see whether semctl IPC_STAT can use union semun
16719     case "$d_semctl_semun" in
16720     '')
16721       val="$undef"
16722       $cat > try.c <<END
16723 #include <sys/types.h>
16724 #include <sys/ipc.h>
16725 #include <sys/sem.h>
16726 #include <sys/stat.h>
16727 #include <stdio.h>
16728 #include <errno.h>
16729 #include "tryh.h"
16730 #ifndef errno
16731 extern int errno;
16732 #endif
16733 #$d_union_semun HAS_UNION_SEMUN
16734 int main() {
16735     union semun
16736 #ifndef HAS_UNION_SEMUN
16737     {
16738         int val;
16739         struct semid_ds *buf;
16740         unsigned short *array;
16741     }
16742 #endif
16743     arg;
16744     int sem, st;
16745
16746 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16747     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16748     if (sem > -1) {
16749         struct semid_ds argbuf;
16750         arg.buf = &argbuf;
16751 #       ifdef IPC_STAT
16752         st = semctl(sem, 0, IPC_STAT, arg);
16753         if (st == 0)
16754             printf("semun\n");
16755         else
16756 #       endif /* IPC_STAT */
16757             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16758 #       ifdef IPC_RMID
16759         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16760 #       endif /* IPC_RMID */
16761             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16762     } else
16763 #endif /* IPC_PRIVATE && ... */
16764         printf("semget failed: errno = %d\n", errno);
16765   return 0;
16766 }
16767 END
16768       set try
16769       if eval $compile; then
16770           xxx=`$run ./try`
16771           case "$xxx" in
16772           semun) val="$define" ;;
16773           esac
16774       fi
16775       $rm_try
16776       set d_semctl_semun
16777       eval $setvar
16778       ;;
16779     esac
16780     case "$d_semctl_semun" in
16781     $define)
16782         echo "You can use union semun for semctl IPC_STAT." >&4
16783         also='also'
16784         ;;
16785     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16786         also=''
16787         ;;
16788     esac
16789
16790     : see whether semctl IPC_STAT can use struct semid_ds pointer
16791     case "$d_semctl_semid_ds" in
16792     '')
16793       val="$undef"
16794       $cat > try.c <<'END'
16795 #include <sys/types.h>
16796 #include <sys/ipc.h>
16797 #include <sys/sem.h>
16798 #include <sys/stat.h>
16799 #include "tryh.h"
16800 #include <stdio.h>
16801 #include <errno.h>
16802 #ifndef errno
16803 extern int errno;
16804 #endif
16805 int main() {
16806     struct semid_ds arg;
16807     int sem, st;
16808
16809 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16810     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16811     if (sem > -1) {
16812 #       ifdef IPC_STAT
16813         st = semctl(sem, 0, IPC_STAT, &arg);
16814         if (st == 0)
16815             printf("semid_ds\n");
16816         else
16817 #       endif /* IPC_STAT */
16818             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16819 #       ifdef IPC_RMID
16820         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16821 #       endif /* IPC_RMID */
16822             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16823     } else
16824 #endif /* IPC_PRIVATE && ... */
16825         printf("semget failed: errno = %d\n", errno);
16826
16827     return 0;
16828 }
16829 END
16830       set try
16831       if eval $compile; then
16832           xxx=`$run ./try`
16833           case "$xxx" in
16834           semid_ds) val="$define" ;;
16835           esac
16836       fi
16837       $rm_try
16838       set d_semctl_semid_ds
16839       eval $setvar
16840       ;;
16841     esac
16842     case "$d_semctl_semid_ds" in
16843     $define)
16844         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16845         ;;
16846     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16847         ;;
16848     esac
16849     ;;
16850 *)  val="$undef"
16851
16852     # We do not have the full sem*(2) library, so assume we can not
16853     # use either.
16854
16855     set d_semctl_semun
16856     eval $setvar
16857
16858     set d_semctl_semid_ds
16859     eval $setvar
16860     ;;
16861 esac
16862 $rm_try tryh.h
16863
16864 : see if sendmsg exists
16865 set sendmsg d_sendmsg
16866 eval $inlibc
16867
16868 : see if setegid exists
16869 set setegid d_setegid
16870 eval $inlibc
16871
16872 : see if seteuid exists
16873 set seteuid d_seteuid
16874 eval $inlibc
16875
16876 : see if setgrent exists
16877 set setgrent d_setgrent
16878 eval $inlibc
16879
16880 : see if setgrent_r exists
16881 set setgrent_r d_setgrent_r
16882 eval $inlibc
16883 case "$d_setgrent_r" in
16884 "$define")
16885         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16886         case "$d_setgrent_r_proto:$usethreads" in
16887         ":define")      d_setgrent_r_proto=define
16888                 set d_setgrent_r_proto setgrent_r $hdrs
16889                 eval $hasproto ;;
16890         *)      ;;
16891         esac
16892         case "$d_setgrent_r_proto" in
16893         define)
16894         case "$setgrent_r_proto" in
16895         ''|0) try='int setgrent_r(FILE**);'
16896         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16897         esac
16898         case "$setgrent_r_proto" in
16899         ''|0) try='void setgrent_r(FILE**);'
16900         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16901         esac
16902         case "$setgrent_r_proto" in
16903         ''|0)   d_setgrent_r=undef
16904                 setgrent_r_proto=0
16905                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16906         * )     case "$setgrent_r_proto" in
16907                 REENTRANT_PROTO*) ;;
16908                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16909                 esac
16910                 echo "Prototype: $try" ;;
16911         esac
16912         ;;
16913         *)      case "$usethreads" in
16914                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16915                 esac
16916                 d_setgrent_r=undef
16917                 setgrent_r_proto=0
16918                 ;;
16919         esac
16920         ;;
16921 *)      setgrent_r_proto=0
16922         ;;
16923 esac
16924
16925 : see if sethostent exists
16926 set sethostent d_sethent
16927 eval $inlibc
16928
16929 : see if sethostent_r exists
16930 set sethostent_r d_sethostent_r
16931 eval $inlibc
16932 case "$d_sethostent_r" in
16933 "$define")
16934         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16935         case "$d_sethostent_r_proto:$usethreads" in
16936         ":define")      d_sethostent_r_proto=define
16937                 set d_sethostent_r_proto sethostent_r $hdrs
16938                 eval $hasproto ;;
16939         *)      ;;
16940         esac
16941         case "$d_sethostent_r_proto" in
16942         define)
16943         case "$sethostent_r_proto" in
16944         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16945         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16946         esac
16947         case "$sethostent_r_proto" in
16948         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16949         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16950         esac
16951         case "$sethostent_r_proto" in
16952         ''|0)   d_sethostent_r=undef
16953                 sethostent_r_proto=0
16954                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16955         * )     case "$sethostent_r_proto" in
16956                 REENTRANT_PROTO*) ;;
16957                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16958                 esac
16959                 echo "Prototype: $try" ;;
16960         esac
16961         ;;
16962         *)      case "$usethreads" in
16963                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16964                 esac
16965                 d_sethostent_r=undef
16966                 sethostent_r_proto=0
16967                 ;;
16968         esac
16969         ;;
16970 *)      sethostent_r_proto=0
16971         ;;
16972 esac
16973
16974 : see if setitimer exists
16975 set setitimer d_setitimer
16976 eval $inlibc
16977
16978 : see if setlinebuf exists
16979 set setlinebuf d_setlinebuf
16980 eval $inlibc
16981
16982 : see if setlocale exists
16983 set setlocale d_setlocale
16984 eval $inlibc
16985
16986 : see if locale.h is available
16987 set locale.h i_locale
16988 eval $inhdr
16989
16990 : see if setlocale_r exists
16991 set setlocale_r d_setlocale_r
16992 eval $inlibc
16993 case "$d_setlocale_r" in
16994 "$define")
16995         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16996         case "$d_setlocale_r_proto:$usethreads" in
16997         ":define")      d_setlocale_r_proto=define
16998                 set d_setlocale_r_proto setlocale_r $hdrs
16999                 eval $hasproto ;;
17000         *)      ;;
17001         esac
17002         case "$d_setlocale_r_proto" in
17003         define)
17004         case "$setlocale_r_proto" in
17005         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17006         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17007         esac
17008         case "$setlocale_r_proto" in
17009         ''|0)   d_setlocale_r=undef
17010                 setlocale_r_proto=0
17011                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17012         * )     case "$setlocale_r_proto" in
17013                 REENTRANT_PROTO*) ;;
17014                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17015                 esac
17016                 echo "Prototype: $try" ;;
17017         esac
17018         ;;
17019         *)      case "$usethreads" in
17020                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17021                 esac
17022                 d_setlocale_r=undef
17023                 setlocale_r_proto=0
17024                 ;;
17025         esac
17026         ;;
17027 *)      setlocale_r_proto=0
17028         ;;
17029 esac
17030
17031 : see if setnetent exists
17032 set setnetent d_setnent
17033 eval $inlibc
17034
17035 : see if setnetent_r exists
17036 set setnetent_r d_setnetent_r
17037 eval $inlibc
17038 case "$d_setnetent_r" in
17039 "$define")
17040         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17041         case "$d_setnetent_r_proto:$usethreads" in
17042         ":define")      d_setnetent_r_proto=define
17043                 set d_setnetent_r_proto setnetent_r $hdrs
17044                 eval $hasproto ;;
17045         *)      ;;
17046         esac
17047         case "$d_setnetent_r_proto" in
17048         define)
17049         case "$setnetent_r_proto" in
17050         ''|0) try='int setnetent_r(int, struct netent_data*);'
17051         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17052         esac
17053         case "$setnetent_r_proto" in
17054         ''|0) try='void setnetent_r(int, struct netent_data*);'
17055         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17056         esac
17057         case "$setnetent_r_proto" in
17058         ''|0)   d_setnetent_r=undef
17059                 setnetent_r_proto=0
17060                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17061         * )     case "$setnetent_r_proto" in
17062                 REENTRANT_PROTO*) ;;
17063                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17064                 esac
17065                 echo "Prototype: $try" ;;
17066         esac
17067         ;;
17068         *)      case "$usethreads" in
17069                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17070                 esac
17071                 d_setnetent_r=undef
17072                 setnetent_r_proto=0
17073                 ;;
17074         esac
17075         ;;
17076 *)      setnetent_r_proto=0
17077         ;;
17078 esac
17079
17080 : see if setprotoent exists
17081 set setprotoent d_setpent
17082 eval $inlibc
17083
17084 : see if setpgid exists
17085 set setpgid d_setpgid
17086 eval $inlibc
17087
17088 : see if setpgrp2 exists
17089 set setpgrp2 d_setpgrp2
17090 eval $inlibc
17091
17092 : see if setpriority exists
17093 set setpriority d_setprior
17094 eval $inlibc
17095
17096 : see if setproctitle exists
17097 set setproctitle d_setproctitle
17098 eval $inlibc
17099
17100 : see if setprotoent_r exists
17101 set setprotoent_r d_setprotoent_r
17102 eval $inlibc
17103 case "$d_setprotoent_r" in
17104 "$define")
17105         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17106         case "$d_setprotoent_r_proto:$usethreads" in
17107         ":define")      d_setprotoent_r_proto=define
17108                 set d_setprotoent_r_proto setprotoent_r $hdrs
17109                 eval $hasproto ;;
17110         *)      ;;
17111         esac
17112         case "$d_setprotoent_r_proto" in
17113         define)
17114         case "$setprotoent_r_proto" in
17115         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17116         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17117         esac
17118         case "$setprotoent_r_proto" in
17119         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17120         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17121         esac
17122         case "$setprotoent_r_proto" in
17123         ''|0)   d_setprotoent_r=undef
17124                 setprotoent_r_proto=0
17125                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17126         * )     case "$setprotoent_r_proto" in
17127                 REENTRANT_PROTO*) ;;
17128                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17129                 esac
17130                 echo "Prototype: $try" ;;
17131         esac
17132         ;;
17133         *)      case "$usethreads" in
17134                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17135                 esac
17136                 d_setprotoent_r=undef
17137                 setprotoent_r_proto=0
17138                 ;;
17139         esac
17140         ;;
17141 *)      setprotoent_r_proto=0
17142         ;;
17143 esac
17144
17145 : see if setpwent exists
17146 set setpwent d_setpwent
17147 eval $inlibc
17148
17149 : see if setpwent_r exists
17150 set setpwent_r d_setpwent_r
17151 eval $inlibc
17152 case "$d_setpwent_r" in
17153 "$define")
17154         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17155         case "$d_setpwent_r_proto:$usethreads" in
17156         ":define")      d_setpwent_r_proto=define
17157                 set d_setpwent_r_proto setpwent_r $hdrs
17158                 eval $hasproto ;;
17159         *)      ;;
17160         esac
17161         case "$d_setpwent_r_proto" in
17162         define)
17163         case "$setpwent_r_proto" in
17164         ''|0) try='int setpwent_r(FILE**);'
17165         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17166         esac
17167         case "$setpwent_r_proto" in
17168         ''|0) try='void setpwent_r(FILE**);'
17169         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17170         esac
17171         case "$setpwent_r_proto" in
17172         ''|0)   d_setpwent_r=undef
17173                 setpwent_r_proto=0
17174                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17175         * )     case "$setpwent_r_proto" in
17176                 REENTRANT_PROTO*) ;;
17177                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17178                 esac
17179                 echo "Prototype: $try" ;;
17180         esac
17181         ;;
17182         *)      case "$usethreads" in
17183                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17184                 esac
17185                 d_setpwent_r=undef
17186                 setpwent_r_proto=0
17187                 ;;
17188         esac
17189         ;;
17190 *)      setpwent_r_proto=0
17191         ;;
17192 esac
17193
17194 : see if setregid exists
17195 set setregid d_setregid
17196 eval $inlibc
17197 set setresgid d_setresgid
17198 eval $inlibc
17199
17200 : see if setreuid exists
17201 set setreuid d_setreuid
17202 eval $inlibc
17203 set setresuid d_setresuid
17204 eval $inlibc
17205
17206 : see if setrgid exists
17207 set setrgid d_setrgid
17208 eval $inlibc
17209
17210 : see if setruid exists
17211 set setruid d_setruid
17212 eval $inlibc
17213
17214 : see if setservent exists
17215 set setservent d_setsent
17216 eval $inlibc
17217
17218 : see if setservent_r exists
17219 set setservent_r d_setservent_r
17220 eval $inlibc
17221 case "$d_setservent_r" in
17222 "$define")
17223         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17224         case "$d_setservent_r_proto:$usethreads" in
17225         ":define")      d_setservent_r_proto=define
17226                 set d_setservent_r_proto setservent_r $hdrs
17227                 eval $hasproto ;;
17228         *)      ;;
17229         esac
17230         case "$d_setservent_r_proto" in
17231         define)
17232         case "$setservent_r_proto" in
17233         ''|0) try='int setservent_r(int, struct servent_data*);'
17234         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17235         esac
17236         case "$setservent_r_proto" in
17237         ''|0) try='void setservent_r(int, struct servent_data*);'
17238         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17239         esac
17240         case "$setservent_r_proto" in
17241         ''|0)   d_setservent_r=undef
17242                 setservent_r_proto=0
17243                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17244         * )     case "$setservent_r_proto" in
17245                 REENTRANT_PROTO*) ;;
17246                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17247                 esac
17248                 echo "Prototype: $try" ;;
17249         esac
17250         ;;
17251         *)      case "$usethreads" in
17252                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17253                 esac
17254                 d_setservent_r=undef
17255                 setservent_r_proto=0
17256                 ;;
17257         esac
17258         ;;
17259 *)      setservent_r_proto=0
17260         ;;
17261 esac
17262
17263 : see if setsid exists
17264 set setsid d_setsid
17265 eval $inlibc
17266
17267 : see if setvbuf exists
17268 set setvbuf d_setvbuf
17269 eval $inlibc
17270
17271 : see if sfio.h is available
17272 set sfio.h i_sfio
17273 eval $inhdr
17274
17275 : see if sfio library is available
17276 case "$i_sfio" in
17277 $define)
17278         val=''
17279         set sfreserve val
17280         eval $inlibc
17281         ;;
17282 *)
17283         val="$undef"
17284         ;;
17285 esac
17286 : Ok, but do we want to use it.
17287 case "$val" in
17288 $define)
17289         case "$usesfio" in
17290         true|$define|[yY]*) dflt='y';;
17291         *) dflt='n';;
17292         esac
17293         echo "$package can use the sfio library, but it is experimental."
17294         rp="You seem to have sfio available, do you want to try using it?"
17295         . ./myread
17296         case "$ans" in
17297         y|Y)    echo "Ok, turning on sfio then."
17298                 val="$define"
17299                 ;;
17300         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17301                 val="$undef"
17302                 ;;
17303         esac
17304         ;;
17305 *)      case "$usesfio" in
17306         true|$define|[yY]*)
17307                 echo "Sorry, cannot find sfio on this machine." >&4
17308                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17309                 val="$undef"
17310                 ;;
17311         esac
17312         ;;
17313 esac
17314 set d_sfio
17315 eval $setvar
17316 case "$d_sfio" in
17317 $define) usesfio='true';;
17318 *) usesfio='false';;
17319 esac
17320 case "$d_sfio" in
17321 $define) ;;
17322 *)      : Remove sfio from list of libraries to use
17323         case "$libs" in
17324         *-lsfio*)
17325                 echo "Removing unneeded -lsfio from library list" >&4
17326                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17327                 shift
17328                 libs="$*"
17329                 echo "libs = $libs" >&4
17330                 ;;
17331         esac
17332 ;;
17333 esac
17334
17335
17336 : see if shmctl exists
17337 set shmctl d_shmctl
17338 eval $inlibc
17339
17340 : see if shmget exists
17341 set shmget d_shmget
17342 eval $inlibc
17343
17344 : see if shmat exists
17345 set shmat d_shmat
17346 eval $inlibc
17347 : see what shmat returns
17348 case "$d_shmat" in
17349 "$define")
17350         $cat >shmat.c <<'END'
17351 #include <sys/shm.h>
17352 void *shmat();
17353 END
17354         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17355                 shmattype='void *'
17356         else
17357                 shmattype='char *'
17358         fi
17359         echo "and it returns ($shmattype)." >&4
17360         : see if a prototype for shmat is available
17361         xxx=`./findhdr sys/shm.h`
17362         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17363         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17364                 val="$define"
17365         else
17366                 val="$undef"
17367         fi
17368         $rm -f shmat.[co]
17369         ;;
17370 *)
17371         val="$undef"
17372         ;;
17373 esac
17374 set d_shmatprototype
17375 eval $setvar
17376
17377 : see if shmdt exists
17378 set shmdt d_shmdt
17379 eval $inlibc
17380
17381 : see how much of the 'shm*(2)' library is present.
17382 h_shm=true
17383 echo " "
17384 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17385 *"$undef"*) h_shm=false;;
17386 esac
17387 case "$osname" in
17388 freebsd)
17389     case "`ipcs 2>&1`" in
17390     "SVID shared memory"*"not configured"*)
17391         echo "Your $osname does not have the shm*(2) configured." >&4
17392         h_shm=false
17393         val="$undef"
17394         set shmctl d_shmctl
17395         evat $setvar
17396         set shmget d_shmget
17397         evat $setvar
17398         set shmat d_shmat
17399         evat $setvar
17400         set shmdt d_shmdt
17401         evat $setvar
17402         ;;
17403     esac
17404     ;;
17405 esac
17406 : we could also check for sys/ipc.h ...
17407 if $h_shm && $test `./findhdr sys/shm.h`; then
17408         echo "You have the full shm*(2) library." >&4
17409         val="$define"
17410 else
17411         echo "You don't have the full shm*(2) library." >&4
17412         val="$undef"
17413 fi
17414 set d_shm
17415 eval $setvar
17416
17417 : see if we have sigaction
17418 echo " "
17419 if set sigaction val -f d_sigaction; eval $csym; $val; then
17420         echo 'sigaction() found.' >&4
17421         $cat > try.c <<EOP
17422 #include <stdio.h>
17423 #include <sys/types.h>
17424 #include <signal.h>
17425 #$i_stdlib I_STDLIB
17426 #ifdef I_STDLIB
17427 #include <stdlib.h>
17428 #endif
17429 int main()
17430 {
17431     struct sigaction act, oact;
17432     act.sa_flags = 0;
17433     oact.sa_handler = 0;
17434     /* so that act and oact are used */
17435     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17436 }
17437 EOP
17438         set try
17439         if eval $compile_ok; then
17440                 val="$define"
17441         else
17442                 echo "But you don't seem to have a useable struct sigaction." >&4
17443                 val="$undef"
17444         fi
17445 else
17446         echo 'sigaction NOT found.' >&4
17447         val="$undef"
17448 fi
17449 set d_sigaction; eval $setvar
17450 $rm_try
17451
17452 : see if this is a sunmath.h system
17453 set sunmath.h i_sunmath
17454 eval $inhdr
17455
17456 : see if signbit exists
17457 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17458 $cat >try.c <<EOCP
17459 #$i_math I_MATH
17460 #$i_sunmath I_SUNMATH
17461 #ifdef I_MATH
17462 #  include <math.h>
17463 #endif
17464 #ifdef I_SUNMATH  /* Solaris special math library */
17465 #  include <sunmath.h>
17466 #endif
17467 #define NV $nvtype
17468 int main(int argc, char **argv)
17469 {
17470     NV x = 0.0;
17471     NV y = -0.0;
17472     if ((signbit(x) == 0) && (signbit(y) != 0))
17473         return 0;
17474     else
17475         return 1;
17476 }
17477 EOCP
17478 val="$undef"
17479 set try
17480 if eval $compile; then
17481     if $run ./try; then
17482         $echo "Yes." >&4
17483         val="$define"
17484     else
17485         $echo "Signbit seems to be available, but doesn't work as I expected."
17486         $echo "I won't use it." >&4
17487         val="$undef"
17488     fi
17489 else
17490     $echo "Nope." >&4
17491     dflt="$undef"
17492 fi
17493 set d_signbit
17494 eval $setvar
17495 $rm_try
17496
17497 : see if sigprocmask exists
17498 set sigprocmask d_sigprocmask
17499 eval $inlibc
17500
17501 : see if sigsetjmp exists
17502 echo " "
17503 case "$d_sigsetjmp" in
17504 '')
17505         $cat >try.c <<EOP
17506 #include <setjmp.h>
17507 #$i_stdlib I_STDLIB
17508 #ifdef I_STDLIB
17509 #include <stdlib.h>
17510 #endif
17511 sigjmp_buf env;
17512 int set = 1;
17513 int main()
17514 {
17515         if (sigsetjmp(env,1))
17516                 exit(set);
17517         set = 0;
17518         siglongjmp(env, 1);
17519         exit(1);
17520 }
17521 EOP
17522         set try
17523         if eval $compile; then
17524                 if $run ./try >/dev/null 2>&1; then
17525                         echo "POSIX sigsetjmp found." >&4
17526                         val="$define"
17527                 else
17528                         $cat >&4 <<EOM
17529 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17530 I'll ignore them.
17531 EOM
17532                         val="$undef"
17533                 fi
17534         else
17535                 echo "sigsetjmp not found." >&4
17536                 val="$undef"
17537         fi
17538         ;;
17539 *) val="$d_sigsetjmp"
17540         case "$d_sigsetjmp" in
17541         $define) echo "POSIX sigsetjmp found." >&4;;
17542         $undef) echo "sigsetjmp not found." >&4;;
17543         esac
17544         ;;
17545 esac
17546 set d_sigsetjmp
17547 eval $setvar
17548 $rm_try
17549
17550 : see if snprintf exists
17551 set snprintf d_snprintf
17552 eval $inlibc
17553
17554 : see if vsnprintf exists
17555 set vsnprintf d_vsnprintf
17556 eval $inlibc
17557
17558 case "$d_snprintf-$d_vsnprintf" in
17559 "$define-$define")
17560     $cat <<EOM
17561 Checking whether your snprintf() and vsnprintf() work okay...
17562 EOM
17563     $cat >try.c <<'EOCP'
17564 /* v?snprintf testing logic courtesy of Russ Allbery.
17565  * According to C99:
17566  * - if the buffer is too short it still must be \0-terminated
17567  * - if the buffer is too short the potentially required length
17568  *   must be returned and not -1
17569  * - if the buffer is NULL the potentially required length
17570  *   must be returned and not -1 or core dump
17571  */
17572 #include <stdio.h>
17573 #include <stdarg.h>
17574
17575 char buf[2];
17576
17577 int test (char *format, ...)
17578 {
17579     va_list args;
17580     int count;
17581
17582     va_start (args, format);
17583     count = vsnprintf (buf, sizeof buf, format, args);
17584     va_end (args);
17585     return count;
17586 }
17587
17588 int main ()
17589 {
17590     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17591              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17592 }
17593 EOCP
17594     set try
17595     if eval $compile; then
17596         `$run ./try`
17597         case "$?" in
17598         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17599         *) cat <<EOM >&4
17600 Your snprintf() and snprintf() don't seem to be working okay.
17601 EOM
17602            d_snprintf="$undef"
17603            d_vsnprintf="$undef"
17604            ;;
17605         esac
17606     else
17607         echo "(I can't seem to compile the test program--assuming they don't)"
17608         d_snprintf="$undef"
17609         d_vsnprintf="$undef"
17610     fi
17611     $rm_try
17612     ;;
17613 esac
17614
17615 : see if sockatmark exists
17616 set sockatmark d_sockatmark
17617 eval $inlibc
17618
17619 : see if prototype for sockatmark is available
17620 echo " "
17621 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17622 eval $hasproto
17623
17624 : see if socks5_init exists
17625 set socks5_init d_socks5_init
17626 eval $inlibc
17627
17628 : see if sprintf returns the length of the string in the buffer as per ANSI
17629 $echo "Checking whether sprintf returns the length of the string..." >&4
17630 $cat <<EOP >try.c
17631 #include <stdio.h>
17632 #$i_stdlib I_STDLIB
17633 #ifdef I_STDLIB
17634 #include <stdlib.h>
17635 #endif
17636 #$i_string I_STRING
17637 #ifdef I_STRING
17638 #  include <string.h>
17639 #else
17640 #  include <strings.h>
17641 #endif
17642 #$i_math I_MATH
17643 #ifdef I_MATH
17644 #include <math.h>
17645 #endif
17646
17647 char buffer[256];
17648
17649 int check (size_t expect, int test) {
17650   size_t got = strlen(buffer);
17651   if (expect == got)
17652     return 0;
17653
17654   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17655        test, buffer);
17656   exit (test);
17657 }
17658
17659 int main(int argc, char **argv) {
17660   int test = 0;
17661
17662   check(sprintf(buffer, ""), ++test);
17663   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17664   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17665
17666   return 0;
17667 }
17668 EOP
17669 set try
17670
17671 if eval $compile; then
17672     xxx="`$run ./try`"
17673     case "$?" in
17674         0) cat >&4 <<EOM
17675 sprintf returns the length of the string (as ANSI says it should)
17676 EOM
17677         d_sprintf_returns_strlen="$define"
17678         ;;
17679         *) cat >&4 <<EOM
17680 sprintf does not return the length of the string (how old is this system?)
17681 EOM
17682         d_sprintf_returns_strlen="$undef"
17683         ;;
17684     esac
17685 else
17686     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17687     d_sprintf_returns_strlen="$undef"
17688 fi
17689 $rm_try
17690
17691 : see if srand48_r exists
17692 set srand48_r d_srand48_r
17693 eval $inlibc
17694 case "$d_srand48_r" in
17695 "$define")
17696         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17697         case "$d_srand48_r_proto:$usethreads" in
17698         ":define")      d_srand48_r_proto=define
17699                 set d_srand48_r_proto srand48_r $hdrs
17700                 eval $hasproto ;;
17701         *)      ;;
17702         esac
17703         case "$d_srand48_r_proto" in
17704         define)
17705         case "$srand48_r_proto" in
17706         ''|0) try='int srand48_r(long, struct drand48_data*);'
17707         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17708         esac
17709         case "$srand48_r_proto" in
17710         ''|0)   d_srand48_r=undef
17711                 srand48_r_proto=0
17712                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17713         * )     case "$srand48_r_proto" in
17714                 REENTRANT_PROTO*) ;;
17715                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17716                 esac
17717                 echo "Prototype: $try" ;;
17718         esac
17719         ;;
17720         *)      case "$usethreads" in
17721                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17722                 esac
17723                 d_srand48_r=undef
17724                 srand48_r_proto=0
17725                 ;;
17726         esac
17727         ;;
17728 *)      srand48_r_proto=0
17729         ;;
17730 esac
17731
17732 : see if srandom_r exists
17733 set srandom_r d_srandom_r
17734 eval $inlibc
17735 case "$d_srandom_r" in
17736 "$define")
17737         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17738         case "$d_srandom_r_proto:$usethreads" in
17739         ":define")      d_srandom_r_proto=define
17740                 set d_srandom_r_proto srandom_r $hdrs
17741                 eval $hasproto ;;
17742         *)      ;;
17743         esac
17744         case "$d_srandom_r_proto" in
17745         define)
17746         case "$srandom_r_proto" in
17747         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17748         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17749         esac
17750         case "$srandom_r_proto" in
17751         ''|0)   d_srandom_r=undef
17752                 srandom_r_proto=0
17753                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17754         * )     case "$srandom_r_proto" in
17755                 REENTRANT_PROTO*) ;;
17756                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17757                 esac
17758                 echo "Prototype: $try" ;;
17759         esac
17760         ;;
17761         *)      case "$usethreads" in
17762                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17763                 esac
17764                 d_srandom_r=undef
17765                 srandom_r_proto=0
17766                 ;;
17767         esac
17768         ;;
17769 *)      srandom_r_proto=0
17770         ;;
17771 esac
17772
17773 : see if prototype for setresgid is available
17774 echo " "
17775 set d_sresgproto setresgid $i_unistd unistd.h
17776 eval $hasproto
17777
17778 : see if prototype for setresuid is available
17779 echo " "
17780 set d_sresuproto setresuid $i_unistd unistd.h
17781 eval $hasproto
17782
17783 : see if sys/stat.h is available
17784 set sys/stat.h i_sysstat
17785 eval $inhdr
17786
17787 : see if stat knows about block sizes
17788 echo " "
17789 echo "Checking to see if your struct stat has st_blocks field..." >&4
17790 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17791 eval $hasfield
17792
17793 : see if this is a sys/vfs.h system
17794 set sys/vfs.h i_sysvfs
17795 eval $inhdr
17796
17797 : see if this is a sys/statfs.h system
17798 set sys/statfs.h i_sysstatfs
17799 eval $inhdr
17800
17801 : Check for statfs_s
17802 echo " "
17803 echo "Checking to see if your system supports struct statfs..." >&4
17804 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
17805 eval $hasstruct
17806 case "$d_statfs_s" in
17807 "$define")      echo "Yes, it does."   ;;
17808 *)              echo "No, it doesn't." ;;
17809 esac
17810
17811
17812 : see if struct statfs knows about f_flags
17813 case "$d_statfs_s" in
17814 define)
17815         echo " "
17816         echo "Checking to see if your struct statfs has f_flags field..." >&4
17817         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
17818         eval $hasfield
17819         ;;
17820 *)      val="$undef"
17821         set d_statfs_f_flags
17822         eval $setvar
17823         ;;
17824 esac
17825 case "$d_statfs_f_flags" in
17826 "$define")      echo "Yes, it does."   ;;
17827 *)              echo "No, it doesn't." ;;
17828 esac
17829
17830 : see what flavor, if any, of static inline is supported
17831 echo " "
17832 echo "Checking to see if your system supports static inline..."
17833 $cat > try.c <<'EOCP'
17834 #include <stdlib.h>
17835 extern int f_via_a(int x);
17836 extern int f_via_b(int x);
17837 int main(int argc, char **argv)
17838 {
17839     int y;
17840
17841     y = f_via_a(0);
17842 #ifdef USE_B
17843     y = f_via_b(0);
17844 #endif
17845     if (y == 42) {
17846         return EXIT_SUCCESS;
17847     }
17848     else {
17849         return EXIT_FAILURE;
17850     }
17851 }
17852 EOCP
17853 $cat > a.c <<'EOCP'
17854 static INLINE int f(int x) {
17855     int y;
17856     y = x + 42;
17857     return y;
17858 }
17859
17860 int f_via_a(int x)
17861 {
17862     return f(x);
17863 }
17864 EOCP
17865 $cat > b.c <<'EOCP'
17866 extern int f(int x);
17867
17868 int f_via_b(int x)
17869 {
17870     return f(x);
17871 }
17872 EOCP
17873
17874 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17875 case "$perl_static_inline" in
17876 '')     # Check the various possibilities, and break out on success.
17877         # For gcc, prefer __inline__, which will still permit 
17878         # cflags.SH to add in -ansi.
17879         case "$gccversion" in
17880                 '') xxx="inline __inline__ __inline _inline";;
17881                 *)  xxx="__inline__ inline __inline _inline";;
17882         esac
17883         for inline in $xxx; do
17884                 set try -DINLINE=$inline a.c
17885                 if eval $compile && $run ./try; then
17886                         # Now make sure there is no external linkage of static
17887                         # functions
17888                         set try -DINLINE=$inline -DUSE_B a.c b.c
17889                         if eval $compile && $run ./try; then
17890                                 $echo "Your compiler supports static $inline, " >&4
17891                                 $echo "but it also creates an external definition," >&4
17892                                 $echo "so I won't use it." >&4
17893                                 val=$undef
17894                         else
17895                                 $echo "Your compiler supports static $inline." >&4
17896                                 val=$define
17897                                 perl_static_inline="static $inline";
17898                                 break;
17899                         fi
17900                 else
17901                         $echo "Your compiler does NOT support static $inline." >&4
17902                         val="$undef"
17903                 fi
17904         done
17905         ;;
17906 *inline*) # Some variant of inline exists.
17907         echo "Keeping your $hint value of $perl_static_inline."
17908         val=$define
17909         ;;
17910 static)  # No inline capabilities
17911         echo "Keeping your $hint value of $perl_static_inline."
17912         val=$undef
17913         ;;
17914 *)  # Unrecognized previous value -- blindly trust the supplied
17915         # value and hope it makes sense.  Use old value for
17916         # d_static_inline, if there is one.
17917         echo "Keeping your $hint value of $perl_static_inline."
17918         case "$d_static_inline" in
17919                 '') val=$define ;;
17920                 *)  val=$d_static_inline ;;
17921         esac
17922         ;;
17923 esac
17924 # Fallback to plain 'static' if nothing worked.
17925 case "$perl_static_inline" in
17926 '')
17927         perl_static_inline="static"
17928         val=$undef
17929         ;;
17930 esac
17931 set d_static_inline
17932 eval $setvar
17933 $rm -f a.[co] b.[co]
17934 $rm_try
17935
17936 : Check stream access
17937 $cat >&4 <<EOM
17938 Checking how to access stdio streams by file descriptor number...
17939 EOM
17940 case "$stdio_stream_array" in
17941 '')     $cat >try.c <<EOCP
17942 #include <stdio.h>
17943 int main() {
17944   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17945     printf("yes\n");
17946 }
17947 EOCP
17948         for s in _iob __iob __sF
17949         do
17950                 set try -DSTDIO_STREAM_ARRAY=$s
17951                 if eval $compile; then
17952                         case "`$run ./try`" in
17953                         yes)    stdio_stream_array=$s; break ;;
17954                         esac
17955                 fi
17956         done
17957         $rm_try
17958 esac
17959 case "$stdio_stream_array" in
17960 '')     $cat >&4 <<EOM
17961 I can't figure out how to access stdio streams by file descriptor number.
17962 EOM
17963         d_stdio_stream_array="$undef"
17964         ;;
17965 *)      $cat >&4 <<EOM
17966 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17967 EOM
17968         d_stdio_stream_array="$define"
17969         ;;
17970 esac
17971
17972 : see if strcoll exists
17973 set strcoll d_strcoll
17974 eval $inlibc
17975
17976 : check for structure copying
17977 echo " "
17978 echo "Checking to see if your C compiler can copy structs..." >&4
17979 $cat >try.c <<'EOCP'
17980 int main()
17981 {
17982         struct blurfl {
17983                 int dyick;
17984         } foo, bar;
17985
17986         foo = bar;
17987 }
17988 EOCP
17989 if $cc -c try.c >/dev/null 2>&1 ; then
17990         val="$define"
17991         echo "Yup, it can."
17992 else
17993         val="$undef"
17994         echo "Nope, it can't."
17995 fi
17996 set d_strctcpy
17997 eval $setvar
17998 $rm_try
17999
18000 : see if strerror and/or sys_errlist[] exist
18001 echo " "
18002 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18003     if set strerror val -f d_strerror; eval $csym; $val; then
18004                 echo 'strerror() found.' >&4
18005                 d_strerror="$define"
18006                 d_strerrm='strerror(e)'
18007                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18008                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18009                         d_syserrlst="$define"
18010                 else
18011                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18012                         d_syserrlst="$undef"
18013                 fi
18014     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18015                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18016                 echo 'strerror() found in string header.' >&4
18017                 d_strerror="$define"
18018                 d_strerrm='strerror(e)'
18019                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18020                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18021                                 d_syserrlst="$define"
18022                 else
18023                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18024                         d_syserrlst="$undef"
18025                 fi
18026     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18027                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18028                 d_strerror="$undef"
18029                 d_syserrlst="$define"
18030                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18031     else
18032                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18033                 d_strerror="$undef"
18034                 d_syserrlst="$undef"
18035                 d_strerrm='"unknown"'
18036     fi
18037 fi
18038
18039 : see if strerror_r exists
18040 set strerror_r d_strerror_r
18041 eval $inlibc
18042 case "$d_strerror_r" in
18043 "$define")
18044         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18045         case "$d_strerror_r_proto:$usethreads" in
18046         ":define")      d_strerror_r_proto=define
18047                 set d_strerror_r_proto strerror_r $hdrs
18048                 eval $hasproto ;;
18049         *)      ;;
18050         esac
18051         case "$d_strerror_r_proto" in
18052         define)
18053         case "$strerror_r_proto" in
18054         ''|0) try='int strerror_r(int, char*, size_t);'
18055         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18056         esac
18057         case "$strerror_r_proto" in
18058         ''|0) try='int strerror_r(int, char*, int);'
18059         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18060         esac
18061         case "$strerror_r_proto" in
18062         ''|0) try='char* strerror_r(int, char*, size_t);'
18063         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18064         esac
18065         case "$strerror_r_proto" in
18066         ''|0)   d_strerror_r=undef
18067                 strerror_r_proto=0
18068                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18069         * )     case "$strerror_r_proto" in
18070                 REENTRANT_PROTO*) ;;
18071                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18072                 esac
18073                 echo "Prototype: $try" ;;
18074         esac
18075         ;;
18076         *)      case "$usethreads" in
18077                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18078                 esac
18079                 d_strerror_r=undef
18080                 strerror_r_proto=0
18081                 ;;
18082         esac
18083         ;;
18084 *)      strerror_r_proto=0
18085         ;;
18086 esac
18087
18088 : see if strftime exists
18089 set strftime d_strftime
18090 eval $inlibc
18091
18092 : see if strlcat exists
18093 set strlcat d_strlcat
18094 eval $inlibc
18095
18096 : see if strlcpy exists
18097 set strlcpy d_strlcpy
18098 eval $inlibc
18099
18100 : see if strtod exists
18101 set strtod d_strtod
18102 eval $inlibc
18103
18104 : see if strtol exists
18105 set strtol d_strtol
18106 eval $inlibc
18107
18108 : see if strtold exists
18109 set strtold d_strtold
18110 eval $inlibc
18111
18112 : see if strtoll exists
18113 set strtoll d_strtoll
18114 eval $inlibc
18115
18116 case "$d_longlong-$d_strtoll" in
18117 "$define-$define")
18118         $cat <<EOM
18119 Checking whether your strtoll() works okay...
18120 EOM
18121         $cat >try.c <<'EOCP'
18122 #include <errno.h>
18123 #ifdef __hpux
18124 #define strtoll __strtoll
18125 #endif
18126 #ifdef __EMX__
18127 #define strtoll _strtoll
18128 #endif
18129 #include <stdio.h>
18130 extern long long int strtoll(char *s, char **, int);
18131 static int bad = 0;
18132 int check(char *s, long long ell, int een) {
18133         long long gll;
18134         errno = 0;
18135         gll = strtoll(s, 0, 10);
18136         if (!((gll == ell) && (errno == een)))
18137                 bad++;
18138 }
18139 int main() {
18140         check(" 1",                                      1LL, 0);
18141         check(" 0",                                      0LL, 0);
18142         check("-1",                                     -1LL, 0);
18143         check("-9223372036854775808", -9223372036854775808LL, 0);
18144         check("-9223372036854775808", -9223372036854775808LL, 0);
18145         check(" 9223372036854775807",  9223372036854775807LL, 0);
18146         check("-9223372036854775808", -9223372036854775808LL, 0);
18147         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18148         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18149         if (!bad)
18150                 printf("ok\n");
18151 }
18152 EOCP
18153         set try
18154         if eval $compile; then
18155                 yyy=`$run ./try`
18156                 case "$yyy" in
18157                 ok) echo "Your strtoll() seems to be working okay." ;;
18158                 *) cat <<EOM >&4
18159 Your strtoll() doesn't seem to be working okay.
18160 EOM
18161                    d_strtoll="$undef"
18162                    ;;
18163                 esac
18164         else
18165                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18166                 d_strtoll="$undef"
18167         fi
18168         ;;
18169 esac
18170
18171 : see if strtoq exists
18172 set strtoq d_strtoq
18173 eval $inlibc
18174
18175 : see if strtoul exists
18176 set strtoul d_strtoul
18177 eval $inlibc
18178
18179 case "$d_strtoul" in
18180 "$define")
18181         $cat <<EOM
18182 Checking whether your strtoul() works okay...
18183 EOM
18184         $cat >try.c <<'EOCP'
18185 #include <errno.h>
18186 #include <stdio.h>
18187 extern unsigned long int strtoul(char *s, char **, int);
18188 static int bad = 0;
18189 void check(char *s, unsigned long eul, int een) {
18190         unsigned long gul;
18191         errno = 0;
18192         gul = strtoul(s, 0, 10);
18193         if (!((gul == eul) && (errno == een)))
18194                 bad++;
18195 }
18196 int main() {
18197         check(" 1", 1L, 0);
18198         check(" 0", 0L, 0);
18199 EOCP
18200         case "$longsize" in
18201         8)
18202             $cat >>try.c <<'EOCP'
18203         check("18446744073709551615", 18446744073709551615UL, 0);
18204         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18205 #if 0 /* strtoul() for /^-/ strings is undefined. */
18206         check("-1", 18446744073709551615UL, 0);
18207         check("-18446744073709551614", 2, 0);
18208         check("-18446744073709551615", 1, 0);
18209         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18210         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18211 #endif
18212 EOCP
18213                 ;;
18214         4)
18215                     $cat >>try.c <<'EOCP'
18216         check("4294967295", 4294967295UL, 0);
18217         check("4294967296", 4294967295UL, ERANGE);
18218 #if 0 /* strtoul() for /^-/ strings is undefined. */
18219         check("-1", 4294967295UL, 0);
18220         check("-4294967294", 2, 0);
18221         check("-4294967295", 1, 0);
18222         check("-4294967296", 4294967295UL, ERANGE);
18223         check("-4294967297", 4294967295UL, ERANGE);
18224 #endif
18225 EOCP
18226                 ;;
18227         *)
18228 : Should we write these tests to be more portable by sprintf-ing
18229 : ~0 and then manipulating that char string as input for strtol?
18230                 ;;
18231         esac
18232         $cat >>try.c <<'EOCP'
18233         if (!bad)
18234                 printf("ok\n");
18235         return 0;
18236 }
18237 EOCP
18238         set try
18239         if eval $compile; then
18240                 case "`$run ./try`" in
18241                 ok) echo "Your strtoul() seems to be working okay." ;;
18242                 *) cat <<EOM >&4
18243 Your strtoul() doesn't seem to be working okay.
18244 EOM
18245                    d_strtoul="$undef"
18246                    ;;
18247                 esac
18248         else
18249                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18250                 d_strtoul="$undef"
18251         fi
18252         ;;
18253 esac
18254
18255 : see if strtoull exists
18256 set strtoull d_strtoull
18257 eval $inlibc
18258
18259 case "$d_longlong-$d_strtoull" in
18260 "$define-$define")
18261         $cat <<EOM
18262 Checking whether your strtoull() works okay...
18263 EOM
18264         $cat >try.c <<'EOCP'
18265 #include <errno.h>
18266 #ifdef __hpux
18267 #define strtoull __strtoull
18268 #endif
18269 #include <stdio.h>
18270 extern unsigned long long int strtoull(char *s, char **, int);
18271 static int bad = 0;
18272 int check(char *s, long long eull, int een) {
18273         long long gull;
18274         errno = 0;
18275         gull = strtoull(s, 0, 10);
18276         if (!((gull == eull) && (errno == een)))
18277                 bad++;
18278 }
18279 int main() {
18280         check(" 1",                                        1LL, 0);
18281         check(" 0",                                        0LL, 0);
18282         check("18446744073709551615",  18446744073709551615ULL, 0);
18283         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18284 #if 0 /* strtoull() for /^-/ strings is undefined. */
18285         check("-1",                    18446744073709551615ULL, 0);
18286         check("-18446744073709551614",                     2LL, 0);
18287         check("-18446744073709551615",                     1LL, 0);
18288         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18289         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18290 #endif
18291         if (!bad)
18292                 printf("ok\n");
18293 }
18294 EOCP
18295         set try
18296         if eval $compile; then
18297                 case "`$run ./try`" in
18298                 ok) echo "Your strtoull() seems to be working okay." ;;
18299                 *) cat <<EOM >&4
18300 Your strtoull() doesn't seem to be working okay.
18301 EOM
18302                    d_strtoull="$undef"
18303                    ;;
18304                 esac
18305         else
18306                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18307                 d_strtoull="$undef"
18308         fi
18309         ;;
18310 esac
18311
18312 : see if strtouq exists
18313 set strtouq d_strtouq
18314 eval $inlibc
18315
18316 case "$d_strtouq" in
18317 "$define")
18318         $cat <<EOM
18319 Checking whether your strtouq() works okay...
18320 EOM
18321         $cat >try.c <<'EOCP'
18322 #include <errno.h>
18323 #include <stdio.h>
18324 extern unsigned long long int strtouq(char *s, char **, int);
18325 static int bad = 0;
18326 void check(char *s, unsigned long long eull, int een) {
18327         unsigned long long gull;
18328         errno = 0;
18329         gull = strtouq(s, 0, 10);
18330         if (!((gull == eull) && (errno == een)))
18331                 bad++;
18332 }
18333 int main() {
18334         check(" 1",                                        1LL, 0);
18335         check(" 0",                                        0LL, 0);
18336         check("18446744073709551615",  18446744073709551615ULL, 0);
18337         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18338 #if 0 /* strtouq() for /^-/ strings is undefined. */
18339         check("-1",                    18446744073709551615ULL, 0);
18340         check("-18446744073709551614",                     2LL, 0);
18341         check("-18446744073709551615",                     1LL, 0);
18342         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18343         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18344 #endif
18345         if (!bad)
18346                 printf("ok\n");
18347         return 0;
18348 }
18349 EOCP
18350         set try
18351         if eval $compile; then
18352                 case "`$run ./try`" in
18353                 ok) echo "Your strtouq() seems to be working okay." ;;
18354                 *) cat <<EOM >&4
18355 Your strtouq() doesn't seem to be working okay.
18356 EOM
18357                    d_strtouq="$undef"
18358                    ;;
18359                 esac
18360         else
18361                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18362                 d_strtouq="$undef"
18363         fi
18364         ;;
18365 esac
18366
18367 : see if strxfrm exists
18368 set strxfrm d_strxfrm
18369 eval $inlibc
18370
18371 : see if symlink exists
18372 set symlink d_symlink
18373 eval $inlibc
18374
18375 : see if syscall exists
18376 set syscall d_syscall
18377 eval $inlibc
18378
18379 : see if prototype for syscall is available
18380 echo " "
18381 set d_syscallproto syscall $i_unistd unistd.h
18382 eval $hasproto
18383
18384 : see if sysconf exists
18385 set sysconf d_sysconf
18386 eval $inlibc
18387
18388 : see if system exists
18389 set system d_system
18390 eval $inlibc
18391
18392 : see if tcgetpgrp exists
18393 set tcgetpgrp d_tcgetpgrp
18394 eval $inlibc
18395
18396 : see if tcsetpgrp exists
18397 set tcsetpgrp d_tcsetpgrp
18398 eval $inlibc
18399
18400 : see if prototype for telldir is available
18401 echo " "
18402 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18403 eval $hasproto
18404
18405 : see if time exists
18406 echo " "
18407 if test "X$d_time" = X -o X"$timetype" = X; then
18408     if set time val -f d_time; eval $csym; $val; then
18409                 echo 'time() found.' >&4
18410                 val="$define"
18411                 rp="What is the type returned by time() on this system?"
18412                 set time_t timetype long stdio.h sys/types.h
18413                 eval $typedef_ask
18414     else
18415                 echo 'time() not found, hope that will do.' >&4
18416                 val="$undef"
18417                 timetype='int';
18418     fi
18419     set d_time
18420     eval $setvar
18421 fi
18422
18423 : see if timegm exists
18424 set timegm d_timegm
18425 eval $inlibc
18426
18427 : see if this is a sys/times.h system
18428 set sys/times.h i_systimes
18429 eval $inhdr
18430
18431 : see if times exists
18432 echo " "
18433 if set times val -f d_times; eval $csym; $val; then
18434         echo 'times() found.' >&4
18435         d_times="$define"
18436         inc=''
18437         case "$i_systimes" in
18438         "$define") inc='sys/times.h';;
18439         esac
18440         rp="What is the type returned by times() on this system?"
18441         set clock_t clocktype long stdio.h sys/types.h $inc
18442         eval $typedef_ask
18443 else
18444         echo 'times() NOT found, hope that will do.' >&4
18445         d_times="$undef"
18446         clocktype='int'
18447 fi
18448
18449 : see if tmpnam_r exists
18450 set tmpnam_r d_tmpnam_r
18451 eval $inlibc
18452 case "$d_tmpnam_r" in
18453 "$define")
18454         hdrs="$i_systypes sys/types.h define stdio.h "
18455         case "$d_tmpnam_r_proto:$usethreads" in
18456         ":define")      d_tmpnam_r_proto=define
18457                 set d_tmpnam_r_proto tmpnam_r $hdrs
18458                 eval $hasproto ;;
18459         *)      ;;
18460         esac
18461         case "$d_tmpnam_r_proto" in
18462         define)
18463         case "$tmpnam_r_proto" in
18464         ''|0) try='char* tmpnam_r(char*);'
18465         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18466         esac
18467         case "$tmpnam_r_proto" in
18468         ''|0)   d_tmpnam_r=undef
18469                 tmpnam_r_proto=0
18470                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18471         * )     case "$tmpnam_r_proto" in
18472                 REENTRANT_PROTO*) ;;
18473                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18474                 esac
18475                 echo "Prototype: $try" ;;
18476         esac
18477         ;;
18478         *)      case "$usethreads" in
18479                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18480                 esac
18481                 d_tmpnam_r=undef
18482                 tmpnam_r_proto=0
18483                 ;;
18484         esac
18485         ;;
18486 *)      tmpnam_r_proto=0
18487         ;;
18488 esac
18489
18490 : see if truncate exists
18491 set truncate d_truncate
18492 eval $inlibc
18493
18494 : see if ttyname_r exists
18495 set ttyname_r d_ttyname_r
18496 eval $inlibc
18497 case "$d_ttyname_r" in
18498 "$define")
18499         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18500         case "$d_ttyname_r_proto:$usethreads" in
18501         ":define")      d_ttyname_r_proto=define
18502                 set d_ttyname_r_proto ttyname_r $hdrs
18503                 eval $hasproto ;;
18504         *)      ;;
18505         esac
18506         case "$d_ttyname_r_proto" in
18507         define)
18508         case "$ttyname_r_proto" in
18509         ''|0) try='int ttyname_r(int, char*, size_t);'
18510         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18511         esac
18512         case "$ttyname_r_proto" in
18513         ''|0) try='int ttyname_r(int, char*, int);'
18514         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18515         esac
18516         case "$ttyname_r_proto" in
18517         ''|0) try='char* ttyname_r(int, char*, int);'
18518         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18519         esac
18520         case "$ttyname_r_proto" in
18521         ''|0)   d_ttyname_r=undef
18522                 ttyname_r_proto=0
18523                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18524         * )     case "$ttyname_r_proto" in
18525                 REENTRANT_PROTO*) ;;
18526                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18527                 esac
18528                 echo "Prototype: $try" ;;
18529         esac
18530         ;;
18531         *)      case "$usethreads" in
18532                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18533                 esac
18534                 d_ttyname_r=undef
18535                 ttyname_r_proto=0
18536                 ;;
18537         esac
18538         ;;
18539 *)      ttyname_r_proto=0
18540         ;;
18541 esac
18542
18543 : see if tzname[] exists
18544 echo " "
18545 if set tzname val -a d_tzname; eval $csym; $val; then
18546         val="$define"
18547         echo 'tzname[] found.' >&4
18548 else
18549         val="$undef"
18550         echo 'tzname[] NOT found.' >&4
18551 fi
18552 set d_tzname
18553 eval $setvar
18554
18555 : Check if is a multiplatform env
18556 case "$osname" in
18557 next|rhapsody|darwin) multiarch="$define" ;;
18558 esac
18559 case "$multiarch" in
18560 ''|[nN]*) multiarch="$undef" ;;
18561 esac
18562
18563 : check for ordering of bytes in a UV
18564 echo " "
18565 case "$usecrosscompile$multiarch" in
18566 *$define*)
18567         $cat <<EOM
18568 You seem to be either cross-compiling or doing a multiarchitecture build,
18569 skipping the byteorder check.
18570
18571 EOM
18572         byteorder='ffff'
18573         ;;
18574 *)
18575         case "$byteorder" in
18576         '')
18577                 $cat <<'EOM'
18578 In the following, larger digits indicate more significance.  A big-endian
18579 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18580 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18581 machines may have weird orders like 3412.  A Cray will report 87654321,
18582 an Alpha will report 12345678. If the test program works the default is
18583 probably right.
18584 I'm now running the test program...
18585 EOM
18586                 $cat >try.c <<EOCP
18587 #include <stdio.h>
18588 #$i_stdlib I_STDLIB
18589 #ifdef I_STDLIB
18590 #include <stdlib.h>
18591 #endif
18592 #include <sys/types.h>
18593 typedef $uvtype UV;
18594 int main()
18595 {
18596         int i;
18597         union {
18598                 UV l;
18599                 char c[$uvsize];
18600         } u;
18601
18602         if ($uvsize > 4)
18603                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18604         else
18605                 u.l = (UV)0x04030201;
18606         for (i = 0; i < $uvsize; i++)
18607                 printf("%c", u.c[i]+'0');
18608         printf("\n");
18609         exit(0);
18610 }
18611 EOCP
18612                 xxx_prompt=y
18613                 set try
18614                 if eval $compile && $run ./try > /dev/null; then
18615                         dflt=`$run ./try`
18616                         case "$dflt" in
18617                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18618                                 echo "(The test program ran ok.)"
18619                                 echo "byteorder=$dflt"
18620                                 xxx_prompt=n
18621                         ;;
18622                         ????|????????) echo "(The test program ran ok.)" ;;
18623                         *) echo "(The test program didn't run right for some reason.)" ;;
18624                         esac
18625                 else
18626                         dflt='4321'
18627                         cat <<'EOM'
18628 (I can't seem to compile the test program.  Guessing big-endian...)
18629 EOM
18630                 fi
18631                 case "$xxx_prompt" in
18632                 y)
18633                         rp="What is the order of bytes in $uvtype?"
18634                         . ./myread
18635                         byteorder="$ans"
18636                         ;;
18637                 *)      byteorder=$dflt
18638                         ;;
18639                 esac
18640                 ;;
18641         esac
18642         $rm_try
18643         ;;
18644 esac
18645
18646 : Checking 32bit alignedness
18647 $cat <<EOM
18648
18649 Checking to see whether you can access character data unalignedly...
18650 EOM
18651 case "$d_u32align" in
18652 '')   $cat >try.c <<EOCP
18653 #include <stdio.h>
18654 #$i_stdlib I_STDLIB
18655 #ifdef I_STDLIB
18656 #include <stdlib.h>
18657 #endif
18658 #define U32 $u32type
18659 #define BYTEORDER 0x$byteorder
18660 #define U8 $u8type
18661 #include <signal.h>
18662 #ifdef SIGBUS
18663 $signal_t bletch(int s) { exit(4); }
18664 #endif
18665 int main() {
18666 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18667     volatile U8 buf[8];
18668     volatile U32 *up;
18669     int i;
18670
18671     if (sizeof(U32) != 4) {
18672         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18673         exit(1);
18674     }
18675
18676     fflush(stdout);
18677
18678 #ifdef SIGBUS
18679     signal(SIGBUS, bletch);
18680 #endif
18681
18682     buf[0] = 0;
18683     buf[1] = 0;
18684     buf[2] = 0;
18685     buf[3] = 1;
18686     buf[4] = 0;
18687     buf[5] = 0;
18688     buf[6] = 0;
18689     buf[7] = 1;
18690
18691     for (i = 0; i < 4; i++) {
18692         up = (U32*)(buf + i);
18693         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18694                (*up == 1 << (8*(3-i)))  /* little-endian */
18695               )
18696            )
18697         {
18698             printf("read failed (%x)\n", *up);
18699             exit(2);
18700         }
18701     }
18702
18703     /* write test */
18704     for (i = 0; i < 4; i++) {
18705         up = (U32*)(buf + i);
18706         *up = 0xBeef;
18707         if (*up != 0xBeef) {
18708             printf("write failed (%x)\n", *up);
18709             exit(3);
18710         }
18711     }
18712
18713     exit(0);
18714 #else
18715     printf("1\n");
18716     exit(1);
18717 #endif
18718     return 0;
18719 }
18720 EOCP
18721 set try
18722 if eval $compile_ok; then
18723         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18724         $run ./try 2>&1 >/dev/null
18725         case "$?" in
18726         0)      cat >&4 <<EOM
18727 You can access character data pretty unalignedly.
18728 EOM
18729                 d_u32align="$undef"
18730                 ;;
18731         *)      cat >&4 <<EOM
18732 It seems that you must access character data in an aligned manner.
18733 EOM
18734                 d_u32align="$define"
18735                 ;;
18736         esac
18737 else
18738         rp='Can you access character data at unaligned addresses?'
18739         dflt='n'
18740         . ./myread
18741         case "$ans" in
18742         [yY]*)  d_u32align="$undef"  ;;
18743         *)      d_u32align="$define" ;;
18744         esac
18745 fi
18746 $rm_try
18747 ;;
18748 esac
18749
18750 : see if ualarm exists
18751 set ualarm d_ualarm
18752 eval $inlibc
18753
18754 : see if umask exists
18755 set umask d_umask
18756 eval $inlibc
18757
18758 : see if unordered exists
18759 set unordered d_unordered
18760 eval $inlibc
18761
18762 : see if unsetenv exists
18763 set unsetenv d_unsetenv
18764 eval $inlibc
18765
18766 : see if usleep exists
18767 set usleep d_usleep
18768 eval $inlibc
18769
18770 : see if prototype for usleep is available
18771 echo " "
18772 set d_usleepproto usleep $i_unistd unistd.h
18773 eval $hasproto
18774
18775 : see if ustat exists
18776 set ustat d_ustat
18777 eval $inlibc
18778
18779 : see if closedir exists
18780 set closedir d_closedir
18781 eval $inlibc
18782
18783 case "$d_closedir" in
18784 "$define")
18785         echo " "
18786         echo "Checking whether closedir() returns a status..." >&4
18787         cat > try.c <<EOM
18788 #$i_dirent I_DIRENT             /**/
18789 #$i_sysdir I_SYS_DIR            /**/
18790 #$i_sysndir I_SYS_NDIR          /**/
18791 #$i_systypes I_SYS_TYPES        /**/
18792
18793 #if defined(I_SYS_TYPES)
18794 #include <sys/types.h>
18795 #endif
18796 #if defined(I_DIRENT)
18797 #include <dirent.h>
18798 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18799 #include <sys/dir.h>
18800 #endif
18801 #else
18802 #ifdef I_SYS_NDIR
18803 #include <sys/ndir.h>
18804 #else
18805 #ifdef I_SYS_DIR
18806 #ifdef hp9000s500
18807 #include <ndir.h>       /* may be wrong in the future */
18808 #else
18809 #include <sys/dir.h>
18810 #endif
18811 #endif
18812 #endif
18813 #endif
18814 int main() { return closedir(opendir(".")); }
18815 EOM
18816         set try
18817         if eval $compile_ok; then
18818                 if $run ./try > /dev/null 2>&1 ; then
18819                         echo "Yes, it does."
18820                         val="$undef"
18821                 else
18822                         echo "No, it doesn't."
18823                         val="$define"
18824                 fi
18825         else
18826                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18827                 val="$define"
18828         fi
18829         ;;
18830 *)
18831         val="$undef";
18832         ;;
18833 esac
18834 set d_void_closedir
18835 eval $setvar
18836 $rm_try
18837
18838 : see if there is a wait4
18839 set wait4 d_wait4
18840 eval $inlibc
18841
18842 : see if waitpid exists
18843 set waitpid d_waitpid
18844 eval $inlibc
18845
18846 : see if wcstombs exists
18847 set wcstombs d_wcstombs
18848 eval $inlibc
18849
18850 : see if wctomb exists
18851 set wctomb d_wctomb
18852 eval $inlibc
18853
18854 : see if writev exists
18855 set writev d_writev
18856 eval $inlibc
18857
18858 : preserve RCS keywords in files with variable substitution, grrr
18859 Date='$Date'
18860 Id='$Id'
18861 Log='$Log'
18862 RCSfile='$RCSfile'
18863 Revision='$Revision'
18864
18865 : check for alignment requirements
18866 echo " "
18867 case "$usecrosscompile$multiarch" in
18868 *$define*)
18869         $cat <<EOM
18870 You seem to be either cross-compiling or doing a multiarchitecture build,
18871 skipping the memory alignment check.
18872
18873 EOM
18874         case "$alignbytes" in
18875         '') alignbytes=8 ;;
18876         esac
18877         ;;
18878 *)
18879         case "$alignbytes" in
18880         '') echo "Checking alignment constraints..." >&4
18881                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18882                         $cat >try.c <<'EOCP'
18883 typedef long double NV;
18884 EOCP
18885                 else
18886                         $cat >try.c <<'EOCP'
18887 typedef double NV;
18888 EOCP
18889                 fi
18890                 $cat >>try.c <<'EOCP'
18891 #include <stdio.h>
18892 struct foobar {
18893         char foo;
18894         NV bar;
18895 } try_algn;
18896 int main()
18897 {
18898     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18899     return(0);
18900 }
18901 EOCP
18902                 set try
18903                 if eval $compile_ok; then
18904                         dflt=`$run ./try`
18905                 else
18906                         dflt='8'
18907                         echo "(I can't seem to compile the test program...)"
18908                 fi
18909                 ;;
18910         *) dflt="$alignbytes"
18911                 ;;
18912         esac
18913         rp="Doubles must be aligned on a how-many-byte boundary?"
18914         . ./myread
18915         alignbytes="$ans"
18916         $rm_try
18917         ;;
18918 esac
18919
18920
18921 : set the base revision
18922 baserev=5.0
18923
18924 : length of character in bytes. Is always 1, otherwise it isnt C
18925 : This used to be a test using sizeof
18926 charsize=1
18927
18928 : Check for the number of bits in a character
18929 case "$charbits" in
18930 '')     echo "Checking how long a character is (in bits)..." >&4
18931         $cat >try.c <<EOCP
18932 #include <stdio.h>
18933 int main ()
18934 {
18935     int n;
18936     unsigned char c;
18937     for (c = 1, n = 0; c; c <<= 1, n++) ;
18938     printf ("%d\n", n);
18939     return (0);
18940     }
18941 EOCP
18942         set try
18943         if eval $compile_ok; then
18944                 dflt=`$run ./try`
18945         else
18946                 dflt='8'
18947                 echo "(I can't seem to compile the test program.  Guessing...)"
18948         fi
18949         ;;
18950 *)
18951         dflt="$charbits"
18952         ;;
18953 esac
18954 rp="What is the length of a character (in bits)?"
18955 . ./myread
18956 charbits="$ans"
18957 $rm_try
18958 case "$charbits" in
18959 8)      ;;
18960 *)      cat >&4 << EOM
18961 Your system has an unsigned character size of $charbits bits, which
18962 is rather unusual (normally it is 8 bits).  Perl likely will not work
18963 correctly on your system, with subtle bugs in various places.
18964 EOM
18965         rp='Do you really want to continue?'
18966         dflt='n'
18967         . ./myread
18968         case "$ans" in
18969                 [yY])   echo >&4 "Okay, continuing."    ;;
18970                 *)      exit 1                          ;;
18971         esac
18972 esac
18973
18974 : how do we concatenate cpp tokens here?
18975 echo " "
18976 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18977 $cat >cpp_stuff.c <<'EOCP'
18978 #define RCAT(a,b)a/**/b
18979 #define ACAT(a,b)a ## b
18980 RCAT(Rei,ser)
18981 ACAT(Cir,cus)
18982 EOCP
18983 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18984 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18985         echo "Oh!  Smells like ANSI's been here." >&4
18986         echo "We can catify or stringify, separately or together!"
18987         cpp_stuff=42
18988 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18989         echo "Ah, yes!  The good old days!" >&4
18990         echo "However, in the good old days we don't know how to stringify and"
18991         echo "catify at the same time."
18992         cpp_stuff=1
18993 else
18994         $cat >&4 <<EOM
18995 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18996 You're going to have to edit the values of CAT[2-5] in config.h...
18997 EOM
18998         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18999 fi
19000 $rm -f cpp_stuff.*
19001
19002 : see if this is a db.h system
19003 set db.h i_db
19004 eval $inhdr
19005
19006 case "$i_db" in
19007 $define)
19008         : Check db version.
19009         echo " "
19010         echo "Checking Berkeley DB version ..." >&4
19011         $cat >try.c <<EOCP
19012 #$d_const HASCONST
19013 #ifndef HASCONST
19014 #define const
19015 #endif
19016 #include <sys/types.h>
19017 #include <stdio.h>
19018 #$i_stdlib I_STDLIB
19019 #ifdef I_STDLIB
19020 #include <stdlib.h>
19021 #endif
19022 #include <db.h>
19023 int main(int argc, char *argv[])
19024 {
19025 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19026     int Major, Minor, Patch ;
19027     unsigned long Version ;
19028     (void)db_version(&Major, &Minor, &Patch) ;
19029     if (argc == 2) {
19030         printf("%d %d %d %d %d %d\n",
19031                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19032                Major, Minor, Patch);
19033         exit(0);
19034     }
19035     printf("You have Berkeley DB Version 2 or greater.\n");
19036
19037     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19038                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19039     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19040                 Major, Minor, Patch) ;
19041
19042     /* check that db.h & libdb are compatible */
19043     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19044         printf("db.h and libdb are incompatible.\n") ;
19045         exit(3);
19046     }
19047
19048     printf("db.h and libdb are compatible.\n") ;
19049
19050     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19051                 + DB_VERSION_PATCH ;
19052
19053     /* needs to be >= 2.3.4 */
19054     if (Version < 2003004) {
19055     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19056         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19057         exit(2);
19058     }
19059
19060     exit(0);
19061 #else
19062 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19063     if (argc == 2) {
19064         printf("1 0 0\n");
19065         exit(0);
19066     }
19067     printf("You have Berkeley DB Version 1.\n");
19068     exit(0);    /* DB version < 2: the coast is clear. */
19069 #else
19070     exit(1);    /* <db.h> not Berkeley DB? */
19071 #endif
19072 #endif
19073 }
19074 EOCP
19075         set try
19076         if eval $compile_ok && $run ./try; then
19077                 echo 'Looks OK.' >&4
19078                 set `$run ./try 1`
19079                 db_version_major=$1
19080                 db_version_minor=$2
19081                 db_version_patch=$3
19082         else
19083                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19084                 i_db=$undef
19085                 case " $libs " in
19086                 *"-ldb "*)
19087                         : Remove db from list of libraries to use
19088                         echo "Removing unusable -ldb from library list" >&4
19089                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19090                         shift
19091                         libs="$*"
19092                         echo "libs = $libs" >&4
19093                         ;;
19094                 esac
19095         fi
19096         $rm_try
19097         ;;
19098 esac
19099
19100 case "$i_db" in
19101 define)
19102         : Check the return type needed for hash
19103         echo " "
19104         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19105         $cat >try.c <<EOCP
19106 #$d_const HASCONST
19107 #ifndef HASCONST
19108 #define const
19109 #endif
19110 #include <sys/types.h>
19111 #include <db.h>
19112
19113 #ifndef DB_VERSION_MAJOR
19114 u_int32_t hash_cb (ptr, size)
19115 const void *ptr;
19116 size_t size;
19117 {
19118 }
19119 HASHINFO info;
19120 int main()
19121 {
19122         info.hash = hash_cb;
19123 }
19124 #endif
19125 EOCP
19126         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19127                 if $contains warning try.out >>/dev/null 2>&1 ; then
19128                         db_hashtype='int'
19129                 else
19130                         db_hashtype='u_int32_t'
19131                 fi
19132         else
19133                 : XXX Maybe we should just give up here.
19134                 db_hashtype=u_int32_t
19135                 $cat try.out >&4
19136                 echo "Help:  I can't seem to compile the db test program." >&4
19137                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19138         fi
19139         $rm_try
19140         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19141         ;;
19142 *)      db_hashtype=u_int32_t
19143         ;;
19144 esac
19145 case "$i_db" in
19146 define)
19147         : Check the return type needed for prefix
19148         echo " "
19149         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19150         cat >try.c <<EOCP
19151 #$d_const HASCONST
19152 #ifndef HASCONST
19153 #define const
19154 #endif
19155 #include <sys/types.h>
19156 #include <db.h>
19157
19158 #ifndef DB_VERSION_MAJOR
19159 size_t prefix_cb (key1, key2)
19160 const DBT *key1;
19161 const DBT *key2;
19162 {
19163 }
19164 BTREEINFO info;
19165 int main()
19166 {
19167         info.prefix = prefix_cb;
19168 }
19169 #endif
19170 EOCP
19171         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19172                 if $contains warning try.out >>/dev/null 2>&1 ; then
19173                         db_prefixtype='int'
19174                 else
19175                         db_prefixtype='size_t'
19176                 fi
19177         else
19178                 db_prefixtype='size_t'
19179                 : XXX Maybe we should just give up here.
19180                 $cat try.out >&4
19181                 echo "Help:  I can't seem to compile the db test program." >&4
19182                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19183         fi
19184         $rm_try
19185         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19186         ;;
19187 *)      db_prefixtype='size_t'
19188         ;;
19189 esac
19190
19191 : How can we generate normalized random numbers ?
19192 echo " "
19193 echo "Looking for a random number function..." >&4
19194 case "$randfunc" in
19195 '')
19196         if set drand48 val -f; eval $csym; $val; then
19197                 dflt="drand48"
19198                 echo "Good, found drand48()." >&4
19199         elif set random val -f; eval $csym; $val; then
19200                 dflt="random"
19201                 echo "OK, found random()." >&4
19202         else
19203                 dflt="rand"
19204                 echo "Yick, looks like I have to use rand()." >&4
19205         fi
19206         echo " "
19207         ;;
19208 *)
19209         dflt="$randfunc"
19210         ;;
19211 esac
19212 cont=true
19213
19214 case "$ccflags" in
19215 *-Dmy_rand=*|*-Dmy_srand=*)
19216         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19217         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19218         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19219         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19220         ;;
19221 esac
19222
19223 while $test "$cont"; do
19224         rp="Use which function to generate random numbers?"
19225         . ./myread
19226         if $test "$ans" = "$dflt"; then
19227                 : null
19228         else
19229                 randbits=''
19230         fi
19231         randfunc="$ans"
19232         if set $ans val -f; eval $csym; $val; then
19233                 cont=''
19234         else
19235                 dflt=y
19236                 rp="I cannot find function $ans. Use that name anyway?"
19237                 . ./myread
19238                 dflt=rand
19239                 case "$ans" in
19240                         [yY]*) cont='';;
19241                 esac
19242         fi
19243         case "$cont" in
19244         '')
19245                 case "$randfunc" in
19246                 drand48)
19247                         drand01="drand48()"
19248                         seedfunc="srand48"
19249                         randbits=48
19250                         randseedtype=long
19251                         ;;
19252                 rand|random)
19253                         case "$randbits" in
19254                         '')
19255 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19256                                 $cat >try.c <<EOCP
19257 #$i_unistd I_UNISTD
19258 #$i_stdlib I_STDLIB
19259 #include <stdio.h>
19260 #ifdef I_UNISTD
19261 #  include <unistd.h>
19262 #endif
19263 #ifdef I_STDLIB
19264 #  include <stdlib.h>
19265 #endif
19266 int main()
19267 {
19268         register int i;
19269         register unsigned long tmp;
19270         register unsigned long max = 0L;
19271
19272         for (i = 1000; i; i--) {
19273                 tmp = (unsigned long) $randfunc();
19274                 if (tmp > max) max = tmp;
19275         }
19276         for (i = 0; max; i++)
19277                 max /= 2;
19278         printf("%d\n",i);
19279 }
19280 EOCP
19281                                 set try
19282                                 if eval $compile_ok; then
19283                                         dflt=`try`
19284                                 else
19285                                         dflt='?'
19286                                         echo "(I can't seem to compile the test program...)"
19287                                 fi
19288                                 ;;
19289                         *)
19290                                 dflt="$randbits"
19291                                 ;;
19292                         esac
19293                         rp="How many bits does your $randfunc() function produce?"
19294                         . ./myread
19295                         randbits="$ans"
19296                         $rm_try
19297                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19298                         seedfunc="s$randfunc"
19299                         randseedtype=unsigned
19300                         ;;
19301                 *)
19302                         dflt="31"
19303                         rp="How many bits does your $randfunc() function produce?"
19304                         . ./myread
19305                         randbits="$ans"
19306                         seedfunc="s$randfunc"
19307                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19308                         if set $seedfunc val -f; eval $csym; $val; then
19309                                 echo "(Using $seedfunc() to seed random generator)"
19310                         else
19311                                 echo "(Warning: no $seedfunc() to seed random generator)"
19312                                 seedfunc=rand
19313                         fi
19314                         randseedtype=unsigned
19315                         ;;
19316                 esac
19317                 ;;
19318         esac
19319 done
19320
19321 : Determine if this is an EBCDIC system
19322 echo " "
19323 echo "Determining whether or not we are on an EBCDIC system..." >&4
19324 $cat >try.c <<'EOM'
19325 int main()
19326 {
19327   if ('M'==0xd4) return 0;
19328   return 1;
19329 }
19330 EOM
19331
19332 val=$undef
19333 set try
19334 if eval $compile_ok; then
19335         if $run ./try; then
19336                 echo "You seem to speak EBCDIC." >&4
19337                 val="$define"
19338         else
19339                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19340         fi
19341 else
19342         echo "I'm unable to compile the test program." >&4
19343         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19344 fi
19345 $rm_try
19346 set ebcdic
19347 eval $setvar
19348
19349 : Check how to flush
19350 echo " "
19351 $cat >&4 <<EOM
19352 Checking how to flush all pending stdio output...
19353 EOM
19354 # I only know how to find the first 32 possibly open files on SunOS.
19355 # See also hints/sunos_4_1.sh and util.c  --AD
19356 case "$osname" in
19357 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19358 esac
19359 $cat >>try.c <<EOCP
19360 #include <stdio.h>
19361 #$i_stdlib I_STDLIB
19362 #ifdef I_STDLIB
19363 #include <stdlib.h>
19364 #endif
19365 #$i_unistd I_UNISTD
19366 #ifdef I_UNISTD
19367 # include <unistd.h>
19368 #endif
19369 #$d_sysconf HAS_SYSCONF
19370 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19371 #ifdef HAS_STDIO_STREAM_ARRAY
19372 # define STDIO_STREAM_ARRAY $stdio_stream_array
19373 #endif
19374 int main() {
19375   FILE* p;
19376   unlink("try.out");
19377   p = fopen("try.out", "w");
19378 #ifdef TRY_FPUTC
19379   fputc('x', p);
19380 #else
19381 # ifdef TRY_FPRINTF
19382   fprintf(p, "x");
19383 # endif
19384 #endif
19385 #ifdef TRY_FFLUSH_NULL
19386   fflush(NULL);
19387 #endif
19388 #ifdef TRY_FFLUSH_ALL
19389   {
19390     long open_max = -1;
19391 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19392     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19393 # else
19394 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19395     open_max = sysconf(_SC_OPEN_MAX);
19396 #  else
19397 #   ifdef FOPEN_MAX
19398     open_max = FOPEN_MAX;
19399 #   else
19400 #    ifdef OPEN_MAX
19401     open_max = OPEN_MAX;
19402 #    else
19403 #     ifdef _NFILE
19404     open_max = _NFILE;
19405 #     endif
19406 #    endif
19407 #   endif
19408 #  endif
19409 # endif
19410 # ifdef HAS_STDIO_STREAM_ARRAY
19411     if (open_max > 0) {
19412       long i;
19413       for (i = 0; i < open_max; i++)
19414             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19415                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19416                 STDIO_STREAM_ARRAY[i]._flag)
19417                 fflush(&STDIO_STREAM_ARRAY[i]);
19418     }
19419   }
19420 # endif
19421 #endif
19422   _exit(42);
19423 }
19424 EOCP
19425 : first we have to find out how _not_ to flush
19426 $to try.c
19427 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19428     output=''
19429     set try -DTRY_FPUTC
19430     if eval $compile; then
19431             $run ./try 2>/dev/null
19432             code="$?"
19433             $from try.out
19434             if $test ! -s try.out -a "X$code" = X42; then
19435                 output=-DTRY_FPUTC
19436             fi
19437     fi
19438     case "$output" in
19439     '')
19440             set try -DTRY_FPRINTF
19441             if eval $compile; then
19442                     $run ./try 2>/dev/null
19443                     code="$?"
19444                     $from try.out
19445                     if $test ! -s try.out -a "X$code" = X42; then
19446                         output=-DTRY_FPRINTF
19447                     fi
19448             fi
19449         ;;
19450     esac
19451 fi
19452 : check for fflush NULL behaviour
19453 case "$fflushNULL" in
19454 '')     set try -DTRY_FFLUSH_NULL $output
19455         if eval $compile; then
19456                 $run ./try 2>/dev/null
19457                 code="$?"
19458                 $from try.out
19459                 if $test -s try.out -a "X$code" = X42; then
19460                         fflushNULL="`$cat try.out`"
19461                 else
19462                         if $test "X$code" != X42; then
19463                                 $cat >&4 <<EOM
19464 (If this test failed, don't worry, we'll try another method shortly.)
19465 EOM
19466                         fi
19467                 fi
19468         fi
19469         $rm -f core try.core core.try.*
19470         case "$fflushNULL" in
19471         x)      $cat >&4 <<EOM
19472 Your fflush(NULL) works okay for output streams.
19473 Let's see if it clobbers input pipes...
19474 EOM
19475 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19476 # bug that improperly flushes the input end of pipes.  So we avoid the
19477 # autoflush on fork/system/exec support for now. :-(
19478 $cat >tryp.c <<EOCP
19479 #include <stdio.h>
19480 int
19481 main(int argc, char **argv)
19482 {
19483     char buf[1024];
19484     int i;
19485     char *bp = buf;
19486     while (1) {
19487         while ((i = getc(stdin)) != -1
19488                && (*bp++ = i) != '\n'
19489                && bp < &buf[1024])
19490         /* DO NOTHING */ ;
19491         *bp = '\0';
19492         fprintf(stdout, "%s", buf);
19493         fflush(NULL);
19494         if (i == -1)
19495             return 0;
19496         bp = buf;
19497     }
19498 }
19499 EOCP
19500                 fflushNULL="$define"
19501                 set tryp
19502                 if eval $compile; then
19503                     $rm -f tryp.out
19504                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19505                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19506                        $cat >&4 <<EOM
19507 fflush(NULL) seems to behave okay with input streams.
19508 EOM
19509                         fflushNULL="$define"
19510                     else
19511                         $cat >&4 <<EOM
19512 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19513 EOM
19514                         fflushNULL="$undef"
19515                     fi
19516                 fi
19517                 $rm -f core tryp.c tryp.core core.tryp.*
19518                 ;;
19519         '')     $cat >&4 <<EOM
19520 Your fflush(NULL) isn't working (contrary to ANSI C).
19521 EOM
19522                 fflushNULL="$undef"
19523                 ;;
19524         *)      $cat >&4 <<EOM
19525 Cannot figure out whether your fflush(NULL) works or not.
19526 I'm assuming it doesn't (contrary to ANSI C).
19527 EOM
19528                 fflushNULL="$undef"
19529                 ;;
19530         esac
19531         ;;
19532 $define|true|[yY]*)
19533         fflushNULL="$define"
19534         ;;
19535 *)
19536         fflushNULL="$undef"
19537         ;;
19538 esac
19539 : check explicit looping only if NULL did not work, and if the pipe
19540 : bug does not show up on an explicit flush too
19541 case "$fflushNULL" in
19542 "$undef")
19543         $cat >tryp.c <<EOCP
19544 #include <stdio.h>
19545 int
19546 main(int argc, char **argv)
19547 {
19548     char buf[1024];
19549     int i;
19550     char *bp = buf;
19551     while (1) {
19552         while ((i = getc(stdin)) != -1
19553                && (*bp++ = i) != '\n'
19554                && bp < &buf[1024])
19555         /* DO NOTHING */ ;
19556         *bp = '\0';
19557         fprintf(stdout, "%s", buf);
19558         fflush(stdin);
19559         if (i == -1)
19560             return 0;
19561         bp = buf;
19562     }
19563 }
19564 EOCP
19565         set tryp
19566         if eval $compile; then
19567             $rm -f tryp.out
19568             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19569             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19570                $cat >&4 <<EOM
19571 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19572 EOM
19573                 : now check for fflushall behaviour
19574                 case "$fflushall" in
19575                 '')     set try -DTRY_FFLUSH_ALL $output
19576                         if eval $compile; then
19577                                 $cat >&4 <<EOM
19578 (Now testing the other method--but note that this also may fail.)
19579 EOM
19580                                 $run ./try 2>/dev/null
19581                                 code=$?
19582                                 $from try.out
19583                                 if $test -s try.out -a "X$code" = X42; then
19584                                         fflushall="`$cat try.out`"
19585                                 fi
19586                         fi
19587                         $rm_try
19588                         case "$fflushall" in
19589                         x)      $cat >&4 <<EOM
19590 Whew. Flushing explicitly all the stdio streams works.
19591 EOM
19592                                 fflushall="$define"
19593                                 ;;
19594                         '')     $cat >&4 <<EOM
19595 Sigh. Flushing explicitly all the stdio streams doesn't work.
19596 EOM
19597                                 fflushall="$undef"
19598                                 ;;
19599                         *)      $cat >&4 <<EOM
19600 Cannot figure out whether flushing stdio streams explicitly works or not.
19601 I'm assuming it doesn't.
19602 EOM
19603                                 fflushall="$undef"
19604                                 ;;
19605                         esac
19606                         ;;
19607                 "$define"|true|[yY]*)
19608                         fflushall="$define"
19609                         ;;
19610                 *)
19611                         fflushall="$undef"
19612                         ;;
19613                 esac
19614             else
19615                 $cat >&4 <<EOM
19616 All is futile.  Even fflush(stdin) clobbers input pipes!
19617 EOM
19618                 fflushall="$undef"
19619             fi
19620         else
19621             fflushall="$undef"
19622         fi
19623         $rm -f core tryp.c tryp.core core.tryp.*
19624         ;;
19625 *)      fflushall="$undef"
19626         ;;
19627 esac
19628
19629 case "$fflushNULL$fflushall" in
19630 undefundef)
19631         $cat <<EOM
19632 OK, I give up.  I cannot figure out how to flush pending stdio output.
19633 We won't be flushing handles at all before fork/exec/popen.
19634 EOM
19635         ;;
19636 esac
19637 $rm_try tryp
19638
19639 : Store the full pathname to the ar program for use in the C program
19640 : Respect a hint or command line value for full_ar.
19641 case "$full_ar" in
19642 '') full_ar=$ar ;;
19643 esac
19644
19645 : Store the full pathname to the sed program for use in the C program
19646 full_sed=$sed
19647
19648 : see what type gids are declared as in the kernel
19649 echo " "
19650 echo "Looking for the type for group ids returned by getgid()."
19651 set gid_t gidtype xxx stdio.h sys/types.h
19652 eval $typedef
19653 case "$gidtype" in
19654 xxx)
19655         xxx=`./findhdr sys/user.h`
19656         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19657         case $1 in
19658         unsigned) dflt="$1 $2" ;;
19659         *) dflt="$1" ;;
19660         esac
19661         ;;
19662 *) dflt="$gidtype";;
19663 esac
19664 case "$gidtype" in
19665 gid_t) echo "gid_t found." ;;
19666 *)      rp="What is the type for group ids returned by getgid()?"
19667         . ./myread
19668         gidtype="$ans"
19669         ;;
19670 esac
19671
19672 : Check the size of GID
19673 echo " "
19674 case "$gidtype" in
19675 *_t) zzz="$gidtype"     ;;
19676 *)   zzz="gid"          ;;
19677 esac
19678 echo "Checking the size of $zzz..." >&4
19679 cat > try.c <<EOCP
19680 #include <sys/types.h>
19681 #include <stdio.h>
19682 #$i_stdlib I_STDLIB
19683 #ifdef I_STDLIB
19684 #include <stdlib.h>
19685 #endif
19686 int main() {
19687     printf("%d\n", (int)sizeof($gidtype));
19688     exit(0);
19689 }
19690 EOCP
19691 set try
19692 if eval $compile_ok; then
19693         yyy=`$run ./try`
19694         case "$yyy" in
19695         '')     gidsize=4
19696                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19697                 ;;
19698         *)      gidsize=$yyy
19699                 echo "Your $zzz is $gidsize bytes long."
19700                 ;;
19701         esac
19702 else
19703         gidsize=4
19704         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19705 fi
19706
19707
19708 : Check if GID is signed
19709 echo " "
19710 case "$gidtype" in
19711 *_t) zzz="$gidtype"     ;;
19712 *)   zzz="gid"          ;;
19713 esac
19714 echo "Checking the sign of $zzz..." >&4
19715 cat > try.c <<EOCP
19716 #include <sys/types.h>
19717 #include <stdio.h>
19718 int main() {
19719         $gidtype foo = -1;
19720         if (foo < 0)
19721                 printf("-1\n");
19722         else
19723                 printf("1\n");
19724 }
19725 EOCP
19726 set try
19727 if eval $compile; then
19728         yyy=`$run ./try`
19729         case "$yyy" in
19730         '')     gidsign=1
19731                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19732                 ;;
19733         *)      gidsign=$yyy
19734                 case "$gidsign" in
19735                  1) echo "Your $zzz is unsigned." ;;
19736                 -1) echo "Your $zzz is signed."   ;;
19737                 esac
19738                 ;;
19739         esac
19740 else
19741         gidsign=1
19742         echo "(I can't compile the test program--guessing unsigned.)" >&4
19743 fi
19744
19745
19746 : Check 64bit sizes
19747 echo " "
19748
19749 if $test X"$quadtype" != X; then
19750
19751 echo "Checking how to print 64-bit integers..." >&4
19752
19753 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19754         $cat >try.c <<'EOCP'
19755 #include <sys/types.h>
19756 #include <stdio.h>
19757 int main() {
19758   int q = 12345678901;
19759   printf("%ld\n", q);
19760 }
19761 EOCP
19762         set try
19763         if eval $compile; then
19764                 yyy=`$run ./try`
19765                 case "$yyy" in
19766                 12345678901)
19767                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19768                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19769                         echo "We will use %d."
19770                         ;;
19771                 esac
19772         fi
19773 fi
19774
19775 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19776         $cat >try.c <<'EOCP'
19777 #include <sys/types.h>
19778 #include <stdio.h>
19779 int main() {
19780   long q = 12345678901;
19781   printf("%ld\n", q);
19782 }
19783 EOCP
19784         set try
19785         if eval $compile; then
19786                 yyy=`$run ./try`
19787                 case "$yyy" in
19788                 12345678901)
19789                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19790                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19791                         echo "We will use %ld."
19792                         ;;
19793                 esac
19794         fi
19795 fi
19796
19797 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19798         $cat >try.c <<'EOCP'
19799 #include <sys/types.h>
19800 #include <inttypes.h>
19801 #include <stdio.h>
19802 int main() {
19803   int64_t q = 12345678901;
19804   printf("%" PRId64 "\n", q);
19805 }
19806 EOCP
19807         set try
19808         if eval $compile; then
19809                 yyy=`$run ./try`
19810                 case "$yyy" in
19811                 12345678901)
19812                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19813                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19814                         echo "We will use the C9X style."
19815                         ;;
19816                 esac
19817         fi
19818 fi
19819
19820 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19821         $cat >try.c <<EOCP
19822 #include <sys/types.h>
19823 #include <stdio.h>
19824 int main() {
19825   $quadtype q = 12345678901;
19826   printf("%Ld\n", q);
19827 }
19828 EOCP
19829         set try
19830         if eval $compile; then
19831                 yyy=`$run ./try`
19832                 case "$yyy" in
19833                 12345678901)
19834                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19835                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19836                         echo "We will use %Ld."
19837                         ;;
19838                 esac
19839         fi
19840 fi
19841
19842 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19843         $cat >try.c <<'EOCP'
19844 #include <sys/types.h>
19845 #include <stdio.h>
19846 int main() {
19847   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19848   printf("%lld\n", q);
19849 }
19850 EOCP
19851         set try
19852         if eval $compile; then
19853                 yyy=`$run ./try`
19854                 case "$yyy" in
19855                 12345678901)
19856                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19857                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19858                         echo "We will use the %lld style."
19859                         ;;
19860                 esac
19861         fi
19862 fi
19863
19864 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19865         $cat >try.c <<EOCP
19866 #include <sys/types.h>
19867 #include <stdio.h>
19868 int main() {
19869   $quadtype q = 12345678901;
19870   printf("%qd\n", q);
19871 }
19872 EOCP
19873         set try
19874         if eval $compile; then
19875                 yyy=`$run ./try`
19876                 case "$yyy" in
19877                 12345678901)
19878                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19879                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19880                         echo "We will use %qd."
19881                         ;;
19882                 esac
19883         fi
19884 fi
19885
19886 if $test X"$sPRId64" = X; then
19887         echo "Cannot figure out how to print 64-bit integers." >&4
19888 fi
19889 $rm_try
19890
19891 fi
19892
19893 case "$sPRId64" in
19894 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19895         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19896         ;;
19897 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19898         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19899         ;;
19900 esac
19901
19902 : Check format strings for internal types
19903 echo " "
19904 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19905
19906 if $test X"$ivsize" = X8; then
19907         ivdformat="$sPRId64"
19908         uvuformat="$sPRIu64"
19909         uvoformat="$sPRIo64"
19910         uvxformat="$sPRIx64"
19911         uvXUformat="$sPRIXU64"
19912 else
19913         if $test X"$ivsize" = X"$longsize"; then
19914                 ivdformat='"ld"'
19915                 uvuformat='"lu"'
19916                 uvoformat='"lo"'
19917                 uvxformat='"lx"'
19918                 uvXUformat='"lX"'
19919         else
19920                 if $test X"$ivsize" = X"$intsize"; then
19921                         ivdformat='"d"'
19922                         uvuformat='"u"'
19923                         uvoformat='"o"'
19924                         uvxformat='"x"'
19925                         uvXUformat='"X"'
19926                 else
19927                         : far out
19928                         if $test X"$ivsize" = X"$shortsize"; then
19929                                 ivdformat='"hd"'
19930                                 uvuformat='"hu"'
19931                                 uvoformat='"ho"'
19932                                 uvxformat='"hx"'
19933                                 uvXUformat='"hX"'
19934                         fi
19935                 fi
19936         fi
19937 fi
19938
19939 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19940         nveformat="$sPRIeldbl"
19941         nvfformat="$sPRIfldbl"
19942         nvgformat="$sPRIgldbl"
19943         nvEUformat="$sPRIEUldbl"
19944         nvFUformat="$sPRIFUldbl"
19945         nvGUformat="$sPRIGUldbl"
19946 else
19947         nveformat='"e"'
19948         nvfformat='"f"'
19949         nvgformat='"g"'
19950         nvEUformat='"E"'
19951         nvFUformat='"F"'
19952         nvGUformat='"G"'
19953 fi
19954
19955 case "$ivdformat" in
19956 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19957     exit 1
19958     ;;
19959 esac
19960
19961 : Check format string for GID
19962
19963 echo " "
19964 $echo "Checking the format string to be used for gids..." >&4
19965
19966 case "$gidsign" in
19967 -1)     if $test X"$gidsize" = X"$ivsize"; then
19968                 gidformat="$ivdformat"
19969         else
19970                 if $test X"$gidsize" = X"$longsize"; then
19971                         gidformat='"ld"'
19972                 else
19973                         if $test X"$gidsize" = X"$intsize"; then
19974                                 gidformat='"d"'
19975                         else
19976                                 if $test X"$gidsize" = X"$shortsize"; then
19977                                         gidformat='"hd"'
19978                                 fi
19979                         fi
19980                 fi
19981         fi
19982         ;;
19983 *)      if $test X"$gidsize" = X"$uvsize"; then
19984                 gidformat="$uvuformat"
19985         else
19986                 if $test X"$gidsize" = X"$longsize"; then
19987                         gidformat='"lu"'
19988                 else
19989                         if $test X"$gidsize" = X"$intsize"; then
19990                                 gidformat='"u"'
19991                         else
19992                                 if $test X"$gidsize" = X"$shortsize"; then
19993                                         gidformat='"hu"'
19994                                 fi
19995                         fi
19996                 fi
19997         fi
19998         ;;
19999 esac
20000
20001 : see if getgroups exists
20002 set getgroups d_getgrps
20003 eval $inlibc
20004
20005 : see if setgroups exists
20006 set setgroups d_setgrps
20007 eval $inlibc
20008
20009 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20010 echo " "
20011 case "$d_getgrps$d_setgrps" in
20012 *define*)
20013         case "$groupstype" in
20014         '') dflt="$gidtype" ;;
20015         *)  dflt="$groupstype" ;;
20016         esac
20017         $cat <<EOM
20018 What type of pointer is the second argument to getgroups() and setgroups()?
20019 Usually this is the same as group ids, $gidtype, but not always.
20020
20021 EOM
20022         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20023         . ./myread
20024         groupstype="$ans"
20025         ;;
20026 *)  groupstype="$gidtype";;
20027 esac
20028
20029 : MAD = Misc Attribute Definition
20030
20031 if $test $patchlevel -lt 9; then
20032 : MAD is not available in 5.8.x or earlier.
20033     ans=n;
20034 else
20035     case "$mad" in
20036     $define|true|[yY]*) dflt='y' ;;
20037     *)                  dflt='n' ;;
20038     esac
20039     cat <<EOM
20040
20041 Would you like to build with Misc Attribute Decoration? This is development
20042 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20043 overhead on the interpreter.
20044
20045 If this doesn't make any sense to you, just accept the default '$dflt'.
20046 EOM
20047     rp='Build Perl with MAD?'
20048     . ./myread
20049 fi
20050 case "$ans" in
20051 y|Y)    val="$define"
20052         madlyh='madly.h madly.act madly.tab'
20053         madlysrc='madly.c'
20054         madlyobj="madly$_o" ;;
20055 *)      val="$undef"
20056         madlyh=''
20057         madlysrc=''
20058         madlyobj='' ;;
20059 esac
20060 set mad
20061 eval $setvar
20062
20063 : check whether make sets MAKE
20064 echo " "
20065 echo "Checking if your $make program sets \$(MAKE)..." >&4
20066 case "$make_set_make" in
20067 '')
20068         $sed 's/^X //' > testmake.mak << 'EOF'
20069 Xall:
20070 X       @echo 'maketemp="$(MAKE)"'
20071 EOF
20072         case "`$make -f testmake.mak 2>/dev/null`" in
20073         *maketemp=*) make_set_make='#' ;;
20074         *)      make_set_make="MAKE=$make" ;;
20075         esac
20076         $rm -f testmake.mak
20077         ;;
20078 esac
20079 case "$make_set_make" in
20080 '#') echo "Yup, it does.";;
20081 *) echo "Nope, it doesn't.";;
20082 esac
20083
20084 : see what type is used for mode_t
20085 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20086 set mode_t modetype int stdio.h sys/types.h
20087 eval $typedef_ask
20088
20089 : see if we need va_copy
20090 echo " "
20091 case "$i_stdarg" in
20092 "$define")
20093         $cat >try.c <<EOCP
20094 #include <stdarg.h>
20095 #include <stdio.h>
20096 #$i_stdlib I_STDLIB
20097 #ifdef I_STDLIB
20098 #include <stdlib.h>
20099 #endif
20100 #include <signal.h>
20101
20102 int
20103 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20104 {
20105   return vfprintf(f, fmt, *valp);
20106 }
20107
20108 int
20109 myvfprintf(FILE *f, const  char *fmt, va_list val)
20110 {
20111   return ivfprintf(f, fmt, &val);
20112 }
20113
20114 int
20115 myprintf(char *fmt, ...)
20116 {
20117   va_list val;
20118   va_start(val, fmt);
20119   return myvfprintf(stdout, fmt, val);
20120 }
20121
20122 int
20123 main(int ac, char **av)
20124 {
20125   signal(SIGSEGV, exit);
20126
20127   myprintf("%s%cs all right, then\n", "that", '\'');
20128   exit(0);
20129 }
20130 EOCP
20131         set try
20132         if eval $compile && $run ./try 2>&1 >/dev/null; then
20133                 case "`$run ./try`" in
20134                 "that's all right, then")
20135                         okay=yes
20136                         ;;
20137                 esac
20138         fi
20139         case "$okay" in
20140         yes)    echo "It seems that you don't need va_copy()." >&4
20141                 need_va_copy="$undef"
20142                 ;;
20143         *)      echo "It seems that va_copy() or similar will be needed." >&4
20144                 need_va_copy="$define"
20145                 ;;
20146         esac
20147         $rm_try
20148         ;;
20149 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20150         ;;
20151 esac
20152
20153 : see what type is used for size_t
20154 rp="What is the type used for the length parameter for string functions?"
20155 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20156 eval $typedef_ask
20157
20158 : check for type of arguments to gethostbyaddr. 
20159 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20160         case "$d_gethbyaddr" in
20161         $define)
20162                 $cat <<EOM
20163
20164 Checking to see what type of arguments are accepted by gethostbyaddr().
20165 EOM
20166                 hdrs="$define sys/types.h
20167                         $d_socket sys/socket.h 
20168                         $i_niin netinet/in.h 
20169                         $i_netdb netdb.h
20170                         $i_unistd unistd.h"
20171                 : The first arg can 'char *' or 'void *'
20172                 : The second arg is some of integral type
20173                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20174                         for yyy in size_t long int; do
20175                                 case "$netdb_host_type" in
20176                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20177                                         if ./protochk "$try" $hdrs; then
20178                                                 echo "Your system accepts $xxx for the first arg."
20179                                                 echo "...and $yyy for the second arg."
20180                                                 netdb_host_type="$xxx"
20181                                                 netdb_hlen_type="$yyy"
20182                                         fi
20183                                         ;;
20184                                 esac
20185                         done
20186                 done
20187                 : In case none of those worked, prompt the user.
20188                 case "$netdb_host_type" in
20189                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20190                         dflt='char *'
20191                         . ./myread
20192                         netdb_host_type=$ans
20193                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20194                         dflt="$sizetype"
20195                         . ./myread
20196                         netdb_hlen_type=$ans
20197                         ;;
20198                 esac
20199                 ;;
20200         *)      : no gethostbyaddr, so pick harmless defaults
20201                 netdb_host_type='char *'
20202                 netdb_hlen_type="$sizetype"
20203                 ;;
20204         esac
20205         # Remove the "const" if needed. -- but then we'll have a 
20206         # prototype clash!
20207         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20208 fi
20209
20210 : check for type of argument to gethostbyname. 
20211 if test "X$netdb_name_type" = X ; then
20212         case "$d_gethbyname" in
20213         $define)
20214                 $cat <<EOM
20215
20216 Checking to see what type of argument is accepted by gethostbyname().
20217 EOM
20218                 hdrs="$define sys/types.h
20219                         $d_socket sys/socket.h 
20220                         $i_niin netinet/in.h 
20221                         $i_netdb netdb.h
20222                         $i_unistd unistd.h"
20223                 for xxx in "const char *" "char *"; do
20224                         case "$netdb_name_type" in
20225                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20226                                 if ./protochk "$try" $hdrs; then
20227                                         echo "Your system accepts $xxx."
20228                                         netdb_name_type="$xxx"
20229                                 fi
20230                                 ;;
20231                         esac
20232                 done
20233                 : In case none of those worked, prompt the user.
20234                 case "$netdb_name_type" in
20235                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20236                         dflt='char *'
20237                         . ./myread
20238                         netdb_name_type=$ans
20239                         ;;
20240                 esac
20241                 ;;
20242         *)      : no gethostbyname, so pick harmless default
20243                 netdb_name_type='char *'
20244                 ;;
20245         esac
20246 fi
20247
20248 : check for type of 1st argument to getnetbyaddr. 
20249 if test "X$netdb_net_type" = X ; then
20250         case "$d_getnbyaddr" in
20251         $define)
20252                 $cat <<EOM
20253
20254 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20255 EOM
20256                 hdrs="$define sys/types.h
20257                         $d_socket sys/socket.h 
20258                         $i_niin netinet/in.h 
20259                         $i_netdb netdb.h
20260                         $i_unistd unistd.h"
20261                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20262                         case "$netdb_net_type" in
20263                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20264                                 if ./protochk "$try" $hdrs; then
20265                                         echo "Your system accepts $xxx."
20266                                         netdb_net_type="$xxx"
20267                                 fi
20268                                 ;;
20269                         esac
20270                 done
20271                 : In case none of those worked, prompt the user.
20272                 case "$netdb_net_type" in
20273                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20274                         dflt='long'
20275                         . ./myread
20276                         netdb_net_type=$ans
20277                         ;;
20278                 esac
20279                 ;;
20280         *)      : no getnetbyaddr, so pick harmless default
20281                 netdb_net_type='long'
20282                 ;;
20283         esac
20284 fi
20285 : locate the preferred pager for this system
20286 fn=f/
20287 case "$pager" in
20288 '')
20289         dflt=''
20290         case "$pg" in
20291         /*) dflt=$pg;;
20292         [a-zA-Z]:/*) dflt=$pg;;
20293         esac
20294         case "$more" in
20295         /*) dflt=$more;;
20296         [a-zA-Z]:/*) dflt=$more;;
20297         esac
20298         case "$less" in
20299         /*) dflt=$less;;
20300         [a-zA-Z]:/*) dflt=$less;;
20301         esac
20302         case "$dflt" in
20303         '') dflt=/usr/ucb/more;;
20304         esac
20305         ;;
20306 *)      dflt="$pager"
20307         fn="f/($pager)"
20308         ;;
20309 esac
20310 echo " "
20311 rp='What pager is used on your system?'
20312 . ./getfile
20313 pager="$ans"
20314
20315 : see what type pids are declared as in the kernel
20316 rp="What is the type of process ids on this system?"
20317 set pid_t pidtype int stdio.h sys/types.h
20318 eval $typedef_ask
20319
20320 : see if ar generates random libraries by itself
20321 echo " "
20322 echo "Checking how to generate random libraries on your machine..." >&4
20323 echo 'int bar1() { return bar2(); }' > bar1.c
20324 echo 'int bar2() { return 2; }' > bar2.c
20325 $cat > foo.c <<EOP
20326 #$i_stdlib I_STDLIB
20327 #ifdef I_STDLIB
20328 #include <stdlib.h>
20329 #endif
20330 int main() { printf("%d\n", bar1()); exit(0); }
20331 EOP
20332 $cc $ccflags -c bar1.c >/dev/null 2>&1
20333 $cc $ccflags -c bar2.c >/dev/null 2>&1
20334 $cc $ccflags -c foo.c >/dev/null 2>&1
20335 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20336 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20337         $run ./foobar >/dev/null 2>&1; then
20338         echo "$ar appears to generate random libraries itself."
20339         orderlib=false
20340         if [ "X$ranlib" = "X" ]; then
20341             ranlib=":"
20342         fi
20343 elif $ar s bar$_a >/dev/null 2>&1 &&
20344         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20345         $run ./foobar >/dev/null 2>&1; then
20346                 echo "a table of contents needs to be added with '$ar s'."
20347                 orderlib=false
20348                 ranlib="$ar s"
20349 elif $ar ts bar$_a >/dev/null 2>&1 &&
20350         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20351         $run ./foobar >/dev/null 2>&1; then
20352                 echo "a table of contents needs to be added with '$ar ts'."
20353                 orderlib=false
20354                 ranlib="$ar ts"
20355 else
20356         case "$ranlib" in
20357         :) ranlib='';;
20358         '')
20359                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20360                 $test -f $ranlib || ranlib=''
20361                 ;;
20362         esac
20363         if $test -n "$ranlib"; then
20364                 echo "your system has '$ranlib'; we'll use that."
20365                 orderlib=false
20366         else
20367                 echo "your system doesn't seem to support random libraries"
20368                 echo "so we'll use lorder and tsort to order the libraries."
20369                 orderlib=true
20370                 ranlib=":"
20371         fi
20372 fi
20373 $rm -f foo* bar*
20374
20375 : see if this is a values.h system
20376 set values.h i_values
20377 eval $inhdr
20378
20379 : Check the max offset that gmtime and localtime accept
20380 echo "Checking max offsets that gmtime () accepts"
20381
20382 case $i_values in
20383     define) yyy="#include <values.h>" ;;
20384     *)      yyy="" ;;
20385     esac
20386
20387 case "$sGMTIME_min/$sGMTIME_max" in
20388     0/0|/)
20389         $cat >try.c <<EOCP
20390 #include <sys/types.h>
20391 #include <stdio.h>
20392 #include <time.h>
20393 $yyy
20394
20395 int i;
20396 struct tm *tmp;
20397 time_t pt;
20398
20399 void gm_check (time_t t, int min_year, int max_year)
20400 {
20401     tmp = gmtime (&t);
20402     if ( tmp == NULL ||
20403         /* Check tm_year overflow */
20404          tmp->tm_year < min_year || tmp->tm_year > max_year)
20405         tmp = NULL;
20406     else
20407         pt = t;
20408     } /* gm_check */
20409
20410 int check_max ()
20411 {
20412     tmp = NULL;
20413     pt  = 0;
20414 #ifdef MAXLONG
20415     gm_check (MAXLONG, 69, 0x7fffffff);
20416 #endif
20417     if (tmp == NULL || tmp->tm_year < 0) {
20418         for (i = 63; i >= 0; i--) {
20419             time_t x = pt | ((time_t)1 << i);
20420             if (x < 0 || x < pt) continue;
20421             gm_check (x, 69, 0x7fffffff);
20422             }
20423         }
20424     printf ("sGMTIME_max=%ld\n", pt);
20425     return (0);
20426     } /* check_max */
20427
20428 int check_min ()
20429 {
20430     tmp = NULL;
20431     pt  = 0;
20432 #ifdef MINLONG
20433     gm_check (MINLONG, -1900, 70);
20434 #endif
20435     if (tmp == NULL) {
20436         for (i = 36; i >= 0; i--) {
20437             time_t x = pt - ((time_t)1 << i);
20438             if (x > 0) continue;
20439             gm_check (x, -1900, 70);
20440             }
20441         }
20442     printf ("sGMTIME_min=%ld\n", pt);
20443     return (0);
20444     } /* check_min */
20445
20446 int main (int argc, char *argv[])
20447 {
20448     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20449     check_max ();
20450     check_min ();
20451     return (0);
20452     } /* main */
20453 EOCP
20454         set try
20455         if eval $compile; then
20456             eval `$run ./try`
20457         else
20458             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20459             fi
20460         $rm_try
20461         ;;
20462     esac
20463
20464 echo "Checking max offsets that localtime () accepts"
20465
20466 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20467     0/0|/)
20468         $cat >try.c <<EOCP
20469 #include <sys/types.h>
20470 #include <stdio.h>
20471 #include <time.h>
20472 $yyy
20473
20474 int i;
20475 struct tm *tmp;
20476 time_t pt;
20477
20478 void local_check (time_t t, int min_year, int max_year)
20479 {
20480     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20481         tmp = NULL;
20482     else
20483         tmp = localtime (&t);
20484     if ( tmp == NULL ||
20485         /* Check tm_year overflow */
20486          tmp->tm_year < min_year || tmp->tm_year > max_year)
20487         tmp = NULL;
20488     else
20489         pt = t;
20490     } /* local_check */
20491
20492 int check_max ()
20493 {
20494     tmp = NULL;
20495     pt  = 0;
20496 #ifdef MAXLONG
20497     local_check (MAXLONG, 69, 0x7fffffff);
20498 #endif
20499     if (tmp == NULL || tmp->tm_year < 0) {
20500         for (i = 63; i >= 0; i--) {
20501             time_t x = pt | ((time_t)1 << i);
20502             if (x < 0 || x < pt) continue;
20503             local_check (x, 69, 0x7fffffff);
20504             }
20505         }
20506     printf ("sLOCALTIME_max=%ld\n", pt);
20507     return (0);
20508    } /* check_max */
20509
20510 int check_min ()
20511 {
20512     tmp = NULL;
20513     pt  = 0;
20514 #ifdef MINLONG
20515     local_check (MINLONG, -1900, 70);
20516 #endif
20517     if (tmp == NULL) {
20518         for (i = 36; i >= 0; i--) {
20519             time_t x = pt - ((time_t)1 << i);
20520             if (x > 0) continue;
20521             local_check (x, -1900, 70);
20522             }
20523         }
20524     printf ("sLOCALTIME_min=%ld\n", pt);
20525     return (0);
20526     } /* check_min */
20527
20528 int main (int argc, char *argv[])
20529 {
20530     check_max ();
20531     check_min ();
20532     return (0);
20533     } /* main */
20534 EOCP
20535         set try
20536         if eval $compile; then
20537             eval `$run ./try`
20538         else
20539             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20540             fi
20541         $rm_try
20542         ;;
20543     esac
20544
20545 : check for type of arguments to select.
20546 case "$selecttype" in
20547 '') case "$d_select" in
20548         $define)
20549                 echo " "
20550                 $cat <<EOM
20551 Checking to see what type of arguments are accepted by select().
20552 EOM
20553                 hdrs="$define sys/types.h
20554                         $i_systime sys/time.h
20555                         $i_sysselct sys/select.h
20556                         $d_socket sys/socket.h"
20557                 : The first arg can be int, unsigned, or size_t
20558                 : The last arg may or may not be 'const'
20559                 val=''
20560                 : void pointer has been seen but using that
20561                 : breaks the selectminbits test
20562                 for xxx in 'fd_set *' 'int *'; do
20563                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20564                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20565                                         case "$val" in
20566                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20567                                                 if ./protochk "$try" $hdrs; then
20568                                                         echo "Your system accepts $xxx."
20569                                                         val="$xxx"
20570                                                 fi
20571                                                 ;;
20572                                         esac
20573                                 done
20574                         done
20575                 done
20576                 case "$val" in
20577                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20578                         case "$d_fd_set" in
20579                                 $define) dflt="fd_set *" ;;
20580                                 *)              dflt="int *" ;;
20581                         esac
20582                         . ./myread
20583                         val=$ans
20584                         ;;
20585                 esac
20586                 selecttype="$val"
20587                 ;;
20588         *)      : no select, so pick a harmless default
20589                 selecttype='int *'
20590                 ;;
20591         esac
20592         ;;
20593 esac
20594
20595 : check for the select 'width'
20596 case "$selectminbits" in
20597 '') safebits=`expr $ptrsize \* 8`
20598     case "$d_select" in
20599         $define)
20600                 $cat <<EOM
20601
20602 Checking to see on how many bits at a time your select() operates...
20603 EOM
20604                 $cat >try.c <<EOCP
20605 #include <sys/types.h>
20606 #$i_time I_TIME
20607 #$i_systime I_SYS_TIME
20608 #$i_systimek I_SYS_TIME_KERNEL
20609 #ifdef I_TIME
20610 #   include <time.h>
20611 #endif
20612 #ifdef I_SYS_TIME
20613 #   ifdef I_SYS_TIME_KERNEL
20614 #       define KERNEL
20615 #   endif
20616 #   include <sys/time.h>
20617 #   ifdef I_SYS_TIME_KERNEL
20618 #       undef KERNEL
20619 #   endif
20620 #endif
20621 #$i_sysselct I_SYS_SELECT
20622 #ifdef I_SYS_SELECT
20623 #include <sys/select.h>
20624 #endif
20625 #$d_socket HAS_SOCKET
20626 #ifdef HAS_SOCKET
20627 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20628 #endif
20629 #include <stdio.h>
20630 #$i_stdlib I_STDLIB
20631 #ifdef I_STDLIB
20632 #include <stdlib.h>
20633 #endif
20634 $selecttype b;
20635 #define S sizeof(*(b))
20636 #define MINBITS 64
20637 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20638 #define NBITS  (NBYTES * 8)
20639 int main() {
20640     char *s = (char *)malloc(NBYTES);
20641     struct timeval t;
20642     int i;
20643     FILE* fp;
20644     int fd;
20645
20646     if (!s)
20647         exit(1);
20648     fclose(stdin);
20649     fp = fopen("try.c", "r");
20650     if (fp == 0)
20651       exit(2);
20652     fd = fileno(fp);
20653     if (fd < 0)
20654       exit(3);
20655     b = ($selecttype)s;
20656     for (i = 0; i < NBITS; i++)
20657         FD_SET(i, b);
20658     t.tv_sec  = 0;
20659     t.tv_usec = 0;
20660     select(fd + 1, b, 0, 0, &t);
20661     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20662     free(s);
20663     printf("%d\n", i + 1);
20664     return 0;
20665 }
20666 EOCP
20667                 set try
20668                 if eval $compile_ok; then
20669                         selectminbits=`$run ./try`
20670                         case "$selectminbits" in
20671                         '')     cat >&4 <<EOM
20672 Cannot figure out on how many bits at a time your select() operates.
20673 I'll play safe and guess it is $safebits bits.
20674 EOM
20675                                 selectminbits=$safebits
20676                                 bits="$safebits bits"
20677                                 ;;
20678                         1)      bits="1 bit" ;;
20679                         *)      bits="$selectminbits bits" ;;
20680                         esac
20681                         echo "Your select() operates on $bits at a time." >&4
20682                 else
20683                         rp='What is the minimum number of bits your select() operates on?'
20684                         case "$byteorder" in
20685                         12345678)       dflt=64 ;;
20686                         1234)           dflt=32 ;;
20687                         *)              dflt=1  ;;
20688                         esac
20689                         . ./myread
20690                         val=$ans
20691                         selectminbits="$val"
20692                 fi
20693                 $rm_try
20694                 ;;
20695         *)      : no select, so pick a harmless default
20696                 selectminbits=$safebits
20697                 ;;
20698         esac
20699         ;;
20700 esac
20701
20702 : Trace out the files included by signal.h, then look for SIGxxx names.
20703 if [ "X$fieldn" = X ]; then
20704         : Just make some guesses.  We check them later.
20705         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20706 else
20707         xxx=`echo '#include <signal.h>' |
20708         $cppstdin $cppminus $cppflags 2>/dev/null |
20709         $grep '^[       ]*#.*include' |
20710         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20711                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20712 fi
20713 xxxfiles=''
20714 for xx in $xxx /dev/null ; do
20715         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20716 done
20717 case "$xxxfiles" in
20718 '')     xxxfiles=`./findhdr signal.h` ;;
20719 esac
20720 xxx=`awk '
20721 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20722         print substr($2, 4, 20)
20723 }
20724 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20725         print substr($3, 4, 20)
20726 }' $xxxfiles`
20727 : Append some common names just in case the awk scan failed.
20728 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20729 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20730 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20731 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20732 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20733
20734 : generate a few handy files for later
20735 $cat > signal.c <<EOCP
20736 #include <sys/types.h>
20737 #include <signal.h>
20738 #$i_stdlib I_STDLIB
20739 #ifdef I_STDLIB
20740 #include <stdlib.h>
20741 #endif
20742 #include <stdio.h>
20743 int main() {
20744
20745 /* Strange style to avoid deeply-nested #if/#else/#endif */
20746 #ifndef NSIG
20747 #  ifdef _NSIG
20748 #    define NSIG (_NSIG)
20749 #  endif
20750 #endif
20751
20752 #ifndef NSIG
20753 #  ifdef SIGMAX
20754 #    define NSIG (SIGMAX+1)
20755 #  endif
20756 #endif
20757
20758 #ifndef NSIG
20759 #  ifdef SIG_MAX
20760 #    define NSIG (SIG_MAX+1)
20761 #  endif
20762 #endif
20763
20764 #ifndef NSIG
20765 #  ifdef _SIG_MAX
20766 #    define NSIG (_SIG_MAX+1)
20767 #  endif
20768 #endif
20769
20770 #ifndef NSIG
20771 #  ifdef MAXSIG
20772 #    define NSIG (MAXSIG+1)
20773 #  endif
20774 #endif
20775
20776 #ifndef NSIG
20777 #  ifdef MAX_SIG
20778 #    define NSIG (MAX_SIG+1)
20779 #  endif
20780 #endif
20781
20782 #ifndef NSIG
20783 #  ifdef SIGARRAYSIZE
20784 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20785 #  endif
20786 #endif
20787
20788 #ifndef NSIG
20789 #  ifdef _sys_nsig
20790 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20791 #  endif
20792 #endif
20793
20794 /* Default to some arbitrary number that's big enough to get most
20795    of the common signals.
20796 */
20797 #ifndef NSIG
20798 #    define NSIG 50
20799 #endif
20800
20801 printf("NSIG %d\n", NSIG);
20802
20803 #ifndef JUST_NSIG
20804
20805 EOCP
20806
20807 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20808 {
20809         printf "#ifdef SIG"; printf $1; printf "\n"
20810         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20811         printf $1; printf ");\n"
20812         printf "#endif\n"
20813 }
20814 END {
20815         printf "#endif /* JUST_NSIG */\n";
20816         printf "exit(0);\n}\n";
20817 }
20818 ' >>signal.c
20819 $cat >signal.awk <<'EOP'
20820 BEGIN { ndups = 0 }
20821 $1 ~ /^NSIG$/ { nsig = $2 }
20822 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20823     if ($2 > maxsig) { maxsig = $2 }
20824     if (sig_name[$2]) {
20825         dup_name[ndups] = $1
20826         dup_num[ndups] = $2
20827         ndups++
20828     }
20829     else {
20830         sig_name[$2] = $1
20831         sig_num[$2] = $2
20832     }
20833 }
20834 END {
20835     if (nsig == 0) {
20836         nsig = maxsig + 1
20837     }
20838     printf("NSIG %d\n", nsig);
20839     for (n = 1; n < nsig; n++) {
20840         if (sig_name[n]) {
20841             printf("%s %d\n", sig_name[n], sig_num[n])
20842         }
20843         else {
20844             printf("NUM%d %d\n", n, n)
20845         }
20846     }
20847     for (n = 0; n < ndups; n++) {
20848         printf("%s %d\n", dup_name[n], dup_num[n])
20849     }
20850 }
20851 EOP
20852 $cat >signal_cmd <<EOS
20853 $startsh
20854 if $test -s signal.lst; then
20855     echo "Using your existing signal.lst file"
20856         exit 0
20857 fi
20858 xxx="$xxx"
20859 EOS
20860 $cat >>signal_cmd <<'EOS'
20861
20862 set signal
20863 if eval $compile_ok; then
20864         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20865                 $uniq | $awk -f signal.awk >signal.lst
20866 else
20867         echo "(I can't seem be able to compile the whole test program)" >&4
20868         echo "(I'll try it in little pieces.)" >&4
20869         set signal -DJUST_NSIG
20870         if eval $compile_ok; then
20871                 $run ./signal$_exe > signal.nsg
20872                 $cat signal.nsg
20873         else
20874                 echo "I can't seem to figure out how many signals you have." >&4
20875                 echo "Guessing 50." >&4
20876                 echo 'NSIG 50' > signal.nsg
20877         fi
20878         : Now look at all the signal names, one at a time.
20879         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20880                 $cat > signal.c <<EOCP
20881 #include <sys/types.h>
20882 #include <signal.h>
20883 #include <stdio.h>
20884 int main() {
20885 printf("$xx %d\n", SIG${xx});
20886 return 0;
20887 }
20888 EOCP
20889                 set signal
20890                 if eval $compile; then
20891                         echo "SIG${xx} found."
20892                         $run ./signal$_exe  >> signal.ls1
20893                 else
20894                         echo "SIG${xx} NOT found."
20895                 fi
20896         done
20897         if $test -s signal.ls1; then
20898                 $cat signal.nsg signal.ls1 |
20899                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20900         fi
20901
20902 fi
20903 if $test -s signal.lst; then
20904         :
20905 else
20906         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20907         echo 'kill -l' >signal
20908         set X `csh -f <signal`
20909         $rm -f signal
20910         shift
20911         case $# in
20912         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20913         esac
20914         echo $@ | $tr ' ' $trnl | \
20915             $awk '{ printf "%s %d\n", $1, ++s; }
20916                   END { printf "NSIG %d\n", ++s }' >signal.lst
20917 fi
20918 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20919 EOS
20920 chmod a+x signal_cmd
20921 $eunicefix signal_cmd
20922
20923 : generate list of signal names
20924 echo " "
20925 case "$sig_name_init" in
20926 '') doinit=yes ;;
20927 *)  case "$sig_num_init" in
20928     ''|*,*) doinit=yes ;;
20929     esac ;;
20930 esac
20931 case "$doinit" in
20932 yes)
20933         echo "Generating a list of signal names and numbers..." >&4
20934         . ./signal_cmd
20935         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20936         sig_name=`$awk 'BEGIN { printf "ZERO " }
20937                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20938         sig_num=`$awk  'BEGIN { printf "0 " }
20939                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20940         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20941                              !/^NSIG/   { printf "\"%s\", ", $1 }
20942                              END        { printf "0\n" }' signal.lst`
20943         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20944                              !/^NSIG/   { printf "%d, ", $2}
20945                              END        { printf "0\n"}' signal.lst`
20946         ;;
20947 esac
20948 echo "The following $sig_count signals are available:"
20949 echo " "
20950 echo $sig_name | $awk \
20951 'BEGIN { linelen = 0 }
20952 {
20953         for (i = 1; i <= NF; i++) {
20954                 name = "SIG" $i " "
20955                 linelen = linelen + length(name)
20956                 if (linelen > 70) {
20957                         printf "\n"
20958                         linelen = length(name)
20959                 }
20960                 printf "%s", name
20961         }
20962         printf "\n"
20963 }'
20964 sig_size=`echo $sig_name | awk '{print NF}'`
20965 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20966
20967 : Check size of size
20968 echo " "
20969 case "$sizetype" in
20970 *_t) zzz="$sizetype"    ;;
20971 *)   zzz="filesize"     ;;
20972 esac
20973 echo "Checking the size of $zzz..." >&4
20974 cat > try.c <<EOCP
20975 #include <sys/types.h>
20976 #include <stdio.h>
20977 #$i_stdlib I_STDLIB
20978 #ifdef I_STDLIB
20979 #include <stdlib.h>
20980 #endif
20981 int main() {
20982     printf("%d\n", (int)sizeof($sizetype));
20983     exit(0);
20984 }
20985 EOCP
20986 set try
20987 if eval $compile_ok; then
20988         yyy=`$run ./try`
20989         case "$yyy" in
20990         '')     sizesize=4
20991                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20992                 ;;
20993         *)      sizesize=$yyy
20994                 echo "Your $zzz size is $sizesize bytes."
20995                 ;;
20996         esac
20997 else
20998         sizesize=4
20999         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21000 fi
21001
21002
21003 : check for socklen_t
21004 echo " "
21005 echo "Checking to see if you have socklen_t..." >&4
21006 $cat >try.c <<EOCP
21007 #include <sys/types.h>
21008 #$d_socket HAS_SOCKET
21009 #ifdef HAS_SOCKET
21010 #include <sys/socket.h>
21011 #endif
21012 int main() { socklen_t x = 16; }
21013 EOCP
21014 set try
21015 if eval $compile; then
21016         val="$define"
21017         echo "You have socklen_t."
21018 else
21019         val="$undef"
21020         echo "You do not have socklen_t."
21021         case "$sizetype" in
21022         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21023         esac
21024 fi
21025 $rm_try
21026 set d_socklen_t
21027 eval $setvar
21028
21029 : see if this is a socks.h system
21030 set socks.h i_socks
21031 eval $inhdr
21032
21033 : check for type of the size argument to socket calls
21034 case "$d_socket" in
21035 "$define")
21036         $cat <<EOM
21037
21038 Checking to see what type is the last argument of accept().
21039 EOM
21040         yyy=''
21041         case "$d_socklen_t" in
21042         "$define") yyy="$yyy socklen_t"
21043         esac
21044         yyy="$yyy $sizetype int long unsigned"
21045         for xxx in $yyy; do
21046                 case "$socksizetype" in
21047                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21048                         case "$usesocks" in
21049                         "$define")
21050                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21051                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21052                                         socksizetype="$xxx"
21053                                 fi
21054                                 ;;
21055                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21056                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21057                                         socksizetype="$xxx"
21058                                 fi
21059                                 ;;
21060                         esac
21061                         ;;
21062                 esac
21063         done
21064 : In case none of those worked, prompt the user.
21065         case "$socksizetype" in
21066         '')     rp='What is the type for socket address structure sizes?'
21067                 dflt='int'
21068                 . ./myread
21069                 socksizetype=$ans
21070                 ;;
21071         esac
21072         ;;
21073 *)      : no sockets, so pick relatively harmless default
21074         socksizetype='int'
21075         ;;
21076 esac
21077
21078 : see what type is used for signed size_t
21079 set ssize_t ssizetype int stdio.h sys/types.h
21080 eval $typedef
21081 dflt="$ssizetype"
21082 $cat > try.c <<EOM
21083 #include <stdio.h>
21084 #$i_stdlib I_STDLIB
21085 #ifdef I_STDLIB
21086 #include <stdlib.h>
21087 #endif
21088 #include <sys/types.h>
21089 #define Size_t $sizetype
21090 #define SSize_t $dflt
21091 int main()
21092 {
21093         if (sizeof(Size_t) == sizeof(SSize_t))
21094                 printf("$dflt\n");
21095         else if (sizeof(Size_t) == sizeof(int))
21096                 printf("int\n");
21097         else
21098                 printf("long\n");
21099         exit(0);
21100 }
21101 EOM
21102 echo " "
21103 set try
21104 if eval $compile_ok && $run ./try > /dev/null; then
21105         ssizetype=`$run ./try`
21106         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21107 else
21108         $cat >&4 <<EOM
21109 Help! I can't compile and run the ssize_t test program: please enlighten me!
21110 (This is probably a misconfiguration in your system or libraries, and
21111 you really ought to fix it.  Still, I'll try anyway.)
21112
21113 I need a type that is the same size as $sizetype, but is guaranteed to
21114 be signed.  Common values are ssize_t, int and long.
21115
21116 EOM
21117         rp="What signed type is the same size as $sizetype?"
21118         . ./myread
21119         ssizetype="$ans"
21120 fi
21121 $rm_try
21122
21123 : Check the size of st_ino
21124 $echo " "
21125 $echo "Checking the size of st_ino..." >&4
21126 $cat > try.c <<EOCP
21127 #include <sys/stat.h>
21128 #include <stdio.h>
21129 #$i_stdlib I_STDLIB
21130 #ifdef I_STDLIB
21131 #include <stdlib.h>
21132 #endif
21133 int main() {
21134     struct stat st;
21135     printf("%d\n", (int)sizeof(st.st_ino));
21136     exit(0);
21137 }
21138 EOCP
21139 set try
21140 if eval $compile_ok; then
21141         val=`$run ./try`
21142         case "$val" in
21143         '')     st_ino_size=4
21144                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21145                 ;;
21146         *)      st_ino_size=$val
21147                 $echo "Your st_ino is $st_ino_size bytes long."
21148                 ;;
21149         esac
21150 else
21151         st_ino_size=4
21152         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21153 fi
21154 $rm_try
21155
21156 : Check if st_ino is signed
21157 $echo " "
21158 $echo "Checking the sign of st_ino..." >&4
21159 $cat > try.c <<EOCP
21160 #include <sys/stat.h>
21161 #include <stdio.h>
21162 int main() {
21163         struct stat foo;
21164         foo.st_ino = -1;
21165         if (foo.st_ino < 0)
21166                 printf("-1\n");
21167         else
21168                 printf("1\n");
21169 }
21170 EOCP
21171 set try
21172 if eval $compile; then
21173         val=`$run ./try`
21174         case "$val" in
21175         '')     st_ino_sign=1
21176                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21177                 ;;
21178         *)      st_ino_sign=$val
21179                 case "$st_ino_sign" in
21180                  1) $echo "Your st_ino is unsigned." ;;
21181                 -1) $echo "Your st_ino is signed."   ;;
21182                 esac
21183                 ;;
21184         esac
21185 else
21186         st_ino_sign=1
21187         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21188 fi
21189 $rm_try
21190
21191 : see what type of char stdio uses.
21192 echo " "
21193 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21194 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21195         echo "Your stdio uses unsigned chars." >&4
21196         stdchar="unsigned char"
21197 else
21198         echo "Your stdio uses signed chars." >&4
21199         stdchar="char"
21200 fi
21201 $rm -f stdioh
21202
21203 : see what type uids are declared as in the kernel
21204 echo " "
21205 echo "Looking for the type for user ids returned by getuid()."
21206 set uid_t uidtype xxx stdio.h sys/types.h
21207 eval $typedef
21208 case "$uidtype" in
21209 xxx)
21210         xxx=`./findhdr sys/user.h`
21211         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21212         case $1 in
21213         unsigned) dflt="$1 $2" ;;
21214         *) dflt="$1" ;;
21215         esac
21216         ;;
21217 *) dflt="$uidtype";;
21218 esac
21219 case "$uidtype" in
21220 uid_t)  echo "uid_t found." ;;
21221 *)      rp="What is the type for user ids returned by getuid()?"
21222         . ./myread
21223         uidtype="$ans"
21224         ;;
21225 esac
21226
21227 : Check size of UID
21228 echo " "
21229 case "$uidtype" in
21230 *_t) zzz="$uidtype"     ;;
21231 *)   zzz="uid"          ;;
21232 esac
21233 echo "Checking the size of $zzz..." >&4
21234 cat > try.c <<EOCP
21235 #include <sys/types.h>
21236 #include <stdio.h>
21237 #$i_stdlib I_STDLIB
21238 #ifdef I_STDLIB
21239 #include <stdlib.h>
21240 #endif
21241 int main() {
21242     printf("%d\n", (int)sizeof($uidtype));
21243     exit(0);
21244 }
21245 EOCP
21246 set try
21247 if eval $compile_ok; then
21248         yyy=`$run ./try`
21249         case "$yyy" in
21250         '')     uidsize=4
21251                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21252                 ;;
21253         *)      uidsize=$yyy
21254                 echo "Your $zzz is $uidsize bytes long."
21255                 ;;
21256         esac
21257 else
21258         uidsize=4
21259         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21260 fi
21261
21262 : Check if UID is signed
21263 echo " "
21264 case "$uidtype" in
21265 *_t) zzz="$uidtype"     ;;
21266 *)   zzz="uid"          ;;
21267 esac
21268 echo "Checking the sign of $zzz..." >&4
21269 cat > try.c <<EOCP
21270 #include <sys/types.h>
21271 #include <stdio.h>
21272 int main() {
21273         $uidtype foo = -1;
21274         if (foo < 0)
21275                 printf("-1\n");
21276         else
21277                 printf("1\n");
21278 }
21279 EOCP
21280 set try
21281 if eval $compile; then
21282         yyy=`$run ./try`
21283         case "$yyy" in
21284         '')     uidsign=1
21285                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21286                 ;;
21287         *)      uidsign=$yyy
21288                 case "$uidsign" in
21289                  1) echo "Your $zzz is unsigned." ;;
21290                 -1) echo "Your $zzz is signed."   ;;
21291                 esac
21292                 ;;
21293         esac
21294 else
21295         uidsign=1
21296         echo "(I can't compile the test program--guessing unsigned.)" >&4
21297 fi
21298
21299
21300 : Check format string for UID
21301 echo " "
21302 $echo "Checking the format string to be used for uids..." >&4
21303
21304 case "$uidsign" in
21305 -1)     if $test X"$uidsize" = X"$ivsize"; then
21306                 uidformat="$ivdformat"
21307         else
21308                 if $test X"$uidsize" = X"$longsize"; then
21309                         uidformat='"ld"'
21310                 else
21311                         if $test X"$uidsize" = X"$intsize"; then
21312                                 uidformat='"d"'
21313                         else
21314                                 if $test X"$uidsize" = X"$shortsize"; then
21315                                         uidformat='"hd"'
21316                                 fi
21317                         fi
21318                 fi
21319         fi
21320         ;;
21321 *)      if $test X"$uidsize" = X"$uvsize"; then
21322                 uidformat="$uvuformat"
21323         else
21324                 if $test X"$uidsize" = X"$longsize"; then
21325                         uidformat='"lu"'
21326                 else
21327                         if $test X"$uidsize" = X"$intsize"; then
21328                                 uidformat='"u"'
21329                         else
21330                                 if $test X"$uidsize" = X"$shortsize"; then
21331                                         uidformat='"hu"'
21332                                 fi
21333                         fi
21334                 fi
21335         fi
21336         ;;
21337 esac
21338
21339 : Check if site customization support was requested
21340 case "$usesitecustomize" in
21341     $define|true|[Yy]*)
21342         usesitecustomize="$define"
21343         ;;
21344     *)
21345         usesitecustomize="$undef"
21346         ;;
21347     esac
21348
21349 : see if prototypes support variable argument declarations
21350 echo " "
21351 case "$prototype$i_stdarg" in
21352 $define$define)
21353         echo "It appears we'll be able to prototype varargs functions." >&4
21354         val="$define"
21355         ;;
21356 *)
21357         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21358         val="$undef"
21359         ;;
21360 esac
21361 set vaproto
21362 eval $setvar
21363
21364 : determine compiler compiler
21365 case "$yacc" in
21366 '')
21367         dflt=yacc;;
21368 *)
21369         dflt="$yacc";;
21370 esac
21371 echo " "
21372 comp='yacc'
21373 if $test -f "$byacc$_exe"; then
21374         dflt="$byacc"
21375         comp="byacc or $comp"
21376 fi
21377 if $test -f "$bison$_exe"; then
21378         comp="$comp or bison -y"
21379 fi
21380 rp="Which compiler compiler ($comp) shall I use?"
21381 . ./myread
21382 yacc="$ans"
21383 case "$yacc" in
21384 *bis*)
21385         case "$yacc" in
21386         *-y*) ;;
21387         *)
21388                 yacc="$yacc -y"
21389                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21390                 ;;
21391         esac
21392         ;;
21393 esac
21394
21395 : see if this is a assert.h system
21396 set assert.h i_assert
21397 eval $inhdr
21398
21399 : see if this is a fp.h system
21400 set fp.h i_fp
21401 eval $inhdr
21402
21403 : see if this is a fp_class.h system
21404 set fp_class.h i_fp_class
21405 eval $inhdr
21406
21407 : see if gdbm.h is available
21408 set gdbm.h t_gdbm
21409 eval $inhdr
21410 case "$t_gdbm" in
21411 $define)
21412         : see if gdbm_open exists
21413         set gdbm_open d_gdbm_open
21414         eval $inlibc
21415         case "$d_gdbm_open" in
21416         $undef)
21417                 t_gdbm="$undef"
21418                 echo "We won't be including <gdbm.h>"
21419                 ;;
21420         esac
21421         ;;
21422 esac
21423 val="$t_gdbm"
21424 set i_gdbm
21425 eval $setvar
21426
21427 : see if this is a ieeefp.h system
21428 case "$i_ieeefp" in
21429 '' ) set ieeefp.h i_ieeefp
21430      eval $inhdr
21431      ;;
21432 esac
21433
21434 : see if this is a libutil.h system
21435 set libutil.h i_libutil
21436 eval $inhdr
21437
21438 : see if mach cthreads are available
21439 if test "X$usethreads" = "X$define"; then
21440         set mach/cthreads.h i_machcthr
21441         eval $inhdr
21442 else
21443         i_machcthr="$undef"
21444 fi
21445
21446 : see if this is a mntent.h system
21447 set mntent.h i_mntent
21448 eval $inhdr
21449
21450 : see if net/errno.h is available
21451 val=''
21452 set net/errno.h val
21453 eval $inhdr
21454
21455 : Unfortunately, it causes problems on some systems.  Arrgh.
21456 case "$val" in
21457 $define)
21458         cat > try.c <<'EOM'
21459 #include <stdio.h>
21460 #include <errno.h>
21461 #include <net/errno.h>
21462 int func()
21463 {
21464         return ENOTSOCK;
21465 }
21466 EOM
21467         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21468                 echo "We'll be including <net/errno.h>." >&4
21469         else
21470                 echo "We won't be including <net/errno.h>." >&4
21471                 val="$undef"
21472         fi
21473         $rm_try
21474         ;;
21475 esac
21476 set i_neterrno
21477 eval $setvar
21478
21479 : see if netinet/tcp.h is available
21480 set netinet/tcp.h i_netinettcp
21481 eval $inhdr
21482
21483 : see if this is a poll.h system
21484 set poll.h i_poll
21485 eval $inhdr
21486
21487 : see if this is a prot.h system
21488 set prot.h i_prot
21489 eval $inhdr
21490
21491 : Preprocessor symbols
21492 echo " "
21493 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21494 $cat <<'EOSH' > Cppsym.know
21495 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21496 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21497 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21498 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21499 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21500 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21501 bull c cadmus clipper CMU COFF COMPILER_VERSION
21502 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21503 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21504 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21505 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21506 GLIBC GLIBC_MINOR
21507 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21508 H3050R H3050RX hbullx20 hcx host_mips
21509 hp200 hp300 hp700 HP700 hp800 hp9000
21510 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21511 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21512 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21513 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21514 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21515 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21516 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21517 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21518 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21519 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21520 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21521 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21522 MATH_HAS_NO_SIDE_EFFECTS
21523 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21524 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21525 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21526 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21527 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21528 NetBSD news1500 news1700 news1800 news1900 news3700
21529 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21530 ns32016 ns32332 ns32k nsc32000
21531 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21532 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21533 pc532 pdp11 PGC PIC plexus PORTAR posix
21534 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21535 POSIX_C_SOURCE POSIX_SOURCE POWER
21536 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21537 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21538 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21539 sony sony_news sonyrisc sparc sparclite spectrum
21540 stardent stdc STDC_EXT stratos sun sun3 sun386
21541 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21542 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21543 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21544 sysV68 sysV88 Tek4132 Tek4300 titan
21545 TM3200 TM5400 TM5600
21546 tower tower32 tower32_200 tower32_600 tower32_700
21547 tower32_800 tower32_850 tss
21548 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21549 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21550 unix UNIX95 UNIX99 unixpc unos
21551 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21552 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21553 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21554 USGr4 USGr4_2
21555 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21556 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21557 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21558 z8000
21559 EOSH
21560 # Maybe put other stuff here too.
21561 cat <<EOSH >>Cppsym.know
21562 $osname
21563 EOSH
21564 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21565 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21566 $cat Cppsym.know > Cppsym.c
21567 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21568 $rm -f Cppsym.a Cppsym.b Cppsym.c
21569 cat <<EOSH > Cppsym
21570 $startsh
21571 if $test \$# -gt 0; then
21572     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21573     if $test -s Cppsym.got; then
21574         $rm -f Cppsym.got
21575         exit 0
21576     fi
21577     $rm -f Cppsym.got
21578     exit 1
21579 else
21580     $tr " " "$trnl" | ./Cppsym.try
21581     exit 0
21582 fi
21583 EOSH
21584 chmod +x Cppsym
21585 $eunicefix Cppsym
21586 cat <<EOSH > Cppsym.try
21587 $startsh
21588 cat <<'EOCP' > try.c
21589 #include <stdio.h>
21590 #if cpp_stuff == 1
21591 #define STRINGIFY(a)    "a"
21592 #endif
21593 #if cpp_stuff == 42
21594 #define StGiFy(a)  #a
21595 #define STRINGIFY(a)    StGiFy(a)
21596 #endif
21597 #if $cpp_stuff != 1 && $cpp_stuff != 42
21598 #   include "Bletch: How does this C preprocessor stringify macros?"
21599 #endif
21600 int main() {
21601 EOCP
21602 $awk \\
21603 EOSH
21604 cat <<'EOSH' >> Cppsym.try
21605 'length($1) > 0 {
21606     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21607     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21608     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21609     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21610 }'       >> try.c
21611 echo 'return 0;}' >> try.c
21612 EOSH
21613 cat <<EOSH >> Cppsym.try
21614 ccflags="$ccflags"
21615 case "$osname-$gccversion" in
21616 irix-) ccflags="\$ccflags -woff 1178" ;;
21617 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21618 esac
21619 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21620 EOSH
21621 chmod +x Cppsym.try
21622 $eunicefix Cppsym.try
21623 ./Cppsym < Cppsym.know > Cppsym.true
21624 : Add in any linux cpp "predefined macros":
21625 case "$osname::$gccversion" in
21626   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21627     tHdrH=_tmpHdr
21628     rm -f $tHdrH'.h' $tHdrH
21629     touch $tHdrH'.h'
21630     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21631        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21632        if [ -s $tHdrH'_cppsym.real' ]; then
21633           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21634        fi
21635     fi
21636     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21637   ;;
21638 esac
21639 : now check the C compiler for additional symbols
21640 postprocess_cc_v=''
21641 case "$osname" in
21642 aix) postprocess_cc_v="|$tr , ' '" ;;
21643 esac
21644 $cat >ccsym <<EOS
21645 $startsh
21646 $cat >tmp.c <<EOF
21647 extern int foo;
21648 EOF
21649 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21650 do
21651         case "\$i" in
21652         -D*) echo "\$i" | $sed 's/^-D//';;
21653         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21654         esac
21655 done
21656 $rm_try
21657 EOS
21658 postprocess_cc_v=''
21659 chmod +x ccsym
21660 $eunicefix ccsym
21661 ./ccsym > ccsym1.raw
21662 if $test -s ccsym1.raw; then
21663        $sort ccsym1.raw | $uniq >ccsym.raw
21664 else
21665        mv ccsym1.raw ccsym.raw
21666 fi
21667
21668 $awk '/\=/ { print $0; next }
21669         { print $0"=1" }' ccsym.raw >ccsym.list
21670 $comm -13 Cppsym.true ccsym.list >ccsym.own
21671 $comm -12 Cppsym.true ccsym.list >ccsym.com
21672 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21673 also=''
21674 if $test -z ccsym.raw; then
21675         echo "Your C compiler doesn't seem to define any symbols!" >&4
21676         echo " "
21677         echo "However, your C preprocessor defines the following symbols:"
21678         $cat Cppsym.true
21679         ccsymbols=''
21680         cppsymbols=`$cat Cppsym.true`
21681         cppsymbols=`echo $cppsymbols`
21682         cppccsymbols="$cppsymbols"
21683 else
21684         if $test -s ccsym.com; then
21685                 echo "Your C compiler and pre-processor define these symbols:"
21686                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21687                 also='also '
21688                 symbols='ones'
21689                 cppccsymbols=`$cat ccsym.com`
21690                 cppccsymbols=`echo $cppccsymbols`
21691                 $test "$silent" || sleep 1
21692         fi
21693         if $test -s ccsym.cpp; then
21694                 $test "$also" && echo " "
21695                 echo "Your C pre-processor ${also}defines the following symbols:"
21696                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21697                 also='further '
21698                 cppsymbols=`$cat ccsym.cpp`
21699                 cppsymbols=`echo $cppsymbols`
21700                 $test "$silent" || sleep 1
21701         fi
21702         if $test -s ccsym.own; then
21703                 $test "$also" && echo " "
21704                 echo "Your C compiler ${also}defines the following cpp symbols:"
21705                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21706                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21707                 ccsymbols=`$cat ccsym.own`
21708                 ccsymbols=`echo $ccsymbols`
21709                 $test "$silent" || sleep 1
21710         fi
21711 fi
21712
21713 : see if this is a termio system
21714 val="$undef"
21715 val2="$undef"
21716 val3="$undef"
21717 if $test `./findhdr termios.h`; then
21718         set tcsetattr i_termios
21719         eval $inlibc
21720         val3="$i_termios"
21721 fi
21722 echo " "
21723 case "$val3" in
21724 "$define") echo "You have POSIX termios.h... good!" >&4;;
21725 *) if ./Cppsym pyr; then
21726                 case "`/bin/universe`" in
21727                 ucb) if $test `./findhdr sgtty.h`; then
21728                                 val2="$define"
21729                                 echo "<sgtty.h> found." >&4
21730                         else
21731                                 echo "System is pyramid with BSD universe."
21732                                 ./warn "<sgtty.h> not found--you could have problems."
21733                         fi;;
21734                 *) if $test `./findhdr termio.h`; then
21735                                 val="$define"
21736                                 echo "<termio.h> found." >&4
21737                         else
21738                                 echo "System is pyramid with USG universe."
21739                                 ./warn "<termio.h> not found--you could have problems."
21740                         fi;;
21741                 esac
21742         elif ./usg; then
21743                 if $test `./findhdr termio.h`; then
21744                         echo "<termio.h> found." >&4
21745                         val="$define"
21746                 elif $test `./findhdr sgtty.h`; then
21747                         echo "<sgtty.h> found." >&4
21748                         val2="$define"
21749                 else
21750                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21751                 fi
21752         else
21753                 if $test `./findhdr sgtty.h`; then
21754                         echo "<sgtty.h> found." >&4
21755                         val2="$define"
21756                 elif $test `./findhdr termio.h`; then
21757                         echo "<termio.h> found." >&4
21758                         val="$define"
21759                 else
21760                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21761                 fi
21762         fi;;
21763 esac
21764 set i_termio; eval $setvar
21765 val=$val2; set i_sgtty; eval $setvar
21766 val=$val3; set i_termios; eval $setvar
21767
21768 : see if stdbool is available
21769 set stdbool.h i_stdbool
21770 eval $inhdr
21771
21772 : see if stddef is available
21773 set stddef.h i_stddef
21774 eval $inhdr
21775
21776 : see if sys/access.h is available
21777 set sys/access.h i_sysaccess
21778 eval $inhdr
21779
21780 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21781 set sys/filio.h i_sysfilio
21782 eval $inhdr
21783 echo " "
21784 if $test `./findhdr sys/ioctl.h`; then
21785         val="$define"
21786         echo '<sys/ioctl.h> found.' >&4
21787 else
21788         val="$undef"
21789         if $test $i_sysfilio = "$define"; then
21790             echo '<sys/ioctl.h> NOT found.' >&4
21791         else
21792                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21793                 $test $i_termio = "$define" && xxx="termio.h"
21794                 $test $i_termios = "$define" && xxx="termios.h"
21795 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21796         fi
21797 fi
21798 set i_sysioctl
21799 eval $setvar
21800
21801 : see if socket ioctl defs are in sys/sockio.h
21802 echo " "
21803 xxx=`./findhdr sys/sockio.h`
21804 if $test "$xxx"; then
21805         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21806                 val="$define"
21807                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21808         else
21809                 val="$undef"
21810                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21811         fi
21812 else
21813         val="$undef"
21814         $cat <<EOM
21815 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21816 EOM
21817 fi
21818 set i_syssockio
21819 eval $setvar
21820
21821 : see if this is a syslog.h system
21822 set syslog.h i_syslog
21823 eval $inhdr
21824
21825 : see if this is a sys/mode.h system
21826 set sys/mode.h i_sysmode
21827 eval $inhdr
21828
21829 : see if there is a sys/poll.h file
21830 set sys/poll.h i_syspoll
21831 eval $inhdr
21832
21833 : see if sys/resource.h has to be included
21834 set sys/resource.h i_sysresrc
21835 eval $inhdr
21836
21837 : see if sys/security.h is available
21838 set sys/security.h i_syssecrt
21839 eval $inhdr
21840
21841 : see if this is a sys/statvfs.h system
21842 set sys/statvfs.h i_sysstatvfs
21843 eval $inhdr
21844
21845 : see if this is a sys/un.h system
21846 set sys/un.h i_sysun
21847 eval $inhdr
21848
21849 : see if this is a sys/utsname.h system
21850 set sys/utsname.h i_sysutsname
21851 eval $inhdr
21852
21853 : see if this is a syswait system
21854 set sys/wait.h i_syswait
21855 eval $inhdr
21856
21857 : see if this is a ustat.h system
21858 set ustat.h i_ustat
21859 eval $inhdr
21860
21861 : see if this is an utime system
21862 set utime.h i_utime
21863 eval $inhdr
21864
21865 : see if this is a vfork system
21866 case "$d_vfork" in
21867 "$define")
21868         set vfork.h i_vfork
21869         eval $inhdr
21870         ;;
21871 *)
21872         i_vfork="$undef"
21873         ;;
21874 esac
21875
21876 : Check extensions
21877 echo " "
21878 echo "Looking for extensions..." >&4
21879 : If we are using the old config.sh, known_extensions may contain
21880 : old or inaccurate or duplicate values.
21881 known_extensions=''
21882 nonxs_extensions=''
21883 : We do not use find because it might not be available.
21884 : We do not just use MANIFEST because the user may have dropped
21885 : some additional extensions into the source tree and expect them
21886 : to be built.
21887
21888 : Function to recursively find available extensions, ignoring DynaLoader
21889 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21890 : In 5.10.1 and later, extensions are stored in directories
21891 : like File-Glob instead of the older File/Glob/.
21892 find_extensions='
21893     for xxx in *; do
21894         case "$xxx" in
21895             DynaLoader|dynaload) ;;
21896             *)
21897             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21898             leaf=`echo $xxx | $sed -e s/.*-//`;
21899             if $test -d File; then
21900                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21901                     known_extensions="$known_extensions $1$this_ext";
21902                 elif $test -f $xxx/Makefile.PL; then
21903                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21904                 else
21905                     if $test -d $xxx -a $# -lt 10; then
21906                         set $1$xxx/ $*;
21907                         cd "$xxx";
21908                         eval $find_extensions;
21909                         cd ..;
21910                         shift;
21911                     fi;
21912                 fi;
21913             else
21914                 $ls -1 $xxx > $$.tmp;
21915                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21916                     known_extensions="$known_extensions $this_ext";
21917                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21918                     known_extensions="$known_extensions $this_ext";
21919                 elif $test -d $xxx; then
21920                     nonxs_extensions="$nonxs_extensions $this_ext";
21921                 fi;
21922                 $rm -f $$.tmp;
21923             fi
21924             ;;
21925         esac;
21926     done'
21927 tdir=`pwd`
21928 cd "$rsrc/cpan"
21929 set X
21930 shift
21931 eval $find_extensions
21932 cd "$rsrc/dist"
21933 set X
21934 shift
21935 eval $find_extensions
21936 cd "$rsrc/ext"
21937 set X
21938 shift
21939 eval $find_extensions
21940 if $test -d File-Glob; then
21941     : All ext/ flattened
21942 else
21943     # Special case:  Add in modules that nest beyond the first level.
21944     # Currently threads/shared and Hash/Util/FieldHash, since they are
21945     # not picked up by the recursive find above (and adding in general
21946     # recursive finding breaks SDBM_File/sdbm).
21947     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21948     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21949 fi
21950 set X $known_extensions
21951 shift
21952 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21953 set X $nonxs_extensions
21954 shift
21955 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21956 cd "$tdir"
21957
21958 : Now see which are supported on this system.
21959 avail_ext=''
21960 for xxx in $known_extensions ; do
21961         case "$xxx" in
21962         DB_File|db_file)
21963                 case "$i_db" in
21964                 $define) avail_ext="$avail_ext $xxx" ;;
21965                 esac
21966                 ;;
21967         GDBM_File|gdbm_fil)
21968                 case "$i_gdbm" in
21969                 $define) avail_ext="$avail_ext $xxx" ;;
21970                 esac
21971                 ;;
21972         I18N/Langinfo|i18n_lan)
21973                 case "$i_langinfo$d_nl_langinfo" in
21974                 $define$define) avail_ext="$avail_ext $xxx" ;;
21975                 esac
21976                 ;;
21977         IPC/SysV|ipc/sysv)
21978                 : XXX Do we need a useipcsysv variable here
21979                 case "${d_msg}${d_sem}${d_shm}" in
21980                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21981                 esac
21982                 ;;
21983         NDBM_File|ndbm_fil)
21984                 case "$d_ndbm" in
21985                 $define)
21986                     case "$osname-$use64bitint" in
21987                     hpux-define)
21988                         case "$libs" in
21989                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21990                         esac
21991                         ;;
21992                     *) avail_ext="$avail_ext $xxx" ;;
21993                     esac
21994                     ;;
21995                 esac
21996                 ;;
21997         ODBM_File|odbm_fil)
21998                 case "${i_dbm}${i_rpcsvcdbm}" in
21999                 *"${define}"*)
22000                     case "$d_cplusplus" in
22001                     define) ;; # delete as a function name will not work
22002                     *)  case "$osname-$use64bitint" in
22003                         hpux-define)
22004                             case "$libs" in
22005                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22006                             esac
22007                             ;;
22008                         *) avail_ext="$avail_ext $xxx" ;;
22009                         esac
22010                         ;;
22011                     esac
22012                     ;;
22013                 esac
22014                 ;;
22015         Opcode|opcode)
22016                 case "$useopcode" in
22017                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22018                 esac
22019                 ;;
22020         POSIX|posix)
22021                 case "$useposix" in
22022                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22023                 esac
22024                 ;;
22025         Socket|socket)
22026                 case "$d_socket" in
22027                 true|$define|y)
22028                     case "$osname" in
22029                     beos) ;; # not unless BONE
22030                     *) avail_ext="$avail_ext $xxx" ;;
22031                     esac
22032                     ;;
22033                 esac
22034                 ;;
22035         Sys/Syslog|sys/syslog)
22036                 : XXX syslog requires socket
22037                 case "$d_socket" in
22038                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22039                 esac
22040                 ;;
22041         Thread|thread)
22042                 case "$usethreads" in
22043                 true|$define|y)
22044                         case "$use5005threads" in
22045                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22046                         esac
22047                 esac
22048                 ;;
22049         threads|threads/shared)
22050                 # threads and threads::shared are special cases.
22051                 # To stop people from asking "Perl 5.8.0 was supposed
22052                 # to have this new fancy threads implementation but my
22053                 # perl doesn't have it" and from people trying to
22054                 # (re)install the threads module using CPAN.pm and
22055                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22056                 # the threads.pm and threads/shared.pm will always be
22057                 # there, croaking informatively ("you need to rebuild
22058                 # all of Perl with threads, sorry") when threads haven't
22059                 # been compiled in.
22060                 # --jhi
22061                 avail_ext="$avail_ext $xxx"
22062                 ;;
22063         VMS*)
22064                 ;;
22065         Win32*)
22066                 case "$osname" in
22067                 cygwin) avail_ext="$avail_ext $xxx" ;;
22068                 esac
22069                 ;;
22070         XS/APItest|xs/apitest)
22071                 # This is just for testing.  Skip it unless we have dynamic loading.
22072
22073                 case "$usedl" in
22074                 $define) avail_ext="$avail_ext $xxx" ;;
22075                 esac
22076                 ;;
22077         XS/Typemap|xs/typemap)
22078                 # This is just for testing.  Skip it unless we have dynamic loading.
22079                 case "$usedl" in
22080                 $define) avail_ext="$avail_ext $xxx" ;;
22081                 esac
22082                 ;;
22083         *)      avail_ext="$avail_ext $xxx"
22084                 ;;
22085         esac
22086 done
22087
22088 set X $avail_ext
22089 shift
22090 avail_ext="$*"
22091
22092 case "$onlyextensions" in
22093 '') ;;
22094 *)  keepextensions=''
22095     echo "You have requested that only certain extensions be included..." >&4
22096     for i in $onlyextensions; do
22097         case " $avail_ext " in
22098         *" $i "*)
22099             echo "Keeping extension $i."
22100             keepextensions="$keepextensions $i"
22101             ;;
22102         *) echo "Ignoring extension $i." ;;
22103         esac
22104     done
22105     avail_ext="$keepextensions"
22106     ;;
22107 esac
22108
22109 case "$noextensions" in
22110 '') ;;
22111 *)  keepextensions=''
22112     echo "You have requested that certain extensions be ignored..." >&4
22113     for i in $avail_ext; do
22114         case " $noextensions " in
22115         *" $i "*) echo "Ignoring extension $i." ;;
22116         *) echo "Keeping extension $i.";
22117            keepextensions="$keepextensions $i"
22118            ;;
22119         esac
22120     done
22121     avail_ext="$keepextensions"
22122     ;;
22123 esac
22124
22125 : Now see which nonxs extensions are supported on this system.
22126 : For now assume all are.
22127 nonxs_ext=''
22128 for xxx in $nonxs_extensions ; do
22129         case "$xxx" in
22130         *)      nonxs_ext="$nonxs_ext $xxx"
22131                 ;;
22132         esac
22133 done
22134
22135 set X $nonxs_ext
22136 shift
22137 nonxs_ext="$*"
22138
22139 case $usedl in
22140 $define)
22141         $cat <<EOM
22142 A number of extensions are supplied with $package.  You may choose to
22143 compile these extensions for dynamic loading (the default), compile
22144 them into the $package executable (static loading), or not include
22145 them at all.  Answer "none" to include no extensions.
22146 Note that DynaLoader is always built and need not be mentioned here.
22147
22148 EOM
22149         case "$dynamic_ext" in
22150         '')
22151                 : Exclude those listed in static_ext
22152                 dflt=''
22153                 for xxx in $avail_ext; do
22154                         case " $static_ext " in
22155                         *" $xxx "*) ;;
22156                         *) dflt="$dflt $xxx" ;;
22157                         esac
22158                 done
22159                 set X $dflt
22160                 shift
22161                 dflt="$*"
22162                 ;;
22163         *)      dflt="$dynamic_ext"
22164                 # Perhaps we are reusing an old out-of-date config.sh.
22165                 case "$hint" in
22166                 previous)
22167                         if test X"$dynamic_ext" != X"$avail_ext"; then
22168                                 $cat <<EOM
22169 NOTICE:  Your previous config.sh list may be incorrect.
22170 The extensions now available to you are
22171         ${avail_ext}
22172 but the default list from your previous config.sh is
22173         ${dynamic_ext}
22174
22175 EOM
22176                         fi
22177                         ;;
22178                 esac
22179                 ;;
22180         esac
22181         case "$dflt" in
22182         '')     dflt=none;;
22183         esac
22184         rp="What extensions do you wish to load dynamically?"
22185         . ./myread
22186         case "$ans" in
22187         none) dynamic_ext=' ' ;;
22188         *) dynamic_ext="$ans" ;;
22189         esac
22190
22191         case "$static_ext" in
22192         '')
22193                 : Exclude those already listed in dynamic linking
22194                 dflt=''
22195                 for xxx in $avail_ext; do
22196                         case " $dynamic_ext " in
22197                         *" $xxx "*) ;;
22198                         *) dflt="$dflt $xxx" ;;
22199                         esac
22200                 done
22201                 set X $dflt
22202                 shift
22203                 dflt="$*"
22204                 ;;
22205         *)  dflt="$static_ext"
22206                 ;;
22207         esac
22208
22209         case "$dflt" in
22210         '')     dflt=none;;
22211         esac
22212         rp="What extensions do you wish to load statically?"
22213         . ./myread
22214         case "$ans" in
22215         none) static_ext=' ' ;;
22216         *) static_ext="$ans" ;;
22217         esac
22218         ;;
22219 *)
22220         $cat <<EOM
22221 A number of extensions are supplied with $package.  Answer "none"
22222 to include no extensions.
22223 Note that DynaLoader is always built and need not be mentioned here.
22224
22225 EOM
22226         case "$static_ext" in
22227         '') dflt="$avail_ext" ;;
22228         *)      dflt="$static_ext"
22229                 # Perhaps we are reusing an old out-of-date config.sh.
22230                 case "$hint" in
22231                 previous)
22232                         if test X"$static_ext" != X"$avail_ext"; then
22233                                 $cat <<EOM
22234 NOTICE:  Your previous config.sh list may be incorrect.
22235 The extensions now available to you are
22236         ${avail_ext}
22237 but the default list from your previous config.sh is
22238         ${static_ext}
22239
22240 EOM
22241                         fi
22242                         ;;
22243                 esac
22244                 ;;
22245         esac
22246         : Exclude those that are not xs extensions
22247         case "$dflt" in
22248         '')     dflt=none;;
22249         esac
22250         rp="What extensions do you wish to include?"
22251         . ./myread
22252         case "$ans" in
22253         none) static_ext=' ' ;;
22254         *) static_ext="$ans" ;;
22255         esac
22256         ;;
22257 esac
22258 #
22259 # Encode is a special case.  If we are building Encode as a static
22260 # extension, we need to explicitly list its subextensions as well.
22261 # For other nested extensions, this is handled automatically by
22262 # the appropriate Makefile.PL.
22263 case " $static_ext " in
22264         *" Encode "*) # Add the subextensions of Encode
22265         cd "$rsrc/cpan"
22266         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22267                 static_ext="$static_ext Encode/$xxx"
22268         done
22269         cd "$tdir"
22270         ;;
22271 esac
22272
22273 set X $dynamic_ext $static_ext $nonxs_ext
22274 shift
22275 extensions="$*"
22276
22277 # Sanity check:  We require an extension suitable for use with
22278 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22279 # should show up as failures in the test suite, but it's helpful to
22280 # catch them now.) The 'extensions' list is normally sorted
22281 # alphabetically, so we need to accept either
22282 #    DB_File ... Fcntl ... IO  ....
22283 # or something like
22284 #    Fcntl ... NDBM_File ... IO  ....
22285 case " $extensions"  in
22286 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22287 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22288 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22289 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22290    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22291    ;;
22292 esac
22293
22294 : Remove libraries needed only for extensions
22295 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22296 : The exception is SunOS 4.x, which needs them.
22297 case "${osname}X${osvers}" in
22298 sunos*X4*)
22299     perllibs="$libs"
22300     ;;
22301 *) case "$usedl" in
22302     $define|true|[yY]*)
22303             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22304             shift
22305             perllibs="$*"
22306             ;;
22307     *)  perllibs="$libs"
22308             ;;
22309     esac
22310     ;;
22311 esac
22312
22313 : Remove build directory name from cppstdin so it can be used from
22314 : either the present location or the final installed location.
22315 echo " "
22316 : Get out of the UU directory to get correct path name.
22317 cd ..
22318 case "$cppstdin" in
22319 `pwd`/cppstdin)
22320         echo "Stripping down cppstdin path name"
22321         cppstdin=cppstdin
22322         ;;
22323 esac
22324 cd UU
22325
22326 : end of configuration questions
22327 echo " "
22328 echo "End of configuration questions."
22329 echo " "
22330
22331 : back to where it started
22332 if test -d ../UU; then
22333         cd ..
22334 fi
22335
22336 : configuration may be unconditionally patched via a 'config.arch' file
22337 if $test -f config.arch; then
22338         echo "I see a config.arch file, loading it." >&4
22339         . ./config.arch
22340 fi
22341
22342 : configuration may be patched via a 'config.over' file
22343 if $test -f config.over; then
22344         echo " "
22345         dflt=y
22346         rp='I see a config.over file.  Do you wish to load it?'
22347         . UU/myread
22348         case "$ans" in
22349         n*) echo "OK, I'll ignore it.";;
22350         *)      . ./config.over
22351                 echo "Configuration override changes have been loaded."
22352                 ;;
22353         esac
22354 fi
22355
22356 : in case they want portability, strip down executable paths
22357 case "$d_portable" in
22358 "$define")
22359         echo " "
22360         echo "Stripping down executable paths..." >&4
22361         for file in $loclist $trylist; do
22362                 eval temp=\$$file
22363                 eval $file=`basename $temp`
22364         done
22365         ;;
22366 esac
22367
22368 : create config.sh file
22369 echo " "
22370 echo "Creating config.sh..." >&4
22371 $spitshell <<EOT >config.sh
22372 $startsh
22373 #
22374 # This file was produced by running the Configure script. It holds all the
22375 # definitions figured out by Configure. Should you modify one of these values,
22376 # do not forget to propagate your changes by running "Configure -der". You may
22377 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22378 #
22379
22380 # Package name      : $package
22381 # Source directory  : $src
22382 # Configuration time: $cf_time
22383 # Configured by     : $cf_by
22384 # Target system     : $myuname
22385
22386 EOT
22387 : Add in command line options if available
22388 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22389
22390 $spitshell <<EOT >>config.sh
22391
22392 Author='$Author'
22393 Date='$Date'
22394 Header='$Header'
22395 Id='$Id'
22396 Locker='$Locker'
22397 Log='$Log'
22398 RCSfile='$RCSfile'
22399 Revision='$Revision'
22400 Source='$Source'
22401 State='$State'
22402 _a='$_a'
22403 _exe='$_exe'
22404 _o='$_o'
22405 afs='$afs'
22406 afsroot='$afsroot'
22407 alignbytes='$alignbytes'
22408 ansi2knr='$ansi2knr'
22409 aphostname='$aphostname'
22410 api_revision='$api_revision'
22411 api_subversion='$api_subversion'
22412 api_version='$api_version'
22413 api_versionstring='$api_versionstring'
22414 ar='$ar'
22415 archlib='$archlib'
22416 archlibexp='$archlibexp'
22417 archname64='$archname64'
22418 archname='$archname'
22419 archobjs='$archobjs'
22420 asctime_r_proto='$asctime_r_proto'
22421 awk='$awk'
22422 baserev='$baserev'
22423 bash='$bash'
22424 bin='$bin'
22425 bin_ELF='$bin_ELF'
22426 binexp='$binexp'
22427 bison='$bison'
22428 byacc='$byacc'
22429 byteorder='$byteorder'
22430 c='$c'
22431 castflags='$castflags'
22432 cat='$cat'
22433 cc='$cc'
22434 cccdlflags='$cccdlflags'
22435 ccdlflags='$ccdlflags'
22436 ccflags='$ccflags'
22437 ccflags_uselargefiles='$ccflags_uselargefiles'
22438 ccname='$ccname'
22439 ccsymbols='$ccsymbols'
22440 ccversion='$ccversion'
22441 cf_by='$cf_by'
22442 cf_email='$cf_email'
22443 cf_time='$cf_time'
22444 charbits='$charbits'
22445 charsize='$charsize'
22446 chgrp='$chgrp'
22447 chmod='$chmod'
22448 chown='$chown'
22449 clocktype='$clocktype'
22450 comm='$comm'
22451 compress='$compress'
22452 contains='$contains'
22453 cp='$cp'
22454 cpio='$cpio'
22455 cpp='$cpp'
22456 cpp_stuff='$cpp_stuff'
22457 cppccsymbols='$cppccsymbols'
22458 cppflags='$cppflags'
22459 cpplast='$cpplast'
22460 cppminus='$cppminus'
22461 cpprun='$cpprun'
22462 cppstdin='$cppstdin'
22463 cppsymbols='$cppsymbols'
22464 crypt_r_proto='$crypt_r_proto'
22465 cryptlib='$cryptlib'
22466 csh='$csh'
22467 ctermid_r_proto='$ctermid_r_proto'
22468 ctime_r_proto='$ctime_r_proto'
22469 d_Gconvert='$d_Gconvert'
22470 d_PRIEUldbl='$d_PRIEUldbl'
22471 d_PRIFUldbl='$d_PRIFUldbl'
22472 d_PRIGUldbl='$d_PRIGUldbl'
22473 d_PRIXU64='$d_PRIXU64'
22474 d_PRId64='$d_PRId64'
22475 d_PRIeldbl='$d_PRIeldbl'
22476 d_PRIfldbl='$d_PRIfldbl'
22477 d_PRIgldbl='$d_PRIgldbl'
22478 d_PRIi64='$d_PRIi64'
22479 d_PRIo64='$d_PRIo64'
22480 d_PRIu64='$d_PRIu64'
22481 d_PRIx64='$d_PRIx64'
22482 d_SCNfldbl='$d_SCNfldbl'
22483 d__fwalk='$d__fwalk'
22484 d_access='$d_access'
22485 d_accessx='$d_accessx'
22486 d_aintl='$d_aintl'
22487 d_alarm='$d_alarm'
22488 d_archlib='$d_archlib'
22489 d_asctime64='$d_asctime64'
22490 d_asctime_r='$d_asctime_r'
22491 d_atolf='$d_atolf'
22492 d_atoll='$d_atoll'
22493 d_attribute_deprecated='$d_attribute_deprecated'
22494 d_attribute_format='$d_attribute_format'
22495 d_attribute_malloc='$d_attribute_malloc'
22496 d_attribute_nonnull='$d_attribute_nonnull'
22497 d_attribute_noreturn='$d_attribute_noreturn'
22498 d_attribute_pure='$d_attribute_pure'
22499 d_attribute_unused='$d_attribute_unused'
22500 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22501 d_bcmp='$d_bcmp'
22502 d_bcopy='$d_bcopy'
22503 d_bsd='$d_bsd'
22504 d_bsdgetpgrp='$d_bsdgetpgrp'
22505 d_bsdsetpgrp='$d_bsdsetpgrp'
22506 d_builtin_choose_expr='$d_builtin_choose_expr'
22507 d_builtin_expect='$d_builtin_expect'
22508 d_bzero='$d_bzero'
22509 d_c99_variadic_macros='$d_c99_variadic_macros'
22510 d_casti32='$d_casti32'
22511 d_castneg='$d_castneg'
22512 d_charvspr='$d_charvspr'
22513 d_chown='$d_chown'
22514 d_chroot='$d_chroot'
22515 d_chsize='$d_chsize'
22516 d_class='$d_class'
22517 d_clearenv='$d_clearenv'
22518 d_closedir='$d_closedir'
22519 d_cmsghdr_s='$d_cmsghdr_s'
22520 d_const='$d_const'
22521 d_copysignl='$d_copysignl'
22522 d_cplusplus='$d_cplusplus'
22523 d_crypt='$d_crypt'
22524 d_crypt_r='$d_crypt_r'
22525 d_csh='$d_csh'
22526 d_ctermid='$d_ctermid'
22527 d_ctermid_r='$d_ctermid_r'
22528 d_ctime64='$d_ctime64'
22529 d_ctime_r='$d_ctime_r'
22530 d_cuserid='$d_cuserid'
22531 d_dbl_dig='$d_dbl_dig'
22532 d_dbminitproto='$d_dbminitproto'
22533 d_difftime64='$d_difftime64'
22534 d_difftime='$d_difftime'
22535 d_dir_dd_fd='$d_dir_dd_fd'
22536 d_dirfd='$d_dirfd'
22537 d_dirnamlen='$d_dirnamlen'
22538 d_dlerror='$d_dlerror'
22539 d_dlopen='$d_dlopen'
22540 d_dlsymun='$d_dlsymun'
22541 d_dosuid='$d_dosuid'
22542 d_drand48_r='$d_drand48_r'
22543 d_drand48proto='$d_drand48proto'
22544 d_dup2='$d_dup2'
22545 d_eaccess='$d_eaccess'
22546 d_endgrent='$d_endgrent'
22547 d_endgrent_r='$d_endgrent_r'
22548 d_endhent='$d_endhent'
22549 d_endhostent_r='$d_endhostent_r'
22550 d_endnent='$d_endnent'
22551 d_endnetent_r='$d_endnetent_r'
22552 d_endpent='$d_endpent'
22553 d_endprotoent_r='$d_endprotoent_r'
22554 d_endpwent='$d_endpwent'
22555 d_endpwent_r='$d_endpwent_r'
22556 d_endsent='$d_endsent'
22557 d_endservent_r='$d_endservent_r'
22558 d_eofnblk='$d_eofnblk'
22559 d_eunice='$d_eunice'
22560 d_faststdio='$d_faststdio'
22561 d_fchdir='$d_fchdir'
22562 d_fchmod='$d_fchmod'
22563 d_fchown='$d_fchown'
22564 d_fcntl='$d_fcntl'
22565 d_fcntl_can_lock='$d_fcntl_can_lock'
22566 d_fd_macros='$d_fd_macros'
22567 d_fd_set='$d_fd_set'
22568 d_fds_bits='$d_fds_bits'
22569 d_fgetpos='$d_fgetpos'
22570 d_finite='$d_finite'
22571 d_finitel='$d_finitel'
22572 d_flexfnam='$d_flexfnam'
22573 d_flock='$d_flock'
22574 d_flockproto='$d_flockproto'
22575 d_fork='$d_fork'
22576 d_fp_class='$d_fp_class'
22577 d_fpathconf='$d_fpathconf'
22578 d_fpclass='$d_fpclass'
22579 d_fpclassify='$d_fpclassify'
22580 d_fpclassl='$d_fpclassl'
22581 d_fpos64_t='$d_fpos64_t'
22582 d_frexpl='$d_frexpl'
22583 d_fs_data_s='$d_fs_data_s'
22584 d_fseeko='$d_fseeko'
22585 d_fsetpos='$d_fsetpos'
22586 d_fstatfs='$d_fstatfs'
22587 d_fstatvfs='$d_fstatvfs'
22588 d_fsync='$d_fsync'
22589 d_ftello='$d_ftello'
22590 d_ftime='$d_ftime'
22591 d_futimes='$d_futimes'
22592 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22593 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22594 d_getaddrinfo='$d_getaddrinfo'
22595 d_getcwd='$d_getcwd'
22596 d_getespwnam='$d_getespwnam'
22597 d_getfsstat='$d_getfsstat'
22598 d_getgrent='$d_getgrent'
22599 d_getgrent_r='$d_getgrent_r'
22600 d_getgrgid_r='$d_getgrgid_r'
22601 d_getgrnam_r='$d_getgrnam_r'
22602 d_getgrps='$d_getgrps'
22603 d_gethbyaddr='$d_gethbyaddr'
22604 d_gethbyname='$d_gethbyname'
22605 d_gethent='$d_gethent'
22606 d_gethname='$d_gethname'
22607 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22608 d_gethostbyname_r='$d_gethostbyname_r'
22609 d_gethostent_r='$d_gethostent_r'
22610 d_gethostprotos='$d_gethostprotos'
22611 d_getitimer='$d_getitimer'
22612 d_getlogin='$d_getlogin'
22613 d_getlogin_r='$d_getlogin_r'
22614 d_getmnt='$d_getmnt'
22615 d_getmntent='$d_getmntent'
22616 d_getnameinfo='$d_getnameinfo'
22617 d_getnbyaddr='$d_getnbyaddr'
22618 d_getnbyname='$d_getnbyname'
22619 d_getnent='$d_getnent'
22620 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22621 d_getnetbyname_r='$d_getnetbyname_r'
22622 d_getnetent_r='$d_getnetent_r'
22623 d_getnetprotos='$d_getnetprotos'
22624 d_getpagsz='$d_getpagsz'
22625 d_getpbyname='$d_getpbyname'
22626 d_getpbynumber='$d_getpbynumber'
22627 d_getpent='$d_getpent'
22628 d_getpgid='$d_getpgid'
22629 d_getpgrp2='$d_getpgrp2'
22630 d_getpgrp='$d_getpgrp'
22631 d_getppid='$d_getppid'
22632 d_getprior='$d_getprior'
22633 d_getprotobyname_r='$d_getprotobyname_r'
22634 d_getprotobynumber_r='$d_getprotobynumber_r'
22635 d_getprotoent_r='$d_getprotoent_r'
22636 d_getprotoprotos='$d_getprotoprotos'
22637 d_getprpwnam='$d_getprpwnam'
22638 d_getpwent='$d_getpwent'
22639 d_getpwent_r='$d_getpwent_r'
22640 d_getpwnam_r='$d_getpwnam_r'
22641 d_getpwuid_r='$d_getpwuid_r'
22642 d_getsbyname='$d_getsbyname'
22643 d_getsbyport='$d_getsbyport'
22644 d_getsent='$d_getsent'
22645 d_getservbyname_r='$d_getservbyname_r'
22646 d_getservbyport_r='$d_getservbyport_r'
22647 d_getservent_r='$d_getservent_r'
22648 d_getservprotos='$d_getservprotos'
22649 d_getspnam='$d_getspnam'
22650 d_getspnam_r='$d_getspnam_r'
22651 d_gettimeod='$d_gettimeod'
22652 d_gmtime64='$d_gmtime64'
22653 d_gmtime_r='$d_gmtime_r'
22654 d_gnulibc='$d_gnulibc'
22655 d_grpasswd='$d_grpasswd'
22656 d_hasmntopt='$d_hasmntopt'
22657 d_htonl='$d_htonl'
22658 d_ilogbl='$d_ilogbl'
22659 d_inc_version_list='$d_inc_version_list'
22660 d_index='$d_index'
22661 d_inetaton='$d_inetaton'
22662 d_inetntop='$d_inetntop'
22663 d_inetpton='$d_inetpton'
22664 d_int64_t='$d_int64_t'
22665 d_isascii='$d_isascii'
22666 d_isfinite='$d_isfinite'
22667 d_isinf='$d_isinf'
22668 d_isnan='$d_isnan'
22669 d_isnanl='$d_isnanl'
22670 d_killpg='$d_killpg'
22671 d_lchown='$d_lchown'
22672 d_ldbl_dig='$d_ldbl_dig'
22673 d_libm_lib_version='$d_libm_lib_version'
22674 d_link='$d_link'
22675 d_localtime64='$d_localtime64'
22676 d_localtime_r='$d_localtime_r'
22677 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22678 d_locconv='$d_locconv'
22679 d_lockf='$d_lockf'
22680 d_longdbl='$d_longdbl'
22681 d_longlong='$d_longlong'
22682 d_lseekproto='$d_lseekproto'
22683 d_lstat='$d_lstat'
22684 d_madvise='$d_madvise'
22685 d_malloc_good_size='$d_malloc_good_size'
22686 d_malloc_size='$d_malloc_size'
22687 d_mblen='$d_mblen'
22688 d_mbstowcs='$d_mbstowcs'
22689 d_mbtowc='$d_mbtowc'
22690 d_memchr='$d_memchr'
22691 d_memcmp='$d_memcmp'
22692 d_memcpy='$d_memcpy'
22693 d_memmove='$d_memmove'
22694 d_memset='$d_memset'
22695 d_mkdir='$d_mkdir'
22696 d_mkdtemp='$d_mkdtemp'
22697 d_mkfifo='$d_mkfifo'
22698 d_mkstemp='$d_mkstemp'
22699 d_mkstemps='$d_mkstemps'
22700 d_mktime64='$d_mktime64'
22701 d_mktime='$d_mktime'
22702 d_mmap='$d_mmap'
22703 d_modfl='$d_modfl'
22704 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22705 d_modflproto='$d_modflproto'
22706 d_mprotect='$d_mprotect'
22707 d_msg='$d_msg'
22708 d_msg_ctrunc='$d_msg_ctrunc'
22709 d_msg_dontroute='$d_msg_dontroute'
22710 d_msg_oob='$d_msg_oob'
22711 d_msg_peek='$d_msg_peek'
22712 d_msg_proxy='$d_msg_proxy'
22713 d_msgctl='$d_msgctl'
22714 d_msgget='$d_msgget'
22715 d_msghdr_s='$d_msghdr_s'
22716 d_msgrcv='$d_msgrcv'
22717 d_msgsnd='$d_msgsnd'
22718 d_msync='$d_msync'
22719 d_munmap='$d_munmap'
22720 d_mymalloc='$d_mymalloc'
22721 d_ndbm='$d_ndbm'
22722 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22723 d_nice='$d_nice'
22724 d_nl_langinfo='$d_nl_langinfo'
22725 d_nv_preserves_uv='$d_nv_preserves_uv'
22726 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22727 d_off64_t='$d_off64_t'
22728 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22729 d_oldpthreads='$d_oldpthreads'
22730 d_oldsock='$d_oldsock'
22731 d_open3='$d_open3'
22732 d_pathconf='$d_pathconf'
22733 d_pause='$d_pause'
22734 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22735 d_phostname='$d_phostname'
22736 d_pipe='$d_pipe'
22737 d_poll='$d_poll'
22738 d_portable='$d_portable'
22739 d_prctl='$d_prctl'
22740 d_prctl_set_name='$d_prctl_set_name'
22741 d_printf_format_null='$d_printf_format_null'
22742 d_procselfexe='$d_procselfexe'
22743 d_pseudofork='$d_pseudofork'
22744 d_pthread_atfork='$d_pthread_atfork'
22745 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22746 d_pthread_yield='$d_pthread_yield'
22747 d_pwage='$d_pwage'
22748 d_pwchange='$d_pwchange'
22749 d_pwclass='$d_pwclass'
22750 d_pwcomment='$d_pwcomment'
22751 d_pwexpire='$d_pwexpire'
22752 d_pwgecos='$d_pwgecos'
22753 d_pwpasswd='$d_pwpasswd'
22754 d_pwquota='$d_pwquota'
22755 d_qgcvt='$d_qgcvt'
22756 d_quad='$d_quad'
22757 d_random_r='$d_random_r'
22758 d_readdir64_r='$d_readdir64_r'
22759 d_readdir='$d_readdir'
22760 d_readdir_r='$d_readdir_r'
22761 d_readlink='$d_readlink'
22762 d_readv='$d_readv'
22763 d_recvmsg='$d_recvmsg'
22764 d_rename='$d_rename'
22765 d_rewinddir='$d_rewinddir'
22766 d_rmdir='$d_rmdir'
22767 d_safebcpy='$d_safebcpy'
22768 d_safemcpy='$d_safemcpy'
22769 d_sanemcmp='$d_sanemcmp'
22770 d_sbrkproto='$d_sbrkproto'
22771 d_scalbnl='$d_scalbnl'
22772 d_sched_yield='$d_sched_yield'
22773 d_scm_rights='$d_scm_rights'
22774 d_seekdir='$d_seekdir'
22775 d_select='$d_select'
22776 d_sem='$d_sem'
22777 d_semctl='$d_semctl'
22778 d_semctl_semid_ds='$d_semctl_semid_ds'
22779 d_semctl_semun='$d_semctl_semun'
22780 d_semget='$d_semget'
22781 d_semop='$d_semop'
22782 d_sendmsg='$d_sendmsg'
22783 d_setegid='$d_setegid'
22784 d_seteuid='$d_seteuid'
22785 d_setgrent='$d_setgrent'
22786 d_setgrent_r='$d_setgrent_r'
22787 d_setgrps='$d_setgrps'
22788 d_sethent='$d_sethent'
22789 d_sethostent_r='$d_sethostent_r'
22790 d_setitimer='$d_setitimer'
22791 d_setlinebuf='$d_setlinebuf'
22792 d_setlocale='$d_setlocale'
22793 d_setlocale_r='$d_setlocale_r'
22794 d_setnent='$d_setnent'
22795 d_setnetent_r='$d_setnetent_r'
22796 d_setpent='$d_setpent'
22797 d_setpgid='$d_setpgid'
22798 d_setpgrp2='$d_setpgrp2'
22799 d_setpgrp='$d_setpgrp'
22800 d_setprior='$d_setprior'
22801 d_setproctitle='$d_setproctitle'
22802 d_setprotoent_r='$d_setprotoent_r'
22803 d_setpwent='$d_setpwent'
22804 d_setpwent_r='$d_setpwent_r'
22805 d_setregid='$d_setregid'
22806 d_setresgid='$d_setresgid'
22807 d_setresuid='$d_setresuid'
22808 d_setreuid='$d_setreuid'
22809 d_setrgid='$d_setrgid'
22810 d_setruid='$d_setruid'
22811 d_setsent='$d_setsent'
22812 d_setservent_r='$d_setservent_r'
22813 d_setsid='$d_setsid'
22814 d_setvbuf='$d_setvbuf'
22815 d_sfio='$d_sfio'
22816 d_shm='$d_shm'
22817 d_shmat='$d_shmat'
22818 d_shmatprototype='$d_shmatprototype'
22819 d_shmctl='$d_shmctl'
22820 d_shmdt='$d_shmdt'
22821 d_shmget='$d_shmget'
22822 d_sigaction='$d_sigaction'
22823 d_signbit='$d_signbit'
22824 d_sigprocmask='$d_sigprocmask'
22825 d_sigsetjmp='$d_sigsetjmp'
22826 d_sin6_scope_id='$d_sin6_scope_id'
22827 d_sitearch='$d_sitearch'
22828 d_snprintf='$d_snprintf'
22829 d_sockaddr_sa_len='$d_sockaddr_sa_len'
22830 d_sockatmark='$d_sockatmark'
22831 d_sockatmarkproto='$d_sockatmarkproto'
22832 d_socket='$d_socket'
22833 d_socklen_t='$d_socklen_t'
22834 d_sockpair='$d_sockpair'
22835 d_socks5_init='$d_socks5_init'
22836 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22837 d_sqrtl='$d_sqrtl'
22838 d_srand48_r='$d_srand48_r'
22839 d_srandom_r='$d_srandom_r'
22840 d_sresgproto='$d_sresgproto'
22841 d_sresuproto='$d_sresuproto'
22842 d_statblks='$d_statblks'
22843 d_statfs_f_flags='$d_statfs_f_flags'
22844 d_statfs_s='$d_statfs_s'
22845 d_static_inline='$d_static_inline'
22846 d_statvfs='$d_statvfs'
22847 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22848 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22849 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22850 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22851 d_stdio_stream_array='$d_stdio_stream_array'
22852 d_stdiobase='$d_stdiobase'
22853 d_stdstdio='$d_stdstdio'
22854 d_strchr='$d_strchr'
22855 d_strcoll='$d_strcoll'
22856 d_strctcpy='$d_strctcpy'
22857 d_strerrm='$d_strerrm'
22858 d_strerror='$d_strerror'
22859 d_strerror_r='$d_strerror_r'
22860 d_strftime='$d_strftime'
22861 d_strlcat='$d_strlcat'
22862 d_strlcpy='$d_strlcpy'
22863 d_strtod='$d_strtod'
22864 d_strtol='$d_strtol'
22865 d_strtold='$d_strtold'
22866 d_strtoll='$d_strtoll'
22867 d_strtoq='$d_strtoq'
22868 d_strtoul='$d_strtoul'
22869 d_strtoull='$d_strtoull'
22870 d_strtouq='$d_strtouq'
22871 d_strxfrm='$d_strxfrm'
22872 d_suidsafe='$d_suidsafe'
22873 d_symlink='$d_symlink'
22874 d_syscall='$d_syscall'
22875 d_syscallproto='$d_syscallproto'
22876 d_sysconf='$d_sysconf'
22877 d_sysernlst='$d_sysernlst'
22878 d_syserrlst='$d_syserrlst'
22879 d_system='$d_system'
22880 d_tcgetpgrp='$d_tcgetpgrp'
22881 d_tcsetpgrp='$d_tcsetpgrp'
22882 d_telldir='$d_telldir'
22883 d_telldirproto='$d_telldirproto'
22884 d_time='$d_time'
22885 d_timegm='$d_timegm'
22886 d_times='$d_times'
22887 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22888 d_tm_tm_zone='$d_tm_tm_zone'
22889 d_tmpnam_r='$d_tmpnam_r'
22890 d_truncate='$d_truncate'
22891 d_ttyname_r='$d_ttyname_r'
22892 d_tzname='$d_tzname'
22893 d_u32align='$d_u32align'
22894 d_ualarm='$d_ualarm'
22895 d_umask='$d_umask'
22896 d_uname='$d_uname'
22897 d_union_semun='$d_union_semun'
22898 d_unordered='$d_unordered'
22899 d_unsetenv='$d_unsetenv'
22900 d_usleep='$d_usleep'
22901 d_usleepproto='$d_usleepproto'
22902 d_ustat='$d_ustat'
22903 d_vendorarch='$d_vendorarch'
22904 d_vendorbin='$d_vendorbin'
22905 d_vendorlib='$d_vendorlib'
22906 d_vendorscript='$d_vendorscript'
22907 d_vfork='$d_vfork'
22908 d_void_closedir='$d_void_closedir'
22909 d_voidsig='$d_voidsig'
22910 d_voidtty='$d_voidtty'
22911 d_volatile='$d_volatile'
22912 d_vprintf='$d_vprintf'
22913 d_vsnprintf='$d_vsnprintf'
22914 d_wait4='$d_wait4'
22915 d_waitpid='$d_waitpid'
22916 d_wcstombs='$d_wcstombs'
22917 d_wctomb='$d_wctomb'
22918 d_writev='$d_writev'
22919 d_xenix='$d_xenix'
22920 date='$date'
22921 db_hashtype='$db_hashtype'
22922 db_prefixtype='$db_prefixtype'
22923 db_version_major='$db_version_major'
22924 db_version_minor='$db_version_minor'
22925 db_version_patch='$db_version_patch'
22926 defvoidused='$defvoidused'
22927 direntrytype='$direntrytype'
22928 dlext='$dlext'
22929 dlsrc='$dlsrc'
22930 doublesize='$doublesize'
22931 drand01='$drand01'
22932 drand48_r_proto='$drand48_r_proto'
22933 dtrace='$dtrace'
22934 dynamic_ext='$dynamic_ext'
22935 eagain='$eagain'
22936 ebcdic='$ebcdic'
22937 echo='$echo'
22938 egrep='$egrep'
22939 emacs='$emacs'
22940 endgrent_r_proto='$endgrent_r_proto'
22941 endhostent_r_proto='$endhostent_r_proto'
22942 endnetent_r_proto='$endnetent_r_proto'
22943 endprotoent_r_proto='$endprotoent_r_proto'
22944 endpwent_r_proto='$endpwent_r_proto'
22945 endservent_r_proto='$endservent_r_proto'
22946 eunicefix='$eunicefix'
22947 exe_ext='$exe_ext'
22948 expr='$expr'
22949 extensions='$extensions'
22950 extern_C='$extern_C'
22951 extras='$extras'
22952 fflushNULL='$fflushNULL'
22953 fflushall='$fflushall'
22954 find='$find'
22955 firstmakefile='$firstmakefile'
22956 flex='$flex'
22957 fpossize='$fpossize'
22958 fpostype='$fpostype'
22959 freetype='$freetype'
22960 from='$from'
22961 full_ar='$full_ar'
22962 full_csh='$full_csh'
22963 full_sed='$full_sed'
22964 gccansipedantic='$gccansipedantic'
22965 gccosandvers='$gccosandvers'
22966 gccversion='$gccversion'
22967 getgrent_r_proto='$getgrent_r_proto'
22968 getgrgid_r_proto='$getgrgid_r_proto'
22969 getgrnam_r_proto='$getgrnam_r_proto'
22970 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22971 gethostbyname_r_proto='$gethostbyname_r_proto'
22972 gethostent_r_proto='$gethostent_r_proto'
22973 getlogin_r_proto='$getlogin_r_proto'
22974 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22975 getnetbyname_r_proto='$getnetbyname_r_proto'
22976 getnetent_r_proto='$getnetent_r_proto'
22977 getprotobyname_r_proto='$getprotobyname_r_proto'
22978 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22979 getprotoent_r_proto='$getprotoent_r_proto'
22980 getpwent_r_proto='$getpwent_r_proto'
22981 getpwnam_r_proto='$getpwnam_r_proto'
22982 getpwuid_r_proto='$getpwuid_r_proto'
22983 getservbyname_r_proto='$getservbyname_r_proto'
22984 getservbyport_r_proto='$getservbyport_r_proto'
22985 getservent_r_proto='$getservent_r_proto'
22986 getspnam_r_proto='$getspnam_r_proto'
22987 gidformat='$gidformat'
22988 gidsign='$gidsign'
22989 gidsize='$gidsize'
22990 gidtype='$gidtype'
22991 glibpth='$glibpth'
22992 gmake='$gmake'
22993 gmtime_r_proto='$gmtime_r_proto'
22994 gnulibc_version='$gnulibc_version'
22995 grep='$grep'
22996 groupcat='$groupcat'
22997 groupstype='$groupstype'
22998 gzip='$gzip'
22999 h_fcntl='$h_fcntl'
23000 h_sysfile='$h_sysfile'
23001 hint='$hint'
23002 hostcat='$hostcat'
23003 html1dir='$html1dir'
23004 html1direxp='$html1direxp'
23005 html3dir='$html3dir'
23006 html3direxp='$html3direxp'
23007 i16size='$i16size'
23008 i16type='$i16type'
23009 i32size='$i32size'
23010 i32type='$i32type'
23011 i64size='$i64size'
23012 i64type='$i64type'
23013 i8size='$i8size'
23014 i8type='$i8type'
23015 i_arpainet='$i_arpainet'
23016 i_assert='$i_assert'
23017 i_bsdioctl='$i_bsdioctl'
23018 i_crypt='$i_crypt'
23019 i_db='$i_db'
23020 i_dbm='$i_dbm'
23021 i_dirent='$i_dirent'
23022 i_dld='$i_dld'
23023 i_dlfcn='$i_dlfcn'
23024 i_fcntl='$i_fcntl'
23025 i_float='$i_float'
23026 i_fp='$i_fp'
23027 i_fp_class='$i_fp_class'
23028 i_gdbm='$i_gdbm'
23029 i_gdbm_ndbm='$i_gdbm_ndbm'
23030 i_gdbmndbm='$i_gdbmndbm'
23031 i_grp='$i_grp'
23032 i_ieeefp='$i_ieeefp'
23033 i_inttypes='$i_inttypes'
23034 i_langinfo='$i_langinfo'
23035 i_libutil='$i_libutil'
23036 i_limits='$i_limits'
23037 i_locale='$i_locale'
23038 i_machcthr='$i_machcthr'
23039 i_malloc='$i_malloc'
23040 i_mallocmalloc='$i_mallocmalloc'
23041 i_math='$i_math'
23042 i_memory='$i_memory'
23043 i_mntent='$i_mntent'
23044 i_ndbm='$i_ndbm'
23045 i_netdb='$i_netdb'
23046 i_neterrno='$i_neterrno'
23047 i_netinettcp='$i_netinettcp'
23048 i_niin='$i_niin'
23049 i_poll='$i_poll'
23050 i_prot='$i_prot'
23051 i_pthread='$i_pthread'
23052 i_pwd='$i_pwd'
23053 i_rpcsvcdbm='$i_rpcsvcdbm'
23054 i_sfio='$i_sfio'
23055 i_sgtty='$i_sgtty'
23056 i_shadow='$i_shadow'
23057 i_socks='$i_socks'
23058 i_stdarg='$i_stdarg'
23059 i_stdbool='$i_stdbool'
23060 i_stddef='$i_stddef'
23061 i_stdlib='$i_stdlib'
23062 i_string='$i_string'
23063 i_sunmath='$i_sunmath'
23064 i_sysaccess='$i_sysaccess'
23065 i_sysdir='$i_sysdir'
23066 i_sysfile='$i_sysfile'
23067 i_sysfilio='$i_sysfilio'
23068 i_sysin='$i_sysin'
23069 i_sysioctl='$i_sysioctl'
23070 i_syslog='$i_syslog'
23071 i_sysmman='$i_sysmman'
23072 i_sysmode='$i_sysmode'
23073 i_sysmount='$i_sysmount'
23074 i_sysndir='$i_sysndir'
23075 i_sysparam='$i_sysparam'
23076 i_syspoll='$i_syspoll'
23077 i_sysresrc='$i_sysresrc'
23078 i_syssecrt='$i_syssecrt'
23079 i_sysselct='$i_sysselct'
23080 i_syssockio='$i_syssockio'
23081 i_sysstat='$i_sysstat'
23082 i_sysstatfs='$i_sysstatfs'
23083 i_sysstatvfs='$i_sysstatvfs'
23084 i_systime='$i_systime'
23085 i_systimek='$i_systimek'
23086 i_systimes='$i_systimes'
23087 i_systypes='$i_systypes'
23088 i_sysuio='$i_sysuio'
23089 i_sysun='$i_sysun'
23090 i_sysutsname='$i_sysutsname'
23091 i_sysvfs='$i_sysvfs'
23092 i_syswait='$i_syswait'
23093 i_termio='$i_termio'
23094 i_termios='$i_termios'
23095 i_time='$i_time'
23096 i_unistd='$i_unistd'
23097 i_ustat='$i_ustat'
23098 i_utime='$i_utime'
23099 i_values='$i_values'
23100 i_varargs='$i_varargs'
23101 i_varhdr='$i_varhdr'
23102 i_vfork='$i_vfork'
23103 ignore_versioned_solibs='$ignore_versioned_solibs'
23104 inc_version_list='$inc_version_list'
23105 inc_version_list_init='$inc_version_list_init'
23106 incpath='$incpath'
23107 inews='$inews'
23108 initialinstalllocation='$initialinstalllocation'
23109 installarchlib='$installarchlib'
23110 installbin='$installbin'
23111 installhtml1dir='$installhtml1dir'
23112 installhtml3dir='$installhtml3dir'
23113 installman1dir='$installman1dir'
23114 installman3dir='$installman3dir'
23115 installprefix='$installprefix'
23116 installprefixexp='$installprefixexp'
23117 installprivlib='$installprivlib'
23118 installscript='$installscript'
23119 installsitearch='$installsitearch'
23120 installsitebin='$installsitebin'
23121 installsitehtml1dir='$installsitehtml1dir'
23122 installsitehtml3dir='$installsitehtml3dir'
23123 installsitelib='$installsitelib'
23124 installsiteman1dir='$installsiteman1dir'
23125 installsiteman3dir='$installsiteman3dir'
23126 installsitescript='$installsitescript'
23127 installstyle='$installstyle'
23128 installusrbinperl='$installusrbinperl'
23129 installvendorarch='$installvendorarch'
23130 installvendorbin='$installvendorbin'
23131 installvendorhtml1dir='$installvendorhtml1dir'
23132 installvendorhtml3dir='$installvendorhtml3dir'
23133 installvendorlib='$installvendorlib'
23134 installvendorman1dir='$installvendorman1dir'
23135 installvendorman3dir='$installvendorman3dir'
23136 installvendorscript='$installvendorscript'
23137 intsize='$intsize'
23138 issymlink='$issymlink'
23139 ivdformat='$ivdformat'
23140 ivsize='$ivsize'
23141 ivtype='$ivtype'
23142 known_extensions='$known_extensions'
23143 ksh='$ksh'
23144 ld='$ld'
23145 lddlflags='$lddlflags'
23146 ldflags='$ldflags'
23147 ldflags_uselargefiles='$ldflags_uselargefiles'
23148 ldlibpthname='$ldlibpthname'
23149 less='$less'
23150 lib_ext='$lib_ext'
23151 libc='$libc'
23152 libperl='$libperl'
23153 libpth='$libpth'
23154 libs='$libs'
23155 libsdirs='$libsdirs'
23156 libsfiles='$libsfiles'
23157 libsfound='$libsfound'
23158 libspath='$libspath'
23159 libswanted='$libswanted'
23160 libswanted_uselargefiles='$libswanted_uselargefiles'
23161 line='$line'
23162 lint='$lint'
23163 lkflags='$lkflags'
23164 ln='$ln'
23165 lns='$lns'
23166 localtime_r_proto='$localtime_r_proto'
23167 locincpth='$locincpth'
23168 loclibpth='$loclibpth'
23169 longdblsize='$longdblsize'
23170 longlongsize='$longlongsize'
23171 longsize='$longsize'
23172 lp='$lp'
23173 lpr='$lpr'
23174 ls='$ls'
23175 lseeksize='$lseeksize'
23176 lseektype='$lseektype'
23177 mad='$mad'
23178 madlyh='$madlyh'
23179 madlyobj='$madlyobj'
23180 madlysrc='$madlysrc'
23181 mail='$mail'
23182 mailx='$mailx'
23183 make='$make'
23184 make_set_make='$make_set_make'
23185 mallocobj='$mallocobj'
23186 mallocsrc='$mallocsrc'
23187 malloctype='$malloctype'
23188 man1dir='$man1dir'
23189 man1direxp='$man1direxp'
23190 man1ext='$man1ext'
23191 man3dir='$man3dir'
23192 man3direxp='$man3direxp'
23193 man3ext='$man3ext'
23194 mips_type='$mips_type'
23195 mistrustnm='$mistrustnm'
23196 mkdir='$mkdir'
23197 mmaptype='$mmaptype'
23198 modetype='$modetype'
23199 more='$more'
23200 multiarch='$multiarch'
23201 mv='$mv'
23202 myarchname='$myarchname'
23203 mydomain='$mydomain'
23204 myhostname='$myhostname'
23205 myuname='$myuname'
23206 n='$n'
23207 need_va_copy='$need_va_copy'
23208 netdb_hlen_type='$netdb_hlen_type'
23209 netdb_host_type='$netdb_host_type'
23210 netdb_name_type='$netdb_name_type'
23211 netdb_net_type='$netdb_net_type'
23212 nm='$nm'
23213 nm_opt='$nm_opt'
23214 nm_so_opt='$nm_so_opt'
23215 nonxs_ext='$nonxs_ext'
23216 nroff='$nroff'
23217 nvEUformat='$nvEUformat'
23218 nvFUformat='$nvFUformat'
23219 nvGUformat='$nvGUformat'
23220 nv_overflows_integers_at='$nv_overflows_integers_at'
23221 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23222 nveformat='$nveformat'
23223 nvfformat='$nvfformat'
23224 nvgformat='$nvgformat'
23225 nvsize='$nvsize'
23226 nvtype='$nvtype'
23227 o_nonblock='$o_nonblock'
23228 obj_ext='$obj_ext'
23229 old_pthread_create_joinable='$old_pthread_create_joinable'
23230 optimize='$optimize'
23231 orderlib='$orderlib'
23232 osname='$osname'
23233 osvers='$osvers'
23234 otherlibdirs='$otherlibdirs'
23235 package='$package'
23236 pager='$pager'
23237 passcat='$passcat'
23238 patchlevel='$patchlevel'
23239 path_sep='$path_sep'
23240 perl5='$perl5'
23241 perl='$perl'
23242 perl_patchlevel='$perl_patchlevel'
23243 perl_static_inline='$perl_static_inline'
23244 perladmin='$perladmin'
23245 perllibs='$perllibs'
23246 perlpath='$perlpath'
23247 pg='$pg'
23248 phostname='$phostname'
23249 pidtype='$pidtype'
23250 plibpth='$plibpth'
23251 pmake='$pmake'
23252 pr='$pr'
23253 prefix='$prefix'
23254 prefixexp='$prefixexp'
23255 privlib='$privlib'
23256 privlibexp='$privlibexp'
23257 procselfexe='$procselfexe'
23258 prototype='$prototype'
23259 ptrsize='$ptrsize'
23260 quadkind='$quadkind'
23261 quadtype='$quadtype'
23262 randbits='$randbits'
23263 randfunc='$randfunc'
23264 random_r_proto='$random_r_proto'
23265 randseedtype='$randseedtype'
23266 ranlib='$ranlib'
23267 rd_nodata='$rd_nodata'
23268 readdir64_r_proto='$readdir64_r_proto'
23269 readdir_r_proto='$readdir_r_proto'
23270 revision='$revision'
23271 rm='$rm'
23272 rm_try='$rm_try'
23273 rmail='$rmail'
23274 run='$run'
23275 runnm='$runnm'
23276 sGMTIME_max='$sGMTIME_max'
23277 sGMTIME_min='$sGMTIME_min'
23278 sLOCALTIME_max='$sLOCALTIME_max'
23279 sLOCALTIME_min='$sLOCALTIME_min'
23280 sPRIEUldbl='$sPRIEUldbl'
23281 sPRIFUldbl='$sPRIFUldbl'
23282 sPRIGUldbl='$sPRIGUldbl'
23283 sPRIXU64='$sPRIXU64'
23284 sPRId64='$sPRId64'
23285 sPRIeldbl='$sPRIeldbl'
23286 sPRIfldbl='$sPRIfldbl'
23287 sPRIgldbl='$sPRIgldbl'
23288 sPRIi64='$sPRIi64'
23289 sPRIo64='$sPRIo64'
23290 sPRIu64='$sPRIu64'
23291 sPRIx64='$sPRIx64'
23292 sSCNfldbl='$sSCNfldbl'
23293 sched_yield='$sched_yield'
23294 scriptdir='$scriptdir'
23295 scriptdirexp='$scriptdirexp'
23296 sed='$sed'
23297 seedfunc='$seedfunc'
23298 selectminbits='$selectminbits'
23299 selecttype='$selecttype'
23300 sendmail='$sendmail'
23301 setgrent_r_proto='$setgrent_r_proto'
23302 sethostent_r_proto='$sethostent_r_proto'
23303 setlocale_r_proto='$setlocale_r_proto'
23304 setnetent_r_proto='$setnetent_r_proto'
23305 setprotoent_r_proto='$setprotoent_r_proto'
23306 setpwent_r_proto='$setpwent_r_proto'
23307 setservent_r_proto='$setservent_r_proto'
23308 sh='$sh'
23309 shar='$shar'
23310 sharpbang='$sharpbang'
23311 shmattype='$shmattype'
23312 shortsize='$shortsize'
23313 shrpenv='$shrpenv'
23314 shsharp='$shsharp'
23315 sig_count='$sig_count'
23316 sig_name='$sig_name'
23317 sig_name_init='$sig_name_init'
23318 sig_num='$sig_num'
23319 sig_num_init='$sig_num_init'
23320 sig_size='$sig_size'
23321 signal_t='$signal_t'
23322 sitearch='$sitearch'
23323 sitearchexp='$sitearchexp'
23324 sitebin='$sitebin'
23325 sitebinexp='$sitebinexp'
23326 sitehtml1dir='$sitehtml1dir'
23327 sitehtml1direxp='$sitehtml1direxp'
23328 sitehtml3dir='$sitehtml3dir'
23329 sitehtml3direxp='$sitehtml3direxp'
23330 sitelib='$sitelib'
23331 sitelib_stem='$sitelib_stem'
23332 sitelibexp='$sitelibexp'
23333 siteman1dir='$siteman1dir'
23334 siteman1direxp='$siteman1direxp'
23335 siteman3dir='$siteman3dir'
23336 siteman3direxp='$siteman3direxp'
23337 siteprefix='$siteprefix'
23338 siteprefixexp='$siteprefixexp'
23339 sitescript='$sitescript'
23340 sitescriptexp='$sitescriptexp'
23341 sizesize='$sizesize'
23342 sizetype='$sizetype'
23343 sleep='$sleep'
23344 smail='$smail'
23345 so='$so'
23346 sockethdr='$sockethdr'
23347 socketlib='$socketlib'
23348 socksizetype='$socksizetype'
23349 sort='$sort'
23350 spackage='$spackage'
23351 spitshell='$spitshell'
23352 srand48_r_proto='$srand48_r_proto'
23353 srandom_r_proto='$srandom_r_proto'
23354 src='$src'
23355 ssizetype='$ssizetype'
23356 st_ino_sign='$st_ino_sign'
23357 st_ino_size='$st_ino_size'
23358 startperl='$startperl'
23359 startsh='$startsh'
23360 static_ext='$static_ext'
23361 stdchar='$stdchar'
23362 stdio_base='$stdio_base'
23363 stdio_bufsiz='$stdio_bufsiz'
23364 stdio_cnt='$stdio_cnt'
23365 stdio_filbuf='$stdio_filbuf'
23366 stdio_ptr='$stdio_ptr'
23367 stdio_stream_array='$stdio_stream_array'
23368 strerror_r_proto='$strerror_r_proto'
23369 strings='$strings'
23370 submit='$submit'
23371 subversion='$subversion'
23372 sysman='$sysman'
23373 tail='$tail'
23374 tar='$tar'
23375 targetarch='$targetarch'
23376 tbl='$tbl'
23377 tee='$tee'
23378 test='$test'
23379 timeincl='$timeincl'
23380 timetype='$timetype'
23381 tmpnam_r_proto='$tmpnam_r_proto'
23382 to='$to'
23383 touch='$touch'
23384 tr='$tr'
23385 trnl='$trnl'
23386 troff='$troff'
23387 ttyname_r_proto='$ttyname_r_proto'
23388 u16size='$u16size'
23389 u16type='$u16type'
23390 u32size='$u32size'
23391 u32type='$u32type'
23392 u64size='$u64size'
23393 u64type='$u64type'
23394 u8size='$u8size'
23395 u8type='$u8type'
23396 uidformat='$uidformat'
23397 uidsign='$uidsign'
23398 uidsize='$uidsize'
23399 uidtype='$uidtype'
23400 uname='$uname'
23401 uniq='$uniq'
23402 uquadtype='$uquadtype'
23403 use5005threads='$use5005threads'
23404 use64bitall='$use64bitall'
23405 use64bitint='$use64bitint'
23406 usecrosscompile='$usecrosscompile'
23407 usedevel='$usedevel'
23408 usedl='$usedl'
23409 usedtrace='$usedtrace'
23410 usefaststdio='$usefaststdio'
23411 useithreads='$useithreads'
23412 uselargefiles='$uselargefiles'
23413 uselongdouble='$uselongdouble'
23414 usemallocwrap='$usemallocwrap'
23415 usemorebits='$usemorebits'
23416 usemultiplicity='$usemultiplicity'
23417 usemymalloc='$usemymalloc'
23418 usenm='$usenm'
23419 useopcode='$useopcode'
23420 useperlio='$useperlio'
23421 useposix='$useposix'
23422 usereentrant='$usereentrant'
23423 userelocatableinc='$userelocatableinc'
23424 usesfio='$usesfio'
23425 useshrplib='$useshrplib'
23426 usesitecustomize='$usesitecustomize'
23427 usesocks='$usesocks'
23428 usethreads='$usethreads'
23429 usevendorprefix='$usevendorprefix'
23430 usevfork='$usevfork'
23431 usrinc='$usrinc'
23432 uuname='$uuname'
23433 uvXUformat='$uvXUformat'
23434 uvoformat='$uvoformat'
23435 uvsize='$uvsize'
23436 uvtype='$uvtype'
23437 uvuformat='$uvuformat'
23438 uvxformat='$uvxformat'
23439 vaproto='$vaproto'
23440 vendorarch='$vendorarch'
23441 vendorarchexp='$vendorarchexp'
23442 vendorbin='$vendorbin'
23443 vendorbinexp='$vendorbinexp'
23444 vendorhtml1dir='$vendorhtml1dir'
23445 vendorhtml1direxp='$vendorhtml1direxp'
23446 vendorhtml3dir='$vendorhtml3dir'
23447 vendorhtml3direxp='$vendorhtml3direxp'
23448 vendorlib='$vendorlib'
23449 vendorlib_stem='$vendorlib_stem'
23450 vendorlibexp='$vendorlibexp'
23451 vendorman1dir='$vendorman1dir'
23452 vendorman1direxp='$vendorman1direxp'
23453 vendorman3dir='$vendorman3dir'
23454 vendorman3direxp='$vendorman3direxp'
23455 vendorprefix='$vendorprefix'
23456 vendorprefixexp='$vendorprefixexp'
23457 vendorscript='$vendorscript'
23458 vendorscriptexp='$vendorscriptexp'
23459 version='$version'
23460 version_patchlevel_string='$version_patchlevel_string'
23461 versiononly='$versiononly'
23462 vi='$vi'
23463 voidflags='$voidflags'
23464 xlibpth='$xlibpth'
23465 yacc='$yacc'
23466 yaccflags='$yaccflags'
23467 zcat='$zcat'
23468 zip='$zip'
23469 EOT
23470
23471 : add special variables
23472 $test -f $src/patchlevel.h && \
23473 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23474 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23475 echo "PERL_CONFIG_SH=true" >>config.sh
23476
23477 : propagate old symbols
23478 if $test -f UU/config.sh; then
23479         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23480         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23481                 config.sh config.sh UU/oldconfig.sh |\
23482                 $sort | $uniq -u >UU/oldsyms
23483         set X `$cat UU/oldsyms`
23484         shift
23485         case $# in
23486         0) ;;
23487         *)
23488                 $cat <<EOM
23489 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23490 EOM
23491                 echo ": Variables propagated from previous config.sh file." >>config.sh
23492                 for sym in `$cat UU/oldsyms`; do
23493                         echo "    Propagating $hint variable "'$'"$sym..."
23494                         eval 'tmp="$'"${sym}"'"'
23495                         echo "$tmp" | \
23496                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23497                 done
23498                 ;;
23499         esac
23500 fi
23501
23502 : Finish up by extracting the .SH files
23503 case "$alldone" in
23504 exit)
23505         $rm -rf UU
23506         echo "Extraction done."
23507         exit 0
23508         ;;
23509 cont)
23510         ;;
23511 '')
23512         dflt=''
23513         nostick=true
23514         $cat <<EOM
23515
23516 If you'd like to make any changes to the config.sh file before I begin
23517 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23518
23519 EOM
23520         rp="Press return or use a shell escape to edit config.sh:"
23521         . UU/myread
23522         nostick=''
23523         case "$ans" in
23524         '') ;;
23525         *) : in case they cannot read
23526                 sh 1>&4 -c "$ans";;
23527         esac
23528         ;;
23529 esac
23530
23531 : if this fails, just run all the .SH files by hand
23532 . ./config.sh
23533
23534 echo " "
23535 exec 1>&4
23536 pwd=`pwd`
23537 . ./UU/extract
23538 cd "$pwd"
23539
23540 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23541         dflt=y
23542         case "$silent" in
23543         true) ;;
23544         *)
23545                 $cat <<EOM
23546
23547 Now you need to generate make dependencies by running "$make depend".
23548 You might prefer to run it in background: "$make depend > makedepend.out &"
23549 It can take a while, so you might not want to run it right now.
23550
23551 EOM
23552                 ;;
23553         esac
23554         rp="Run $make depend now?"
23555         . UU/myread
23556         case "$ans" in
23557         y*)
23558                 $make depend && echo "Now you must run '$make'."
23559                 ;;
23560         *)
23561                 echo "You must run '$make depend' then '$make'."
23562                 ;;
23563         esac
23564 elif test -f [Mm]akefile; then
23565         echo " "
23566         echo "Now you must run a $make."
23567 else
23568         echo "Configure done."
23569 fi
23570
23571 if $test -f Policy.sh; then
23572     $cat <<EOM
23573
23574 If you compile $package on a different machine or from a different object
23575 directory, copy the Policy.sh file from this object directory to the
23576 new one before you run Configure -- this will help you with most of
23577 the policy defaults.
23578
23579 EOM
23580 fi
23581 if $test -f config.msg; then
23582     echo "Hmm.  I also noted the following information while running:"
23583     echo " "
23584     $cat config.msg >&4
23585     $rm -f config.msg
23586 fi
23587 $rm -f kit*isdone ark*isdone
23588 $rm -rf UU
23589
23590 : End of Configure
23591