This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
is_duplicate_pod() and get_pod_metadata() in pod_lib.pl modified $_
[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 Fri Jan 27 15:48:54 CET 2012 [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_isblank=''
569 d_isfinite=''
570 d_isinf=''
571 d_isnan=''
572 d_isnanl=''
573 d_killpg=''
574 d_lchown=''
575 d_ldbl_dig=''
576 d_libm_lib_version=''
577 d_link=''
578 d_localtime_r=''
579 d_localtime_r_needs_tzset=''
580 localtime_r_proto=''
581 d_locconv=''
582 d_lockf=''
583 d_longdbl=''
584 longdblsize=''
585 d_longlong=''
586 longlongsize=''
587 d_lseekproto=''
588 d_lstat=''
589 d_madvise=''
590 d_malloc_good_size=''
591 d_malloc_size=''
592 d_mblen=''
593 d_mbstowcs=''
594 d_mbtowc=''
595 d_memchr=''
596 d_memcmp=''
597 d_memcpy=''
598 d_memmove=''
599 d_memset=''
600 d_mkdir=''
601 d_mkdtemp=''
602 d_mkfifo=''
603 d_mkstemp=''
604 d_mkstemps=''
605 d_mktime=''
606 d_mmap=''
607 mmaptype=''
608 d_modfl=''
609 d_modfl_pow32_bug=''
610 d_modflproto=''
611 d_mprotect=''
612 d_msg=''
613 d_msgctl=''
614 d_msgget=''
615 d_msghdr_s=''
616 d_msgrcv=''
617 d_msgsnd=''
618 d_msync=''
619 d_munmap=''
620 d_nice=''
621 d_nl_langinfo=''
622 d_off64_t=''
623 d_open3=''
624 d_fpathconf=''
625 d_pathconf=''
626 d_pause=''
627 d_pipe=''
628 d_poll=''
629 d_portable=''
630 d_prctl=''
631 d_prctl_set_name=''
632 d_procselfexe=''
633 procselfexe=''
634 d_old_pthread_create_joinable=''
635 old_pthread_create_joinable=''
636 d_pthread_atfork=''
637 d_pthread_attr_setscope=''
638 d_pthread_yield=''
639 d_sched_yield=''
640 sched_yield=''
641 d_qgcvt=''
642 d_random_r=''
643 random_r_proto=''
644 d_readdir64_r=''
645 readdir64_r_proto=''
646 d_readdir=''
647 d_rewinddir=''
648 d_seekdir=''
649 d_telldir=''
650 d_readdir_r=''
651 readdir_r_proto=''
652 d_readlink=''
653 d_readv=''
654 d_recvmsg=''
655 d_rename=''
656 d_rmdir=''
657 d_safebcpy=''
658 d_safemcpy=''
659 d_sanemcmp=''
660 d_sbrkproto=''
661 d_scalbnl=''
662 d_select=''
663 d_sem=''
664 d_semctl=''
665 d_semget=''
666 d_semop=''
667 d_sendmsg=''
668 d_setegid=''
669 d_seteuid=''
670 d_setgrent=''
671 d_setgrent_r=''
672 setgrent_r_proto=''
673 d_setgrps=''
674 d_sethent=''
675 d_sethostent_r=''
676 sethostent_r_proto=''
677 d_setitimer=''
678 d_setlinebuf=''
679 d_setlocale=''
680 d_setlocale_r=''
681 setlocale_r_proto=''
682 d_setnent=''
683 d_setnetent_r=''
684 setnetent_r_proto=''
685 d_setpent=''
686 d_setpgid=''
687 d_setpgrp2=''
688 d_bsdsetpgrp=''
689 d_setpgrp=''
690 d_setprior=''
691 d_setproctitle=''
692 d_setprotoent_r=''
693 setprotoent_r_proto=''
694 d_setpwent=''
695 d_setpwent_r=''
696 setpwent_r_proto=''
697 d_setregid=''
698 d_setresgid=''
699 d_setresuid=''
700 d_setreuid=''
701 d_setrgid=''
702 d_setruid=''
703 d_setsent=''
704 d_setservent_r=''
705 setservent_r_proto=''
706 d_setsid=''
707 d_setvbuf=''
708 d_sfio=''
709 usesfio=''
710 d_shm=''
711 d_shmat=''
712 d_shmatprototype=''
713 shmattype=''
714 d_shmctl=''
715 d_shmdt=''
716 d_shmget=''
717 d_sigaction=''
718 d_signbit=''
719 d_sigprocmask=''
720 d_sigsetjmp=''
721 usesitecustomize=''
722 d_snprintf=''
723 d_vsnprintf=''
724 d_sockatmark=''
725 d_sockatmarkproto=''
726 d_msg_ctrunc=''
727 d_msg_dontroute=''
728 d_msg_oob=''
729 d_msg_peek=''
730 d_msg_proxy=''
731 d_oldsock=''
732 d_scm_rights=''
733 d_sin6_scope_id=''
734 d_sockaddr_sa_len=''
735 d_socket=''
736 d_sockpair=''
737 sockethdr=''
738 socketlib=''
739 d_socklen_t=''
740 d_socks5_init=''
741 d_sprintf_returns_strlen=''
742 d_sqrtl=''
743 d_srand48_r=''
744 srand48_r_proto=''
745 d_srandom_r=''
746 srandom_r_proto=''
747 d_sresgproto=''
748 d_sresuproto=''
749 d_statblks=''
750 d_statfs_f_flags=''
751 d_statfs_s=''
752 d_static_inline=''
753 perl_static_inline=''
754 d_fstatvfs=''
755 d_statvfs=''
756 d_stdio_cnt_lval=''
757 d_stdio_ptr_lval=''
758 d_stdio_ptr_lval_nochange_cnt=''
759 d_stdio_ptr_lval_sets_cnt=''
760 d_stdiobase=''
761 d_stdstdio=''
762 stdio_base=''
763 stdio_bufsiz=''
764 stdio_cnt=''
765 stdio_filbuf=''
766 stdio_ptr=''
767 d_index=''
768 d_strchr=''
769 d_strcoll=''
770 d_strctcpy=''
771 d_strerrm=''
772 d_strerror=''
773 d_sysernlst=''
774 d_syserrlst=''
775 d_strerror_r=''
776 strerror_r_proto=''
777 d_strftime=''
778 d_strlcat=''
779 d_strlcpy=''
780 d_strtod=''
781 d_strtol=''
782 d_strtold=''
783 d_strtoll=''
784 d_strtoq=''
785 d_strtoul=''
786 d_strtoull=''
787 d_strtouq=''
788 d_strxfrm=''
789 d_symlink=''
790 d_syscall=''
791 d_syscallproto=''
792 d_sysconf=''
793 d_system=''
794 d_tcgetpgrp=''
795 d_tcsetpgrp=''
796 d_telldirproto=''
797 d_time=''
798 timetype=''
799 d_asctime64=''
800 d_ctime64=''
801 d_difftime64=''
802 d_gmtime64=''
803 d_localtime64=''
804 d_mktime64=''
805 d_timegm=''
806 clocktype=''
807 d_times=''
808 d_tmpnam_r=''
809 tmpnam_r_proto=''
810 d_truncate=''
811 d_ttyname_r=''
812 ttyname_r_proto=''
813 d_tzname=''
814 d_u32align=''
815 d_ualarm=''
816 d_umask=''
817 d_semctl_semid_ds=''
818 d_semctl_semun=''
819 d_union_semun=''
820 d_unordered=''
821 d_unsetenv=''
822 d_usleep=''
823 d_usleepproto=''
824 d_ustat=''
825 d_pseudofork=''
826 d_vfork=''
827 usevfork=''
828 d_voidsig=''
829 signal_t=''
830 d_volatile=''
831 d_charvspr=''
832 d_vprintf=''
833 d_wait4=''
834 d_waitpid=''
835 d_wcstombs=''
836 d_wctomb=''
837 d_writev=''
838 dlext=''
839 bin_ELF=''
840 cccdlflags=''
841 ccdlflags=''
842 dlsrc=''
843 ld=''
844 lddlflags=''
845 usedl=''
846 doublesize=''
847 ebcdic=''
848 fflushNULL=''
849 fflushall=''
850 fpossize=''
851 fpostype=''
852 gccansipedantic=''
853 gccosandvers=''
854 gccversion=''
855 gidformat=''
856 gidsign=''
857 gidsize=''
858 gidtype=''
859 groupstype=''
860 h_fcntl=''
861 h_sysfile=''
862 html1dir=''
863 html1direxp=''
864 installhtml1dir=''
865 html3dir=''
866 html3direxp=''
867 installhtml3dir=''
868 i_arpainet=''
869 i_assert=''
870 i_crypt=''
871 db_hashtype=''
872 db_prefixtype=''
873 db_version_major=''
874 db_version_minor=''
875 db_version_patch=''
876 i_db=''
877 i_dbm=''
878 i_rpcsvcdbm=''
879 d_dirnamlen=''
880 direntrytype=''
881 i_dirent=''
882 i_dld=''
883 i_dlfcn=''
884 i_fcntl=''
885 i_float=''
886 i_fp=''
887 i_fp_class=''
888 i_gdbm=''
889 d_grpasswd=''
890 i_grp=''
891 i_ieeefp=''
892 i_inttypes=''
893 i_langinfo=''
894 i_libutil=''
895 i_limits=''
896 i_locale=''
897 i_machcthr=''
898 i_malloc=''
899 i_mallocmalloc=''
900 i_math=''
901 i_memory=''
902 i_mntent=''
903 d_gdbm_ndbm_h_uses_prototypes=''
904 d_gdbmndbm_h_uses_prototypes=''
905 d_ndbm=''
906 d_ndbm_h_uses_prototypes=''
907 i_gdbm_ndbm=''
908 i_gdbmndbm=''
909 i_ndbm=''
910 i_netdb=''
911 i_neterrno=''
912 i_netinettcp=''
913 i_niin=''
914 i_sysin=''
915 i_poll=''
916 i_prot=''
917 i_pthread=''
918 d_pwage=''
919 d_pwchange=''
920 d_pwclass=''
921 d_pwcomment=''
922 d_pwexpire=''
923 d_pwgecos=''
924 d_pwpasswd=''
925 d_pwquota=''
926 i_pwd=''
927 i_sfio=''
928 i_shadow=''
929 i_socks=''
930 i_stdbool=''
931 i_stddef=''
932 i_stdlib=''
933 i_string=''
934 strings=''
935 i_sunmath=''
936 i_sysaccess=''
937 i_sysdir=''
938 i_sysfile=''
939 d_voidtty=''
940 i_bsdioctl=''
941 i_sysfilio=''
942 i_sysioctl=''
943 i_syssockio=''
944 i_syslog=''
945 i_sysmman=''
946 i_sysmode=''
947 i_sysmount=''
948 i_sysndir=''
949 i_sysparam=''
950 i_syspoll=''
951 i_sysresrc=''
952 i_syssecrt=''
953 i_sysselct=''
954 i_sysstat=''
955 i_sysstatfs=''
956 i_sysstatvfs=''
957 i_systimes=''
958 i_systypes=''
959 i_sysuio=''
960 i_sysun=''
961 i_sysutsname=''
962 i_sysvfs=''
963 i_syswait=''
964 i_sgtty=''
965 i_termio=''
966 i_termios=''
967 d_tm_tm_gmtoff=''
968 d_tm_tm_zone=''
969 i_systime=''
970 i_systimek=''
971 i_time=''
972 timeincl=''
973 i_unistd=''
974 i_ustat=''
975 i_utime=''
976 i_values=''
977 i_stdarg=''
978 i_varargs=''
979 i_varhdr=''
980 i_vfork=''
981 d_inc_version_list=''
982 inc_version_list=''
983 inc_version_list_init=''
984 installprefix=''
985 installprefixexp=''
986 installstyle=''
987 installusrbinperl=''
988 intsize=''
989 longsize=''
990 shortsize=''
991 issymlink=''
992 libc=''
993 ldlibpthname=''
994 libperl=''
995 shrpenv=''
996 useshrplib=''
997 glibpth=''
998 libpth=''
999 loclibpth=''
1000 plibpth=''
1001 xlibpth=''
1002 ignore_versioned_solibs=''
1003 libs=''
1004 libsdirs=''
1005 libsfiles=''
1006 libsfound=''
1007 libspath=''
1008 lns=''
1009 d_PRIEUldbl=''
1010 d_PRIFUldbl=''
1011 d_PRIGUldbl=''
1012 d_PRIeldbl=''
1013 d_PRIfldbl=''
1014 d_PRIgldbl=''
1015 d_SCNfldbl=''
1016 sPRIEUldbl=''
1017 sPRIFUldbl=''
1018 sPRIGUldbl=''
1019 sPRIeldbl=''
1020 sPRIfldbl=''
1021 sPRIgldbl=''
1022 sSCNfldbl=''
1023 lseeksize=''
1024 lseektype=''
1025 mad=''
1026 madlyh=''
1027 madlyobj=''
1028 madlysrc=''
1029 make_set_make=''
1030 d_mymalloc=''
1031 freetype=''
1032 mallocobj=''
1033 mallocsrc=''
1034 malloctype=''
1035 usemallocwrap=''
1036 usemymalloc=''
1037 installman1dir=''
1038 man1dir=''
1039 man1direxp=''
1040 man1ext=''
1041 installman3dir=''
1042 man3dir=''
1043 man3direxp=''
1044 man3ext=''
1045 modetype=''
1046 multiarch=''
1047 mydomain=''
1048 myhostname=''
1049 phostname=''
1050 c=''
1051 n=''
1052 d_eofnblk=''
1053 eagain=''
1054 o_nonblock=''
1055 rd_nodata=''
1056 need_va_copy=''
1057 netdb_hlen_type=''
1058 netdb_host_type=''
1059 netdb_name_type=''
1060 netdb_net_type=''
1061 groupcat=''
1062 hostcat=''
1063 passcat=''
1064 orderlib=''
1065 ranlib=''
1066 d_perl_otherlibdirs=''
1067 otherlibdirs=''
1068 package=''
1069 spackage=''
1070 pager=''
1071 api_revision=''
1072 api_subversion=''
1073 api_version=''
1074 api_versionstring=''
1075 patchlevel=''
1076 perl_patchlevel=''
1077 revision=''
1078 subversion=''
1079 version=''
1080 version_patchlevel_string=''
1081 perl5=''
1082 perladmin=''
1083 perlpath=''
1084 d_nv_preserves_uv=''
1085 d_nv_zero_is_allbits_zero=''
1086 i16size=''
1087 i16type=''
1088 i32size=''
1089 i32type=''
1090 i64size=''
1091 i64type=''
1092 i8size=''
1093 i8type=''
1094 ivsize=''
1095 ivtype=''
1096 nv_overflows_integers_at=''
1097 nv_preserves_uv_bits=''
1098 nvsize=''
1099 nvtype=''
1100 u16size=''
1101 u16type=''
1102 u32size=''
1103 u32type=''
1104 u64size=''
1105 u64type=''
1106 u8size=''
1107 u8type=''
1108 uvsize=''
1109 uvtype=''
1110 ivdformat=''
1111 nvEUformat=''
1112 nvFUformat=''
1113 nvGUformat=''
1114 nveformat=''
1115 nvfformat=''
1116 nvgformat=''
1117 uvXUformat=''
1118 uvoformat=''
1119 uvuformat=''
1120 uvxformat=''
1121 pidtype=''
1122 prefix=''
1123 prefixexp=''
1124 installprivlib=''
1125 privlib=''
1126 privlibexp=''
1127 prototype=''
1128 ptrsize=''
1129 d_PRIXU64=''
1130 d_PRId64=''
1131 d_PRIi64=''
1132 d_PRIo64=''
1133 d_PRIu64=''
1134 d_PRIx64=''
1135 sPRIXU64=''
1136 sPRId64=''
1137 sPRIi64=''
1138 sPRIo64=''
1139 sPRIu64=''
1140 sPRIx64=''
1141 d_quad=''
1142 quadkind=''
1143 quadtype=''
1144 uquadtype=''
1145 drand01=''
1146 randbits=''
1147 randfunc=''
1148 randseedtype=''
1149 seedfunc=''
1150 installscript=''
1151 scriptdir=''
1152 scriptdirexp=''
1153 selectminbits=''
1154 selecttype=''
1155 sh=''
1156 sig_count=''
1157 sig_name=''
1158 sig_name_init=''
1159 sig_num=''
1160 sig_num_init=''
1161 sig_size=''
1162 d_sitearch=''
1163 installsitearch=''
1164 sitearch=''
1165 sitearchexp=''
1166 installsitebin=''
1167 sitebin=''
1168 sitebinexp=''
1169 installsitehtml1dir=''
1170 sitehtml1dir=''
1171 sitehtml1direxp=''
1172 installsitehtml3dir=''
1173 sitehtml3dir=''
1174 sitehtml3direxp=''
1175 installsitelib=''
1176 sitelib=''
1177 sitelib_stem=''
1178 sitelibexp=''
1179 installsiteman1dir=''
1180 siteman1dir=''
1181 siteman1direxp=''
1182 installsiteman3dir=''
1183 siteman3dir=''
1184 siteman3direxp=''
1185 siteprefix=''
1186 siteprefixexp=''
1187 installsitescript=''
1188 sitescript=''
1189 sitescriptexp=''
1190 sizesize=''
1191 sizetype=''
1192 so=''
1193 socksizetype=''
1194 sharpbang=''
1195 shsharp=''
1196 spitshell=''
1197 src=''
1198 ssizetype=''
1199 st_ino_sign=''
1200 st_ino_size=''
1201 startperl=''
1202 startsh=''
1203 stdchar=''
1204 d_stdio_stream_array=''
1205 stdio_stream_array=''
1206 sysman=''
1207 sGMTIME_max=''
1208 sGMTIME_min=''
1209 sLOCALTIME_max=''
1210 sLOCALTIME_min=''
1211 trnl=''
1212 uidformat=''
1213 uidsign=''
1214 uidsize=''
1215 uidtype=''
1216 archname64=''
1217 use64bitall=''
1218 use64bitint=''
1219 dtrace=''
1220 usedtrace=''
1221 usefaststdio=''
1222 usekernprocpathname=''
1223 ccflags_uselargefiles=''
1224 ldflags_uselargefiles=''
1225 libswanted_uselargefiles=''
1226 uselargefiles=''
1227 uselongdouble=''
1228 usemorebits=''
1229 usemultiplicity=''
1230 nm_opt=''
1231 nm_so_opt=''
1232 runnm=''
1233 usenm=''
1234 usensgetexecutablepath=''
1235 useperlio=''
1236 usesocks=''
1237 d_oldpthreads=''
1238 use5005threads=''
1239 useithreads=''
1240 usereentrant=''
1241 usethreads=''
1242 incpath=''
1243 mips_type=''
1244 usrinc=''
1245 vaproto=''
1246 d_vendorarch=''
1247 installvendorarch=''
1248 vendorarch=''
1249 vendorarchexp=''
1250 d_vendorbin=''
1251 installvendorbin=''
1252 vendorbin=''
1253 vendorbinexp=''
1254 installvendorhtml1dir=''
1255 vendorhtml1dir=''
1256 vendorhtml1direxp=''
1257 installvendorhtml3dir=''
1258 vendorhtml3dir=''
1259 vendorhtml3direxp=''
1260 d_vendorlib=''
1261 installvendorlib=''
1262 vendorlib=''
1263 vendorlib_stem=''
1264 vendorlibexp=''
1265 installvendorman1dir=''
1266 vendorman1dir=''
1267 vendorman1direxp=''
1268 installvendorman3dir=''
1269 vendorman3dir=''
1270 vendorman3direxp=''
1271 usevendorprefix=''
1272 vendorprefix=''
1273 vendorprefixexp=''
1274 d_vendorscript=''
1275 installvendorscript=''
1276 vendorscript=''
1277 vendorscriptexp=''
1278 versiononly=''
1279 defvoidused=''
1280 voidflags=''
1281 yacc=''
1282 yaccflags=''
1283 CONFIG=''
1284
1285 : Detect odd OSs
1286 define='define'
1287 undef='undef'
1288 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1289 rmlist=''
1290
1291 : We must find out about Eunice early
1292 eunicefix=':'
1293 if test -f /etc/unixtovms; then
1294         eunicefix=/etc/unixtovms
1295 fi
1296 if test -f /etc/unixtovms.exe; then
1297         eunicefix=/etc/unixtovms.exe
1298 fi
1299
1300 : Set executable suffix now -- needed before hints available
1301 if test -f "/libs/version.library"; then
1302 : Amiga OS
1303     _exe=""
1304 elif test -f "/system/gnu_library/bin/ar.pm"; then
1305 : Stratus VOS
1306     _exe=".pm"
1307 elif test -n "$DJGPP"; then
1308 : DOS DJGPP
1309     _exe=".exe"
1310 elif test -d c:/. -o -n "$is_os2" ; then
1311 : OS/2 or cygwin
1312     _exe=".exe"
1313 fi
1314
1315 groupstype=''
1316 i_whoami=''
1317 : Trailing extension.  Override this in a hint file, if needed.
1318 : Extra object files, if any, needed on this platform.
1319 archobjs=''
1320 archname=''
1321 : Possible local include directories to search.
1322 : Set locincpth to "" in a hint file to defeat local include searches.
1323 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1324 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1325 :
1326 : no include file wanted by default
1327 inclwanted=''
1328
1329 : Enable -DEBUGGING and -DDEBUGGING from the command line
1330 EBUGGING=''
1331 DEBUGGING=''
1332
1333 libnames=''
1334 : change the next line if compiling for Xenix/286 on Xenix/386
1335 xlibpth='/usr/lib/386 /lib/386'
1336 : Possible local library directories to search.
1337 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1338 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1339
1340 : general looking path for locating libraries
1341 glibpth="/lib /usr/lib $xlibpth"
1342 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1343 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1344 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1345 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1346
1347 : Private path used by Configure to find libraries.  Its value
1348 : is prepended to libpth. This variable takes care of special
1349 : machines, like the mips.  Usually, it should be empty.
1350 plibpth=''
1351
1352 : default library list
1353 libswanted=''
1354 : some systems want to use only the non-versioned libso:s
1355 ignore_versioned_solibs=''
1356 : set usethreads on the Configure command line to enable threads.
1357 usereentrant='undef'
1358 : full support for void wanted by default
1359 defvoidused=15
1360
1361 ccname=''
1362 ccversion=''
1363 perllibs=''
1364 : set useposix=false in your hint file to disable the POSIX extension.
1365 useposix=true
1366 : set useopcode=false in your hint file to disable the Opcode extension.
1367 useopcode=true
1368 archname64=''
1369 ccflags_uselargefiles=''
1370 ldflags_uselargefiles=''
1371 libswanted_uselargefiles=''
1372 : set usemultiplicity on the Configure command line to enable multiplicity.
1373 : set usesocks on the Configure command line to enable socks.
1374 : List of libraries we want.
1375 : If anyone needs extra -lxxx, put those in a hint file.
1376 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1377 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1378 : We probably want to search /usr/shlib before most other libraries.
1379 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1380 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1381 glibpth="/usr/shlib $glibpth"
1382 : Do not use vfork unless overridden by a hint file.
1383 usevfork=false
1384
1385 : Find the basic shell for Bourne shell scripts
1386 case "$sh" in
1387 '')
1388         case "$SYSTYPE" in
1389         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1390         *) xxx='/bin/sh';;
1391         esac
1392         if test -f "$xxx"; then
1393                 sh="$xxx"
1394         else
1395                 : Build up a list and do a single loop so we can 'break' out.
1396                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1397                 for xxx in sh bash ksh pdksh ash; do
1398                         for p in $pth; do
1399                                 try="$try ${p}/${xxx}"
1400                         done
1401                 done
1402                 for xxx in $try; do
1403                         if test -f "$xxx"; then
1404                                 sh="$xxx";
1405                                 break
1406                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1407                                 sh="$xxx";
1408                                 break
1409                         elif test -f "$xxx.exe"; then
1410                                 sh="$xxx";
1411                                 break
1412                         fi
1413                 done
1414         fi
1415         ;;
1416 esac
1417
1418 case "$sh" in
1419 '')     cat >&2 <<EOM
1420 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1421
1422 Usually it's in /bin/sh.  How did you even get this far?
1423 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1424 we'll try to straighten this all out.
1425 EOM
1426         exit 1
1427         ;;
1428 esac
1429
1430 : see if sh knows # comments
1431 if `$sh -c '#' >/dev/null 2>&1`; then
1432         shsharp=true
1433         spitshell=cat
1434         xcat=/bin/cat
1435         test -f $xcat$_exe || xcat=/usr/bin/cat
1436         if test ! -f $xcat$_exe; then
1437                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1438                         if test -f $p/cat$_exe; then
1439                                 xcat=$p/cat
1440                                 break
1441                         fi
1442                 done
1443                 if test ! -f $xcat$_exe; then
1444                         echo "Can't find cat anywhere!"
1445                         exit 1
1446                 fi
1447         fi
1448         echo "#!$xcat" >sharp
1449         $eunicefix sharp
1450         chmod +x sharp
1451         ./sharp > today 2>/dev/null
1452         if test -s today; then
1453                 sharpbang='#!'
1454         else
1455                 echo "#! $xcat" > sharp
1456                 $eunicefix sharp
1457                 chmod +x sharp
1458                 ./sharp > today 2>/dev/null
1459                 if test -s today; then
1460                         sharpbang='#! '
1461                 else
1462                         sharpbang=': use '
1463                 fi
1464         fi
1465 else
1466         echo " "
1467         echo "Your $sh doesn't grok # comments--I will strip them later on."
1468         shsharp=false
1469         cd ..
1470         echo "exec grep -v '^[  ]*#'" >spitshell
1471         chmod +x spitshell
1472         $eunicefix spitshell
1473         spitshell=`pwd`/spitshell
1474         cd UU
1475         echo "I presume that if # doesn't work, #! won't work either!"
1476         sharpbang=': use '
1477 fi
1478 rm -f sharp today
1479
1480 : figure out how to guarantee sh startup
1481 case "$startsh" in
1482 '') startsh=${sharpbang}${sh} ;;
1483 *)
1484 esac
1485 cat >sharp <<EOSS
1486 $startsh
1487 set abc
1488 test "$?abc" != 1
1489 EOSS
1490
1491 chmod +x sharp
1492 $eunicefix sharp
1493 if ./sharp; then
1494         : echo "Yup, it does."
1495 else
1496         echo "Hmm... '$startsh' does not guarantee sh startup..."
1497         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1498 fi
1499 rm -f sharp
1500
1501 : Save command line options in file UU/cmdline.opt for later use in
1502 : generating config.sh.
1503 cat > cmdline.opt <<EOSH
1504 : Configure command line arguments.
1505 config_arg0='$0'
1506 config_args='$*'
1507 config_argc=$#
1508 EOSH
1509 argn=1
1510 args_exp=''
1511 args_sep=''
1512 for arg in "$@"; do
1513         cat >>cmdline.opt <<EOSH
1514 config_arg$argn='$arg'
1515 EOSH
1516         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1517 $arg
1518 EOC
1519         arg_exp=`cat cmdl.opt`
1520         args_exp="$args_exp$args_sep'$arg_exp'"
1521         argn=`expr $argn + 1`
1522         args_sep=' '
1523 done
1524 rm -f cmdl.opt
1525
1526 : produce awk script to parse command line options
1527 cat >options.awk <<'EOF'
1528 BEGIN {
1529         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1530
1531         len = length(optstr);
1532         for (i = 1; i <= len; i++) {
1533                 c = substr(optstr, i, 1);
1534                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1535                 if (a == ":") {
1536                         arg[c] = 1;
1537                         i++;
1538                 }
1539                 opt[c] = 1;
1540         }
1541 }
1542 {
1543         expect = 0;
1544         str = $0;
1545         if (substr(str, 1, 1) != "-") {
1546                 printf("'%s'\n", str);
1547                 next;
1548         }
1549         len = length($0);
1550         for (i = 2; i <= len; i++) {
1551                 c = substr(str, i, 1);
1552                 if (!opt[c]) {
1553                         printf("-%s\n", substr(str, i));
1554                         next;
1555                 }
1556                 printf("-%s\n", c);
1557                 if (arg[c]) {
1558                         if (i < len)
1559                                 printf("'%s'\n", substr(str, i + 1));
1560                         else
1561                                 expect = 1;
1562                         next;
1563                 }
1564         }
1565 }
1566 END {
1567         if (expect)
1568                 print "?";
1569 }
1570 EOF
1571
1572 : process the command line options
1573 set X `for arg in "$@"; do echo "X$arg"; done |
1574         sed -e s/X// | awk -f options.awk`
1575 eval "set $*"
1576 shift
1577 rm -f options.awk
1578
1579 : set up default values
1580 fastread=''
1581 reuseval=false
1582 config_sh=''
1583 alldone=''
1584 error=''
1585 silent=''
1586 extractsh=''
1587 override=''
1588 knowitall=''
1589 rm -f optdef.sh posthint.sh
1590 cat >optdef.sh <<EOS
1591 $startsh
1592 EOS
1593
1594
1595 : option parsing
1596 while test $# -gt 0; do
1597         case "$1" in
1598         -d) shift; fastread=yes;;
1599         -e) shift; alldone=cont;;
1600         -f)
1601                 shift
1602                 cd ..
1603                 if test -r "$1"; then
1604                         config_sh="$1"
1605                 else
1606                         echo "$me: cannot read config file $1." >&2
1607                         error=true
1608                 fi
1609                 cd UU
1610                 shift;;
1611         --help|\
1612         -h) shift; error=true;;
1613         -r) shift; reuseval=true;;
1614         -s) shift; silent=true; realsilent=true;;
1615         -E) shift; alldone=exit;;
1616         -K) shift; knowitall=true;;
1617         -O) shift; override=true;;
1618         -S) shift; silent=true; extractsh=true;;
1619         -D)
1620                 shift
1621                 case "$1" in
1622                 *=)
1623                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1624                         echo "$me: ignoring -D $1" >&2
1625                         ;;
1626                 *=*) echo "$1" | \
1627                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1628                 *) echo "$1='define'" >> optdef.sh;;
1629                 esac
1630                 shift
1631                 ;;
1632         -U)
1633                 shift
1634                 case "$1" in
1635                 *=) echo "$1" >> optdef.sh;;
1636                 *=*)
1637                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1638                         echo "$me: ignoring -U $1" >&2
1639                         ;;
1640                 *) echo "$1='undef'" >> optdef.sh;;
1641                 esac
1642                 shift
1643                 ;;
1644         -A)
1645             shift
1646             xxx=''
1647             yyy="$1"
1648             zzz=''
1649             uuu=undef
1650             case "$yyy" in
1651             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1652                  case "$zzz" in
1653                  *:*) zzz='' ;;
1654                  *)   xxx=append
1655                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1656                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1657                  esac
1658                  ;;
1659             esac
1660             case "$xxx" in
1661             '')  case "$yyy" in
1662                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1663                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1664                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1665                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1666                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1667                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1668                  esac
1669                  ;;
1670             esac
1671             case "$xxx" in
1672             append)
1673                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1674             clear)
1675                 echo "$yyy=''"                  >> posthint.sh ;;
1676             define)
1677                 case "$zzz" in
1678                 '') zzz=define ;;
1679                 esac
1680                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1681             eval)
1682                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1683             prepend)
1684                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1685             undef)
1686                 case "$zzz" in
1687                 '') zzz="$uuu" ;;
1688                 esac
1689                 echo "$yyy=$zzz"                >> posthint.sh ;;
1690             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1691             esac
1692             shift
1693             ;;
1694         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1695             exit 0;;
1696         --) break;;
1697         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1698         *) break;;
1699         esac
1700 done
1701
1702 case "$error" in
1703 true)
1704         cat >&2 <<EOM
1705 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1706                  [-U symbol] [-U symbol=] [-A command:symbol...]
1707   -d : use defaults for all answers.
1708   -e : go on without questioning past the production of config.sh.
1709   -f : specify an alternate default configuration file.
1710   -h : print this help message and exit (with an error status).
1711   -r : reuse C symbols value if possible (skips costly nm extraction).
1712   -s : silent mode, only echoes questions and essential information.
1713   -D : define symbol to have some value:
1714          -D symbol         symbol gets the value 'define'
1715          -D symbol=value   symbol gets the value 'value'
1716        common used examples (see INSTALL for more info):
1717          -Duse64bitint            use 64bit integers
1718          -Duse64bitall            use 64bit integers and pointers
1719          -Dusethreads             use thread support
1720          -Dinc_version_list=none  do not include older perl trees in @INC
1721          -DEBUGGING=none          DEBUGGING options
1722          -Dcc=gcc                 choose your compiler
1723          -Dprefix=/opt/perl5      choose your destination
1724   -E : stop at the end of questions, after having produced config.sh.
1725   -K : do not use unless you know what you are doing.
1726   -O : let -D and -U override definitions from loaded configuration file.
1727   -S : perform variable substitutions on all .SH files (can mix with -f)
1728   -U : undefine symbol:
1729          -U symbol    symbol gets the value 'undef'
1730          -U symbol=   symbol gets completely empty
1731        e.g.:  -Uversiononly
1732   -A : manipulate symbol after the platform specific hints have been applied:
1733          -A append:symbol=value   append value to symbol
1734          -A symbol=value          like append:, but with a separating space
1735          -A define:symbol=value   define symbol to have value
1736          -A clear:symbol          define symbol to be ''
1737          -A define:symbol         define symbol to be 'define'
1738          -A eval:symbol=value     define symbol to be eval of value
1739          -A prepend:symbol=value  prepend value to symbol
1740          -A undef:symbol          define symbol to be 'undef'
1741          -A undef:symbol=         define symbol to be ''
1742        e.g.:  -A prepend:libswanted='cl pthread '
1743               -A ccflags=-DSOME_MACRO
1744   -V : print version number and exit (with a zero status).
1745 EOM
1746         exit 1
1747         ;;
1748 esac
1749
1750 : Sanity checks
1751 case "$fastread$alldone" in
1752 yescont|yesexit) ;;
1753 *)
1754         case "$extractsh" in
1755         true) ;;
1756         *)
1757                 if test ! -t 0; then
1758                         echo "Say 'sh Configure', not 'sh <Configure'"
1759                         exit 1
1760                 fi
1761                 ;;
1762         esac
1763         ;;
1764 esac
1765
1766 exec 4>&1
1767 case "$silent" in
1768 true) exec 1>/dev/null;;
1769 esac
1770
1771 : run the defines and the undefines, if any, but leave the file out there...
1772 touch optdef.sh
1773 . ./optdef.sh
1774 : create the posthint manipulation script and leave the file out there...
1775 touch posthint.sh
1776
1777 : set package name
1778 package='perl5'
1779 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1780 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1781 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1782 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1783 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1784 esac
1785
1786 : Some greps do not return status, grrr.
1787 echo "grimblepritz" >grimble
1788 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1789         contains=contains
1790 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1791         contains=grep
1792 else
1793         contains=contains
1794 fi
1795 rm -f grimble
1796 : the following should work in any shell
1797 case "$contains" in
1798 contains*)
1799         echo " "
1800         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1801         cat >contains <<'EOSS'
1802 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1803 EOSS
1804 chmod +x contains
1805 esac
1806
1807 : Find the path to the source tree
1808 case "$src" in
1809 '') case "$0" in
1810     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1811          case "$src" in
1812          /*)    ;;
1813          .)     ;;
1814          *)     src=`cd ../$src && pwd` ;;
1815          esac
1816          ;;
1817     *)   src='.';;
1818     esac;;
1819 esac
1820 case "$src" in
1821 '')     src=/
1822         rsrc=/
1823         ;;
1824 /*)     rsrc="$src";;
1825 *)      rsrc="../$src";;
1826 esac
1827 if test -f $rsrc/Configure && \
1828         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1829 then
1830    : found it, so we are ok.
1831 else
1832         rsrc=''
1833         for src in . .. ../.. ../../.. ../../../..; do
1834                 if test -f ../$src/Configure && \
1835                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1836                 then
1837                         rsrc=../$src
1838                         break
1839                 fi
1840         done
1841 fi
1842 case "$rsrc" in
1843 '')
1844         cat <<EOM >&4
1845
1846 Sorry, I can't seem to locate the source dir for $package.  Please start
1847 Configure with an explicit path -- i.e. /some/path/Configure.
1848
1849 EOM
1850         exit 1
1851         ;;
1852 ../.)   rsrc='..';;
1853 *)
1854         echo " "
1855         echo "Sources for $package found in \"$src\"." >&4
1856         ;;
1857 esac
1858
1859 : script used to extract .SH files with variable substitutions
1860 cat >extract <<'EOS'
1861 PERL_CONFIG_SH=true
1862 echo "Doing variable substitutions on .SH files..."
1863 if test -f MANIFEST; then
1864         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1865 else
1866         echo "(Looking for .SH files under the source directory.)"
1867         set x `(cd "$src"; find . -name "*.SH" -print)`
1868 fi
1869 shift
1870 case $# in
1871 0) set x `(cd "$src"; echo *.SH)`; shift;;
1872 esac
1873 if test ! -f "$src/$1"; then
1874         shift
1875 fi
1876 mkdir_p='
1877 name=$1;
1878 create="";
1879 while test $name; do
1880         if test ! -d "$name"; then
1881                 create="$name $create";
1882                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1883                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1884         else
1885                 name="";
1886         fi;
1887 done;
1888 for file in $create; do
1889         mkdir $file;
1890 done
1891 '
1892 for file in $*; do
1893         case "$src" in
1894         ".")
1895                 case "$file" in
1896                 */*)
1897                         dir=`expr X$file : 'X\(.*\)/'`
1898                         file=`expr X$file : 'X.*/\(.*\)'`
1899                         (cd "$dir" && . ./$file)
1900                         ;;
1901                 *)
1902                         . ./$file
1903                         ;;
1904                 esac
1905                 ;;
1906         *)
1907                 case "$file" in
1908                 */*)
1909                         dir=`expr X$file : 'X\(.*\)/'`
1910                         file=`expr X$file : 'X.*/\(.*\)'`
1911                         (set x $dir; shift; eval $mkdir_p)
1912                         sh <"$src/$dir/$file"
1913                         ;;
1914                 *)
1915                         sh <"$src/$file"
1916                         ;;
1917                 esac
1918                 ;;
1919         esac
1920 done
1921 if test -f "$src/config_h.SH"; then
1922         if test ! -f config.h; then
1923         : oops, they left it out of MANIFEST, probably, so do it anyway.
1924         . "$src/config_h.SH"
1925         fi
1926 fi
1927 EOS
1928
1929 : extract files and exit if asked to do so
1930 case "$extractsh" in
1931 true)
1932         case "$realsilent" in
1933         true) ;;
1934         *) exec 1>&4;;
1935         esac
1936         case "$config_sh" in
1937         '') config_sh='config.sh';;
1938         esac
1939         echo " "
1940         echo "Fetching answers from $config_sh..."
1941         cd ..
1942         . $config_sh
1943         test "$override" && . ./optdef.sh
1944         echo " "
1945         . UU/extract
1946         rm -rf UU
1947         echo "Extraction done."
1948         exit 0
1949         ;;
1950 esac
1951
1952 : Eunice requires " " instead of "", can you believe it
1953 echo " "
1954 : Here we go...
1955 echo "Beginning of configuration questions for $package."
1956
1957 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1958
1959 : first determine how to suppress newline on echo command
1960 echo " "
1961 echo "Checking echo to see how to suppress newlines..."
1962 (echo "hi there\c" ; echo " ") >.echotmp
1963 if $contains c .echotmp >/dev/null 2>&1 ; then
1964         echo "...using -n."
1965         n='-n'
1966         c=''
1967 else
1968         cat <<'EOM'
1969 ...using \c
1970 EOM
1971         n=''
1972         c='\c'
1973 fi
1974 echo $n "The star should be here-->$c"
1975 echo '*'
1976 rm -f .echotmp
1977
1978 : Now test for existence of everything in MANIFEST
1979 echo " "
1980 if test -f "$rsrc/MANIFEST"; then
1981         echo "First let's make sure your kit is complete.  Checking..." >&4
1982         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1983                 (split -l 50 2>/dev/null || split -50)
1984         rm -f missing
1985         tmppwd=`pwd`
1986         for filelist in x??; do
1987                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1988                         >/dev/null 2>>"$tmppwd/missing")
1989         done
1990         if test -s missing; then
1991                 cat missing >&4
1992                 cat >&4 <<'EOM'
1993
1994 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1995
1996 You have the option of continuing the configuration process, despite the
1997 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1998 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1999 and contact the author (perlbug@perl.org).
2000
2001 EOM
2002                 echo $n "Continue? [n] $c" >&4
2003                 read ans
2004                 case "$ans" in
2005                 y*)
2006                         echo "Continuing..." >&4
2007                         rm -f missing
2008                         ;;
2009                 *)
2010                         echo "ABORTING..." >&4
2011                         kill $$
2012                         ;;
2013                 esac
2014         else
2015                 echo "Looks good..."
2016         fi
2017 else
2018         echo "There is no MANIFEST file.  I hope your kit is complete !"
2019 fi
2020 rm -f missing x??
2021
2022 : Find the appropriate value for a newline for tr
2023 echo " "
2024 if test -n "$DJGPP"; then
2025        trnl='\012'
2026 fi
2027 if test X"$trnl" = X; then
2028         case "`echo foo|tr '\n' x 2>/dev/null`" in
2029         foox) trnl='\n' ;;
2030         esac
2031 fi
2032 if test X"$trnl" = X; then
2033         case "`echo foo|tr '\012' x 2>/dev/null`" in
2034         foox) trnl='\012' ;;
2035         esac
2036 fi
2037 if test X"$trnl" = X; then
2038        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2039        fooxy) trnl='\n\r' ;;
2040        esac
2041 fi
2042 if test X"$trnl" = X; then
2043         cat <<EOM >&2
2044
2045 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2046
2047 EOM
2048         exit 1
2049 fi
2050
2051 : compute the number of columns on the terminal for proper question formatting
2052 case "$COLUMNS" in
2053 '') COLUMNS='80';;
2054 esac
2055
2056 : set up the echo used in my read
2057 myecho="case \"\$xxxm\" in
2058 '') echo $n \"\$rp $c\" >&4;;
2059 *) case \"\$rp\" in
2060         '') echo $n \"[\$xxxm] $c\";;
2061         *)
2062                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2063                         echo \"\$rp\" >&4
2064                         echo $n \"[\$xxxm] $c\" >&4
2065                 else
2066                         echo $n \"\$rp [\$xxxm] $c\" >&4
2067                 fi
2068                 ;;
2069         esac;;
2070 esac"
2071
2072 : now set up to do reads with possible shell escape and default assignment
2073 cat <<EOSC >myread
2074 $startsh
2075 xxxm=\$dflt
2076 $myecho
2077 ans='!'
2078 case "\$fastread" in
2079 yes) case "\$dflt" in
2080         '') ;;
2081         *) ans='';
2082                 case "\$silent-\$rp" in
2083                 true-) ;;
2084                 *) echo " " >&4;;
2085                 esac;;
2086         esac;;
2087 *) case "\$silent" in
2088         true) case "\$rp" in
2089                 '') ans='';;
2090                 esac;;
2091         esac;;
2092 esac
2093 while expr "X\$ans" : "X!" >/dev/null; do
2094         read answ
2095         set x \$xxxm
2096         shift
2097         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2098         case  "\$answ" in
2099         "!")
2100                 sh 1>&4
2101                 echo " "
2102                 $myecho
2103                 ;;
2104         !*)
2105                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2106                 shift
2107                 sh 1>&4 -c "\$*"
2108                 echo " "
2109                 $myecho
2110                 ;;
2111         "\$ans")
2112                 case "\$ans" in
2113                 \\&*)
2114                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2115                         shift
2116                         case "\$1" in
2117                         -d)
2118                                 fastread=yes
2119                                 echo "(OK, I'll run with -d after this question.)" >&4
2120                                 ;;
2121                         -*)
2122                                 echo "*** Sorry, \$1 not supported yet." >&4
2123                                 ;;
2124                         esac
2125                         $myecho
2126                         ans=!
2127                         ;;
2128                 esac;;
2129         *)
2130                 case "\$aok" in
2131                 y)
2132                         echo "*** Substitution done -- please confirm."
2133                         xxxm="\$ans"
2134                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2135                         xxxm="\$ans"
2136                         ans=!
2137                         ;;
2138                 *)
2139                         echo "*** Error -- try again."
2140                         ans=!
2141                         ;;
2142                 esac
2143                 $myecho
2144                 ;;
2145         esac
2146         case "\$ans\$xxxm\$nostick" in
2147         '')
2148                 ans=!
2149                 $myecho
2150                 ;;
2151         esac
2152 done
2153 case "\$ans" in
2154 '') ans="\$xxxm";;
2155 esac
2156 EOSC
2157
2158 : create .config dir to save info across Configure sessions
2159 test -d ../.config || mkdir ../.config
2160 cat >../.config/README <<EOF
2161 This directory created by Configure to save information that should
2162 persist across sessions for $package.
2163
2164 You may safely delete it if you wish.
2165 EOF
2166
2167 : See if we are using a devel version and want that
2168 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2169 case "$usedevel" in
2170 $define|true|[yY]*)
2171     usedevel="$define" ;;
2172 *) case "$xversion" in
2173    *[13579])
2174         cat >&4 <<EOH
2175 *** WHOA THERE!!! ***
2176
2177     This is an UNSTABLE DEVELOPMENT release.
2178     The version of this $package distribution is $xversion, that is, odd,
2179     (as opposed to even) and that signifies a development release.
2180     If you want a maintenance release, you want an even-numbered version.
2181
2182     Do ***NOT*** install this into production use.
2183     Data corruption and crashes are possible.
2184
2185     It is most seriously suggested that you do not continue any further
2186     unless you want to help in developing and debugging Perl.
2187
2188     If you *still* want to build perl, you can answer 'y' now,
2189     or pass -Dusedevel to Configure.
2190
2191 EOH
2192         rp='Do you really want to continue?'
2193         dflt='n'
2194         . ./myread
2195         case "$ans" in
2196         [yY]) echo >&4 "Okay, continuing."
2197               usedevel="$define" ;;
2198         *) echo >&4 "Okay, bye."
2199            exit 1
2200            ;;
2201         esac
2202         ;;
2203     esac
2204     usedevel="$undef"
2205     ;;
2206 esac
2207 case "$usedevel" in
2208 $define|true|[yY]*)
2209         case "$versiononly" in
2210         '') versiononly="$define" ;;
2211         esac
2212         case "$installusrbinperl" in
2213         '') installusrbinperl="$undef" ;;
2214         esac
2215         ;;
2216 esac
2217
2218 : general instructions
2219 needman=true
2220 firsttime=true
2221 user=`(logname) 2>/dev/null`
2222 case "$user" in
2223 '') user=`whoami 2>&1`;;
2224 esac
2225 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2226         firsttime=false
2227         echo " "
2228         rp='Would you like to see the instructions?'
2229         dflt=n
2230         . ./myread
2231         case "$ans" in
2232         [yY]*) ;;
2233         *) needman=false;;
2234         esac
2235 fi
2236 if $needman; then
2237         cat <<EOH
2238
2239 This installation shell script will examine your system and ask you questions
2240 to determine how the perl5 package should be installed. If you get
2241 stuck on a question, you may use a ! shell escape to start a subshell or
2242 execute a command.  Many of the questions will have default answers in square
2243 brackets; typing carriage return will give you the default.
2244
2245 On some of the questions which ask for file or directory names you are allowed
2246 to use the ~name construct to specify the login directory belonging to "name",
2247 even if you don't have a shell which knows about that.  Questions where this is
2248 allowed will be marked "(~name ok)".
2249
2250 EOH
2251         rp=''
2252         dflt='Type carriage return to continue'
2253         . ./myread
2254         cat <<'EOH'
2255
2256 The prompter used in this script allows you to use shell variables and
2257 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2258 in the default answer, as if the default line was a set of arguments given to a
2259 script shell.  This means you may also use $* to repeat the whole default line,
2260 so you do not have to re-type everything to add something to the default.
2261
2262 Every time there is a substitution, you will have to confirm.  If there is an
2263 error (e.g. an unmatched backtick), the default answer will remain unchanged
2264 and you will be prompted again.
2265
2266 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2267 the questions and use the computed defaults (or the previous answers if there
2268 was already a config.sh file). Type 'Configure -h' for a list of options.
2269 You may also start interactively and then answer '& -d' at any prompt to turn
2270 on the non-interactive behaviour for the remainder of the execution.
2271
2272 EOH
2273         . ./myread
2274         cat <<EOH
2275
2276 Much effort has been expended to ensure that this shell script will run on any
2277 Unix system.  If despite that it blows up on yours, your best bet is to edit
2278 Configure and run it again.  If you can't run Configure for some reason,
2279 you'll have to generate a config.sh file by hand.  Whatever problems you
2280 have, let me (perlbug@perl.org) know how I blew it.
2281
2282 This installation script affects things in two ways:
2283
2284 1) it may do direct variable substitutions on some of the files included
2285    in this kit.
2286 2) it builds a config.h file for inclusion in C programs.  You may edit
2287    any of these files as the need arises after running this script.
2288
2289 If you make a mistake on a question, there is no easy way to back up to it
2290 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2291 files.  Configure will offer to let you do this before it runs the SH files.
2292
2293 EOH
2294         dflt='Type carriage return to continue'
2295         . ./myread
2296         case "$firsttime" in
2297         true) echo $user >>../.config/instruct;;
2298         esac
2299 fi
2300
2301 : find out where common programs are
2302 echo " "
2303 echo "Locating common programs..." >&4
2304 cat <<EOSC >loc
2305 $startsh
2306 case \$# in
2307 0) exit 1;;
2308 esac
2309 thing=\$1
2310 shift
2311 dflt=\$1
2312 shift
2313 for dir in \$*; do
2314         case "\$thing" in
2315         .)
2316         if test -d \$dir/\$thing; then
2317                 echo \$dir
2318                 exit 0
2319         fi
2320         ;;
2321         *)
2322         for thisthing in \$dir/\$thing; do
2323                 : just loop through to pick last item
2324         done
2325         if test -f \$thisthing; then
2326                 echo \$thisthing
2327                 exit 0
2328         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2329                 echo \$thisthing
2330                 exit 0
2331         elif test -f \$dir/\$thing.exe; then
2332                 if test -n "$DJGPP"; then
2333                         echo \$dir/\$thing.exe
2334                 elif test "$eunicefix" != ":"; then
2335                         : on Eunice apparently
2336                         echo \$dir/\$thing
2337                 fi
2338                 exit 0
2339         fi
2340         ;;
2341         esac
2342 done
2343 echo \$dflt
2344 exit 1
2345 EOSC
2346 chmod +x loc
2347 $eunicefix loc
2348 loclist="
2349 awk
2350 cat
2351 chmod
2352 comm
2353 cp
2354 echo
2355 expr
2356 grep
2357 ls
2358 mkdir
2359 rm
2360 sed
2361 sort
2362 touch
2363 tr
2364 uniq
2365 "
2366 trylist="
2367 ar
2368 bison
2369 byacc
2370 cpp
2371 csh
2372 date
2373 egrep
2374 gmake
2375 gzip
2376 less
2377 ln
2378 make
2379 more
2380 nm
2381 nroff
2382 perl
2383 pg
2384 test
2385 uname
2386 zip
2387 "
2388 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2389 pth="$pth /lib /usr/lib"
2390 for file in $loclist; do
2391         eval xxx=\$$file
2392         case "$xxx" in
2393         /*|?:[\\/]*)
2394                 if test -f "$xxx"; then
2395                         : ok
2396                 else
2397                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2398                         xxx=`./loc $file $file $pth`
2399                 fi
2400                 ;;
2401         '') xxx=`./loc $file $file $pth`;;
2402         *) xxx=`./loc $xxx $xxx $pth`;;
2403         esac
2404         eval $file=$xxx$_exe
2405         eval _$file=$xxx
2406         case "$xxx" in
2407         /*)
2408                 echo $file is in $xxx.
2409                 ;;
2410         ?:[\\/]*)
2411                 echo $file is in $xxx.
2412                 ;;
2413         *)
2414                 echo "I don't know where '$file' is, and my life depends on it." >&4
2415                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2416                 exit 1
2417                 ;;
2418         esac
2419 done
2420 echo " "
2421 echo "Don't worry if any of the following aren't found..."
2422 say=offhand
2423 for file in $trylist; do
2424         eval xxx=\$$file
2425         case "$xxx" in
2426         /*|?:[\\/]*)
2427                 if test -f "$xxx"; then
2428                         : ok
2429                 else
2430                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2431                         xxx=`./loc $file $file $pth`
2432                 fi
2433                 ;;
2434         '') xxx=`./loc $file $file $pth`;;
2435         *) xxx=`./loc $xxx $xxx $pth`;;
2436         esac
2437         eval $file=$xxx$_exe
2438         eval _$file=$xxx
2439         case "$xxx" in
2440         /*)
2441                 echo $file is in $xxx.
2442                 ;;
2443         ?:[\\/]*)
2444                 echo $file is in $xxx.
2445                 ;;
2446         *)
2447                 echo "I don't see $file out there, $say."
2448                 say=either
2449                 ;;
2450         esac
2451 done
2452 case "$egrep" in
2453 egrep)
2454         echo "Substituting grep for egrep."
2455         egrep=$grep
2456         _egrep=$grep
2457         ;;
2458 esac
2459 case "$less" in
2460 '')     ;;
2461 *)      if $less -R </dev/null >/dev/null; then
2462                echo "Substituting less -R for less."
2463                less="$less -R"
2464                _less=$less
2465         fi
2466         ;;
2467 esac
2468 case "$ln" in
2469 ln)
2470         echo "Substituting cp for ln."
2471         ln=$cp
2472         _ln=$cp
2473         ;;
2474 esac
2475 case "$make" in
2476 make)
2477         case "$gmake" in
2478         gmake)
2479         echo "I can't find make or gmake, and my life depends on it." >&4
2480         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2481         exit 1
2482         ;;
2483         esac
2484         ;;
2485 esac
2486 case "$gmake" in
2487 gmake)  ;;
2488 *)      # We can't have osname yet.
2489         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2490                 # Assume that gmake, if found, is definitely GNU make
2491                 # and prefer it over the system make.
2492                 echo "Substituting gmake for make."
2493                 make=$gmake
2494                 _make=$gmake
2495         fi
2496         ;;
2497 esac
2498 case "$test" in
2499 test)
2500         echo "Hopefully test is built into your sh."
2501         ;;
2502 *)
2503         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2504                 echo "Using the test built into your sh."
2505                 test=test
2506                 _test=test
2507         fi
2508         ;;
2509 esac
2510 case "$echo" in
2511 echo)
2512         echo "Hopefully echo is built into your sh."
2513         ;;
2514 '') ;;
2515 *)
2516         echo " "
2517 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2518         $echo $n "hi there$c" >foo1
2519         echo $n "hi there$c" >foo2
2520         if cmp foo1 foo2 >/dev/null 2>&1; then
2521                 echo "They are compatible.  In fact, they may be identical."
2522         else
2523                 case "$n" in
2524                 '-n') n='' c='\c';;
2525                 *) n='-n' c='';;
2526                 esac
2527                 cat <<FOO
2528 They are not compatible!  You are probably running ksh on a non-USG system.
2529 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2530 have echo built in and we may have to run some Bourne shell scripts.  That
2531 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2532
2533 FOO
2534                 $echo $n "The star should be here-->$c"
2535                 $echo "*"
2536         fi
2537         $rm -f foo1 foo2
2538         ;;
2539 esac
2540
2541 # This question was auctioned at YAPC::Europe-2007 in Vienna
2542 # I never promised you could answer it. I only auctioned the question.
2543 cat <<FOO
2544 The following message is sponsored by
2545
2546   Dresden.pm<--The stars should be here.
2547
2548 Dear Perl user, system administrator or package
2549 maintainer, the Perl community sends greetings to
2550 you. Do you (emblematical) greet back [Y/n]? n
2551
2552 FOO
2553
2554 : Check what type of C compiler we use
2555 cat <<EOS >trygcc
2556 $startsh
2557 EOS
2558 cat <<'EOSC' >>trygcc
2559 case "$cc" in
2560 '') ;;
2561 *)  $rm -f try try.*
2562     $cat >try.c <<EOM
2563 int main(int argc, char *argv[]) {
2564   return 0;
2565 }
2566 EOM
2567     if $cc -o try $ccflags $ldflags try.c; then
2568        :
2569     else
2570         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2571         despair=yes
2572         trygcc=yes
2573         case "$cc" in
2574         *gcc*) trygcc=no ;;
2575         esac
2576         # Skip this test because it gives a false match on output like:
2577         #    ./trygcc: line 23: cc: command not found
2578         # case "`$cc -v -c try.c 2>&1`" in
2579         # *gcc*) trygcc=no ;;
2580         # esac
2581         if $test X"$trygcc" = Xyes; then
2582             if gcc -o try -c try.c; then
2583                 echo " "
2584                 echo "You seem to have a working gcc, though." >&4
2585                 # Switching compilers may undo the work of hints files.
2586                 # The most common problem is -D_REENTRANT for threads.
2587                 # This heuristic catches that case, but gets false positives
2588                 # if -Dusethreads was not actually specified.  Better to
2589                 # bail out here with a useful message than fail 
2590                 # mysteriously later. Should we perhaps just try to
2591                 # re-invoke Configure -Dcc=gcc config_args ?
2592                 if $test -f usethreads.cbu; then
2593                         $cat >&4 <<EOM 
2594
2595 *** However, any setting of the C compiler flags (e.g. for thread support)
2596 *** will be lost.  It may be necessary for you to restart Configure and
2597 *** add -Dcc=gcc to your Configure command line.
2598
2599 EOM
2600                         rp="Would you like to go ahead and try gcc anyway?"
2601                         dflt=n
2602                 else
2603                         rp="Would you like to use it?"
2604                         dflt=y
2605                 fi
2606                 if $test -f myread; then
2607                     . ./myread
2608                 else
2609                     if $test -f UU/myread; then
2610                         . ./UU/myread
2611                     else
2612                         echo "Cannot find myread, sorry.  Aborting." >&2
2613                         exit 1
2614                     fi
2615                 fi  
2616                 case "$ans" in
2617                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2618                 esac
2619             fi
2620         fi
2621     fi
2622     $rm -f try try.*
2623     ;;
2624 esac
2625 EOSC
2626
2627 cat <<EOS >checkcc
2628 $startsh
2629 EOS
2630 cat <<'EOSC' >>checkcc
2631 case "$cc" in        
2632 '') ;;
2633 *)  $rm -f try try.*              
2634     $cat >try.c <<EOM
2635 int main(int argc, char *argv[]) {
2636   return 0;
2637 }
2638 EOM
2639     if $cc -o try $ccflags $ldflags try.c; then
2640        :
2641     else
2642         if $test X"$despair" = Xyes; then
2643            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2644         fi
2645         $cat >&4 <<EOM         
2646 You need to find a working C compiler.
2647 Either (purchase and) install the C compiler supplied by your OS vendor,
2648 or for a free C compiler try http://gcc.gnu.org/
2649 I cannot continue any further, aborting.
2650 EOM
2651         exit 1
2652     fi
2653     $rm -f try try.*
2654     ;;
2655 esac
2656 EOSC
2657
2658 : determine whether symbolic links are supported
2659 echo " "
2660 $touch blurfl
2661 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2662         echo "Symbolic links are supported." >&4
2663         lns="$ln -s"
2664 else
2665         echo "Symbolic links are NOT supported." >&4
2666         lns="$ln"
2667 fi
2668 $rm -f blurfl sym
2669
2670 : determine whether symbolic links are supported
2671 echo " "
2672 case "$lns" in
2673 *"ln"*" -s")
2674         echo "Checking how to test for symbolic links..." >&4
2675         $lns blurfl sym
2676         if $test "X$issymlink" = X; then
2677                 case "$newsh" in
2678                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2679                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2680                 esac
2681                 if test $? = 0; then
2682                         issymlink="test -h"
2683                 else
2684                         echo "Your builtin 'test -h' may be broken." >&4
2685                         case "$test" in
2686                         /*)     ;;
2687                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2688                                 for p in $pth
2689                                 do
2690                                         if test -f "$p/$test"; then
2691                                                 test="$p/$test"
2692                                                 break
2693                                         fi
2694                                 done
2695                                 ;;
2696                         esac
2697                         case "$test" in
2698                         /*)
2699                                 echo "Trying external '$test -h'." >&4
2700                                 issymlink="$test -h"
2701                                 if $test ! -h sym >/dev/null 2>&1; then
2702                                         echo "External '$test -h' is broken, too." >&4
2703                                         issymlink=''
2704                                 fi
2705                                 ;;
2706                         *)      issymlink='' ;;
2707                         esac
2708                 fi              
2709         fi
2710         if $test "X$issymlink" = X; then
2711                 if $test -L sym 2>/dev/null; then
2712                         issymlink="$test -L"
2713                         echo "The builtin '$test -L' worked." >&4
2714                 fi
2715         fi
2716         if $test "X$issymlink" != X; then
2717                 echo "You can test for symbolic links with '$issymlink'." >&4
2718         else
2719                 echo "I do not know how you can test for symbolic links." >&4
2720         fi
2721         $rm -f blurfl sym
2722         ;;
2723 *)      echo "No symbolic links, so not testing for their testing..." >&4
2724         ;;
2725 esac
2726 echo " "
2727
2728 : Make symlinks util
2729 case "$mksymlinks" in
2730 $define|true|[yY]*)
2731         case "$src" in
2732         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2733                 exit 1
2734                 ;;
2735         *)      case "$lns:$issymlink" in
2736                 *"ln"*" -s:"*"test -"?)
2737                         echo "Creating the symbolic links..." >&4
2738                         echo "(First creating the subdirectories...)" >&4
2739                         cd ..
2740                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2741                                 read directory
2742                                 test -z "$directory" && break
2743                                 mkdir -p $directory
2744                         done
2745                         # Sanity check 1.
2746                         if test ! -d t/base; then
2747                                 echo "Failed to create the subdirectories.  Aborting." >&4
2748                                 exit 1
2749                         fi
2750                         echo "(Then creating the symlinks...)" >&4
2751                         awk '{print $1}' $src/MANIFEST | while true; do
2752                                 read filename
2753                                 test -z "$filename" && break
2754                                 if test -f $filename; then
2755                                         if $issymlink $filename; then
2756                                                 rm -f $filename
2757                                         fi
2758                                 fi
2759                                 if test -f $filename; then
2760                                         echo "$filename already exists, not symlinking."
2761                                 else
2762                                         ln -s $src/$filename $filename
2763                                 fi
2764                         done
2765                         # Sanity check 2.
2766                         if test ! -f t/base/lex.t; then
2767                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2768                                 exit 1
2769                         fi
2770                         cd UU
2771                         ;;
2772                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2773                         ;;
2774                 esac
2775                 ;;
2776         esac
2777         ;;
2778 esac
2779
2780 : Check for Cross-Compilation
2781 case "$usecrosscompile" in
2782 $define|true|[yY]*)
2783         $echo "Cross-compiling..."
2784         croak=''
2785         case "$cc" in
2786         *-*-gcc) # A cross-compiling gcc, probably.
2787             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2788             ar=$targetarch-ar
2789             # leave out ld, choosing it is more complex
2790             nm=$targetarch-nm
2791             ranlib=$targetarch-ranlib
2792             $echo 'extern int foo;' > try.c
2793             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2794             shift
2795             if $test $# -gt 0; then
2796                 incpth="$incpth $*"
2797                 incpth="`$echo $incpth|$sed 's/^ //'`"
2798                 echo "Guessing incpth '$incpth'." >&4
2799                 for i in $*; do
2800                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2801                     if $test -d $j; then
2802                         libpth="$libpth $j"
2803                     fi
2804                 done   
2805                 libpth="`$echo $libpth|$sed 's/^ //'`"
2806                 echo "Guessing libpth '$libpth'." >&4
2807             fi
2808             $rm -f try.c
2809             ;;
2810         esac
2811         case "$targetarch" in
2812         '') echo "Targetarch not defined." >&4; croak=y ;;
2813         *)  echo "Using targetarch $targetarch." >&4 ;;
2814         esac
2815         case "$incpth" in
2816         '') echo "Incpth not defined." >&4; croak=y ;;
2817         *)  echo "Using incpth '$incpth'." >&4 ;;
2818         esac
2819         case "$libpth" in
2820         '') echo "Libpth not defined." >&4; croak=y ;;
2821         *)  echo "Using libpth '$libpth'." >&4 ;;
2822         esac
2823         case "$usrinc" in
2824         '') for i in $incpth; do
2825                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2826                     usrinc=$i
2827                     echo "Guessing usrinc $usrinc." >&4
2828                     break
2829                 fi
2830             done
2831             case "$usrinc" in
2832             '') echo "Usrinc not defined." >&4; croak=y ;;
2833             esac
2834             ;;
2835         *)  echo "Using usrinc $usrinc." >&4 ;;
2836         esac
2837         case "$targethost" in
2838         '') echo "Targethost not defined." >&4; croak=y ;;
2839         *)  echo "Using targethost $targethost." >&4
2840         esac
2841         locincpth=' '
2842         loclibpth=' '
2843         case "$croak" in
2844         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2845         esac
2846         case "$src" in
2847         /*) run=$src/Cross/run
2848             targetmkdir=$src/Cross/mkdir
2849             to=$src/Cross/to
2850             from=$src/Cross/from
2851             ;;
2852         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2853             run=$pwd/Cross/run
2854             targetmkdir=$pwd/Cross/mkdir
2855             to=$pwd/Cross/to
2856             from=$pwd/Cross/from
2857             ;;
2858         esac
2859         case "$targetrun" in
2860         '') targetrun=ssh ;;
2861         esac
2862         case "$targetto" in
2863         '') targetto=scp ;;
2864         esac
2865         case "$targetfrom" in
2866         '') targetfrom=scp ;;
2867         esac
2868         run=$run-$targetrun
2869         to=$to-$targetto
2870         from=$from-$targetfrom
2871         case "$targetdir" in
2872         '')  targetdir=/tmp
2873              echo "Guessing targetdir $targetdir." >&4
2874              ;;
2875         esac
2876         case "$targetuser" in
2877         '')  targetuser=root
2878              echo "Guessing targetuser $targetuser." >&4
2879              ;;
2880         esac
2881         case "$targetfrom" in
2882         scp)    q=-q ;;
2883         *)      q='' ;;
2884         esac
2885         case "$targetrun" in
2886         ssh|rsh)
2887             cat >$run <<EOF
2888 #!/bin/sh
2889 case "\$1" in
2890 -cwd)
2891   shift
2892   cwd=\$1
2893   shift
2894   ;;
2895 esac
2896 case "\$cwd" in
2897 '') cwd=$targetdir ;;
2898 esac
2899 exe=\$1
2900 shift
2901 if $test ! -f \$exe.xok; then
2902   $to \$exe
2903   $touch \$exe.xok
2904 fi
2905 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2906 EOF
2907             ;;
2908         *)  echo "Unknown targetrun '$targetrun'" >&4
2909             exit 1
2910             ;;
2911         esac
2912         case "$targetmkdir" in
2913         */Cross/mkdir)
2914             cat >$targetmkdir <<EOF
2915 #!/bin/sh
2916 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2917 EOF
2918             $chmod a+rx $targetmkdir
2919             ;;
2920         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2921             exit 1
2922             ;;
2923         esac
2924         case "$targetto" in
2925         scp|rcp)
2926             cat >$to <<EOF
2927 #!/bin/sh
2928 for f in \$@
2929 do
2930   case "\$f" in
2931   /*)
2932     $targetmkdir \`dirname \$f\`
2933     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2934     ;;
2935   *)
2936     $targetmkdir $targetdir/\`dirname \$f\`
2937     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2938     ;;
2939   esac
2940 done
2941 exit 0
2942 EOF
2943             ;;
2944         cp) cat >$to <<EOF
2945 #!/bin/sh
2946 for f in \$@
2947 do
2948   case "\$f" in
2949   /*)
2950     $mkdir -p $targetdir/\`dirname \$f\`
2951     $cp \$f $targetdir/\$f || exit 1
2952     ;;
2953   *)
2954     $targetmkdir $targetdir/\`dirname \$f\`
2955     $cp \$f $targetdir/\$f || exit 1
2956     ;;
2957   esac
2958 done
2959 exit 0
2960 EOF
2961             ;;
2962         *)  echo "Unknown targetto '$targetto'" >&4
2963             exit 1
2964             ;;
2965         esac
2966         case "$targetfrom" in
2967         scp|rcp)
2968           cat >$from <<EOF
2969 #!/bin/sh
2970 for f in \$@
2971 do
2972   $rm -f \$f
2973   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2974 done
2975 exit 0
2976 EOF
2977             ;;
2978         cp) cat >$from <<EOF
2979 #!/bin/sh
2980 for f in \$@
2981 do
2982   $rm -f \$f
2983   cp $targetdir/\$f . || exit 1
2984 done
2985 exit 0
2986 EOF
2987             ;;
2988         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2989             exit 1
2990             ;;
2991         esac
2992         if $test ! -f $run; then
2993             echo "Target 'run' script '$run' not found." >&4
2994         else
2995             $chmod a+rx $run
2996         fi
2997         if $test ! -f $to; then
2998             echo "Target 'to' script '$to' not found." >&4
2999         else
3000             $chmod a+rx $to
3001         fi
3002         if $test ! -f $from; then
3003             echo "Target 'from' script '$from' not found." >&4
3004         else
3005             $chmod a+rx $from
3006         fi
3007         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3008             exit 1
3009         fi
3010         cat >&4 <<EOF
3011 Using '$run' for remote execution,
3012 and '$from' and '$to'
3013 for remote file transfer.
3014 EOF
3015         ;;
3016 *)      run=''
3017         to=:
3018         from=:
3019         usecrosscompile='undef'
3020         targetarch=''
3021         ;;
3022 esac
3023
3024 : see whether [:lower:] and [:upper:] are supported character classes
3025 echo " "
3026 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3027 ABYZ)
3028         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3029         up='[:upper:]'
3030         low='[:lower:]'
3031         ;;
3032 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3033         # (0xd9 and 0xe2), therefore that is a nice testing point.
3034         if test "X$up" = X -o "X$low" = X; then
3035             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3036             rs) up='[A-Z]'
3037                 low='[a-z]'
3038                 ;;
3039             esac
3040         fi
3041         if test "X$up" = X -o "X$low" = X; then
3042             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3043             rs) up='A-Z'
3044                 low='a-z'
3045                 ;;
3046             esac
3047         fi
3048         if test "X$up" = X -o "X$low" = X; then
3049             case "`echo RS | od -x 2>/dev/null`" in
3050             *D9E2*|*d9e2*)
3051                 echo "Hey, this might be EBCDIC." >&4
3052                 if test "X$up" = X -o "X$low" = X; then
3053                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3054                     rs) up='[A-IJ-RS-Z]'
3055                         low='[a-ij-rs-z]'
3056                         ;;
3057                     esac
3058                 fi
3059                 if test "X$up" = X -o "X$low" = X; then
3060                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3061                     rs) up='A-IJ-RS-Z'
3062                         low='a-ij-rs-z'
3063                         ;;
3064                     esac
3065                 fi
3066                 ;;
3067             esac
3068         fi
3069 esac
3070 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3071 rs)
3072     echo "Using $up and $low to convert case." >&4
3073     ;;
3074 *)
3075     echo "I don't know how to translate letters from upper to lower case." >&4
3076     echo "Your tr is not acting any way I know of." >&4
3077     exit 1
3078     ;;
3079 esac
3080 : set up the translation script tr, must be called with ./tr of course
3081 cat >tr <<EOSC
3082 $startsh
3083 case "\$1\$2" in
3084 '[A-Z][a-z]') exec $tr '$up' '$low';;
3085 '[a-z][A-Z]') exec $tr '$low' '$up';;
3086 esac
3087 exec $tr "\$@"
3088 EOSC
3089 chmod +x tr
3090 $eunicefix tr
3091
3092 : Try to determine whether config.sh was made on this system
3093 case "$config_sh" in
3094 '')
3095 myuname=`$uname -a 2>/dev/null`
3096 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3097 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3098 # because the A-Z/a-z are not consecutive.
3099 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3100         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3101 newmyuname="$myuname"
3102 dflt=n
3103 case "$knowitall" in
3104 '')
3105         if test -f ../config.sh; then
3106                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3107                         eval "`grep myuname= ../config.sh`"
3108                 fi
3109                 if test "X$myuname" = "X$newmyuname"; then
3110                         dflt=y
3111                 fi
3112         fi
3113         ;;
3114 *) dflt=y;;
3115 esac
3116
3117 : Get old answers from old config file if Configure was run on the
3118 : same system, otherwise use the hints.
3119 hint=default
3120 cd ..
3121 if test -f config.sh; then
3122         echo " "
3123         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3124         . UU/myread
3125         case "$ans" in
3126         n*|N*) echo "OK, I'll ignore it."
3127                 mv config.sh config.sh.old
3128                 myuname="$newmyuname"
3129                 ;;
3130         *)  echo "Fetching default answers from your old config.sh file..." >&4
3131                 tmp_n="$n"
3132                 tmp_c="$c"
3133                 tmp_sh="$sh"
3134                 . ./config.sh
3135                 cp config.sh UU
3136                 n="$tmp_n"
3137                 c="$tmp_c"
3138                 : Older versions did not always set $sh.  Catch re-use of such
3139                 : an old config.sh.
3140                 case "$sh" in
3141                 '') sh="$tmp_sh" ;;
3142                 esac
3143                 hint=previous
3144                 ;;
3145         esac
3146 fi
3147 . ./UU/checkcc
3148 if test ! -f config.sh; then
3149         $cat <<EOM
3150
3151 First time through, eh?  I have some defaults handy for some systems
3152 that need some extra help getting the Configure answers right:
3153
3154 EOM
3155         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3156         dflt=''
3157         : Half the following guesses are probably wrong... If you have better
3158         : tests or hints, please send them to perlbug@perl.org
3159         : The metaconfig authors would also appreciate a copy...
3160         $test -f /irix && osname=irix
3161         $test -f /xenix && osname=sco_xenix
3162         $test -f /dynix && osname=dynix
3163         $test -f /dnix && osname=dnix
3164         $test -f /lynx.os && osname=lynxos
3165         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3166         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3167         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3168         $test -f /bin/mips && /bin/mips && osname=mips
3169         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3170                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3171         $test -d /usr/apollo/bin && osname=apollo
3172         $test -f /etc/saf/_sactab && osname=svr4
3173         $test -d /usr/include/minix && osname=minix
3174         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3175         if $test -d /MachTen -o -d /MachTen_Folder; then
3176                 osname=machten
3177                 if $test -x /sbin/version; then
3178                         osvers=`/sbin/version | $awk '{print $2}' |
3179                         $sed -e 's/[A-Za-z]$//'`
3180                 elif $test -x /usr/etc/version; then
3181                         osvers=`/usr/etc/version | $awk '{print $2}' |
3182                         $sed -e 's/[A-Za-z]$//'`
3183                 else
3184                         osvers="$2.$3"
3185                 fi
3186         fi
3187
3188         $test -f /sys/posix.dll &&
3189                 $test -f /usr/bin/what &&
3190                 set X `/usr/bin/what /sys/posix.dll` &&
3191                 $test "$3" = UWIN &&
3192                 osname=uwin &&
3193                 osvers="$5"
3194
3195         if $test -f $uname; then
3196                 set X $myuname
3197                 shift
3198
3199                 case "$5" in
3200                 fps*) osname=fps ;;
3201                 mips*)
3202                         case "$4" in
3203                         umips) osname=umips ;;
3204                         *) osname=mips ;;
3205                         esac;;
3206                 [23]100) osname=mips ;;
3207                 next*) osname=next ;;
3208                 i386*)
3209                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3210                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3211                                 osname='sco'
3212                                 osvers=$tmp
3213                         elif $test -f /etc/kconfig; then
3214                                 osname=isc
3215                                 if test "$lns" = "$ln -s"; then
3216                                         osvers=4
3217                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3218                                         osvers=3
3219                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3220                                         osvers=2
3221                                 fi
3222                         fi
3223                         tmp=''
3224                         ;;
3225                 pc*)
3226                         if test -n "$DJGPP"; then
3227                                 osname=dos
3228                                 osvers=djgpp
3229                         fi
3230                         ;;
3231                 esac
3232
3233                 case "$1" in
3234                 aix) osname=aix
3235                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3236                         case "$tmp" in
3237                         # oslevel can fail with:
3238                         # oslevel: Unable to acquire lock.
3239                         *not\ found) osvers="$4"."$3" ;;
3240                         '<3240'|'<>3240') osvers=3.2.0 ;;
3241                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3242                         '=3250'|'>3250') osvers=3.2.5 ;;
3243                         *) osvers=$tmp;;
3244                         esac
3245                         ;;
3246                 bsd386) osname=bsd386
3247                         osvers=`$uname -r`
3248                         ;;
3249                 cygwin*) osname=cygwin
3250                         osvers="$3"
3251                         ;;
3252                 *dc.osx) osname=dcosx
3253                         osvers="$3"
3254                         ;;
3255                 dnix) osname=dnix
3256                         osvers="$3"
3257                         ;;
3258                 domainos) osname=apollo
3259                         osvers="$3"
3260                         ;;
3261                 dgux)   osname=dgux
3262                         osvers="$3"
3263                         ;;
3264                 dragonfly) osname=dragonfly
3265                         osvers="$3"
3266                         ;;
3267                 dynixptx*) osname=dynixptx
3268                         osvers=`echo "$4"|sed 's/^v//'`
3269                         ;;
3270                 freebsd) osname=freebsd
3271                         osvers="$3" ;;
3272                 genix)  osname=genix ;;
3273                 gnu)    osname=gnu
3274                         osvers="$3" ;;
3275                 hp*)    osname=hpux
3276                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3277                         ;;
3278                 irix*)  osname=irix
3279                         case "$3" in
3280                         4*) osvers=4 ;;
3281                         5*) osvers=5 ;;
3282                         *)      osvers="$3" ;;
3283                         esac
3284                         ;;
3285                 linux)  osname=linux
3286                         case "$3" in
3287                         *)      osvers="$3" ;;
3288                         esac
3289                         ;;
3290                 MiNT)   osname=mint
3291                         ;;
3292                 netbsd*) osname=netbsd
3293                         osvers="$3"
3294                         ;;
3295                 news-os) osvers="$3"
3296                         case "$3" in
3297                         4*) osname=newsos4 ;;
3298                         *) osname=newsos ;;
3299                         esac
3300                         ;;
3301                 next*) osname=next ;;
3302                 nonstop-ux) osname=nonstopux ;;
3303                 openbsd) osname=openbsd
3304                         osvers="$3"
3305                         ;;
3306                 os2)    osname=os2
3307                         osvers="$4"
3308                         ;;
3309                 POSIX-BC | posix-bc ) osname=posix-bc
3310                         osvers="$3"
3311                         ;;
3312                 powerux | power_ux | powermax_os | powermaxos | \
3313                 powerunix | power_unix) osname=powerux
3314                         osvers="$3"
3315                         ;;
3316                 qnx) osname=qnx
3317                         osvers="$4"
3318                         ;;
3319                 solaris) osname=solaris
3320                         case "$3" in
3321                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3322                         *)      osvers="$3" ;;
3323                         esac
3324                         ;;
3325                 sunos) osname=sunos
3326                         case "$3" in
3327                         5*) osname=solaris
3328                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3329                         *)      osvers="$3" ;;
3330                         esac
3331                         ;;
3332                 titanos) osname=titanos
3333                         case "$3" in
3334                         1*) osvers=1 ;;
3335                         2*) osvers=2 ;;
3336                         3*) osvers=3 ;;
3337                         4*) osvers=4 ;;
3338                         *)      osvers="$3" ;;
3339                         esac
3340                         ;;
3341                 ultrix) osname=ultrix
3342                         osvers="$3"
3343                         ;;
3344                 osf1|mls+)      case "$5" in
3345                                 alpha)
3346                                         osname=dec_osf
3347                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3348                                         case "$osvers" in
3349                                         [1-9].[0-9]*) ;;
3350                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3351                                         esac
3352                                         ;;
3353                         hp*)    osname=hp_osf1  ;;
3354                         mips)   osname=mips_osf1 ;;
3355                         esac
3356                         ;;
3357                 # UnixWare 7.1.2 is known as Open UNIX 8
3358                 openunix|unixware) osname=svr5
3359                         osvers="$4"
3360                         ;;
3361                 uts)    osname=uts
3362                         osvers="$3"
3363                         ;;
3364                 vos) osvers="$3"
3365                         ;;
3366                 $2) case "$osname" in
3367                         *isc*) ;;
3368                         *freebsd*) ;;
3369                         svr*)
3370                                 : svr4.x or possibly later
3371                                 case "svr$3" in
3372                                 ${osname}*)
3373                                         osname=svr$3
3374                                         osvers=$4
3375                                         ;;
3376                                 esac
3377                                 case "$osname" in
3378                                 svr4.0)
3379                                         : Check for ESIX
3380                                         if test -f /stand/boot ; then
3381                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3382                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3383                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3384                                                         if test -n "$isesix"; then
3385                                                                 osname=esix4
3386                                                         fi
3387                                                 fi
3388                                         fi
3389                                         ;;
3390                                 esac
3391                                 ;;
3392                         *)      if test -f /etc/systemid; then
3393                                         osname=sco
3394                                         set `echo $3 | $sed 's/\./ /g'` $4
3395                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3396                                                 osvers=$1.$2.$3
3397                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3398                                                 osvers=$1.$2
3399                                         elif $test -f $src/hints/sco_$1.sh; then
3400                                                 osvers=$1
3401                                         fi
3402                                 else
3403                                         case "$osname" in
3404                                         '') : Still unknown.  Probably a generic Sys V.
3405                                                 osname="sysv"
3406                                                 osvers="$3"
3407                                                 ;;
3408                                         esac
3409                                 fi
3410                                 ;;
3411                         esac
3412                         ;;
3413                 *)      case "$osname" in
3414                         '') : Still unknown.  Probably a generic BSD.
3415                                 osname="$1"
3416                                 osvers="$3"
3417                                 ;;
3418                         esac
3419                         ;;
3420                 esac
3421         else
3422                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3423                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3424                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3425                                 osname=news_os
3426                         fi
3427                         $rm -f UU/kernel.what
3428                 elif test -d c:/. -o -n "$is_os2" ; then
3429                         set X $myuname
3430                         osname=os2
3431                         osvers="$5"
3432                 fi
3433         fi
3434
3435         case "$targetarch" in
3436         '') ;;
3437         *)  hostarch=$osname
3438             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3439             osvers=''
3440             ;;
3441         esac
3442
3443         : Now look for a hint file osname_osvers, unless one has been
3444         : specified already.
3445         case "$hintfile" in
3446         ''|' ')
3447                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3448                 : Also try without trailing minor version numbers.
3449                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3450                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3451                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3452                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3453                 case "$file" in
3454                 '') dflt=none ;;
3455                 *)  case "$osvers" in
3456                         '') dflt=$file
3457                                 ;;
3458                         *)  if $test -f $src/hints/$file.sh ; then
3459                                         dflt=$file
3460                                 elif $test -f $src/hints/$xfile.sh ; then
3461                                         dflt=$xfile
3462                                 elif $test -f $src/hints/$xxfile.sh ; then
3463                                         dflt=$xxfile
3464                                 elif $test -f $src/hints/$xxxfile.sh ; then
3465                                         dflt=$xxxfile
3466                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3467                                         dflt=$xxxxfile
3468                                 elif $test -f "$src/hints/${osname}.sh" ; then
3469                                         dflt="${osname}"
3470                                 else
3471                                         dflt=none
3472                                 fi
3473                                 ;;
3474                         esac
3475                         ;;
3476                 esac
3477                 if $test -f Policy.sh ; then
3478                         case "$dflt" in
3479                         *Policy*) ;;
3480                         none) dflt="Policy" ;;
3481                         *) dflt="Policy $dflt" ;;
3482                         esac
3483                 fi
3484                 ;;
3485         *)
3486                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3487                 ;;
3488         esac
3489
3490         if $test -f Policy.sh ; then
3491                 $cat <<EOM
3492
3493 There's also a Policy hint file available, which should make the
3494 site-specific (policy) questions easier to answer.
3495 EOM
3496
3497         fi
3498
3499         $cat <<EOM
3500
3501 You may give one or more space-separated answers, or "none" if appropriate.
3502 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3503 previous run of Configure, you may specify it as well as or instead of
3504 OS-specific hints.  If hints are provided for your OS, you should use them:
3505 although Perl can probably be built without hints on many platforms, using
3506 hints often improve performance and may enable features that Configure can't
3507 set up on its own. If there are no hints that match your OS, specify "none";
3508 DO NOT give a wrong version or a wrong OS.
3509
3510 EOM
3511
3512         rp="Which of these apply, if any?"
3513         . UU/myread
3514         tans=$ans
3515         for file in $tans; do
3516                 if $test X$file = XPolicy -a -f Policy.sh; then
3517                         . Policy.sh
3518                         $cat Policy.sh >> UU/config.sh
3519                 elif $test -f $src/hints/$file.sh; then
3520                         . $src/hints/$file.sh
3521                         $cat $src/hints/$file.sh >> UU/config.sh
3522                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3523                         : nothing
3524                 else
3525                         : Give one chance to correct a possible typo.
3526                         echo "$file.sh does not exist"
3527                         dflt=$file
3528                         rp="hint to use instead?"
3529                         . UU/myread
3530                         for file in $ans; do
3531                                 if $test -f "$src/hints/$file.sh"; then
3532                                         . $src/hints/$file.sh
3533                                         $cat $src/hints/$file.sh >> UU/config.sh
3534                                 elif $test X$ans = X -o X$ans = Xnone ; then
3535                                         : nothing
3536                                 else
3537                                         echo "$file.sh does not exist -- ignored."
3538                                 fi
3539                         done
3540                 fi
3541         done
3542
3543         hint=recommended
3544         : Remember our hint file for later.
3545         if $test -f "$src/hints/$file.sh" ; then
3546                 hintfile="$file"
3547         else
3548                 hintfile=''
3549         fi
3550 fi
3551 cd UU
3552 ;;
3553 *)
3554         echo " "
3555         echo "Fetching default answers from $config_sh..." >&4
3556         tmp_n="$n"
3557         tmp_c="$c"
3558         cd ..
3559         cp $config_sh config.sh 2>/dev/null
3560         chmod +w config.sh
3561         . ./config.sh
3562         cd UU
3563         cp ../config.sh .
3564         n="$tmp_n"
3565         c="$tmp_c"
3566         hint=previous
3567         ;;
3568 esac
3569 test "$override" && . ./optdef.sh
3570
3571 : Restore computed paths
3572 for file in $loclist $trylist; do
3573         eval $file="\$_$file"
3574 done
3575
3576 cat << EOM
3577
3578 Configure uses the operating system name and version to set some defaults.
3579 The default value is probably right if the name rings a bell. Otherwise,
3580 since spelling matters for me, either accept the default or answer "none"
3581 to leave it blank.
3582
3583 EOM
3584 case "$osname" in
3585         ''|' ')
3586                 case "$hintfile" in
3587                 ''|' '|none) dflt=none ;;
3588                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3589                 esac
3590                 ;;
3591         *) dflt="$osname" ;;
3592 esac
3593 rp="Operating system name?"
3594 . ./myread
3595 case "$ans" in
3596 none)  osname='' ;;
3597 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3598 esac
3599 echo " "
3600 case "$osvers" in
3601         ''|' ')
3602                 case "$hintfile" in
3603                 ''|' '|none) dflt=none ;;
3604                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3605                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3606                         case "$dflt" in
3607                         ''|' ') dflt=none ;;
3608                         esac
3609                         ;;
3610                 esac
3611                 ;;
3612         *) dflt="$osvers" ;;
3613 esac
3614 rp="Operating system version?"
3615 . ./myread
3616 case "$ans" in
3617 none)  osvers='' ;;
3618 *) osvers="$ans" ;;
3619 esac
3620
3621
3622 . ./posthint.sh
3623
3624 : who configured the system
3625 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3626 case "$cf_by" in
3627 "")
3628         cf_by=`(logname) 2>/dev/null`
3629         case "$cf_by" in
3630         "")
3631                 cf_by=`(whoami) 2>/dev/null`
3632                 case "$cf_by" in
3633                 "") cf_by=unknown ;;
3634                 esac ;;
3635         esac ;;
3636 esac
3637
3638 : decide how portable to be.  Allow command line overrides.
3639 case "$d_portable" in
3640 "$undef") ;;
3641 *)      d_portable="$define" ;;
3642 esac
3643
3644 : set up shell script to do ~ expansion
3645 cat >filexp <<EOSS
3646 $startsh
3647 : expand filename
3648 case "\$1" in
3649  \~/*|\~)
3650         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3651         ;;
3652  \~*)
3653         if $test -f /bin/csh; then
3654                 /bin/csh -f -c "glob \$1"
3655                 failed=\$?
3656                 echo ""
3657                 exit \$failed
3658         else
3659                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3660                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3661                 if $test ! -d "\$dir"; then
3662                         me=\`basename \$0\`
3663                         echo "\$me: can't locate home directory for: \$name" >&2
3664                         exit 1
3665                 fi
3666                 case "\$1" in
3667                 */*)
3668                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3669                         ;;
3670                 *)
3671                         echo \$dir
3672                         ;;
3673                 esac
3674         fi
3675         ;;
3676 *)
3677         echo \$1
3678         ;;
3679 esac
3680 EOSS
3681 chmod +x filexp
3682 $eunicefix filexp
3683
3684 : now set up to get a file name
3685 cat <<EOS >getfile
3686 $startsh
3687 EOS
3688 cat <<'EOSC' >>getfile
3689 tilde=''
3690 fullpath=''
3691 already=''
3692 skip=''
3693 none_ok=''
3694 exp_file=''
3695 nopath_ok=''
3696 orig_rp="$rp"
3697 orig_dflt="$dflt"
3698 case "$gfpth" in
3699 '') gfpth='.' ;;
3700 esac
3701
3702 case "$fn" in
3703 *\(*)
3704         : getfile will accept an answer from the comma-separated list
3705         : enclosed in parentheses even if it does not meet other criteria.
3706         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3707         fn=`echo $fn | sed 's/(.*)//'`
3708         ;;
3709 esac
3710
3711 case "$fn" in
3712 *:*)
3713         loc_file=`expr $fn : '.*:\(.*\)'`
3714         fn=`expr $fn : '\(.*\):.*'`
3715         ;;
3716 esac
3717
3718 case "$fn" in
3719 *~*) tilde=true;;
3720 esac
3721 case "$fn" in
3722 */*) fullpath=true;;
3723 esac
3724 case "$fn" in
3725 *+*) skip=true;;
3726 esac
3727 case "$fn" in
3728 *n*) none_ok=true;;
3729 esac
3730 case "$fn" in
3731 *e*) exp_file=true;;
3732 esac
3733 case "$fn" in
3734 *p*) nopath_ok=true;;
3735 esac
3736
3737 case "$fn" in
3738 *f*) type='File';;
3739 *d*) type='Directory';;
3740 *l*) type='Locate';;
3741 esac
3742
3743 what="$type"
3744 case "$what" in
3745 Locate) what='File';;
3746 esac
3747
3748 case "$exp_file" in
3749 '')
3750         case "$d_portable" in
3751         "$define") ;;
3752         *) exp_file=true;;
3753         esac
3754         ;;
3755 esac
3756
3757 cd ..
3758 while test "$type"; do
3759         redo=''
3760         rp="$orig_rp"
3761         dflt="$orig_dflt"
3762         case "$tilde" in
3763         true) rp="$rp (~name ok)";;
3764         esac
3765         . UU/myread
3766         if test -f UU/getfile.ok && \
3767                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3768         then
3769                 value="$ans"
3770                 ansexp="$ans"
3771                 break
3772         fi
3773         case "$ans" in
3774         none)
3775                 value=''
3776                 ansexp=''
3777                 case "$none_ok" in
3778                 true) type='';;
3779                 esac
3780                 ;;
3781         *)
3782                 case "$tilde" in
3783                 '') value="$ans"
3784                         ansexp="$ans";;
3785                 *)
3786                         value=`UU/filexp $ans`
3787                         case $? in
3788                         0)
3789                                 if test "$ans" != "$value"; then
3790                                         echo "(That expands to $value on this system.)"
3791                                 fi
3792                                 ;;
3793                         *) value="$ans";;
3794                         esac
3795                         ansexp="$value"
3796                         case "$exp_file" in
3797                         '') value="$ans";;
3798                         esac
3799                         ;;
3800                 esac
3801                 case "$fullpath" in
3802                 true)
3803                         case "$ansexp" in
3804                         /*) value="$ansexp" ;;
3805                         [a-zA-Z]:/*) value="$ansexp" ;;
3806                         *)
3807                                 redo=true
3808                                 case "$already" in
3809                                 true)
3810                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3811                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3812                                         ;;
3813                                 *)
3814                                 echo "Please give a full path name, starting with slash." >&4
3815                                         case "$tilde" in
3816                                         true)
3817                                 echo "Note that using ~name is ok provided it expands well." >&4
3818                                                 already=true
3819                                                 ;;
3820                                         esac
3821                                 esac
3822                                 ;;
3823                         esac
3824                         ;;
3825                 esac
3826                 case "$redo" in
3827                 '')
3828                         case "$type" in
3829                         File)
3830                                 for fp in $gfpth; do
3831                                         if test "X$fp" = X.; then
3832                                             pf="$ansexp"
3833                                         else    
3834                                             pf="$fp/$ansexp"
3835                                         fi
3836                                         if test -f "$pf"; then
3837                                                 type=''
3838                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3839                                         then
3840                                                 echo "($value is not a plain file, but that's ok.)"
3841                                                 type=''
3842                                         fi
3843                                         if test X"$type" = X; then
3844                                             value="$pf"
3845                                             break
3846                                         fi
3847                                 done
3848                                 ;;
3849                         Directory)
3850                                 for fp in $gfpth; do
3851                                         if test "X$fp" = X.; then
3852                                             dir="$ans"
3853                                             direxp="$ansexp"
3854                                         else    
3855                                             dir="$fp/$ansexp"
3856                                             direxp="$fp/$ansexp"
3857                                         fi
3858                                         if test -d "$direxp"; then
3859                                                 type=''
3860                                                 value="$dir"
3861                                                 break
3862                                         fi
3863                                 done
3864                                 ;;
3865                         Locate)
3866                                 if test -d "$ansexp"; then
3867                                         echo "(Looking for $loc_file in directory $value.)"
3868                                         value="$value/$loc_file"
3869                                         ansexp="$ansexp/$loc_file"
3870                                 fi
3871                                 if test -f "$ansexp"; then
3872                                         type=''
3873                                 fi
3874                                 case "$nopath_ok" in
3875                                 true)   case "$value" in
3876                                         */*) ;;
3877                                         *)      echo "Assuming $value will be in people's path."
3878                                                 type=''
3879                                                 ;;
3880                                         esac
3881                                         ;;
3882                                 esac
3883                                 ;;
3884                         esac
3885
3886                         case "$skip" in
3887                         true) type='';
3888                         esac
3889
3890                         case "$type" in
3891                         '') ;;
3892                         *)
3893                                 if test "$fastread" = yes; then
3894                                         dflt=y
3895                                 else
3896                                         dflt=n
3897                                 fi
3898                                 rp="$what $value doesn't exist.  Use that name anyway?"
3899                                 . UU/myread
3900                                 dflt=''
3901                                 case "$ans" in
3902                                 y*) type='';;
3903                                 *) echo " ";;
3904                                 esac
3905                                 ;;
3906                         esac
3907                         ;;
3908                 esac
3909                 ;;
3910         esac
3911 done
3912 cd UU
3913 ans="$value"
3914 rp="$orig_rp"
3915 dflt="$orig_dflt"
3916 rm -f getfile.ok
3917 test "X$gfpthkeep" != Xy && gfpth=""
3918 EOSC
3919
3920 : determine root of directory hierarchy where package will be installed.
3921 case "$prefix" in
3922 '')
3923         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3924         ;;
3925 *?/)
3926         dflt=`echo "$prefix" | sed 's/.$//'`
3927         ;;
3928 *)
3929         dflt="$prefix"
3930         ;;
3931 esac
3932 $cat <<EOM
3933
3934 By default, $package will be installed in $dflt/bin, manual pages
3935 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3936 installation directories. Typically this is something like /usr/local.
3937 If you wish to have binaries under /usr/bin but other parts of the
3938 installation under /usr/local, that's ok: you will be prompted
3939 separately for each of the installation directories, the prefix being
3940 only used to set the defaults.
3941
3942 EOM
3943 fn=d~
3944 rp='Installation prefix to use?'
3945 . ./getfile
3946 oldprefix=''
3947 case "$prefix" in
3948 '') ;;
3949 *)
3950         case "$ans" in
3951         "$prefix") ;;
3952         *) oldprefix="$prefix";;
3953         esac
3954         ;;
3955 esac
3956 prefix="$ans"
3957 prefixexp="$ansexp"
3958
3959 : allow them to override the AFS root
3960 case "$afsroot" in
3961 '')     afsroot=/afs ;;
3962 *)      afsroot=$afsroot ;;
3963 esac
3964
3965 : is AFS running?
3966 echo " "
3967 case "$afs" in
3968 $define|true)   afs=true ;;
3969 $undef|false)   afs=false ;;
3970 *)      if $test -d $afsroot; then
3971                 afs=true
3972         else
3973                 afs=false
3974         fi
3975         ;;
3976 esac
3977 if $afs; then
3978         echo "AFS may be running... I'll be extra cautious then..." >&4
3979 else
3980         echo "AFS does not seem to be running..." >&4
3981 fi
3982
3983 : determine installation prefix for where package is to be installed.
3984 if $afs; then 
3985 $cat <<EOM
3986
3987 Since you are running AFS, I need to distinguish the directory in which
3988 files will reside from the directory in which they are installed (and from
3989 which they are presumably copied to the former directory by occult means).
3990
3991 EOM
3992         case "$installprefix" in
3993         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3994         *) dflt="$installprefix";;
3995         esac
3996 else
3997 $cat <<EOM
3998
3999 In some special cases, particularly when building $package for distribution,
4000 it is convenient to distinguish the directory in which files should be
4001 installed from the directory ($prefix) in which they will
4002 eventually reside.  For most users, these two directories are the same.
4003
4004 EOM
4005         case "$installprefix" in
4006         '') dflt=$prefix ;;
4007         *) dflt=$installprefix;;
4008         esac
4009 fi
4010 fn=d~
4011 rp='What installation prefix should I use for installing files?'
4012 . ./getfile
4013 installprefix="$ans"
4014 installprefixexp="$ansexp"
4015
4016 : Perform the prefixexp/installprefixexp correction if necessary
4017 cat <<EOS >installprefix
4018 $startsh
4019 EOS
4020 cat <<'EOSC' >>installprefix
4021 : Change installation prefix, if necessary.
4022 if $test X"$prefix" != X"$installprefix"; then
4023     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4024 else
4025     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4026 fi
4027 EOSC
4028 chmod +x installprefix
4029 $eunicefix installprefix
4030
4031 : Set variables such as privlib and privlibexp from the output of ./getfile
4032 : performing the prefixexp/installprefixexp correction if necessary.
4033 cat <<EOS >setprefixvar
4034 $startsh
4035 EOS
4036 cat <<'EOSC' >>setprefixvar
4037 eval "${prefixvar}=\"\$ans\""
4038 eval "${prefixvar}exp=\"\$ansexp\""
4039 . ./installprefix
4040 EOSC
4041 chmod +x setprefixvar
4042 $eunicefix setprefixvar
4043
4044 : set up the script used to warn in case of inconsistency
4045 cat <<EOS >whoa
4046 $startsh
4047 EOS
4048 cat <<'EOSC' >>whoa
4049 dflt=y
4050 case "$hint" in
4051     recommended)
4052         case "$hintfile" in
4053         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4054                 ;;
4055         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4056                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4057                 ;;
4058         esac
4059         ;;
4060     *)  echo " "
4061         echo "*** WHOA THERE!!! ***" >&4
4062         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4063         ;;
4064 esac
4065 rp="    Keep the $hint value?"
4066 . ./myread
4067 case "$ans" in
4068 y) td=$was; tu=$was;;
4069 esac
4070 EOSC
4071
4072 : function used to set '$1' to '$val'
4073 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4074 case "$val$was" in
4075 $define$undef) . ./whoa; eval "$var=\$td";;
4076 $undef$define) . ./whoa; eval "$var=\$tu";;
4077 *) eval "$var=$val";;
4078 esac'
4079
4080 : get the patchlevel
4081 echo " "
4082 echo "Getting the current patchlevel..." >&4
4083 if $test -r $rsrc/patchlevel.h;then
4084         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4085         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4086         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4087         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4088         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4089         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4090         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4091 else
4092         revision=0
4093         patchlevel=0
4094         subversion=0
4095         api_revision=0
4096         api_version=0
4097         api_subversion=0
4098         perl_patchlevel=0
4099         $echo "(You do not have patchlevel.h.  Eek.)"
4100 fi
4101 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4102 version_patchlevel_string="version $patchlevel subversion $subversion"
4103 case "$perl_patchlevel" in
4104 0|'') ;;
4105 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4106     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4107     ;;
4108 esac
4109
4110 $echo "(You have $package $version_patchlevel_string.)"
4111
4112 case "$osname" in
4113 dos|vms)
4114         : XXX Should be a Configure test for double-dots in filenames.
4115         version=`echo $revision $patchlevel $subversion | \
4116                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4117         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4118                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4119         ;;
4120 *)
4121         version=`echo $revision $patchlevel $subversion | \
4122                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4123         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4124                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4125         ;;
4126 esac
4127 : Special case the 5.005_xx maintenance series, which used 5.005
4128 : without any subversion label as a subdirectory in $sitelib
4129 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4130         api_versionstring='5.005'
4131 fi
4132
4133 : Do we want threads support and if so, what type
4134 case "$usethreads" in
4135 $define|true|[yY]*)     dflt='y';;
4136 *)     # Catch case where user specified ithreads or 5005threads but
4137        # forgot -Dusethreads (A.D. 4/2002)
4138        case "$useithreads$use5005threads" in
4139        *$define*)       dflt='y';;
4140        *)               dflt='n';;
4141        esac
4142        ;;
4143 esac
4144 cat <<EOM
4145
4146 Perl can be built to take advantage of threads on some systems.
4147 To do so, Configure can be run with -Dusethreads.
4148
4149 Note that Perl built with threading support runs slightly slower
4150 and uses more memory than plain Perl. The current implementation
4151 is believed to be stable, but it is fairly new, and so should be
4152 treated with caution.
4153
4154 If this doesn't make any sense to you, just accept the default '$dflt'.
4155 EOM
4156 rp='Build a threading Perl?'
4157 . ./myread
4158 case "$ans" in
4159 y|Y)    val="$define" ;;
4160 *)      val="$undef" ;;
4161 esac
4162 set usethreads
4163 eval $setvar
4164
4165 if $test $patchlevel -lt 9; then
4166     case "$usethreads" in
4167     $define)
4168         $cat <<EOM
4169
4170 Since release 5.6, Perl has had two different threading implementations,
4171 the newer interpreter-based version (ithreads) with one interpreter per
4172 thread, and the older 5.005 version (5005threads).
4173 The 5005threads version is effectively unmaintained and will probably be
4174 removed in Perl 5.10, so there should be no need to build a Perl using it
4175 unless needed for backwards compatibility with some existing 5.005threads
4176 code.
4177
4178 EOM
4179         : Default to ithreads unless overridden on command line or with
4180         : old config.sh
4181         dflt='y'
4182         case "$use5005threads" in
4183                 $define|true|[yY]*) dflt='n';;
4184         esac
4185         case "$useithreads" in
4186                 $undef|false|[nN]*) dflt='n';;
4187         esac
4188         rp='Use the newer interpreter-based ithreads?'
4189         . ./myread
4190         case "$ans" in
4191         y|Y)    val="$define" ;;
4192         *)      val="$undef" ;;
4193         esac
4194         set useithreads
4195         eval $setvar
4196         : Now set use5005threads to the opposite value.
4197         case "$useithreads" in
4198         $define) val="$undef" ;;
4199         *) val="$define" ;;
4200         esac
4201         set use5005threads
4202         eval $setvar
4203         ;;
4204     *)
4205         useithreads="$undef"
4206         use5005threads="$undef"
4207         ;;
4208     esac
4209
4210     case "$useithreads$use5005threads" in
4211     "$define$define")
4212         $cat >&4 <<EOM
4213
4214 You cannot have both the ithreads and the 5.005 threads enabled
4215 at the same time.  Disabling the 5.005 threads since they are
4216 much less stable than the ithreads.
4217
4218 EOM
4219         use5005threads="$undef"
4220         ;;
4221     esac
4222
4223 else
4224 : perl-5.9.x and later
4225
4226     if test X"$usethreads" = "X$define"; then
4227         case "$use5005threads" in
4228             $define|true|[yY]*)
4229                 $cat >&4 <<EOM
4230
4231 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4232
4233 EOM
4234             ;;
4235         esac
4236     fi
4237
4238     use5005threads="$undef"
4239     useithreads="$usethreads"
4240 fi
4241
4242 case "$d_oldpthreads" in
4243 '')     : Configure tests would be welcome here.  For now, assume undef.
4244         val="$undef" ;;
4245 *)      val="$d_oldpthreads" ;;
4246 esac
4247 set d_oldpthreads
4248 eval $setvar
4249
4250
4251 : Look for a hint-file generated 'call-back-unit'.  If the
4252 : user has specified that a threading perl is to be built,
4253 : we may need to set or change some other defaults.
4254 if $test -f usethreads.cbu; then
4255     echo "Your platform has some specific hints regarding threaded builds, using them..."
4256     . ./usethreads.cbu
4257 else
4258     case "$usethreads" in
4259         "$define"|true|[yY]*)
4260                 $cat <<EOM
4261 (Your platform does not have any specific hints for threaded builds.
4262  Assuming POSIX threads, then.)
4263 EOM
4264         ;;
4265     esac
4266 fi
4267
4268 : Check if multiplicity is required
4269 cat <<EOM
4270
4271 Perl can be built so that multiple Perl interpreters can coexist
4272 within the same Perl executable.
4273 EOM
4274
4275 case "$useithreads" in
4276 $define)
4277         cat <<EOM
4278 This multiple interpreter support is required for interpreter-based threads.
4279 EOM
4280         val="$define"
4281         ;;
4282 *)      case "$usemultiplicity" in
4283         $define|true|[yY]*)     dflt='y';;
4284         *) dflt='n';;
4285         esac
4286         echo " "
4287         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4288         rp='Build Perl for multiplicity?'
4289         . ./myread
4290         case "$ans" in
4291         y|Y)    val="$define" ;;
4292         *)      val="$undef" ;;
4293         esac
4294         ;;
4295 esac
4296 set usemultiplicity
4297 eval $setvar
4298
4299 : Check if morebits is requested
4300 case "$usemorebits" in
4301 "$define"|true|[yY]*)
4302         use64bitint="$define"
4303         uselongdouble="$define"
4304         usemorebits="$define"
4305         ;;
4306 *)      usemorebits="$undef"
4307         ;;
4308 esac
4309
4310 : Determine the C compiler to be used
4311 echo " "
4312 case "$cc" in
4313 '') dflt=cc;;
4314 *) dflt="$cc";;
4315 esac
4316 rp="Use which C compiler?"
4317 . ./myread
4318 cc="$ans"
4319
4320 : See whether they have no cc but they do have gcc
4321 . ./trygcc
4322 if $test -f cc.cbu; then
4323     . ./cc.cbu
4324 fi
4325 . ./checkcc
4326
4327 : make some quick guesses about what we are up against
4328 echo " "
4329 $echo $n "Hmm...  $c"
4330 echo exit 1 >bsd
4331 echo exit 1 >usg
4332 echo exit 1 >v7
4333 echo exit 1 >osf1
4334 echo exit 1 >eunice
4335 echo exit 1 >xenix
4336 echo exit 1 >venix
4337 echo exit 1 >os2
4338 d_bsd="$undef"
4339 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4340 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4341 then
4342         echo "Looks kind of like an OSF/1 system, but we'll see..."
4343         echo exit 0 >osf1
4344 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4345         xxx=`./loc addbib blurfl $pth`
4346         if $test -f $xxx; then
4347         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4348                 echo exit 0 >bsd
4349                 echo exit 0 >usg
4350         else
4351                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4352                         echo "Looks kind of like an extended USG system, but we'll see..."
4353                 else
4354                         echo "Looks kind of like a USG system, but we'll see..."
4355                 fi
4356                 echo exit 0 >usg
4357         fi
4358 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4359         echo "Looks kind of like a BSD system, but we'll see..."
4360         d_bsd="$define"
4361         echo exit 0 >bsd
4362 else
4363         echo "Looks kind of like a Version 7 system, but we'll see..."
4364         echo exit 0 >v7
4365 fi
4366 case "$eunicefix" in
4367 *unixtovms*)
4368         $cat <<'EOI'
4369 There is, however, a strange, musty smell in the air that reminds me of
4370 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4371 EOI
4372         echo exit 0 >eunice
4373         d_eunice="$define"
4374 : it so happens the Eunice I know will not run shell scripts in Unix format
4375         ;;
4376 *)
4377         echo " "
4378         echo "Congratulations.  You aren't running Eunice."
4379         d_eunice="$undef"
4380         ;;
4381 esac
4382 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4383 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4384 : semicolon as a patch separator
4385 case "$p_" in
4386 :) ;;
4387 *)
4388         $cat <<'EOI'
4389 I have the feeling something is not exactly right, however...don't tell me...
4390 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4391 (Or you may be running DOS with DJGPP.)
4392 EOI
4393         echo exit 0 >os2
4394         ;;
4395 esac
4396 if test -f /xenix; then
4397         echo "Actually, this looks more like a XENIX system..."
4398         echo exit 0 >xenix
4399         d_xenix="$define"
4400 else
4401         echo " "
4402         echo "It's not Xenix..."
4403         d_xenix="$undef"
4404 fi
4405 chmod +x xenix
4406 $eunicefix xenix
4407 if test -f /venix; then
4408         echo "Actually, this looks more like a VENIX system..."
4409         echo exit 0 >venix
4410 else
4411         echo " "
4412         if ./xenix; then
4413                 : null
4414         else
4415                 echo "Nor is it Venix..."
4416         fi
4417 fi
4418 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4419 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4420 $rm -f foo
4421
4422 : Check if we are using GNU gcc and what its version is
4423 echo " "
4424 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4425 $cat >try.c <<EOM
4426 #include <stdio.h>
4427 int main() {
4428 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4429 #ifdef __VERSION__
4430         printf("%s\n", __VERSION__);
4431 #else
4432         printf("%s\n", "1");
4433 #endif
4434 #endif
4435         return(0);
4436 }
4437 EOM
4438 if $cc -o try $ccflags $ldflags try.c; then
4439         gccversion=`$run ./try`
4440         case "$gccversion" in
4441         '') echo "You are not using GNU cc." ;;
4442         *)  echo "You are using GNU cc $gccversion."
4443             ccname=gcc
4444             ;;
4445         esac
4446 else
4447         echo " "
4448         echo "*** WHOA THERE!!! ***" >&4
4449         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4450         case "$knowitall" in
4451         '')
4452         echo "    You'd better start hunting for one and let me know about it." >&4
4453                 exit 1
4454                 ;;
4455         esac
4456 fi
4457 $rm -f try try.*
4458 case "$gccversion" in
4459 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4460 esac
4461 case "$gccversion" in
4462 '') gccosandvers='' ;;
4463 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4464    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4465    gccshortvers=''
4466    case "$gccosandvers" in
4467    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4468    $osname$osvers) ;; # looking good
4469    $osname*) cat <<EOM >&4
4470
4471 *** WHOA THERE!!! ***
4472
4473     Your gcc has not been compiled for the exact release of
4474     your operating system ($gccosandvers versus $osname$osvers).
4475
4476     In general it is a good idea to keep gcc synchronized with
4477     the operating system because otherwise serious problems
4478     may ensue when trying to compile software, like Perl.
4479
4480     I'm trying to be optimistic here, though, and will continue.
4481     If later during the configuration and build icky compilation
4482     problems appear (headerfile conflicts being the most common
4483     manifestation), I suggest reinstalling the gcc to match
4484     your operating system release.
4485
4486 EOM
4487       ;;
4488    *) gccosandvers='' ;; # failed to parse, better be silent
4489    esac
4490    ;;
4491 esac
4492 case "$ccname" in
4493 '') ccname="$cc" ;;
4494 esac
4495
4496 # gcc 3.* complain about adding -Idirectories that they already know about,
4497 # so we will take those off from locincpth.
4498 case "$gccversion" in
4499 3*)
4500     echo "main(){}">try.c
4501     for incdir in $locincpth; do
4502        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4503              grep '^c[cp]p*[01]: warning: changing search order '`
4504        if test "X$warn" != X; then
4505            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4506        fi
4507     done
4508     $rm -f try try.*
4509 esac
4510
4511 : What should the include directory be ?
4512 echo " "
4513 $echo $n "Hmm...  $c"
4514 dflt='/usr/include'
4515 incpath=''
4516 mips_type=''
4517 if $test -f /bin/mips && /bin/mips; then
4518         echo "Looks like a MIPS system..."
4519         $cat >usr.c <<'EOCP'
4520 #ifdef SYSTYPE_BSD43
4521 /bsd43
4522 #endif
4523 EOCP
4524         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4525                 dflt='/bsd43/usr/include'
4526                 incpath='/bsd43'
4527                 mips_type='BSD 4.3'
4528         else
4529                 mips_type='System V'
4530         fi
4531         $rm -f usr.c usr.out
4532         echo "and you're compiling with the $mips_type compiler and libraries."
4533         xxx_prompt=y
4534         echo "exit 0" >mips
4535 else
4536         echo "Doesn't look like a MIPS system."
4537         xxx_prompt=n
4538         echo "exit 1" >mips
4539 fi
4540 chmod +x mips
4541 $eunicefix mips
4542 case "$usrinc" in
4543 '') ;;
4544 *) dflt="$usrinc";;
4545 esac
4546 case "$xxx_prompt" in
4547 y)      fn=d/
4548         echo " "
4549         rp='Where are the include files you want to use?'
4550         . ./getfile
4551         usrinc="$ans"
4552         ;;
4553 *)      usrinc="$dflt"
4554         ;;
4555 esac
4556
4557 : see how we invoke the C preprocessor
4558 echo " "
4559 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4560 cat <<'EOT' >testcpp.c
4561 #define ABC abc
4562 #define XYZ xyz
4563 ABC.XYZ
4564 EOT
4565 cd ..
4566 if test ! -f cppstdin; then
4567         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4568                 # AIX cc -E doesn't show the absolute headerfile
4569                 # locations but we'll cheat by using the -M flag.
4570                 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
4571         else
4572                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4573         fi
4574 else
4575         echo "Keeping your $hint cppstdin wrapper."
4576 fi
4577 chmod 755 cppstdin
4578 wrapper=`pwd`/cppstdin
4579 ok='false'
4580 cd UU
4581
4582 if $test "X$cppstdin" != "X" && \
4583         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4584         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4585 then
4586         echo "You used to use $cppstdin $cppminus so we'll use that again."
4587         case "$cpprun" in
4588         '') echo "But let's see if we can live without a wrapper..." ;;
4589         *)
4590                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4591                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4592                 then
4593                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4594                         ok='true'
4595                 else
4596                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4597                 fi
4598                 ;;
4599         esac
4600 else
4601         case "$cppstdin" in
4602         '') ;;
4603         *)
4604                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4605                 ;;
4606         esac
4607 fi
4608
4609 if $ok; then
4610         : nothing
4611 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4612         $cc -E <testcpp.c >testcpp.out 2>&1; \
4613         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4614         echo "Yup, it does."
4615         x_cpp="$cc -E"
4616         x_minus='';
4617 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4618         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4619         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4620         echo "Yup, it does."
4621         x_cpp="$cc -E"
4622         x_minus='-';
4623 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4624         $cc -P <testcpp.c >testcpp.out 2>&1; \
4625         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626         echo "Yipee, that works!"
4627         x_cpp="$cc -P"
4628         x_minus='';
4629 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4630         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632         echo "At long last!"
4633         x_cpp="$cc -P"
4634         x_minus='-';
4635 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4636         $cpp <testcpp.c >testcpp.out 2>&1; \
4637         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638         echo "It works!"
4639         x_cpp="$cpp"
4640         x_minus='';
4641 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4642         $cpp - <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "Hooray, it works!  I was beginning to wonder."
4645         x_cpp="$cpp"
4646         x_minus='-';
4647 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4648         $wrapper <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         x_cpp="$wrapper"
4651         x_minus=''
4652         echo "Eureka!"
4653 else
4654         dflt=''
4655         rp="No dice.  I can't find a C preprocessor.  Name one:"
4656         . ./myread
4657         x_cpp="$ans"
4658         x_minus=''
4659         $x_cpp <testcpp.c >testcpp.out 2>&1
4660         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661                 echo "OK, that will do." >&4
4662         else
4663 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4664                 exit 1
4665         fi
4666 fi
4667
4668 case "$ok" in
4669 false)
4670         cppstdin="$x_cpp"
4671         cppminus="$x_minus"
4672         cpprun="$x_cpp"
4673         cpplast="$x_minus"
4674         set X $x_cpp
4675         shift
4676         case "$1" in
4677         "$cpp")
4678                 echo "Perhaps can we force $cc -E using a wrapper..."
4679                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4680                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4681                 then
4682                         echo "Yup, we can."
4683                         cppstdin="$wrapper"
4684                         cppminus='';
4685                 else
4686                         echo "Nope, we'll have to live without it..."
4687                 fi
4688                 ;;
4689         esac
4690         case "$cpprun" in
4691         "$wrapper")
4692                 cpprun=''
4693                 cpplast=''
4694                 ;;
4695         esac
4696         ;;
4697 esac
4698
4699 case "$cppstdin" in
4700 "$wrapper"|'cppstdin') ;;
4701 *) $rm -f $wrapper;;
4702 esac
4703 $rm -f testcpp.c testcpp.out
4704
4705 : Set private lib path
4706 case "$plibpth" in
4707 '') if ./mips; then
4708                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4709         fi;;
4710 esac
4711 case "$libpth" in
4712 ' ') dlist='';;
4713 '') dlist="$loclibpth $plibpth $glibpth";;
4714 *) dlist="$libpth";;
4715 esac
4716
4717 : Now check and see which directories actually exist, avoiding duplicates
4718 libpth=''
4719 for xxx in $dlist
4720 do
4721     if $test -d $xxx; then
4722                 case " $libpth " in
4723                 *" $xxx "*) ;;
4724                 *) libpth="$libpth $xxx";;
4725                 esac
4726     fi
4727 done
4728 $cat <<'EOM'
4729
4730 Some systems have incompatible or broken versions of libraries.  Among
4731 the directories listed in the question below, please remove any you
4732 know not to be holding relevant libraries, and add any that are needed.
4733 Say "none" for none.
4734
4735 EOM
4736 case "$libpth" in
4737 '') dflt='none';;
4738 *)
4739         set X $libpth
4740         shift
4741         dflt=${1+"$@"}
4742         ;;
4743 esac
4744 rp="Directories to use for library searches?"
4745 . ./myread
4746 case "$ans" in
4747 none) libpth=' ';;
4748 *) libpth="$ans";;
4749 esac
4750
4751 : compute shared library extension
4752 case "$so" in
4753 '')
4754         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4755                 dflt='sl'
4756         else
4757                 dflt='so'
4758         fi
4759         ;;
4760 *) dflt="$so";;
4761 esac
4762 $cat <<EOM
4763
4764 On some systems, shared libraries may be available.  Answer 'none' if
4765 you want to suppress searching of shared libraries for the remainder
4766 of this configuration.
4767
4768 EOM
4769 rp='What is the file extension used for shared libraries?'
4770 . ./myread
4771 so="$ans"
4772
4773 : Define several unixisms.
4774 : Hints files or command line option can be used to override them.
4775 : The convoluted testing is in case hints files set either the old
4776 : or the new name.
4777 case "$_exe" in
4778 '')     case "$exe_ext" in
4779         '')     ;;
4780         *)      _exe="$exe_ext" ;;
4781         esac
4782         ;;
4783 esac
4784 case "$_a" in
4785 '')     case "$lib_ext" in
4786     '') _a='.a';;
4787         *)      _a="$lib_ext" ;;
4788         esac
4789         ;;
4790 esac
4791 case "$_o" in
4792 '') case "$obj_ext" in
4793         '')     _o='.o';;
4794         *)      _o="$obj_ext";;
4795         esac
4796         ;;
4797 esac
4798 case "$p_" in
4799 '') case "$path_sep" in
4800         '')     p_=':';;
4801         *)      p_="$path_sep";;
4802         esac
4803         ;;
4804 esac
4805 exe_ext=$_exe
4806 lib_ext=$_a
4807 obj_ext=$_o
4808 path_sep=$p_
4809
4810 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4811
4812 : Which makefile gets called first.  This is used by make depend.
4813 case "$firstmakefile" in
4814 '') firstmakefile='makefile';;
4815 esac
4816
4817 : Check is we will use socks
4818 case "$usesocks" in
4819 $define|true|[yY]*)     dflt='y';;
4820 *) dflt='n';;
4821 esac
4822 cat <<EOM
4823
4824 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4825 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4826 to use the PerlIO abstraction layer, this will be implicitly selected.
4827
4828 If this doesn't make any sense to you, just accept the default '$dflt'.
4829 EOM
4830 rp='Build Perl for SOCKS?'
4831 . ./myread
4832 case "$ans" in
4833 y|Y)    val="$define" ;;
4834 *)      val="$undef" ;;
4835 esac
4836 set usesocks
4837 eval $setvar
4838
4839 : Check for uselongdouble support
4840 case "$ccflags" in
4841 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4842 esac
4843
4844 case "$uselongdouble" in
4845 $define|true|[yY]*)     dflt='y';;
4846 *) dflt='n';;
4847 esac
4848 cat <<EOM
4849
4850 Perl can be built to take advantage of long doubles which
4851 (if available) may give more accuracy and range for floating point numbers.
4852
4853 If this doesn't make any sense to you, just accept the default '$dflt'.
4854 EOM
4855 rp='Try to use long doubles if available?'
4856 . ./myread
4857 case "$ans" in
4858 y|Y)    val="$define"   ;;
4859 *)      val="$undef"    ;;
4860 esac
4861 set uselongdouble
4862 eval $setvar
4863
4864 case "$uselongdouble" in
4865 true|[yY]*) uselongdouble="$define" ;;
4866 esac
4867
4868 : Look for a hint-file generated 'call-back-unit'.  If the
4869 : user has specified that long doubles should be used,
4870 : we may need to set or change some other defaults.
4871 if $test -f uselongdouble.cbu; then
4872     echo "Your platform has some specific hints regarding long doubles, using them..."
4873     . ./uselongdouble.cbu
4874 else
4875     case "$uselongdouble" in
4876         $define)
4877                 $cat <<EOM
4878 (Your platform does not have any specific hints for long doubles.)
4879 EOM
4880         ;;
4881     esac
4882 fi
4883
4884 : Looking for optional libraries
4885 echo " "
4886 echo "Checking for optional libraries..." >&4
4887 case "$libs" in
4888 ' '|'') dflt='';;
4889 *) dflt="$libs";;
4890 esac
4891 case "$libswanted" in
4892 '') libswanted='c_s';;
4893 esac
4894 case "$usesocks" in
4895 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4896 esac
4897 libsfound=''
4898 libsfiles=''
4899 libsdirs=''
4900 libspath=''
4901 for thisdir in $libpth $xlibpth; do
4902   test -d $thisdir && libspath="$libspath $thisdir"
4903 done
4904 for thislib in $libswanted; do
4905         for thisdir in $libspath; do
4906             xxx=''
4907             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4908                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4909                 $test -f "$xxx" && eval $libscheck
4910                 $test -f "$xxx" && libstyle=shared
4911             fi
4912             if test ! -f "$xxx"; then
4913                 xxx=$thisdir/lib$thislib.$so
4914                 $test -f "$xxx" && eval $libscheck
4915                 $test -f "$xxx" && libstyle=shared
4916             fi
4917             if test ! -f "$xxx"; then
4918                 xxx=$thisdir/lib$thislib$_a
4919                 $test -f "$xxx" && eval $libscheck
4920                 $test -f "$xxx" && libstyle=static
4921             fi
4922             if test ! -f "$xxx"; then
4923                 xxx=$thisdir/$thislib$_a
4924                 $test -f "$xxx" && eval $libscheck
4925                 $test -f "$xxx" && libstyle=static
4926             fi
4927             if test ! -f "$xxx"; then
4928                 xxx=$thisdir/lib${thislib}_s$_a
4929                 $test -f "$xxx" && eval $libscheck
4930                 $test -f "$xxx" && libstyle=static
4931                 $test -f "$xxx" && thislib=${thislib}_s
4932             fi
4933             if test ! -f "$xxx"; then
4934                 xxx=$thisdir/Slib$thislib$_a
4935                 $test -f "$xxx" && eval $libscheck
4936                 $test -f "$xxx" && libstyle=static
4937             fi
4938             if $test -f "$xxx"; then
4939                 case "$libstyle" in
4940                 shared) echo "Found -l$thislib (shared)." ;;
4941                 static) echo "Found -l$thislib." ;;
4942                 *)      echo "Found -l$thislib ($libstyle)." ;;
4943                 esac
4944                 case " $dflt " in
4945                 *"-l$thislib "*);;
4946                 *) dflt="$dflt -l$thislib"
4947                    libsfound="$libsfound $xxx"
4948                    yyy=`basename $xxx`
4949                    libsfiles="$libsfiles $yyy"
4950                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4951                    case " $libsdirs " in
4952                    *" $yyy "*) ;;
4953                    *) libsdirs="$libsdirs $yyy" ;;
4954                    esac
4955                    ;;
4956                 esac
4957                 break
4958             fi
4959         done
4960         if $test ! -f "$xxx"; then
4961             echo "No -l$thislib."
4962         fi
4963 done
4964 set X $dflt
4965 shift
4966 dflt="$*"
4967 case "$libs" in
4968 '') dflt="$dflt";;
4969 *) dflt="$libs";;
4970 esac
4971 case "$dflt" in
4972 ' '|'') dflt='none';;
4973 esac
4974
4975 $cat <<EOM
4976
4977 In order to compile $package on your machine, a number of libraries
4978 are usually needed.  Include any other special libraries here as well.
4979 Say "none" for none.  The default list is almost always right.
4980 EOM
4981
4982 echo " "
4983 rp="What libraries to use?"
4984 . ./myread
4985 case "$ans" in
4986 none) libs=' ';;
4987 *) libs="$ans";;
4988 esac
4989
4990 : determine optimization, if desired, or use for debug flag also
4991 case "$optimize" in
4992 ' '|$undef) dflt='none';;
4993 '') dflt='-O';;
4994 *) dflt="$optimize";;
4995 esac
4996 $cat <<EOH
4997
4998 By default, $package compiles with the -O flag to use the optimizer.
4999 Alternately, you might want to use the symbolic debugger, which uses
5000 the -g flag (on traditional Unix systems).  Either flag can be
5001 specified here.  To use neither flag, specify the word "none".
5002
5003 EOH
5004 rp="What optimizer/debugger flag should be used?"
5005 . ./myread
5006 optimize="$ans"
5007 case "$optimize" in
5008 'none') optimize=" ";;
5009 esac
5010
5011 : Check what DEBUGGING is required from the command line
5012 : -DEBUGGING      or -DDEBUGGING or
5013 : -DEBUGGING=both                       = -g + -DDEBUGGING
5014 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5015 : -DEBUGGING=none or -UDEBUGGING        =
5016 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5017 case "$EBUGGING" in
5018 '')     ;;
5019 *)      DEBUGGING=$EBUGGING ;;
5020 esac
5021
5022 case "$DEBUGGING" in
5023 -g|both|$define)
5024     case "$optimize" in
5025         *-g*) ;;
5026         *)    optimize="$optimize -g" ;;
5027     esac ;;
5028 none|$undef)
5029     case "$optimize" in
5030         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5031                 shift
5032                 optimize="$*"
5033                 ;;
5034     esac ;;
5035 esac
5036
5037 dflt=''
5038 case "$DEBUGGING" in
5039 both|$define) dflt='-DDEBUGGING'
5040 esac
5041
5042 : argument order is deliberate, as the flag will start with - which set could
5043 : think is an option
5044 checkccflag='check=$1; flag=$2; callback=$3;
5045 echo " ";
5046 echo "Checking if your compiler accepts $flag" 2>&1;
5047 echo "int main(void) { return 0; }" > gcctest.c;
5048 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5049     echo "Yes, it does." 2>&1;
5050     if $test -s gcctest.out ; then
5051         echo "But your platform does not like it:";
5052         cat gcctest.out;
5053     else
5054         case "$ccflags" in
5055         *$check*)
5056             echo "Leaving current flags $ccflags alone." 2>&1
5057             ;;
5058         *) dflt="$dflt $flag";
5059             eval $callback
5060             ;;
5061         esac
5062     fi
5063 else
5064     echo "Nope, it does not, but that is ok." 2>&1;
5065 fi
5066 '
5067
5068 : We will not override a previous value, but we might want to
5069 : augment a hint file
5070 case "$hint" in
5071 default|recommended)
5072         case "$gccversion" in
5073         1*) dflt="$dflt -fpcc-struct-return" ;;
5074         esac
5075         case "$optimize:$DEBUGGING" in
5076         *-g*:old) dflt="$dflt -DDEBUGGING";;
5077         esac
5078         case "$gccversion" in
5079         2*) if $test -d /etc/conf/kconfig.d &&
5080                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5081                 then
5082                         # Interactive Systems (ISC) POSIX mode.
5083                         dflt="$dflt -posix"
5084                 fi
5085                 ;;
5086         esac
5087         case "$gccversion" in
5088         1*) ;;
5089         2.[0-8]*) ;;
5090         ?*)     set strict-aliasing -fno-strict-aliasing
5091                 eval $checkccflag
5092                 ;;
5093         esac
5094         # For gcc, adding -pipe speeds up compilations for some, but apparently
5095         # some assemblers can't read from stdin.  (It also slows down compilations
5096         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5097         case "$gccversion" in
5098         ?*)     set pipe -pipe
5099                 eval $checkccflag
5100                 ;;
5101         esac
5102
5103         # on x86_64 (at least) we require an extra library (libssp) in the
5104         # link command line. This library is not named, so I infer that it is
5105         # an implementation detail that may change. Hence the safest approach
5106         # is to add the flag to the flags passed to the compiler at link time,
5107         # as that way the compiler can do the right implementation dependant
5108         # thing. (NWC)
5109         case "$gccversion" in
5110         ?*)     set stack-protector -fstack-protector
5111                 eval $checkccflag
5112                 ;;
5113         esac
5114         ;;
5115 esac
5116
5117 case "$mips_type" in
5118 *BSD*|'') inclwanted="$locincpth $usrinc";;
5119 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5120 esac
5121 for thisincl in $inclwanted; do
5122         if $test -d $thisincl; then
5123                 if $test x$thisincl != x$usrinc; then
5124                         case "$dflt" in
5125                         *" -I$thisincl "*);;
5126                         *) dflt="$dflt -I$thisincl ";;
5127                         esac
5128                 fi
5129         fi
5130 done
5131
5132 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5133         xxx=true;
5134 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5135         xxx=true;
5136 else
5137         xxx=false;
5138 fi;
5139 if $xxx; then
5140         case "$dflt" in
5141         *$2*);;
5142         *) dflt="$dflt -D$2";;
5143         esac;
5144 fi'
5145
5146 set signal.h LANGUAGE_C; eval $inctest
5147
5148 case "$usesocks" in
5149 $define)
5150         ccflags="$ccflags -DSOCKS"
5151         ;;
5152 esac
5153
5154 case "$hint" in
5155 default|recommended) dflt="$ccflags $dflt" ;;
5156 *) dflt="$ccflags";;
5157 esac
5158
5159 case "$dflt" in
5160 ''|' ') dflt=none;;
5161 esac
5162
5163 $cat <<EOH
5164
5165 Your C compiler may want other flags.  For this question you should include
5166 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5167 but you should NOT include libraries or ld flags like -lwhatever.  If you
5168 want $package to honor its debug switch, you should include -DDEBUGGING here.
5169 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5170
5171 To use no flags, specify the word "none".
5172
5173 EOH
5174 set X $dflt
5175 shift
5176 dflt=${1+"$@"}
5177 rp="Any additional cc flags?"
5178 . ./myread
5179 case "$ans" in
5180 none) ccflags='';;
5181 *) ccflags="$ans";;
5182 esac
5183
5184 : the following weeds options from ccflags that are of no interest to cpp
5185 case "$cppflags" in
5186 '') cppflags="$ccflags" ;;
5187 *)  cppflags="$cppflags $ccflags" ;;
5188 esac
5189 case "$gccversion" in
5190 1*) cppflags="$cppflags -D__GNUC__"
5191 esac
5192 case "$mips_type" in
5193 '');;
5194 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5195 esac
5196 case "$cppflags" in
5197 '');;
5198 *)
5199         echo " "
5200         echo "Let me guess what the preprocessor flags are..." >&4
5201         set X $cppflags
5202         shift
5203         cppflags=''
5204         $cat >cpp.c <<'EOM'
5205 #define BLURFL foo
5206
5207 BLURFL xx LFRULB
5208 EOM
5209         previous=''
5210         for flag in $*
5211         do
5212                 case "$flag" in
5213                 -*) ftry="$flag";;
5214                 *) ftry="$previous $flag";;
5215                 esac
5216                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5217                         >cpp1.out 2>/dev/null && \
5218                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5219                         >cpp2.out 2>/dev/null && \
5220                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5221                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5222                 then
5223                         cppflags="$cppflags $ftry"
5224                         previous=''
5225                 else
5226                         previous="$flag"
5227                 fi
5228         done
5229         set X $cppflags
5230         shift
5231         cppflags=${1+"$@"}
5232         case "$cppflags" in
5233         *-*)  echo "They appear to be: $cppflags";;
5234         esac
5235         $rm -f cpp.c cpp?.out
5236         ;;
5237 esac
5238
5239 : flags used in final linking phase
5240 case "$ldflags" in
5241 '') if ./venix; then
5242                 dflt='-i -z'
5243         else
5244                 dflt=''
5245         fi
5246         case "$ccflags" in
5247         *-posix*) dflt="$dflt -posix" ;;
5248         esac
5249         ;;
5250 *) dflt="$ldflags";;
5251 esac
5252 # See note above about -fstack-protector
5253 case "$ccflags" in
5254 *-fstack-protector*) 
5255         case "$dflt" in
5256         *-fstack-protector*) ;; # Don't add it again
5257         *) dflt="$dflt -fstack-protector" ;; 
5258         esac
5259         ;;
5260 esac
5261
5262 : Try to guess additional flags to pick up local libraries.
5263 for thislibdir in $libpth; do
5264         case " $loclibpth " in
5265         *" $thislibdir "*)
5266                 case "$dflt " in
5267                 *"-L$thislibdir "*) ;;
5268                 *)  dflt="$dflt -L$thislibdir" ;;
5269                 esac
5270                 ;;
5271         esac
5272 done
5273
5274 case "$dflt" in
5275 '') dflt='none' ;;
5276 esac
5277
5278 $cat <<EOH
5279
5280 Your C linker may need flags.  For this question you should
5281 include -L/whatever and any other flags used by the C linker, but you
5282 should NOT include libraries like -lwhatever.
5283
5284 Make sure you include the appropriate -L/path flags if your C linker
5285 does not normally search all of the directories you specified above,
5286 namely
5287         $libpth
5288 To use no flags, specify the word "none".
5289
5290 EOH
5291
5292 rp="Any additional ld flags (NOT including libraries)?"
5293 . ./myread
5294 case "$ans" in
5295 none) ldflags='';;
5296 *) ldflags="$ans";;
5297 esac
5298 rmlist="$rmlist pdp11"
5299
5300 : coherency check
5301 echo " "
5302 echo "Checking your choice of C compiler and flags for coherency..." >&4
5303 $cat > try.c <<'EOF'
5304 #include <stdio.h>
5305 int main() { printf("Ok\n"); return(0); }
5306 EOF
5307 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5308 shift
5309 $cat >try.msg <<'EOM'
5310 I've tried to compile and run the following simple program:
5311
5312 EOM
5313 $cat try.c >> try.msg
5314
5315 $cat >> try.msg <<EOM
5316
5317 I used the command:
5318
5319         $*
5320         $run ./try
5321
5322 and I got the following output:
5323
5324 EOM
5325 dflt=y
5326 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5327         if $sh -c "$run ./try " >>try.msg 2>&1; then
5328                 xxx=`$run ./try`
5329                 case "$xxx" in
5330                 "Ok") dflt=n ;;
5331                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5332                         case " $libs " in
5333                         *" -lsfio "*)
5334                                 cat >> try.msg <<'EOQS'
5335 If $libs contains -lsfio, and sfio is mis-configured, then it
5336 sometimes (apparently) runs and exits with a 0 status, but with no
5337 output!  It may have to do with sfio's use of _exit vs. exit.
5338
5339 EOQS
5340                                 rp="You have a big problem.  Shall I abort Configure"
5341                                 dflt=y
5342                                 ;;
5343                         esac
5344                         ;;
5345                 esac
5346         else
5347                 echo "The program compiled OK, but exited with status $?." >>try.msg
5348                 rp="You have a problem.  Shall I abort Configure"
5349                 dflt=y
5350         fi
5351 else
5352         echo "I can't compile the test program." >>try.msg
5353         rp="You have a BIG problem.  Shall I abort Configure"
5354         dflt=y
5355 fi
5356 case "$dflt" in
5357 y)
5358         $cat try.msg >&4
5359         case "$knowitall" in
5360         '')
5361                 echo "(The supplied flags or libraries might be incorrect.)"
5362                 ;;
5363         *) dflt=n;;
5364         esac
5365         echo " "
5366         . ./myread
5367         case "$ans" in
5368         n*|N*) ;;
5369         *)      echo "Ok.  Stopping Configure." >&4
5370                 exit 1
5371                 ;;
5372         esac
5373         ;;
5374 n) echo "OK, that should do.";;
5375 esac
5376 $rm_try gcctest gcctest.out
5377
5378 : define a shorthand compile call
5379 compile='
5380 mc_file=$1;
5381 shift;
5382 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5383 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5384 exit 1;
5385 fi;
5386 esac;
5387 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5388 : define a shorthand compile call for compilations that should be ok.
5389 compile_ok='
5390 mc_file=$1;
5391 shift;
5392 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5393
5394 : determine filename position in cpp output
5395 echo " "
5396 echo "Computing filename position in cpp output for #include directives..." >&4
5397 case "$osname" in
5398 vos) testaccess=-e ;;
5399 *)   testaccess=-r ;;
5400 esac
5401 echo '#include <stdio.h>' > foo.c
5402 $cat >fieldn <<EOF
5403 $startsh
5404 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5405 $grep '^[       ]*#.*stdio\.h' | \
5406 while read cline; do
5407         pos=1
5408         set \$cline
5409         while $test \$# -gt 0; do
5410                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5411                         echo "\$pos"
5412                         exit 0
5413                 fi
5414                 shift
5415                 pos=\`expr \$pos + 1\`
5416         done
5417 done
5418 EOF
5419 chmod +x fieldn
5420 fieldn=`./fieldn`
5421 $rm -f foo.c fieldn
5422 case $fieldn in
5423 '') pos='???';;
5424 1) pos=first;;
5425 2) pos=second;;
5426 3) pos=third;;
5427 *) pos="${fieldn}th";;
5428 esac
5429 echo "Your cpp writes the filename in the $pos field of the line."
5430
5431 case "$osname" in
5432 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5433 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5434 *)   cppfilter='' ;;
5435 esac
5436 : locate header file
5437 $cat >findhdr <<EOF
5438 $startsh
5439 wanted=\$1
5440 name=''
5441 for usrincdir in $usrinc
5442 do
5443         if test -f \$usrincdir/\$wanted; then
5444                 echo "\$usrincdir/\$wanted"
5445                 exit 0
5446         fi
5447 done
5448 awkprg='{ print \$$fieldn }'
5449 echo "#include <\$wanted>" > foo\$\$.c
5450 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5451 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5452 while read cline; do
5453         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5454         case "\$name" in
5455         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5456         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5457         *) exit 2;;
5458         esac;
5459 done;
5460 #
5461 # status = 0: grep returned 0 lines, case statement not executed
5462 # status = 1: headerfile found
5463 # status = 2: while loop executed, no headerfile found
5464 #
5465 status=\$?
5466 $rm -f foo\$\$.c;
5467 if test \$status -eq 1; then
5468         exit 0;
5469 fi
5470 exit 1
5471 EOF
5472 chmod +x findhdr
5473
5474 : define an alternate in-header-list? function
5475 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5476 cont=true; xxf="echo \"<\$1> found.\" >&4";
5477 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5478 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5479 esac;
5480 case $# in 4) instead=instead;; *) instead="at last";; esac;
5481 while $test "$cont"; do
5482         xxx=`./findhdr $1`
5483         var=$2; eval "was=\$$2";
5484         if $test "$xxx" && $test -r "$xxx";
5485         then eval $xxf;
5486         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5487                 cont="";
5488         else eval $xxnf;
5489         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5490         set $yyy; shift; shift; yyy=$@;
5491         case $# in 0) cont="";;
5492         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5493                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5494         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5495                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5496         esac;
5497 done;
5498 while $test "$yyy";
5499 do set $yyy; var=$2; eval "was=\$$2";
5500         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5501         set $yyy; shift; shift; yyy=$@;
5502 done'
5503
5504 : see if stdlib is available
5505 set stdlib.h i_stdlib
5506 eval $inhdr
5507
5508 : check for lengths of integral types
5509 echo " "
5510 case "$intsize" in
5511 '')
5512         echo "Checking to see how big your integers are..." >&4
5513         $cat >try.c <<EOCP
5514 #include <stdio.h>
5515 #$i_stdlib I_STDLIB
5516 #ifdef I_STDLIB
5517 #include <stdlib.h>
5518 #endif
5519 int main()
5520 {
5521         printf("intsize=%d;\n", (int)sizeof(int));
5522         printf("longsize=%d;\n", (int)sizeof(long));
5523         printf("shortsize=%d;\n", (int)sizeof(short));
5524         exit(0);
5525 }
5526 EOCP
5527         set try
5528         if eval $compile_ok && $run ./try > /dev/null; then
5529                 eval `$run ./try`
5530                 echo "Your integers are $intsize bytes long."
5531                 echo "Your long integers are $longsize bytes long."
5532                 echo "Your short integers are $shortsize bytes long."
5533         else
5534                 $cat >&4 <<EOM
5535 !
5536 Help! I can't compile and run the intsize test program: please enlighten me!
5537 (This is probably a misconfiguration in your system or libraries, and
5538 you really ought to fix it.  Still, I'll try anyway.)
5539 !
5540 EOM
5541                 dflt=4
5542                 rp="What is the size of an integer (in bytes)?"
5543                 . ./myread
5544                 intsize="$ans"
5545                 dflt=$intsize
5546                 rp="What is the size of a long integer (in bytes)?"
5547                 . ./myread
5548                 longsize="$ans"
5549                 dflt=2
5550                 rp="What is the size of a short integer (in bytes)?"
5551                 . ./myread
5552                 shortsize="$ans"
5553         fi
5554         ;;
5555 esac
5556 $rm_try
5557
5558 : check for long long
5559 echo " "
5560 echo "Checking to see if you have long long..." >&4
5561 echo 'int main() { long long x = 7; return 0; }' > try.c
5562 set try
5563 if eval $compile; then
5564         val="$define"
5565         echo "You have long long."
5566 else
5567         val="$undef"
5568         echo "You do not have long long."
5569 fi
5570 $rm_try
5571 set d_longlong
5572 eval $setvar
5573
5574 : check for length of long long
5575 case "${d_longlong}${longlongsize}" in
5576 $define)
5577         echo " "
5578         echo "Checking to see how big your long longs are..." >&4
5579         $cat >try.c <<'EOCP'
5580 #include <stdio.h>
5581 int main()
5582 {
5583     printf("%d\n", (int)sizeof(long long));
5584     return(0);
5585 }
5586 EOCP
5587         set try
5588         if eval $compile_ok; then
5589                 longlongsize=`$run ./try`
5590                 echo "Your long longs are $longlongsize bytes long."
5591         else
5592                 dflt='8'
5593                 echo " "
5594                 echo "(I can't seem to compile the test program.  Guessing...)"
5595                 rp="What is the size of a long long (in bytes)?"
5596                 . ./myread
5597                 longlongsize="$ans"
5598         fi
5599         if $test "X$longsize" = "X$longlongsize"; then
5600                 echo "(That isn't any different from an ordinary long.)"
5601         fi
5602         ;;
5603 esac
5604 $rm_try
5605
5606 : see if inttypes.h is available
5607 : we want a real compile instead of Inhdr because some systems
5608 : have an inttypes.h which includes non-existent headers
5609 echo " "
5610 $cat >try.c <<EOCP
5611 #include <inttypes.h>
5612 int main() {
5613         static int32_t foo32 = 0x12345678;
5614 }
5615 EOCP
5616 set try
5617 if eval $compile; then
5618         echo "<inttypes.h> found." >&4
5619         val="$define"
5620 else
5621         echo "<inttypes.h> NOT found." >&4
5622         val="$undef"
5623 fi
5624 $rm_try
5625 set i_inttypes
5626 eval $setvar
5627
5628 : check for int64_t
5629 echo " "
5630 echo "Checking to see if you have int64_t..." >&4
5631 $cat >try.c <<EOCP
5632 #include <sys/types.h>
5633 #$i_inttypes I_INTTYPES
5634 #ifdef I_INTTYPES
5635 #include <inttypes.h>
5636 #endif
5637 int main() { int64_t x = 7; }
5638 EOCP
5639 set try
5640 if eval $compile; then
5641         val="$define"
5642         echo "You have int64_t."
5643 else
5644         val="$undef"
5645         echo "You do not have int64_t."
5646 fi
5647 $rm_try
5648 set d_int64_t
5649 eval $setvar
5650
5651 : Check if 64bit ints have a quad type
5652 echo " "
5653 echo "Checking which 64-bit integer type we could use..." >&4
5654
5655 case "$intsize" in
5656 8) val=int
5657    set quadtype
5658    eval $setvar
5659    val='"unsigned int"'
5660    set uquadtype
5661    eval $setvar
5662    quadkind=1
5663    ;;
5664 *) case "$longsize" in
5665    8) val=long
5666       set quadtype
5667       eval $setvar
5668       val='"unsigned long"'
5669       set uquadtype
5670       eval $setvar
5671       quadkind=2
5672       ;;
5673    *) case "$d_longlong:$longlongsize" in
5674       define:8)
5675         val='"long long"'
5676         set quadtype
5677         eval $setvar
5678         val='"unsigned long long"'
5679         set uquadtype
5680         eval $setvar
5681         quadkind=3
5682         ;;
5683       *) case "$d_int64_t" in
5684          define)
5685            val=int64_t
5686            set quadtype
5687            eval $setvar
5688            val=uint64_t
5689            set uquadtype
5690            eval $setvar
5691            quadkind=4
5692            ;;
5693          esac
5694          ;;
5695       esac
5696       ;;
5697    esac
5698    ;;
5699 esac
5700
5701 case "$quadtype" in
5702 '')     echo "Alas, no 64-bit integer types in sight." >&4
5703         d_quad="$undef"
5704         ;;
5705 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5706         d_quad="$define"
5707         ;;
5708 esac
5709
5710 : Do we want 64bit support
5711 case "$uselonglong" in
5712 "$define"|true|[yY]*)
5713         cat <<EOM >&4
5714
5715 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5716 EOM
5717         use64bitint="$define"
5718         ;;
5719 esac
5720 case "$use64bits" in
5721 "$define"|true|[yY]*)
5722         cat <<EOM >&4
5723
5724 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5725 EOM
5726         use64bitint="$define"
5727         ;;
5728 esac
5729 case "$use64bitints" in
5730 "$define"|true|[yY]*)
5731         cat <<EOM >&4
5732
5733 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5734 EOM
5735         use64bitint="$define"
5736         ;;
5737 esac
5738 case "$use64bitsint" in
5739 "$define"|true|[yY]*)
5740         cat <<EOM >&4
5741
5742 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5743 EOM
5744         use64bitint="$define"
5745         ;;
5746 esac
5747 case "$uselonglongs" in
5748 "$define"|true|[yY]*)
5749         cat <<EOM >&4
5750
5751 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5752 EOM
5753         use64bitint="$define"
5754         ;;
5755 esac
5756 case "$use64bitsall" in
5757 "$define"|true|[yY]*)
5758         cat <<EOM >&4
5759
5760 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5761 EOM
5762         use64bitall="$define"
5763         ;;
5764 esac
5765
5766 case "$ccflags" in
5767 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5768 esac
5769 case "$use64bitall" in
5770 "$define"|true|[yY]*) use64bitint="$define" ;;
5771 esac
5772
5773 case "$longsize" in
5774 8) cat <<EOM
5775
5776 You have natively 64-bit long integers.
5777 EOM
5778    val="$define"
5779    ;;
5780 *) case "$use64bitint" in
5781    "$define"|true|[yY]*) dflt='y';;
5782    *) dflt='n';;
5783    esac
5784    case "$d_quad" in
5785    "$define") ;;
5786    *) dflt='n' ;;
5787    esac
5788    cat <<EOM
5789
5790 Perl can be built to take advantage of 64-bit integer types
5791 on some systems.  To do so, Configure can be run with -Duse64bitint.
5792 Choosing this option will most probably introduce binary incompatibilities.
5793
5794 If this doesn't make any sense to you, just accept the default '$dflt'.
5795 (The default has been chosen based on your configuration.)
5796 EOM
5797    rp='Try to use 64-bit integers, if available?'
5798    . ./myread
5799    case "$ans" in
5800    [yY]*) val="$define" ;;
5801    *)     val="$undef"  ;;
5802    esac
5803    ;;
5804 esac
5805 set use64bitint
5806 eval $setvar
5807
5808 case "$use64bitall" in
5809 "$define"|true|[yY]*) dflt='y' ;;
5810 *) case "$longsize" in
5811    8) dflt='y' ;;
5812    *) dflt='n' ;;
5813    esac
5814    ;;
5815 esac
5816 cat <<EOM
5817
5818 You may also choose to try maximal 64-bitness.  It means using as much
5819 64-bitness as possible on the platform.  This in turn means even more
5820 binary incompatibilities.  On the other hand, your platform may not
5821 have any more 64-bitness available than what you already have chosen.
5822
5823 If this doesn't make any sense to you, just accept the default '$dflt'.
5824 (The default has been chosen based on your configuration.)
5825 EOM
5826 rp='Try to use maximal 64-bit support, if available?'
5827 . ./myread
5828 case "$ans" in
5829 [yY]*) val="$define" ;;
5830 *)     val="$undef"  ;;
5831 esac
5832 set use64bitall
5833 eval $setvar
5834 case "$use64bitall" in
5835 "$define")
5836         case "$use64bitint" in
5837         "$undef")
5838                 cat <<EOM
5839
5840 Since you have chosen a maximally 64-bit build, I'm also turning on
5841 the use of 64-bit integers.
5842 EOM
5843                 use64bitint="$define" ;;
5844         esac
5845         ;;
5846 esac
5847
5848 : Look for a hint-file generated 'call-back-unit'.  If the
5849 : user has specified that a 64-bit perl is to be built,
5850 : we may need to set or change some other defaults.
5851 if $test -f use64bitint.cbu; then
5852         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5853         . ./use64bitint.cbu
5854 fi
5855 case "$use64bitint" in
5856 "$define"|true|[yY]*)
5857         case "$longsize" in
5858         4) case "$archname64" in
5859            '') archname64=64int ;;
5860            esac
5861            ;;
5862         esac
5863         ;;
5864 esac
5865
5866 : Look for a hint-file generated 'call-back-unit'.  If the
5867 : user has specified that a maximally 64-bit perl is to be built,
5868 : we may need to set or change some other defaults.
5869 if $test -f use64bitall.cbu; then
5870         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5871         . ./use64bitall.cbu
5872 fi
5873 case "$use64bitall" in
5874 "$define"|true|[yY]*)
5875         case "$longsize" in
5876         4) case "$archname64" in
5877            ''|64int) archname64=64all ;;
5878            esac
5879            ;;
5880         esac
5881         ;;
5882 esac
5883
5884 case "$d_quad:$use64bitint" in
5885 $undef:$define)
5886         cat >&4 <<EOF
5887
5888 *** You have chosen to use 64-bit integers,
5889 *** but none can be found.
5890 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5891 *** Cannot continue, aborting.
5892
5893 EOF
5894         exit 1
5895         ;;
5896 esac
5897
5898 : check for length of double
5899 echo " "
5900 case "$doublesize" in
5901 '')
5902         echo "Checking to see how big your double precision numbers are..." >&4
5903         $cat >try.c <<EOCP
5904 #include <stdio.h>
5905 #$i_stdlib I_STDLIB
5906 #ifdef I_STDLIB
5907 #include <stdlib.h>
5908 #endif
5909 int main()
5910 {
5911     printf("%d\n", (int)sizeof(double));
5912     exit(0);
5913 }
5914 EOCP
5915         set try
5916         if eval $compile_ok; then
5917                 doublesize=`$run ./try`
5918                 echo "Your double is $doublesize bytes long."
5919         else
5920                 dflt='8'
5921                 echo "(I can't seem to compile the test program.  Guessing...)"
5922                 rp="What is the size of a double precision number (in bytes)?"
5923                 . ./myread
5924                 doublesize="$ans"
5925         fi
5926         ;;
5927 esac
5928 $rm_try
5929
5930 : check for long doubles
5931 echo " "
5932 echo "Checking to see if you have long double..." >&4
5933 echo 'int main() { long double x = 7.0; }' > try.c
5934 set try
5935 if eval $compile; then
5936         val="$define"
5937         echo "You have long double."
5938 else
5939         val="$undef"
5940         echo "You do not have long double."
5941 fi
5942 $rm_try
5943 set d_longdbl
5944 eval $setvar
5945
5946 : check for length of long double
5947 case "${d_longdbl}${longdblsize}" in
5948 $define)
5949         echo " "
5950         echo "Checking to see how big your long doubles are..." >&4
5951         $cat >try.c <<'EOCP'
5952 #include <stdio.h>
5953 int main()
5954 {
5955         printf("%d\n", sizeof(long double));
5956 }
5957 EOCP
5958         set try
5959         set try
5960         if eval $compile; then
5961                 longdblsize=`$run ./try`
5962                 echo "Your long doubles are $longdblsize bytes long."
5963         else
5964                 dflt='8'
5965                 echo " "
5966                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5967                 rp="What is the size of a long double (in bytes)?"
5968                 . ./myread
5969                 longdblsize="$ans"
5970         fi
5971         if $test "X$doublesize" = "X$longdblsize"; then
5972                 echo "That isn't any different from an ordinary double."
5973                 echo "I'll keep your setting anyway, but you may see some"
5974                 echo "harmless compilation warnings."
5975         fi
5976         ;;
5977 esac
5978 $rm_try
5979
5980 : determine the architecture name
5981 echo " "
5982 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5983         tarch=`arch`"-$osname"
5984 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5985         if uname -m > tmparch 2>&1 ; then
5986                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5987                         -e 's/$/'"-$osname/" tmparch`
5988         else
5989                 tarch="$osname"
5990         fi
5991         $rm -f tmparch
5992 else
5993         tarch="$osname"
5994 fi
5995 case "$myarchname" in
5996 ''|"$tarch") ;;
5997 *)
5998         echo "(Your architecture name used to be $myarchname.)"
5999         archname=''
6000         ;;
6001 esac
6002 case "$targetarch" in
6003 '') ;;
6004 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6005 esac
6006 myarchname="$tarch"
6007 case "$archname" in
6008 '') dflt="$tarch";;
6009 *) dflt="$archname";;
6010 esac
6011 rp='What is your architecture name'
6012 . ./myread
6013 archname="$ans"
6014 case "$usethreads" in
6015 $define)
6016         echo "Threads selected." >&4
6017         case "$archname" in
6018         *-thread*) echo "...and architecture name already has -thread." >&4
6019                 ;;
6020         *)      archname="$archname-thread"
6021                 echo "...setting architecture name to $archname." >&4
6022                 ;;
6023         esac
6024         ;;
6025 esac
6026 case "$usemultiplicity" in
6027 $define)
6028         echo "Multiplicity selected." >&4
6029         case "$archname" in
6030         *-multi*) echo "...and architecture name already has -multi." >&4
6031                 ;;
6032         *)      archname="$archname-multi"
6033                 echo "...setting architecture name to $archname." >&4
6034                 ;;
6035         esac
6036         ;;
6037 esac
6038 case "$use64bitint$use64bitall" in
6039 *"$define"*)
6040         case "$archname64" in
6041         '')
6042                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6043                 ;;
6044         *)
6045                 case "$use64bitint" in
6046                 "$define") echo "64 bit integers selected." >&4 ;;
6047                 esac
6048                 case "$use64bitall" in
6049                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6050                 esac
6051                 case "$archname" in
6052                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6053                         ;;
6054                 *)      archname="$archname-$archname64"
6055                         echo "...setting architecture name to $archname." >&4
6056                         ;;
6057                 esac
6058                 ;;
6059         esac
6060 esac
6061 case "$uselongdouble" in
6062 $define)
6063         echo "Long doubles selected." >&4
6064         case "$longdblsize" in
6065         $doublesize)
6066                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6067                 ;;
6068         *)
6069                 case "$archname" in
6070                 *-ld*) echo "...and architecture name already has -ld." >&4
6071                         ;;
6072                 *)      archname="$archname-ld"
6073                         echo "...setting architecture name to $archname." >&4
6074                         ;;
6075                 esac
6076                 ;;
6077         esac
6078         ;;
6079 esac
6080 if $test -f archname.cbu; then
6081         echo "Your platform has some specific hints for architecture name, using them..."
6082         . ./archname.cbu
6083 fi
6084
6085 : set the prefixit variable, to compute a suitable default value
6086 prefixit='case "$3" in
6087 ""|none)
6088         case "$oldprefix" in
6089         "") eval "$1=\"\$$2\"";;
6090         *)
6091                 case "$3" in
6092                 "") eval "$1=";;
6093                 none)
6094                         eval "tp=\"\$$2\"";
6095                         case "$tp" in
6096                         ""|" ") eval "$1=\"\$$2\"";;
6097                         *) eval "$1=";;
6098                         esac;;
6099                 esac;;
6100         esac;;
6101 *)
6102         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6103         case "$tp" in
6104         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6105         /*-$oldprefix/*|\~*-$oldprefix/*)
6106                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6107         *) eval "$1=\"\$$2\"";;
6108         esac;;
6109 esac'
6110
6111 : determine installation style
6112 : For now, try to deduce it from prefix unless it is already set.
6113 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6114 case "$installstyle" in
6115 '')     case "$prefix" in
6116                 *perl*) dflt='lib';;
6117                 *) dflt='lib/perl5' ;;
6118         esac
6119         ;;
6120 *)      dflt="$installstyle" ;;
6121 esac
6122 : Probably not worth prompting for this since we prompt for all
6123 : the directories individually, and the prompt would be too long and
6124 : confusing anyway.
6125 installstyle=$dflt
6126
6127 : determine where public executables go
6128 echo " "
6129 set dflt bin bin
6130 eval $prefixit
6131 fn=d~
6132 rp='Pathname where the public executables will reside?'
6133 . ./getfile
6134 if $test "X$ansexp" != "X$binexp"; then
6135         installbin=''
6136 fi
6137 prefixvar=bin
6138 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6139 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6140 :     this via initialinstalllocation
6141 . ./setprefixvar
6142
6143 case "$userelocatableinc" in
6144 $define|true|[yY]*)     dflt='y' ;;
6145 *)                      dflt='n' ;;
6146 esac
6147 cat <<EOM
6148
6149 Would you like to build Perl so that the installation is relocatable, so that
6150 library paths in @INC are determined relative to the path of the perl binary?
6151 This is not advised for system Perl installs, or if you need to run setid
6152 scripts or scripts under taint mode.
6153
6154 If this doesn't make any sense to you, just accept the default '$dflt'.
6155 EOM
6156 rp='Use relocatable @INC?'
6157 . ./myread
6158 case "$ans" in
6159 y|Y)    val="$define" ;;
6160 *)      val="$undef"  ;;
6161 esac
6162 set userelocatableinc
6163 eval $setvar
6164
6165 initialinstalllocation="$binexp"
6166 : Default prefix is now "up one level from where the binaries are"
6167 case "$userelocatableinc" in
6168 $define|true|[yY]*)
6169     bin=".../"
6170     binexp=".../"
6171     prefix=".../.."
6172     prefixexp=".../.."
6173     installprefixexp=".../.."
6174     ;;
6175 esac
6176
6177 : determine where private library files go
6178 : Usual default is /usr/local/lib/perl5/$version.
6179 : Also allow things like /opt/perl/lib/$version, since
6180 : /opt/perl/lib/perl5... would be redundant.
6181 : The default "style" setting is made in installstyle.U
6182 case "$installstyle" in
6183 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6184 *)       set dflt privlib lib/$version ;;
6185 esac
6186 eval $prefixit
6187 $cat <<EOM
6188
6189 There are some auxiliary files for $package that need to be put into a
6190 private library directory that is accessible by everyone.
6191
6192 EOM
6193 fn=$binexp
6194 fn=d~+
6195 rp='Pathname where the private library files will reside?'
6196 . ./getfile
6197 prefixvar=privlib
6198 . ./setprefixvar
6199
6200 : set the prefixup variable, to restore leading tilda escape
6201 prefixup='case "$prefixexp" in
6202 "$prefix") ;;
6203 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6204 esac'
6205
6206 : determine where public architecture dependent libraries go
6207 set archlib archlib
6208 eval $prefixit
6209 : privlib default is /usr/local/lib/$package/$version
6210 : archlib default is /usr/local/lib/$package/$version/$archname
6211 : privlib may have an optional trailing /share.
6212 tdflt=`echo $privlib | $sed 's,/share$,,'`
6213 tdflt=$tdflt/$archname
6214 case "$archlib" in
6215 '')     dflt=$tdflt
6216         ;;
6217 *)      dflt="$archlib"
6218     ;;
6219 esac
6220 $cat <<EOM
6221
6222 $spackage contains architecture-dependent library files.  If you are
6223 sharing libraries in a heterogeneous environment, you might store
6224 these files in a separate location.  Otherwise, you can just include
6225 them with the rest of the public library files.
6226
6227 EOM
6228 fn=$binexp
6229 fn=d+~
6230 rp='Where do you want to put the public architecture-dependent libraries?'
6231 . ./getfile
6232 prefixvar=archlib
6233 . ./setprefixvar
6234 if $test X"$archlib" = X"$privlib"; then
6235         d_archlib="$undef"
6236 else
6237         d_archlib="$define"
6238 fi
6239
6240 : see if setuid scripts can be secure
6241 $cat <<EOM
6242
6243 Some kernels have a bug that prevents setuid #! scripts from being
6244 secure.  Some sites have disabled setuid #! scripts because of this.
6245
6246 First let's decide if your kernel supports secure setuid #! scripts.
6247 (If setuid #! scripts would be secure but have been disabled anyway,
6248 don't say that they are secure if asked.)
6249
6250 EOM
6251
6252 val="$undef"
6253 if $test -d /dev/fd; then
6254         echo "#!$ls" >reflect
6255         chmod +x,u+s reflect
6256         ./reflect >flect 2>&1
6257         if $contains "/dev/fd" flect >/dev/null; then
6258                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6259                 val="$define"
6260         else
6261                 $cat <<EOM
6262 If you are not sure if they are secure, I can check but I'll need a
6263 username and password different from the one you are using right now.
6264 If you don't have such a username or don't want me to test, simply
6265 enter 'none'.
6266
6267 EOM
6268                 rp='Other username to test security of setuid scripts with?'
6269                 dflt='none'
6270                 . ./myread
6271                 case "$ans" in
6272                 n|none)
6273                         case "$d_suidsafe" in
6274                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6275                                 dflt=n;;
6276                         "$undef")
6277                                 echo "Well, the $hint value is *not* secure." >&4
6278                                 dflt=n;;
6279                         *)      echo "Well, the $hint value *is* secure." >&4
6280                                 dflt=y;;
6281                         esac
6282                         ;;
6283                 *)
6284                         $rm -f reflect flect
6285                         echo "#!$ls" >reflect
6286                         chmod +x,u+s reflect
6287                         echo >flect
6288                         chmod a+w flect
6289                         echo '"su" will (probably) prompt you for '"$ans's password."
6290                         su $ans -c './reflect >flect'
6291                         if $contains "/dev/fd" flect >/dev/null; then
6292                                 echo "Okay, it looks like setuid scripts are secure." >&4
6293                                 dflt=y
6294                         else
6295                                 echo "I don't think setuid scripts are secure." >&4
6296                                 dflt=n
6297                         fi
6298                         ;;
6299                 esac
6300                 rp='Does your kernel have *secure* setuid scripts?'
6301                 . ./myread
6302                 case "$ans" in
6303                 [yY]*)  val="$define";;
6304                 *)      val="$undef";;
6305                 esac
6306         fi
6307 else
6308         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6309         echo "(That's for file descriptors, not floppy disks.)"
6310         val="$undef"
6311 fi
6312 set d_suidsafe
6313 eval $setvar
6314
6315 $rm -f reflect flect
6316
6317 : now see if they want to do setuid emulation
6318 if $test $patchlevel -lt 11; then
6319 echo " "
6320 val="$undef"
6321 case "$d_suidsafe" in
6322 "$define")
6323         val="$undef"
6324         echo "No need to emulate SUID scripts since they are secure here." >&4
6325         ;;
6326 *)
6327         $cat <<EOM
6328 Some systems have disabled setuid scripts, especially systems where
6329 setuid scripts cannot be secure.  On systems where setuid scripts have
6330 been disabled, the setuid/setgid bits on scripts are currently
6331 useless.  It is possible for $package to detect those bits and emulate
6332 setuid/setgid in a secure fashion.  This emulation will only work if
6333 setuid scripts have been disabled in your kernel.
6334
6335 EOM
6336         case "$d_dosuid" in
6337         "$define") dflt=y ;;
6338         *) dflt=n ;;
6339         esac
6340         rp="Do you want to do setuid/setgid emulation?"
6341         . ./myread
6342         case "$ans" in
6343         [yY]*)  val="$define";;
6344         *)      val="$undef";;
6345         esac
6346         ;;
6347 esac
6348 set d_dosuid
6349 eval $setvar
6350 else
6351     case "$d_dosuid" in
6352         "$define")
6353         cat >&4 <<EOH
6354
6355 SUID emulation has been removed for 5.12
6356 Please re-run Configure without -Dd_dosuid
6357
6358 EOH
6359         exit 1;
6360         ;;
6361     esac
6362     d_dosuid=undef
6363 fi
6364
6365 : Find perl5.005 or later.
6366 echo "Looking for a previously installed perl5.005 or later... "
6367 case "$perl5" in
6368 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6369                 : Check if this perl is recent and can load a simple module
6370                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6371                         perl5=$tdir/perl
6372                         break;
6373                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6374                         perl5=$tdir/perl5
6375                         break;
6376                 fi
6377         done
6378         ;;
6379 *)      perl5="$perl5"
6380         ;;
6381 esac
6382 case "$perl5" in
6383 '')     echo "None found.  That's ok.";;
6384 *)      echo "Using $perl5." ;;
6385 esac
6386
6387 : Set the siteprefix variables
6388 $cat <<EOM
6389
6390 After $package is installed, you may wish to install various
6391 add-on modules and utilities.  Typically, these add-ons will
6392 be installed under $prefix with the rest
6393 of this package.  However, you may wish to install such add-ons
6394 elsewhere under a different prefix.
6395
6396 If you do not wish to put everything under a single prefix, that's
6397 ok.  You will be prompted for the individual locations; this siteprefix
6398 is only used to suggest the defaults.
6399
6400 The default should be fine for most people.
6401
6402 EOM
6403 fn=d~+
6404 rp='Installation prefix to use for add-on modules and utilities?'
6405 : XXX Here might be another good place for an installstyle setting.
6406 case "$siteprefix" in
6407 '') dflt=$prefix ;;
6408 *)  dflt=$siteprefix ;;
6409 esac
6410 . ./getfile
6411 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6412 oldsiteprefix=''
6413 case "$siteprefix" in
6414 '') ;;
6415 *)      case "$ans" in
6416         "$prefix") ;;
6417         *) oldsiteprefix="$prefix";;
6418         esac
6419         ;;
6420 esac
6421 siteprefix="$ans"
6422 siteprefixexp="$ansexp"
6423
6424 : determine where site specific libraries go.
6425 : Usual default is /usr/local/lib/perl5/site_perl/$version
6426 : The default "style" setting is made in installstyle.U
6427 : XXX No longer works with Prefixit stuff.
6428 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6429 case "$sitelib" in
6430 '') case "$installstyle" in
6431         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6432         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6433         esac
6434         ;;
6435 *)      dflt="$sitelib"
6436         ;;
6437 esac
6438 $cat <<EOM
6439
6440 The installation process will create a directory for
6441 site-specific extensions and modules.  Most users find it convenient
6442 to place all site-specific files in this directory rather than in the
6443 main distribution directory.
6444
6445 EOM
6446 fn=d~+
6447 rp='Pathname for the site-specific library files?'
6448 . ./getfile
6449 prefixvar=sitelib
6450 . ./setprefixvar
6451 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6452
6453 : Determine list of previous versions to include in @INC
6454 $cat > getverlist <<EOPL
6455 #!$perl5 -w
6456 use File::Basename;
6457 \$api_versionstring = "$api_versionstring";
6458 \$version = "$version";
6459 \$stem = "$sitelib_stem";
6460 \$archname = "$archname";
6461 EOPL
6462         $cat >> getverlist <<'EOPL'
6463 # The list found is store twice for each entry: the original name, and
6464 # the binary broken down version as pack "sss", so sorting is easy and
6465 # unambiguous. This will work for all versions that have a maximum of
6466 # three digit groups, separate by '.'s or '_'s. Names are extended with
6467 # ".0.0" to ensure at least three elements for the pack.
6468 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6469
6470 # Can't have leading @ because metaconfig interprets it as a command!
6471 ;@inc_version_list=();
6472 # XXX Redo to do opendir/readdir?
6473 if (-d $stem) {
6474     chdir($stem);
6475     ;@candidates = map {
6476         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6477     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6478 }
6479 else {
6480     ;@candidates = ();
6481 }
6482
6483 ($pversion, $aversion, $vsn5005) = map {
6484     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6485 foreach $d (@candidates) {
6486     if ($d->[1] lt $pversion) {
6487         if ($d->[1] ge $aversion) {
6488             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6489         }
6490         elsif ($d->[1] ge $vsn5005) {
6491             unshift(@inc_version_list, grep { -d } $d->[0]);
6492         }
6493     }
6494     else {
6495         # Skip newer version.  I.e. don't look in
6496         # 5.7.0 if we're installing 5.6.1.
6497     }
6498 }
6499
6500 if (@inc_version_list) {
6501     print join(' ', @inc_version_list);
6502 }
6503 else {
6504     # Blank space to preserve value for next Configure run.
6505     print " ";
6506 }
6507 EOPL
6508 chmod +x getverlist
6509 case "$inc_version_list" in
6510 '')     if test -x "$perl5$exe_ext"; then
6511                 dflt=`$perl5 getverlist`
6512         else
6513                 dflt='none'
6514         fi
6515         ;;
6516 $undef) dflt='none' ;;
6517 *)  eval dflt=\"$inc_version_list\" ;;
6518 esac
6519 case "$dflt" in
6520 ''|' ') dflt=none ;;
6521 esac
6522 case "$dflt" in
6523 5.005) dflt=none ;;
6524 esac
6525 $cat <<EOM
6526
6527 In order to ease the process of upgrading, this version of perl
6528 can be configured to use modules built and installed with earlier
6529 versions of perl that were installed under $prefix.  Specify here
6530 the list of earlier versions that this version of perl should check.
6531 If Configure detected no earlier versions of perl installed under
6532 $prefix, then the list will be empty.  Answer 'none' to tell perl
6533 to not search earlier versions.
6534
6535 The default should almost always be sensible, so if you're not sure,
6536 just accept the default.
6537 EOM
6538
6539 rp='List of earlier versions to include in @INC?'
6540 . ./myread
6541 case "$ans" in
6542 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6543 *) inc_version_list="$ans" ;;
6544 esac
6545 case "$inc_version_list" in
6546 ''|' ')
6547         inc_version_list_init='0'
6548         d_inc_version_list="$undef"
6549         ;;
6550 *)      inc_version_list_init=`echo $inc_version_list |
6551                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6552         d_inc_version_list="$define"
6553         ;;
6554 esac
6555 $rm -f getverlist
6556
6557 : see if malloc/malloc.h has to be included
6558 set malloc/malloc.h i_mallocmalloc
6559 eval $inhdr
6560
6561 : see if this is a malloc.h system
6562 : we want a real compile instead of Inhdr because some systems have a
6563 : malloc.h that just gives a compile error saying to use stdlib.h instead
6564 echo " "
6565 $cat >try.c <<EOCP
6566 #include <stdlib.h>
6567 #include <malloc.h>
6568 #$i_mallocmalloc I_MALLOCMALLOC
6569 #ifdef I_MALLOCMALLOC
6570 # include <malloc/malloc.h>
6571 #endif
6572
6573 int main () { return 0; }
6574 EOCP
6575 set try
6576 if eval $compile; then
6577     echo "<malloc.h> found." >&4
6578     val="$define"
6579 else
6580     echo "<malloc.h> NOT found." >&4
6581     val="$undef"
6582 fi
6583 $rm_try
6584 set i_malloc
6585 eval $setvar
6586
6587 : check for void type
6588 echo " "
6589 echo "Checking to see how well your C compiler groks the void type..." >&4
6590 case "$voidflags" in
6591 '')
6592         $cat >try.c <<EOCP
6593 #$i_stdlib I_STDLIB
6594 #ifdef I_STDLIB
6595 #include <stdlib.h>
6596 #endif
6597 #if TRY & 1
6598 void sub() {
6599 #else
6600 sub() {
6601 #endif
6602         extern void moo();      /* function returning void */
6603         void (*goo)();          /* ptr to func returning void */
6604 #if TRY & 8
6605         void *hue;              /* generic ptr */
6606 #endif
6607 #if TRY & 2
6608         void (*foo[10])();
6609 #endif
6610
6611 #if TRY & 4
6612         if(goo == moo) {
6613                 exit(0);
6614         }
6615 #endif
6616         exit(0);
6617 }
6618 int main() { sub(); }
6619 EOCP
6620         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6621                 voidflags=$defvoidused
6622         echo "Good.  It appears to support void to the level $package wants.">&4
6623                 if $contains warning .out >/dev/null 2>&1; then
6624                         echo "However, you might get some warnings that look like this:"
6625                         $cat .out
6626                 fi
6627         else
6628 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6629                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6630                         echo "It supports 1..."
6631                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6632                                 echo "It also supports 2..."
6633                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6634                                         voidflags=7
6635                                         echo "And it supports 4 but not 8 definitely."
6636                                 else
6637                                         echo "It doesn't support 4..."
6638                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6639                                                 voidflags=11
6640                                                 echo "But it supports 8."
6641                                         else
6642                                                 voidflags=3
6643                                                 echo "Neither does it support 8."
6644                                         fi
6645                                 fi
6646                         else
6647                                 echo "It does not support 2..."
6648                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6649                                         voidflags=13
6650                                         echo "But it supports 4 and 8."
6651                                 else
6652                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6653                                                 voidflags=5
6654                                                 echo "And it supports 4 but has not heard about 8."
6655                                         else
6656                                                 echo "However it supports 8 but not 4."
6657                                         fi
6658                                 fi
6659                         fi
6660                 else
6661                         echo "There is no support at all for void."
6662                         voidflags=0
6663                 fi
6664         fi
6665 esac
6666 case "$voidflags" in
6667 "$defvoidused") ;;
6668 *)      $cat >&4 <<'EOM'
6669   Support flag bits are:
6670     1: basic void declarations.
6671     2: arrays of pointers to functions returning void.
6672     4: operations between pointers to and addresses of void functions.
6673     8: generic void pointers.
6674 EOM
6675         dflt="$voidflags";
6676         rp="Your void support flags add up to what?"
6677         . ./myread
6678         voidflags="$ans"
6679         ;;
6680 esac
6681 $rm_try
6682
6683 : check for length of pointer
6684 echo " "
6685 case "$ptrsize" in
6686 '')
6687         echo "Checking to see how big your pointers are..." >&4
6688         if test "$voidflags" -gt 7; then
6689                 echo '#define VOID_PTR char *' > try.c
6690         else
6691                 echo '#define VOID_PTR void *' > try.c
6692         fi
6693         $cat >>try.c <<EOCP
6694 #include <stdio.h>
6695 #$i_stdlib I_STDLIB
6696 #ifdef I_STDLIB
6697 #include <stdlib.h>
6698 #endif
6699 int main()
6700 {
6701     printf("%d\n", (int)sizeof(VOID_PTR));
6702     exit(0);
6703 }
6704 EOCP
6705         set try
6706         if eval $compile_ok; then
6707                 ptrsize=`$run ./try`
6708                 echo "Your pointers are $ptrsize bytes long."
6709         else
6710                 dflt='4'
6711                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6712                 rp="What is the size of a pointer (in bytes)?"
6713                 . ./myread
6714                 ptrsize="$ans"
6715         fi
6716         ;;
6717 esac
6718 $rm_try
6719 case "$use64bitall" in
6720 "$define"|true|[yY]*)
6721         case "$ptrsize" in
6722         4)      cat <<EOM >&4
6723
6724 *** You have chosen a maximally 64-bit build,
6725 *** but your pointers are only 4 bytes wide.
6726 *** Please rerun Configure without -Duse64bitall.
6727 EOM
6728                 case "$d_quad" in
6729                 define)
6730                         cat <<EOM >&4
6731 *** Since you have quads, you could possibly try with -Duse64bitint.
6732 EOM
6733                         ;;
6734                 esac
6735                 cat <<EOM >&4
6736 *** Cannot continue, aborting.
6737
6738 EOM
6739
6740                 exit 1
6741                 ;;
6742         esac
6743         ;;
6744 esac
6745
6746
6747 : determine whether to use malloc wrapping
6748 echo " "
6749 case "$usemallocwrap" in
6750 [yY]*|true|$define)     dflt='y' ;;
6751 [nN]*|false|$undef)     dflt='n' ;;
6752 *)      case "$usedevel" in
6753         [yY]*|true|$define)     dflt='y' ;;
6754         *) dflt='n' ;;
6755         esac
6756         ;;
6757 esac
6758 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6759 . ./myread
6760 usemallocwrap="$ans"
6761 case "$ans" in
6762 y*|true)
6763         usemallocwrap="$define" ;;
6764 *)
6765         usemallocwrap="$undef" ;;
6766 esac
6767
6768 : determine which malloc to compile in
6769 echo " "
6770 case "$usemymalloc" in
6771 [yY]*|true|$define)     dflt='y' ;;
6772 [nN]*|false|$undef)     dflt='n' ;;
6773 *)      case "$ptrsize" in
6774         4) dflt='y' ;;
6775         *) dflt='n' ;;
6776         esac
6777         if test "$useithreads" = "$define"; then dflt='n'; fi
6778         ;;
6779 esac
6780 rp="Do you wish to attempt to use the malloc that comes with $package?"
6781 . ./myread
6782 usemymalloc="$ans"
6783 case "$ans" in
6784 y*|true)
6785         usemymalloc='y'
6786         mallocsrc='malloc.c'
6787         mallocobj="malloc$_o"
6788         d_mymalloc="$define"
6789         case "$libs" in
6790         *-lmalloc*)
6791                 : Remove malloc from list of libraries to use
6792                 echo "Removing unneeded -lmalloc from library list" >&4
6793                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6794                 shift
6795                 libs="$*"
6796                 echo "libs = $libs" >&4
6797                 ;;
6798         esac
6799         ;;
6800 *)
6801         usemymalloc='n'
6802         mallocsrc=''
6803         mallocobj=''
6804         d_mymalloc="$undef"
6805         ;;
6806 esac
6807
6808 : compute the return types of malloc and free
6809 echo " "
6810 $cat >malloc.c <<END
6811 #$i_malloc I_MALLOC
6812 #$i_stdlib I_STDLIB
6813 #include <stdio.h>
6814 #include <sys/types.h>
6815 #ifdef I_MALLOC
6816 #include <malloc.h>
6817 #endif
6818 #ifdef I_STDLIB
6819 #include <stdlib.h>
6820 #endif
6821 #ifdef TRY_MALLOC
6822 void *malloc();
6823 #endif
6824 #ifdef TRY_FREE
6825 void free();
6826 #endif
6827 END
6828 case "$malloctype" in
6829 '')
6830         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6831                 malloctype='void *'
6832         else
6833                 malloctype='char *'
6834         fi
6835         ;;
6836 esac
6837 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6838
6839 case "$freetype" in
6840 '')
6841         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6842                 freetype='void'
6843         else
6844                 freetype='int'
6845         fi
6846         ;;
6847 esac
6848 echo "Your system uses $freetype free(), it would seem." >&4
6849 $rm -f malloc.[co]
6850 : determine where site specific architecture-dependent libraries go.
6851 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6852 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6853 : sitelib may have an optional trailing /share.
6854 case "$sitearch" in
6855 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6856         dflt="$dflt/$archname"
6857         ;;
6858 *)      dflt="$sitearch"
6859         ;;
6860 esac
6861 set sitearch sitearch none
6862 eval $prefixit
6863 $cat <<EOM
6864
6865 The installation process will also create a directory for
6866 architecture-dependent site-specific extensions and modules.
6867
6868 EOM
6869 fn=d~+
6870 rp='Pathname for the site-specific architecture-dependent library files?'
6871 . ./getfile
6872 prefixvar=sitearch
6873 . ./setprefixvar
6874 if $test X"$sitearch" = X"$sitelib"; then
6875         d_sitearch="$undef"
6876 else
6877         d_sitearch="$define"
6878 fi
6879
6880 : Set the vendorprefix variables
6881 $cat <<EOM
6882
6883 The installation process will also create a directory for
6884 vendor-supplied add-ons.  Vendors who supply perl with their system
6885 may find it convenient to place all vendor-supplied files in this
6886 directory rather than in the main distribution directory.  This will
6887 ease upgrades between binary-compatible maintenance versions of perl.
6888
6889 Of course you may also use these directories in whatever way you see
6890 fit.  For example, you might use them to access modules shared over a
6891 company-wide network.
6892
6893 The default answer should be fine for most people.
6894 This causes further questions about vendor add-ons to be skipped
6895 and no vendor-specific directories will be configured for perl.
6896
6897 EOM
6898 rp='Do you want to configure vendor-specific add-on directories?'
6899 case "$usevendorprefix" in
6900 define|true|[yY]*) dflt=y ;;
6901 *)      : User may have set vendorprefix directly on Configure command line.
6902         case "$vendorprefix" in
6903         ''|' ') dflt=n ;;
6904         *)      dflt=y ;;
6905         esac
6906         ;;
6907 esac
6908 . ./myread
6909 case "$ans" in
6910 [yY]*)  fn=d~+
6911         rp='Installation prefix to use for vendor-supplied add-ons?'
6912         case "$vendorprefix" in
6913         '') dflt='' ;;
6914         *)  dflt=$vendorprefix ;;
6915         esac
6916         . ./getfile
6917         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6918         oldvendorprefix=''
6919         case "$vendorprefix" in
6920         '') ;;
6921         *)      case "$ans" in
6922                 "$prefix") ;;
6923                 *) oldvendorprefix="$prefix";;
6924                 esac
6925                 ;;
6926         esac
6927         usevendorprefix="$define"
6928         vendorprefix="$ans"
6929         vendorprefixexp="$ansexp"
6930         ;;
6931 *)      usevendorprefix="$undef"
6932         vendorprefix=''
6933         vendorprefixexp=''
6934         ;;
6935 esac
6936
6937 : Set the vendorlib variables
6938 case "$vendorprefix" in
6939 '')     d_vendorlib="$undef"
6940         vendorlib=''
6941         vendorlibexp=''
6942         ;;
6943 *)      d_vendorlib="$define"
6944         : determine where vendor-supplied modules go.
6945         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6946         case "$vendorlib" in
6947         '')
6948                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6949                 case "$installstyle" in
6950                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6951                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6952                 esac
6953                 ;;
6954         *)      dflt="$vendorlib"
6955                 ;;
6956         esac
6957         fn=d~+
6958         rp='Pathname for the vendor-supplied library files?'
6959         . ./getfile
6960         vendorlib="$ans"
6961         vendorlibexp="$ansexp"
6962         ;;
6963 esac
6964 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6965 prefixvar=vendorlib
6966 . ./installprefix
6967
6968 : Set the vendorarch variables
6969 case "$vendorprefix" in
6970 '')     d_vendorarch="$undef"
6971         vendorarch=''
6972         vendorarchexp=''
6973         ;;
6974 *)      d_vendorarch="$define"
6975         : determine where vendor-supplied architecture-dependent libraries go.
6976         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6977         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6978         : vendorlib may have an optional trailing /share.
6979         case "$vendorarch" in
6980         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6981                 dflt="$dflt/$archname"
6982                 ;;
6983         *)      dflt="$vendorarch" ;;
6984         esac
6985         fn=d~+
6986         rp='Pathname for vendor-supplied architecture-dependent files?'
6987         . ./getfile
6988         vendorarch="$ans"
6989         vendorarchexp="$ansexp"
6990         ;;
6991 esac
6992 prefixvar=vendorarch
6993 . ./installprefix
6994 if $test X"$vendorarch" = X"$vendorlib"; then
6995         d_vendorarch="$undef"
6996 else
6997         d_vendorarch="$define"
6998 fi
6999
7000 : Final catch-all directories to search
7001 $cat <<EOM
7002
7003 Lastly, you can have perl look in other directories for extensions and
7004 modules in addition to those already specified.
7005 These directories will be searched after 
7006         $sitearch 
7007         $sitelib 
7008 EOM
7009 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7010 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7011 echo ' '
7012 case "$otherlibdirs" in
7013 ''|' ') dflt='none' ;;
7014 *)      dflt="$otherlibdirs" ;;
7015 esac
7016 $cat <<EOM
7017 Enter a colon-separated set of extra paths to include in perl's @INC
7018 search path, or enter 'none' for no extra paths.
7019
7020 EOM
7021
7022 rp='Colon-separated list of additional directories for perl to search?'
7023 . ./myread
7024 case "$ans" in
7025 ' '|''|none)    otherlibdirs=' ' ;;     
7026 *)      otherlibdirs="$ans" ;;
7027 esac
7028 case "$otherlibdirs" in
7029 ' ') val=$undef ;;
7030 *)      val=$define ;;
7031 esac
7032 set d_perl_otherlibdirs
7033 eval $setvar
7034
7035 : Cruising for prototypes
7036 echo " "
7037 echo "Checking out function prototypes..." >&4
7038 $cat >prototype.c <<EOCP
7039 #$i_stdlib I_STDLIB
7040 #ifdef I_STDLIB
7041 #include <stdlib.h>
7042 #endif
7043 int main(int argc, char *argv[]) {
7044         exit(0);}
7045 EOCP
7046 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7047         echo "Your C compiler appears to support function prototypes."
7048         val="$define"
7049 else
7050         echo "Your C compiler doesn't seem to understand function prototypes."
7051         val="$undef"
7052 fi
7053 set prototype
7054 eval $setvar
7055 $rm -f prototype*
7056
7057 : Check if ansi2knr is required
7058 case "$prototype" in
7059 "$define") ;;
7060 *)      ansi2knr='ansi2knr'
7061         echo " "
7062         cat <<EOM >&4
7063
7064 $me:  FATAL ERROR:
7065 This version of $package can only be compiled by a compiler that 
7066 understands function prototypes.  Unfortunately, your C compiler 
7067         $cc $ccflags
7068 doesn't seem to understand them.  Sorry about that.
7069
7070 If GNU cc is available for your system, perhaps you could try that instead.  
7071
7072 Eventually, we hope to support building Perl with pre-ANSI compilers.
7073 If you would like to help in that effort, please contact <perlbug@perl.org>.
7074
7075 Aborting Configure now.
7076 EOM
7077         exit 2
7078         ;;
7079 esac
7080
7081 : DTrace support
7082 dflt_dtrace='/usr/sbin/dtrace'
7083 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7084
7085 cat <<EOM
7086
7087 Perl can be built to support DTrace on platforms that support it.
7088 DTrace is a diagnosis and performance analysis tool from Sun.
7089
7090 If this doesn't make any sense to you, just accept the default '$dflt'.
7091 EOM
7092
7093 while $test 1 ; do
7094         case "$usedtrace" in
7095         $define|true|[yY]*)
7096                 dflt='y'
7097                 ;;
7098         ?*)
7099                 dflt='y'
7100                 dflt_dtrace=$usedtrace
7101                 ;;
7102         *)
7103                 dflt='n'
7104                 ;;
7105         esac
7106
7107         rp='Support DTrace if available?'
7108         . ./myread
7109         case "$ans" in
7110         y|Y)    val="$define" ;;
7111         *)      val="$undef" ;;
7112         esac
7113         set usedtrace
7114         eval $setvar
7115
7116         test "X$usedtrace" != "X$define" && break
7117
7118         echo " "
7119         rp='Where is the dtrace executable?'
7120         dflt=$dflt_dtrace
7121         . ./getfile
7122         val="$ans"
7123         set dtrace
7124         eval $setvar
7125
7126         if $test -f $dtrace
7127         then
7128                 if $dtrace -h -s ../perldtrace.d \
7129                         -o perldtrace.tmp >/dev/null 2>&1 \
7130                         && rm -f perldtrace.tmp
7131                 then
7132                         echo " "
7133                         echo "Good: your $dtrace knows about the -h flag."
7134                 else
7135                         cat >&2 <<EOM
7136
7137 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7138 ***
7139 *** Your installed dtrace doesn't support the -h switch to compile a D
7140 *** program into a C header. Can't continue.
7141
7142 EOM
7143                         exit 1
7144                 fi
7145                 break;
7146         fi
7147
7148         case "$fastread" in
7149         yes)
7150                 cat >&2 <<EOM
7151
7152 *** $me:  Fatal Error:  $dtrace not found.
7153 *** Can't continue.
7154
7155 EOM
7156                 exit 1
7157                 ;;
7158         *)
7159                 echo "*** $dtrace was not found."
7160                 echo " "
7161                 ;;
7162         esac
7163 done
7164
7165 : See if we want extra modules installed
7166 echo " "
7167 case "$extras" in
7168 '') dflt='n';;
7169 *) dflt='y';;
7170 esac
7171 cat <<EOM
7172 Perl can be built with extra modules or bundles of modules which
7173 will be fetched from the CPAN and installed alongside Perl.
7174
7175 Notice that you will need access to the CPAN; either via the Internet,
7176 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7177 be asked later to configure the CPAN.pm module which will in turn do
7178 the installation of the rest of the extra modules or bundles.)
7179
7180 Notice also that if the modules require any external software such as
7181 libraries and headers (the libz library and the zlib.h header for the
7182 Compress::Zlib module, for example) you MUST have any such software
7183 already installed, this configuration process will NOT install such
7184 things for you.
7185
7186 If this doesn't make any sense to you, just accept the default '$dflt'.
7187 EOM
7188 rp='Install any extra modules (y or n)?'
7189 . ./myread
7190 case "$ans" in
7191 y|Y)
7192         cat <<EOM
7193
7194 Please list any extra modules or bundles to be installed from CPAN,
7195 with spaces between the names.  The names can be in any format the
7196 'install' command of CPAN.pm will understand.  (Answer 'none',
7197 without the quotes, to install no extra modules or bundles.)
7198 EOM
7199         rp='Extras?'
7200         dflt="$extras"
7201         . ./myread
7202         extras="$ans"
7203 esac
7204 case "$extras" in
7205 ''|'none')
7206         val=''
7207         $rm -f ../extras.lst
7208         ;;
7209 *)      echo "(Saving the list of extras for later...)"
7210         echo "$extras" > ../extras.lst
7211         val="'$extras'"
7212         ;;
7213 esac
7214 set extras
7215 eval $setvar
7216 echo " "
7217
7218 : determine where html pages for programs go
7219 set html1dir html1dir none
7220 eval $prefixit
7221 $cat <<EOM
7222
7223 If you wish to install html files for programs in $spackage, indicate
7224 the appropriate directory here.  To skip installing html files,
7225 answer "none".
7226 EOM
7227 case "$html1dir" in
7228 ''|none|$undef|' ') dflt=none ;;
7229 *) dflt=$html1dir ;;
7230 esac
7231 fn=dn+~
7232 rp="Directory for the main $spackage html pages?"
7233 . ./getfile
7234 prefixvar=html1dir
7235 . ./setprefixvar
7236 : Use ' ' for none so value is preserved next time through Configure
7237 $test X"$html1dir" = "X" && html1dir=' '
7238
7239 : determine where html pages for libraries and modules go
7240 set html3dir html3dir none
7241 eval $prefixit
7242 $cat <<EOM
7243
7244 If you wish to install html files for modules associated with $spackage,
7245 indicate the appropriate directory here.  To skip installing html files,
7246 answer "none".
7247 EOM
7248 : There is no obvious default.  If they have specified html1dir, then
7249 : try to key off that, possibly changing .../html1 into .../html3.
7250 case "$html3dir" in
7251 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7252 *) dflt=$html3dir ;;
7253 esac
7254 fn=dn+~
7255 rp="Directory for the $spackage module html pages?"
7256 . ./getfile
7257 prefixvar=html3dir
7258 . ./setprefixvar
7259 : Use ' ' for none so value is preserved next time through Configure
7260 $test X"$html3dir" = "X" && html3dir=' '
7261
7262 : determine whether to install perl also as /usr/bin/perl
7263
7264 echo " "
7265 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7266         $cat <<EOM
7267 Many scripts expect perl to be installed as /usr/bin/perl.
7268
7269 If you want to, I can install the perl you are about to compile
7270 as /usr/bin/perl (in addition to $bin/perl).
7271 EOM
7272         if test -f /usr/bin/perl; then
7273             $cat <<EOM
7274
7275 However, please note that because you already have a /usr/bin/perl,
7276 overwriting that with a new Perl would very probably cause problems.
7277 Therefore I'm assuming you don't want to do that (unless you insist).
7278
7279 EOM
7280             case "$installusrbinperl" in
7281             "$define"|[yY]*)    dflt='y';;
7282             *)                  dflt='n';;
7283             esac
7284         else
7285             $cat <<EOM
7286
7287 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7288
7289 EOM
7290             case "$installusrbinperl" in
7291             "$undef"|[nN]*)     dflt='n';;
7292             *)                  dflt='y';;
7293             esac
7294         fi
7295         rp="Do you want to install perl as /usr/bin/perl?"
7296         . ./myread
7297         case "$ans" in
7298         [yY]*)  val="$define";;
7299         *)      val="$undef" ;;
7300         esac
7301 else
7302         val="$undef"
7303 fi
7304 set installusrbinperl
7305 eval $setvar
7306
7307 : Check if we are using the GNU C library
7308 echo " "
7309 echo "Checking for GNU C Library..." >&4
7310 cat >try.c <<'EOCP'
7311 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7312    alone are insufficient to distinguish different versions, such as
7313    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7314    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7315 */
7316 #include <stdio.h>
7317 int main(void)
7318 {
7319 #ifdef __GLIBC__
7320 #   ifdef __GLIBC_MINOR__
7321 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7322 #           include <gnu/libc-version.h>
7323             printf("%s\n",  gnu_get_libc_version());
7324 #       else
7325             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7326 #       endif
7327 #   else
7328         printf("%d\n",  __GLIBC__);
7329 #   endif
7330     return 0;
7331 #else
7332     return 1;
7333 #endif
7334 }
7335 EOCP
7336 set try
7337 if eval $compile_ok && $run ./try > glibc.ver; then
7338         val="$define"
7339         gnulibc_version=`$cat glibc.ver`
7340         echo "You are using the GNU C Library version $gnulibc_version"
7341 else
7342         val="$undef"
7343         gnulibc_version=''
7344         echo "You are not using the GNU C Library"
7345 fi
7346 $rm_try glibc.ver
7347 set d_gnulibc
7348 eval $setvar
7349
7350 : see if nm is to be used to determine whether a symbol is defined or not
7351 case "$usenm" in
7352 '')
7353         dflt=''
7354         case "$d_gnulibc" in
7355         "$define")
7356                 echo " "
7357                 echo "nm probably won't work on the GNU C Library." >&4
7358                 dflt=n
7359                 ;;
7360         esac
7361         case "$dflt" in
7362         '') 
7363                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7364                         echo " "
7365                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7366                         echo "'nm' won't be sufficient on this sytem." >&4
7367                         dflt=n
7368                 fi
7369                 ;;
7370         esac
7371         case "$dflt" in
7372         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7373                 if $test $dflt -gt 20; then
7374                         dflt=y
7375                 else
7376                         dflt=n
7377                 fi
7378                 ;;
7379         esac
7380         ;;
7381 *)
7382         case "$usenm" in
7383         true|$define) dflt=y;;
7384         *) dflt=n;;
7385         esac
7386         ;;
7387 esac
7388 $cat <<EOM
7389
7390 I can use $nm to extract the symbols from your C libraries. This
7391 is a time consuming task which may generate huge output on the disk (up
7392 to 3 megabytes) but that should make the symbols extraction faster. The
7393 alternative is to skip the 'nm' extraction part and to compile a small
7394 test program instead to determine whether each symbol is present. If
7395 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7396 this may be the best solution.
7397
7398 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7399
7400 EOM
7401 rp="Shall I use $nm to extract C symbols from the libraries?"
7402 . ./myread
7403 case "$ans" in
7404 [Nn]*) usenm=false;;
7405 *) usenm=true;;
7406 esac
7407
7408 runnm=$usenm
7409 case "$reuseval" in
7410 true) runnm=false;;
7411 esac
7412
7413 : nm options which may be necessary
7414 case "$nm_opt" in
7415 '') if $test -f /mach_boot; then
7416                 nm_opt=''       # Mach
7417         elif $test -d /usr/ccs/lib; then
7418                 nm_opt='-p'     # Solaris (and SunOS?)
7419         elif $test -f /dgux; then
7420                 nm_opt='-p'     # DG-UX
7421         elif $test -f /lib64/rld; then
7422                 nm_opt='-p'     # 64-bit Irix
7423         else
7424                 nm_opt=''
7425         fi;;
7426 esac
7427
7428 : nm options which may be necessary for shared libraries but illegal
7429 : for archive libraries.  Thank you, Linux.
7430 case "$nm_so_opt" in
7431 '')     case "$myuname" in
7432         *linux*|gnu*)
7433                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7434                         nm_so_opt='--dynamic'
7435                 fi
7436                 ;;
7437         esac
7438         ;;
7439 esac
7440
7441 : Figure out where the libc is located
7442 case "$runnm" in
7443 true)
7444 : get list of predefined functions in a handy place
7445 echo " "
7446 case "$libc" in
7447 '') libc=unknown
7448         case "$libs" in
7449         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7450         esac
7451         ;;
7452 esac
7453 case "$libs" in
7454 '') ;;
7455 *)  for thislib in $libs; do
7456         case "$thislib" in
7457         -lc|-lc_s)
7458                 : Handle C library specially below.
7459                 ;;
7460         -l*)
7461                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7462                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7463                         :
7464                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7465                         :
7466                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7467                         :
7468                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7469                         :
7470                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7471                         :
7472                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7473                         :
7474                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7475                         :
7476                 else
7477                         try=''
7478                 fi
7479                 libnames="$libnames $try"
7480                 ;;
7481         *) libnames="$libnames $thislib" ;;
7482         esac
7483         done
7484         ;;
7485 esac
7486 xxx=normal
7487 case "$libc" in
7488 unknown)
7489         set /lib/libc.$so
7490         for xxx in $libpth; do
7491                 $test -r $1 || set $xxx/libc.$so
7492                 : The messy sed command sorts on library version numbers.
7493                 $test -r $1 || \
7494                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7495                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7496                                 h
7497                                 s/[0-9][0-9]*/0000&/g
7498                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7499                                 G
7500                                 s/\n/ /' | \
7501                          $sort | $sed -e 's/^.* //'`
7502                 eval set \$$#
7503         done
7504         $test -r $1 || set /usr/ccs/lib/libc.$so
7505         $test -r $1 || set /lib/libsys_s$_a
7506         ;;
7507 *)
7508         set blurfl
7509         ;;
7510 esac
7511 if $test -r "$1"; then
7512         echo "Your (shared) C library seems to be in $1."
7513         libc="$1"
7514 elif $test -r /lib/libc && $test -r /lib/clib; then
7515         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7516         xxx=apollo
7517         libc='/lib/clib /lib/libc'
7518         if $test -r /lib/syslib; then
7519                 echo "(Your math library is in /lib/syslib.)"
7520                 libc="$libc /lib/syslib"
7521         fi
7522 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7523         echo "Your C library seems to be in $libc, as you said before."
7524 elif $test -r $incpath/usr/lib/libc$_a; then
7525         libc=$incpath/usr/lib/libc$_a;
7526         echo "Your C library seems to be in $libc.  That's fine."
7527 elif $test -r /lib/libc$_a; then
7528         libc=/lib/libc$_a;
7529         echo "Your C library seems to be in $libc.  You're normal."
7530 else
7531         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7532                 :
7533         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7534                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7535         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7536                 :
7537         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7538                 :
7539         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7540                 :
7541         else
7542                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7543         fi
7544         if $test -r "$tans"; then
7545                 echo "Your C library seems to be in $tans, of all places."
7546                 libc=$tans
7547         else
7548                 libc='blurfl'
7549         fi
7550 fi
7551 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7552         dflt="$libc"
7553         cat <<EOM
7554
7555 If the guess above is wrong (which it might be if you're using a strange
7556 compiler, or your machine supports multiple models), you can override it here.
7557
7558 EOM
7559 else
7560         dflt=''
7561         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7562         cat >&4 <<EOM
7563 I can't seem to find your C library.  I've looked in the following places:
7564
7565 EOM
7566         $sed 's/^/      /' libpath
7567         cat <<EOM
7568
7569 None of these seems to contain your C library. I need to get its name...
7570
7571 EOM
7572 fi
7573 fn=f
7574 rp='Where is your C library?'
7575 . ./getfile
7576 libc="$ans"
7577
7578 echo " "
7579 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7580 set X `cat libnames`
7581 shift
7582 xxx=files
7583 case $# in 1) xxx=file; esac
7584 echo "Extracting names from the following $xxx for later perusal:" >&4
7585 echo " "
7586 $sed 's/^/      /' libnames >&4
7587 echo " "
7588 $echo $n "This may take a while...$c" >&4
7589
7590 for file in $*; do
7591         case $file in
7592         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7593         *) $nm $nm_opt $file 2>/dev/null;;
7594         esac
7595 done >libc.tmp
7596
7597 $echo $n ".$c"
7598 $grep fprintf libc.tmp > libc.ptf
7599 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7600 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7601 xxx='[ADTSIWi]'
7602 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7603         eval $xscan;\
7604         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7605                 eval $xrun
7606 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7607         eval $xscan;\
7608         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7609                 eval $xrun
7610 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7611         eval $xscan;\
7612         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7613                 eval $xrun
7614 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7615         eval $xscan;\
7616         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7617                 eval $xrun
7618 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7619         eval $xscan;\
7620         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7621                 eval $xrun
7622 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7623         eval $xscan;\
7624         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7625                 eval $xrun
7626 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7627                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7628         eval $xscan;\
7629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630                 eval $xrun
7631 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7636         eval $xscan;\
7637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638                 eval $xrun
7639 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7640         eval $xscan;\
7641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7642                 eval $xrun
7643 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\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/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7648         eval $xscan;\
7649         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7650                 eval $xrun
7651 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7652         eval $xscan;\
7653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7654                 eval $xrun
7655 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7656         eval $xscan;\
7657         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7658                 eval $xrun
7659 else
7660         $nm -p $* 2>/dev/null >libc.tmp
7661         $grep fprintf libc.tmp > libc.ptf
7662         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7663                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7664         then
7665                 nm_opt='-p'
7666                 eval $xrun
7667         else
7668                 echo " "
7669                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7670                 com=''
7671                 if $ar t $libc > libc.tmp && \
7672                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7673                 then
7674                         for thisname in $libnames $libc; do
7675                                 $ar t $thisname >>libc.tmp
7676                         done
7677                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7678                         echo "Ok." >&4
7679                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7680                         for thisname in $libnames $libc; do
7681                                 $ar tv $thisname >>libc.tmp
7682                                 emximp -o tmp.imp $thisname \
7683                                     2>/dev/null && \
7684                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7685                                     < tmp.imp >>libc.tmp
7686                                 $rm -f tmp.imp
7687                         done
7688                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7689                         echo "Ok." >&4
7690                 else
7691                         echo "$ar didn't seem to work right." >&4
7692                         echo "Maybe this is a Cray...trying bld instead..." >&4
7693                         if  bld t $libc | \
7694                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7695                                 $test -s libc.list
7696                         then
7697                                 for thisname in $libnames; do
7698                                         bld t $libnames | \
7699                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7700                                         $ar t $thisname >>libc.tmp
7701                                 done
7702                                 echo "Ok." >&4
7703                         else
7704                                 echo "That didn't work either.  Giving up." >&4
7705                                 exit 1
7706                         fi
7707                 fi
7708         fi
7709 fi
7710 nm_extract="$com"
7711 case "$PASE" in
7712 define)
7713     echo " "
7714     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7715     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7716     ;;
7717 *)  if $test -f /lib/syscalls.exp; then
7718         echo " "
7719         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7720         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7721                 /lib/syscalls.exp >>libc.list
7722     fi
7723     ;;
7724 esac
7725 ;;
7726 esac
7727 $rm -f libnames libpath
7728
7729 : see if dld is available
7730 set dld.h i_dld
7731 eval $inhdr
7732
7733 : Check if we are using C++
7734 echo " "
7735 echo "Checking for C++..." >&4
7736 $cat >try.c <<'EOCP'
7737 #include <stdio.h>
7738 int main(void)
7739 {
7740 #ifdef __cplusplus
7741     return 0;
7742 #else
7743     return 1;
7744 #endif
7745 }
7746 EOCP
7747 set try
7748 if eval $compile_ok && $run ./try; then
7749         val="$define"
7750         echo "You are using a C++ compiler."
7751 else
7752         val="$undef"
7753         echo "You are not using a C++ compiler."
7754 fi
7755 $rm_try cplusplus$$
7756 set d_cplusplus
7757 eval $setvar
7758
7759 : is a C symbol defined?
7760 csym='tlook=$1;
7761 case "$3" in
7762 -v) tf=libc.tmp; tdc="";;
7763 -a) tf=libc.tmp; tdc="[]";;
7764 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7765 esac;
7766 case "$d_cplusplus" in
7767     $define)    extern_C="extern \"C\"" ;;
7768     *)          extern_C="extern"       ;;
7769 esac;
7770 tx=yes;
7771 case "$reuseval-$4" in
7772 true-) ;;
7773 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7774 esac;
7775 case "$tx" in
7776 yes)
7777         tval=false;
7778         if $test "$runnm" = true; then
7779                 if $contains $tlook $tf >/dev/null 2>&1; then
7780                         tval=true;
7781                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7782                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7783                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7784                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7785                         $rm_try;
7786                 fi;
7787         else
7788                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7789                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7790                 $rm_try;
7791         fi;
7792         ;;
7793 *)
7794         case "$tval" in
7795         $define) tval=true;;
7796         *) tval=false;;
7797         esac;
7798         ;;
7799 esac;
7800 eval "$2=$tval"'
7801
7802 : define an is-in-libc? function
7803 inlibc='echo " "; td=$define; tu=$undef;
7804 sym=$1; var=$2; eval "was=\$$2";
7805 tx=yes;
7806 case "$reuseval$was" in
7807 true) ;;
7808 true*) tx=no;;
7809 esac;
7810 case "$tx" in
7811 yes)
7812         set $sym tres -f;
7813         eval $csym;
7814         case "$tres" in
7815         true)
7816                 echo "$sym() found." >&4;
7817                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7818         *)
7819                 echo "$sym() NOT found." >&4;
7820                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7821         esac;;
7822 *)
7823         case "$was" in
7824         $define) echo "$sym() found." >&4;;
7825         *) echo "$sym() NOT found." >&4;;
7826         esac;;
7827 esac'
7828
7829 : see if dlopen exists
7830 xxx_runnm="$runnm"
7831 xxx_ccflags="$ccflags"
7832 runnm=false
7833 : with g++ one needs -shared to get is-in-libc to work for dlopen
7834 case "$gccversion" in
7835 '')     ;;
7836 *)      case "$d_cplusplus" in
7837         "$define") ccflags="$ccflags -shared" ;;
7838         esac
7839         ;;
7840 esac
7841 set dlopen d_dlopen
7842 eval $inlibc
7843 runnm="$xxx_runnm"
7844 ccflags="$xxx_ccflags"
7845
7846 : see if this is a unistd.h system
7847 set unistd.h i_unistd
7848 eval $inhdr
7849
7850 : determine which dynamic loading, if any, to compile in
7851 echo " "
7852 dldir="ext/DynaLoader"
7853 case "$usedl" in
7854 $define|y|true)
7855         dflt='y'
7856         usedl="$define"
7857         ;;
7858 $undef|n|false)
7859         dflt='n'
7860         usedl="$undef"
7861         ;;
7862 *)
7863         dflt='n'
7864         case "$d_dlopen" in
7865             $define) dflt='y' ;;
7866         esac
7867         case "$i_dld" in
7868             $define) dflt='y' ;;
7869         esac
7870         : Does a dl_xxx.xs file exist for this operating system
7871         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7872         ;;
7873 esac
7874 rp="Do you wish to use dynamic loading?"
7875 . ./myread
7876 usedl="$ans"
7877 bin_ELF="$undef"
7878 case "$ans" in
7879 y*) usedl="$define"
7880         case "$dlsrc" in
7881         '')
7882                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7883                         dflt="$dldir/dl_${osname}.xs"
7884                 elif $test "$d_dlopen" = "$define" ; then
7885                         dflt="$dldir/dl_dlopen.xs"
7886                 elif $test "$i_dld" = "$define" ; then
7887                         dflt="$dldir/dl_dld.xs"
7888                 else
7889                         dflt=''
7890                 fi
7891                 ;;
7892         *)      dflt="$dldir/$dlsrc"
7893                 ;;
7894         esac
7895     echo "The following dynamic loading files are available:"
7896         : Can not go over to $dldir because getfile has path hard-coded in.
7897         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7898         rp="Source file to use for dynamic loading"
7899         fn="fne"
7900         gfpth="$src"
7901         . ./getfile
7902         usedl="$define"
7903         : emulate basename
7904         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7905
7906         $cat << EOM
7907
7908 Some systems may require passing special flags to $cc -c to
7909 compile modules that will be used to create a shared library.
7910 To use no flags, say "none".
7911
7912 EOM
7913     case "$cccdlflags" in
7914     '') case "$gccversion" in
7915                 '') case "$osname" in
7916                         hpux)   dflt='+z' ;;
7917                         next)   dflt='none' ;;
7918                         irix*)  dflt='-KPIC' ;;
7919                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7920                         sunos)  dflt='-pic' ;;
7921                         *)      dflt='none' ;;
7922                     esac
7923                         ;;
7924                 *)  case "$osname" in
7925                         darwin) dflt='none' ;;
7926                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7927                         *)      dflt='-fpic' ;;
7928                     esac ;;
7929             esac ;;
7930         ' ') dflt='none' ;;
7931     *)  dflt="$cccdlflags" ;;
7932     esac
7933     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7934     . ./myread
7935     case "$ans" in
7936     none) cccdlflags=' ' ;;
7937     *) cccdlflags="$ans" ;;
7938     esac
7939
7940     cat << EOM
7941
7942 Some systems use ld to create libraries that can be dynamically loaded,
7943 while other systems (such as those using ELF) use $cc.
7944
7945 EOM
7946         case "$ld" in
7947         '')     $cat >try.c <<EOM
7948 /* Test for whether ELF binaries are produced */
7949 #include <fcntl.h>
7950 #$i_stdlib I_STDLIB
7951 #ifdef I_STDLIB
7952 #include <stdlib.h>
7953 #endif
7954 #$i_unistd I_UNISTD
7955 #ifdef I_UNISTD
7956 #include <unistd.h>
7957 #endif
7958 int main() {
7959         char b[4];
7960         int i = open("a.out",O_RDONLY);
7961         if(i == -1)
7962                 exit(1); /* fail */
7963         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7964                 exit(0); /* succeed (yes, it's ELF) */
7965         else
7966                 exit(1); /* fail */
7967 }
7968 EOM
7969                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7970                         cat <<EOM
7971 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7972 EOM
7973                         dflt="$cc"
7974                         bin_ELF="$define"
7975                 else
7976                         echo "I'll use ld to build dynamic libraries."
7977                         dflt='ld'
7978                 fi
7979                 $rm_try
7980                 ;;
7981         *)      dflt="$ld"
7982                 ;;
7983         esac
7984
7985     rp="What command should be used to create dynamic libraries?"
7986     . ./myread
7987         ld="$ans"
7988
7989     cat << EOM
7990
7991 Some systems may require passing special flags to $ld to create a
7992 library that can be dynamically loaded.  If your ld flags include
7993 -L/other/path options to locate libraries outside your loader's normal
7994 search path, you may need to specify those -L options here as well.  To
7995 use no flags, say "none".
7996
7997 EOM
7998     case "$lddlflags" in
7999     '') case "$osname" in
8000                         beos) dflt='-nostart' ;;
8001                         haiku) dflt='-shared' ;;
8002                         hpux) dflt='-b';
8003                               case "$gccversion" in
8004                               '') dflt="$dflt +vnocompatwarnings" ;;
8005                               esac
8006                               ;;
8007                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8008                         next)  dflt='none' ;;
8009                         solaris) dflt='-G' ;;
8010                         sunos) dflt='-assert nodefinitions' ;;
8011                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8012                 *)     dflt='none' ;;
8013                         esac
8014                         ;;
8015     *) dflt="$lddlflags" ;;
8016     esac
8017
8018         : Try to guess additional flags to pick up local libraries.
8019         : Be careful not to append to a plain 'none'
8020         case "$dflt" in
8021         none) dflt='' ;;
8022         esac
8023         for thisflag in $ldflags; do
8024                 case "$thisflag" in
8025                 -L*|-R*|-Wl,-R*)
8026                         case " $dflt " in
8027                         *" $thisflag "*) ;;
8028                         *) dflt="$dflt $thisflag" ;;
8029                         esac
8030                         ;;
8031                 esac
8032         done
8033
8034         case "$dflt" in
8035         ''|' ') dflt='none' ;;
8036         esac
8037
8038         case "$ldflags" in
8039         *-fstack-protector*)
8040             case "$dflt" in
8041                         *-fstack-protector*) ;; # Don't add it again
8042                         *) dflt="$dflt -fstack-protector" ;; 
8043                 esac
8044                 ;;
8045         esac
8046
8047
8048     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8049     . ./myread
8050     case "$ans" in
8051     none) lddlflags=' ' ;;
8052     *) lddlflags="$ans" ;;
8053     esac
8054
8055         cat <<EOM
8056
8057 Some systems may require passing special flags to $cc to indicate that
8058 the resulting executable will use dynamic linking.  To use no flags,
8059 say "none".
8060
8061 EOM
8062     case "$ccdlflags" in
8063     '') case "$osname" in
8064             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8065             next|sunos) dflt='none' ;;
8066             *)          dflt='none' ;;
8067             esac ;;
8068     ' ')  dflt='none' ;;
8069     *)  dflt="$ccdlflags" ;;
8070     esac
8071     rp="Any special flags to pass to $cc to use dynamic linking?"
8072     . ./myread
8073     case "$ans" in
8074     none) ccdlflags=' ' ;;
8075     *) ccdlflags="$ans" ;;
8076     esac
8077     ;;
8078 *)  usedl="$undef"
8079         ld='ld'
8080     dlsrc='dl_none.xs'
8081     lddlflags=''
8082     ccdlflags=''
8083     ;;
8084 esac
8085
8086 : Do we want a shared libperl?
8087 also=''
8088 case "$usedl" in
8089 $undef)
8090         # No dynamic loading being used, so don't bother even to prompt.
8091         useshrplib='false'
8092         ;;
8093 *)      case "$useshrplib" in
8094         '')     case "$osname" in
8095                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8096                         dflt=y
8097                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8098                         ;;
8099                 next*)
8100                         case "$osvers" in
8101                         4*)     dflt=y
8102                                 also='Building a shared libperl is needed for MAB support.'
8103                                 ;;
8104                         *)      dflt=n
8105                                 ;;
8106                         esac
8107                         ;;
8108                 *)      dflt=n
8109                         ;;
8110                 esac
8111                 ;;
8112         $define|true|[Yy]*)
8113                 dflt=y
8114                 ;;
8115         *)      dflt=n
8116                 ;;
8117         esac
8118         $cat << EOM
8119
8120 The perl executable is normally obtained by linking perlmain.c with
8121 libperl${_a}, any static extensions (usually just DynaLoader), and
8122 any other libraries needed on this system (such as -lm, etc.).  Since
8123 your system supports dynamic loading, it is probably possible to build
8124 a shared libperl.$so.  If you will have more than one executable linked
8125 to libperl.$so, this will significantly reduce the size of each
8126 executable, but it may have a noticeable effect on performance.  The
8127 default is probably sensible for your system.
8128 $also
8129
8130 EOM
8131         rp="Build a shared libperl.$so (y/n)"
8132         . ./myread
8133         case "$ans" in
8134         true|$define|[Yy]*)
8135                 useshrplib='true'  ;;
8136         *)      useshrplib='false' ;;
8137         esac
8138         ;;
8139 esac
8140
8141 case "$useshrplib" in
8142 true)
8143         case "$userelocatableinc" in
8144         true|define)
8145                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8146                 echo "See INSTALL for an explanation why that won't work." >&4
8147                 exit 4
8148                 ;;
8149         esac
8150         case "$libperl" in
8151         '')
8152                 # Figure out a good name for libperl.so.  Since it gets stored in
8153                 # a version-specific architecture-dependent library, the version
8154                 # number isn't really that important, except for making cc/ld happy.
8155                 #
8156                 # A name such as libperl.so.10.1
8157                 majmin="libperl.$so.$patchlevel.$subversion"
8158                 # A name such as libperl.so.100
8159                 majonly=`echo $patchlevel $subversion |
8160                         $awk '{printf "%d%02d", $1, $2}'`
8161                 majonly=libperl.$so.$majonly
8162                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8163                 # rely on figuring it out from the naming of libc.
8164                 case "${osname}${osvers}" in
8165                 next4*)
8166                         dflt=libperl.5.$so
8167                         # XXX How handle the --version stuff for MAB?
8168                         ;;
8169                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8170                         dflt=libperl.$so
8171                         ;;
8172                 cygwin*) # ld links now against the dll directly
8173                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8174                         majonly=`echo $patchlevel $subversion |
8175                                 $awk '{printf "%03d%03d", $1, $2}'`
8176                         majonly=cygperl5.$majonly.$so
8177                         dflt=$majmin
8178                         ;;
8179                 *)      # Try to guess based on whether libc has major.minor.
8180                         case "$libc" in
8181                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8182                         *libc.$so.[0-9]*) dflt=$majonly ;;
8183                         *)      dflt=libperl.$so ;;
8184                         esac
8185                         ;;
8186                 esac
8187                 ;;
8188         *)      dflt=$libperl
8189                 ;;
8190         esac
8191         cat << EOM
8192
8193 I need to select a good name for the shared libperl.  If your system uses
8194 library names with major and minor numbers, then you might want something
8195 like $majmin.  Alternatively, if your system uses a single version
8196 number for shared libraries, then you might want to use $majonly.
8197 Or, your system might be quite happy with a simple libperl.$so.
8198
8199 Since the shared libperl will get installed into a version-specific
8200 architecture-dependent directory, the version number of the shared perl
8201 library probably isn't important, so the default should be o.k.
8202
8203 EOM
8204         rp='What name do you want to give to the shared libperl?'
8205         . ./myread
8206         libperl=$ans
8207         echo "Ok, I'll use $libperl"
8208         ;;
8209 *)
8210         libperl="libperl${_a}"
8211         ;;
8212 esac
8213
8214 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8215 case "$shrpdir" in
8216 '') ;;
8217 *)      $cat >&4 <<EOM
8218 WARNING:  Use of the shrpdir variable for the installation location of
8219 the shared $libperl is not supported.  It was never documented and
8220 will not work in this version.  Let me (perlbug@perl.org)
8221 know of any problems this may cause.
8222
8223 EOM
8224         case "$shrpdir" in
8225         "$archlibexp/CORE")
8226                 $cat >&4 <<EOM
8227 But your current setting of $shrpdir is
8228 the default anyway, so it's harmless.
8229 EOM
8230                 ;;
8231         *)
8232                 $cat >&4 <<EOM
8233 Further, your current attempted setting of $shrpdir
8234 conflicts with the value of $archlibexp/CORE
8235 that installperl will use.
8236 EOM
8237                 ;;
8238         esac
8239         ;;
8240 esac
8241
8242 # How will the perl executable find the installed shared $libperl?
8243 # Add $xxx to ccdlflags.
8244 # If we can't figure out a command-line option, use $shrpenv to
8245 # set env LD_RUN_PATH.  The main perl makefile uses this.
8246 shrpdir=$archlibexp/CORE
8247 xxx=''
8248 tmp_shrpenv=''
8249 if "$useshrplib"; then
8250     case "$osname" in
8251         aix)
8252                 # We'll set it in Makefile.SH...
8253                 ;;
8254         solaris)
8255                 xxx="-R $shrpdir"
8256                 ;;
8257         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8258                 xxx="-Wl,-R$shrpdir"
8259                 ;;
8260         bsdos|linux|irix*|dec_osf|gnu*)
8261                 xxx="-Wl,-rpath,$shrpdir"
8262                 ;;
8263         next)
8264                 # next doesn't like the default...
8265                 ;;
8266         beos)
8267                 # beos doesn't like the default, either.
8268                 ;;
8269         haiku)
8270                 # Haiku doesn't like the default, either.
8271                 ;;
8272         hpux*)
8273                 # hpux doesn't like the default, either.
8274                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8275                 ;;
8276         cygwin)
8277                 # cygwin needs only ldlibpth
8278                 ;;
8279         *)
8280                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8281                 ;;
8282         esac
8283         case "$xxx" in
8284         '') ;;
8285         *)
8286                 # Only add $xxx if it isn't already in ccdlflags.
8287                 case " $ccdlflags " in
8288                 *" $xxx "*)     ;;
8289                 *)      ccdlflags="$ccdlflags $xxx"
8290                         cat <<EOM >&4
8291
8292 Adding $xxx to the flags
8293 passed to $ld so that the perl executable will find the
8294 installed shared $libperl.
8295
8296 EOM
8297                         ;;
8298                 esac
8299                 ;;
8300         esac
8301 fi
8302 # Fix ccdlflags in AIX for building external extensions.
8303 # (For building Perl itself bare -bE:perl.exp is needed,
8304 #  Makefile.SH takes care of this.)
8305 case "$osname" in
8306 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8307 esac
8308 # Respect a hint or command-line value.
8309 case "$shrpenv" in
8310 '') shrpenv="$tmp_shrpenv" ;;
8311 esac
8312 case "$ldlibpthname" in
8313 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8314 none)   ldlibpthname='' ;;
8315 esac
8316
8317 : determine where manual pages are on this system
8318 echo " "
8319 case "$sysman" in
8320 '') 
8321         syspath='/usr/share/man/man1 /usr/man/man1'
8322         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8323         syspath="$syspath /usr/man/u_man/man1"
8324         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8325         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8326         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8327         sysman=`./loc . /usr/man/man1 $syspath`
8328         ;;
8329 esac
8330 if $test -d "$sysman"; then
8331         echo "System manual is in $sysman." >&4
8332 else
8333         echo "Could not find manual pages in source form." >&4
8334 fi
8335
8336 : determine where manual pages go
8337 set man1dir man1dir none
8338 eval $prefixit
8339 $cat <<EOM
8340
8341 $spackage has manual pages available in source form.
8342 EOM
8343 case "$nroff" in
8344 nroff)
8345         echo "However, you don't have nroff, so they're probably useless to you."
8346         case "$man1dir" in
8347         '') man1dir="none";;
8348         esac;;
8349 esac
8350 echo "If you don't want the manual sources installed, answer 'none'."
8351 case "$man1dir" in
8352 ' ') dflt=none
8353         ;;
8354 '')
8355         lookpath="$prefixexp/share/man/man1"
8356         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8357         lookpath="$lookpath $prefixexp/man/p_man/man1"
8358         lookpath="$lookpath $prefixexp/man/u_man/man1"
8359         lookpath="$lookpath $prefixexp/man/man.1"
8360         case "$sysman" in
8361         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8362         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8363         esac
8364         set dflt
8365         eval $prefixup
8366         ;;
8367 *)  dflt="$man1dir"
8368         ;;
8369 esac
8370 echo " "
8371 fn=dn+~
8372 rp="Where do the main $spackage manual pages (source) go?"
8373 . ./getfile
8374 if $test "X$man1direxp" != "X$ansexp"; then
8375         installman1dir=''
8376 fi
8377 prefixvar=man1dir
8378 . ./setprefixvar
8379
8380 case "$man1dir" in
8381 '')     man1dir=' '
8382         installman1dir='';;
8383 esac
8384
8385 : What suffix to use on installed man pages
8386
8387 case "$man1dir" in
8388 ' ')
8389         man1ext='0'
8390         ;;
8391 *)
8392         rp="What suffix should be used for the main $spackage man pages?"
8393         case "$man1ext" in
8394         '')     case "$man1dir" in
8395                 *1)  dflt=1 ;;
8396                 *1p) dflt=1p ;;
8397                 *1pm) dflt=1pm ;;
8398                 *l) dflt=l;;
8399                 *n) dflt=n;;
8400                 *o) dflt=o;;
8401                 *p) dflt=p;;
8402                 *C) dflt=C;;
8403                 *L) dflt=L;;
8404                 *L1) dflt=L1;;
8405                 *) dflt=1;;
8406                 esac
8407                 ;;
8408         *)      dflt="$man1ext";;
8409         esac
8410         . ./myread
8411         man1ext="$ans"
8412         ;;
8413 esac
8414
8415 : see if we can have long filenames
8416 echo " "
8417 first=123456789abcdef
8418 $rm -f $first
8419 if (echo hi >$first) 2>/dev/null; then
8420         if $test -f 123456789abcde; then
8421                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8422                 val="$undef"
8423         else
8424                 echo 'You can have filenames longer than 14 characters.'>&4
8425                 val="$define"
8426         fi
8427 else
8428         $cat <<'EOM'
8429 You can't have filenames longer than 14 chars.
8430 You can't even think about them!
8431 EOM
8432         val="$undef"
8433 fi
8434 set d_flexfnam
8435 eval $setvar
8436 $rm -rf 123456789abcde*
8437
8438 : determine where library module manual pages go
8439 set man3dir man3dir none
8440 eval $prefixit
8441 $cat <<EOM
8442
8443 $spackage has manual pages for many of the library modules.
8444 EOM
8445
8446 case "$nroff" in
8447 nroff)
8448         $cat <<'EOM'
8449 However, you don't have nroff, so they're probably useless to you.
8450 EOM
8451         case "$man3dir" in
8452         '') man3dir="none";;
8453         esac;;
8454 esac
8455
8456 case "$d_flexfnam" in
8457 undef)
8458         $cat <<'EOM'
8459 However, your system can't handle the long file names like File::Basename.3.
8460 EOM
8461         case "$man3dir" in
8462         '') man3dir="none";;
8463         esac;;
8464 esac
8465
8466 echo "If you don't want the manual sources installed, answer 'none'."
8467 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8468 case "$man3dir" in
8469 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8470         if $test -d "$privlib/man/man3"; then
8471                 cat <<EOM >&4
8472
8473 WARNING:  Previous versions of perl installed man3 pages into
8474 $privlib/man/man3.  This version will suggest a
8475 new default of $dflt.
8476 EOM
8477                 tdflt=$dflt
8478                 dflt='n'
8479                 rp='Do you wish to preserve the old behavior?(y/n)'
8480                 . ./myread
8481                 case "$ans" in
8482                 y*) dflt="$privlib/man/man3" ;;
8483                 *)  dflt=$tdflt ;;
8484                 esac
8485     fi
8486         ;;
8487 *)      dflt="$man3dir" ;;
8488 esac
8489 case "$dflt" in
8490 ' ') dflt=none ;;
8491 esac
8492 echo " "
8493 fn=dn+~
8494 rp="Where do the $package library man pages (source) go?"
8495 . ./getfile
8496 prefixvar=man3dir
8497 . ./setprefixvar
8498
8499 case "$man3dir" in
8500 '')     man3dir=' '
8501         installman3dir='';;
8502 esac
8503
8504 : What suffix to use on installed man pages
8505 case "$man3dir" in
8506 ' ')
8507         man3ext='0'
8508         ;;
8509 *)
8510         rp="What suffix should be used for the $package library man pages?"
8511         case "$man3ext" in
8512         '')     case "$man3dir" in
8513                 *3)  dflt=3 ;;
8514                 *3p) dflt=3p ;;
8515                 *3pm) dflt=3pm ;;
8516                 *l) dflt=l;;
8517                 *n) dflt=n;;
8518                 *o) dflt=o;;
8519                 *p) dflt=p;;
8520                 *C) dflt=C;;
8521                 *L) dflt=L;;
8522                 *L3) dflt=L3;;
8523                 *) dflt=3;;
8524                 esac
8525                 ;;
8526         *)      dflt="$man3ext";;
8527         esac
8528         . ./myread
8529         man3ext="$ans"
8530         ;;
8531 esac
8532
8533 : see if we have to deal with yellow pages, now NIS.
8534 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8535         if $test -f /usr/etc/nibindd; then
8536                 echo " "
8537                 echo "I'm fairly confident you're on a NeXT."
8538                 echo " "
8539                 rp='Do you get the hosts file via NetInfo?'
8540                 dflt=y
8541                 case "$hostcat" in
8542                 nidump*) ;;
8543                 '') ;;
8544                 *) dflt=n;;
8545                 esac
8546                 . ./myread
8547                 case "$ans" in
8548                 y*) hostcat='nidump hosts .';;
8549                 *)      case "$hostcat" in
8550                         nidump*) hostcat='';;
8551                         esac
8552                         ;;
8553                 esac
8554         fi
8555         case "$hostcat" in
8556         nidump*) ;;
8557         *)
8558                 case "$hostcat" in
8559                 *ypcat*) dflt=y;;
8560                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8561                                 dflt=y
8562                         else
8563                                 dflt=n
8564                         fi;;
8565                 *) dflt=n;;
8566                 esac
8567                 echo " "
8568                 rp='Are you getting the hosts file via yellow pages?'
8569                 . ./myread
8570                 case "$ans" in
8571                 y*) hostcat='ypcat hosts';;
8572                 *) hostcat='cat /etc/hosts';;
8573                 esac
8574                 ;;
8575         esac
8576 fi
8577 case "$hostcat" in
8578 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8579 esac
8580 case "$groupcat" in
8581 '') test -f /etc/group && groupcat='cat /etc/group';;
8582 esac
8583 case "$passcat" in
8584 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8585 esac
8586
8587 : now get the host name
8588 echo " "
8589 echo "Figuring out host name..." >&4
8590 case "$myhostname" in
8591 '') cont=true
8592         echo 'Maybe "hostname" will work...'
8593         if tans=`sh -c hostname 2>&1` ; then
8594                 myhostname=$tans
8595                 phostname=hostname
8596                 cont=''
8597         fi
8598         ;;
8599 *) cont='';;
8600 esac
8601 if $test "$cont"; then
8602         if ./xenix; then
8603                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8604                 if tans=`cat /etc/systemid 2>&1` ; then
8605                         myhostname=$tans
8606                         phostname='cat /etc/systemid'
8607                         echo "Whadyaknow.  Xenix always was a bit strange..."
8608                         cont=''
8609                 fi
8610         elif $test -r /etc/systemid; then
8611                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8612         fi
8613 fi
8614 if $test "$cont"; then
8615         echo 'No, maybe "uuname -l" will work...'
8616         if tans=`sh -c 'uuname -l' 2>&1` ; then
8617                 myhostname=$tans
8618                 phostname='uuname -l'
8619         else
8620                 echo 'Strange.  Maybe "uname -n" will work...'
8621                 if tans=`sh -c 'uname -n' 2>&1` ; then
8622                         myhostname=$tans
8623                         phostname='uname -n'
8624                 else
8625                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8626                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8627                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8628                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8629                         else
8630                                 case "$myhostname" in
8631                                 '') echo "Does this machine have an identity crisis or something?"
8632                                         phostname='';;
8633                                 *)
8634                                         echo "Well, you said $myhostname before..."
8635                                         phostname='echo $myhostname';;
8636                                 esac
8637                         fi
8638                 fi
8639         fi
8640 fi
8641 case "$myhostname" in
8642 '') myhostname=noname ;;
8643 esac
8644 : you do not want to know about this
8645 set $myhostname
8646 myhostname=$1
8647
8648 : verify guess
8649 if $test "$myhostname" ; then
8650         dflt=y
8651         rp='Your host name appears to be "'$myhostname'".'" Right?"
8652         . ./myread
8653         case "$ans" in
8654         y*) ;;
8655         *) myhostname='';;
8656         esac
8657 fi
8658
8659 : bad guess or no guess
8660 while $test "X$myhostname" = X ; do
8661         dflt=''
8662         rp="Please type the (one word) name of your host:"
8663         . ./myread
8664         myhostname="$ans"
8665 done
8666
8667 : translate upper to lower if necessary
8668 case "$myhostname" in
8669 *[A-Z]*)
8670         echo "(Normalizing case in your host name)"
8671         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8672         ;;
8673 esac
8674
8675 case "$myhostname" in
8676 *.*)
8677         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8678         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8679         echo "(Trimming domain name from host name--host name is now $myhostname)"
8680         ;;
8681 *) case "$mydomain" in
8682         '')
8683                 {
8684                         test "X$hostcat" = "Xypcat hosts" &&
8685                         ypmatch "$myhostname" hosts 2>/dev/null |\
8686                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8687                         $test -s hosts
8688                 } || {
8689                         test "X$hostcat" != "X" &&
8690                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8691                                         /[       ]$myhostname[  . ]/p" > hosts
8692                 }
8693                 tmp_re="[       . ]"
8694                 if $test -f hosts; then
8695                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8696                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8697                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8698                                 hosts | $sort | $uniq | \
8699                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8700                         case `$echo X$dflt` in
8701                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8702                                 dflt=.
8703                                 ;;
8704                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8705                                 ;;
8706                         esac
8707                 else
8708                         echo "(I cannot locate a hosts database anywhere)"
8709                         dflt=.
8710                 fi
8711                 case "$dflt" in
8712                 .)
8713                         tans=`./loc resolv.conf X /etc /usr/etc`
8714                         if $test -f "$tans"; then
8715                                 echo "(Attempting domain name extraction from $tans)"
8716                                 dflt=.`$sed -n -e 's/   / /g' \
8717                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8718                                   -e 1q 2>/dev/null`
8719                                 case "$dflt" in
8720                                 .) dflt=.`$sed -n -e 's/        / /g' \
8721                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8722                                      -e 1q 2>/dev/null`
8723                                         ;;
8724                                 esac
8725                         fi
8726                         ;;
8727                 esac
8728                 case "$dflt" in
8729                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8730                         dflt=.`sh -c domainname 2>/dev/null`
8731                         case "$dflt" in
8732                         '') dflt='.';;
8733                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8734                         esac
8735                         ;;
8736                 esac
8737                 case "$dflt$osname" in
8738                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8739                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8740                         ;;
8741                 esac
8742                 case "$dflt" in
8743                 .) echo "(Lost all hope -- silly guess then)"
8744                         dflt='.nonet'
8745                         ;;
8746                 esac
8747                 $rm -f hosts
8748                 ;;
8749         *) dflt="$mydomain";;
8750         esac;;
8751 esac
8752 echo " "
8753 rp="What is your domain name?"
8754 . ./myread
8755 tans="$ans"
8756 case "$ans" in
8757 '') ;;
8758 .*) ;;
8759 *) tans=".$tans";;
8760 esac
8761 mydomain="$tans"
8762
8763 : translate upper to lower if necessary
8764 case "$mydomain" in
8765 *[A-Z]*)
8766         echo "(Normalizing case in your domain name)"
8767         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8768         ;;
8769 esac
8770
8771 : a little sanity check here
8772 case "$phostname" in
8773 '') ;;
8774 *)
8775         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8776         $myhostname$mydomain|$myhostname) ;;
8777         *)
8778                 case "$phostname" in
8779                 sed*)
8780                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8781                         ;;
8782                 *)
8783                         echo "(That doesn't agree with your $phostname command, by the way.)"
8784                         ;;
8785                 esac
8786         ;;
8787         esac
8788         ;;
8789 esac
8790
8791 : determine the e-mail address of the user who is running us
8792 $cat <<EOM
8793
8794 I need to get your e-mail address in Internet format if possible, i.e.
8795 something like user@host.domain. Please answer accurately since I have
8796 no easy means to double check it. The default value provided below
8797 is most probably close to reality but may not be valid from outside
8798 your organization...
8799
8800 EOM
8801 cont=x
8802 while test "$cont"; do
8803         case "$cf_email" in
8804         '') dflt="$cf_by@$myhostname$mydomain";;
8805         *) dflt="$cf_email";;
8806         esac
8807         rp='What is your e-mail address?'
8808         . ./myread
8809         cf_email="$ans"
8810         case "$cf_email" in
8811         *@*.*) cont='' ;;
8812         *)
8813                 rp='Address does not look like an Internet one.  Use it anyway?'
8814                 case "$fastread" in
8815                 yes) dflt=y ;;
8816                 *) dflt=n ;;
8817                 esac
8818                 . ./myread
8819                 case "$ans" in
8820                 y*) cont='' ;;
8821                 *) echo " " ;;
8822                 esac
8823                 ;;
8824         esac
8825 done
8826
8827 : Ask e-mail of administrator
8828 $cat <<EOM
8829
8830 If you or somebody else will be maintaining perl at your site, please
8831 fill in the correct e-mail address here so that they may be contacted
8832 if necessary. Currently, the "perlbug" program included with perl
8833 will send mail to this address in addition to perlbug@perl.org. You may
8834 enter "none" for no administrator.
8835
8836 EOM
8837 case "$perladmin" in
8838 '') dflt="$cf_email";;
8839 *) dflt="$perladmin";;
8840 esac
8841 rp='Perl administrator e-mail address'
8842 . ./myread
8843 perladmin="$ans"
8844
8845 : determine whether to only install version-specific parts.
8846 echo " "
8847 $cat <<EOM
8848 Do you want to install only the version-specific parts of the perl
8849 distribution?  Usually you do *not* want to do this.
8850 EOM
8851 case "$versiononly" in
8852 "$define"|[Yy]*|true) dflt='y' ;;
8853 *) dflt='n';
8854 esac
8855 rp="Do you want to install only the version-specific parts of perl?"
8856 . ./myread
8857 case "$ans" in
8858 [yY]*)  val="$define";;
8859 *)      val="$undef" ;;
8860 esac
8861 set versiononly
8862 eval $setvar
8863
8864 case "$versiononly" in
8865 "$define") inc_version_list=''
8866            inc_version_list_init=0
8867            ;;
8868 esac
8869
8870 : figure out how to guarantee perl startup
8871 : XXX Note that this currently takes advantage of the bug that binexp ignores
8872 :     the Configure -Dinstallprefix setting, which in turn means that under
8873 :     relocatable @INC, initialinstalllocation is what binexp started as.
8874 case "$startperl" in
8875 '')
8876         case "$sharpbang" in
8877         *!)
8878                 $cat <<EOH
8879
8880 I can use the #! construct to start perl on your system. This will
8881 make startup of perl scripts faster, but may cause problems if you
8882 want to share those scripts and perl is not in a standard place
8883 ($initialinstalllocation/perl) on all your platforms. The alternative
8884 is to force a shell by starting the script with a single ':' character.
8885
8886 EOH
8887                 case "$versiononly" in
8888                 "$define")      dflt="$initialinstalllocation/perl$version";;
8889                 *)              dflt="$initialinstalllocation/perl";;
8890                 esac
8891                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8892                 . ./myread
8893                 case "$ans" in
8894                 none)   startperl=": # use perl";;
8895                 *)      startperl="#!$ans"
8896                         if $test 30 -lt `echo "$ans" | wc -c`; then
8897                                 $cat >&4 <<EOM
8898
8899 WARNING:  Some systems limit the #! command to 32 characters.
8900 If you experience difficulty running Perl scripts with #!, try
8901 installing Perl in a directory with a shorter pathname.
8902
8903 EOM
8904                         fi ;;
8905                 esac
8906                 ;;
8907         *) startperl=": # use perl"
8908                 ;;
8909         esac
8910         ;;
8911 esac
8912 echo "I'll use $startperl to start perl scripts."
8913
8914 : figure best path for perl in scripts
8915 case "$perlpath" in
8916 '')
8917         case "$versiononly" in
8918         "$define")      perlpath="$initialinstalllocation/perl$version";;
8919         *)              perlpath="$initialinstalllocation/perl";;
8920         esac
8921         case "$startperl" in
8922         *!*) ;;
8923         *)
8924                 $cat <<EOH
8925
8926 I will use the "eval 'exec'" idiom to start Perl on your system.
8927 I can use the full path of your Perl binary for this purpose, but
8928 doing so may cause problems if you want to share those scripts and
8929 Perl is not always in a standard place ($initialinstalllocation/perl).
8930
8931 EOH
8932                 dflt="$initialinstalllocation/perl"
8933                 rp="What path shall I use in \"eval 'exec'\"?"
8934                 . ./myread
8935                 perlpath="$ans"
8936                 ;;
8937         esac
8938         ;;
8939 esac
8940 case "$startperl" in
8941 *!*)    ;;
8942 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8943 esac
8944
8945 : determine where public executable scripts go
8946 set scriptdir scriptdir
8947 eval $prefixit
8948 case "$scriptdir" in
8949 '')
8950         dflt="$bin"
8951         : guess some guesses
8952         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8953         $test -d /usr/share/bin     && dflt=/usr/share/bin
8954         $test -d /usr/local/script  && dflt=/usr/local/script
8955         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8956         $test -d $prefixexp/script  && dflt=$prefixexp/script
8957         set dflt
8958         eval $prefixup
8959         ;;
8960 *)  dflt="$scriptdir"
8961         ;;
8962 esac
8963 $cat <<EOM
8964
8965 Some installations have a separate directory just for executable scripts so
8966 that they can mount it across multiple architectures but keep the scripts in
8967 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8968 Or you might just lump your scripts in with all your other executables.
8969
8970 EOM
8971 fn=d~
8972 rp='Where do you keep publicly executable scripts?'
8973 . ./getfile
8974 if $test "X$ansexp" != "X$scriptdirexp"; then
8975         installscript=''
8976 fi
8977 installscriptdir=''
8978 prefixvar=scriptdir
8979 . ./setprefixvar
8980 : A little fix up for an irregularly named variable.
8981 installscript="$installscriptdir"
8982
8983 : determine where add-on public executables go
8984 case "$sitebin" in
8985 '')     dflt=$siteprefix/bin ;;
8986 *)      dflt=$sitebin ;;
8987 esac
8988 fn=d~
8989 rp='Pathname where the add-on public executables should be installed?'
8990 . ./getfile
8991 prefixvar=sitebin
8992 . ./setprefixvar
8993
8994 : determine where add-on html pages go
8995 : There is no standard location, so try to copy the previously-selected
8996 : directory structure for the core html pages.
8997 case "$sitehtml1dir" in
8998 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8999 *)     dflt=$sitehtml1dir ;;
9000 esac
9001 case "$dflt" in
9002 ''|' ') dflt=none ;;
9003 esac
9004 fn=dn+~
9005 rp='Pathname where the site-specific html pages should be installed?'
9006 . ./getfile
9007 prefixvar=sitehtml1dir
9008 . ./setprefixvar
9009
9010 : determine where add-on library html pages go
9011 : There is no standard location, so try to copy the previously-selected
9012 : directory structure for the core html pages.
9013 case "$sitehtml3dir" in
9014 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9015 *)     dflt=$sitehtml3dir ;;
9016 esac
9017 case "$dflt" in
9018 ''|' ') dflt=none ;;
9019 esac
9020 fn=dn+~
9021 rp='Pathname where the site-specific library html pages should be installed?'
9022 . ./getfile
9023 prefixvar=sitehtml3dir
9024 . ./setprefixvar
9025
9026 : determine where add-on manual pages go
9027 case "$siteman1dir" in
9028 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9029 *)      dflt=$siteman1dir ;;
9030 esac
9031 case "$dflt" in
9032 ''|' ') dflt=none ;;
9033 esac
9034 fn=dn+~
9035 rp='Pathname where the site-specific manual pages should be installed?'
9036 . ./getfile
9037 prefixvar=siteman1dir
9038 . ./setprefixvar
9039
9040 : determine where add-on library man pages go
9041 case "$siteman3dir" in
9042 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9043 *)      dflt=$siteman3dir ;;
9044 esac
9045 case "$dflt" in
9046 ''|' ') dflt=none ;;
9047 esac
9048 fn=dn+~
9049 rp='Pathname where the site-specific library manual pages should be installed?'
9050 . ./getfile
9051 prefixvar=siteman3dir
9052 . ./setprefixvar
9053
9054 : determine where add-on public executable scripts go
9055 case "$sitescript" in
9056 '')     dflt=$siteprefix/script
9057         $test -d $dflt || dflt=$sitebin ;;
9058 *)  dflt="$sitescript" ;;
9059 esac
9060 fn=d~+
9061 rp='Pathname where add-on public executable scripts should be installed?'
9062 . ./getfile
9063 prefixvar=sitescript
9064 . ./setprefixvar
9065
9066 : Check if faststdio is requested and available
9067 case "$usefaststdio" in
9068 $define|true|[yY]*|'')
9069         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9070         case "$xversion" in
9071         [68])   dflt='y' ;;
9072         *)      dflt='n' ;;
9073         esac
9074         ;;
9075 *) dflt='n';;
9076 esac
9077 cat <<EOM
9078
9079 Perl can be built to use 'fast stdio', which means using the stdio
9080 library but also directly manipulating the stdio buffers to enable
9081 faster I/O.  Using stdio is better for backward compatibility (especially
9082 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9083 interface has been preferred instead of stdio.
9084
9085 If this doesn't make any sense to you, just accept the default '$dflt'.
9086 EOM
9087 rp='Use the "fast stdio" if available?'
9088 . ./myread
9089 case "$ans" in
9090 y|Y)    val="$define" ;;
9091 *)      val="$undef" ;;
9092 esac
9093 set usefaststdio
9094 eval $setvar
9095
9096
9097 : define an is-a-typedef? function
9098 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9099 case "$inclist" in
9100 "") inclist="sys/types.h";;
9101 esac;
9102 eval "varval=\$$var";
9103 case "$varval" in
9104 "")
9105         $rm -f temp.c;
9106         for inc in $inclist; do
9107                 echo "#include <$inc>" >>temp.c;
9108         done;
9109         echo "#ifdef $type" >> temp.c;
9110         echo "printf(\"We have $type\");" >> temp.c;
9111         echo "#endif" >> temp.c;
9112         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9113         if $contains $type temp.E >/dev/null 2>&1; then
9114                 eval "$var=\$type";
9115         else
9116                 eval "$var=\$def";
9117         fi;
9118         $rm -f temp.?;;
9119 *) eval "$var=\$varval";;
9120 esac'
9121
9122 : define an is-a-typedef? function that prompts if the type is not available.
9123 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9124 case "$inclist" in
9125 "") inclist="sys/types.h";;
9126 esac;
9127 eval "varval=\$$var";
9128 case "$varval" in
9129 "")
9130         $rm -f temp.c;
9131         for inc in $inclist; do
9132                 echo "#include <$inc>" >>temp.c;
9133         done;
9134         echo "#ifdef $type" >> temp.c;
9135         echo "printf(\"We have $type\");" >> temp.c;
9136         echo "#endif" >> temp.c;
9137         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9138         echo " " ;
9139         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9140         if $contains $type temp.E >/dev/null 2>&1; then
9141                 echo "$type found." >&4;
9142                 eval "$var=\$type";
9143         else
9144                 echo "$type NOT found." >&4;
9145                 dflt="$def";
9146                 . ./myread ;
9147                 eval "$var=\$ans";
9148         fi;
9149         $rm -f temp.?;;
9150 *) eval "$var=\$varval";;
9151 esac'
9152
9153 : see what type lseek is declared as in the kernel
9154 rp="What is the type used for lseek's offset on this system?"
9155 set off_t lseektype long stdio.h sys/types.h
9156 eval $typedef_ask
9157
9158 echo " "
9159 echo "Checking to see how big your file offsets are..." >&4
9160 $cat >try.c <<EOCP
9161 #include <sys/types.h>
9162 #include <stdio.h>
9163 int main()
9164 {
9165     printf("%d\n", (int)sizeof($lseektype));
9166     return(0);
9167 }
9168 EOCP
9169 set try
9170 if eval $compile_ok; then
9171         lseeksize=`$run ./try`
9172         echo "Your file offsets are $lseeksize bytes long."
9173 else
9174         dflt=$longsize
9175         echo " "
9176         echo "(I can't seem to compile the test program.  Guessing...)"
9177         rp="What is the size of your file offsets (in bytes)?"
9178         . ./myread
9179         lseeksize="$ans"
9180 fi
9181 $rm_try
9182
9183 : see what type file positions are declared as in the library
9184 rp="What is the type for file position used by fsetpos()?"
9185 set fpos_t fpostype long stdio.h sys/types.h
9186 eval $typedef_ask
9187
9188 : Check size for Fpos_t
9189 echo " "
9190 case "$fpostype" in
9191 *_t) zzz="$fpostype"    ;;
9192 *)   zzz="fpos_t"       ;;
9193 esac
9194 echo "Checking the size of $zzz..." >&4
9195 cat > try.c <<EOCP
9196 #include <sys/types.h>
9197 #include <stdio.h>
9198 #$i_stdlib I_STDLIB
9199 #ifdef I_STDLIB
9200 #include <stdlib.h>
9201 #endif
9202 int main() {
9203     printf("%d\n", (int)sizeof($fpostype));
9204     exit(0);
9205 }
9206 EOCP
9207 set try
9208 if eval $compile_ok; then
9209         yyy=`$run ./try`
9210         case "$yyy" in
9211         '')     fpossize=4
9212                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9213                 ;;
9214         *)      fpossize=$yyy
9215                 echo "Your $zzz is $fpossize bytes long."
9216                 ;;
9217         esac
9218 else
9219         dflt="$longsize"
9220         echo " " >&4
9221         echo "(I can't compile the test program.  Guessing...)" >&4
9222         rp="What is the size of your file positions (in bytes)?"
9223         . ./myread
9224         fpossize="$ans"
9225 fi
9226
9227 : Check for large file support
9228 # Backward compatibility (uselfs is deprecated).
9229 case "$uselfs" in
9230 "$define"|true|[yY]*)
9231         cat <<EOM >&4
9232
9233 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9234 EOM
9235         uselargefiles="$define"
9236         ;;
9237 esac
9238
9239 case "$lseeksize:$fpossize" in
9240 8:8) cat <<EOM
9241
9242 You can have files larger than 2 gigabytes.
9243 EOM
9244    val="$define" ;;
9245 *)    case "$uselargefiles" in
9246    "$undef"|false|[nN]*) dflt='n' ;;
9247    *)   dflt='y' ;;
9248    esac
9249    cat <<EOM
9250
9251 Perl can be built to understand large files (files larger than 2 gigabytes)
9252 on some systems.  To do so, Configure can be run with -Duselargefiles.
9253
9254 If this doesn't make any sense to you, just accept the default '$dflt'.
9255 EOM
9256    rp='Try to understand large files, if available?'
9257    . ./myread
9258    case "$ans" in
9259    y|Y)         val="$define" ;;
9260    *)           val="$undef"  ;;
9261    esac
9262    ;;
9263 esac
9264 set uselargefiles
9265 eval $setvar
9266 : Look for a hint-file generated 'call-back-unit'.  If the
9267 : user has specified that a large files perl is to be built,
9268 : we may need to set or change some other defaults.
9269 if $test -f uselargefiles.cbu; then
9270         echo "Your platform has some specific hints regarding large file builds, using them..."
9271         . ./uselargefiles.cbu
9272 fi
9273 case "$uselargefiles" in
9274 "$define")
9275         if $test -f uselargefiles.cbu; then
9276                 echo " "
9277                 echo "Rechecking to see how big your file offsets are..." >&4
9278                 $cat >try.c <<EOCP
9279 #include <sys/types.h>
9280 #include <stdio.h>
9281 int main()
9282 {
9283     printf("%d\n", (int)sizeof($lseektype));
9284     return(0);
9285 }
9286 EOCP
9287                 set try
9288                 if eval $compile_ok; then
9289                         lseeksize=`$run ./try`
9290                         $echo "Your file offsets are now $lseeksize bytes long."
9291                 else
9292                         dflt="$lseeksize"
9293                         echo " "
9294                         echo "(I can't seem to compile the test program.  Guessing...)"
9295                         rp="What is the size of your file offsets (in bytes)?"
9296                         . ./myread
9297                         lseeksize="$ans"
9298                 fi
9299                 case "$fpostype" in
9300                 *_t) zzz="$fpostype"    ;;
9301                 *)   zzz="fpos_t"       ;;
9302                 esac
9303                 $echo $n "Rechecking the size of $zzz...$c" >&4
9304                 $cat > try.c <<EOCP
9305 #include <sys/types.h>
9306 #include <stdio.h>
9307 #$i_stdlib I_STDLIB
9308 #ifdef I_STDLIB
9309 #include <stdlib.h>
9310 #endif
9311 int main() {
9312     printf("%d\n", (int)sizeof($fpostype));
9313     return(0);
9314 }
9315 EOCP
9316                 set try
9317                 if eval $compile_ok; then
9318                         yyy=`$run ./try`
9319                         dflt="$lseeksize"
9320                         case "$yyy" in
9321                         '')     echo " "
9322                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9323                                 ;;
9324                         *)      fpossize=$yyy
9325                                 echo " $fpossize bytes." >&4
9326                                 ;;
9327                         esac
9328                 else
9329                         dflt="$fpossize"
9330                         echo " "
9331                         echo "(I can't compile the test program.  Guessing...)" >&4
9332                         rp="What is the size of your file positions (in bytes)?"
9333                         . ./myread
9334                         fpossize="$ans"
9335                 fi
9336                 $rm_try
9337         fi
9338         ;;
9339 esac
9340
9341 : Check if we want perlio
9342 useperlio="$define"
9343
9344 : Set the vendorbin variables
9345 case "$vendorprefix" in
9346 '')     d_vendorbin="$undef"
9347         vendorbin=''
9348         vendorbinexp=''
9349         ;;
9350 *)      d_vendorbin="$define"
9351         : determine where vendor-supplied executables go.
9352         case "$vendorbin" in
9353         '') dflt=$vendorprefix/bin ;;
9354         *)      dflt="$vendorbin" ;;
9355         esac
9356         fn=d~+
9357         rp='Pathname for the vendor-supplied executables directory?'
9358         . ./getfile
9359         vendorbin="$ans"
9360         vendorbinexp="$ansexp"
9361         ;;
9362 esac
9363 prefixvar=vendorbin
9364 . ./installprefix
9365
9366 : Set the vendorhtml1dir variables
9367 case "$vendorprefix" in
9368 '')     vendorhtml1dir=''
9369         vendorhtml1direxp=''
9370         ;;
9371 *)      : determine where vendor-supplied html pages go.
9372         : There is no standard location, so try to copy the previously-selected
9373         : directory structure for the core html pages.
9374         : XXX Better default suggestions would be welcome.
9375         case "$vendorhtml1dir" in
9376         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9377         *)      dflt=$vendorhtml1dir ;;
9378         esac
9379         case "$dflt" in
9380         ''|' ') dflt=none ;;
9381         esac
9382         fn=dn+~
9383         rp='Pathname for the vendor-supplied html pages?'
9384         . ./getfile
9385         vendorhtml1dir="$ans"
9386         vendorhtml1direxp="$ansexp"
9387         ;;
9388 esac
9389 : Use ' ' for none so value is preserved next time through Configure
9390 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9391 prefixvar=vendorhtml1dir
9392 . ./installprefix
9393
9394 : Set the vendorhtml3dir variables
9395 case "$vendorprefix" in
9396 '')     vendorhtml3dir=''
9397         vendorhtml3direxp=''
9398         ;;
9399 *)      : determine where vendor-supplied module html pages go.
9400         : There is no standard location, so try to copy the previously-selected
9401         : directory structure for the core html pages.
9402         : XXX Better default suggestions would be welcome.
9403         case "$vendorhtml3dir" in
9404         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9405         *)      dflt=$vendorhtml3dir ;;
9406         esac
9407         case "$dflt" in
9408         ''|' ') dflt=none ;;
9409         esac
9410         fn=dn+~
9411         rp='Pathname for the vendor-supplied html pages?'
9412         . ./getfile
9413         vendorhtml3dir="$ans"
9414         vendorhtml3direxp="$ansexp"
9415         ;;
9416 esac
9417 : Use ' ' for none so value is preserved next time through Configure
9418 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9419 prefixvar=vendorhtml3dir
9420 . ./installprefix
9421
9422 : Set the vendorman1dir variables
9423 case "$vendorprefix" in
9424 '')     vendorman1dir=''
9425         vendorman1direxp=''
9426         ;;
9427 *)      : determine where vendor-supplied manual pages go.
9428         case "$vendorman1dir" in
9429         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9430         *)      dflt=$vendorman1dir ;;
9431         esac
9432         case "$dflt" in
9433         ''|' ') dflt=none ;;
9434         esac
9435         fn=nd~+
9436         rp='Pathname for the vendor-supplied manual section 1 pages?'
9437         . ./getfile
9438         vendorman1dir="$ans"
9439         vendorman1direxp="$ansexp"
9440         ;;
9441 esac
9442 : Use ' ' for none so value is preserved next time through Configure
9443 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9444 prefixvar=vendorman1dir
9445 . ./installprefix
9446
9447 : Set the vendorman3dir variables
9448 case "$vendorprefix" in
9449 '')     vendorman3dir=''
9450         vendorman3direxp=''
9451         ;;
9452 *)      : determine where vendor-supplied module manual pages go.
9453         case "$vendorman3dir" in
9454         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9455         *)      dflt=$vendorman3dir ;;
9456         esac
9457         case "$dflt" in
9458         ''|' ') dflt=none ;;
9459         esac
9460         fn=nd~+
9461         rp='Pathname for the vendor-supplied manual section 3 pages?'
9462         . ./getfile
9463         vendorman3dir="$ans"
9464         vendorman3direxp="$ansexp"
9465         ;;
9466 esac
9467 : Use ' ' for none so value is preserved next time through Configure
9468 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9469 prefixvar=vendorman3dir
9470 . ./installprefix
9471
9472 : Set the vendorscript variables
9473 case "$vendorprefix" in
9474 '')     d_vendorscript="$undef"
9475         vendorscript=''
9476         vendorscriptexp=''
9477         ;;
9478 *)      d_vendorscript="$define"
9479         : determine where vendor-supplied scripts go.
9480         case "$vendorscript" in
9481         '')     dflt=$vendorprefix/script
9482                 $test -d $dflt || dflt=$vendorbin ;;
9483         *)  dflt="$vendorscript" ;;
9484         esac
9485         $cat <<EOM
9486
9487 The installation process will create a directory for
9488 vendor-supplied scripts.
9489
9490 EOM
9491         fn=d~+
9492         rp='Pathname for the vendor-supplied scripts directory?'
9493         . ./getfile
9494         vendorscript="$ans"
9495         vendorscriptexp="$ansexp"
9496         ;;
9497 esac
9498 prefixvar=vendorscript
9499 . ./installprefix
9500
9501 : script used to emit important warnings
9502 cat >warn <<EOS
9503 $startsh
9504 if test \$# -gt 0; then
9505         echo "\$@" >msg
9506 else
9507         cat >msg
9508 fi
9509 echo "*** WARNING:" >&4
9510 sed -e 's/^/*** /' <msg >&4
9511 echo "*** " >&4
9512 cat msg >>config.msg
9513 echo " " >>config.msg
9514 rm -f msg
9515 EOS
9516 chmod +x warn
9517 $eunicefix warn
9518
9519 : see which of string.h or strings.h is needed
9520 echo " "
9521 strings=`./findhdr string.h`
9522 if $test "$strings" && $test -r "$strings"; then
9523         echo "Using <string.h> instead of <strings.h>." >&4
9524         val="$define"
9525 else
9526         val="$undef"
9527         strings=`./findhdr strings.h`
9528         if $test "$strings" && $test -r "$strings"; then
9529                 echo "Using <strings.h> instead of <string.h>." >&4
9530         else
9531                 ./warn "No string header found -- You'll surely have problems."
9532         fi
9533 fi
9534 set i_string
9535 eval $setvar
9536 case "$i_string" in
9537 "$undef") strings=`./findhdr strings.h`;;
9538 *)        strings=`./findhdr string.h`;;
9539 esac
9540
9541 : see if qgcvt exists
9542 set qgcvt d_qgcvt
9543 eval $inlibc
9544
9545 : Check print/scan long double stuff
9546 echo " "
9547
9548 if $test X"$d_longdbl" = X"$define"; then
9549
9550 echo "Checking how to print long doubles..." >&4
9551
9552 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9553         $cat >try.c <<'EOCP'
9554 #include <sys/types.h>
9555 #include <stdio.h>
9556 int main() {
9557   double d = 123.456;
9558   printf("%.3f\n", d);
9559 }
9560 EOCP
9561         set try
9562         if eval $compile; then
9563                 yyy=`$run ./try`
9564                 case "$yyy" in
9565                 123.456)
9566                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9567                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9568                         echo "We will use %f."
9569                         ;;
9570                 esac
9571         fi
9572 fi
9573
9574 if $test X"$sPRIfldbl" = X; then
9575         $cat >try.c <<'EOCP'
9576 #include <sys/types.h>
9577 #include <stdio.h>
9578 int main() {
9579   long double d = 123.456;
9580   printf("%.3Lf\n", d);
9581 }
9582 EOCP
9583         set try
9584         if eval $compile; then
9585                 yyy=`$run ./try`
9586                 case "$yyy" in
9587                 123.456)
9588                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9589                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9590                         echo "We will use %Lf."
9591                         ;;
9592                 esac
9593         fi
9594 fi
9595
9596 if $test X"$sPRIfldbl" = X; then
9597         $cat >try.c <<'EOCP'
9598 #include <sys/types.h>
9599 #include <stdio.h>
9600 int main() {
9601   long double d = 123.456;
9602   printf("%.3llf\n", d);
9603 }
9604 EOCP
9605         set try
9606         if eval $compile; then
9607                 yyy=`$run ./try`
9608                 case "$yyy" in
9609                 123.456)
9610                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9611                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9612                         echo "We will use %llf."
9613                         ;;
9614                 esac
9615         fi
9616 fi
9617
9618 if $test X"$sPRIfldbl" = X; then
9619         $cat >try.c <<'EOCP'
9620 #include <sys/types.h>
9621 #include <stdio.h>
9622 int main() {
9623   long double d = 123.456;
9624   printf("%.3lf\n", d);
9625 }
9626 EOCP
9627         set try
9628         if eval $compile; then
9629                 yyy=`$run ./try`
9630                 case "$yyy" in
9631                 123.456)
9632                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9633                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9634                         echo "We will use %lf."
9635                         ;;
9636                 esac
9637         fi
9638 fi
9639
9640 if $test X"$sPRIfldbl" = X; then
9641         echo "Cannot figure out how to print long doubles." >&4
9642 else
9643         sSCNfldbl=$sPRIfldbl    # expect consistency
9644 fi
9645
9646 $rm_try
9647
9648 fi # d_longdbl
9649
9650 case "$sPRIfldbl" in
9651 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9652         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9653         d_SCNfldbl="$undef";
9654         ;;
9655 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9656         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9657         d_SCNfldbl="$define";
9658         ;;
9659 esac
9660
9661 : Check how to convert floats to strings.
9662
9663 if test "X$d_Gconvert" = X; then
9664
9665 echo " "
9666 echo "Checking for an efficient way to convert floats to strings."
9667 echo " " > try.c
9668 case "$uselongdouble" in
9669 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9670 esac
9671 case "$d_longdbl" in
9672 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9673 esac
9674 case "$d_PRIgldbl" in
9675 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9676 esac
9677 $cat >>try.c <<EOP
9678 #ifdef TRY_gconvert
9679 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9680 char *myname = "gconvert";
9681 #endif
9682 #ifdef TRY_gcvt
9683 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9684 char *myname = "gcvt";
9685 #endif
9686 #ifdef TRY_qgcvt
9687 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9688 char *myname = "qgcvt";
9689 #define DOUBLETYPE long double
9690 #endif
9691 #ifdef TRY_sprintf
9692 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9693 #ifdef HAS_PRIgldbl
9694 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9695 #else
9696 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9697 #endif
9698 #else
9699 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9700 #endif
9701 char *myname = "sprintf";
9702 #endif
9703
9704 #ifndef DOUBLETYPE
9705 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9706 #define DOUBLETYPE long double
9707 #else
9708 #define DOUBLETYPE double
9709 #endif
9710 #endif
9711
9712 #include <stdio.h>
9713
9714 #$i_stdlib I_STDLIB
9715 #ifdef I_STDLIB
9716 #include <stdlib.h>
9717 #endif
9718 #$i_string I_STRING
9719 #ifdef I_STRING
9720 #  include <string.h>
9721 #else
9722 #  include <strings.h>
9723 #endif
9724
9725 int checkit(char *expect, char *got)
9726 {
9727     if (strcmp(expect, got)) {
9728                 printf("%s oddity:  Expected %s, got %s\n",
9729                         myname, expect, got);
9730                 exit(1);
9731         }
9732 }
9733
9734 int main()
9735 {
9736         char buf[64];
9737         buf[63] = '\0';
9738
9739         /* This must be 1st test on (which?) platform */
9740         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9741         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9742         checkit("0.1", buf);
9743
9744         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9745         checkit("0.01", buf);
9746
9747         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9748         checkit("0.001", buf);
9749
9750         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9751         checkit("0.0001", buf);
9752
9753         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9754         if (strlen(buf) > 5)
9755             checkit("9e-005", buf); /* for Microsoft ?? */
9756         else
9757             checkit("9e-05", buf);
9758
9759         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9760         checkit("1", buf);
9761
9762         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9763         checkit("1.1", buf);
9764
9765         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9766         checkit("1.01", buf);
9767
9768         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9769         checkit("1.001", buf);
9770
9771         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9772         checkit("1.0001", buf);
9773
9774         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9775         checkit("1.00001", buf);
9776
9777         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9778         checkit("1.000001", buf);
9779
9780         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9781         checkit("0", buf);
9782
9783         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9784         checkit("-1", 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         /* Some Linux gcvt's give -1.e+5 here. */
9791         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9792         checkit("-100000", buf);
9793
9794         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9795         checkit("123.456", buf);
9796
9797         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9798         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9799         /* 34 should be enough to scare even long double
9800          * places into using the e notation. */
9801         if (strlen(buf) > 5)
9802             checkit("1e+034", buf); /* for Microsoft */
9803         else
9804             checkit("1e+34", buf);
9805
9806         /* For Perl, if you add additional tests here, also add them to
9807          * t/base/num.t for benefit of platforms not using Configure or
9808          * overriding d_Gconvert */
9809
9810         exit(0);
9811 }
9812 EOP
9813 : first add preferred functions to our list
9814 xxx_list=""
9815 for xxx_convert in $gconvert_preference; do
9816     case $xxx_convert in
9817     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9818     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9819     esac
9820 done
9821 : then add any others
9822 for xxx_convert in gconvert gcvt sprintf; do
9823     case "$xxx_list" in
9824     *$xxx_convert*) ;;
9825     *) xxx_list="$xxx_list $xxx_convert" ;;
9826     esac
9827 done
9828
9829 case "$d_longdbl$uselongdouble" in
9830 "$define$define")
9831     : again, add preferred functions to our list first
9832     xxx_ld_list=""
9833     for xxx_convert in $gconvert_ld_preference; do
9834         case $xxx_convert in
9835         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9836         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9837         esac
9838     done
9839     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9840     for xxx_convert in qgcvt sprintf $xxx_list; do
9841         case "$xxx_ld_list" in
9842         $xxx_convert*|*" $xxx_convert"*) ;;
9843         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9844         esac
9845     done
9846     : if sprintf cannot do long doubles, move it to the end
9847     if test "$d_PRIgldbl" != "$define"; then
9848         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9849     fi
9850     : if no qgcvt, remove it
9851     if test "$d_qgcvt" != "$define"; then
9852         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9853     fi
9854     : use the ld_list
9855     xxx_list="$xxx_ld_list"
9856     ;;
9857 esac
9858
9859 for xxx_convert in $xxx_list; do
9860         echo "Trying $xxx_convert..."
9861         $rm -f try try$_o core
9862         set try -DTRY_$xxx_convert
9863         if eval $compile; then
9864                 echo "$xxx_convert() found." >&4
9865                 if $run ./try; then
9866                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9867                         break;
9868                 else
9869                         echo "...But $xxx_convert didn't work as I expected."
9870                         xxx_convert=''
9871                 fi
9872         else
9873                 echo "$xxx_convert NOT found." >&4
9874         fi
9875 done
9876
9877 if test X$xxx_convert = X; then
9878     echo "*** WHOA THERE!!! ***" >&4
9879     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9880     xxx_convert=sprintf
9881 fi
9882
9883 case "$xxx_convert" in
9884 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9885 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9886 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9887 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9888    "$define$define$define")
9889       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9890    "$define$define$undef")
9891       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9892    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9893    esac
9894    ;;
9895 esac
9896
9897 fi
9898 $rm_try
9899
9900 : see if _fwalk exists
9901 set fwalk d__fwalk
9902 eval $inlibc
9903
9904 : Initialize h_fcntl
9905 h_fcntl=false
9906
9907 : Initialize h_sysfile
9908 h_sysfile=false
9909
9910 : access call always available on UNIX
9911 set access d_access
9912 eval $inlibc
9913
9914 : locate the flags for 'access()'
9915 case "$d_access" in
9916 "$define")
9917         echo " "
9918         $cat >access.c <<EOCP
9919 #include <sys/types.h>
9920 #ifdef I_FCNTL
9921 #include <fcntl.h>
9922 #endif
9923 #ifdef I_SYS_FILE
9924 #include <sys/file.h>
9925 #endif
9926 #ifdef I_UNISTD
9927 #include <unistd.h>
9928 #endif
9929 #$i_stdlib I_STDLIB
9930 #ifdef I_STDLIB
9931 #include <stdlib.h>
9932 #endif
9933 int main() {
9934         exit(R_OK);
9935 }
9936 EOCP
9937         : check sys/file.h first, no particular reason here
9938         if $test `./findhdr sys/file.h` && \
9939                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9940                 h_sysfile=true;
9941                 echo "<sys/file.h> defines the *_OK access constants." >&4
9942         elif $test `./findhdr fcntl.h` && \
9943                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9944                 h_fcntl=true;
9945                 echo "<fcntl.h> defines the *_OK access constants." >&4
9946         elif $test `./findhdr unistd.h` && \
9947                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9948                 echo "<unistd.h> defines the *_OK access constants." >&4
9949         else
9950                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9951         fi
9952         ;;
9953 esac
9954 $rm -f access*
9955
9956 : see if accessx exists
9957 set accessx d_accessx
9958 eval $inlibc
9959
9960 : see if aintl exists
9961 set aintl d_aintl
9962 eval $inlibc
9963
9964 : see if alarm exists
9965 set alarm d_alarm
9966 eval $inlibc
9967
9968 : see if 64bit time functions exists
9969
9970 set ctime64 d_ctime64
9971 eval $inlibc
9972
9973 set localtime64 d_localtime64
9974 eval $inlibc
9975
9976 set gmtime64 d_gmtime64
9977 eval $inlibc
9978
9979 set mktime64 d_mktime64
9980 eval $inlibc
9981
9982 set difftime64 d_difftime64
9983 eval $inlibc
9984
9985 set asctime64 d_asctime64
9986 eval $inlibc
9987
9988 : see if POSIX threads are available
9989 set pthread.h i_pthread
9990 eval $inhdr
9991
9992 : define a function to check prototypes
9993 $cat > protochk <<EOSH
9994 $startsh
9995 cc="$cc"
9996 optimize="$optimize"
9997 ccflags="$ccflags"
9998 prototype="$prototype"
9999 define="$define"
10000 rm_try="$rm_try"
10001 usethreads=$usethreads
10002 i_pthread=$i_pthread
10003 pthread_h_first=$pthread_h_first
10004 EOSH
10005
10006 $cat >> protochk <<'EOSH'
10007
10008 $rm_try
10009 foo="$1"
10010 shift
10011 while test $# -ge 2; do
10012         case "$1" in
10013                 $define) echo "#include <$2>" >> try.c ;;
10014                 literal) echo "$2" >> try.c ;;
10015         esac
10016     # Extra magic for the benefit of systems that need pthread.h
10017     # to be included early to correctly detect threadsafe functions.
10018     # Such functions must guarantee themselves, though, that the usethreads
10019     # and i_pthread have been defined, before calling protochk.
10020     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10021         echo "#include <pthread.h>" >> try.c
10022         pthread_h_done=yes
10023     fi
10024     shift 2
10025 done
10026 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10027 cat >> try.c <<'EOCP'
10028 #ifdef CAN_PROTOTYPE
10029 #define _(args) args
10030 #else
10031 #define _(args) ()
10032 #endif
10033 EOCP
10034 echo "$foo" >> try.c
10035 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10036 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10037 status=$?
10038 $rm_try
10039 exit $status
10040 EOSH
10041 chmod +x protochk
10042 $eunicefix protochk
10043
10044 : Define hasproto macro for Configure internal use
10045 hasproto='varname=$1; func=$2; shift; shift;
10046 while $test $# -ge 2; do
10047         case "$1" in
10048         $define) echo "#include <$2>";;
10049         esac ;
10050     shift 2;
10051 done > try.c;
10052 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10053 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10054         echo "$func() prototype found.";
10055         val="$define";
10056 else
10057         echo "$func() prototype NOT found.";
10058         val="$undef";
10059 fi;
10060 set $varname;
10061 eval $setvar;
10062 $rm_try tryout.c'
10063
10064 : see if sys/types.h has to be included
10065 set sys/types.h i_systypes
10066 eval $inhdr
10067
10068 : see if sys/select.h has to be included
10069 set sys/select.h i_sysselct
10070 eval $inhdr
10071
10072 : Define hasfield macro for Configure internal use
10073 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10074 while $test $# -ge 2; do
10075         case "$1" in
10076         $define) echo "#include <$2>";;
10077         esac ;
10078     shift 2;
10079 done > try.c;
10080 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10081 set try;
10082 if eval $compile; then
10083         val="$define";
10084 else
10085         val="$undef";
10086 fi;
10087 set $varname;
10088 eval $setvar;
10089 $rm_try'
10090
10091 : see if we should include time.h, sys/time.h, or both
10092 echo " "
10093 if test "X$timeincl" = X; then
10094         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10095         $echo $n "I'm now running the test program...$c"
10096         $cat >try.c <<EOCP
10097 #include <sys/types.h>
10098 #ifdef I_TIME
10099 #include <time.h>
10100 #endif
10101 #ifdef I_SYSTIME
10102 #ifdef SYSTIMEKERNEL
10103 #define KERNEL
10104 #endif
10105 #include <sys/time.h>
10106 #endif
10107 #ifdef I_SYSSELECT
10108 #include <sys/select.h>
10109 #endif
10110 #$i_stdlib I_STDLIB
10111 #ifdef I_STDLIB
10112 #include <stdlib.h>
10113 #endif
10114 int main()
10115 {
10116         struct tm foo;
10117 #ifdef S_TIMEVAL
10118         struct timeval bar;
10119 #endif
10120 #ifdef S_TIMEZONE
10121         struct timezone tzp;
10122 #endif
10123         if (foo.tm_sec == foo.tm_sec)
10124                 exit(0);
10125 #ifdef S_TIMEVAL
10126         if (bar.tv_sec == bar.tv_sec)
10127                 exit(0);
10128 #endif
10129         exit(1);
10130 }
10131 EOCP
10132         flags=''
10133         for s_timezone in '-DS_TIMEZONE' ''; do
10134         sysselect=''
10135         for s_timeval in '-DS_TIMEVAL' ''; do
10136         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10137         for i_time in '' '-DI_TIME'; do
10138         for i_systime in '-DI_SYSTIME' ''; do
10139                 case "$flags" in
10140                 '') $echo $n ".$c"
10141                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10142                         if eval $compile; then
10143                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10144                                 shift
10145                                 flags="$*"
10146                                 echo " "
10147                                 $echo $n "Succeeded with $flags$c"
10148                         fi
10149                         ;;
10150                 esac
10151         done
10152         done
10153         done
10154         done
10155         done
10156         timeincl=''
10157         echo " "
10158         case "$flags" in
10159         *SYSTIMEKERNEL*) i_systimek="$define"
10160                 timeincl=`./findhdr sys/time.h`
10161                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10162         *) i_systimek="$undef";;
10163         esac
10164         case "$flags" in
10165         *I_TIME*) i_time="$define"
10166                 timeincl=`./findhdr time.h`" $timeincl"
10167                 echo "We'll include <time.h>." >&4;;
10168         *) i_time="$undef";;
10169         esac
10170         case "$flags" in
10171         *I_SYSTIME*) i_systime="$define"
10172                 timeincl=`./findhdr sys/time.h`" $timeincl"
10173                 echo "We'll include <sys/time.h>." >&4;;
10174         *) i_systime="$undef";;
10175         esac
10176         $rm_try
10177 fi
10178 : see if struct tm knows about tm_zone
10179 case "$i_systime$i_time" in
10180 *$define*)
10181         echo " "
10182         echo "Checking to see if your struct tm has tm_zone field..." >&4
10183         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10184         eval $hasfield
10185         ;;
10186 *)      val="$undef"
10187         set d_tm_tm_zone
10188         eval $setvar
10189         ;;
10190 esac
10191 case "$d_tm_tm_zone" in
10192 "$define")      echo "Yes, it does."   ;;
10193 *)              echo "No, it doesn't." ;;
10194 esac
10195 : see if struct tm knows about tm_gmtoff
10196 case "$i_systime$i_time" in
10197 *$define*)
10198         echo " "
10199         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10200         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10201         eval $hasfield
10202         ;;
10203 *)      val="$undef"
10204         set d_tm_tm_gmtoff
10205         eval $setvar
10206         ;;
10207 esac
10208 case "$d_tm_tm_gmtoff" in
10209 "$define")      echo "Yes, it does."   ;;
10210 *)              echo "No, it doesn't." ;;
10211 esac
10212
10213 : see if asctime_r exists
10214 set asctime_r d_asctime_r
10215 eval $inlibc
10216 case "$d_asctime_r" in
10217 "$define")
10218         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10219         case "$d_asctime_r_proto:$usethreads" in
10220         ":define")      d_asctime_r_proto=define
10221                 set d_asctime_r_proto asctime_r $hdrs
10222                 eval $hasproto ;;
10223         *)      ;;
10224         esac
10225         case "$d_asctime_r_proto" in
10226         define)
10227         case "$asctime_r_proto" in
10228         ''|0) try='char* asctime_r(const struct tm*, char*);'
10229         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10230         esac
10231         case "$asctime_r_proto" in
10232         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10233         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10234         esac
10235         case "$asctime_r_proto" in
10236         ''|0) try='int asctime_r(const struct tm*, char*);'
10237         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10238         esac
10239         case "$asctime_r_proto" in
10240         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10241         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10242         esac
10243         case "$asctime_r_proto" in
10244         ''|0)   d_asctime_r=undef
10245                 asctime_r_proto=0
10246                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10247         * )     case "$asctime_r_proto" in
10248                 REENTRANT_PROTO*) ;;
10249                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10250                 esac
10251                 echo "Prototype: $try" ;;
10252         esac
10253         ;;
10254         *)      case "$usethreads" in
10255                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10256                 esac
10257                 d_asctime_r=undef
10258                 asctime_r_proto=0
10259                 ;;
10260         esac
10261         ;;
10262 *)      asctime_r_proto=0
10263         ;;
10264 esac
10265
10266 : see if atolf exists
10267 set atolf d_atolf
10268 eval $inlibc
10269
10270 : see if atoll exists
10271 set atoll d_atoll
10272 eval $inlibc
10273
10274 : Look for GCC-style attribute format
10275 case "$d_attribute_format" in
10276 '')
10277 echo " "
10278 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10279 $cat >attrib.c <<'EOCP'
10280 #include <stdio.h>
10281 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10282 EOCP
10283 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10284         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10285                 echo "Your C compiler doesn't support __attribute__((format))."
10286                 val="$undef"
10287         else
10288                 echo "Your C compiler supports __attribute__((format))."
10289                 val="$define"
10290         fi
10291 else
10292         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10293         val="$undef"
10294 fi
10295 ;;
10296 *) val="$d_attribute_format" ;;
10297 esac
10298 set d_attribute_format
10299 eval $setvar
10300 $rm -f attrib*
10301
10302 : Look for GCC-style attribute format with null format allowed
10303 case "$d_printf_format_null" in
10304 '') case "$d_attribute_format" in
10305     $define)
10306         echo " "
10307         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10308 $cat >attrib.c <<EOCP
10309 #include <stdio.h>
10310 #$i_stdlib I_STDLIB
10311 #ifdef I_STDLIB
10312 #include <stdlib.h>
10313 #endif
10314 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10315 int null_printf (char* pat,...) { return (int)pat; }
10316 int main () { exit(null_printf(NULL)); }
10317 EOCP
10318         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10319             : run the executable in case it produces a run-time warning
10320             if $run ./attrib >>attrib.out 2>&1; then
10321                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10322                     echo "Your C compiler doesn't allow __printf__ format to be null."
10323                     val="$undef"
10324                 else
10325                     echo "Your C compiler allows __printf__ format to be null."
10326                     val="$define"
10327                 fi
10328             else
10329             echo "Your C compiler executable failed with __printf__ format null."
10330             val="$undef"
10331         fi
10332     else
10333         echo "Your C compiler fails with __printf__ format null."
10334         val="$undef"
10335     fi
10336     ;;
10337     *)  val="$undef" ;;
10338     esac
10339 ;;
10340 *)  val="$d_printf_format_null" ;;
10341 esac
10342 set d_printf_format_null
10343 eval $setvar
10344 $rm -f attrib*
10345
10346 : Look for GCC-style attribute malloc
10347 case "$d_attribute_malloc" in
10348 '')
10349 echo " "
10350 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10351 $cat >attrib.c <<'EOCP'
10352 #include <stdio.h>
10353 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10354 EOCP
10355 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10356         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10357                 echo "Your C compiler doesn't support __attribute__((malloc))."
10358                 val="$undef"
10359         else
10360                 echo "Your C compiler supports __attribute__((malloc))."
10361                 val="$define"
10362         fi
10363 else
10364         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10365         val="$undef"
10366 fi
10367 ;;
10368 *) val="$d_attribute_malloc" ;;
10369 esac
10370 set d_attribute_malloc
10371 eval $setvar
10372 $rm -f attrib*
10373
10374 : Look for GCC-style attribute nonnull
10375 case "$d_attribute_nonnull" in
10376 '')
10377 echo " "
10378 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10379 $cat >attrib.c <<'EOCP'
10380 #include <stdio.h>
10381 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10382 EOCP
10383 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10384         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10385                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10386                 val="$undef"
10387         else
10388                 echo "Your C compiler supports __attribute__((nonnull))."
10389                 val="$define"
10390         fi
10391 else
10392         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10393         val="$undef"
10394 fi
10395 ;;
10396 *) val="$d_attribute_nonnull" ;;
10397 esac
10398 set d_attribute_nonnull
10399 eval $setvar
10400 $rm -f attrib*
10401
10402 : Look for GCC-style attribute noreturn
10403 case "$d_attribute_noreturn" in
10404 '')
10405 echo " "
10406 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10407 $cat >attrib.c <<'EOCP'
10408 #include <stdio.h>
10409 void fall_over_dead( void ) __attribute__((noreturn));
10410 EOCP
10411 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10412         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10413                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10414                 val="$undef"
10415         else
10416                 echo "Your C compiler supports __attribute__((noreturn))."
10417                 val="$define"
10418         fi
10419 else
10420         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10421         val="$undef"
10422 fi
10423 ;;
10424 *) val="$d_attribute_noreturn" ;;
10425 esac
10426 set d_attribute_noreturn
10427 eval $setvar
10428 $rm -f attrib*
10429
10430 : Look for GCC-style attribute pure
10431 case "$d_attribute_pure" in
10432 '')
10433 echo " "
10434 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10435 $cat >attrib.c <<'EOCP'
10436 #include <stdio.h>
10437 int square( int n ) __attribute__((pure));
10438 EOCP
10439 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10440         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10441                 echo "Your C compiler doesn't support __attribute__((pure))."
10442                 val="$undef"
10443         else
10444                 echo "Your C compiler supports __attribute__((pure))."
10445                 val="$define"
10446         fi
10447 else
10448         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10449         val="$undef"
10450 fi
10451 ;;
10452 *) val="$d_attribute_pure" ;;
10453 esac
10454 set d_attribute_pure
10455 eval $setvar
10456 $rm -f attrib*
10457
10458 : Look for GCC-style attribute unused
10459 case "$d_attribute_unused" in
10460 '')
10461 echo " "
10462 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10463 $cat >attrib.c <<'EOCP'
10464 #include <stdio.h>
10465 int do_something( int dummy __attribute__((unused)), int n );
10466 EOCP
10467 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10468         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10469                 echo "Your C compiler doesn't support __attribute__((unused))."
10470                 val="$undef"
10471         else
10472                 echo "Your C compiler supports __attribute__((unused))."
10473                 val="$define"
10474         fi
10475 else
10476         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10477         val="$undef"
10478 fi
10479 ;;
10480 *) val="$d_attribute_unused" ;;
10481 esac
10482 set d_attribute_unused
10483 eval $setvar
10484 $rm -f attrib*
10485
10486 : Look for GCC-style attribute deprecated
10487 case "$d_attribute_deprecated" in
10488 '')
10489 echo " "
10490 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10491 $cat >attrib.c <<'EOCP'
10492 #include <stdio.h>
10493 int I_am_deprecated(void) __attribute__((deprecated));
10494 EOCP
10495 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10496         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10497                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10498                 val="$undef"
10499         else
10500                 echo "Your C compiler supports __attribute__((deprecated))."
10501                 val="$define"
10502         fi
10503 else
10504         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10505         val="$undef"
10506 fi
10507 ;;
10508 *) val="$d_attribute_deprecated" ;;
10509 esac
10510 set d_attribute_deprecated
10511 eval $setvar
10512 $rm -f attrib*
10513
10514 : Look for GCC-style attribute warn_unused_result
10515 case "$d_attribute_warn_unused_result" in
10516 '')
10517 echo " "
10518 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10519 $cat >attrib.c <<'EOCP'
10520 #include <stdio.h>
10521 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10522 EOCP
10523 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10524         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10525                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10526                 val="$undef"
10527         else
10528                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10529                 val="$define"
10530         fi
10531 else
10532         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10533         val="$undef"
10534 fi
10535 ;;
10536 *) val="$d_attribute_warn_unused_result" ;;
10537 esac
10538 set d_attribute_warn_unused_result
10539 eval $setvar
10540 $rm -f attrib*
10541
10542 : see if bcmp exists
10543 set bcmp d_bcmp
10544 eval $inlibc
10545
10546 : see if bcopy exists
10547 set bcopy d_bcopy
10548 eval $inlibc
10549
10550 : see if getpgrp exists
10551 set getpgrp d_getpgrp
10552 eval $inlibc
10553
10554 case "$d_getpgrp" in
10555 "$define")
10556         echo " "
10557         echo "Checking to see which flavor of getpgrp is in use..."
10558         $cat >try.c <<EOP
10559 #$i_unistd I_UNISTD
10560 #include <sys/types.h>
10561 #ifdef I_UNISTD
10562 #  include <unistd.h>
10563 #endif
10564 #$i_stdlib I_STDLIB
10565 #ifdef I_STDLIB
10566 #include <stdlib.h>
10567 #endif
10568 int main()
10569 {
10570         if (getuid() == 0) {
10571                 printf("(I see you are running Configure as super-user...)\n");
10572                 setuid(1);
10573         }
10574 #ifdef TRY_BSD_PGRP
10575         if (getpgrp(1) == 0)
10576                 exit(0);
10577 #else
10578         if (getpgrp() > 0)
10579                 exit(0);
10580 #endif
10581         exit(1);
10582 }
10583 EOP
10584         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10585                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10586                 val="$define"
10587         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10588                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10589                 val="$undef"
10590         else
10591                 echo "I can't seem to compile and run the test program."
10592                 if ./usg; then
10593                         xxx="a USG one, i.e. you use getpgrp()."
10594                 else
10595                         # SVR4 systems can appear rather BSD-ish.
10596                         case "$i_unistd" in
10597                         $undef)
10598                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10599                                 val="$define"
10600                                 ;;
10601                         $define)
10602                                 xxx="probably a USG one, i.e. you use getpgrp()."
10603                                 val="$undef"
10604                                 ;;
10605                         esac
10606                 fi
10607                 echo "Assuming your getpgrp is $xxx" >&4
10608         fi
10609         ;;
10610 *) val="$undef";;
10611 esac
10612 set d_bsdgetpgrp
10613 eval $setvar
10614 $rm_try
10615
10616 : see if setpgrp exists
10617 set setpgrp d_setpgrp
10618 eval $inlibc
10619
10620 case "$d_setpgrp" in
10621 "$define")
10622         echo " "
10623         echo "Checking to see which flavor of setpgrp is in use..."
10624         $cat >try.c <<EOP
10625 #$i_unistd I_UNISTD
10626 #include <sys/types.h>
10627 #ifdef I_UNISTD
10628 #  include <unistd.h>
10629 #endif
10630 #$i_stdlib I_STDLIB
10631 #ifdef I_STDLIB
10632 #include <stdlib.h>
10633 #endif
10634 int main()
10635 {
10636         if (getuid() == 0) {
10637                 printf("(I see you are running Configure as super-user...)\n");
10638                 setuid(1);
10639         }
10640 #ifdef TRY_BSD_PGRP
10641         if (-1 == setpgrp(1, 1))
10642                 exit(0);
10643 #else
10644         if (setpgrp() != -1)
10645                 exit(0);
10646 #endif
10647         exit(1);
10648 }
10649 EOP
10650         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10651                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10652                 val="$define"
10653         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10654                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10655                 val="$undef"
10656         else
10657                 echo "(I can't seem to compile and run the test program.)"
10658                 if ./usg; then
10659                         xxx="a USG one, i.e. you use setpgrp()."
10660                 else
10661                         # SVR4 systems can appear rather BSD-ish.
10662                         case "$i_unistd" in
10663                         $undef)
10664                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10665                                 val="$define"
10666                                 ;;
10667                         $define)
10668                                 xxx="probably a USG one, i.e. you use setpgrp()."
10669                                 val="$undef"
10670                                 ;;
10671                         esac
10672                 fi
10673                 echo "Assuming your setpgrp is $xxx" >&4
10674         fi
10675         ;;
10676 *) val="$undef";;
10677 esac
10678 set d_bsdsetpgrp
10679 eval $setvar
10680 $rm_try
10681
10682 : Look for GCC-style __builtin_choose_expr
10683 case "$d_builtin_choose_expr" in
10684 '')
10685     echo " "
10686     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10687     $cat >try.c <<'EOCP'
10688 #include <assert.h>
10689 #include <stdlib.h>
10690 #include <stdio.h>
10691
10692 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10693
10694 int main(void) {
10695     assert( SYRINX(1) == 2112 );
10696     assert( SYRINX(1) != 5150 );
10697     assert( SYRINX(0) == 5150 );
10698     assert( SYRINX(0) != 2112 );
10699     puts( "All good!" );
10700     exit(0);
10701 }
10702
10703 EOCP
10704     set try
10705     if eval $compile && $run ./try; then
10706         echo "Your C compiler supports __builtin_choose_expr."
10707         val="$define"
10708     else
10709         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10710         val="$undef"
10711     fi
10712 ;;
10713 *) val="$d_builtin_choose_expr" ;;
10714 esac
10715
10716 set d_builtin_choose_expr
10717 eval $setvar
10718 $rm_try
10719
10720 : Look for GCC-style __builtin_expect
10721 case "$d_builtin_expect" in
10722 '')
10723     echo " "
10724     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10725     $cat >try.c <<'EOCP'
10726 int main(void) {
10727     int n = 50;
10728     if ( __builtin_expect(n, 0) ) n = 1;
10729     /* Remember shell exit code truth is 0, C truth is non-zero */
10730     return !(n == 1);
10731 }
10732 EOCP
10733     set try
10734     if eval $compile && $run ./try; then
10735         echo "Your C compiler supports __builtin_expect."
10736         val="$define"
10737     else
10738         echo "Your C compiler doesn't seem to understand __builtin_expect."
10739         val="$undef"
10740     fi
10741     ;;
10742 *) val="$d_builtin_expect" ;;
10743 esac
10744
10745 set d_builtin_expect
10746 eval $setvar
10747 $rm_try
10748
10749 : see if bzero exists
10750 set bzero d_bzero
10751 eval $inlibc
10752
10753 : see if stdarg is available
10754 echo " "
10755 if $test `./findhdr stdarg.h`; then
10756         echo "<stdarg.h> found." >&4
10757         valstd="$define"
10758 else
10759         echo "<stdarg.h> NOT found." >&4
10760         valstd="$undef"
10761 fi
10762
10763 : see if varags is available
10764 echo " "
10765 if $test `./findhdr varargs.h`; then
10766         echo "<varargs.h> found." >&4
10767 else
10768         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10769 fi
10770
10771 : set up the varargs testing programs
10772 $cat > varargs.c <<EOP
10773 #ifdef I_STDARG
10774 #include <stdarg.h>
10775 #endif
10776 #ifdef I_VARARGS
10777 #include <varargs.h>
10778 #endif
10779
10780 #ifdef I_STDARG
10781 int f(char *p, ...)
10782 #else
10783 int f(va_alist)
10784 va_dcl
10785 #endif
10786 {
10787         va_list ap;
10788 #ifndef I_STDARG
10789         char *p;
10790 #endif
10791 #ifdef I_STDARG
10792         va_start(ap,p);
10793 #else
10794         va_start(ap);
10795         p = va_arg(ap, char *);
10796 #endif
10797         va_end(ap);
10798         return 0;
10799 }
10800 EOP
10801 $cat > varargs <<EOP
10802 $startsh
10803 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10804         echo "true"
10805 else
10806         echo "false"
10807 fi
10808 $rm -f varargs$_o
10809 EOP
10810 chmod +x varargs
10811
10812 : now check which varargs header should be included
10813 echo " "
10814 i_varhdr=''
10815 case "$valstd" in
10816 "$define")
10817         if `./varargs I_STDARG`; then
10818                 val='stdarg.h'
10819         elif `./varargs I_VARARGS`; then
10820                 val='varargs.h'
10821         fi
10822         ;;
10823 *)
10824         if `./varargs I_VARARGS`; then
10825                 val='varargs.h'
10826         fi
10827         ;;
10828 esac
10829 case "$val" in
10830 '')
10831 echo "I could not find the definition for va_dcl... You have problems..." >&4
10832         val="$undef"; set i_stdarg; eval $setvar
10833         val="$undef"; set i_varargs; eval $setvar
10834         ;;
10835 *)
10836         set i_varhdr
10837         eval $setvar
10838         case "$i_varhdr" in
10839         stdarg.h)
10840                 val="$define"; set i_stdarg; eval $setvar
10841                 val="$undef"; set i_varargs; eval $setvar
10842                 ;;
10843         varargs.h)
10844                 val="$undef"; set i_stdarg; eval $setvar
10845                 val="$define"; set i_varargs; eval $setvar
10846                 ;;
10847         esac
10848         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10849 esac
10850 $rm -f varargs*
10851
10852 : see if the Compiler supports C99 variadic macros
10853 case "$i_stdarg$i_stdlib" in
10854     "$define$define")
10855     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10856     $cat >try.c <<EOCP
10857 #include <stdio.h>
10858 #include <stdarg.h>
10859
10860 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10861
10862 int main() {
10863   char buf[20];
10864   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10865   puts(buf);
10866   return 0;
10867 }
10868 EOCP
10869     set try
10870     if eval $compile && $run ./try 2>&1 >/dev/null; then
10871         case "`$run ./try`" in
10872             "123 456 789")
10873             echo "You have C99 variadic macros." >&4
10874             d_c99_variadic_macros="$define"
10875             ;;
10876             *)
10877             echo "You don't have functional C99 variadic macros." >&4
10878             d_c99_variadic_macros="$undef"
10879             ;;
10880         esac
10881     else
10882         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10883         d_c99_variadic_macros="$undef"
10884     fi
10885     $rm_try
10886     ;;
10887     *)
10888     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10889     d_c99_variadic_macros="$undef"
10890     ;;
10891 esac
10892
10893 : see if signal is declared as pointer to function returning int or void
10894 echo " "
10895 xxx=`./findhdr signal.h`
10896 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10897 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10898         echo "You have int (*signal())() instead of void." >&4
10899         val="$undef"
10900 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10901         echo "You have void (*signal())()." >&4
10902         val="$define"
10903 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10904         echo "You have int (*signal())() instead of void." >&4
10905         val="$undef"
10906 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10907         echo "You have void (*signal())()." >&4
10908         val="$define"
10909 else
10910         case "$d_voidsig" in
10911         '')
10912         echo "I can't determine whether signal handler returns void or int..." >&4
10913                 dflt=void
10914                 rp="What type does your signal handler return?"
10915                 . ./myread
10916                 case "$ans" in
10917                 v*) val="$define";;
10918                 *) val="$undef";;
10919                 esac;;
10920         "$define")
10921                 echo "As you already told me, signal handler returns void." >&4
10922                 val="$define"
10923                 ;;
10924         *)      echo "As you already told me, signal handler returns int." >&4
10925                 val="$undef"
10926                 ;;
10927         esac
10928 fi
10929 set d_voidsig
10930 eval $setvar
10931 case "$d_voidsig" in
10932 "$define") signal_t="void";;
10933 *) signal_t="int";;
10934 esac
10935 $rm -f $$.tmp
10936
10937 : check for ability to cast large floats to 32-bit ints.
10938 echo " "
10939 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10940 if $test "$intsize" -ge 4; then
10941         xxx=int
10942 else
10943         xxx=long
10944 fi
10945 $cat >try.c <<EOCP
10946 #include <stdio.h>
10947 #$i_stdlib I_STDLIB
10948 #ifdef I_STDLIB
10949 #include <stdlib.h>
10950 #endif
10951 #include <sys/types.h>
10952 #include <signal.h>
10953 $signal_t blech(int s) { exit(3); }
10954 int main()
10955 {
10956         $xxx i32;
10957         double f, g;
10958         int result = 0;
10959         char str[16];
10960         signal(SIGFPE, blech);
10961
10962         /* Don't let compiler optimize the test away.  Store the number
10963            in a writable string for gcc to pass to sscanf under HP-UX.
10964         */
10965         sprintf(str, "2147483647");
10966         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10967         g = 10 * f;
10968         i32  = ($xxx) g;
10969
10970         /* x86 processors will probably give 0x8000 0000, which is a
10971            sign change.  We don't want that.  We want to mimic SPARC
10972            behavior here, which is to preserve the sign and give
10973            back 0x7fff ffff.
10974         */
10975         if (i32 != ($xxx) f)
10976                 result |= 1;
10977         exit(result);
10978 }
10979 EOCP
10980 set try
10981 if eval $compile_ok; then
10982         $run ./try
10983         yyy=$?
10984 else
10985         echo "(I can't seem to compile the test program--assuming it can't)"
10986         yyy=1
10987 fi
10988 case "$yyy" in
10989 0)      val="$define"
10990         echo "Yup, it can."
10991         ;;
10992 *)      val="$undef"
10993         echo "Nope, it can't."
10994         ;;
10995 esac
10996 set d_casti32
10997 eval $setvar
10998 $rm_try
10999
11000 : check for ability to cast negative floats to unsigned
11001 echo " "
11002 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11003 $cat >try.c <<EOCP
11004 #include <stdio.h>
11005 #$i_stdlib I_STDLIB
11006 #ifdef I_STDLIB
11007 #include <stdlib.h>
11008 #endif
11009 #include <sys/types.h>
11010 #include <signal.h>
11011 $signal_t blech(int s) { exit(7); }
11012 $signal_t blech_in_list(int s) { exit(4); }
11013 unsigned long dummy_long(unsigned long p) { return p; }
11014 unsigned int dummy_int(unsigned int p) { return p; }
11015 unsigned short dummy_short(unsigned short p) { return p; }
11016 int main()
11017 {
11018         double f;
11019         unsigned long along;
11020         unsigned int aint;
11021         unsigned short ashort;
11022         int result = 0;
11023         char str[16];
11024
11025         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11026            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11027            optimized the whole file away
11028         */
11029         /* Store the number in a writable string for gcc to pass to
11030            sscanf under HP-UX.
11031         */
11032         sprintf(str, "-123");
11033         sscanf(str, "%lf", &f);  /* f = -123.; */
11034
11035         signal(SIGFPE, blech);
11036         along = (unsigned long)f;
11037         aint = (unsigned int)f;
11038         ashort = (unsigned short)f;
11039         if (along != (unsigned long)-123)
11040                 result |= 1;
11041         if (aint != (unsigned int)-123)
11042                 result |= 1;
11043         if (ashort != (unsigned short)-123)
11044                 result |= 1;
11045         sprintf(str, "1073741824.");
11046         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11047         f = f + f;
11048         along = 0;
11049         along = (unsigned long)f;
11050         if (along != 0x80000000)
11051                 result |= 2;
11052         f -= 1.;
11053         along = 0;
11054         along = (unsigned long)f;
11055         if (along != 0x7fffffff)
11056                 result |= 1;
11057         f += 2.;
11058         along = 0;
11059         along = (unsigned long)f;
11060         if (along != 0x80000001)
11061                 result |= 2;
11062         if (result)
11063                 exit(result);
11064         signal(SIGFPE, blech_in_list);
11065         sprintf(str, "123.");
11066         sscanf(str, "%lf", &f);  /* f = 123.; */
11067         along = dummy_long((unsigned long)f);
11068         aint = dummy_int((unsigned int)f);
11069         ashort = dummy_short((unsigned short)f);
11070         if (along != (unsigned long)123)
11071                 result |= 4;
11072         if (aint != (unsigned int)123)
11073                 result |= 4;
11074         if (ashort != (unsigned short)123)
11075                 result |= 4;
11076         exit(result);
11077
11078 }
11079 EOCP
11080 set try
11081 if eval $compile_ok; then
11082         $run ./try
11083         castflags=$?
11084 else
11085         echo "(I can't seem to compile the test program--assuming it can't)"
11086         castflags=7
11087 fi
11088 case "$castflags" in
11089 0)      val="$define"
11090         echo "Yup, it can."
11091         ;;
11092 *)      val="$undef"
11093         echo "Nope, it can't."
11094         ;;
11095 esac
11096 set d_castneg
11097 eval $setvar
11098 $rm_try
11099
11100 : see if vprintf exists
11101 echo " "
11102 if set vprintf val -f d_vprintf; eval $csym; $val; then
11103         echo 'vprintf() found.' >&4
11104         val="$define"
11105         $cat >try.c <<EOF
11106 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11107 #$i_varargs I_VARARGS
11108
11109 #$i_stdlib I_STDLIB
11110 #$i_unistd I_UNISTD
11111
11112 #ifdef I_STDARG
11113 #  include <stdarg.h>
11114 #else /* I_VARARGS */
11115 #  include <varargs.h>
11116 #endif
11117
11118 #ifdef I_UNISTD
11119 #  include <unistd.h>
11120 #endif
11121
11122 #ifdef I_STDLIB
11123 #  include <stdlib.h>
11124 #endif
11125
11126 #include <stdio.h> /* vsprintf prototype */
11127
11128 #ifdef I_STDARG
11129 void xxx(int n, ...)
11130 {
11131     va_list args;
11132     char buf[10];
11133     va_start(args, n);
11134     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11135 }
11136 int main() { xxx(1, "foo"); }
11137
11138 #else /* I_VARARGS */
11139
11140 xxx(va_alist)
11141 va_dcl
11142 {
11143     va_list args;
11144     char buf[10];
11145     va_start(args);
11146     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11147 }
11148 int main() { xxx("foo"); }
11149
11150 #endif
11151
11152 EOF
11153         set try
11154         if eval $compile_ok; then
11155                 if $run ./try; then
11156                         echo "Your vsprintf() returns (int)." >&4
11157                         val2="$undef"
11158                 else
11159                         echo "Your vsprintf() returns (char*)." >&4
11160                         val2="$define"
11161                 fi
11162         else
11163                 echo 'I am unable to compile the vsprintf() test program.' >&4
11164                 # We shouldn't get here.  If we do, assume the standard signature,
11165                 # not the old BSD one.
11166                 echo 'Guessing that vsprintf() returns (int).' >&4
11167                 val2="$undef"
11168         fi
11169 else
11170         echo 'vprintf() NOT found.' >&4
11171         val="$undef"
11172         val2="$undef"
11173 fi
11174 $rm_try
11175 set d_vprintf
11176 eval $setvar
11177 val=$val2
11178 set d_charvspr
11179 eval $setvar
11180
11181 : see if chown exists
11182 set chown d_chown
11183 eval $inlibc
11184
11185 : see if chroot exists
11186 set chroot d_chroot
11187 eval $inlibc
11188
11189 : see if chsize exists
11190 set chsize d_chsize
11191 eval $inlibc
11192
11193 : see if class exists
11194 set class d_class
11195 eval $inlibc
11196
11197 : see if clearenv exists
11198 set clearenv d_clearenv
11199 eval $inlibc
11200
11201 : Define hasstruct macro for Configure internal use
11202 hasstruct='varname=$1; struct=$2; shift; shift;
11203 while $test $# -ge 2; do
11204         case "$1" in
11205         $define) echo "#include <$2>";;
11206         esac ;
11207     shift 2;
11208 done > try.c;
11209 echo "int main () { struct $struct foo; }" >> try.c;
11210 set try;
11211 if eval $compile; then
11212         val="$define";
11213 else
11214         val="$undef";
11215 fi;
11216 set $varname;
11217 eval $setvar;
11218 $rm_try'
11219
11220 : see whether socket exists
11221 socketlib=''
11222 sockethdr=''
11223 echo " "
11224 $echo $n "Hmm... $c" >&4
11225 if set socket val -f d_socket; eval $csym; $val; then
11226         echo "Looks like you have Berkeley networking support." >&4
11227         d_socket="$define"
11228         if set setsockopt val -f; eval $csym; $val; then
11229                 d_oldsock="$undef"
11230         else
11231                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11232                 d_oldsock="$define"
11233         fi
11234 else
11235         if $contains socklib libc.list >/dev/null 2>&1; then
11236                 echo "Looks like you have Berkeley networking support." >&4
11237                 d_socket="$define"
11238                 : we will have to assume that it supports the 4.2 BSD interface
11239                 d_oldsock="$undef"
11240         else
11241                 echo "You don't have Berkeley networking in libc$_a..." >&4
11242                 if test "X$d_socket" = "X$define"; then
11243                    echo "...but you seem to believe that you have sockets." >&4
11244                 else
11245                         for net in net socket
11246                         do
11247                                 if test -f /usr/lib/lib$net$_a; then
11248                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11249                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11250                                         if $contains socket libc.list >/dev/null 2>&1; then
11251                                                 d_socket="$define"
11252                                                 socketlib="-l$net"
11253                                                 case "$net" in
11254                                                 net)
11255                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11256                                                         sockethdr="-I/usr/netinclude"
11257                                                         ;;
11258                                                 esac
11259                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11260                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11261                                                         d_oldsock="$undef"
11262                                                 else
11263                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11264                                                         d_oldsock="$define"
11265                                                 fi
11266                                                 break
11267                                         fi
11268                                 fi
11269                         done
11270                         if test "X$d_socket" != "X$define"; then
11271                            echo "or anywhere else I see." >&4
11272                            d_socket="$undef"
11273                            d_oldsock="$undef"
11274                         fi
11275                 fi
11276         fi
11277 fi
11278
11279 : see if socketpair exists
11280 set socketpair d_sockpair
11281 eval $inlibc
11282
11283
11284 echo " "
11285 echo "Checking the availability sa_len in the sock struct ..." >&4
11286 $cat >try.c <<EOF
11287 #include <sys/types.h>
11288 #include <sys/socket.h>
11289 int main() {
11290 struct sockaddr sa;
11291 return (sa.sa_len);
11292 }
11293 EOF
11294 val="$undef"
11295 set try; if eval $compile; then
11296         val="$define"
11297 fi
11298 set d_sockaddr_sa_len; eval $setvar
11299 $rm_try
11300
11301 echo " "
11302 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11303 $cat >try.c <<EOF
11304 #include <sys/types.h>
11305 #include <sys/socket.h>
11306 #include <netinet/in.h>
11307 int main() {
11308 struct sockaddr_in6 sin6;
11309 return (sin6.sin6_scope_id);
11310 }
11311 EOF
11312 val="$undef"
11313 set try; if eval $compile; then
11314         val="$define"
11315 fi
11316 set d_sin6_scope_id; eval $setvar
11317 $rm_try
11318
11319 echo " "
11320 echo "Checking the availability of certain socket constants..." >&4
11321 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11322         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11323         $cat >try.c <<EOF
11324 #include <sys/types.h>
11325 #include <sys/socket.h>
11326 int main() {
11327     int i = $ENUM;
11328 }
11329 EOF
11330         val="$undef"
11331         set try; if eval $compile; then
11332                 val="$define"
11333         fi
11334         set d_${enum}; eval $setvar
11335         $rm_try
11336 done
11337
11338 : see if this is a sys/uio.h system
11339 set sys/uio.h i_sysuio
11340 eval $inhdr
11341
11342 : Check for cmsghdr support
11343 echo " "
11344 echo "Checking to see if your system supports struct cmsghdr..." >&4
11345 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11346 eval $hasstruct
11347 case "$d_cmsghdr_s" in
11348 "$define")      echo "Yes, it does."   ;;
11349 *)              echo "No, it doesn't." ;;
11350 esac
11351
11352
11353 : check for const keyword
11354 echo " "
11355 echo 'Checking to see if your C compiler knows about "const"...' >&4
11356 $cat >const.c <<'EOCP'
11357 typedef struct spug { int drokk; } spug;
11358 int main()
11359 {
11360         const char *foo;
11361         const spug y = { 0 };
11362 }
11363 EOCP
11364 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11365         val="$define"
11366         echo "Yup, it does."
11367 else
11368         val="$undef"
11369         echo "Nope, it doesn't."
11370 fi
11371 set d_const
11372 eval $setvar
11373
11374 : see if copysignl exists
11375 set copysignl d_copysignl
11376 eval $inlibc
11377
11378 : see if crypt exists
11379 echo " "
11380 set crypt d_crypt
11381 eval $inlibc
11382 case "$d_crypt" in
11383 $define) cryptlib='' ;;
11384 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11385                 echo 'crypt() found.' >&4
11386                 val="$define"
11387                 cryptlib=''
11388         else
11389                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11390                 if $test -z "$cryptlib"; then
11391                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11392                 else
11393                         cryptlib=-lcrypt
11394                 fi
11395                 if $test -z "$cryptlib"; then
11396                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11397                 else
11398                         cryptlib=-lcrypt
11399                 fi
11400                 if $test -z "$cryptlib"; then
11401                         cryptlib=`./loc libcrypt$_a "" $libpth`
11402                 else
11403                         cryptlib=-lcrypt
11404                 fi
11405                 if $test -z "$cryptlib"; then
11406                         echo 'crypt() NOT found.' >&4
11407                         val="$undef"
11408                 else
11409                         val="$define"
11410                 fi
11411         fi
11412         set d_crypt
11413         eval $setvar
11414         ;;
11415 esac
11416
11417 : see if this is a crypt.h system
11418 set crypt.h i_crypt
11419 eval $inhdr
11420
11421 : see if crypt_r exists
11422 set crypt_r d_crypt_r
11423 eval $inlibc
11424 case "$d_crypt_r" in
11425 "$define")
11426         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11427         case "$d_crypt_r_proto:$usethreads" in
11428         ":define")      d_crypt_r_proto=define
11429                 set d_crypt_r_proto crypt_r $hdrs
11430                 eval $hasproto ;;
11431         *)      ;;
11432         esac
11433         case "$d_crypt_r_proto" in
11434         define)
11435         case "$crypt_r_proto" in
11436         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11437         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11438         esac
11439         case "$crypt_r_proto" in
11440         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11441         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11442         esac
11443         case "$crypt_r_proto" in
11444         ''|0)   d_crypt_r=undef
11445                 crypt_r_proto=0
11446                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11447         * )     case "$crypt_r_proto" in
11448                 REENTRANT_PROTO*) ;;
11449                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11450                 esac
11451                 echo "Prototype: $try" ;;
11452         esac
11453         ;;
11454         *)      case "$usethreads" in
11455                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11456                 esac
11457                 d_crypt_r=undef
11458                 crypt_r_proto=0
11459                 ;;
11460         esac
11461         ;;
11462 *)      crypt_r_proto=0
11463         ;;
11464 esac
11465
11466 : get csh whereabouts
11467 case "$csh" in
11468 'csh') val="$undef" ;;
11469 *) val="$define" ;;
11470 esac
11471 set d_csh
11472 eval $setvar
11473 : Respect a hint or command line value for full_csh.
11474 case "$full_csh" in
11475 '') full_csh=$csh ;;
11476 esac
11477
11478 : see if ctermid exists
11479 set ctermid d_ctermid
11480 eval $inlibc
11481
11482 : see if ctermid_r exists
11483 set ctermid_r d_ctermid_r
11484 eval $inlibc
11485 case "$d_ctermid_r" in
11486 "$define")
11487         hdrs="$i_systypes sys/types.h define stdio.h "
11488         case "$d_ctermid_r_proto:$usethreads" in
11489         ":define")      d_ctermid_r_proto=define
11490                 set d_ctermid_r_proto ctermid_r $hdrs
11491                 eval $hasproto ;;
11492         *)      ;;
11493         esac
11494         case "$d_ctermid_r_proto" in
11495         define)
11496         case "$ctermid_r_proto" in
11497         ''|0) try='char* ctermid_r(char*);'
11498         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11499         esac
11500         case "$ctermid_r_proto" in
11501         ''|0)   d_ctermid_r=undef
11502                 ctermid_r_proto=0
11503                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11504         * )     case "$ctermid_r_proto" in
11505                 REENTRANT_PROTO*) ;;
11506                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11507                 esac
11508                 echo "Prototype: $try" ;;
11509         esac
11510         ;;
11511         *)      case "$usethreads" in
11512                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11513                 esac
11514                 d_ctermid_r=undef
11515                 ctermid_r_proto=0
11516                 ;;
11517         esac
11518         ;;
11519 *)      ctermid_r_proto=0
11520         ;;
11521 esac
11522
11523 : see if ctime_r exists
11524 set ctime_r d_ctime_r
11525 eval $inlibc
11526 case "$d_ctime_r" in
11527 "$define")
11528         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11529         case "$d_ctime_r_proto:$usethreads" in
11530         ":define")      d_ctime_r_proto=define
11531                 set d_ctime_r_proto ctime_r $hdrs
11532                 eval $hasproto ;;
11533         *)      ;;
11534         esac
11535         case "$d_ctime_r_proto" in
11536         define)
11537         case "$ctime_r_proto" in
11538         ''|0) try='char* ctime_r(const time_t*, char*);'
11539         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11540         esac
11541         case "$ctime_r_proto" in
11542         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11543         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11544         esac
11545         case "$ctime_r_proto" in
11546         ''|0) try='int ctime_r(const time_t*, char*);'
11547         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11548         esac
11549         case "$ctime_r_proto" in
11550         ''|0) try='int ctime_r(const time_t*, char*, int);'
11551         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11552         esac
11553         case "$ctime_r_proto" in
11554         ''|0)   d_ctime_r=undef
11555                 ctime_r_proto=0
11556                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11557         * )     case "$ctime_r_proto" in
11558                 REENTRANT_PROTO*) ;;
11559                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11560                 esac
11561                 echo "Prototype: $try" ;;
11562         esac
11563         ;;
11564         *)      case "$usethreads" in
11565                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11566                 esac
11567                 d_ctime_r=undef
11568                 ctime_r_proto=0
11569                 ;;
11570         esac
11571         ;;
11572 *)      ctime_r_proto=0
11573         ;;
11574 esac
11575
11576 : see if cuserid exists
11577 set cuserid d_cuserid
11578 eval $inlibc
11579
11580 : see if this is a limits.h system
11581 set limits.h i_limits
11582 eval $inhdr
11583
11584 : see if this is a float.h system
11585 set float.h i_float
11586 eval $inhdr
11587
11588 : See if number of significant digits in a double precision number is known
11589 echo " "
11590 $cat >dbl_dig.c <<EOM
11591 #$i_limits I_LIMITS
11592 #$i_float I_FLOAT
11593 #ifdef I_LIMITS
11594 #include <limits.h>
11595 #endif
11596 #ifdef I_FLOAT
11597 #include <float.h>
11598 #endif
11599 #ifdef DBL_DIG
11600 printf("Contains DBL_DIG");
11601 #endif
11602 EOM
11603 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11604 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11605         echo "DBL_DIG found." >&4
11606         val="$define"
11607 else
11608         echo "DBL_DIG NOT found." >&4
11609         val="$undef"
11610 fi
11611 $rm -f dbl_dig.?
11612 set d_dbl_dig
11613 eval $setvar
11614
11615 : see if dbm.h is available
11616 : see if dbmclose exists
11617 set dbmclose d_dbmclose
11618 eval $inlibc
11619
11620 case "$d_dbmclose" in
11621 $define)
11622         set dbm.h i_dbm
11623         eval $inhdr
11624         case "$i_dbm" in
11625         $define)
11626                 val="$undef"
11627                 set i_rpcsvcdbm
11628                 eval $setvar
11629                 ;;
11630         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11631                 eval $inhdr
11632                 ;;
11633         esac
11634         ;;
11635 *)      echo "We won't be including <dbm.h>"
11636         val="$undef"
11637         set i_dbm
11638         eval $setvar
11639         val="$undef"
11640         set i_rpcsvcdbm
11641         eval $setvar
11642         ;;
11643 esac
11644
11645 : see if prototype for dbminit is available
11646 echo " "
11647 set d_dbminitproto dbminit $i_dbm dbm.h
11648 eval $hasproto
11649
11650 : see if difftime exists
11651 set difftime d_difftime
11652 eval $inlibc
11653
11654 : see if this is a dirent system
11655 echo " "
11656 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11657         val="$define"
11658         echo "<dirent.h> found." >&4
11659 else
11660         val="$undef"
11661         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11662                 echo "<sys/dir.h> found." >&4
11663                 echo " "
11664         else
11665                 xinc=`./findhdr sys/ndir.h`
11666         fi
11667         echo "<dirent.h> NOT found." >&4
11668 fi
11669 set i_dirent
11670 eval $setvar
11671
11672 : Look for type of directory structure.
11673 echo " "
11674 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11675
11676 case "$direntrytype" in
11677 ''|' ')
11678         case "$i_dirent" in
11679         $define) guess1='struct dirent' ;;
11680         *) guess1='struct direct'  ;;
11681         esac
11682         ;;
11683 *)      guess1="$direntrytype"
11684         ;;
11685 esac
11686
11687 case "$guess1" in
11688 'struct dirent') guess2='struct direct' ;;
11689 *) guess2='struct dirent' ;;
11690 esac
11691
11692 if $contains "$guess1" try.c >/dev/null 2>&1; then
11693         direntrytype="$guess1"
11694         echo "Your directory entries are $direntrytype." >&4
11695 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11696         direntrytype="$guess2"
11697         echo "Your directory entries seem to be $direntrytype." >&4
11698 else
11699         echo "I don't recognize your system's directory entries." >&4
11700         rp="What type is used for directory entries on this system?"
11701         dflt="$guess1"
11702         . ./myread
11703         direntrytype="$ans"
11704 fi
11705 $rm_try
11706
11707 : see if the directory entry stores field length
11708 echo " "
11709 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11710 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11711         echo "Good, your directory entry keeps length information in d_namlen." >&4
11712         val="$define"
11713 else
11714         echo "Your directory entry does not know about the d_namlen field." >&4
11715         val="$undef"
11716 fi
11717 set d_dirnamlen
11718 eval $setvar
11719 $rm_try
11720
11721 : Look for DIR.dd_fd
11722 case "$i_dirent" in
11723 "$define")
11724     echo "Checking to see if DIR has a dd_fd member variable" >&4
11725     $cat >try.c <<EOCP
11726 #$i_stdlib I_STDLIB
11727 #ifdef I_STDLIB
11728 #include <stdlib.h>
11729 #endif
11730 #include <dirent.h>
11731
11732 int main() {
11733     DIR dir;
11734     dir.dd_fd = 1;
11735     return 0;
11736 }
11737 EOCP
11738     val=$undef
11739     set try
11740     if eval $compile; then
11741         echo "Yes, it does."
11742         val="$define"
11743     else
11744         echo "No, it does not."
11745         val="$undef"
11746     fi
11747     ;;
11748 *)
11749     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11750     val="$undef"
11751     ;;
11752 esac
11753 set d_dir_dd_fd
11754 eval $setvar
11755 $rm_try
11756
11757 : see if this is an sysdir system
11758 set sys/dir.h i_sysdir
11759 eval $inhdr
11760
11761 : see if this is an sysndir system
11762 set sys/ndir.h i_sysndir
11763 eval $inhdr
11764
11765 : Look for dirfd
11766 echo " "
11767 $cat >dirfd.c <<EOM
11768 #include <stdio.h>
11769 #$i_stdlib I_STDLIB
11770 #ifdef I_STDLIB
11771 #include <stdlib.h>
11772 #endif
11773 #$i_dirent I_DIRENT             /**/
11774 #$i_sysdir I_SYS_DIR            /**/
11775 #$i_sysndir I_SYS_NDIR          /**/
11776 #$i_systypes I_SYS_TYPES        /**/
11777 #if defined(I_SYS_TYPES)
11778 #include <sys/types.h>
11779 #endif
11780 #if defined(I_DIRENT)
11781 #include <dirent.h>
11782 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11783 #include <sys/dir.h>
11784 #endif
11785 #else
11786 #ifdef I_SYS_NDIR
11787 #include <sys/ndir.h>
11788 #else
11789 #ifdef I_SYS_DIR
11790 #ifdef hp9000s500
11791 #include <ndir.h>       /* may be wrong in the future */
11792 #else
11793 #include <sys/dir.h>
11794 #endif
11795 #endif
11796 #endif
11797 #endif 
11798 int main() {
11799         DIR *dirp = opendir(".");
11800         if (dirfd(dirp) >= 0)
11801                 exit(0);
11802         else
11803                 exit(1);
11804 }
11805 EOM
11806 val=$undef
11807 set dirfd
11808 if eval $compile; then
11809         val="$define"
11810 fi
11811 case "$val" in
11812 $define)        echo "dirfd() found." >&4       ;;
11813 *)              echo "dirfd() NOT found." >&4   ;;
11814 esac
11815 set d_dirfd
11816 eval $setvar
11817 $rm -f dirfd*
11818
11819 : see if dlerror exists
11820 xxx_runnm="$runnm"
11821 runnm=false
11822 set dlerror d_dlerror
11823 eval $inlibc
11824 runnm="$xxx_runnm"
11825
11826 : see if dlfcn is available
11827 set dlfcn.h i_dlfcn
11828 eval $inhdr
11829
11830 : Check what extension to use for shared libs
11831 case "$usedl" in
11832 $define|y|true)
11833         $cat << EOM
11834
11835 On a few systems, the dynamically loaded modules that perl generates and uses
11836 will need a different extension than shared libs. The default will probably
11837 be appropriate.
11838
11839 EOM
11840         case "$dlext" in
11841         '')     dflt="$so" ;;
11842         *)      dflt="$dlext" ;;
11843         esac
11844         rp='What is the extension of dynamically loaded modules'
11845         . ./myread
11846         dlext="$ans"
11847         ;;
11848 *)
11849         dlext="none"
11850         ;;
11851 esac
11852
11853 : Check if dlsym need a leading underscore
11854 echo " "
11855 val="$undef"
11856
11857 case "$dlsrc" in
11858 dl_dlopen.xs)
11859         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11860         $cat >dyna.c <<'EOM'
11861 fred () { }
11862 EOM
11863
11864 $cat >fred.c<<EOM
11865
11866 #include <stdio.h>
11867 #$i_stdlib I_STDLIB
11868 #ifdef I_STDLIB
11869 #include <stdlib.h>
11870 #endif
11871 #$i_dlfcn I_DLFCN
11872 #ifdef I_DLFCN
11873 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11874 #else
11875 #include <sys/types.h>
11876 #include <nlist.h>
11877 #include <link.h>
11878 #endif
11879
11880 extern int fred() ;
11881
11882 int main()
11883 {
11884     void * handle ;
11885     void * symbol ;
11886 #ifndef RTLD_LAZY
11887     int mode = 1 ;
11888 #else
11889     int mode = RTLD_LAZY ;
11890 #endif
11891     handle = dlopen("./dyna.$dlext", mode) ;
11892     if (handle == NULL) {
11893         printf ("1\n") ;
11894         fflush (stdout) ;
11895         exit(0);
11896     }
11897     symbol = dlsym(handle, "fred") ;
11898     if (symbol == NULL) {
11899         /* try putting a leading underscore */
11900         symbol = dlsym(handle, "_fred") ;
11901         if (symbol == NULL) {
11902             printf ("2\n") ;
11903             fflush (stdout) ;
11904             exit(0);
11905         }
11906         printf ("3\n") ;
11907     }
11908     else
11909         printf ("4\n") ;
11910     fflush (stdout) ;
11911     exit(0);
11912 }
11913 EOM
11914         : Call the object file tmp-dyna.o in case dlext=o.
11915         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11916                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11917                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11918                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11919                 xxx=`$run ./fred`
11920                 case $xxx in
11921                 1)      echo "Test program failed using dlopen." >&4
11922                         echo "Perhaps you should not use dynamic loading." >&4;;
11923                 2)      echo "Test program failed using dlsym." >&4
11924                         echo "Perhaps you should not use dynamic loading." >&4;;
11925                 3)      echo "dlsym needs a leading underscore" >&4
11926                         val="$define" ;;
11927                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11928                 esac
11929         else
11930                 echo "I can't compile and run the test program." >&4
11931                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11932         fi
11933         ;;
11934 esac
11935
11936 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11937
11938 set d_dlsymun
11939 eval $setvar
11940
11941 : see if drand48_r exists
11942 set drand48_r d_drand48_r
11943 eval $inlibc
11944 case "$d_drand48_r" in
11945 "$define")
11946         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11947         case "$d_drand48_r_proto:$usethreads" in
11948         ":define")      d_drand48_r_proto=define
11949                 set d_drand48_r_proto drand48_r $hdrs
11950                 eval $hasproto ;;
11951         *)      ;;
11952         esac
11953         case "$d_drand48_r_proto" in
11954         define)
11955         case "$drand48_r_proto" in
11956         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11957         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11958         esac
11959         case "$drand48_r_proto" in
11960         ''|0)   d_drand48_r=undef
11961                 drand48_r_proto=0
11962                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11963         * )     case "$drand48_r_proto" in
11964                 REENTRANT_PROTO*) ;;
11965                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11966                 esac
11967                 echo "Prototype: $try" ;;
11968         esac
11969         ;;
11970         *)      case "$usethreads" in
11971                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11972                 esac
11973                 d_drand48_r=undef
11974                 drand48_r_proto=0
11975                 ;;
11976         esac
11977         ;;
11978 *)      drand48_r_proto=0
11979         ;;
11980 esac
11981
11982 : see if prototype for drand48 is available
11983 echo " "
11984 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11985 eval $hasproto
11986
11987 : see if dup2 exists
11988 set dup2 d_dup2
11989 eval $inlibc
11990
11991 : see if eaccess exists
11992 set eaccess d_eaccess
11993 eval $inlibc
11994
11995 : see if endgrent exists
11996 set endgrent d_endgrent
11997 eval $inlibc
11998
11999 : see if this is an grp system
12000 set grp.h i_grp
12001 eval $inhdr
12002
12003 case "$i_grp" in
12004 $define)
12005         xxx=`./findhdr grp.h`
12006         $cppstdin $cppflags $cppminus < $xxx >$$.h
12007
12008         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12009                 val="$define"
12010         else
12011                 val="$undef"
12012         fi
12013         set d_grpasswd
12014         eval $setvar
12015
12016         $rm -f $$.h
12017         ;;
12018 *)
12019         val="$undef";
12020         set d_grpasswd; eval $setvar
12021         ;;
12022 esac
12023
12024 : see if endgrent_r exists
12025 set endgrent_r d_endgrent_r
12026 eval $inlibc
12027 case "$d_endgrent_r" in
12028 "$define")
12029         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12030         case "$d_endgrent_r_proto:$usethreads" in
12031         ":define")      d_endgrent_r_proto=define
12032                 set d_endgrent_r_proto endgrent_r $hdrs
12033                 eval $hasproto ;;
12034         *)      ;;
12035         esac
12036         case "$d_endgrent_r_proto" in
12037         define)
12038         case "$endgrent_r_proto" in
12039         ''|0) try='int endgrent_r(FILE**);'
12040         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12041         esac
12042         case "$endgrent_r_proto" in
12043         ''|0) try='void endgrent_r(FILE**);'
12044         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12045         esac
12046         case "$endgrent_r_proto" in
12047         ''|0)   d_endgrent_r=undef
12048                 endgrent_r_proto=0
12049                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12050         * )     case "$endgrent_r_proto" in
12051                 REENTRANT_PROTO*) ;;
12052                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12053                 esac
12054                 echo "Prototype: $try" ;;
12055         esac
12056         ;;
12057         *)      case "$usethreads" in
12058                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12059                 esac
12060                 d_endgrent_r=undef
12061                 endgrent_r_proto=0
12062                 ;;
12063         esac
12064         ;;
12065 *)      endgrent_r_proto=0
12066         ;;
12067 esac
12068
12069 : see if endhostent exists
12070 set endhostent d_endhent
12071 eval $inlibc
12072
12073 : see if this is a netdb.h system
12074 set netdb.h i_netdb
12075 eval $inhdr
12076
12077 : see if endhostent_r exists
12078 set endhostent_r d_endhostent_r
12079 eval $inlibc
12080 case "$d_endhostent_r" in
12081 "$define")
12082         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12083         case "$d_endhostent_r_proto:$usethreads" in
12084         ":define")      d_endhostent_r_proto=define
12085                 set d_endhostent_r_proto endhostent_r $hdrs
12086                 eval $hasproto ;;
12087         *)      ;;
12088         esac
12089         case "$d_endhostent_r_proto" in
12090         define)
12091         case "$endhostent_r_proto" in
12092         ''|0) try='int endhostent_r(struct hostent_data*);'
12093         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12094         esac
12095         case "$endhostent_r_proto" in
12096         ''|0) try='void endhostent_r(struct hostent_data*);'
12097         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12098         esac
12099         case "$endhostent_r_proto" in
12100         ''|0)   d_endhostent_r=undef
12101                 endhostent_r_proto=0
12102                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12103         * )     case "$endhostent_r_proto" in
12104                 REENTRANT_PROTO*) ;;
12105                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12106                 esac
12107                 echo "Prototype: $try" ;;
12108         esac
12109         ;;
12110         *)      case "$usethreads" in
12111                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12112                 esac
12113                 d_endhostent_r=undef
12114                 endhostent_r_proto=0
12115                 ;;
12116         esac
12117         ;;
12118 *)      endhostent_r_proto=0
12119         ;;
12120 esac
12121
12122 : see if endnetent exists
12123 set endnetent d_endnent
12124 eval $inlibc
12125
12126 : see if endnetent_r exists
12127 set endnetent_r d_endnetent_r
12128 eval $inlibc
12129 case "$d_endnetent_r" in
12130 "$define")
12131         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12132         case "$d_endnetent_r_proto:$usethreads" in
12133         ":define")      d_endnetent_r_proto=define
12134                 set d_endnetent_r_proto endnetent_r $hdrs
12135                 eval $hasproto ;;
12136         *)      ;;
12137         esac
12138         case "$d_endnetent_r_proto" in
12139         define)
12140         case "$endnetent_r_proto" in
12141         ''|0) try='int endnetent_r(struct netent_data*);'
12142         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12143         esac
12144         case "$endnetent_r_proto" in
12145         ''|0) try='void endnetent_r(struct netent_data*);'
12146         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12147         esac
12148         case "$endnetent_r_proto" in
12149         ''|0)   d_endnetent_r=undef
12150                 endnetent_r_proto=0
12151                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12152         * )     case "$endnetent_r_proto" in
12153                 REENTRANT_PROTO*) ;;
12154                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12155                 esac
12156                 echo "Prototype: $try" ;;
12157         esac
12158         ;;
12159         *)      case "$usethreads" in
12160                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12161                 esac
12162                 d_endnetent_r=undef
12163                 endnetent_r_proto=0
12164                 ;;
12165         esac
12166         ;;
12167 *)      endnetent_r_proto=0
12168         ;;
12169 esac
12170
12171 : see if endprotoent exists
12172 set endprotoent d_endpent
12173 eval $inlibc
12174
12175 : see if endprotoent_r exists
12176 set endprotoent_r d_endprotoent_r
12177 eval $inlibc
12178 case "$d_endprotoent_r" in
12179 "$define")
12180         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12181         case "$d_endprotoent_r_proto:$usethreads" in
12182         ":define")      d_endprotoent_r_proto=define
12183                 set d_endprotoent_r_proto endprotoent_r $hdrs
12184                 eval $hasproto ;;
12185         *)      ;;
12186         esac
12187         case "$d_endprotoent_r_proto" in
12188         define)
12189         case "$endprotoent_r_proto" in
12190         ''|0) try='int endprotoent_r(struct protoent_data*);'
12191         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12192         esac
12193         case "$endprotoent_r_proto" in
12194         ''|0) try='void endprotoent_r(struct protoent_data*);'
12195         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12196         esac
12197         case "$endprotoent_r_proto" in
12198         ''|0)   d_endprotoent_r=undef
12199                 endprotoent_r_proto=0
12200                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12201         * )     case "$endprotoent_r_proto" in
12202                 REENTRANT_PROTO*) ;;
12203                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12204                 esac
12205                 echo "Prototype: $try" ;;
12206         esac
12207         ;;
12208         *)      case "$usethreads" in
12209                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12210                 esac
12211                 d_endprotoent_r=undef
12212                 endprotoent_r_proto=0
12213                 ;;
12214         esac
12215         ;;
12216 *)      endprotoent_r_proto=0
12217         ;;
12218 esac
12219
12220 : see if endpwent exists
12221 set endpwent d_endpwent
12222 eval $inlibc
12223
12224 : see if this is a pwd.h system
12225 set pwd.h i_pwd
12226 eval $inhdr
12227
12228 case "$i_pwd" in
12229 $define)
12230         xxx=`./findhdr pwd.h`
12231         $cppstdin $cppflags $cppminus < $xxx >$$.h
12232
12233         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12234                 val="$define"
12235         else
12236                 val="$undef"
12237         fi
12238         set d_pwquota
12239         eval $setvar
12240
12241         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12242                 val="$define"
12243         else
12244                 val="$undef"
12245         fi
12246         set d_pwage
12247         eval $setvar
12248
12249         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12250                 val="$define"
12251         else
12252                 val="$undef"
12253         fi
12254         set d_pwchange
12255         eval $setvar
12256
12257         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12258                 val="$define"
12259         else
12260                 val="$undef"
12261         fi
12262         set d_pwclass
12263         eval $setvar
12264
12265         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12266                 val="$define"
12267         else
12268                 val="$undef"
12269         fi
12270         set d_pwexpire
12271         eval $setvar
12272
12273         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12274                 val="$define"
12275         else
12276                 val="$undef"
12277         fi
12278         set d_pwcomment
12279         eval $setvar
12280
12281         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12282                 val="$define"
12283         else
12284                 val="$undef"
12285         fi
12286         set d_pwgecos
12287         eval $setvar
12288
12289         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12290                 val="$define"
12291         else
12292                 val="$undef"
12293         fi
12294         set d_pwpasswd
12295         eval $setvar
12296
12297         $rm -f $$.h
12298         ;;
12299 *)
12300         val="$undef"; 
12301         set d_pwquota; eval $setvar
12302         set d_pwage; eval $setvar
12303         set d_pwchange; eval $setvar
12304         set d_pwclass; eval $setvar
12305         set d_pwexpire; eval $setvar
12306         set d_pwcomment; eval $setvar
12307         set d_pwgecos; eval $setvar
12308         set d_pwpasswd; eval $setvar
12309         ;;
12310 esac
12311
12312 : see if endpwent_r exists
12313 set endpwent_r d_endpwent_r
12314 eval $inlibc
12315 case "$d_endpwent_r" in
12316 "$define")
12317         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12318         case "$d_endpwent_r_proto:$usethreads" in
12319         ":define")      d_endpwent_r_proto=define
12320                 set d_endpwent_r_proto endpwent_r $hdrs
12321                 eval $hasproto ;;
12322         *)      ;;
12323         esac
12324         case "$d_endpwent_r_proto" in
12325         define)
12326         case "$endpwent_r_proto" in
12327         ''|0) try='int endpwent_r(FILE**);'
12328         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12329         esac
12330         case "$endpwent_r_proto" in
12331         ''|0) try='void endpwent_r(FILE**);'
12332         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12333         esac
12334         case "$endpwent_r_proto" in
12335         ''|0)   d_endpwent_r=undef
12336                 endpwent_r_proto=0
12337                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12338         * )     case "$endpwent_r_proto" in
12339                 REENTRANT_PROTO*) ;;
12340                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12341                 esac
12342                 echo "Prototype: $try" ;;
12343         esac
12344         ;;
12345         *)      case "$usethreads" in
12346                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12347                 esac
12348                 d_endpwent_r=undef
12349                 endpwent_r_proto=0
12350                 ;;
12351         esac
12352         ;;
12353 *)      endpwent_r_proto=0
12354         ;;
12355 esac
12356
12357 : see if endservent exists
12358 set endservent d_endsent
12359 eval $inlibc
12360
12361 : see if endservent_r exists
12362 set endservent_r d_endservent_r
12363 eval $inlibc
12364 case "$d_endservent_r" in
12365 "$define")
12366         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12367         case "$d_endservent_r_proto:$usethreads" in
12368         ":define")      d_endservent_r_proto=define
12369                 set d_endservent_r_proto endservent_r $hdrs
12370                 eval $hasproto ;;
12371         *)      ;;
12372         esac
12373         case "$d_endservent_r_proto" in
12374         define)
12375         case "$endservent_r_proto" in
12376         ''|0) try='int endservent_r(struct servent_data*);'
12377         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12378         esac
12379         case "$endservent_r_proto" in
12380         ''|0) try='void endservent_r(struct servent_data*);'
12381         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12382         esac
12383         case "$endservent_r_proto" in
12384         ''|0)   d_endservent_r=undef
12385                 endservent_r_proto=0
12386                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12387         * )     case "$endservent_r_proto" in
12388                 REENTRANT_PROTO*) ;;
12389                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12390                 esac
12391                 echo "Prototype: $try" ;;
12392         esac
12393         ;;
12394         *)      case "$usethreads" in
12395                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12396                 esac
12397                 d_endservent_r=undef
12398                 endservent_r_proto=0
12399                 ;;
12400         esac
12401         ;;
12402 *)      endservent_r_proto=0
12403         ;;
12404 esac
12405
12406 : Locate the flags for 'open()'
12407 echo " "
12408 $cat >try.c <<EOCP
12409 #include <sys/types.h>
12410 #ifdef I_FCNTL
12411 #include <fcntl.h>
12412 #endif
12413 #ifdef I_SYS_FILE
12414 #include <sys/file.h>
12415 #endif
12416 #$i_stdlib I_STDLIB
12417 #ifdef I_STDLIB
12418 #include <stdlib.h>
12419 #endif
12420 int main() {
12421         if(O_RDONLY);
12422 #ifdef O_TRUNC
12423         exit(0);
12424 #else
12425         exit(1);
12426 #endif
12427 }
12428 EOCP
12429 : check sys/file.h first to get FREAD on Sun
12430 if $test `./findhdr sys/file.h` && \
12431                 set try -DI_SYS_FILE && eval $compile; then
12432         h_sysfile=true;
12433         echo "<sys/file.h> defines the O_* constants..." >&4
12434         if $run ./try; then
12435                 echo "and you have the 3 argument form of open()." >&4
12436                 val="$define"
12437         else
12438                 echo "but not the 3 argument form of open().  Oh, well." >&4
12439                 val="$undef"
12440         fi
12441 elif $test `./findhdr fcntl.h` && \
12442                 set try -DI_FCNTL && eval $compile; then
12443         h_fcntl=true;
12444         echo "<fcntl.h> defines the O_* constants..." >&4
12445         if $run ./try; then
12446                 echo "and you have the 3 argument form of open()." >&4
12447                 val="$define"
12448         else
12449                 echo "but not the 3 argument form of open().  Oh, well." >&4
12450                 val="$undef"
12451         fi
12452 else
12453         val="$undef"
12454         echo "I can't find the O_* constant definitions!  You got problems." >&4
12455 fi
12456 set d_open3
12457 eval $setvar
12458 $rm_try
12459
12460 : see if this is a sys/file.h system
12461 val=''
12462 set sys/file.h val
12463 eval $inhdr
12464
12465 : do we need to include sys/file.h ?
12466 case "$val" in
12467 "$define")
12468         echo " "
12469         if $h_sysfile; then
12470                 val="$define"
12471                 echo "We'll be including <sys/file.h>." >&4
12472         else
12473                 val="$undef"
12474                 echo "We won't be including <sys/file.h>." >&4
12475         fi
12476         ;;
12477 *)
12478         h_sysfile=false
12479         ;;
12480 esac
12481 set i_sysfile
12482 eval $setvar
12483
12484 : see if fcntl.h is there
12485 val=''
12486 set fcntl.h val
12487 eval $inhdr
12488
12489 : see if we can include fcntl.h
12490 case "$val" in
12491 "$define")
12492         echo " "
12493         if $h_fcntl; then
12494                 val="$define"
12495                 echo "We'll be including <fcntl.h>." >&4
12496         else
12497                 val="$undef"
12498                 if $h_sysfile; then
12499         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12500                 else
12501                         echo "We won't be including <fcntl.h>." >&4
12502                 fi
12503         fi
12504         ;;
12505 *)
12506         h_fcntl=false
12507         val="$undef"
12508         ;;
12509 esac
12510 set i_fcntl
12511 eval $setvar
12512
12513 : see if fork exists
12514 set fork d_fork
12515 eval $inlibc
12516
12517 : see if pipe exists
12518 set pipe d_pipe
12519 eval $inlibc
12520
12521 : check for non-blocking I/O stuff
12522 case "$h_sysfile" in
12523 true) echo "#include <sys/file.h>" > head.c;;
12524 *)
12525        case "$h_fcntl" in
12526        true) echo "#include <fcntl.h>" > head.c;;
12527        *) echo "#include <sys/fcntl.h>" > head.c;;
12528        esac
12529        ;;
12530 esac
12531 echo " "
12532 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12533 case "$o_nonblock" in
12534 '')
12535         $cat head.c > try.c
12536         $cat >>try.c <<EOCP
12537 #include <stdio.h>
12538 #$i_stdlib I_STDLIB
12539 #ifdef I_STDLIB
12540 #include <stdlib.h>
12541 #endif
12542 #$i_fcntl I_FCNTL
12543 #ifdef I_FCNTL
12544 #include <fcntl.h>
12545 #endif
12546 int main() {
12547 #ifdef O_NONBLOCK
12548         printf("O_NONBLOCK\n");
12549         exit(0);
12550 #endif
12551 #ifdef O_NDELAY
12552         printf("O_NDELAY\n");
12553         exit(0);
12554 #endif
12555 #ifdef FNDELAY
12556         printf("FNDELAY\n");
12557         exit(0);
12558 #endif
12559         exit(0);
12560 }
12561 EOCP
12562         set try
12563         if eval $compile_ok; then
12564                 o_nonblock=`$run ./try`
12565                 case "$o_nonblock" in
12566                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12567                 *) echo "Seems like we can use $o_nonblock.";;
12568                 esac
12569         else
12570                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12571         fi
12572         ;;
12573 *) echo "Using $hint value $o_nonblock.";;
12574 esac
12575 $rm_try
12576
12577 echo " "
12578 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12579 case "$eagain" in
12580 '')
12581         case "$d_fork:$d_pipe" in
12582         define:define)
12583         $cat head.c > try.c
12584         $cat >>try.c <<EOCP
12585 #include <errno.h>
12586 #include <sys/types.h>
12587 #include <signal.h>
12588 #include <stdio.h>
12589 #$i_stdlib I_STDLIB
12590 #ifdef I_STDLIB
12591 #include <stdlib.h>
12592 #endif
12593 #$i_fcntl I_FCNTL
12594 #ifdef I_FCNTL
12595 #include <fcntl.h>
12596 #endif
12597 #define MY_O_NONBLOCK $o_nonblock
12598 #ifndef errno  /* XXX need better Configure test */
12599 extern int errno;
12600 #endif
12601 #$i_unistd I_UNISTD
12602 #ifdef I_UNISTD
12603 #include <unistd.h>
12604 #endif
12605 #$i_string I_STRING
12606 #ifdef I_STRING
12607 #include <string.h>
12608 #else
12609 #include <strings.h>
12610 #endif
12611 $signal_t blech(int x) { exit(3); }
12612 EOCP
12613         $cat >> try.c <<'EOCP'
12614 int main()
12615 {
12616         int pd[2];
12617         int pu[2];
12618         char buf[1];
12619         char string[100];
12620
12621         pipe(pd);       /* Down: child -> parent */
12622         pipe(pu);       /* Up: parent -> child */
12623         if (0 != fork()) {
12624                 int ret;
12625                 close(pd[1]);   /* Parent reads from pd[0] */
12626                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12627 #ifdef F_SETFL
12628                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12629                         exit(1);
12630 #else
12631                 exit(4);
12632 #endif
12633                 signal(SIGALRM, blech);
12634                 alarm(5);
12635                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12636                         exit(2);
12637                 sprintf(string, "%d\n", ret);
12638                 write(2, string, strlen(string));
12639                 alarm(0);
12640 #ifdef EAGAIN
12641                 if (errno == EAGAIN) {
12642                         printf("EAGAIN\n");
12643                         goto ok;
12644                 }
12645 #endif
12646 #ifdef EWOULDBLOCK
12647                 if (errno == EWOULDBLOCK)
12648                         printf("EWOULDBLOCK\n");
12649 #endif
12650         ok:
12651                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12652                 sleep(2);                               /* Give it time to close our pipe */
12653                 alarm(5);
12654                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12655                 alarm(0);
12656                 sprintf(string, "%d\n", ret);
12657                 write(4, string, strlen(string));
12658                 exit(0);
12659         }
12660
12661         close(pd[0]);                   /* We write to pd[1] */
12662         close(pu[1]);                   /* We read from pu[0] */
12663         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12664         close(pd[1]);                   /* Pipe pd is now fully closed! */
12665         exit(0);                                /* Bye bye, thank you for playing! */
12666 }
12667 EOCP
12668         set try
12669         if eval $compile_ok; then
12670                 echo "$startsh" >mtry
12671                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12672                 chmod +x mtry
12673                 ./mtry >/dev/null 2>&1
12674                 case $? in
12675                 0) eagain=`$cat try.out`;;
12676                 1) echo "Could not perform non-blocking setting!";;
12677                 2) echo "I did a successful read() for something that was not there!";;
12678                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12679                 4) echo "Could not find F_SETFL!";;
12680                 *) echo "Something terribly wrong happened during testing.";;
12681                 esac
12682                 rd_nodata=`$cat try.ret`
12683                 echo "A read() system call with no data present returns $rd_nodata."
12684                 case "$rd_nodata" in
12685                 0|-1) ;;
12686                 *)
12687                         echo "(That's peculiar, fixing that to be -1.)"
12688                         rd_nodata=-1
12689                         ;;
12690                 esac
12691                 case "$eagain" in
12692                 '')
12693                         echo "Forcing errno EAGAIN on read() with no data available."
12694                         eagain=EAGAIN
12695                         ;;
12696                 *)
12697                         echo "Your read() sets errno to $eagain when no data is available."
12698                         ;;
12699                 esac
12700                 status=`$cat try.err`
12701                 case "$status" in
12702                 0) echo "And it correctly returns 0 to signal EOF.";;
12703                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12704                 *) echo "However, your read() returns '$status' on EOF??";;
12705                 esac
12706                 val="$define"
12707                 if test "$status" = "$rd_nodata"; then
12708                         echo "WARNING: you can't distinguish between EOF and no data!"
12709                         val="$undef"
12710                 fi
12711         else
12712                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12713                 eagain=EAGAIN
12714         fi
12715         ;;
12716         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12717                 eagain=EAGAIN
12718                 val="$define"
12719                 ;;
12720         esac
12721         set d_eofnblk
12722         eval $setvar
12723         ;;
12724 *)
12725         echo "Using $hint value $eagain."
12726         echo "Your read() returns $rd_nodata when no data is present."
12727         case "$d_eofnblk" in
12728         "$define") echo "And you can see EOF because read() returns 0.";;
12729         "$undef") echo "But you can't see EOF status from read() returned value.";;
12730         *)
12731                 echo "(Assuming you can't see EOF status from read anyway.)"
12732                 d_eofnblk=$undef
12733                 ;;
12734         esac
12735         ;;
12736 esac
12737 $rm_try head.c mtry
12738
12739 : see if _ptr and _cnt from stdio act std
12740 echo " "
12741
12742 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12743         echo "(Looks like you have stdio.h from BSD.)"
12744         case "$stdio_ptr" in
12745         '') stdio_ptr='((fp)->_p)'
12746                 ptr_lval=$define
12747                 ;;
12748         *)      ptr_lval=$d_stdio_ptr_lval;;
12749         esac
12750         case "$stdio_cnt" in
12751         '') stdio_cnt='((fp)->_r)'
12752                 cnt_lval=$define
12753                 ;;
12754         *)      cnt_lval=$d_stdio_cnt_lval;;
12755         esac
12756         case "$stdio_base" in
12757         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12758         esac
12759         case "$stdio_bufsiz" in
12760         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12761         esac
12762 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12763         echo "(Looks like you have stdio.h from Linux.)"
12764         case "$stdio_ptr" in
12765         '') stdio_ptr='((fp)->_IO_read_ptr)'
12766                 ptr_lval=$define
12767                 ;;
12768         *)      ptr_lval=$d_stdio_ptr_lval;;
12769         esac
12770         case "$stdio_cnt" in
12771         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12772                 cnt_lval=$undef
12773                 ;;
12774         *)      cnt_lval=$d_stdio_cnt_lval;;
12775         esac
12776         case "$stdio_base" in
12777         '') stdio_base='((fp)->_IO_read_base)';;
12778         esac
12779         case "$stdio_bufsiz" in
12780         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12781         esac
12782 else
12783         case "$stdio_ptr" in
12784         '') stdio_ptr='((fp)->_ptr)'
12785                 ptr_lval=$define
12786                 ;;
12787         *)      ptr_lval=$d_stdio_ptr_lval;;
12788         esac
12789         case "$stdio_cnt" in
12790         '') stdio_cnt='((fp)->_cnt)'
12791                 cnt_lval=$define
12792                 ;;
12793         *)      cnt_lval=$d_stdio_cnt_lval;;
12794         esac
12795         case "$stdio_base" in
12796         '') stdio_base='((fp)->_base)';;
12797         esac
12798         case "$stdio_bufsiz" in
12799         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12800         esac
12801 fi
12802
12803 : test whether _ptr and _cnt really work
12804 echo "Checking how std your stdio is..." >&4
12805 $cat >try.c <<EOP
12806 #include <stdio.h>
12807 #$i_stdlib I_STDLIB
12808 #ifdef I_STDLIB
12809 #include <stdlib.h>
12810 #endif
12811 #define FILE_ptr(fp)    $stdio_ptr
12812 #define FILE_cnt(fp)    $stdio_cnt
12813 int main() {
12814         FILE *fp = fopen("try.c", "r");
12815         char c = getc(fp);
12816         if (
12817                 18 <= FILE_cnt(fp) &&
12818                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12819         )
12820                 exit(0);
12821         exit(1);
12822 }
12823 EOP
12824 val="$undef"
12825 set try
12826 if eval $compile && $to try.c; then
12827         if $run ./try; then
12828                 echo "Your stdio acts pretty std."
12829                 val="$define"
12830         else
12831                 echo "Your stdio isn't very std."
12832         fi
12833 else
12834         echo "Your stdio doesn't appear very std."
12835 fi
12836 $rm_try
12837
12838 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12839 # direct buffer manipulation no longer works.  The Configure tests
12840 # should be changed to correctly detect this, but until then,
12841 # the following check should at least let perl compile and run.
12842 # (This quick fix should be updated before 5.8.1.)
12843 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12844 # A. Dougherty, June 3, 2002.
12845 case "$d_gnulibc" in
12846 $define)
12847         case "$gnulibc_version" in
12848         2.[01]*)  ;;
12849         2.2) ;;
12850         2.2.[0-9]) ;;
12851         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12852                 val="$undef"
12853                 ;;
12854         esac
12855         ;;
12856 esac
12857 set d_stdstdio
12858 eval $setvar
12859
12860 : Can _ptr be used as an lvalue?
12861 case "$d_stdstdio$ptr_lval" in
12862 $define$define) val=$define ;;
12863 *) val=$undef ;;
12864 esac
12865 set d_stdio_ptr_lval
12866 eval $setvar
12867
12868 : Can _cnt be used as an lvalue?
12869 case "$d_stdstdio$cnt_lval" in
12870 $define$define) val=$define ;;
12871 *) val=$undef ;;
12872 esac
12873 set d_stdio_cnt_lval
12874 eval $setvar
12875
12876
12877 : test whether setting _ptr sets _cnt as a side effect
12878 d_stdio_ptr_lval_sets_cnt="$undef"
12879 d_stdio_ptr_lval_nochange_cnt="$undef"
12880 case "$d_stdio_ptr_lval$d_stdstdio" in
12881 $define$define)
12882         echo "Checking to see what happens if we set the stdio ptr..." >&4
12883 $cat >try.c <<EOP
12884 #include <stdio.h>
12885 /* Can we scream? */
12886 /* Eat dust sed :-) */
12887 /* In the buffer space, no one can hear you scream. */
12888 #$i_stdlib I_STDLIB
12889 #ifdef I_STDLIB
12890 #include <stdlib.h>
12891 #endif
12892 #define FILE_ptr(fp)    $stdio_ptr
12893 #define FILE_cnt(fp)    $stdio_cnt
12894 #include <sys/types.h>
12895 int main() {
12896         FILE *fp = fopen("try.c", "r");
12897         int c;
12898         char *ptr;
12899         size_t cnt;
12900         if (!fp) {
12901             puts("Fail even to read");
12902             exit(1);
12903         }
12904         c = getc(fp); /* Read away the first # */
12905         if (c == EOF) {
12906             puts("Fail even to read");
12907             exit(1);
12908         }
12909         if (!(
12910                 18 <= FILE_cnt(fp) &&
12911                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12912         )) {
12913                 puts("Fail even to read");
12914                 exit (1);
12915         }
12916         ptr = (char*) FILE_ptr(fp);
12917         cnt = (size_t)FILE_cnt(fp);
12918
12919         FILE_ptr(fp) += 42;
12920
12921         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12922                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12923                 exit (1);
12924         }
12925         if (FILE_cnt(fp) <= 20) {
12926                 printf ("Fail (<20 chars to test)");
12927                 exit (1);
12928         }
12929         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12930                 puts("Fail compare");
12931                 exit (1);
12932         }
12933         if (cnt == FILE_cnt(fp)) {
12934                 puts("Pass_unchanged");
12935                 exit (0);
12936         }
12937         if (FILE_cnt(fp) == (cnt - 42)) {
12938                 puts("Pass_changed");
12939                 exit (0);
12940         }
12941         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12942         return 1;
12943
12944 }
12945 EOP
12946         set try
12947         if eval $compile && $to try.c; then
12948                 case `$run ./try` in
12949                 Pass_changed)
12950                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12951                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12952                 Pass_unchanged)
12953                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12954                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12955                 Fail*)
12956                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12957                 *)
12958                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12959         esac
12960         else
12961                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12962         fi
12963         $rm_try
12964         ;;
12965 esac
12966
12967 : see if _base is also standard
12968 val="$undef"
12969 case "$d_stdstdio" in
12970 $define)
12971         $cat >try.c <<EOP
12972 #include <stdio.h>
12973 #$i_stdlib I_STDLIB
12974 #ifdef I_STDLIB
12975 #include <stdlib.h>
12976 #endif
12977 #define FILE_base(fp)   $stdio_base
12978 #define FILE_bufsiz(fp) $stdio_bufsiz
12979 int main() {
12980         FILE *fp = fopen("try.c", "r");
12981         char c = getc(fp);
12982         if (
12983                 19 <= FILE_bufsiz(fp) &&
12984                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12985         )
12986                 exit(0);
12987         exit(1);
12988 }
12989 EOP
12990         set try
12991         if eval $compile && $to try.c; then
12992                 if $run ./try; then
12993                         echo "And its _base field acts std."
12994                         val="$define"
12995                 else
12996                         echo "But its _base field isn't std."
12997                 fi
12998         else
12999                 echo "However, it seems to be lacking the _base field."
13000         fi
13001         $rm_try
13002         ;;
13003 esac
13004 set d_stdiobase
13005 eval $setvar
13006
13007 : see if fast_stdio exists
13008 val="$undef"
13009 case "$d_stdstdio:$d_stdio_ptr_lval" in
13010 "$define:$define")
13011         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13012         *$define*)
13013                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13014                 val="$define"
13015                 ;;
13016         esac
13017         ;;
13018 esac
13019 set d_faststdio
13020 eval $setvar
13021
13022
13023
13024 : see if fchdir exists
13025 set fchdir d_fchdir
13026 eval $inlibc
13027
13028 : see if fchmod exists
13029 set fchmod d_fchmod
13030 eval $inlibc
13031
13032 : see if fchown exists
13033 set fchown d_fchown
13034 eval $inlibc
13035
13036 : see if this is an fcntl system
13037 set fcntl d_fcntl
13038 eval $inlibc
13039
13040 : See if fcntl-based locking works.
13041 echo " "
13042 $cat >try.c <<EOCP
13043 #$i_stdlib I_STDLIB
13044 #ifdef I_STDLIB
13045 #include <stdlib.h>
13046 #endif
13047 #include <unistd.h>
13048 #include <fcntl.h>
13049 #include <signal.h>
13050 $signal_t blech(int x) { exit(3); }
13051 int main() {
13052 #if defined(F_SETLK) && defined(F_SETLKW)
13053      struct flock flock;
13054      int retval, fd;
13055      fd = open("try.c", O_RDONLY);
13056      flock.l_type = F_RDLCK;
13057      flock.l_whence = SEEK_SET;
13058      flock.l_start = flock.l_len = 0;
13059      signal(SIGALRM, blech);
13060      alarm(10);
13061      retval = fcntl(fd, F_SETLK, &flock);
13062      close(fd);
13063      (retval < 0 ? exit(2) : exit(0));
13064 #else
13065      exit(2);
13066 #endif
13067 }
13068 EOCP
13069 echo "Checking if fcntl-based file locking works... "
13070 case "$d_fcntl" in
13071 "$define")
13072         set try
13073         if eval $compile_ok; then
13074                 if $run ./try; then
13075                         echo "Yes, it seems to work."
13076                         val="$define"
13077                 else
13078                         echo "Nope, it didn't work."
13079                         val="$undef"
13080                         case "$?" in
13081                         3) $cat >&4 <<EOM
13082 ***
13083 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13084 *** This is (almost) impossible.
13085 *** If your NFS lock daemons are not feeling well, something like
13086 *** this may happen, please investigate.  Cannot continue, aborting.
13087 ***
13088 EOM
13089                                 exit 1
13090                                 ;;
13091                         esac
13092                 fi
13093         else
13094                 echo "I'm unable to compile the test program, so I'll assume not."
13095                 val="$undef"
13096         fi
13097         ;;
13098 *) val="$undef";
13099         echo "Nope, since you don't even have fcntl()."
13100         ;;
13101 esac
13102 set d_fcntl_can_lock
13103 eval $setvar
13104 $rm_try
13105
13106 : check for fd_set items
13107 $cat <<EOM
13108
13109 Checking to see how well your C compiler handles fd_set and friends ...
13110 EOM
13111 $cat >try.c <<EOCP
13112 #$i_stdlib I_STDLIB
13113 #ifdef I_STDLIB
13114 #include <stdlib.h>
13115 #endif
13116 #$i_systime I_SYS_TIME
13117 #$i_sysselct I_SYS_SELECT
13118 #$d_socket HAS_SOCKET
13119 #include <sys/types.h>
13120 #ifdef HAS_SOCKET
13121 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13122 #endif
13123 #ifdef I_SYS_TIME
13124 #include <sys/time.h>
13125 #endif
13126 #ifdef I_SYS_SELECT
13127 #include <sys/select.h>
13128 #endif
13129 int main() {
13130         fd_set fds;
13131
13132 #ifdef TRYBITS
13133         if(fds.fds_bits);
13134 #endif
13135
13136 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13137         exit(0);
13138 #else
13139         exit(1);
13140 #endif
13141 }
13142 EOCP
13143 set try -DTRYBITS
13144 if eval $compile; then
13145         d_fds_bits="$define"
13146         d_fd_set="$define"
13147         echo "Well, your system knows about the normal fd_set typedef..." >&4
13148         if $run ./try; then
13149                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13150                 d_fd_macros="$define"
13151         else
13152                 $cat >&4 <<'EOM'
13153 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13154 EOM
13155                 d_fd_macros="$undef"
13156         fi
13157 else
13158         $cat <<'EOM'
13159 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13160 EOM
13161         set try
13162         if eval $compile; then
13163                 d_fds_bits="$undef"
13164                 d_fd_set="$define"
13165                 echo "Well, your system has some sort of fd_set available..." >&4
13166                 if $run ./try; then
13167                         echo "and you have the normal fd_set macros." >&4
13168                         d_fd_macros="$define"
13169                 else
13170                         $cat <<'EOM'
13171 but not the normal fd_set macros!  Gross!  More work for me...
13172 EOM
13173                         d_fd_macros="$undef"
13174                 fi
13175         else
13176         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13177                 d_fd_set="$undef"
13178                 d_fds_bits="$undef"
13179                 d_fd_macros="$undef"
13180         fi
13181 fi
13182 $rm_try
13183
13184 : see if fgetpos exists
13185 set fgetpos d_fgetpos
13186 eval $inlibc
13187
13188 : see if finite exists
13189 set finite d_finite
13190 eval $inlibc
13191
13192 : see if finitel exists
13193 set finitel d_finitel
13194 eval $inlibc
13195
13196 : see if flock exists
13197 set flock d_flock
13198 eval $inlibc
13199
13200 : see if prototype for flock is available
13201 echo " "
13202 set d_flockproto flock $i_sysfile sys/file.h
13203 eval $hasproto
13204
13205 : see if fp_class exists
13206 set fp_class d_fp_class
13207 eval $inlibc
13208
13209 : see if pathconf exists
13210 set pathconf d_pathconf
13211 eval $inlibc
13212
13213 : see if fpathconf exists
13214 set fpathconf d_fpathconf
13215 eval $inlibc
13216
13217 : see if fpclass exists
13218 set fpclass d_fpclass
13219 eval $inlibc
13220
13221 : see if fpclassify exists
13222 set fpclassify d_fpclassify
13223 eval $inlibc
13224
13225 : see if fpclassl exists
13226 set fpclassl d_fpclassl
13227 eval $inlibc
13228
13229 : check for fpos64_t
13230 echo " "
13231 echo "Checking to see if you have fpos64_t..." >&4
13232 $cat >try.c <<EOCP
13233 #include <stdio.h>
13234 int main() { fpos64_t x = 7; }
13235 EOCP
13236 set try
13237 if eval $compile; then
13238         val="$define"
13239         echo "You have fpos64_t."
13240 else
13241         val="$undef"
13242         echo "You do not have fpos64_t."
13243         case "$fpossize" in
13244         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13245         esac
13246 fi
13247 $rm_try
13248 set d_fpos64_t
13249 eval $setvar
13250
13251 : see if frexpl exists
13252 set frexpl d_frexpl
13253 eval $inlibc
13254
13255 : see if this is a sys/param system
13256 set sys/param.h i_sysparam
13257 eval $inhdr
13258
13259 : see if this is a sys/mount.h system
13260 set sys/mount.h i_sysmount
13261 eval $inhdr
13262
13263 : Check for fs_data_s
13264 echo " "
13265 echo "Checking to see if your system supports struct fs_data..." >&4
13266 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13267 eval $hasstruct
13268 case "$d_fs_data_s" in
13269 "$define")      echo "Yes, it does."   ;;
13270 *)              echo "No, it doesn't." ;;
13271 esac
13272
13273 : see if fseeko exists
13274 set fseeko d_fseeko
13275 eval $inlibc
13276 case "$longsize" in
13277 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13278 esac
13279
13280 : see if fsetpos exists
13281 set fsetpos d_fsetpos
13282 eval $inlibc
13283
13284 : see if fstatfs exists
13285 set fstatfs d_fstatfs
13286 eval $inlibc
13287
13288 : see if statvfs exists
13289 set statvfs d_statvfs
13290 eval $inlibc
13291
13292 : see if fstatvfs exists
13293 set fstatvfs d_fstatvfs
13294 eval $inlibc
13295
13296
13297 : see if fsync exists
13298 set fsync d_fsync
13299 eval $inlibc
13300
13301 : see if ftello exists
13302 set ftello d_ftello
13303 eval $inlibc
13304 case "$longsize" in
13305 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13306 esac
13307
13308 : check for a working futimes
13309 d_futimes="$undef"
13310 echo " "
13311 echo "Checking if you have a working futimes()" >&4
13312 $cat >try.c <<EOCP
13313 #include <stdio.h>
13314 #include <sys/time.h>
13315 #include <errno.h>
13316 #include <fcntl.h>
13317
13318 int main ()
13319 {
13320     int fd, rv;
13321     fd = open ("try.c", O_RDWR);
13322     if (-1 == fd) exit (1);
13323     rv = futimes (fd, NULL);
13324     exit (rv == -1 ? errno : 0);
13325 }
13326 EOCP
13327 set try
13328 if eval $compile; then
13329     `$run ./try`
13330     rc=$?
13331     case "$rc" in
13332         0)  echo "Yes, you have" >&4
13333             d_futimes="$define"
13334             ;;
13335         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13336             ;;
13337     esac
13338 else
13339     echo "No, it does not (probably harmless)" >&4
13340 fi
13341 $rm_try
13342
13343 : see if ndbm.h is available
13344 set ndbm.h i_ndbm
13345 eval $inhdr
13346 : Compatibility location for RedHat 7.1
13347 set gdbm/ndbm.h i_gdbmndbm
13348 eval $inhdr
13349 : Compatibility location for Debian 4.0
13350 set gdbm-ndbm.h i_gdbm_ndbm
13351 eval $inhdr
13352
13353 val="$undef"
13354 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13355         : see if dbm_open exists
13356         set dbm_open d_dbm_open
13357         eval $inlibc
13358         case "$d_dbm_open" in
13359         $undef)
13360                 i_ndbm="$undef"
13361                 i_gdbmndbm="$undef"
13362                 i_gdbm_ndbm="$undef"
13363                 echo "We won't be including <ndbm.h>"
13364                 val="$undef"
13365                 ;;
13366         *) val="$define"
13367            ;;
13368         esac
13369 fi
13370 set d_ndbm
13371 eval $setvar
13372
13373 ndbm_hdr_protochk='name=$1; hdr=$2;
13374 eval "ihdr=\$""i_$name";
13375 val="$undef";
13376 if $test "$ihdr" = "$define"; then
13377         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13378         case "$d_cplusplus" in
13379         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13380         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13381         esac;
13382         case "$val" in
13383         $define) $echo "Your <$hdr> seems to have prototypes";;
13384         *) $echo "Your <$hdr> does not seem to have prototypes";;
13385         esac;
13386 fi;
13387 set "d_${name}_h_uses_prototypes";
13388 eval $setvar'
13389
13390 set ndbm ndbm.h
13391 eval $ndbm_hdr_protochk
13392 set gdbmndbm gdbm/ndbm.h
13393 eval $ndbm_hdr_protochk
13394 set gdbm_ndbm gdbm-ndbm.h
13395 eval $ndbm_hdr_protochk
13396
13397 : see if getaddrinfo exists
13398 set getaddrinfo d_getaddrinfo
13399 eval $inlibc
13400
13401 : see if getcwd exists
13402 set getcwd d_getcwd
13403 eval $inlibc
13404
13405 : see if getespwnam exists
13406 set getespwnam d_getespwnam
13407 eval $inlibc
13408
13409 : see if getfsstat exists
13410 set getfsstat d_getfsstat
13411 eval $inlibc
13412
13413 : see if getgrent exists
13414 set getgrent d_getgrent
13415 eval $inlibc
13416
13417 : see if getgrent_r exists
13418 set getgrent_r d_getgrent_r
13419 eval $inlibc
13420 case "$d_getgrent_r" in
13421 "$define")
13422         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13423         case "$d_getgrent_r_proto:$usethreads" in
13424         ":define")      d_getgrent_r_proto=define
13425                 set d_getgrent_r_proto getgrent_r $hdrs
13426                 eval $hasproto ;;
13427         *)      ;;
13428         esac
13429         case "$d_getgrent_r_proto" in
13430         define)
13431         case "$getgrent_r_proto" in
13432         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13433         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13434         esac
13435         case "$getgrent_r_proto" in
13436         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13437         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13438         esac
13439         case "$getgrent_r_proto" in
13440         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13441         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13442         esac
13443         case "$getgrent_r_proto" in
13444         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13445         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13446         esac
13447         case "$getgrent_r_proto" in
13448         ''|0) try='int getgrent_r(struct group*, char*, int);'
13449         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13450         esac
13451         case "$getgrent_r_proto" in
13452         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13453         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13454         esac
13455         case "$getgrent_r_proto" in
13456         ''|0)   d_getgrent_r=undef
13457                 getgrent_r_proto=0
13458                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13459         * )     case "$getgrent_r_proto" in
13460                 REENTRANT_PROTO*) ;;
13461                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13462                 esac
13463                 echo "Prototype: $try" ;;
13464         esac
13465         ;;
13466         *)      case "$usethreads" in
13467                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13468                 esac
13469                 d_getgrent_r=undef
13470                 getgrent_r_proto=0
13471                 ;;
13472         esac
13473         ;;
13474 *)      getgrent_r_proto=0
13475         ;;
13476 esac
13477
13478 : see if getgrgid_r exists
13479 set getgrgid_r d_getgrgid_r
13480 eval $inlibc
13481 case "$d_getgrgid_r" in
13482 "$define")
13483         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13484         case "$d_getgrgid_r_proto:$usethreads" in
13485         ":define")      d_getgrgid_r_proto=define
13486                 set d_getgrgid_r_proto getgrgid_r $hdrs
13487                 eval $hasproto ;;
13488         *)      ;;
13489         esac
13490         case "$d_getgrgid_r_proto" in
13491         define)
13492         case "$getgrgid_r_proto" in
13493         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13494         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13495         esac
13496         case "$getgrgid_r_proto" in
13497         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13498         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13499         esac
13500         case "$getgrgid_r_proto" in
13501         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13502         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13503         esac
13504         case "$getgrgid_r_proto" in
13505         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13506         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13507         esac
13508         case "$getgrgid_r_proto" in
13509         ''|0)   d_getgrgid_r=undef
13510                 getgrgid_r_proto=0
13511                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13512         * )     case "$getgrgid_r_proto" in
13513                 REENTRANT_PROTO*) ;;
13514                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13515                 esac
13516                 echo "Prototype: $try" ;;
13517         esac
13518         ;;
13519         *)      case "$usethreads" in
13520                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13521                 esac
13522                 d_getgrgid_r=undef
13523                 getgrgid_r_proto=0
13524                 ;;
13525         esac
13526         ;;
13527 *)      getgrgid_r_proto=0
13528         ;;
13529 esac
13530
13531 : see if getgrnam_r exists
13532 set getgrnam_r d_getgrnam_r
13533 eval $inlibc
13534 case "$d_getgrnam_r" in
13535 "$define")
13536         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13537         case "$d_getgrnam_r_proto:$usethreads" in
13538         ":define")      d_getgrnam_r_proto=define
13539                 set d_getgrnam_r_proto getgrnam_r $hdrs
13540                 eval $hasproto ;;
13541         *)      ;;
13542         esac
13543         case "$d_getgrnam_r_proto" in
13544         define)
13545         case "$getgrnam_r_proto" in
13546         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13547         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13548         esac
13549         case "$getgrnam_r_proto" in
13550         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13551         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13552         esac
13553         case "$getgrnam_r_proto" in
13554         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13555         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13556         esac
13557         case "$getgrnam_r_proto" in
13558         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13559         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13560         esac
13561         case "$getgrnam_r_proto" in
13562         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13563         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13564         esac
13565         case "$getgrnam_r_proto" in
13566         ''|0)   d_getgrnam_r=undef
13567                 getgrnam_r_proto=0
13568                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13569         * )     case "$getgrnam_r_proto" in
13570                 REENTRANT_PROTO*) ;;
13571                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13572                 esac
13573                 echo "Prototype: $try" ;;
13574         esac
13575         ;;
13576         *)      case "$usethreads" in
13577                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13578                 esac
13579                 d_getgrnam_r=undef
13580                 getgrnam_r_proto=0
13581                 ;;
13582         esac
13583         ;;
13584 *)      getgrnam_r_proto=0
13585         ;;
13586 esac
13587
13588 : see if gethostbyaddr exists
13589 set gethostbyaddr d_gethbyaddr
13590 eval $inlibc
13591
13592 : see if gethostbyname exists
13593 set gethostbyname d_gethbyname
13594 eval $inlibc
13595
13596 : see if gethostent exists
13597 set gethostent d_gethent
13598 eval $inlibc
13599
13600 : see how we will look up host name
13601 echo " "
13602 call=''
13603 if set gethostname val -f d_gethname; eval $csym; $val; then
13604         echo 'gethostname() found.' >&4
13605         d_gethname="$define"
13606         call=gethostname
13607 fi
13608 if set uname val -f d_uname; eval $csym; $val; then
13609         if ./xenix; then
13610                 $cat <<'EOM'
13611 uname() was found, but you're running xenix, and older versions of xenix
13612 have a broken uname(). If you don't really know whether your xenix is old
13613 enough to have a broken system call, use the default answer.
13614
13615 EOM
13616                 dflt=y
13617                 case "$d_uname" in
13618                 "$define") dflt=n;;
13619                 esac
13620                 rp='Is your uname() broken?'
13621                 . ./myread
13622                 case "$ans" in
13623                 n*) d_uname="$define"; call=uname;;
13624                 esac
13625         else
13626                 echo 'uname() found.' >&4
13627                 d_uname="$define"
13628                 case "$call" in
13629                 '') call=uname ;;
13630                 esac
13631         fi
13632 fi
13633 case "$d_gethname" in
13634 '') d_gethname="$undef";;
13635 esac
13636 case "$d_uname" in
13637 '') d_uname="$undef";;
13638 esac
13639 case "$d_uname$d_gethname" in
13640 *define*)
13641         dflt=n
13642         cat <<EOM
13643
13644 Every now and then someone has a $call() that lies about the hostname
13645 but can't be fixed for political or economic reasons.  If you wish, I can
13646 pretend $call() isn't there and maybe compute hostname at run-time
13647 thanks to the '$phostname' command.
13648
13649 EOM
13650         rp="Shall I ignore $call() from now on?"
13651         . ./myread
13652         case "$ans" in
13653         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13654         esac;;
13655 esac
13656 case "$phostname" in
13657 '') aphostname='';;
13658 *) case "$aphostname" in
13659         /*) ;;
13660         *) set X $phostname
13661                 shift
13662                 file=$1
13663                 shift
13664                 file=`./loc $file $file $pth`
13665                 aphostname=`echo $file $*`
13666                 ;;
13667         esac
13668         ;;
13669 esac
13670 case "$d_uname$d_gethname" in
13671 *define*) ;;
13672 *)
13673         case "$phostname" in
13674         '')
13675                 echo "There will be no way for $package to get your hostname." >&4;;
13676         *)
13677         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13678                 ;;
13679         esac;;
13680 esac
13681 case "$d_phostname" in
13682 '') d_phostname="$undef";;
13683 esac
13684
13685 : see if gethostbyaddr_r exists
13686 set gethostbyaddr_r d_gethostbyaddr_r
13687 eval $inlibc
13688 case "$d_gethostbyaddr_r" in
13689 "$define")
13690         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13691         case "$d_gethostbyaddr_r_proto:$usethreads" in
13692         ":define")      d_gethostbyaddr_r_proto=define
13693                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13694                 eval $hasproto ;;
13695         *)      ;;
13696         esac
13697         case "$d_gethostbyaddr_r_proto" in
13698         define)
13699         case "$gethostbyaddr_r_proto" in
13700         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13701         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13702         esac
13703         case "$gethostbyaddr_r_proto" in
13704         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13705         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13706         esac
13707         case "$gethostbyaddr_r_proto" in
13708         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13709         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13710         esac
13711         case "$gethostbyaddr_r_proto" in
13712         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13713         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13714         esac
13715         case "$gethostbyaddr_r_proto" in
13716         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13717         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13718         esac
13719         case "$gethostbyaddr_r_proto" in
13720         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13721         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13722         esac
13723         case "$gethostbyaddr_r_proto" in
13724         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13725         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13726         esac
13727         case "$gethostbyaddr_r_proto" in
13728         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13729         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13730         esac
13731         case "$gethostbyaddr_r_proto" in
13732         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13733         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13734         esac
13735         case "$gethostbyaddr_r_proto" in
13736         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13737         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13738         esac
13739         case "$gethostbyaddr_r_proto" in
13740         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13741         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13742         esac
13743         case "$gethostbyaddr_r_proto" in
13744         ''|0)   d_gethostbyaddr_r=undef
13745                 gethostbyaddr_r_proto=0
13746                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13747         * )     case "$gethostbyaddr_r_proto" in
13748                 REENTRANT_PROTO*) ;;
13749                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13750                 esac
13751                 echo "Prototype: $try" ;;
13752         esac
13753         ;;
13754         *)      case "$usethreads" in
13755                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13756                 esac
13757                 d_gethostbyaddr_r=undef
13758                 gethostbyaddr_r_proto=0
13759                 ;;
13760         esac
13761         ;;
13762 *)      gethostbyaddr_r_proto=0
13763         ;;
13764 esac
13765
13766 : see if gethostbyname_r exists
13767 set gethostbyname_r d_gethostbyname_r
13768 eval $inlibc
13769 case "$d_gethostbyname_r" in
13770 "$define")
13771         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13772         case "$d_gethostbyname_r_proto:$usethreads" in
13773         ":define")      d_gethostbyname_r_proto=define
13774                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13775                 eval $hasproto ;;
13776         *)      ;;
13777         esac
13778         case "$d_gethostbyname_r_proto" in
13779         define)
13780         case "$gethostbyname_r_proto" in
13781         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13782         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13783         esac
13784         case "$gethostbyname_r_proto" in
13785         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13786         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13787         esac
13788         case "$gethostbyname_r_proto" in
13789         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13790         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13791         esac
13792         case "$gethostbyname_r_proto" in
13793         ''|0)   d_gethostbyname_r=undef
13794                 gethostbyname_r_proto=0
13795                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13796         * )     case "$gethostbyname_r_proto" in
13797                 REENTRANT_PROTO*) ;;
13798                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13799                 esac
13800                 echo "Prototype: $try" ;;
13801         esac
13802         ;;
13803         *)      case "$usethreads" in
13804                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13805                 esac
13806                 d_gethostbyname_r=undef
13807                 gethostbyname_r_proto=0
13808                 ;;
13809         esac
13810         ;;
13811 *)      gethostbyname_r_proto=0
13812         ;;
13813 esac
13814
13815 : see if gethostent_r exists
13816 set gethostent_r d_gethostent_r
13817 eval $inlibc
13818 case "$d_gethostent_r" in
13819 "$define")
13820         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13821         case "$d_gethostent_r_proto:$usethreads" in
13822         ":define")      d_gethostent_r_proto=define
13823                 set d_gethostent_r_proto gethostent_r $hdrs
13824                 eval $hasproto ;;
13825         *)      ;;
13826         esac
13827         case "$d_gethostent_r_proto" in
13828         define)
13829         case "$gethostent_r_proto" in
13830         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13831         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13832         esac
13833         case "$gethostent_r_proto" in
13834         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13835         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13836         esac
13837         case "$gethostent_r_proto" in
13838         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13839         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13840         esac
13841         case "$gethostent_r_proto" in
13842         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13843         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13844         esac
13845         case "$gethostent_r_proto" in
13846         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13847         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13848         esac
13849         case "$gethostent_r_proto" in
13850         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13851         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13852         esac
13853         case "$gethostent_r_proto" in
13854         ''|0)   d_gethostent_r=undef
13855                 gethostent_r_proto=0
13856                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13857         * )     case "$gethostent_r_proto" in
13858                 REENTRANT_PROTO*) ;;
13859                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13860                 esac
13861                 echo "Prototype: $try" ;;
13862         esac
13863         ;;
13864         *)      case "$usethreads" in
13865                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13866                 esac
13867                 d_gethostent_r=undef
13868                 gethostent_r_proto=0
13869                 ;;
13870         esac
13871         ;;
13872 *)      gethostent_r_proto=0
13873         ;;
13874 esac
13875
13876 : see if prototypes for various gethostxxx netdb.h functions are available
13877 echo " "
13878 set d_gethostprotos gethostent $i_netdb netdb.h
13879 eval $hasproto
13880
13881 : see if getitimer exists
13882 set getitimer d_getitimer
13883 eval $inlibc
13884
13885 : see if getlogin exists
13886 set getlogin d_getlogin
13887 eval $inlibc
13888
13889 : see if getlogin_r exists
13890 set getlogin_r d_getlogin_r
13891 eval $inlibc
13892 case "$d_getlogin_r" in
13893 "$define")
13894         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13895         case "$d_getlogin_r_proto:$usethreads" in
13896         ":define")      d_getlogin_r_proto=define
13897                 set d_getlogin_r_proto getlogin_r $hdrs
13898                 eval $hasproto ;;
13899         *)      ;;
13900         esac
13901         case "$d_getlogin_r_proto" in
13902         define)
13903         case "$getlogin_r_proto" in
13904         ''|0) try='int getlogin_r(char*, size_t);'
13905         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13906         esac
13907         case "$getlogin_r_proto" in
13908         ''|0) try='int getlogin_r(char*, int);'
13909         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13910         esac
13911         case "$getlogin_r_proto" in
13912         ''|0) try='char* getlogin_r(char*, size_t);'
13913         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13914         esac
13915         case "$getlogin_r_proto" in
13916         ''|0) try='char* getlogin_r(char*, int);'
13917         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13918         esac
13919         case "$getlogin_r_proto" in
13920         ''|0)   d_getlogin_r=undef
13921                 getlogin_r_proto=0
13922                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13923         * )     case "$getlogin_r_proto" in
13924                 REENTRANT_PROTO*) ;;
13925                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13926                 esac
13927                 echo "Prototype: $try" ;;
13928         esac
13929         ;;
13930         *)      case "$usethreads" in
13931                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13932                 esac
13933                 d_getlogin_r=undef
13934                 getlogin_r_proto=0
13935                 ;;
13936         esac
13937         ;;
13938 *)      getlogin_r_proto=0
13939         ;;
13940 esac
13941
13942 : see if getmnt exists
13943 set getmnt d_getmnt
13944 eval $inlibc
13945
13946 : see if getmntent exists
13947 set getmntent d_getmntent
13948 eval $inlibc
13949
13950 : see if getnameinfo exists
13951 set getnameinfo d_getnameinfo
13952 eval $inlibc
13953
13954 : see if getnetbyaddr exists
13955 set getnetbyaddr d_getnbyaddr
13956 eval $inlibc
13957
13958 : see if getnetbyname exists
13959 set getnetbyname d_getnbyname
13960 eval $inlibc
13961
13962 : see if getnetent exists
13963 set getnetent d_getnent
13964 eval $inlibc
13965
13966 : see if getnetbyaddr_r exists
13967 set getnetbyaddr_r d_getnetbyaddr_r
13968 eval $inlibc
13969 case "$d_getnetbyaddr_r" in
13970 "$define")
13971         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13972         case "$d_getnetbyaddr_r_proto:$usethreads" in
13973         ":define")      d_getnetbyaddr_r_proto=define
13974                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13975                 eval $hasproto ;;
13976         *)      ;;
13977         esac
13978         case "$d_getnetbyaddr_r_proto" in
13979         define)
13980         case "$getnetbyaddr_r_proto" in
13981         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13982         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13983         esac
13984         case "$getnetbyaddr_r_proto" in
13985         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13986         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13987         esac
13988         case "$getnetbyaddr_r_proto" in
13989         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13990         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13991         esac
13992         case "$getnetbyaddr_r_proto" in
13993         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13994         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13995         esac
13996         case "$getnetbyaddr_r_proto" in
13997         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13998         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13999         esac
14000         case "$getnetbyaddr_r_proto" in
14001         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14002         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14003         esac
14004         case "$getnetbyaddr_r_proto" in
14005         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14006         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14007         esac
14008         case "$getnetbyaddr_r_proto" in
14009         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14010         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14011         esac
14012         case "$getnetbyaddr_r_proto" in
14013         ''|0)   d_getnetbyaddr_r=undef
14014                 getnetbyaddr_r_proto=0
14015                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14016         * )     case "$getnetbyaddr_r_proto" in
14017                 REENTRANT_PROTO*) ;;
14018                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14019                 esac
14020                 echo "Prototype: $try" ;;
14021         esac
14022         ;;
14023         *)      case "$usethreads" in
14024                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14025                 esac
14026                 d_getnetbyaddr_r=undef
14027                 getnetbyaddr_r_proto=0
14028                 ;;
14029         esac
14030         ;;
14031 *)      getnetbyaddr_r_proto=0
14032         ;;
14033 esac
14034
14035 : see if getnetbyname_r exists
14036 set getnetbyname_r d_getnetbyname_r
14037 eval $inlibc
14038 case "$d_getnetbyname_r" in
14039 "$define")
14040         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14041         case "$d_getnetbyname_r_proto:$usethreads" in
14042         ":define")      d_getnetbyname_r_proto=define
14043                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14044                 eval $hasproto ;;
14045         *)      ;;
14046         esac
14047         case "$d_getnetbyname_r_proto" in
14048         define)
14049         case "$getnetbyname_r_proto" in
14050         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14051         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14052         esac
14053         case "$getnetbyname_r_proto" in
14054         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14055         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14056         esac
14057         case "$getnetbyname_r_proto" in
14058         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14059         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14060         esac
14061         case "$getnetbyname_r_proto" in
14062         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14063         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14064         esac
14065         case "$getnetbyname_r_proto" in
14066         ''|0)   d_getnetbyname_r=undef
14067                 getnetbyname_r_proto=0
14068                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14069         * )     case "$getnetbyname_r_proto" in
14070                 REENTRANT_PROTO*) ;;
14071                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14072                 esac
14073                 echo "Prototype: $try" ;;
14074         esac
14075         ;;
14076         *)      case "$usethreads" in
14077                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14078                 esac
14079                 d_getnetbyname_r=undef
14080                 getnetbyname_r_proto=0
14081                 ;;
14082         esac
14083         ;;
14084 *)      getnetbyname_r_proto=0
14085         ;;
14086 esac
14087
14088 : see if getnetent_r exists
14089 set getnetent_r d_getnetent_r
14090 eval $inlibc
14091 case "$d_getnetent_r" in
14092 "$define")
14093         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14094         case "$d_getnetent_r_proto:$usethreads" in
14095         ":define")      d_getnetent_r_proto=define
14096                 set d_getnetent_r_proto getnetent_r $hdrs
14097                 eval $hasproto ;;
14098         *)      ;;
14099         esac
14100         case "$d_getnetent_r_proto" in
14101         define)
14102         case "$getnetent_r_proto" in
14103         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14104         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14105         esac
14106         case "$getnetent_r_proto" in
14107         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14108         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14109         esac
14110         case "$getnetent_r_proto" in
14111         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14112         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14113         esac
14114         case "$getnetent_r_proto" in
14115         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14116         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14117         esac
14118         case "$getnetent_r_proto" in
14119         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14120         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14121         esac
14122         case "$getnetent_r_proto" in
14123         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14124         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14125         esac
14126         case "$getnetent_r_proto" in
14127         ''|0)   d_getnetent_r=undef
14128                 getnetent_r_proto=0
14129                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14130         * )     case "$getnetent_r_proto" in
14131                 REENTRANT_PROTO*) ;;
14132                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14133                 esac
14134                 echo "Prototype: $try" ;;
14135         esac
14136         ;;
14137         *)      case "$usethreads" in
14138                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14139                 esac
14140                 d_getnetent_r=undef
14141                 getnetent_r_proto=0
14142                 ;;
14143         esac
14144         ;;
14145 *)      getnetent_r_proto=0
14146         ;;
14147 esac
14148
14149 : see if prototypes for various getnetxxx netdb.h functions are available
14150 echo " "
14151 set d_getnetprotos getnetent $i_netdb netdb.h
14152 eval $hasproto
14153
14154 : see if getpagesize exists
14155 set getpagesize d_getpagsz
14156 eval $inlibc
14157
14158 : Optional checks for getprotobyname and getprotobynumber
14159
14160 : see if getprotobyname exists
14161 set getprotobyname d_getpbyname
14162 eval $inlibc
14163
14164 : see if getprotobynumber exists
14165 set getprotobynumber d_getpbynumber
14166 eval $inlibc
14167
14168 : see if getprotoent exists
14169 set getprotoent d_getpent
14170 eval $inlibc
14171
14172 : see if getpgid exists
14173 set getpgid d_getpgid
14174 eval $inlibc
14175
14176 : see if getpgrp2 exists
14177 set getpgrp2 d_getpgrp2
14178 eval $inlibc
14179
14180 : see if getppid exists
14181 set getppid d_getppid
14182 eval $inlibc
14183
14184 : see if getpriority exists
14185 set getpriority d_getprior
14186 eval $inlibc
14187
14188 : see if getprotobyname_r exists
14189 set getprotobyname_r d_getprotobyname_r
14190 eval $inlibc
14191 case "$d_getprotobyname_r" in
14192 "$define")
14193         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14194         case "$d_getprotobyname_r_proto:$usethreads" in
14195         ":define")      d_getprotobyname_r_proto=define
14196                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14197                 eval $hasproto ;;
14198         *)      ;;
14199         esac
14200         case "$d_getprotobyname_r_proto" in
14201         define)
14202         case "$getprotobyname_r_proto" in
14203         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14204         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14205         esac
14206         case "$getprotobyname_r_proto" in
14207         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14208         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14209         esac
14210         case "$getprotobyname_r_proto" in
14211         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14212         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14213         esac
14214         case "$getprotobyname_r_proto" in
14215         ''|0)   d_getprotobyname_r=undef
14216                 getprotobyname_r_proto=0
14217                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14218         * )     case "$getprotobyname_r_proto" in
14219                 REENTRANT_PROTO*) ;;
14220                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14221                 esac
14222                 echo "Prototype: $try" ;;
14223         esac
14224         ;;
14225         *)      case "$usethreads" in
14226                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14227                 esac
14228                 d_getprotobyname_r=undef
14229                 getprotobyname_r_proto=0
14230                 ;;
14231         esac
14232         ;;
14233 *)      getprotobyname_r_proto=0
14234         ;;
14235 esac
14236
14237 : see if getprotobynumber_r exists
14238 set getprotobynumber_r d_getprotobynumber_r
14239 eval $inlibc
14240 case "$d_getprotobynumber_r" in
14241 "$define")
14242         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14243         case "$d_getprotobynumber_r_proto:$usethreads" in
14244         ":define")      d_getprotobynumber_r_proto=define
14245                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14246                 eval $hasproto ;;
14247         *)      ;;
14248         esac
14249         case "$d_getprotobynumber_r_proto" in
14250         define)
14251         case "$getprotobynumber_r_proto" in
14252         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14253         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14254         esac
14255         case "$getprotobynumber_r_proto" in
14256         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14257         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14258         esac
14259         case "$getprotobynumber_r_proto" in
14260         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14261         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14262         esac
14263         case "$getprotobynumber_r_proto" in
14264         ''|0)   d_getprotobynumber_r=undef
14265                 getprotobynumber_r_proto=0
14266                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14267         * )     case "$getprotobynumber_r_proto" in
14268                 REENTRANT_PROTO*) ;;
14269                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14270                 esac
14271                 echo "Prototype: $try" ;;
14272         esac
14273         ;;
14274         *)      case "$usethreads" in
14275                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14276                 esac
14277                 d_getprotobynumber_r=undef
14278                 getprotobynumber_r_proto=0
14279                 ;;
14280         esac
14281         ;;
14282 *)      getprotobynumber_r_proto=0
14283         ;;
14284 esac
14285
14286 : see if getprotoent_r exists
14287 set getprotoent_r d_getprotoent_r
14288 eval $inlibc
14289 case "$d_getprotoent_r" in
14290 "$define")
14291         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14292         case "$d_getprotoent_r_proto:$usethreads" in
14293         ":define")      d_getprotoent_r_proto=define
14294                 set d_getprotoent_r_proto getprotoent_r $hdrs
14295                 eval $hasproto ;;
14296         *)      ;;
14297         esac
14298         case "$d_getprotoent_r_proto" in
14299         define)
14300         case "$getprotoent_r_proto" in
14301         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14302         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14303         esac
14304         case "$getprotoent_r_proto" in
14305         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14306         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14307         esac
14308         case "$getprotoent_r_proto" in
14309         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14310         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14311         esac
14312         case "$getprotoent_r_proto" in
14313         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14314         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14315         esac
14316         case "$getprotoent_r_proto" in
14317         ''|0)   d_getprotoent_r=undef
14318                 getprotoent_r_proto=0
14319                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14320         * )     case "$getprotoent_r_proto" in
14321                 REENTRANT_PROTO*) ;;
14322                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14323                 esac
14324                 echo "Prototype: $try" ;;
14325         esac
14326         ;;
14327         *)      case "$usethreads" in
14328                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14329                 esac
14330                 d_getprotoent_r=undef
14331                 getprotoent_r_proto=0
14332                 ;;
14333         esac
14334         ;;
14335 *)      getprotoent_r_proto=0
14336         ;;
14337 esac
14338
14339 : see if prototypes for various getprotoxxx netdb.h functions are available
14340 echo " "
14341 set d_getprotoprotos getprotoent $i_netdb netdb.h
14342 eval $hasproto
14343
14344 : see if getprpwnam exists
14345 set getprpwnam d_getprpwnam
14346 eval $inlibc
14347
14348 : see if getpwent exists
14349 set getpwent d_getpwent
14350 eval $inlibc
14351
14352 : see if getpwent_r exists
14353 set getpwent_r d_getpwent_r
14354 eval $inlibc
14355 case "$d_getpwent_r" in
14356 "$define")
14357         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14358         case "$d_getpwent_r_proto:$usethreads" in
14359         ":define")      d_getpwent_r_proto=define
14360                 set d_getpwent_r_proto getpwent_r $hdrs
14361                 eval $hasproto ;;
14362         *)      ;;
14363         esac
14364         case "$d_getpwent_r_proto" in
14365         define)
14366         case "$getpwent_r_proto" in
14367         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14368         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14369         esac
14370         case "$getpwent_r_proto" in
14371         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14372         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14373         esac
14374         case "$getpwent_r_proto" in
14375         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14376         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14377         esac
14378         case "$getpwent_r_proto" in
14379         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14380         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14381         esac
14382         case "$getpwent_r_proto" in
14383         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14384         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14385         esac
14386         case "$getpwent_r_proto" in
14387         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14388         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14389         esac
14390         case "$getpwent_r_proto" in
14391         ''|0)   d_getpwent_r=undef
14392                 getpwent_r_proto=0
14393                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14394         * )     case "$getpwent_r_proto" in
14395                 REENTRANT_PROTO*) ;;
14396                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14397                 esac
14398                 echo "Prototype: $try" ;;
14399         esac
14400         ;;
14401         *)      case "$usethreads" in
14402                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14403                 esac
14404                 d_getpwent_r=undef
14405                 getpwent_r_proto=0
14406                 ;;
14407         esac
14408         ;;
14409 *)      getpwent_r_proto=0
14410         ;;
14411 esac
14412
14413 : see if getpwnam_r exists
14414 set getpwnam_r d_getpwnam_r
14415 eval $inlibc
14416 case "$d_getpwnam_r" in
14417 "$define")
14418         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14419         case "$d_getpwnam_r_proto:$usethreads" in
14420         ":define")      d_getpwnam_r_proto=define
14421                 set d_getpwnam_r_proto getpwnam_r $hdrs
14422                 eval $hasproto ;;
14423         *)      ;;
14424         esac
14425         case "$d_getpwnam_r_proto" in
14426         define)
14427         case "$getpwnam_r_proto" in
14428         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14429         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14430         esac
14431         case "$getpwnam_r_proto" in
14432         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14433         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14434         esac
14435         case "$getpwnam_r_proto" in
14436         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14437         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14438         esac
14439         case "$getpwnam_r_proto" in
14440         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14441         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14442         esac
14443         case "$getpwnam_r_proto" in
14444         ''|0)   d_getpwnam_r=undef
14445                 getpwnam_r_proto=0
14446                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14447         * )     case "$getpwnam_r_proto" in
14448                 REENTRANT_PROTO*) ;;
14449                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14450                 esac
14451                 echo "Prototype: $try" ;;
14452         esac
14453         ;;
14454         *)      case "$usethreads" in
14455                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14456                 esac
14457                 d_getpwnam_r=undef
14458                 getpwnam_r_proto=0
14459                 ;;
14460         esac
14461         ;;
14462 *)      getpwnam_r_proto=0
14463         ;;
14464 esac
14465
14466 : see if getpwuid_r exists
14467 set getpwuid_r d_getpwuid_r
14468 eval $inlibc
14469 case "$d_getpwuid_r" in
14470 "$define")
14471         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14472         case "$d_getpwuid_r_proto:$usethreads" in
14473         ":define")      d_getpwuid_r_proto=define
14474                 set d_getpwuid_r_proto getpwuid_r $hdrs
14475                 eval $hasproto ;;
14476         *)      ;;
14477         esac
14478         case "$d_getpwuid_r_proto" in
14479         define)
14480         case "$getpwuid_r_proto" in
14481         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14482         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14483         esac
14484         case "$getpwuid_r_proto" in
14485         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14486         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14487         esac
14488         case "$getpwuid_r_proto" in
14489         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14490         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14491         esac
14492         case "$getpwuid_r_proto" in
14493         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14494         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14495         esac
14496         case "$getpwuid_r_proto" in
14497         ''|0)   d_getpwuid_r=undef
14498                 getpwuid_r_proto=0
14499                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14500         * )     case "$getpwuid_r_proto" in
14501                 REENTRANT_PROTO*) ;;
14502                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14503                 esac
14504                 echo "Prototype: $try" ;;
14505         esac
14506         ;;
14507         *)      case "$usethreads" in
14508                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14509                 esac
14510                 d_getpwuid_r=undef
14511                 getpwuid_r_proto=0
14512                 ;;
14513         esac
14514         ;;
14515 *)      getpwuid_r_proto=0
14516         ;;
14517 esac
14518
14519 : Optional checks for getsbyname and getsbyport
14520
14521 : see if getservbyname exists
14522 set getservbyname d_getsbyname
14523 eval $inlibc
14524
14525 : see if getservbyport exists
14526 set getservbyport d_getsbyport
14527 eval $inlibc
14528
14529 : see if getservent exists
14530 set getservent d_getsent
14531 eval $inlibc
14532
14533 : see if getservbyname_r exists
14534 set getservbyname_r d_getservbyname_r
14535 eval $inlibc
14536 case "$d_getservbyname_r" in
14537 "$define")
14538         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14539         case "$d_getservbyname_r_proto:$usethreads" in
14540         ":define")      d_getservbyname_r_proto=define
14541                 set d_getservbyname_r_proto getservbyname_r $hdrs
14542                 eval $hasproto ;;
14543         *)      ;;
14544         esac
14545         case "$d_getservbyname_r_proto" in
14546         define)
14547         case "$getservbyname_r_proto" in
14548         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14549         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14550         esac
14551         case "$getservbyname_r_proto" in
14552         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14553         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14554         esac
14555         case "$getservbyname_r_proto" in
14556         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14557         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14558         esac
14559         case "$getservbyname_r_proto" in
14560         ''|0)   d_getservbyname_r=undef
14561                 getservbyname_r_proto=0
14562                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14563         * )     case "$getservbyname_r_proto" in
14564                 REENTRANT_PROTO*) ;;
14565                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14566                 esac
14567                 echo "Prototype: $try" ;;
14568         esac
14569         ;;
14570         *)      case "$usethreads" in
14571                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14572                 esac
14573                 d_getservbyname_r=undef
14574                 getservbyname_r_proto=0
14575                 ;;
14576         esac
14577         ;;
14578 *)      getservbyname_r_proto=0
14579         ;;
14580 esac
14581
14582 : see if getservbyport_r exists
14583 set getservbyport_r d_getservbyport_r
14584 eval $inlibc
14585 case "$d_getservbyport_r" in
14586 "$define")
14587         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14588         case "$d_getservbyport_r_proto:$usethreads" in
14589         ":define")      d_getservbyport_r_proto=define
14590                 set d_getservbyport_r_proto getservbyport_r $hdrs
14591                 eval $hasproto ;;
14592         *)      ;;
14593         esac
14594         case "$d_getservbyport_r_proto" in
14595         define)
14596         case "$getservbyport_r_proto" in
14597         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14598         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14599         esac
14600         case "$getservbyport_r_proto" in
14601         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14602         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14603         esac
14604         case "$getservbyport_r_proto" in
14605         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14606         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14607         esac
14608         case "$getservbyport_r_proto" in
14609         ''|0)   d_getservbyport_r=undef
14610                 getservbyport_r_proto=0
14611                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14612         * )     case "$getservbyport_r_proto" in
14613                 REENTRANT_PROTO*) ;;
14614                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14615                 esac
14616                 echo "Prototype: $try" ;;
14617         esac
14618         ;;
14619         *)      case "$usethreads" in
14620                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14621                 esac
14622                 d_getservbyport_r=undef
14623                 getservbyport_r_proto=0
14624                 ;;
14625         esac
14626         ;;
14627 *)      getservbyport_r_proto=0
14628         ;;
14629 esac
14630
14631 : see if getservent_r exists
14632 set getservent_r d_getservent_r
14633 eval $inlibc
14634 case "$d_getservent_r" in
14635 "$define")
14636         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14637         case "$d_getservent_r_proto:$usethreads" in
14638         ":define")      d_getservent_r_proto=define
14639                 set d_getservent_r_proto getservent_r $hdrs
14640                 eval $hasproto ;;
14641         *)      ;;
14642         esac
14643         case "$d_getservent_r_proto" in
14644         define)
14645         case "$getservent_r_proto" in
14646         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14647         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14648         esac
14649         case "$getservent_r_proto" in
14650         ''|0) try='int getservent_r(struct servent*, char*, int);'
14651         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14652         esac
14653         case "$getservent_r_proto" in
14654         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14655         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14656         esac
14657         case "$getservent_r_proto" in
14658         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14659         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14660         esac
14661         case "$getservent_r_proto" in
14662         ''|0)   d_getservent_r=undef
14663                 getservent_r_proto=0
14664                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14665         * )     case "$getservent_r_proto" in
14666                 REENTRANT_PROTO*) ;;
14667                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14668                 esac
14669                 echo "Prototype: $try" ;;
14670         esac
14671         ;;
14672         *)      case "$usethreads" in
14673                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14674                 esac
14675                 d_getservent_r=undef
14676                 getservent_r_proto=0
14677                 ;;
14678         esac
14679         ;;
14680 *)      getservent_r_proto=0
14681         ;;
14682 esac
14683
14684 : see if prototypes for various getservxxx netdb.h functions are available
14685 echo " "
14686 set d_getservprotos getservent $i_netdb netdb.h
14687 eval $hasproto
14688
14689 : see if getspnam exists
14690 set getspnam d_getspnam
14691 eval $inlibc
14692
14693 : see if this is a shadow.h system
14694 set shadow.h i_shadow
14695 eval $inhdr
14696
14697 : see if getspnam_r exists
14698 set getspnam_r d_getspnam_r
14699 eval $inlibc
14700 case "$d_getspnam_r" in
14701 "$define")
14702         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14703         case "$d_getspnam_r_proto:$usethreads" in
14704         ":define")      d_getspnam_r_proto=define
14705                 set d_getspnam_r_proto getspnam_r $hdrs
14706                 eval $hasproto ;;
14707         *)      ;;
14708         esac
14709         case "$d_getspnam_r_proto" in
14710         define)
14711         case "$getspnam_r_proto" in
14712         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14713         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14714         esac
14715         case "$getspnam_r_proto" in
14716         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14717         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14718         esac
14719         case "$getspnam_r_proto" in
14720         ''|0)   d_getspnam_r=undef
14721                 getspnam_r_proto=0
14722                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14723         * )     case "$getspnam_r_proto" in
14724                 REENTRANT_PROTO*) ;;
14725                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14726                 esac
14727                 echo "Prototype: $try" ;;
14728         esac
14729         ;;
14730         *)      case "$usethreads" in
14731                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14732                 esac
14733                 d_getspnam_r=undef
14734                 getspnam_r_proto=0
14735                 ;;
14736         esac
14737         ;;
14738 *)      getspnam_r_proto=0
14739         ;;
14740 esac
14741
14742 : see if gettimeofday or ftime exists
14743 set gettimeofday d_gettimeod
14744 eval $inlibc
14745 case "$d_gettimeod" in
14746 "$undef")
14747         set ftime d_ftime 
14748         eval $inlibc
14749         ;;
14750 *)
14751         val="$undef"; set d_ftime; eval $setvar
14752         ;;
14753 esac
14754 case "$d_gettimeod$d_ftime" in
14755 "$undef$undef")
14756         echo " "
14757         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14758         ;;
14759 esac
14760
14761 : see if gmtime_r exists
14762 set gmtime_r d_gmtime_r
14763 eval $inlibc
14764 case "$d_gmtime_r" in
14765 "$define")
14766         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14767         case "$d_gmtime_r_proto:$usethreads" in
14768         ":define")      d_gmtime_r_proto=define
14769                 set d_gmtime_r_proto gmtime_r $hdrs
14770                 eval $hasproto ;;
14771         *)      ;;
14772         esac
14773         case "$d_gmtime_r_proto" in
14774         define)
14775         case "$gmtime_r_proto" in
14776         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14777         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14778         esac
14779         case "$gmtime_r_proto" in
14780         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14781         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14782         esac
14783         case "$gmtime_r_proto" in
14784         ''|0)   d_gmtime_r=undef
14785                 gmtime_r_proto=0
14786                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14787         * )     case "$gmtime_r_proto" in
14788                 REENTRANT_PROTO*) ;;
14789                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14790                 esac
14791                 echo "Prototype: $try" ;;
14792         esac
14793         ;;
14794         *)      case "$usethreads" in
14795                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14796                 esac
14797                 d_gmtime_r=undef
14798                 gmtime_r_proto=0
14799                 ;;
14800         esac
14801         ;;
14802 *)      gmtime_r_proto=0
14803         ;;
14804 esac
14805
14806 : see if hasmntopt exists
14807 set hasmntopt d_hasmntopt
14808 eval $inlibc
14809
14810 : see if this is a netinet/in.h or sys/in.h system
14811 set netinet/in.h i_niin sys/in.h i_sysin
14812 eval $inhdr
14813
14814 : see if arpa/inet.h has to be included
14815 set arpa/inet.h i_arpainet
14816 eval $inhdr
14817
14818 : see if htonl --and friends-- exists
14819 val=''
14820 set htonl val
14821 eval $inlibc
14822
14823 : Maybe they are macros.
14824 case "$val" in
14825 $undef)
14826         $cat >htonl.c <<EOM
14827 #include <stdio.h>
14828 #include <sys/types.h>
14829 #$i_niin I_NETINET_IN
14830 #$i_sysin I_SYS_IN
14831 #$i_arpainet I_ARPA_INET
14832 #ifdef I_NETINET_IN
14833 #include <netinet/in.h>
14834 #endif
14835 #ifdef I_SYS_IN
14836 #include <sys/in.h>
14837 #endif
14838 #ifdef I_ARPA_INET
14839 #include <arpa/inet.h>
14840 #endif
14841 #ifdef htonl
14842 printf("Defined as a macro.");
14843 #endif
14844 EOM
14845         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14846         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14847                 val="$define"
14848                 echo "But it seems to be defined as a macro." >&4
14849         fi
14850         $rm -f htonl.?
14851         ;;
14852 esac
14853 set d_htonl
14854 eval $setvar
14855
14856 : see if ilogbl exists
14857 set ilogbl d_ilogbl
14858 eval $inlibc
14859
14860 : index or strchr
14861 echo " "
14862 if set index val -f; eval $csym; $val; then
14863         if set strchr val -f d_strchr; eval $csym; $val; then
14864                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14865                         val="$define"
14866                         vali="$undef"
14867                         echo "strchr() found." >&4
14868                 else
14869                         val="$undef"
14870                         vali="$define"
14871                         echo "index() found." >&4
14872                 fi
14873         else
14874                 val="$undef"
14875                 vali="$define"
14876                 echo "index() found." >&4
14877         fi
14878 else
14879         if set strchr val -f d_strchr; eval $csym; $val; then
14880                 val="$define"
14881                 vali="$undef"
14882                 echo "strchr() found." >&4
14883         else
14884                 echo "No index() or strchr() found!" >&4
14885                 val="$undef"
14886                 vali="$undef"
14887         fi
14888 fi
14889 set d_strchr; eval $setvar
14890 val="$vali"
14891 set d_index; eval $setvar
14892
14893 : check whether inet_aton exists
14894 set inet_aton d_inetaton
14895 eval $inlibc
14896
14897 : see if inet_ntop exists
14898 set inet_ntop d_inetntop
14899 eval $inlibc
14900
14901 : see if inet_pton exists
14902 set inet_pton d_inetpton
14903 eval $inlibc
14904
14905 : Look for isascii
14906 echo " "
14907 $cat >isascii.c <<EOCP
14908 #include <stdio.h>
14909 #include <ctype.h>
14910 #$i_stdlib I_STDLIB
14911 #ifdef I_STDLIB
14912 #include <stdlib.h>
14913 #endif
14914 int main() {
14915         int c = 'A';
14916         if (isascii(c))
14917                 exit(0);
14918         else
14919                 exit(1);
14920 }
14921 EOCP
14922 set isascii
14923 if eval $compile; then
14924         echo "isascii() found." >&4
14925         val="$define"
14926 else
14927         echo "isascii() NOT found." >&4
14928         val="$undef"
14929 fi
14930 set d_isascii
14931 eval $setvar
14932 $rm -f isascii*
14933
14934 : Look for isblank
14935 echo " "
14936 $cat >isblank.c <<'EOCP'
14937 #include <stdio.h>
14938 #include <ctype.h>
14939 int main() {
14940         int c = ' ';
14941         if (isblank(c))
14942                 exit(0);
14943         else
14944                 exit(1);
14945 }
14946 EOCP
14947 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
14948         echo "isblank() found." >&4
14949         val="$define"
14950 else
14951         echo "isblank() NOT found." >&4
14952         val="$undef"
14953 fi
14954 set d_isblank
14955 eval $setvar
14956 $rm -f isblank*
14957
14958 : see if isfinite exists
14959 set isfinite d_isfinite
14960 eval $inlibc
14961
14962 : see if isinf exists
14963 set isinf d_isinf
14964 eval $inlibc
14965
14966 : see if isnan exists
14967 set isnan d_isnan
14968 eval $inlibc
14969
14970 : see if isnanl exists
14971 set isnanl d_isnanl
14972 eval $inlibc
14973
14974 : see if killpg exists
14975 set killpg d_killpg
14976 eval $inlibc
14977
14978 : see if lchown exists
14979 echo " "
14980 $cat > try.c <<'EOCP'
14981 /* System header to define __stub macros and hopefully few prototypes,
14982     which can conflict with char lchown(); below.  */
14983 #include <assert.h>
14984 /* Override any gcc2 internal prototype to avoid an error.  */
14985 /* We use char because int might match the return type of a gcc2
14986    builtin and then its argument prototype would still apply.  */
14987 char lchown();
14988 int main() {
14989     /*  The GNU C library defines this for functions which it implements
14990         to always fail with ENOSYS.  Some functions are actually named
14991         something starting with __ and the normal name is an alias.  */
14992 #if defined (__stub_lchown) || defined (__stub___lchown)
14993 choke me
14994 #else
14995 lchown();
14996 #endif
14997 ; return 0; }
14998 EOCP
14999 set try
15000 if eval $compile; then
15001     $echo "lchown() found." >&4
15002     val="$define"
15003 else
15004     $echo "lchown() NOT found." >&4
15005     val="$undef"
15006 fi
15007 set d_lchown
15008 eval $setvar
15009
15010 : See if number of significant digits in a double precision number is known
15011 echo " "
15012 $cat >ldbl_dig.c <<EOM
15013 #$i_limits I_LIMITS
15014 #$i_float I_FLOAT
15015 #ifdef I_LIMITS
15016 #include <limits.h>
15017 #endif
15018 #ifdef I_FLOAT
15019 #include <float.h>
15020 #endif
15021 #ifdef LDBL_DIG
15022 printf("Contains LDBL_DIG");
15023 #endif
15024 EOM
15025 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15026 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15027         echo "LDBL_DIG found." >&4
15028         val="$define"
15029 else
15030         echo "LDBL_DIG NOT found." >&4
15031         val="$undef"
15032 fi
15033 $rm -f ldbl_dig.?
15034 set d_ldbl_dig
15035 eval $setvar
15036
15037 : see if this is a math.h system
15038 set math.h i_math
15039 eval $inhdr
15040
15041 : check to see if math.h defines _LIB_VERSION
15042 d_libm_lib_version="$undef"
15043 case $i_math in
15044     $define)
15045         echo " "
15046         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15047         $cat >try.c <<EOCP
15048 #include <unistd.h>
15049 #include <math.h>
15050 int main (int argc, char *argv[])
15051 {
15052     printf ("%d\n", _LIB_VERSION);
15053     return (0);
15054     } /* main */
15055 EOCP
15056         set try
15057         if eval $compile; then
15058             foo=`$run ./try`
15059             echo "Yes, it does ($foo)" >&4
15060             d_libm_lib_version="$define"
15061         else
15062             echo "No, it does not (probably harmless)" >&4
15063             fi
15064         $rm_try
15065         ;;
15066
15067     esac
15068
15069 : see if link exists
15070 set link d_link
15071 eval $inlibc
15072
15073 : see if localtime_r exists
15074 set localtime_r d_localtime_r
15075 eval $inlibc
15076 case "$d_localtime_r" in
15077 "$define")
15078         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15079         case "$d_localtime_r_proto:$usethreads" in
15080         ":define")      d_localtime_r_proto=define
15081                 set d_localtime_r_proto localtime_r $hdrs
15082                 eval $hasproto ;;
15083         *)      ;;
15084         esac
15085         case "$d_localtime_r_proto" in
15086         define)
15087         case "$localtime_r_proto" in
15088         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15089         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15090         esac
15091         case "$localtime_r_proto" in
15092         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15093         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15094         esac
15095         case "$localtime_r_proto" in
15096         ''|0)   d_localtime_r=undef
15097                 localtime_r_proto=0
15098                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15099         * )     case "$localtime_r_proto" in
15100                 REENTRANT_PROTO*) ;;
15101                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15102                 esac
15103                 echo "Prototype: $try" ;;
15104         esac
15105         ;;
15106         *)      case "$usethreads" in
15107                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15108                 esac
15109                 d_localtime_r=undef
15110                 localtime_r_proto=0
15111                 ;;
15112         esac
15113         ;;
15114 *)      localtime_r_proto=0
15115         ;;
15116 esac
15117
15118 : see if localtime_r calls tzset
15119 case "$localtime_r_proto" in
15120 REENTRANT_PROTO*)
15121         $cat >try.c <<EOCP
15122 /*  Does our libc's localtime_r call tzset ?
15123  *  return 0 if so, 1 otherwise.
15124  */
15125 #$i_systypes    I_SYS_TYPES
15126 #$i_unistd      I_UNISTD
15127 #$i_time        I_TIME
15128 #$i_stdlib      I_STDLIB
15129 #$i_string      I_STRING
15130 #$i_malloc      I_MALLOC
15131 #ifdef I_SYS_TYPES
15132 #  include <sys/types.h>
15133 #endif
15134 #ifdef I_UNISTD
15135 #  include <unistd.h>
15136 #endif
15137 #ifdef I_TIME
15138 #  include <time.h>
15139 #endif
15140 #ifdef I_STDLIB
15141 #include <stdlib.h>
15142 #endif
15143 #ifdef I_STRING
15144 #  include <string.h>
15145 #else
15146 #  include <strings.h>
15147 #endif
15148 #ifdef I_MALLOC
15149 #  include <malloc.h>
15150 #endif
15151 int main()
15152 {
15153     time_t t = time(0L);
15154     char w_tz[]="TZ" "=GMT+5",
15155          e_tz[]="TZ" "=GMT-5",
15156         *tz_e = (char*)malloc(16),
15157         *tz_w = (char*)malloc(16);
15158     struct tm tm_e, tm_w;
15159     memset(&tm_e,'\0',sizeof(struct tm));
15160     memset(&tm_w,'\0',sizeof(struct tm));
15161     strcpy(tz_e,e_tz);
15162     strcpy(tz_w,w_tz);
15163
15164     putenv(tz_e);
15165     localtime_r(&t, &tm_e);
15166
15167     putenv(tz_w);
15168     localtime_r(&t, &tm_w);
15169
15170     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15171         return 1;
15172     return 0;
15173 }
15174 EOCP
15175         set try
15176         if eval $compile; then
15177             if $run ./try; then
15178                 d_localtime_r_needs_tzset=undef;
15179             else
15180                 d_localtime_r_needs_tzset=define;
15181             fi;
15182         else
15183             d_localtime_r_needs_tzset=undef;
15184         fi;
15185      ;;
15186   *)
15187      d_localtime_r_needs_tzset=undef;
15188      ;;
15189 esac
15190 $rm_try
15191
15192 : see if localeconv exists
15193 set localeconv d_locconv
15194 eval $inlibc
15195
15196 : see if lockf exists
15197 set lockf d_lockf
15198 eval $inlibc
15199
15200 : see if prototype for lseek is available
15201 echo " "
15202 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15203 eval $hasproto
15204
15205 : see if lstat exists
15206 set lstat d_lstat
15207 eval $inlibc
15208
15209 : see if madvise exists
15210 set madvise d_madvise
15211 eval $inlibc
15212
15213 : see if malloc_size exists
15214 set malloc_size d_malloc_size
15215 eval $inlibc
15216
15217 : see if malloc_size_good exists
15218 set malloc_good_size d_malloc_good_size
15219 eval $inlibc
15220
15221 : see if mblen exists
15222 set mblen d_mblen
15223 eval $inlibc
15224
15225 : see if mbstowcs exists
15226 set mbstowcs d_mbstowcs
15227 eval $inlibc
15228
15229 : see if mbtowc exists
15230 set mbtowc d_mbtowc
15231 eval $inlibc
15232
15233 : see if memchr exists
15234 set memchr d_memchr
15235 eval $inlibc
15236
15237 : see if memcmp exists
15238 set memcmp d_memcmp
15239 eval $inlibc
15240
15241 : see if memcpy exists
15242 set memcpy d_memcpy
15243 eval $inlibc
15244
15245 : see if memmove exists
15246 set memmove d_memmove
15247 eval $inlibc
15248
15249 : see if memset exists
15250 set memset d_memset
15251 eval $inlibc
15252
15253 : see if mkdir exists
15254 set mkdir d_mkdir
15255 eval $inlibc
15256
15257 : see if mkdtemp exists
15258 set mkdtemp d_mkdtemp
15259 eval $inlibc
15260
15261 : see if mkfifo exists
15262 set mkfifo d_mkfifo
15263 eval $inlibc
15264
15265 : see if mkstemp exists
15266 set mkstemp d_mkstemp
15267 eval $inlibc
15268
15269 : see if mkstemps exists
15270 set mkstemps d_mkstemps
15271 eval $inlibc
15272
15273 : see if mktime exists
15274 set mktime d_mktime
15275 eval $inlibc
15276
15277 : see if this is a sys/mman.h system
15278 set sys/mman.h i_sysmman
15279 eval $inhdr
15280
15281 : see if mmap exists
15282 set mmap d_mmap
15283 eval $inlibc
15284 : see what shmat returns
15285 : default to something harmless
15286 mmaptype='void *'
15287 case "$i_sysmman$d_mmap" in
15288 "$define$define")
15289         $cat >mmap.c <<'END'
15290 #include <sys/mman.h>
15291 void *mmap();
15292 END
15293         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15294                 mmaptype='void *'
15295         else
15296                 mmaptype='caddr_t'
15297         fi
15298         echo "and it returns ($mmaptype)." >&4
15299         ;;
15300 esac
15301
15302
15303
15304 : see if sqrtl exists
15305 set sqrtl d_sqrtl
15306 eval $inlibc
15307
15308 : see if scalbnl exists
15309 set scalbnl d_scalbnl
15310 eval $inlibc
15311
15312 : see if modfl exists
15313 set modfl d_modfl
15314 eval $inlibc
15315
15316 : see if prototype for modfl is available
15317 echo " "
15318 set d_modflproto modfl $i_math math.h
15319 eval $hasproto
15320
15321 d_modfl_pow32_bug="$undef"
15322
15323 case "$d_longdbl$d_modfl" in
15324 $define$define)
15325         $cat <<EOM
15326 Checking to see whether your modfl() is okay for large values...
15327 EOM
15328 $cat >try.c <<EOCP
15329 #include <math.h>
15330 #include <stdio.h>
15331 EOCP
15332 if $test "X$d_modflproto" != "X$define"; then
15333         $cat >>try.c <<EOCP
15334 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15335 long double modfl (long double, long double *);
15336 EOCP
15337 fi
15338 $cat >>try.c <<EOCP
15339 int main() {
15340     long double nv = 4294967303.15;
15341     long double v, w;
15342     v = modfl(nv, &w);
15343 #ifdef __GLIBC__
15344     printf("glibc");
15345 #endif
15346     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15347     return 0;
15348 }
15349 EOCP
15350         case "$osname:$gccversion" in
15351         aix:)   saveccflags="$ccflags"
15352                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15353         esac
15354         set try
15355         if eval $compile; then
15356                 foo=`$run ./try`
15357                 case "$foo" in
15358                 *" 4294967303.150000 1.150000 4294967302.000000")
15359                         echo >&4 "Your modfl() is broken for large values."
15360                         d_modfl_pow32_bug="$define"
15361                         case "$foo" in
15362                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15363                         ;;
15364                         esac
15365                         ;;
15366                 *" 4294967303.150000 0.150000 4294967303.000000")
15367                         echo >&4 "Your modfl() seems okay for large values."
15368                         ;;
15369                 *)      echo >&4 "I don't understand your modfl() at all."
15370                         d_modfl="$undef"
15371                         ;;
15372                 esac
15373                 $rm_try
15374         else
15375                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15376                 d_modfl="$undef"
15377         fi
15378         case "$osname:$gccversion" in
15379         aix:)   ccflags="$saveccflags" ;; # restore
15380         esac
15381         ;;
15382 esac
15383
15384 if $test "$uselongdouble" = "$define"; then
15385     message=""
15386     if $test "$d_sqrtl" != "$define"; then
15387         message="$message sqrtl"
15388     fi
15389     if $test "$d_modfl" != "$define"; then
15390         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15391             echo "You have both aintl and copysignl, so I can emulate modfl."
15392         else
15393             message="$message modfl"
15394         fi
15395     fi
15396     if $test "$d_frexpl" != "$define"; then
15397         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15398             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15399         else
15400             message="$message frexpl"
15401         fi
15402     fi
15403
15404     if $test "$message" != ""; then
15405         $cat <<EOM >&4
15406
15407 *** You requested the use of long doubles but you do not seem to have
15408 *** the following mathematical functions needed for long double support:
15409 ***    $message
15410 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15411 *** Cannot continue, aborting.
15412
15413 EOM
15414
15415         exit 1
15416     fi
15417 fi
15418
15419 : see if mprotect exists
15420 set mprotect d_mprotect
15421 eval $inlibc
15422
15423 : see if msgctl exists
15424 set msgctl d_msgctl
15425 eval $inlibc
15426
15427 : see if msgget exists
15428 set msgget d_msgget
15429 eval $inlibc
15430
15431 : see if msgsnd exists
15432 set msgsnd d_msgsnd
15433 eval $inlibc
15434
15435 : see if msgrcv exists
15436 set msgrcv d_msgrcv
15437 eval $inlibc
15438
15439 : see how much of the 'msg*(2)' library is present.
15440 h_msg=true
15441 echo " "
15442 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15443 *"$undef"*) h_msg=false;;
15444 esac
15445 case "$osname" in
15446 freebsd)
15447     case "`ipcs 2>&1`" in
15448     "SVID messages"*"not configured"*)
15449         echo "Your $osname does not have the msg*(2) configured." >&4
15450         h_msg=false
15451         val="$undef"
15452         set msgctl d_msgctl
15453         eval $setvar
15454         set msgget d_msgget
15455         eval $setvar
15456         set msgsnd d_msgsnd
15457         eval $setvar
15458         set msgrcv d_msgrcv
15459         eval $setvar
15460         ;;
15461     esac
15462     ;;
15463 esac
15464 : we could also check for sys/ipc.h ...
15465 if $h_msg && $test `./findhdr sys/msg.h`; then
15466         echo "You have the full msg*(2) library." >&4
15467         val="$define"
15468 else
15469         echo "You don't have the full msg*(2) library." >&4
15470         val="$undef"
15471 fi
15472 set d_msg
15473 eval $setvar
15474
15475 : Check for msghdr_s
15476 echo " "
15477 echo "Checking to see if your system supports struct msghdr..." >&4
15478 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15479 eval $hasstruct
15480 case "$d_msghdr_s" in
15481 "$define")      echo "Yes, it does."   ;;
15482 *)              echo "No, it doesn't." ;;
15483 esac
15484
15485
15486 : see if msync exists
15487 set msync d_msync
15488 eval $inlibc
15489
15490 : see if munmap exists
15491 set munmap d_munmap
15492 eval $inlibc
15493
15494 : see if nice exists
15495 set nice d_nice
15496 eval $inlibc
15497
15498 : see if this is a langinfo.h system
15499 set langinfo.h i_langinfo
15500 eval $inhdr
15501
15502 : see if nl_langinfo exists
15503 set nl_langinfo d_nl_langinfo
15504 eval $inlibc
15505
15506 : check for volatile keyword
15507 echo " "
15508 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15509 $cat >try.c <<'EOCP'
15510 int main()
15511 {
15512         typedef struct _goo_struct goo_struct;
15513         goo_struct * volatile goo = ((goo_struct *)0);
15514         struct _goo_struct {
15515                 long long_int;
15516                 int reg_int;
15517                 char char_var;
15518         };
15519         typedef unsigned short foo_t;
15520         char *volatile foo;
15521         volatile int bar;
15522         volatile foo_t blech;
15523         foo = foo;
15524 }
15525 EOCP
15526 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15527         val="$define"
15528         echo "Yup, it does."
15529 else
15530         val="$undef"
15531         echo "Nope, it doesn't."
15532 fi
15533 set d_volatile
15534 eval $setvar
15535 $rm_try
15536
15537 : Check basic sizes
15538 echo " "
15539 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15540
15541 case "$use64bitint:$d_quad:$quadtype" in
15542 define:define:?*)
15543         ivtype="$quadtype"
15544         uvtype="$uquadtype"
15545         ivsize=8
15546         uvsize=8
15547         ;;
15548 *)      ivtype="long"
15549         uvtype="unsigned long"
15550         ivsize=$longsize
15551         uvsize=$longsize
15552         ;;
15553 esac
15554
15555 case "$uselongdouble:$d_longdbl" in
15556 define:define)
15557         nvtype="long double"
15558         nvsize=$longdblsize
15559         ;;
15560 *)      nvtype=double
15561         nvsize=$doublesize
15562         ;;
15563 esac
15564
15565 $echo "(IV will be "$ivtype", $ivsize bytes)"
15566 $echo "(UV will be "$uvtype", $uvsize bytes)"
15567 $echo "(NV will be "$nvtype", $nvsize bytes)"
15568
15569 $cat >try.c <<EOCP
15570 #$i_inttypes I_INTTYPES
15571 #ifdef I_INTTYPES
15572 #include <inttypes.h>
15573 #endif
15574 #include <stdio.h>
15575 int main() {
15576 #ifdef INT8
15577    int8_t i =  INT8_MAX;
15578   uint8_t u = UINT8_MAX;
15579   printf("int8_t\n");
15580 #endif
15581 #ifdef INT16
15582    int16_t i =  INT16_MAX;
15583   uint16_t i = UINT16_MAX;
15584   printf("int16_t\n");
15585 #endif
15586 #ifdef INT32
15587    int32_t i =  INT32_MAX;
15588   uint32_t u = UINT32_MAX;
15589   printf("int32_t\n");
15590 #endif
15591 }
15592 EOCP
15593
15594 i8type="signed char"
15595 u8type="unsigned char"
15596 i8size=1
15597 u8size=1
15598
15599 case "$i16type" in
15600 '')     case "$shortsize" in
15601         2)      i16type=short
15602                 u16type="unsigned short"
15603                 i16size=$shortsize
15604                 u16size=$shortsize
15605                 ;;
15606         esac
15607         ;;
15608 esac
15609 case "$i16type" in
15610 '')     set try -DINT16
15611         if eval $compile; then
15612                 case "`$run ./try`" in
15613                 int16_t)
15614                         i16type=int16_t
15615                         u16type=uint16_t
15616                         i16size=2
15617                         u16size=2
15618                         ;;
15619                 esac
15620         fi
15621         ;;
15622 esac
15623 case "$i16type" in
15624 '')     if $test $shortsize -ge 2; then
15625                 i16type=short
15626                 u16type="unsigned short"
15627                 i16size=$shortsize
15628                 u16size=$shortsize
15629         fi
15630         ;;
15631 esac
15632
15633 case "$i32type" in
15634 '')     case "$longsize" in
15635         4)      i32type=long
15636                 u32type="unsigned long"
15637                 i32size=$longsize
15638                 u32size=$longsize
15639                 ;;
15640         *)      case "$intsize" in
15641                 4)      i32type=int
15642                         u32type="unsigned int"
15643                         i32size=$intsize
15644                         u32size=$intsize
15645                         ;;
15646                 esac
15647                 ;;
15648         esac
15649         ;;
15650 esac
15651 case "$i32type" in
15652 '')     set try -DINT32
15653         if eval $compile; then
15654                 case "`$run ./try`" in
15655                 int32_t)
15656                         i32type=int32_t
15657                         u32type=uint32_t
15658                         i32size=4
15659                         u32size=4
15660                         ;;
15661                 esac
15662         fi
15663         ;;
15664 esac
15665 case "$i32type" in
15666 '')     if $test $intsize -ge 4; then
15667                 i32type=int
15668                 u32type="unsigned int"
15669                 i32size=$intsize
15670                 u32size=$intsize
15671         fi
15672         ;;
15673 esac
15674
15675 case "$i64type" in
15676 '')     case "$d_quad:$quadtype" in
15677         define:?*)
15678                 i64type="$quadtype"
15679                 u64type="$uquadtype"
15680                 i64size=8
15681                 u64size=8
15682                 ;;
15683         esac
15684         ;;
15685 esac
15686
15687 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15688 : volatile so that the compiler has to store it out to memory.
15689 if test X"$d_volatile" = X"$define"; then
15690         volatile=volatile
15691 fi
15692 $cat <<EOP >try.c
15693 #include <stdio.h>
15694 #$i_stdlib I_STDLIB
15695 #ifdef I_STDLIB
15696 #include <stdlib.h>
15697 #endif
15698 #include <sys/types.h>
15699 #include <signal.h>
15700 #ifdef SIGFPE
15701 $volatile int bletched = 0;
15702 $signal_t blech(int s) { bletched = 1; }
15703 #endif
15704 int main() {
15705     $uvtype u = 0;
15706     $nvtype d;
15707     int     n = 8 * $uvsize;
15708     int     i;
15709 #ifdef SIGFPE
15710     signal(SIGFPE, blech);
15711 #endif
15712
15713     for (i = 0; i < n; i++) {
15714       u = u << 1 | ($uvtype)1;
15715       d = ($nvtype)u;
15716       if (($uvtype)d != u)
15717         break;
15718       if (d <= 0)
15719         break;
15720       d = ($nvtype)(u - 1);
15721       if (($uvtype)d != (u - 1))
15722         break;
15723 #ifdef SIGFPE
15724       if (bletched)
15725         break;
15726 #endif
15727     }
15728     printf("%d\n", ((i == n) ? -n : i));
15729     exit(0);
15730 }
15731 EOP
15732 set try
15733
15734 d_nv_preserves_uv="$undef"
15735 if eval $compile; then
15736         nv_preserves_uv_bits="`$run ./try`"
15737 fi
15738 case "$nv_preserves_uv_bits" in
15739 \-[1-9]*)
15740         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15741         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15742         d_nv_preserves_uv="$define"
15743         ;;
15744 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15745         d_nv_preserves_uv="$undef" ;;
15746 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15747         nv_preserves_uv_bits="0" ;;
15748 esac
15749 $rm_try
15750
15751 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15752 : volatile so that the compiler has to store it out to memory.
15753 if test X"$d_volatile" = X"$define"; then
15754         volatile=volatile
15755 fi
15756 $cat <<EOP >try.c
15757 #include <stdio.h>
15758
15759 typedef $nvtype NV;
15760
15761 int
15762 main() {
15763   NV value = 2;
15764   int count = 1;
15765
15766   while(count < 256) {
15767     $volatile NV up = value + 1.0;
15768     $volatile NV negated = -value;
15769     $volatile NV down = negated - 1.0;
15770     $volatile NV got_up = up - value;
15771     int up_good = got_up == 1.0;
15772     int got_down = down - negated;
15773     int down_good = got_down == -1.0;
15774
15775     if (down_good != up_good) {
15776       fprintf(stderr,
15777               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15778               up_good, (double) got_up, down_good, (double) got_down,
15779               count, (double) value);
15780       return 1;
15781     }
15782     if (!up_good) {
15783       while (1) {
15784         if (count > 8) {
15785           count -= 8;
15786           fputs("256.0", stdout);
15787         } else {
15788           count--;
15789           fputs("2.0", stdout);
15790         }
15791         if (!count) {
15792           puts("");
15793           return 0;
15794         }
15795         fputs("*", stdout);
15796       }
15797     }
15798     value *= 2;
15799     ++count;
15800   }
15801   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15802           count, (double) value);
15803   return 1;
15804 }
15805 EOP
15806 set try
15807
15808 nv_overflows_integers_at='0'
15809 if eval $compile; then
15810     xxx="`$run ./try`"
15811     case "$?" in
15812         0)
15813             case "$xxx" in
15814                 2*)  cat >&4 <<EOM
15815 The largest integer your NVs can preserve is equal to $xxx
15816 EOM
15817                     nv_overflows_integers_at="$xxx"
15818                     ;;
15819                 *)  cat >&4 <<EOM
15820 Cannot determine the largest integer value your NVs can hold, unexpected output
15821 '$xxx'
15822 EOM
15823                     ;;
15824             esac
15825             ;;
15826         *)  cat >&4 <<EOM
15827 Cannot determine the largest integer value your NVs can hold
15828 EOM
15829             ;;
15830     esac
15831 fi
15832 $rm_try
15833
15834 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15835 : volatile so that the compiler has to store it out to memory.
15836 if test X"$d_volatile" = X"$define"; then
15837         volatile=volatile
15838 fi
15839 $cat <<EOP >try.c
15840 #include <stdio.h>
15841 #$i_stdlib I_STDLIB
15842 #ifdef I_STDLIB
15843 #include <stdlib.h>
15844 #endif
15845 #$i_string I_STRING
15846 #ifdef I_STRING
15847 #  include <string.h>
15848 #else
15849 #  include <strings.h>
15850 #endif
15851 #include <sys/types.h>
15852 #include <signal.h>
15853 #ifdef SIGFPE
15854 $volatile int bletched = 0;
15855 $signal_t blech(int s) { bletched = 1; }
15856 #endif
15857
15858 int checkit($nvtype d, char *where) {
15859     unsigned char *p = (char *)&d;
15860     unsigned char *end = p + sizeof(d);
15861     int fail = 0;
15862
15863     while (p < end)
15864         fail += *p++;
15865
15866     if (!fail)
15867         return 0;
15868
15869     p = (char *)&d;
15870     printf("No - %s: 0x", where);
15871     while (p < end)
15872         printf ("%02X", *p++);
15873     printf("\n");
15874     return 1;
15875 }
15876
15877 int main(int argc, char **argv) {
15878     $nvtype d = 0.0;
15879     int fail = 0;
15880     fail += checkit(d, "0.0");
15881
15882     /* The compiler shouldn't be assuming that bletched is 0  */
15883     d = bletched;
15884
15885     fail += checkit(d, "bleched");
15886
15887 #ifdef SIGFPE
15888     signal(SIGFPE, blech);
15889 #endif
15890
15891     /* Paranoia - the compiler should have no way of knowing that ANSI says
15892        that argv[argc] will always be NULL.  Actually, if it did assume this it
15893        would be buggy, as this is C and main() can be called from elsewhere in
15894        the program.  */
15895     d = argv[argc] ? 1 : 0;
15896
15897     if (d) {
15898         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15899     }
15900
15901     fail += checkit(d, "ternary");
15902
15903     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15904
15905     if (d != 0.0) {
15906         printf("No - memset doesn't give 0.0\n");
15907         /* This might just blow up:  */
15908         printf("(gives %g)\n", d);
15909         return 1;
15910     }
15911
15912 #ifdef SIGFPE
15913     if (bletched) {
15914         printf("No - something bleched\n");
15915         return 1;
15916     }
15917 #endif
15918     if (fail) {
15919       printf("No - %d fail(s)\n", fail);
15920       return 1;
15921     }
15922     printf("Yes\n");
15923     return 0;
15924 }
15925 EOP
15926 set try
15927
15928 d_nv_zero_is_allbits_zero="$undef"
15929 if eval $compile; then
15930     xxx="`$run ./try`"
15931     case "$?" in
15932         0)
15933             case "$xxx" in
15934                 Yes)  cat >&4 <<EOM
15935 0.0 is represented as all bits zero in memory
15936 EOM
15937                     d_nv_zero_is_allbits_zero="$define"
15938                     ;;
15939                 *)  cat >&4 <<EOM
15940 0.0 is not represented as all bits zero in memory
15941 EOM
15942                     d_nv_zero_is_allbits_zero="$undef"
15943                     ;;
15944             esac
15945             ;;
15946         *)  cat >&4 <<EOM
15947 0.0 is not represented as all bits zero in memory
15948 EOM
15949             d_nv_zero_is_allbits_zero="$undef"
15950             ;;
15951     esac
15952 fi
15953 $rm_try
15954
15955 : check for off64_t
15956 echo " "
15957 echo "Checking to see if you have off64_t..." >&4
15958 $cat >try.c <<EOCP
15959 #include <sys/types.h>
15960 #include <unistd.h>
15961 int main() { off64_t x = 7; }
15962 EOCP
15963 set try
15964 if eval $compile; then
15965         val="$define"
15966         echo "You have off64_t."
15967 else
15968         val="$undef"
15969         echo "You do not have off64_t."
15970         case "$lseeksize" in
15971         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15972         esac
15973 fi
15974 $rm_try
15975 set d_off64_t
15976 eval $setvar
15977
15978 : how to create joinable pthreads
15979 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15980         echo " "
15981         echo "Checking what constant to use for creating joinable pthreads..." >&4
15982         $cat >try.c <<'EOCP'
15983 #include <pthread.h>
15984 int main() {
15985     int detachstate = JOINABLE;
15986 }
15987 EOCP
15988         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15989         if eval $compile; then
15990                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15991                 val="$undef" # Yes, undef.
15992                 set d_old_pthread_create_joinable
15993                 eval $setvar
15994                 val=""
15995                 set old_pthread_create_joinable
15996                 eval $setvar
15997         else
15998                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15999                 if eval $compile; then
16000                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16001                         val="$define"
16002                         set d_old_pthread_create_joinable
16003                         eval $setvar
16004                         val=PTHREAD_CREATE_UNDETACHED
16005                         set old_pthread_create_joinable
16006                         eval $setvar
16007                 else
16008                         set try -DJOINABLE=__UNDETACHED
16009                         if eval $compile; then
16010                                 echo "You seem to use __UNDETACHED." >&4
16011                                 val="$define"
16012                                 set d_old_pthread_create_joinable
16013                                 eval $setvar
16014                                 val=__UNDETACHED
16015                                 set old_pthread_create_joinable
16016                                 eval $setvar
16017                         else
16018                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16019                                 val="$define"
16020                                 set d_old_pthread_create_joinable
16021                                 eval $setvar
16022                                 val=0
16023                                 set old_pthread_create_joinable
16024                                 eval $setvar
16025                         fi
16026                 fi
16027         fi
16028         $rm_try
16029 else
16030     d_old_pthread_create_joinable="$undef"
16031     old_pthread_create_joinable=""
16032 fi
16033
16034 : see if pause exists
16035 set pause d_pause
16036 eval $inlibc
16037
16038 : see if poll exists
16039 set poll d_poll
16040 eval $inlibc
16041
16042 : see if prctl exists
16043 set prctl d_prctl
16044 eval $inlibc
16045
16046 : see if prctl supports PR_SET_NAME
16047 d_prctl_set_name=$undef
16048 case $d_prctl in
16049     $define)
16050         $cat >try.c <<EOM
16051 #include <sys/prctl.h>
16052
16053 int main (int argc, char *argv[])
16054 {
16055     return (prctl (PR_SET_NAME, "Test"));
16056     } /* main */
16057 EOM
16058         set try
16059         if eval $compile_ok && $run ./try; then
16060             echo "Your prctl (PR_SET_NAME, ...) works"
16061             d_prctl_set_name=$define
16062             fi
16063         $rm_try
16064         ;;
16065     esac
16066
16067 : see if readlink exists
16068 set readlink d_readlink
16069 eval $inlibc
16070
16071 : Check if exe is symlink to abs path of executing program
16072 echo " "
16073 procselfexe=''
16074 val="$undef"
16075 case "$d_readlink" in
16076     "$define")
16077         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16078         : more tidy to avoid an extra level of symlink
16079         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16080         while test $# -gt 0; do
16081             type=$1; try=$2
16082             shift; shift
16083             if $issymlink $try; then
16084                 $ls -l $try > reflect
16085                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16086                     echo "You have $type-like $try."
16087                     procselfexe='"'$try'"'
16088                     val="$define"
16089                     : This will break out of the loop
16090                     set X; shift
16091                 fi
16092             fi
16093         done
16094         ;;
16095 esac
16096 $rm -f reflect
16097 set d_procselfexe
16098 eval $setvar
16099
16100 : backward compatibility for d_hvfork
16101 if test X$d_hvfork != X; then
16102         d_vfork="$d_hvfork"
16103         d_hvfork=''
16104 fi
16105 : see if there is a vfork
16106 val=''
16107 set vfork val
16108 eval $inlibc
16109
16110 d_pseudofork=$undef
16111
16112 : Ok, but do we want to use it. vfork is reportedly unreliable in
16113 : perl on Solaris 2.x, and probably elsewhere.
16114 case "$val" in
16115 $define)
16116         echo " "
16117         case "$usevfork" in
16118         false) dflt='n';;
16119         *) dflt='y';;
16120         esac
16121         cat <<'EOM'
16122
16123 Perl can only use a vfork() that doesn't suffer from strict
16124 restrictions on calling functions or modifying global data in
16125 the child.  For example, glibc-2.1 contains such a vfork()
16126 that is unsuitable.  If your system provides a proper fork()
16127 call, chances are that you do NOT want perl to use vfork().
16128
16129 EOM
16130         rp="Do you still want to use vfork()?"
16131         . ./myread
16132         case "$ans" in
16133         y|Y) ;;
16134         *)
16135                 echo "Ok, we won't use vfork()."
16136                 val="$undef"
16137                 ;;
16138         esac
16139         ;;
16140 esac
16141 set d_vfork
16142 eval $setvar
16143 case "$d_vfork" in
16144 $define) usevfork='true';;
16145 *) usevfork='false';;
16146 esac
16147
16148 : see whether the pthread_atfork exists
16149 $cat >try.c <<EOP
16150 #include <pthread.h>
16151 #include <stdio.h>
16152 int main() {
16153 #ifdef  PTHREAD_ATFORK
16154         pthread_atfork(NULL,NULL,NULL);
16155 #endif
16156 }
16157 EOP
16158
16159 : see if pthread_atfork exists
16160 set try -DPTHREAD_ATFORK
16161 if eval $compile; then
16162     val="$define"
16163 else
16164     val="$undef"
16165 fi
16166 case "$usethreads" in
16167 $define)
16168         case "$val" in
16169         $define) echo 'pthread_atfork found.' >&4        ;;
16170         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16171         esac
16172 esac
16173 set d_pthread_atfork
16174 eval $setvar
16175
16176 : see if pthread_attr_setscope exists
16177 set pthread_attr_setscope d_pthread_attr_setscope
16178 eval $inlibc
16179
16180 : see whether the various POSIXish _yields exist
16181 $cat >try.c <<EOP
16182 #include <pthread.h>
16183 #include <stdio.h>
16184 int main() {
16185 #ifdef SCHED_YIELD
16186         sched_yield();
16187 #else
16188 #ifdef PTHREAD_YIELD
16189         pthread_yield();
16190 #else
16191 #ifdef PTHREAD_YIELD_NULL
16192         pthread_yield(NULL);
16193 #endif
16194 #endif
16195 #endif
16196 }
16197 EOP
16198 : see if sched_yield exists
16199 set try -DSCHED_YIELD
16200 if eval $compile; then
16201     val="$define"
16202     sched_yield='sched_yield()'
16203 else
16204     val="$undef"
16205 fi
16206 case "$usethreads" in
16207 $define)
16208         case "$val" in
16209         $define) echo 'sched_yield() found.' >&4        ;;
16210         *)       echo 'sched_yield() NOT found.' >&4    ;;
16211         esac
16212 esac
16213 set d_sched_yield
16214 eval $setvar
16215
16216 : see if pthread_yield exists
16217 set try -DPTHREAD_YIELD
16218 if eval $compile; then
16219     val="$define"
16220     case "$sched_yield" in
16221     '') sched_yield='pthread_yield()' ;;
16222     esac
16223 else
16224     set try -DPTHREAD_YIELD_NULL
16225     if eval $compile; then
16226         val="$define"
16227         case "$sched_yield" in
16228         '') sched_yield='pthread_yield(NULL)' ;;
16229         esac
16230     else
16231         val="$undef"
16232     fi
16233 fi
16234 case "$usethreads" in
16235 $define)
16236         case "$val" in
16237         $define) echo 'pthread_yield() found.' >&4      ;;
16238         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16239         esac
16240         ;;
16241 esac
16242 set d_pthread_yield
16243 eval $setvar
16244 case "$sched_yield" in
16245 '') sched_yield=undef ;;
16246 esac
16247 $rm_try
16248
16249 : see if random_r exists
16250 set random_r d_random_r
16251 eval $inlibc
16252 case "$d_random_r" in
16253 "$define")
16254         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16255         case "$d_random_r_proto:$usethreads" in
16256         ":define")      d_random_r_proto=define
16257                 set d_random_r_proto random_r $hdrs
16258                 eval $hasproto ;;
16259         *)      ;;
16260         esac
16261         case "$d_random_r_proto" in
16262         define)
16263         case "$random_r_proto" in
16264         ''|0) try='int random_r(int*, struct random_data*);'
16265         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16266         esac
16267         case "$random_r_proto" in
16268         ''|0) try='int random_r(long*, struct random_data*);'
16269         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16270         esac
16271         case "$random_r_proto" in
16272         ''|0) try='int random_r(struct random_data*, int32_t*);'
16273         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16274         esac
16275         case "$random_r_proto" in
16276         ''|0)   d_random_r=undef
16277                 random_r_proto=0
16278                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16279         * )     case "$random_r_proto" in
16280                 REENTRANT_PROTO*) ;;
16281                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16282                 esac
16283                 echo "Prototype: $try" ;;
16284         esac
16285         ;;
16286         *)      case "$usethreads" in
16287                 define) echo "random_r has no prototype, not using it." >&4 ;;
16288                 esac
16289                 d_random_r=undef
16290                 random_r_proto=0
16291                 ;;
16292         esac
16293         ;;
16294 *)      random_r_proto=0
16295         ;;
16296 esac
16297
16298 : see if readdir and friends exist
16299 set readdir d_readdir
16300 eval $inlibc
16301 set seekdir d_seekdir
16302 eval $inlibc
16303 set telldir d_telldir
16304 eval $inlibc
16305 set rewinddir d_rewinddir
16306 eval $inlibc
16307
16308 : see if readdir64_r exists
16309 set readdir64_r d_readdir64_r
16310 eval $inlibc
16311 case "$d_readdir64_r" in
16312 "$define")
16313         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16314         case "$d_readdir64_r_proto:$usethreads" in
16315         ":define")      d_readdir64_r_proto=define
16316                 set d_readdir64_r_proto readdir64_r $hdrs
16317                 eval $hasproto ;;
16318         *)      ;;
16319         esac
16320         case "$d_readdir64_r_proto" in
16321         define)
16322         case "$readdir64_r_proto" in
16323         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16324         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16325         esac
16326         case "$readdir64_r_proto" in
16327         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16328         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16329         esac
16330         case "$readdir64_r_proto" in
16331         ''|0)   d_readdir64_r=undef
16332                 readdir64_r_proto=0
16333                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16334         * )     case "$readdir64_r_proto" in
16335                 REENTRANT_PROTO*) ;;
16336                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16337                 esac
16338                 echo "Prototype: $try" ;;
16339         esac
16340         ;;
16341         *)      case "$usethreads" in
16342                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16343                 esac
16344                 d_readdir64_r=undef
16345                 readdir64_r_proto=0
16346                 ;;
16347         esac
16348         ;;
16349 *)      readdir64_r_proto=0
16350         ;;
16351 esac
16352
16353 : see if readdir_r exists
16354 set readdir_r d_readdir_r
16355 eval $inlibc
16356 case "$d_readdir_r" in
16357 "$define")
16358         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16359         case "$d_readdir_r_proto:$usethreads" in
16360         ":define")      d_readdir_r_proto=define
16361                 set d_readdir_r_proto readdir_r $hdrs
16362                 eval $hasproto ;;
16363         *)      ;;
16364         esac
16365         case "$d_readdir_r_proto" in
16366         define)
16367         case "$readdir_r_proto" in
16368         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16369         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16370         esac
16371         case "$readdir_r_proto" in
16372         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16373         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16374         esac
16375         case "$readdir_r_proto" in
16376         ''|0)   d_readdir_r=undef
16377                 readdir_r_proto=0
16378                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16379         * )     case "$readdir_r_proto" in
16380                 REENTRANT_PROTO*) ;;
16381                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16382                 esac
16383                 echo "Prototype: $try" ;;
16384         esac
16385         ;;
16386         *)      case "$usethreads" in
16387                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16388                 esac
16389                 d_readdir_r=undef
16390                 readdir_r_proto=0
16391                 ;;
16392         esac
16393         ;;
16394 *)      readdir_r_proto=0
16395         ;;
16396 esac
16397
16398 : see if readv exists
16399 set readv d_readv
16400 eval $inlibc
16401
16402 : see if recvmsg exists
16403 set recvmsg d_recvmsg
16404 eval $inlibc
16405
16406 : see if rename exists
16407 set rename d_rename
16408 eval $inlibc
16409
16410 : see if rmdir exists
16411 set rmdir d_rmdir
16412 eval $inlibc
16413
16414 : see if memory.h is available.
16415 val=''
16416 set memory.h val
16417 eval $inhdr
16418
16419 : See if it conflicts with string.h
16420 case "$val" in
16421 $define)
16422         case "$strings" in
16423         '') ;;
16424         *)
16425                 $cppstdin $cppflags $cppminus < $strings > mem.h
16426                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16427                         echo " "
16428                         echo "We won't be including <memory.h>."
16429                         val="$undef"
16430                 fi
16431                 $rm -f mem.h
16432                 ;;
16433         esac
16434 esac
16435 set i_memory
16436 eval $setvar
16437
16438 : can bcopy handle overlapping blocks?
16439 echo " "
16440 val="$undef"
16441 case "$d_memmove" in
16442 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16443 *)      case "$d_bcopy" in
16444         "$define")
16445                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16446                 $cat >try.c <<EOCP
16447 #$i_memory I_MEMORY
16448 #$i_stdlib I_STDLIB
16449 #$i_string I_STRING
16450 #$i_unistd I_UNISTD
16451 EOCP
16452         $cat >>try.c <<'EOCP'
16453 #include <stdio.h>
16454 #ifdef I_MEMORY
16455 #  include <memory.h>
16456 #endif
16457 #ifdef I_STDLIB
16458 #  include <stdlib.h>
16459 #endif
16460 #ifdef I_STRING
16461 #  include <string.h>
16462 #else
16463 #  include <strings.h>
16464 #endif
16465 #ifdef I_UNISTD
16466 #  include <unistd.h>  /* Needed for NetBSD */
16467 #endif
16468 int main()
16469 {
16470 char buf[128], abc[128];
16471 char *b;
16472 int len;
16473 int off;
16474 int align;
16475
16476 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16477    try to store the string in read-only memory. */
16478 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16479
16480 for (align = 7; align >= 0; align--) {
16481         for (len = 36; len; len--) {
16482                 b = buf+align;
16483                 bcopy(abc, b, len);
16484                 for (off = 1; off <= len; off++) {
16485                         bcopy(b, b+off, len);
16486                         bcopy(b+off, b, len);
16487                         if (bcmp(b, abc, len))
16488                                 exit(1);
16489                 }
16490         }
16491 }
16492 exit(0);
16493 }
16494 EOCP
16495                 set try
16496                 if eval $compile_ok; then
16497                         if $run ./try 2>/dev/null; then
16498                                 echo "Yes, it can."
16499                                 val="$define"
16500                         else
16501                                 echo "It can't, sorry."
16502                         fi
16503                 else
16504                         echo "(I can't compile the test program, so we'll assume not...)"
16505                 fi
16506                 ;;
16507         esac
16508         $rm_try
16509         ;;
16510 esac
16511 set d_safebcpy
16512 eval $setvar
16513
16514 : can memcpy handle overlapping blocks?
16515 echo " "
16516 val="$undef"
16517 case "$d_memmove" in
16518 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16519 *)      case "$d_memcpy" in
16520         "$define")
16521                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16522                 $cat >try.c <<EOCP
16523 #$i_memory I_MEMORY
16524 #$i_stdlib I_STDLIB
16525 #$i_string I_STRING
16526 #$i_unistd I_UNISTD
16527 EOCP
16528         $cat >>try.c <<'EOCP'
16529 #include <stdio.h>
16530 #ifdef I_MEMORY
16531 #  include <memory.h>
16532 #endif
16533 #ifdef I_STDLIB
16534 #  include <stdlib.h>
16535 #endif
16536 #ifdef I_STRING
16537 #  include <string.h>
16538 #else
16539 #  include <strings.h>
16540 #endif
16541 #ifdef I_UNISTD
16542 #  include <unistd.h>  /* Needed for NetBSD */
16543 #endif
16544 int main()
16545 {
16546 char buf[128], abc[128];
16547 char *b;
16548 int len;
16549 int off;
16550 int align;
16551
16552 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16553    try to store the string in read-only memory. */
16554 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16555
16556 for (align = 7; align >= 0; align--) {
16557         for (len = 36; len; len--) {
16558                 b = buf+align;
16559                 memcpy(b, abc, len);
16560                 for (off = 1; off <= len; off++) {
16561                         memcpy(b+off, b, len);
16562                         memcpy(b, b+off, len);
16563                         if (memcmp(b, abc, len))
16564                                 exit(1);
16565                 }
16566         }
16567 }
16568 exit(0);
16569 }
16570 EOCP
16571                 set try
16572                 if eval $compile_ok; then
16573                         if $run ./try 2>/dev/null; then
16574                                 echo "Yes, it can."
16575                                 val="$define"
16576                         else
16577                                 echo "It can't, sorry."
16578                         fi
16579                 else
16580                         echo "(I can't compile the test program, so we'll assume not...)"
16581                 fi
16582                 ;;
16583         esac
16584         $rm_try
16585         ;;
16586 esac
16587 set d_safemcpy
16588 eval $setvar
16589
16590 : can memcmp be trusted to compare relative magnitude?
16591 val="$undef"
16592 case "$d_memcmp" in
16593 "$define")
16594         echo " "
16595         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16596         $cat >try.c <<EOCP
16597 #$i_memory I_MEMORY
16598 #$i_stdlib I_STDLIB
16599 #$i_string I_STRING
16600 #$i_unistd I_UNISTD
16601 EOCP
16602         $cat >>try.c <<'EOCP'
16603 #include <stdio.h>
16604 #ifdef I_MEMORY
16605 #  include <memory.h>
16606 #endif
16607 #ifdef I_STDLIB
16608 #  include <stdlib.h>
16609 #endif
16610 #ifdef I_STRING
16611 #  include <string.h>
16612 #else
16613 #  include <strings.h>
16614 #endif
16615 #ifdef I_UNISTD
16616 #  include <unistd.h>  /* Needed for NetBSD */
16617 #endif
16618 int main()
16619 {
16620 char a = -1;
16621 char b = 0;
16622 if ((a < b) && memcmp(&a, &b, 1) < 0)
16623         exit(1);
16624 exit(0);
16625 }
16626 EOCP
16627         set try
16628         if eval $compile_ok; then
16629                 if $run ./try 2>/dev/null; then
16630                         echo "Yes, it can."
16631                         val="$define"
16632                 else
16633                         echo "No, it can't (it uses signed chars)."
16634                 fi
16635         else
16636                 echo "(I can't compile the test program, so we'll assume not...)"
16637         fi
16638         ;;
16639 esac
16640 $rm_try
16641 set d_sanemcmp
16642 eval $setvar
16643
16644 : see if prototype for sbrk is available
16645 echo " "
16646 set d_sbrkproto sbrk $i_unistd unistd.h
16647 eval $hasproto
16648
16649 : see if select exists
16650 set select d_select
16651 eval $inlibc
16652
16653 : see if semctl exists
16654 set semctl d_semctl
16655 eval $inlibc
16656
16657 : see if semget exists
16658 set semget d_semget
16659 eval $inlibc
16660
16661 : see if semop exists
16662 set semop d_semop
16663 eval $inlibc
16664
16665 : see how much of the 'sem*(2)' library is present.
16666 h_sem=true
16667 echo " "
16668 case "$d_semctl$d_semget$d_semop" in
16669 *"$undef"*) h_sem=false;;
16670 esac
16671 case "$osname" in
16672 freebsd)
16673     case "`ipcs 2>&1`" in
16674     "SVID messages"*"not configured"*)
16675         echo "Your $osname does not have the sem*(2) configured." >&4
16676         h_sem=false
16677         val="$undef"
16678         set semctl d_semctl
16679         eval $setvar
16680         set semget d_semget
16681         eval $setvar
16682         set semop d_semop
16683         eval $setvar
16684         ;;
16685     esac
16686     ;;
16687 esac
16688 : we could also check for sys/ipc.h ...
16689 if $h_sem && $test `./findhdr sys/sem.h`; then
16690         echo "You have the full sem*(2) library." >&4
16691         val="$define"
16692 else
16693         echo "You don't have the full sem*(2) library." >&4
16694         val="$undef"
16695 fi
16696 set d_sem
16697 eval $setvar
16698
16699 : see whether sys/sem.h defines union semun
16700 echo " "
16701 $cat > try.c <<'END'
16702 #include <sys/types.h>
16703 #include <sys/ipc.h>
16704 #include <sys/sem.h>
16705 int main () { union semun semun; semun.buf = 0; }
16706 END
16707 set try
16708 if eval $compile; then
16709     echo "You have union semun in <sys/sem.h>." >&4
16710     val="$define"
16711 else
16712     echo "You do not have union semun in <sys/sem.h>." >&4
16713     val="$undef"
16714 fi
16715 $rm_try
16716 set d_union_semun
16717 eval $setvar
16718
16719 : see how to do semctl IPC_STAT
16720 case "$d_sem" in
16721 $define)
16722     echo " "
16723     $cat > tryh.h <<END
16724 #ifndef S_IRUSR
16725 #   ifdef S_IREAD
16726 #       define S_IRUSR S_IREAD
16727 #       define S_IWUSR S_IWRITE
16728 #       define S_IXUSR S_IEXEC
16729 #   else
16730 #       define S_IRUSR 0400
16731 #       define S_IWUSR 0200
16732 #       define S_IXUSR 0100
16733 #   endif
16734 #   define S_IRGRP (S_IRUSR>>3)
16735 #   define S_IWGRP (S_IWUSR>>3)
16736 #   define S_IXGRP (S_IXUSR>>3)
16737 #   define S_IROTH (S_IRUSR>>6)
16738 #   define S_IWOTH (S_IWUSR>>6)
16739 #   define S_IXOTH (S_IXUSR>>6)
16740 #endif
16741 #ifndef S_IRWXU
16742 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16743 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16744 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16745 #endif
16746 END
16747     : see whether semctl IPC_STAT can use union semun
16748     case "$d_semctl_semun" in
16749     '')
16750       val="$undef"
16751       $cat > try.c <<END
16752 #include <sys/types.h>
16753 #include <sys/ipc.h>
16754 #include <sys/sem.h>
16755 #include <sys/stat.h>
16756 #include <stdio.h>
16757 #include <errno.h>
16758 #include "tryh.h"
16759 #ifndef errno
16760 extern int errno;
16761 #endif
16762 #$d_union_semun HAS_UNION_SEMUN
16763 int main() {
16764     union semun
16765 #ifndef HAS_UNION_SEMUN
16766     {
16767         int val;
16768         struct semid_ds *buf;
16769         unsigned short *array;
16770     }
16771 #endif
16772     arg;
16773     int sem, st;
16774
16775 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16776     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16777     if (sem > -1) {
16778         struct semid_ds argbuf;
16779         arg.buf = &argbuf;
16780 #       ifdef IPC_STAT
16781         st = semctl(sem, 0, IPC_STAT, arg);
16782         if (st == 0)
16783             printf("semun\n");
16784         else
16785 #       endif /* IPC_STAT */
16786             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16787 #       ifdef IPC_RMID
16788         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16789 #       endif /* IPC_RMID */
16790             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16791     } else
16792 #endif /* IPC_PRIVATE && ... */
16793         printf("semget failed: errno = %d\n", errno);
16794   return 0;
16795 }
16796 END
16797       set try
16798       if eval $compile; then
16799           xxx=`$run ./try`
16800           case "$xxx" in
16801           semun) val="$define" ;;
16802           esac
16803       fi
16804       $rm_try
16805       set d_semctl_semun
16806       eval $setvar
16807       ;;
16808     esac
16809     case "$d_semctl_semun" in
16810     $define)
16811         echo "You can use union semun for semctl IPC_STAT." >&4
16812         also='also'
16813         ;;
16814     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16815         also=''
16816         ;;
16817     esac
16818
16819     : see whether semctl IPC_STAT can use struct semid_ds pointer
16820     case "$d_semctl_semid_ds" in
16821     '')
16822       val="$undef"
16823       $cat > try.c <<'END'
16824 #include <sys/types.h>
16825 #include <sys/ipc.h>
16826 #include <sys/sem.h>
16827 #include <sys/stat.h>
16828 #include "tryh.h"
16829 #include <stdio.h>
16830 #include <errno.h>
16831 #ifndef errno
16832 extern int errno;
16833 #endif
16834 int main() {
16835     struct semid_ds arg;
16836     int sem, st;
16837
16838 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16839     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16840     if (sem > -1) {
16841 #       ifdef IPC_STAT
16842         st = semctl(sem, 0, IPC_STAT, &arg);
16843         if (st == 0)
16844             printf("semid_ds\n");
16845         else
16846 #       endif /* IPC_STAT */
16847             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16848 #       ifdef IPC_RMID
16849         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16850 #       endif /* IPC_RMID */
16851             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16852     } else
16853 #endif /* IPC_PRIVATE && ... */
16854         printf("semget failed: errno = %d\n", errno);
16855
16856     return 0;
16857 }
16858 END
16859       set try
16860       if eval $compile; then
16861           xxx=`$run ./try`
16862           case "$xxx" in
16863           semid_ds) val="$define" ;;
16864           esac
16865       fi
16866       $rm_try
16867       set d_semctl_semid_ds
16868       eval $setvar
16869       ;;
16870     esac
16871     case "$d_semctl_semid_ds" in
16872     $define)
16873         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16874         ;;
16875     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16876         ;;
16877     esac
16878     ;;
16879 *)  val="$undef"
16880
16881     # We do not have the full sem*(2) library, so assume we can not
16882     # use either.
16883
16884     set d_semctl_semun
16885     eval $setvar
16886
16887     set d_semctl_semid_ds
16888     eval $setvar
16889     ;;
16890 esac
16891 $rm_try tryh.h
16892
16893 : see if sendmsg exists
16894 set sendmsg d_sendmsg
16895 eval $inlibc
16896
16897 : see if setegid exists
16898 set setegid d_setegid
16899 eval $inlibc
16900
16901 : see if seteuid exists
16902 set seteuid d_seteuid
16903 eval $inlibc
16904
16905 : see if setgrent exists
16906 set setgrent d_setgrent
16907 eval $inlibc
16908
16909 : see if setgrent_r exists
16910 set setgrent_r d_setgrent_r
16911 eval $inlibc
16912 case "$d_setgrent_r" in
16913 "$define")
16914         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16915         case "$d_setgrent_r_proto:$usethreads" in
16916         ":define")      d_setgrent_r_proto=define
16917                 set d_setgrent_r_proto setgrent_r $hdrs
16918                 eval $hasproto ;;
16919         *)      ;;
16920         esac
16921         case "$d_setgrent_r_proto" in
16922         define)
16923         case "$setgrent_r_proto" in
16924         ''|0) try='int setgrent_r(FILE**);'
16925         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16926         esac
16927         case "$setgrent_r_proto" in
16928         ''|0) try='void setgrent_r(FILE**);'
16929         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16930         esac
16931         case "$setgrent_r_proto" in
16932         ''|0)   d_setgrent_r=undef
16933                 setgrent_r_proto=0
16934                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16935         * )     case "$setgrent_r_proto" in
16936                 REENTRANT_PROTO*) ;;
16937                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16938                 esac
16939                 echo "Prototype: $try" ;;
16940         esac
16941         ;;
16942         *)      case "$usethreads" in
16943                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16944                 esac
16945                 d_setgrent_r=undef
16946                 setgrent_r_proto=0
16947                 ;;
16948         esac
16949         ;;
16950 *)      setgrent_r_proto=0
16951         ;;
16952 esac
16953
16954 : see if sethostent exists
16955 set sethostent d_sethent
16956 eval $inlibc
16957
16958 : see if sethostent_r exists
16959 set sethostent_r d_sethostent_r
16960 eval $inlibc
16961 case "$d_sethostent_r" in
16962 "$define")
16963         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16964         case "$d_sethostent_r_proto:$usethreads" in
16965         ":define")      d_sethostent_r_proto=define
16966                 set d_sethostent_r_proto sethostent_r $hdrs
16967                 eval $hasproto ;;
16968         *)      ;;
16969         esac
16970         case "$d_sethostent_r_proto" in
16971         define)
16972         case "$sethostent_r_proto" in
16973         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16974         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16975         esac
16976         case "$sethostent_r_proto" in
16977         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16978         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16979         esac
16980         case "$sethostent_r_proto" in
16981         ''|0)   d_sethostent_r=undef
16982                 sethostent_r_proto=0
16983                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16984         * )     case "$sethostent_r_proto" in
16985                 REENTRANT_PROTO*) ;;
16986                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16987                 esac
16988                 echo "Prototype: $try" ;;
16989         esac
16990         ;;
16991         *)      case "$usethreads" in
16992                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16993                 esac
16994                 d_sethostent_r=undef
16995                 sethostent_r_proto=0
16996                 ;;
16997         esac
16998         ;;
16999 *)      sethostent_r_proto=0
17000         ;;
17001 esac
17002
17003 : see if setitimer exists
17004 set setitimer d_setitimer
17005 eval $inlibc
17006
17007 : see if setlinebuf exists
17008 set setlinebuf d_setlinebuf
17009 eval $inlibc
17010
17011 : see if setlocale exists
17012 set setlocale d_setlocale
17013 eval $inlibc
17014
17015 : see if locale.h is available
17016 set locale.h i_locale
17017 eval $inhdr
17018
17019 : see if setlocale_r exists
17020 set setlocale_r d_setlocale_r
17021 eval $inlibc
17022 case "$d_setlocale_r" in
17023 "$define")
17024         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17025         case "$d_setlocale_r_proto:$usethreads" in
17026         ":define")      d_setlocale_r_proto=define
17027                 set d_setlocale_r_proto setlocale_r $hdrs
17028                 eval $hasproto ;;
17029         *)      ;;
17030         esac
17031         case "$d_setlocale_r_proto" in
17032         define)
17033         case "$setlocale_r_proto" in
17034         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17035         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17036         esac
17037         case "$setlocale_r_proto" in
17038         ''|0)   d_setlocale_r=undef
17039                 setlocale_r_proto=0
17040                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17041         * )     case "$setlocale_r_proto" in
17042                 REENTRANT_PROTO*) ;;
17043                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17044                 esac
17045                 echo "Prototype: $try" ;;
17046         esac
17047         ;;
17048         *)      case "$usethreads" in
17049                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17050                 esac
17051                 d_setlocale_r=undef
17052                 setlocale_r_proto=0
17053                 ;;
17054         esac
17055         ;;
17056 *)      setlocale_r_proto=0
17057         ;;
17058 esac
17059
17060 : see if setnetent exists
17061 set setnetent d_setnent
17062 eval $inlibc
17063
17064 : see if setnetent_r exists
17065 set setnetent_r d_setnetent_r
17066 eval $inlibc
17067 case "$d_setnetent_r" in
17068 "$define")
17069         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17070         case "$d_setnetent_r_proto:$usethreads" in
17071         ":define")      d_setnetent_r_proto=define
17072                 set d_setnetent_r_proto setnetent_r $hdrs
17073                 eval $hasproto ;;
17074         *)      ;;
17075         esac
17076         case "$d_setnetent_r_proto" in
17077         define)
17078         case "$setnetent_r_proto" in
17079         ''|0) try='int setnetent_r(int, struct netent_data*);'
17080         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17081         esac
17082         case "$setnetent_r_proto" in
17083         ''|0) try='void setnetent_r(int, struct netent_data*);'
17084         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17085         esac
17086         case "$setnetent_r_proto" in
17087         ''|0)   d_setnetent_r=undef
17088                 setnetent_r_proto=0
17089                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17090         * )     case "$setnetent_r_proto" in
17091                 REENTRANT_PROTO*) ;;
17092                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17093                 esac
17094                 echo "Prototype: $try" ;;
17095         esac
17096         ;;
17097         *)      case "$usethreads" in
17098                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17099                 esac
17100                 d_setnetent_r=undef
17101                 setnetent_r_proto=0
17102                 ;;
17103         esac
17104         ;;
17105 *)      setnetent_r_proto=0
17106         ;;
17107 esac
17108
17109 : see if setprotoent exists
17110 set setprotoent d_setpent
17111 eval $inlibc
17112
17113 : see if setpgid exists
17114 set setpgid d_setpgid
17115 eval $inlibc
17116
17117 : see if setpgrp2 exists
17118 set setpgrp2 d_setpgrp2
17119 eval $inlibc
17120
17121 : see if setpriority exists
17122 set setpriority d_setprior
17123 eval $inlibc
17124
17125 : see if setproctitle exists
17126 set setproctitle d_setproctitle
17127 eval $inlibc
17128
17129 : see if setprotoent_r exists
17130 set setprotoent_r d_setprotoent_r
17131 eval $inlibc
17132 case "$d_setprotoent_r" in
17133 "$define")
17134         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17135         case "$d_setprotoent_r_proto:$usethreads" in
17136         ":define")      d_setprotoent_r_proto=define
17137                 set d_setprotoent_r_proto setprotoent_r $hdrs
17138                 eval $hasproto ;;
17139         *)      ;;
17140         esac
17141         case "$d_setprotoent_r_proto" in
17142         define)
17143         case "$setprotoent_r_proto" in
17144         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17145         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17146         esac
17147         case "$setprotoent_r_proto" in
17148         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17149         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17150         esac
17151         case "$setprotoent_r_proto" in
17152         ''|0)   d_setprotoent_r=undef
17153                 setprotoent_r_proto=0
17154                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17155         * )     case "$setprotoent_r_proto" in
17156                 REENTRANT_PROTO*) ;;
17157                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17158                 esac
17159                 echo "Prototype: $try" ;;
17160         esac
17161         ;;
17162         *)      case "$usethreads" in
17163                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17164                 esac
17165                 d_setprotoent_r=undef
17166                 setprotoent_r_proto=0
17167                 ;;
17168         esac
17169         ;;
17170 *)      setprotoent_r_proto=0
17171         ;;
17172 esac
17173
17174 : see if setpwent exists
17175 set setpwent d_setpwent
17176 eval $inlibc
17177
17178 : see if setpwent_r exists
17179 set setpwent_r d_setpwent_r
17180 eval $inlibc
17181 case "$d_setpwent_r" in
17182 "$define")
17183         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17184         case "$d_setpwent_r_proto:$usethreads" in
17185         ":define")      d_setpwent_r_proto=define
17186                 set d_setpwent_r_proto setpwent_r $hdrs
17187                 eval $hasproto ;;
17188         *)      ;;
17189         esac
17190         case "$d_setpwent_r_proto" in
17191         define)
17192         case "$setpwent_r_proto" in
17193         ''|0) try='int setpwent_r(FILE**);'
17194         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17195         esac
17196         case "$setpwent_r_proto" in
17197         ''|0) try='void setpwent_r(FILE**);'
17198         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17199         esac
17200         case "$setpwent_r_proto" in
17201         ''|0)   d_setpwent_r=undef
17202                 setpwent_r_proto=0
17203                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17204         * )     case "$setpwent_r_proto" in
17205                 REENTRANT_PROTO*) ;;
17206                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17207                 esac
17208                 echo "Prototype: $try" ;;
17209         esac
17210         ;;
17211         *)      case "$usethreads" in
17212                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17213                 esac
17214                 d_setpwent_r=undef
17215                 setpwent_r_proto=0
17216                 ;;
17217         esac
17218         ;;
17219 *)      setpwent_r_proto=0
17220         ;;
17221 esac
17222
17223 : see if setregid exists
17224 set setregid d_setregid
17225 eval $inlibc
17226 set setresgid d_setresgid
17227 eval $inlibc
17228
17229 : see if setreuid exists
17230 set setreuid d_setreuid
17231 eval $inlibc
17232 set setresuid d_setresuid
17233 eval $inlibc
17234
17235 : see if setrgid exists
17236 set setrgid d_setrgid
17237 eval $inlibc
17238
17239 : see if setruid exists
17240 set setruid d_setruid
17241 eval $inlibc
17242
17243 : see if setservent exists
17244 set setservent d_setsent
17245 eval $inlibc
17246
17247 : see if setservent_r exists
17248 set setservent_r d_setservent_r
17249 eval $inlibc
17250 case "$d_setservent_r" in
17251 "$define")
17252         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17253         case "$d_setservent_r_proto:$usethreads" in
17254         ":define")      d_setservent_r_proto=define
17255                 set d_setservent_r_proto setservent_r $hdrs
17256                 eval $hasproto ;;
17257         *)      ;;
17258         esac
17259         case "$d_setservent_r_proto" in
17260         define)
17261         case "$setservent_r_proto" in
17262         ''|0) try='int setservent_r(int, struct servent_data*);'
17263         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17264         esac
17265         case "$setservent_r_proto" in
17266         ''|0) try='void setservent_r(int, struct servent_data*);'
17267         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17268         esac
17269         case "$setservent_r_proto" in
17270         ''|0)   d_setservent_r=undef
17271                 setservent_r_proto=0
17272                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17273         * )     case "$setservent_r_proto" in
17274                 REENTRANT_PROTO*) ;;
17275                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17276                 esac
17277                 echo "Prototype: $try" ;;
17278         esac
17279         ;;
17280         *)      case "$usethreads" in
17281                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17282                 esac
17283                 d_setservent_r=undef
17284                 setservent_r_proto=0
17285                 ;;
17286         esac
17287         ;;
17288 *)      setservent_r_proto=0
17289         ;;
17290 esac
17291
17292 : see if setsid exists
17293 set setsid d_setsid
17294 eval $inlibc
17295
17296 : see if setvbuf exists
17297 set setvbuf d_setvbuf
17298 eval $inlibc
17299
17300 : see if sfio.h is available
17301 set sfio.h i_sfio
17302 eval $inhdr
17303
17304 : see if sfio library is available
17305 case "$i_sfio" in
17306 $define)
17307         val=''
17308         set sfreserve val
17309         eval $inlibc
17310         ;;
17311 *)
17312         val="$undef"
17313         ;;
17314 esac
17315 : Ok, but do we want to use it.
17316 case "$val" in
17317 $define)
17318         case "$usesfio" in
17319         true|$define|[yY]*) dflt='y';;
17320         *) dflt='n';;
17321         esac
17322         echo "$package can use the sfio library, but it is experimental."
17323         rp="You seem to have sfio available, do you want to try using it?"
17324         . ./myread
17325         case "$ans" in
17326         y|Y)    echo "Ok, turning on sfio then."
17327                 val="$define"
17328                 ;;
17329         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17330                 val="$undef"
17331                 ;;
17332         esac
17333         ;;
17334 *)      case "$usesfio" in
17335         true|$define|[yY]*)
17336                 echo "Sorry, cannot find sfio on this machine." >&4
17337                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17338                 val="$undef"
17339                 ;;
17340         esac
17341         ;;
17342 esac
17343 set d_sfio
17344 eval $setvar
17345 case "$d_sfio" in
17346 $define) usesfio='true';;
17347 *) usesfio='false';;
17348 esac
17349 case "$d_sfio" in
17350 $define) ;;
17351 *)      : Remove sfio from list of libraries to use
17352         case "$libs" in
17353         *-lsfio*)
17354                 echo "Removing unneeded -lsfio from library list" >&4
17355                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17356                 shift
17357                 libs="$*"
17358                 echo "libs = $libs" >&4
17359                 ;;
17360         esac
17361 ;;
17362 esac
17363
17364
17365 : see if shmctl exists
17366 set shmctl d_shmctl
17367 eval $inlibc
17368
17369 : see if shmget exists
17370 set shmget d_shmget
17371 eval $inlibc
17372
17373 : see if shmat exists
17374 set shmat d_shmat
17375 eval $inlibc
17376 : see what shmat returns
17377 case "$d_shmat" in
17378 "$define")
17379         $cat >shmat.c <<'END'
17380 #include <sys/shm.h>
17381 void *shmat();
17382 END
17383         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17384                 shmattype='void *'
17385         else
17386                 shmattype='char *'
17387         fi
17388         echo "and it returns ($shmattype)." >&4
17389         : see if a prototype for shmat is available
17390         xxx=`./findhdr sys/shm.h`
17391         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17392         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17393                 val="$define"
17394         else
17395                 val="$undef"
17396         fi
17397         $rm -f shmat.[co]
17398         ;;
17399 *)
17400         val="$undef"
17401         ;;
17402 esac
17403 set d_shmatprototype
17404 eval $setvar
17405
17406 : see if shmdt exists
17407 set shmdt d_shmdt
17408 eval $inlibc
17409
17410 : see how much of the 'shm*(2)' library is present.
17411 h_shm=true
17412 echo " "
17413 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17414 *"$undef"*) h_shm=false;;
17415 esac
17416 case "$osname" in
17417 freebsd)
17418     case "`ipcs 2>&1`" in
17419     "SVID shared memory"*"not configured"*)
17420         echo "Your $osname does not have the shm*(2) configured." >&4
17421         h_shm=false
17422         val="$undef"
17423         set shmctl d_shmctl
17424         evat $setvar
17425         set shmget d_shmget
17426         evat $setvar
17427         set shmat d_shmat
17428         evat $setvar
17429         set shmdt d_shmdt
17430         evat $setvar
17431         ;;
17432     esac
17433     ;;
17434 esac
17435 : we could also check for sys/ipc.h ...
17436 if $h_shm && $test `./findhdr sys/shm.h`; then
17437         echo "You have the full shm*(2) library." >&4
17438         val="$define"
17439 else
17440         echo "You don't have the full shm*(2) library." >&4
17441         val="$undef"
17442 fi
17443 set d_shm
17444 eval $setvar
17445
17446 : see if we have sigaction
17447 echo " "
17448 if set sigaction val -f d_sigaction; eval $csym; $val; then
17449         echo 'sigaction() found.' >&4
17450         $cat > try.c <<EOP
17451 #include <stdio.h>
17452 #include <sys/types.h>
17453 #include <signal.h>
17454 #$i_stdlib I_STDLIB
17455 #ifdef I_STDLIB
17456 #include <stdlib.h>
17457 #endif
17458 int main()
17459 {
17460     struct sigaction act, oact;
17461     act.sa_flags = 0;
17462     oact.sa_handler = 0;
17463     /* so that act and oact are used */
17464     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17465 }
17466 EOP
17467         set try
17468         if eval $compile_ok; then
17469                 val="$define"
17470         else
17471                 echo "But you don't seem to have a useable struct sigaction." >&4
17472                 val="$undef"
17473         fi
17474 else
17475         echo 'sigaction NOT found.' >&4
17476         val="$undef"
17477 fi
17478 set d_sigaction; eval $setvar
17479 $rm_try
17480
17481 : see if this is a sunmath.h system
17482 set sunmath.h i_sunmath
17483 eval $inhdr
17484
17485 : see if signbit exists
17486 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17487 $cat >try.c <<EOCP
17488 #$i_math I_MATH
17489 #$i_sunmath I_SUNMATH
17490 #ifdef I_MATH
17491 #  include <math.h>
17492 #endif
17493 #ifdef I_SUNMATH  /* Solaris special math library */
17494 #  include <sunmath.h>
17495 #endif
17496 #define NV $nvtype
17497 int main(int argc, char **argv)
17498 {
17499     NV x = 0.0;
17500     NV y = -0.0;
17501     if ((signbit(x) == 0) && (signbit(y) != 0))
17502         return 0;
17503     else
17504         return 1;
17505 }
17506 EOCP
17507 val="$undef"
17508 set try
17509 if eval $compile; then
17510     if $run ./try; then
17511         $echo "Yes." >&4
17512         val="$define"
17513     else
17514         $echo "Signbit seems to be available, but doesn't work as I expected."
17515         $echo "I won't use it." >&4
17516         val="$undef"
17517     fi
17518 else
17519     $echo "Nope." >&4
17520     dflt="$undef"
17521 fi
17522 set d_signbit
17523 eval $setvar
17524 $rm_try
17525
17526 : see if sigprocmask exists
17527 set sigprocmask d_sigprocmask
17528 eval $inlibc
17529
17530 : see if sigsetjmp exists
17531 echo " "
17532 case "$d_sigsetjmp" in
17533 '')
17534         $cat >try.c <<EOP
17535 #include <setjmp.h>
17536 #$i_stdlib I_STDLIB
17537 #ifdef I_STDLIB
17538 #include <stdlib.h>
17539 #endif
17540 sigjmp_buf env;
17541 int set = 1;
17542 int main()
17543 {
17544         if (sigsetjmp(env,1))
17545                 exit(set);
17546         set = 0;
17547         siglongjmp(env, 1);
17548         exit(1);
17549 }
17550 EOP
17551         set try
17552         if eval $compile; then
17553                 if $run ./try >/dev/null 2>&1; then
17554                         echo "POSIX sigsetjmp found." >&4
17555                         val="$define"
17556                 else
17557                         $cat >&4 <<EOM
17558 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17559 I'll ignore them.
17560 EOM
17561                         val="$undef"
17562                 fi
17563         else
17564                 echo "sigsetjmp not found." >&4
17565                 val="$undef"
17566         fi
17567         ;;
17568 *) val="$d_sigsetjmp"
17569         case "$d_sigsetjmp" in
17570         $define) echo "POSIX sigsetjmp found." >&4;;
17571         $undef) echo "sigsetjmp not found." >&4;;
17572         esac
17573         ;;
17574 esac
17575 set d_sigsetjmp
17576 eval $setvar
17577 $rm_try
17578
17579 : see if snprintf exists
17580 set snprintf d_snprintf
17581 eval $inlibc
17582
17583 : see if vsnprintf exists
17584 set vsnprintf d_vsnprintf
17585 eval $inlibc
17586
17587 case "$d_snprintf-$d_vsnprintf" in
17588 "$define-$define")
17589     $cat <<EOM
17590 Checking whether your snprintf() and vsnprintf() work okay...
17591 EOM
17592     $cat >try.c <<'EOCP'
17593 /* v?snprintf testing logic courtesy of Russ Allbery.
17594  * According to C99:
17595  * - if the buffer is too short it still must be \0-terminated
17596  * - if the buffer is too short the potentially required length
17597  *   must be returned and not -1
17598  * - if the buffer is NULL the potentially required length
17599  *   must be returned and not -1 or core dump
17600  */
17601 #include <stdio.h>
17602 #include <stdarg.h>
17603
17604 char buf[2];
17605
17606 int test (char *format, ...)
17607 {
17608     va_list args;
17609     int count;
17610
17611     va_start (args, format);
17612     count = vsnprintf (buf, sizeof buf, format, args);
17613     va_end (args);
17614     return count;
17615 }
17616
17617 int main ()
17618 {
17619     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17620              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17621 }
17622 EOCP
17623     set try
17624     if eval $compile; then
17625         `$run ./try`
17626         case "$?" in
17627         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17628         *) cat <<EOM >&4
17629 Your snprintf() and snprintf() don't seem to be working okay.
17630 EOM
17631            d_snprintf="$undef"
17632            d_vsnprintf="$undef"
17633            ;;
17634         esac
17635     else
17636         echo "(I can't seem to compile the test program--assuming they don't)"
17637         d_snprintf="$undef"
17638         d_vsnprintf="$undef"
17639     fi
17640     $rm_try
17641     ;;
17642 esac
17643
17644 : see if sockatmark exists
17645 set sockatmark d_sockatmark
17646 eval $inlibc
17647
17648 : see if prototype for sockatmark is available
17649 echo " "
17650 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17651 eval $hasproto
17652
17653 : see if socks5_init exists
17654 set socks5_init d_socks5_init
17655 eval $inlibc
17656
17657 : see if sprintf returns the length of the string in the buffer as per ANSI
17658 $echo "Checking whether sprintf returns the length of the string..." >&4
17659 $cat <<EOP >try.c
17660 #include <stdio.h>
17661 #$i_stdlib I_STDLIB
17662 #ifdef I_STDLIB
17663 #include <stdlib.h>
17664 #endif
17665 #$i_string I_STRING
17666 #ifdef I_STRING
17667 #  include <string.h>
17668 #else
17669 #  include <strings.h>
17670 #endif
17671 #$i_math I_MATH
17672 #ifdef I_MATH
17673 #include <math.h>
17674 #endif
17675
17676 char buffer[256];
17677
17678 int check (size_t expect, int test) {
17679   size_t got = strlen(buffer);
17680   if (expect == got)
17681     return 0;
17682
17683   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17684        test, buffer);
17685   exit (test);
17686 }
17687
17688 int main(int argc, char **argv) {
17689   int test = 0;
17690
17691   check(sprintf(buffer, ""), ++test);
17692   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17693   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17694
17695   return 0;
17696 }
17697 EOP
17698 set try
17699
17700 if eval $compile; then
17701     xxx="`$run ./try`"
17702     case "$?" in
17703         0) cat >&4 <<EOM
17704 sprintf returns the length of the string (as ANSI says it should)
17705 EOM
17706         d_sprintf_returns_strlen="$define"
17707         ;;
17708         *) cat >&4 <<EOM
17709 sprintf does not return the length of the string (how old is this system?)
17710 EOM
17711         d_sprintf_returns_strlen="$undef"
17712         ;;
17713     esac
17714 else
17715     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17716     d_sprintf_returns_strlen="$undef"
17717 fi
17718 $rm_try
17719
17720 : see if srand48_r exists
17721 set srand48_r d_srand48_r
17722 eval $inlibc
17723 case "$d_srand48_r" in
17724 "$define")
17725         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17726         case "$d_srand48_r_proto:$usethreads" in
17727         ":define")      d_srand48_r_proto=define
17728                 set d_srand48_r_proto srand48_r $hdrs
17729                 eval $hasproto ;;
17730         *)      ;;
17731         esac
17732         case "$d_srand48_r_proto" in
17733         define)
17734         case "$srand48_r_proto" in
17735         ''|0) try='int srand48_r(long, struct drand48_data*);'
17736         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17737         esac
17738         case "$srand48_r_proto" in
17739         ''|0)   d_srand48_r=undef
17740                 srand48_r_proto=0
17741                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17742         * )     case "$srand48_r_proto" in
17743                 REENTRANT_PROTO*) ;;
17744                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17745                 esac
17746                 echo "Prototype: $try" ;;
17747         esac
17748         ;;
17749         *)      case "$usethreads" in
17750                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17751                 esac
17752                 d_srand48_r=undef
17753                 srand48_r_proto=0
17754                 ;;
17755         esac
17756         ;;
17757 *)      srand48_r_proto=0
17758         ;;
17759 esac
17760
17761 : see if srandom_r exists
17762 set srandom_r d_srandom_r
17763 eval $inlibc
17764 case "$d_srandom_r" in
17765 "$define")
17766         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17767         case "$d_srandom_r_proto:$usethreads" in
17768         ":define")      d_srandom_r_proto=define
17769                 set d_srandom_r_proto srandom_r $hdrs
17770                 eval $hasproto ;;
17771         *)      ;;
17772         esac
17773         case "$d_srandom_r_proto" in
17774         define)
17775         case "$srandom_r_proto" in
17776         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17777         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17778         esac
17779         case "$srandom_r_proto" in
17780         ''|0)   d_srandom_r=undef
17781                 srandom_r_proto=0
17782                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17783         * )     case "$srandom_r_proto" in
17784                 REENTRANT_PROTO*) ;;
17785                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17786                 esac
17787                 echo "Prototype: $try" ;;
17788         esac
17789         ;;
17790         *)      case "$usethreads" in
17791                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17792                 esac
17793                 d_srandom_r=undef
17794                 srandom_r_proto=0
17795                 ;;
17796         esac
17797         ;;
17798 *)      srandom_r_proto=0
17799         ;;
17800 esac
17801
17802 : see if prototype for setresgid is available
17803 echo " "
17804 set d_sresgproto setresgid $i_unistd unistd.h
17805 eval $hasproto
17806
17807 : see if prototype for setresuid is available
17808 echo " "
17809 set d_sresuproto setresuid $i_unistd unistd.h
17810 eval $hasproto
17811
17812 : see if sys/stat.h is available
17813 set sys/stat.h i_sysstat
17814 eval $inhdr
17815
17816 : see if stat knows about block sizes
17817 echo " "
17818 echo "Checking to see if your struct stat has st_blocks field..." >&4
17819 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17820 eval $hasfield
17821
17822 : see if this is a sys/vfs.h system
17823 set sys/vfs.h i_sysvfs
17824 eval $inhdr
17825
17826 : see if this is a sys/statfs.h system
17827 set sys/statfs.h i_sysstatfs
17828 eval $inhdr
17829
17830 : Check for statfs_s
17831 echo " "
17832 echo "Checking to see if your system supports struct statfs..." >&4
17833 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
17834 eval $hasstruct
17835 case "$d_statfs_s" in
17836 "$define")      echo "Yes, it does."   ;;
17837 *)              echo "No, it doesn't." ;;
17838 esac
17839
17840
17841 : see if struct statfs knows about f_flags
17842 case "$d_statfs_s" in
17843 define)
17844         echo " "
17845         echo "Checking to see if your struct statfs has f_flags field..." >&4
17846         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
17847         eval $hasfield
17848         ;;
17849 *)      val="$undef"
17850         set d_statfs_f_flags
17851         eval $setvar
17852         ;;
17853 esac
17854 case "$d_statfs_f_flags" in
17855 "$define")      echo "Yes, it does."   ;;
17856 *)              echo "No, it doesn't." ;;
17857 esac
17858
17859 : see what flavor, if any, of static inline is supported
17860 echo " "
17861 echo "Checking to see if your system supports static inline..."
17862 $cat > try.c <<'EOCP'
17863 #include <stdlib.h>
17864 extern int f_via_a(int x);
17865 extern int f_via_b(int x);
17866 int main(int argc, char **argv)
17867 {
17868     int y;
17869
17870     y = f_via_a(0);
17871 #ifdef USE_B
17872     y = f_via_b(0);
17873 #endif
17874     if (y == 42) {
17875         return EXIT_SUCCESS;
17876     }
17877     else {
17878         return EXIT_FAILURE;
17879     }
17880 }
17881 EOCP
17882 $cat > a.c <<'EOCP'
17883 static INLINE int f(int x) {
17884     int y;
17885     y = x + 42;
17886     return y;
17887 }
17888
17889 int f_via_a(int x)
17890 {
17891     return f(x);
17892 }
17893 EOCP
17894 $cat > b.c <<'EOCP'
17895 extern int f(int x);
17896
17897 int f_via_b(int x)
17898 {
17899     return f(x);
17900 }
17901 EOCP
17902
17903 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17904 case "$perl_static_inline" in
17905 '')     # Check the various possibilities, and break out on success.
17906         # For gcc, prefer __inline__, which will still permit 
17907         # cflags.SH to add in -ansi.
17908         case "$gccversion" in
17909                 '') xxx="inline __inline__ __inline _inline";;
17910                 *)  xxx="__inline__ inline __inline _inline";;
17911         esac
17912         for inline in $xxx; do
17913                 set try -DINLINE=$inline a.c
17914                 if eval $compile && $run ./try; then
17915                         # Now make sure there is no external linkage of static
17916                         # functions
17917                         set try -DINLINE=$inline -DUSE_B a.c b.c
17918                         if eval $compile && $run ./try; then
17919                                 $echo "Your compiler supports static $inline, " >&4
17920                                 $echo "but it also creates an external definition," >&4
17921                                 $echo "so I won't use it." >&4
17922                                 val=$undef
17923                         else
17924                                 $echo "Your compiler supports static $inline." >&4
17925                                 val=$define
17926                                 perl_static_inline="static $inline";
17927                                 break;
17928                         fi
17929                 else
17930                         $echo "Your compiler does NOT support static $inline." >&4
17931                         val="$undef"
17932                 fi
17933         done
17934         ;;
17935 *inline*) # Some variant of inline exists.
17936         echo "Keeping your $hint value of $perl_static_inline."
17937         val=$define
17938         ;;
17939 static)  # No inline capabilities
17940         echo "Keeping your $hint value of $perl_static_inline."
17941         val=$undef
17942         ;;
17943 *)  # Unrecognized previous value -- blindly trust the supplied
17944         # value and hope it makes sense.  Use old value for
17945         # d_static_inline, if there is one.
17946         echo "Keeping your $hint value of $perl_static_inline."
17947         case "$d_static_inline" in
17948                 '') val=$define ;;
17949                 *)  val=$d_static_inline ;;
17950         esac
17951         ;;
17952 esac
17953 # Fallback to plain 'static' if nothing worked.
17954 case "$perl_static_inline" in
17955 '')
17956         perl_static_inline="static"
17957         val=$undef
17958         ;;
17959 esac
17960 set d_static_inline
17961 eval $setvar
17962 $rm -f a.[co] b.[co]
17963 $rm_try
17964
17965 : Check stream access
17966 $cat >&4 <<EOM
17967 Checking how to access stdio streams by file descriptor number...
17968 EOM
17969 case "$stdio_stream_array" in
17970 '')     $cat >try.c <<EOCP
17971 #include <stdio.h>
17972 int main() {
17973   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17974     printf("yes\n");
17975 }
17976 EOCP
17977         for s in _iob __iob __sF
17978         do
17979                 set try -DSTDIO_STREAM_ARRAY=$s
17980                 if eval $compile; then
17981                         case "`$run ./try`" in
17982                         yes)    stdio_stream_array=$s; break ;;
17983                         esac
17984                 fi
17985         done
17986         $rm_try
17987 esac
17988 case "$stdio_stream_array" in
17989 '')     $cat >&4 <<EOM
17990 I can't figure out how to access stdio streams by file descriptor number.
17991 EOM
17992         d_stdio_stream_array="$undef"
17993         ;;
17994 *)      $cat >&4 <<EOM
17995 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17996 EOM
17997         d_stdio_stream_array="$define"
17998         ;;
17999 esac
18000
18001 : see if strcoll exists
18002 set strcoll d_strcoll
18003 eval $inlibc
18004
18005 : check for structure copying
18006 echo " "
18007 echo "Checking to see if your C compiler can copy structs..." >&4
18008 $cat >try.c <<'EOCP'
18009 int main()
18010 {
18011         struct blurfl {
18012                 int dyick;
18013         } foo, bar;
18014
18015         foo = bar;
18016 }
18017 EOCP
18018 if $cc -c try.c >/dev/null 2>&1 ; then
18019         val="$define"
18020         echo "Yup, it can."
18021 else
18022         val="$undef"
18023         echo "Nope, it can't."
18024 fi
18025 set d_strctcpy
18026 eval $setvar
18027 $rm_try
18028
18029 : see if strerror and/or sys_errlist[] exist
18030 echo " "
18031 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18032     if set strerror val -f d_strerror; eval $csym; $val; then
18033                 echo 'strerror() found.' >&4
18034                 d_strerror="$define"
18035                 d_strerrm='strerror(e)'
18036                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18037                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18038                         d_syserrlst="$define"
18039                 else
18040                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18041                         d_syserrlst="$undef"
18042                 fi
18043     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18044                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18045                 echo 'strerror() found in string header.' >&4
18046                 d_strerror="$define"
18047                 d_strerrm='strerror(e)'
18048                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18049                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18050                                 d_syserrlst="$define"
18051                 else
18052                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18053                         d_syserrlst="$undef"
18054                 fi
18055     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18056                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18057                 d_strerror="$undef"
18058                 d_syserrlst="$define"
18059                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18060     else
18061                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18062                 d_strerror="$undef"
18063                 d_syserrlst="$undef"
18064                 d_strerrm='"unknown"'
18065     fi
18066 fi
18067
18068 : see if strerror_r exists
18069 set strerror_r d_strerror_r
18070 eval $inlibc
18071 case "$d_strerror_r" in
18072 "$define")
18073         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18074         case "$d_strerror_r_proto:$usethreads" in
18075         ":define")      d_strerror_r_proto=define
18076                 set d_strerror_r_proto strerror_r $hdrs
18077                 eval $hasproto ;;
18078         *)      ;;
18079         esac
18080         case "$d_strerror_r_proto" in
18081         define)
18082         case "$strerror_r_proto" in
18083         ''|0) try='int strerror_r(int, char*, size_t);'
18084         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18085         esac
18086         case "$strerror_r_proto" in
18087         ''|0) try='int strerror_r(int, char*, int);'
18088         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18089         esac
18090         case "$strerror_r_proto" in
18091         ''|0) try='char* strerror_r(int, char*, size_t);'
18092         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18093         esac
18094         case "$strerror_r_proto" in
18095         ''|0)   d_strerror_r=undef
18096                 strerror_r_proto=0
18097                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18098         * )     case "$strerror_r_proto" in
18099                 REENTRANT_PROTO*) ;;
18100                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18101                 esac
18102                 echo "Prototype: $try" ;;
18103         esac
18104         ;;
18105         *)      case "$usethreads" in
18106                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18107                 esac
18108                 d_strerror_r=undef
18109                 strerror_r_proto=0
18110                 ;;
18111         esac
18112         ;;
18113 *)      strerror_r_proto=0
18114         ;;
18115 esac
18116
18117 : see if strftime exists
18118 set strftime d_strftime
18119 eval $inlibc
18120
18121 : see if strlcat exists
18122 set strlcat d_strlcat
18123 eval $inlibc
18124
18125 : see if strlcpy exists
18126 set strlcpy d_strlcpy
18127 eval $inlibc
18128
18129 : see if strtod exists
18130 set strtod d_strtod
18131 eval $inlibc
18132
18133 : see if strtol exists
18134 set strtol d_strtol
18135 eval $inlibc
18136
18137 : see if strtold exists
18138 set strtold d_strtold
18139 eval $inlibc
18140
18141 : see if strtoll exists
18142 set strtoll d_strtoll
18143 eval $inlibc
18144
18145 case "$d_longlong-$d_strtoll" in
18146 "$define-$define")
18147         $cat <<EOM
18148 Checking whether your strtoll() works okay...
18149 EOM
18150         $cat >try.c <<'EOCP'
18151 #include <errno.h>
18152 #ifdef __hpux
18153 #define strtoll __strtoll
18154 #endif
18155 #ifdef __EMX__
18156 #define strtoll _strtoll
18157 #endif
18158 #include <stdio.h>
18159 extern long long int strtoll(char *s, char **, int);
18160 static int bad = 0;
18161 int check(char *s, long long ell, int een) {
18162         long long gll;
18163         errno = 0;
18164         gll = strtoll(s, 0, 10);
18165         if (!((gll == ell) && (errno == een)))
18166                 bad++;
18167 }
18168 int main() {
18169         check(" 1",                                      1LL, 0);
18170         check(" 0",                                      0LL, 0);
18171         check("-1",                                     -1LL, 0);
18172         check("-9223372036854775808", -9223372036854775808LL, 0);
18173         check("-9223372036854775808", -9223372036854775808LL, 0);
18174         check(" 9223372036854775807",  9223372036854775807LL, 0);
18175         check("-9223372036854775808", -9223372036854775808LL, 0);
18176         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18177         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18178         if (!bad)
18179                 printf("ok\n");
18180 }
18181 EOCP
18182         set try
18183         if eval $compile; then
18184                 yyy=`$run ./try`
18185                 case "$yyy" in
18186                 ok) echo "Your strtoll() seems to be working okay." ;;
18187                 *) cat <<EOM >&4
18188 Your strtoll() doesn't seem to be working okay.
18189 EOM
18190                    d_strtoll="$undef"
18191                    ;;
18192                 esac
18193         else
18194                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18195                 d_strtoll="$undef"
18196         fi
18197         ;;
18198 esac
18199
18200 : see if strtoq exists
18201 set strtoq d_strtoq
18202 eval $inlibc
18203
18204 : see if strtoul exists
18205 set strtoul d_strtoul
18206 eval $inlibc
18207
18208 case "$d_strtoul" in
18209 "$define")
18210         $cat <<EOM
18211 Checking whether your strtoul() works okay...
18212 EOM
18213         $cat >try.c <<'EOCP'
18214 #include <errno.h>
18215 #include <stdio.h>
18216 extern unsigned long int strtoul(char *s, char **, int);
18217 static int bad = 0;
18218 void check(char *s, unsigned long eul, int een) {
18219         unsigned long gul;
18220         errno = 0;
18221         gul = strtoul(s, 0, 10);
18222         if (!((gul == eul) && (errno == een)))
18223                 bad++;
18224 }
18225 int main() {
18226         check(" 1", 1L, 0);
18227         check(" 0", 0L, 0);
18228 EOCP
18229         case "$longsize" in
18230         8)
18231             $cat >>try.c <<'EOCP'
18232         check("18446744073709551615", 18446744073709551615UL, 0);
18233         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18234 #if 0 /* strtoul() for /^-/ strings is undefined. */
18235         check("-1", 18446744073709551615UL, 0);
18236         check("-18446744073709551614", 2, 0);
18237         check("-18446744073709551615", 1, 0);
18238         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18239         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18240 #endif
18241 EOCP
18242                 ;;
18243         4)
18244                     $cat >>try.c <<'EOCP'
18245         check("4294967295", 4294967295UL, 0);
18246         check("4294967296", 4294967295UL, ERANGE);
18247 #if 0 /* strtoul() for /^-/ strings is undefined. */
18248         check("-1", 4294967295UL, 0);
18249         check("-4294967294", 2, 0);
18250         check("-4294967295", 1, 0);
18251         check("-4294967296", 4294967295UL, ERANGE);
18252         check("-4294967297", 4294967295UL, ERANGE);
18253 #endif
18254 EOCP
18255                 ;;
18256         *)
18257 : Should we write these tests to be more portable by sprintf-ing
18258 : ~0 and then manipulating that char string as input for strtol?
18259                 ;;
18260         esac
18261         $cat >>try.c <<'EOCP'
18262         if (!bad)
18263                 printf("ok\n");
18264         return 0;
18265 }
18266 EOCP
18267         set try
18268         if eval $compile; then
18269                 case "`$run ./try`" in
18270                 ok) echo "Your strtoul() seems to be working okay." ;;
18271                 *) cat <<EOM >&4
18272 Your strtoul() doesn't seem to be working okay.
18273 EOM
18274                    d_strtoul="$undef"
18275                    ;;
18276                 esac
18277         else
18278                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18279                 d_strtoul="$undef"
18280         fi
18281         ;;
18282 esac
18283
18284 : see if strtoull exists
18285 set strtoull d_strtoull
18286 eval $inlibc
18287
18288 case "$d_longlong-$d_strtoull" in
18289 "$define-$define")
18290         $cat <<EOM
18291 Checking whether your strtoull() works okay...
18292 EOM
18293         $cat >try.c <<'EOCP'
18294 #include <errno.h>
18295 #ifdef __hpux
18296 #define strtoull __strtoull
18297 #endif
18298 #include <stdio.h>
18299 extern unsigned long long int strtoull(char *s, char **, int);
18300 static int bad = 0;
18301 int check(char *s, long long eull, int een) {
18302         long long gull;
18303         errno = 0;
18304         gull = strtoull(s, 0, 10);
18305         if (!((gull == eull) && (errno == een)))
18306                 bad++;
18307 }
18308 int main() {
18309         check(" 1",                                        1LL, 0);
18310         check(" 0",                                        0LL, 0);
18311         check("18446744073709551615",  18446744073709551615ULL, 0);
18312         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18313 #if 0 /* strtoull() for /^-/ strings is undefined. */
18314         check("-1",                    18446744073709551615ULL, 0);
18315         check("-18446744073709551614",                     2LL, 0);
18316         check("-18446744073709551615",                     1LL, 0);
18317         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18318         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18319 #endif
18320         if (!bad)
18321                 printf("ok\n");
18322 }
18323 EOCP
18324         set try
18325         if eval $compile; then
18326                 case "`$run ./try`" in
18327                 ok) echo "Your strtoull() seems to be working okay." ;;
18328                 *) cat <<EOM >&4
18329 Your strtoull() doesn't seem to be working okay.
18330 EOM
18331                    d_strtoull="$undef"
18332                    ;;
18333                 esac
18334         else
18335                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18336                 d_strtoull="$undef"
18337         fi
18338         ;;
18339 esac
18340
18341 : see if strtouq exists
18342 set strtouq d_strtouq
18343 eval $inlibc
18344
18345 case "$d_strtouq" in
18346 "$define")
18347         $cat <<EOM
18348 Checking whether your strtouq() works okay...
18349 EOM
18350         $cat >try.c <<'EOCP'
18351 #include <errno.h>
18352 #include <stdio.h>
18353 extern unsigned long long int strtouq(char *s, char **, int);
18354 static int bad = 0;
18355 void check(char *s, unsigned long long eull, int een) {
18356         unsigned long long gull;
18357         errno = 0;
18358         gull = strtouq(s, 0, 10);
18359         if (!((gull == eull) && (errno == een)))
18360                 bad++;
18361 }
18362 int main() {
18363         check(" 1",                                        1LL, 0);
18364         check(" 0",                                        0LL, 0);
18365         check("18446744073709551615",  18446744073709551615ULL, 0);
18366         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18367 #if 0 /* strtouq() for /^-/ strings is undefined. */
18368         check("-1",                    18446744073709551615ULL, 0);
18369         check("-18446744073709551614",                     2LL, 0);
18370         check("-18446744073709551615",                     1LL, 0);
18371         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18372         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18373 #endif
18374         if (!bad)
18375                 printf("ok\n");
18376         return 0;
18377 }
18378 EOCP
18379         set try
18380         if eval $compile; then
18381                 case "`$run ./try`" in
18382                 ok) echo "Your strtouq() seems to be working okay." ;;
18383                 *) cat <<EOM >&4
18384 Your strtouq() doesn't seem to be working okay.
18385 EOM
18386                    d_strtouq="$undef"
18387                    ;;
18388                 esac
18389         else
18390                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18391                 d_strtouq="$undef"
18392         fi
18393         ;;
18394 esac
18395
18396 : see if strxfrm exists
18397 set strxfrm d_strxfrm
18398 eval $inlibc
18399
18400 : see if symlink exists
18401 set symlink d_symlink
18402 eval $inlibc
18403
18404 : see if syscall exists
18405 set syscall d_syscall
18406 eval $inlibc
18407
18408 : see if prototype for syscall is available
18409 echo " "
18410 set d_syscallproto syscall $i_unistd unistd.h
18411 eval $hasproto
18412
18413 : see if sysconf exists
18414 set sysconf d_sysconf
18415 eval $inlibc
18416
18417 : see if system exists
18418 set system d_system
18419 eval $inlibc
18420
18421 : see if tcgetpgrp exists
18422 set tcgetpgrp d_tcgetpgrp
18423 eval $inlibc
18424
18425 : see if tcsetpgrp exists
18426 set tcsetpgrp d_tcsetpgrp
18427 eval $inlibc
18428
18429 : see if prototype for telldir is available
18430 echo " "
18431 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18432 eval $hasproto
18433
18434 : see if time exists
18435 echo " "
18436 if test "X$d_time" = X -o X"$timetype" = X; then
18437     if set time val -f d_time; eval $csym; $val; then
18438                 echo 'time() found.' >&4
18439                 val="$define"
18440                 rp="What is the type returned by time() on this system?"
18441                 set time_t timetype long stdio.h sys/types.h
18442                 eval $typedef_ask
18443     else
18444                 echo 'time() not found, hope that will do.' >&4
18445                 val="$undef"
18446                 timetype='int';
18447     fi
18448     set d_time
18449     eval $setvar
18450 fi
18451
18452 : see if timegm exists
18453 set timegm d_timegm
18454 eval $inlibc
18455
18456 : see if this is a sys/times.h system
18457 set sys/times.h i_systimes
18458 eval $inhdr
18459
18460 : see if times exists
18461 echo " "
18462 if set times val -f d_times; eval $csym; $val; then
18463         echo 'times() found.' >&4
18464         d_times="$define"
18465         inc=''
18466         case "$i_systimes" in
18467         "$define") inc='sys/times.h';;
18468         esac
18469         rp="What is the type returned by times() on this system?"
18470         set clock_t clocktype long stdio.h sys/types.h $inc
18471         eval $typedef_ask
18472 else
18473         echo 'times() NOT found, hope that will do.' >&4
18474         d_times="$undef"
18475         clocktype='int'
18476 fi
18477
18478 : see if tmpnam_r exists
18479 set tmpnam_r d_tmpnam_r
18480 eval $inlibc
18481 case "$d_tmpnam_r" in
18482 "$define")
18483         hdrs="$i_systypes sys/types.h define stdio.h "
18484         case "$d_tmpnam_r_proto:$usethreads" in
18485         ":define")      d_tmpnam_r_proto=define
18486                 set d_tmpnam_r_proto tmpnam_r $hdrs
18487                 eval $hasproto ;;
18488         *)      ;;
18489         esac
18490         case "$d_tmpnam_r_proto" in
18491         define)
18492         case "$tmpnam_r_proto" in
18493         ''|0) try='char* tmpnam_r(char*);'
18494         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18495         esac
18496         case "$tmpnam_r_proto" in
18497         ''|0)   d_tmpnam_r=undef
18498                 tmpnam_r_proto=0
18499                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18500         * )     case "$tmpnam_r_proto" in
18501                 REENTRANT_PROTO*) ;;
18502                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18503                 esac
18504                 echo "Prototype: $try" ;;
18505         esac
18506         ;;
18507         *)      case "$usethreads" in
18508                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18509                 esac
18510                 d_tmpnam_r=undef
18511                 tmpnam_r_proto=0
18512                 ;;
18513         esac
18514         ;;
18515 *)      tmpnam_r_proto=0
18516         ;;
18517 esac
18518
18519 : see if truncate exists
18520 set truncate d_truncate
18521 eval $inlibc
18522
18523 : see if ttyname_r exists
18524 set ttyname_r d_ttyname_r
18525 eval $inlibc
18526 case "$d_ttyname_r" in
18527 "$define")
18528         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18529         case "$d_ttyname_r_proto:$usethreads" in
18530         ":define")      d_ttyname_r_proto=define
18531                 set d_ttyname_r_proto ttyname_r $hdrs
18532                 eval $hasproto ;;
18533         *)      ;;
18534         esac
18535         case "$d_ttyname_r_proto" in
18536         define)
18537         case "$ttyname_r_proto" in
18538         ''|0) try='int ttyname_r(int, char*, size_t);'
18539         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18540         esac
18541         case "$ttyname_r_proto" in
18542         ''|0) try='int ttyname_r(int, char*, int);'
18543         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18544         esac
18545         case "$ttyname_r_proto" in
18546         ''|0) try='char* ttyname_r(int, char*, int);'
18547         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18548         esac
18549         case "$ttyname_r_proto" in
18550         ''|0)   d_ttyname_r=undef
18551                 ttyname_r_proto=0
18552                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18553         * )     case "$ttyname_r_proto" in
18554                 REENTRANT_PROTO*) ;;
18555                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18556                 esac
18557                 echo "Prototype: $try" ;;
18558         esac
18559         ;;
18560         *)      case "$usethreads" in
18561                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18562                 esac
18563                 d_ttyname_r=undef
18564                 ttyname_r_proto=0
18565                 ;;
18566         esac
18567         ;;
18568 *)      ttyname_r_proto=0
18569         ;;
18570 esac
18571
18572 : see if tzname[] exists
18573 echo " "
18574 if set tzname val -a d_tzname; eval $csym; $val; then
18575         val="$define"
18576         echo 'tzname[] found.' >&4
18577 else
18578         val="$undef"
18579         echo 'tzname[] NOT found.' >&4
18580 fi
18581 set d_tzname
18582 eval $setvar
18583
18584 : Check if is a multiplatform env
18585 case "$osname" in
18586 next|rhapsody|darwin) multiarch="$define" ;;
18587 esac
18588 case "$multiarch" in
18589 ''|[nN]*) multiarch="$undef" ;;
18590 esac
18591
18592 : check for ordering of bytes in a UV
18593 echo " "
18594 case "$usecrosscompile$multiarch" in
18595 *$define*)
18596         $cat <<EOM
18597 You seem to be either cross-compiling or doing a multiarchitecture build,
18598 skipping the byteorder check.
18599
18600 EOM
18601         byteorder='ffff'
18602         ;;
18603 *)
18604         case "$byteorder" in
18605         '')
18606                 $cat <<'EOM'
18607 In the following, larger digits indicate more significance.  A big-endian
18608 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18609 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18610 machines may have weird orders like 3412.  A Cray will report 87654321,
18611 an Alpha will report 12345678. If the test program works the default is
18612 probably right.
18613 I'm now running the test program...
18614 EOM
18615                 $cat >try.c <<EOCP
18616 #include <stdio.h>
18617 #$i_stdlib I_STDLIB
18618 #ifdef I_STDLIB
18619 #include <stdlib.h>
18620 #endif
18621 #include <sys/types.h>
18622 typedef $uvtype UV;
18623 int main()
18624 {
18625         int i;
18626         union {
18627                 UV l;
18628                 char c[$uvsize];
18629         } u;
18630
18631         if ($uvsize > 4)
18632                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18633         else
18634                 u.l = (UV)0x04030201;
18635         for (i = 0; i < $uvsize; i++)
18636                 printf("%c", u.c[i]+'0');
18637         printf("\n");
18638         exit(0);
18639 }
18640 EOCP
18641                 xxx_prompt=y
18642                 set try
18643                 if eval $compile && $run ./try > /dev/null; then
18644                         dflt=`$run ./try`
18645                         case "$dflt" in
18646                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18647                                 echo "(The test program ran ok.)"
18648                                 echo "byteorder=$dflt"
18649                                 xxx_prompt=n
18650                         ;;
18651                         ????|????????) echo "(The test program ran ok.)" ;;
18652                         *) echo "(The test program didn't run right for some reason.)" ;;
18653                         esac
18654                 else
18655                         dflt='4321'
18656                         cat <<'EOM'
18657 (I can't seem to compile the test program.  Guessing big-endian...)
18658 EOM
18659                 fi
18660                 case "$xxx_prompt" in
18661                 y)
18662                         rp="What is the order of bytes in $uvtype?"
18663                         . ./myread
18664                         byteorder="$ans"
18665                         ;;
18666                 *)      byteorder=$dflt
18667                         ;;
18668                 esac
18669                 ;;
18670         esac
18671         $rm_try
18672         ;;
18673 esac
18674
18675 : Checking 32bit alignedness
18676 $cat <<EOM
18677
18678 Checking to see whether you can access character data unalignedly...
18679 EOM
18680 case "$d_u32align" in
18681 '')   $cat >try.c <<EOCP
18682 #include <stdio.h>
18683 #$i_stdlib I_STDLIB
18684 #ifdef I_STDLIB
18685 #include <stdlib.h>
18686 #endif
18687 #define U32 $u32type
18688 #define BYTEORDER 0x$byteorder
18689 #define U8 $u8type
18690 #include <signal.h>
18691 #ifdef SIGBUS
18692 $signal_t bletch(int s) { exit(4); }
18693 #endif
18694 int main() {
18695 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18696     volatile U8 buf[8];
18697     volatile U32 *up;
18698     int i;
18699
18700     if (sizeof(U32) != 4) {
18701         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18702         exit(1);
18703     }
18704
18705     fflush(stdout);
18706
18707 #ifdef SIGBUS
18708     signal(SIGBUS, bletch);
18709 #endif
18710
18711     buf[0] = 0;
18712     buf[1] = 0;
18713     buf[2] = 0;
18714     buf[3] = 1;
18715     buf[4] = 0;
18716     buf[5] = 0;
18717     buf[6] = 0;
18718     buf[7] = 1;
18719
18720     for (i = 0; i < 4; i++) {
18721         up = (U32*)(buf + i);
18722         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18723                (*up == 1 << (8*(3-i)))  /* little-endian */
18724               )
18725            )
18726         {
18727             printf("read failed (%x)\n", *up);
18728             exit(2);
18729         }
18730     }
18731
18732     /* write test */
18733     for (i = 0; i < 4; i++) {
18734         up = (U32*)(buf + i);
18735         *up = 0xBeef;
18736         if (*up != 0xBeef) {
18737             printf("write failed (%x)\n", *up);
18738             exit(3);
18739         }
18740     }
18741
18742     exit(0);
18743 #else
18744     printf("1\n");
18745     exit(1);
18746 #endif
18747     return 0;
18748 }
18749 EOCP
18750 set try
18751 if eval $compile_ok; then
18752         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18753         $run ./try 2>&1 >/dev/null
18754         case "$?" in
18755         0)      cat >&4 <<EOM
18756 You can access character data pretty unalignedly.
18757 EOM
18758                 d_u32align="$undef"
18759                 ;;
18760         *)      cat >&4 <<EOM
18761 It seems that you must access character data in an aligned manner.
18762 EOM
18763                 d_u32align="$define"
18764                 ;;
18765         esac
18766 else
18767         rp='Can you access character data at unaligned addresses?'
18768         dflt='n'
18769         . ./myread
18770         case "$ans" in
18771         [yY]*)  d_u32align="$undef"  ;;
18772         *)      d_u32align="$define" ;;
18773         esac
18774 fi
18775 $rm_try
18776 ;;
18777 esac
18778
18779 : see if ualarm exists
18780 set ualarm d_ualarm
18781 eval $inlibc
18782
18783 : see if umask exists
18784 set umask d_umask
18785 eval $inlibc
18786
18787 : see if unordered exists
18788 set unordered d_unordered
18789 eval $inlibc
18790
18791 : see if unsetenv exists
18792 set unsetenv d_unsetenv
18793 eval $inlibc
18794
18795 : see if usleep exists
18796 set usleep d_usleep
18797 eval $inlibc
18798
18799 : see if prototype for usleep is available
18800 echo " "
18801 set d_usleepproto usleep $i_unistd unistd.h
18802 eval $hasproto
18803
18804 : see if ustat exists
18805 set ustat d_ustat
18806 eval $inlibc
18807
18808 : see if closedir exists
18809 set closedir d_closedir
18810 eval $inlibc
18811
18812 case "$d_closedir" in
18813 "$define")
18814         echo " "
18815         echo "Checking whether closedir() returns a status..." >&4
18816         cat > try.c <<EOM
18817 #$i_dirent I_DIRENT             /**/
18818 #$i_sysdir I_SYS_DIR            /**/
18819 #$i_sysndir I_SYS_NDIR          /**/
18820 #$i_systypes I_SYS_TYPES        /**/
18821
18822 #if defined(I_SYS_TYPES)
18823 #include <sys/types.h>
18824 #endif
18825 #if defined(I_DIRENT)
18826 #include <dirent.h>
18827 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18828 #include <sys/dir.h>
18829 #endif
18830 #else
18831 #ifdef I_SYS_NDIR
18832 #include <sys/ndir.h>
18833 #else
18834 #ifdef I_SYS_DIR
18835 #ifdef hp9000s500
18836 #include <ndir.h>       /* may be wrong in the future */
18837 #else
18838 #include <sys/dir.h>
18839 #endif
18840 #endif
18841 #endif
18842 #endif
18843 int main() { return closedir(opendir(".")); }
18844 EOM
18845         set try
18846         if eval $compile_ok; then
18847                 if $run ./try > /dev/null 2>&1 ; then
18848                         echo "Yes, it does."
18849                         val="$undef"
18850                 else
18851                         echo "No, it doesn't."
18852                         val="$define"
18853                 fi
18854         else
18855                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18856                 val="$define"
18857         fi
18858         ;;
18859 *)
18860         val="$undef";
18861         ;;
18862 esac
18863 set d_void_closedir
18864 eval $setvar
18865 $rm_try
18866
18867 : see if there is a wait4
18868 set wait4 d_wait4
18869 eval $inlibc
18870
18871 : see if waitpid exists
18872 set waitpid d_waitpid
18873 eval $inlibc
18874
18875 : see if wcstombs exists
18876 set wcstombs d_wcstombs
18877 eval $inlibc
18878
18879 : see if wctomb exists
18880 set wctomb d_wctomb
18881 eval $inlibc
18882
18883 : see if writev exists
18884 set writev d_writev
18885 eval $inlibc
18886
18887 : preserve RCS keywords in files with variable substitution, grrr
18888 Date='$Date'
18889 Id='$Id'
18890 Log='$Log'
18891 RCSfile='$RCSfile'
18892 Revision='$Revision'
18893
18894 : check for alignment requirements
18895 echo " "
18896 case "$usecrosscompile$multiarch" in
18897 *$define*)
18898         $cat <<EOM
18899 You seem to be either cross-compiling or doing a multiarchitecture build,
18900 skipping the memory alignment check.
18901
18902 EOM
18903         case "$alignbytes" in
18904         '') alignbytes=8 ;;
18905         esac
18906         ;;
18907 *)
18908         case "$alignbytes" in
18909         '') echo "Checking alignment constraints..." >&4
18910                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18911                         $cat >try.c <<'EOCP'
18912 typedef long double NV;
18913 EOCP
18914                 else
18915                         $cat >try.c <<'EOCP'
18916 typedef double NV;
18917 EOCP
18918                 fi
18919                 $cat >>try.c <<'EOCP'
18920 #include <stdio.h>
18921 struct foobar {
18922         char foo;
18923         NV bar;
18924 } try_algn;
18925 int main()
18926 {
18927     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18928     return(0);
18929 }
18930 EOCP
18931                 set try
18932                 if eval $compile_ok; then
18933                         dflt=`$run ./try`
18934                 else
18935                         dflt='8'
18936                         echo "(I can't seem to compile the test program...)"
18937                 fi
18938                 ;;
18939         *) dflt="$alignbytes"
18940                 ;;
18941         esac
18942         rp="Doubles must be aligned on a how-many-byte boundary?"
18943         . ./myread
18944         alignbytes="$ans"
18945         $rm_try
18946         ;;
18947 esac
18948
18949
18950 : set the base revision
18951 baserev=5.0
18952
18953 : length of character in bytes. Is always 1, otherwise it isnt C
18954 : This used to be a test using sizeof
18955 charsize=1
18956
18957 : Check for the number of bits in a character
18958 case "$charbits" in
18959 '')     echo "Checking how long a character is (in bits)..." >&4
18960         $cat >try.c <<EOCP
18961 #include <stdio.h>
18962 int main ()
18963 {
18964     int n;
18965     unsigned char c;
18966     for (c = 1, n = 0; c; c <<= 1, n++) ;
18967     printf ("%d\n", n);
18968     return (0);
18969     }
18970 EOCP
18971         set try
18972         if eval $compile_ok; then
18973                 dflt=`$run ./try`
18974         else
18975                 dflt='8'
18976                 echo "(I can't seem to compile the test program.  Guessing...)"
18977         fi
18978         ;;
18979 *)
18980         dflt="$charbits"
18981         ;;
18982 esac
18983 rp="What is the length of a character (in bits)?"
18984 . ./myread
18985 charbits="$ans"
18986 $rm_try
18987 case "$charbits" in
18988 8)      ;;
18989 *)      cat >&4 << EOM
18990 Your system has an unsigned character size of $charbits bits, which
18991 is rather unusual (normally it is 8 bits).  Perl likely will not work
18992 correctly on your system, with subtle bugs in various places.
18993 EOM
18994         rp='Do you really want to continue?'
18995         dflt='n'
18996         . ./myread
18997         case "$ans" in
18998                 [yY])   echo >&4 "Okay, continuing."    ;;
18999                 *)      exit 1                          ;;
19000         esac
19001 esac
19002
19003 : how do we concatenate cpp tokens here?
19004 echo " "
19005 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19006 $cat >cpp_stuff.c <<'EOCP'
19007 #define RCAT(a,b)a/**/b
19008 #define ACAT(a,b)a ## b
19009 RCAT(Rei,ser)
19010 ACAT(Cir,cus)
19011 EOCP
19012 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19013 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19014         echo "Oh!  Smells like ANSI's been here." >&4
19015         echo "We can catify or stringify, separately or together!"
19016         cpp_stuff=42
19017 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19018         echo "Ah, yes!  The good old days!" >&4
19019         echo "However, in the good old days we don't know how to stringify and"
19020         echo "catify at the same time."
19021         cpp_stuff=1
19022 else
19023         $cat >&4 <<EOM
19024 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19025 You're going to have to edit the values of CAT[2-5] in config.h...
19026 EOM
19027         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19028 fi
19029 $rm -f cpp_stuff.*
19030
19031 : see if this is a db.h system
19032 set db.h i_db
19033 eval $inhdr
19034
19035 case "$i_db" in
19036 $define)
19037         : Check db version.
19038         echo " "
19039         echo "Checking Berkeley DB version ..." >&4
19040         $cat >try.c <<EOCP
19041 #$d_const HASCONST
19042 #ifndef HASCONST
19043 #define const
19044 #endif
19045 #include <sys/types.h>
19046 #include <stdio.h>
19047 #$i_stdlib I_STDLIB
19048 #ifdef I_STDLIB
19049 #include <stdlib.h>
19050 #endif
19051 #include <db.h>
19052 int main(int argc, char *argv[])
19053 {
19054 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19055     int Major, Minor, Patch ;
19056     unsigned long Version ;
19057     (void)db_version(&Major, &Minor, &Patch) ;
19058     if (argc == 2) {
19059         printf("%d %d %d %d %d %d\n",
19060                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19061                Major, Minor, Patch);
19062         exit(0);
19063     }
19064     printf("You have Berkeley DB Version 2 or greater.\n");
19065
19066     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19067                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19068     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19069                 Major, Minor, Patch) ;
19070
19071     /* check that db.h & libdb are compatible */
19072     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19073         printf("db.h and libdb are incompatible.\n") ;
19074         exit(3);
19075     }
19076
19077     printf("db.h and libdb are compatible.\n") ;
19078
19079     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19080                 + DB_VERSION_PATCH ;
19081
19082     /* needs to be >= 2.3.4 */
19083     if (Version < 2003004) {
19084     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19085         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19086         exit(2);
19087     }
19088
19089     exit(0);
19090 #else
19091 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19092     if (argc == 2) {
19093         printf("1 0 0\n");
19094         exit(0);
19095     }
19096     printf("You have Berkeley DB Version 1.\n");
19097     exit(0);    /* DB version < 2: the coast is clear. */
19098 #else
19099     exit(1);    /* <db.h> not Berkeley DB? */
19100 #endif
19101 #endif
19102 }
19103 EOCP
19104         set try
19105         if eval $compile_ok && $run ./try; then
19106                 echo 'Looks OK.' >&4
19107                 set `$run ./try 1`
19108                 db_version_major=$1
19109                 db_version_minor=$2
19110                 db_version_patch=$3
19111         else
19112                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19113                 i_db=$undef
19114                 case " $libs " in
19115                 *"-ldb "*)
19116                         : Remove db from list of libraries to use
19117                         echo "Removing unusable -ldb from library list" >&4
19118                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19119                         shift
19120                         libs="$*"
19121                         echo "libs = $libs" >&4
19122                         ;;
19123                 esac
19124         fi
19125         $rm_try
19126         ;;
19127 esac
19128
19129 case "$i_db" in
19130 define)
19131         : Check the return type needed for hash
19132         echo " "
19133         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19134         $cat >try.c <<EOCP
19135 #$d_const HASCONST
19136 #ifndef HASCONST
19137 #define const
19138 #endif
19139 #include <sys/types.h>
19140 #include <db.h>
19141
19142 #ifndef DB_VERSION_MAJOR
19143 u_int32_t hash_cb (ptr, size)
19144 const void *ptr;
19145 size_t size;
19146 {
19147 }
19148 HASHINFO info;
19149 int main()
19150 {
19151         info.hash = hash_cb;
19152 }
19153 #endif
19154 EOCP
19155         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19156                 if $contains warning try.out >>/dev/null 2>&1 ; then
19157                         db_hashtype='int'
19158                 else
19159                         db_hashtype='u_int32_t'
19160                 fi
19161         else
19162                 : XXX Maybe we should just give up here.
19163                 db_hashtype=u_int32_t
19164                 $cat try.out >&4
19165                 echo "Help:  I can't seem to compile the db test program." >&4
19166                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19167         fi
19168         $rm_try
19169         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19170         ;;
19171 *)      db_hashtype=u_int32_t
19172         ;;
19173 esac
19174 case "$i_db" in
19175 define)
19176         : Check the return type needed for prefix
19177         echo " "
19178         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19179         cat >try.c <<EOCP
19180 #$d_const HASCONST
19181 #ifndef HASCONST
19182 #define const
19183 #endif
19184 #include <sys/types.h>
19185 #include <db.h>
19186
19187 #ifndef DB_VERSION_MAJOR
19188 size_t prefix_cb (key1, key2)
19189 const DBT *key1;
19190 const DBT *key2;
19191 {
19192 }
19193 BTREEINFO info;
19194 int main()
19195 {
19196         info.prefix = prefix_cb;
19197 }
19198 #endif
19199 EOCP
19200         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19201                 if $contains warning try.out >>/dev/null 2>&1 ; then
19202                         db_prefixtype='int'
19203                 else
19204                         db_prefixtype='size_t'
19205                 fi
19206         else
19207                 db_prefixtype='size_t'
19208                 : XXX Maybe we should just give up here.
19209                 $cat try.out >&4
19210                 echo "Help:  I can't seem to compile the db test program." >&4
19211                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19212         fi
19213         $rm_try
19214         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19215         ;;
19216 *)      db_prefixtype='size_t'
19217         ;;
19218 esac
19219
19220 : How can we generate normalized random numbers ?
19221 echo " "
19222 echo "Looking for a random number function..." >&4
19223 case "$randfunc" in
19224 '')
19225         if set drand48 val -f; eval $csym; $val; then
19226                 dflt="drand48"
19227                 echo "Good, found drand48()." >&4
19228         elif set random val -f; eval $csym; $val; then
19229                 dflt="random"
19230                 echo "OK, found random()." >&4
19231         else
19232                 dflt="rand"
19233                 echo "Yick, looks like I have to use rand()." >&4
19234         fi
19235         echo " "
19236         ;;
19237 *)
19238         dflt="$randfunc"
19239         ;;
19240 esac
19241 cont=true
19242
19243 case "$ccflags" in
19244 *-Dmy_rand=*|*-Dmy_srand=*)
19245         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19246         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19247         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19248         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19249         ;;
19250 esac
19251
19252 while $test "$cont"; do
19253         rp="Use which function to generate random numbers?"
19254         . ./myread
19255         if $test "$ans" = "$dflt"; then
19256                 : null
19257         else
19258                 randbits=''
19259         fi
19260         randfunc="$ans"
19261         if set $ans val -f; eval $csym; $val; then
19262                 cont=''
19263         else
19264                 dflt=y
19265                 rp="I cannot find function $ans. Use that name anyway?"
19266                 . ./myread
19267                 dflt=rand
19268                 case "$ans" in
19269                         [yY]*) cont='';;
19270                 esac
19271         fi
19272         case "$cont" in
19273         '')
19274                 case "$randfunc" in
19275                 drand48)
19276                         drand01="drand48()"
19277                         seedfunc="srand48"
19278                         randbits=48
19279                         randseedtype=long
19280                         ;;
19281                 rand|random)
19282                         case "$randbits" in
19283                         '')
19284 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19285                                 $cat >try.c <<EOCP
19286 #$i_unistd I_UNISTD
19287 #$i_stdlib I_STDLIB
19288 #include <stdio.h>
19289 #ifdef I_UNISTD
19290 #  include <unistd.h>
19291 #endif
19292 #ifdef I_STDLIB
19293 #  include <stdlib.h>
19294 #endif
19295 int main()
19296 {
19297         register int i;
19298         register unsigned long tmp;
19299         register unsigned long max = 0L;
19300
19301         for (i = 1000; i; i--) {
19302                 tmp = (unsigned long) $randfunc();
19303                 if (tmp > max) max = tmp;
19304         }
19305         for (i = 0; max; i++)
19306                 max /= 2;
19307         printf("%d\n",i);
19308 }
19309 EOCP
19310                                 set try
19311                                 if eval $compile_ok; then
19312                                         dflt=`try`
19313                                 else
19314                                         dflt='?'
19315                                         echo "(I can't seem to compile the test program...)"
19316                                 fi
19317                                 ;;
19318                         *)
19319                                 dflt="$randbits"
19320                                 ;;
19321                         esac
19322                         rp="How many bits does your $randfunc() function produce?"
19323                         . ./myread
19324                         randbits="$ans"
19325                         $rm_try
19326                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19327                         seedfunc="s$randfunc"
19328                         randseedtype=unsigned
19329                         ;;
19330                 *)
19331                         dflt="31"
19332                         rp="How many bits does your $randfunc() function produce?"
19333                         . ./myread
19334                         randbits="$ans"
19335                         seedfunc="s$randfunc"
19336                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19337                         if set $seedfunc val -f; eval $csym; $val; then
19338                                 echo "(Using $seedfunc() to seed random generator)"
19339                         else
19340                                 echo "(Warning: no $seedfunc() to seed random generator)"
19341                                 seedfunc=rand
19342                         fi
19343                         randseedtype=unsigned
19344                         ;;
19345                 esac
19346                 ;;
19347         esac
19348 done
19349
19350 : Determine if this is an EBCDIC system
19351 echo " "
19352 echo "Determining whether or not we are on an EBCDIC system..." >&4
19353 $cat >try.c <<'EOM'
19354 int main()
19355 {
19356   if ('M'==0xd4) return 0;
19357   return 1;
19358 }
19359 EOM
19360
19361 val=$undef
19362 set try
19363 if eval $compile_ok; then
19364         if $run ./try; then
19365                 echo "You seem to speak EBCDIC." >&4
19366                 val="$define"
19367         else
19368                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19369         fi
19370 else
19371         echo "I'm unable to compile the test program." >&4
19372         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19373 fi
19374 $rm_try
19375 set ebcdic
19376 eval $setvar
19377
19378 : Check how to flush
19379 echo " "
19380 $cat >&4 <<EOM
19381 Checking how to flush all pending stdio output...
19382 EOM
19383 # I only know how to find the first 32 possibly open files on SunOS.
19384 # See also hints/sunos_4_1.sh and util.c  --AD
19385 case "$osname" in
19386 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19387 esac
19388 $cat >>try.c <<EOCP
19389 #include <stdio.h>
19390 #$i_stdlib I_STDLIB
19391 #ifdef I_STDLIB
19392 #include <stdlib.h>
19393 #endif
19394 #$i_unistd I_UNISTD
19395 #ifdef I_UNISTD
19396 # include <unistd.h>
19397 #endif
19398 #$d_sysconf HAS_SYSCONF
19399 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19400 #ifdef HAS_STDIO_STREAM_ARRAY
19401 # define STDIO_STREAM_ARRAY $stdio_stream_array
19402 #endif
19403 int main() {
19404   FILE* p;
19405   unlink("try.out");
19406   p = fopen("try.out", "w");
19407 #ifdef TRY_FPUTC
19408   fputc('x', p);
19409 #else
19410 # ifdef TRY_FPRINTF
19411   fprintf(p, "x");
19412 # endif
19413 #endif
19414 #ifdef TRY_FFLUSH_NULL
19415   fflush(NULL);
19416 #endif
19417 #ifdef TRY_FFLUSH_ALL
19418   {
19419     long open_max = -1;
19420 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19421     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19422 # else
19423 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19424     open_max = sysconf(_SC_OPEN_MAX);
19425 #  else
19426 #   ifdef FOPEN_MAX
19427     open_max = FOPEN_MAX;
19428 #   else
19429 #    ifdef OPEN_MAX
19430     open_max = OPEN_MAX;
19431 #    else
19432 #     ifdef _NFILE
19433     open_max = _NFILE;
19434 #     endif
19435 #    endif
19436 #   endif
19437 #  endif
19438 # endif
19439 # ifdef HAS_STDIO_STREAM_ARRAY
19440     if (open_max > 0) {
19441       long i;
19442       for (i = 0; i < open_max; i++)
19443             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19444                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19445                 STDIO_STREAM_ARRAY[i]._flag)
19446                 fflush(&STDIO_STREAM_ARRAY[i]);
19447     }
19448   }
19449 # endif
19450 #endif
19451   _exit(42);
19452 }
19453 EOCP
19454 : first we have to find out how _not_ to flush
19455 $to try.c
19456 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19457     output=''
19458     set try -DTRY_FPUTC
19459     if eval $compile; then
19460             $run ./try 2>/dev/null
19461             code="$?"
19462             $from try.out
19463             if $test ! -s try.out -a "X$code" = X42; then
19464                 output=-DTRY_FPUTC
19465             fi
19466     fi
19467     case "$output" in
19468     '')
19469             set try -DTRY_FPRINTF
19470             if eval $compile; then
19471                     $run ./try 2>/dev/null
19472                     code="$?"
19473                     $from try.out
19474                     if $test ! -s try.out -a "X$code" = X42; then
19475                         output=-DTRY_FPRINTF
19476                     fi
19477             fi
19478         ;;
19479     esac
19480 fi
19481 : check for fflush NULL behaviour
19482 case "$fflushNULL" in
19483 '')     set try -DTRY_FFLUSH_NULL $output
19484         if eval $compile; then
19485                 $run ./try 2>/dev/null
19486                 code="$?"
19487                 $from try.out
19488                 if $test -s try.out -a "X$code" = X42; then
19489                         fflushNULL="`$cat try.out`"
19490                 else
19491                         if $test "X$code" != X42; then
19492                                 $cat >&4 <<EOM
19493 (If this test failed, don't worry, we'll try another method shortly.)
19494 EOM
19495                         fi
19496                 fi
19497         fi
19498         $rm -f core try.core core.try.*
19499         case "$fflushNULL" in
19500         x)      $cat >&4 <<EOM
19501 Your fflush(NULL) works okay for output streams.
19502 Let's see if it clobbers input pipes...
19503 EOM
19504 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19505 # bug that improperly flushes the input end of pipes.  So we avoid the
19506 # autoflush on fork/system/exec support for now. :-(
19507 $cat >tryp.c <<EOCP
19508 #include <stdio.h>
19509 int
19510 main(int argc, char **argv)
19511 {
19512     char buf[1024];
19513     int i;
19514     char *bp = buf;
19515     while (1) {
19516         while ((i = getc(stdin)) != -1
19517                && (*bp++ = i) != '\n'
19518                && bp < &buf[1024])
19519         /* DO NOTHING */ ;
19520         *bp = '\0';
19521         fprintf(stdout, "%s", buf);
19522         fflush(NULL);
19523         if (i == -1)
19524             return 0;
19525         bp = buf;
19526     }
19527 }
19528 EOCP
19529                 fflushNULL="$define"
19530                 set tryp
19531                 if eval $compile; then
19532                     $rm -f tryp.out
19533                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19534                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19535                        $cat >&4 <<EOM
19536 fflush(NULL) seems to behave okay with input streams.
19537 EOM
19538                         fflushNULL="$define"
19539                     else
19540                         $cat >&4 <<EOM
19541 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19542 EOM
19543                         fflushNULL="$undef"
19544                     fi
19545                 fi
19546                 $rm -f core tryp.c tryp.core core.tryp.*
19547                 ;;
19548         '')     $cat >&4 <<EOM
19549 Your fflush(NULL) isn't working (contrary to ANSI C).
19550 EOM
19551                 fflushNULL="$undef"
19552                 ;;
19553         *)      $cat >&4 <<EOM
19554 Cannot figure out whether your fflush(NULL) works or not.
19555 I'm assuming it doesn't (contrary to ANSI C).
19556 EOM
19557                 fflushNULL="$undef"
19558                 ;;
19559         esac
19560         ;;
19561 $define|true|[yY]*)
19562         fflushNULL="$define"
19563         ;;
19564 *)
19565         fflushNULL="$undef"
19566         ;;
19567 esac
19568 : check explicit looping only if NULL did not work, and if the pipe
19569 : bug does not show up on an explicit flush too
19570 case "$fflushNULL" in
19571 "$undef")
19572         $cat >tryp.c <<EOCP
19573 #include <stdio.h>
19574 int
19575 main(int argc, char **argv)
19576 {
19577     char buf[1024];
19578     int i;
19579     char *bp = buf;
19580     while (1) {
19581         while ((i = getc(stdin)) != -1
19582                && (*bp++ = i) != '\n'
19583                && bp < &buf[1024])
19584         /* DO NOTHING */ ;
19585         *bp = '\0';
19586         fprintf(stdout, "%s", buf);
19587         fflush(stdin);
19588         if (i == -1)
19589             return 0;
19590         bp = buf;
19591     }
19592 }
19593 EOCP
19594         set tryp
19595         if eval $compile; then
19596             $rm -f tryp.out
19597             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19598             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19599                $cat >&4 <<EOM
19600 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19601 EOM
19602                 : now check for fflushall behaviour
19603                 case "$fflushall" in
19604                 '')     set try -DTRY_FFLUSH_ALL $output
19605                         if eval $compile; then
19606                                 $cat >&4 <<EOM
19607 (Now testing the other method--but note that this also may fail.)
19608 EOM
19609                                 $run ./try 2>/dev/null
19610                                 code=$?
19611                                 $from try.out
19612                                 if $test -s try.out -a "X$code" = X42; then
19613                                         fflushall="`$cat try.out`"
19614                                 fi
19615                         fi
19616                         $rm_try
19617                         case "$fflushall" in
19618                         x)      $cat >&4 <<EOM
19619 Whew. Flushing explicitly all the stdio streams works.
19620 EOM
19621                                 fflushall="$define"
19622                                 ;;
19623                         '')     $cat >&4 <<EOM
19624 Sigh. Flushing explicitly all the stdio streams doesn't work.
19625 EOM
19626                                 fflushall="$undef"
19627                                 ;;
19628                         *)      $cat >&4 <<EOM
19629 Cannot figure out whether flushing stdio streams explicitly works or not.
19630 I'm assuming it doesn't.
19631 EOM
19632                                 fflushall="$undef"
19633                                 ;;
19634                         esac
19635                         ;;
19636                 "$define"|true|[yY]*)
19637                         fflushall="$define"
19638                         ;;
19639                 *)
19640                         fflushall="$undef"
19641                         ;;
19642                 esac
19643             else
19644                 $cat >&4 <<EOM
19645 All is futile.  Even fflush(stdin) clobbers input pipes!
19646 EOM
19647                 fflushall="$undef"
19648             fi
19649         else
19650             fflushall="$undef"
19651         fi
19652         $rm -f core tryp.c tryp.core core.tryp.*
19653         ;;
19654 *)      fflushall="$undef"
19655         ;;
19656 esac
19657
19658 case "$fflushNULL$fflushall" in
19659 undefundef)
19660         $cat <<EOM
19661 OK, I give up.  I cannot figure out how to flush pending stdio output.
19662 We won't be flushing handles at all before fork/exec/popen.
19663 EOM
19664         ;;
19665 esac
19666 $rm_try tryp
19667
19668 : Store the full pathname to the ar program for use in the C program
19669 : Respect a hint or command line value for full_ar.
19670 case "$full_ar" in
19671 '') full_ar=$ar ;;
19672 esac
19673
19674 : Store the full pathname to the sed program for use in the C program
19675 full_sed=$sed
19676
19677 : see what type gids are declared as in the kernel
19678 echo " "
19679 echo "Looking for the type for group ids returned by getgid()."
19680 set gid_t gidtype xxx stdio.h sys/types.h
19681 eval $typedef
19682 case "$gidtype" in
19683 xxx)
19684         xxx=`./findhdr sys/user.h`
19685         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19686         case $1 in
19687         unsigned) dflt="$1 $2" ;;
19688         *) dflt="$1" ;;
19689         esac
19690         ;;
19691 *) dflt="$gidtype";;
19692 esac
19693 case "$gidtype" in
19694 gid_t) echo "gid_t found." ;;
19695 *)      rp="What is the type for group ids returned by getgid()?"
19696         . ./myread
19697         gidtype="$ans"
19698         ;;
19699 esac
19700
19701 : Check the size of GID
19702 echo " "
19703 case "$gidtype" in
19704 *_t) zzz="$gidtype"     ;;
19705 *)   zzz="gid"          ;;
19706 esac
19707 echo "Checking the size of $zzz..." >&4
19708 cat > try.c <<EOCP
19709 #include <sys/types.h>
19710 #include <stdio.h>
19711 #$i_stdlib I_STDLIB
19712 #ifdef I_STDLIB
19713 #include <stdlib.h>
19714 #endif
19715 int main() {
19716     printf("%d\n", (int)sizeof($gidtype));
19717     exit(0);
19718 }
19719 EOCP
19720 set try
19721 if eval $compile_ok; then
19722         yyy=`$run ./try`
19723         case "$yyy" in
19724         '')     gidsize=4
19725                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19726                 ;;
19727         *)      gidsize=$yyy
19728                 echo "Your $zzz is $gidsize bytes long."
19729                 ;;
19730         esac
19731 else
19732         gidsize=4
19733         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19734 fi
19735
19736
19737 : Check if GID is signed
19738 echo " "
19739 case "$gidtype" in
19740 *_t) zzz="$gidtype"     ;;
19741 *)   zzz="gid"          ;;
19742 esac
19743 echo "Checking the sign of $zzz..." >&4
19744 cat > try.c <<EOCP
19745 #include <sys/types.h>
19746 #include <stdio.h>
19747 int main() {
19748         $gidtype foo = -1;
19749         if (foo < 0)
19750                 printf("-1\n");
19751         else
19752                 printf("1\n");
19753 }
19754 EOCP
19755 set try
19756 if eval $compile; then
19757         yyy=`$run ./try`
19758         case "$yyy" in
19759         '')     gidsign=1
19760                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19761                 ;;
19762         *)      gidsign=$yyy
19763                 case "$gidsign" in
19764                  1) echo "Your $zzz is unsigned." ;;
19765                 -1) echo "Your $zzz is signed."   ;;
19766                 esac
19767                 ;;
19768         esac
19769 else
19770         gidsign=1
19771         echo "(I can't compile the test program--guessing unsigned.)" >&4
19772 fi
19773
19774
19775 : Check 64bit sizes
19776 echo " "
19777
19778 if $test X"$quadtype" != X; then
19779
19780 echo "Checking how to print 64-bit integers..." >&4
19781
19782 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19783         $cat >try.c <<'EOCP'
19784 #include <sys/types.h>
19785 #include <stdio.h>
19786 int main() {
19787   int q = 12345678901;
19788   printf("%ld\n", q);
19789 }
19790 EOCP
19791         set try
19792         if eval $compile; then
19793                 yyy=`$run ./try`
19794                 case "$yyy" in
19795                 12345678901)
19796                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19797                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19798                         echo "We will use %d."
19799                         ;;
19800                 esac
19801         fi
19802 fi
19803
19804 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19805         $cat >try.c <<'EOCP'
19806 #include <sys/types.h>
19807 #include <stdio.h>
19808 int main() {
19809   long q = 12345678901;
19810   printf("%ld\n", q);
19811 }
19812 EOCP
19813         set try
19814         if eval $compile; then
19815                 yyy=`$run ./try`
19816                 case "$yyy" in
19817                 12345678901)
19818                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19819                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19820                         echo "We will use %ld."
19821                         ;;
19822                 esac
19823         fi
19824 fi
19825
19826 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19827         $cat >try.c <<'EOCP'
19828 #include <sys/types.h>
19829 #include <inttypes.h>
19830 #include <stdio.h>
19831 int main() {
19832   int64_t q = 12345678901;
19833   printf("%" PRId64 "\n", q);
19834 }
19835 EOCP
19836         set try
19837         if eval $compile; then
19838                 yyy=`$run ./try`
19839                 case "$yyy" in
19840                 12345678901)
19841                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19842                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19843                         echo "We will use the C9X style."
19844                         ;;
19845                 esac
19846         fi
19847 fi
19848
19849 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19850         $cat >try.c <<EOCP
19851 #include <sys/types.h>
19852 #include <stdio.h>
19853 int main() {
19854   $quadtype q = 12345678901;
19855   printf("%Ld\n", q);
19856 }
19857 EOCP
19858         set try
19859         if eval $compile; then
19860                 yyy=`$run ./try`
19861                 case "$yyy" in
19862                 12345678901)
19863                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19864                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19865                         echo "We will use %Ld."
19866                         ;;
19867                 esac
19868         fi
19869 fi
19870
19871 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19872         $cat >try.c <<'EOCP'
19873 #include <sys/types.h>
19874 #include <stdio.h>
19875 int main() {
19876   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19877   printf("%lld\n", q);
19878 }
19879 EOCP
19880         set try
19881         if eval $compile; then
19882                 yyy=`$run ./try`
19883                 case "$yyy" in
19884                 12345678901)
19885                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19886                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19887                         echo "We will use the %lld style."
19888                         ;;
19889                 esac
19890         fi
19891 fi
19892
19893 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19894         $cat >try.c <<EOCP
19895 #include <sys/types.h>
19896 #include <stdio.h>
19897 int main() {
19898   $quadtype q = 12345678901;
19899   printf("%qd\n", q);
19900 }
19901 EOCP
19902         set try
19903         if eval $compile; then
19904                 yyy=`$run ./try`
19905                 case "$yyy" in
19906                 12345678901)
19907                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19908                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19909                         echo "We will use %qd."
19910                         ;;
19911                 esac
19912         fi
19913 fi
19914
19915 if $test X"$sPRId64" = X; then
19916         echo "Cannot figure out how to print 64-bit integers." >&4
19917 fi
19918 $rm_try
19919
19920 fi
19921
19922 case "$sPRId64" in
19923 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19924         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19925         ;;
19926 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19927         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19928         ;;
19929 esac
19930
19931 : Check format strings for internal types
19932 echo " "
19933 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19934
19935 if $test X"$ivsize" = X8; then
19936         ivdformat="$sPRId64"
19937         uvuformat="$sPRIu64"
19938         uvoformat="$sPRIo64"
19939         uvxformat="$sPRIx64"
19940         uvXUformat="$sPRIXU64"
19941 else
19942         if $test X"$ivsize" = X"$longsize"; then
19943                 ivdformat='"ld"'
19944                 uvuformat='"lu"'
19945                 uvoformat='"lo"'
19946                 uvxformat='"lx"'
19947                 uvXUformat='"lX"'
19948         else
19949                 if $test X"$ivsize" = X"$intsize"; then
19950                         ivdformat='"d"'
19951                         uvuformat='"u"'
19952                         uvoformat='"o"'
19953                         uvxformat='"x"'
19954                         uvXUformat='"X"'
19955                 else
19956                         : far out
19957                         if $test X"$ivsize" = X"$shortsize"; then
19958                                 ivdformat='"hd"'
19959                                 uvuformat='"hu"'
19960                                 uvoformat='"ho"'
19961                                 uvxformat='"hx"'
19962                                 uvXUformat='"hX"'
19963                         fi
19964                 fi
19965         fi
19966 fi
19967
19968 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19969         nveformat="$sPRIeldbl"
19970         nvfformat="$sPRIfldbl"
19971         nvgformat="$sPRIgldbl"
19972         nvEUformat="$sPRIEUldbl"
19973         nvFUformat="$sPRIFUldbl"
19974         nvGUformat="$sPRIGUldbl"
19975 else
19976         nveformat='"e"'
19977         nvfformat='"f"'
19978         nvgformat='"g"'
19979         nvEUformat='"E"'
19980         nvFUformat='"F"'
19981         nvGUformat='"G"'
19982 fi
19983
19984 case "$ivdformat" in
19985 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19986     exit 1
19987     ;;
19988 esac
19989
19990 : Check format string for GID
19991
19992 echo " "
19993 $echo "Checking the format string to be used for gids..." >&4
19994
19995 case "$gidsign" in
19996 -1)     if $test X"$gidsize" = X"$ivsize"; then
19997                 gidformat="$ivdformat"
19998         else
19999                 if $test X"$gidsize" = X"$longsize"; then
20000                         gidformat='"ld"'
20001                 else
20002                         if $test X"$gidsize" = X"$intsize"; then
20003                                 gidformat='"d"'
20004                         else
20005                                 if $test X"$gidsize" = X"$shortsize"; then
20006                                         gidformat='"hd"'
20007                                 fi
20008                         fi
20009                 fi
20010         fi
20011         ;;
20012 *)      if $test X"$gidsize" = X"$uvsize"; then
20013                 gidformat="$uvuformat"
20014         else
20015                 if $test X"$gidsize" = X"$longsize"; then
20016                         gidformat='"lu"'
20017                 else
20018                         if $test X"$gidsize" = X"$intsize"; then
20019                                 gidformat='"u"'
20020                         else
20021                                 if $test X"$gidsize" = X"$shortsize"; then
20022                                         gidformat='"hu"'
20023                                 fi
20024                         fi
20025                 fi
20026         fi
20027         ;;
20028 esac
20029
20030 : see if getgroups exists
20031 set getgroups d_getgrps
20032 eval $inlibc
20033
20034 : see if setgroups exists
20035 set setgroups d_setgrps
20036 eval $inlibc
20037
20038 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20039 echo " "
20040 case "$d_getgrps$d_setgrps" in
20041 *define*)
20042         case "$groupstype" in
20043         '') dflt="$gidtype" ;;
20044         *)  dflt="$groupstype" ;;
20045         esac
20046         $cat <<EOM
20047 What type of pointer is the second argument to getgroups() and setgroups()?
20048 Usually this is the same as group ids, $gidtype, but not always.
20049
20050 EOM
20051         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20052         . ./myread
20053         groupstype="$ans"
20054         ;;
20055 *)  groupstype="$gidtype";;
20056 esac
20057
20058 : MAD = Misc Attribute Definition
20059
20060 if $test $patchlevel -lt 9; then
20061 : MAD is not available in 5.8.x or earlier.
20062     ans=n;
20063 else
20064     case "$mad" in
20065     $define|true|[yY]*) dflt='y' ;;
20066     *)                  dflt='n' ;;
20067     esac
20068     cat <<EOM
20069
20070 Would you like to build with Misc Attribute Decoration? This is development
20071 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20072 overhead on the interpreter.
20073
20074 If this doesn't make any sense to you, just accept the default '$dflt'.
20075 EOM
20076     rp='Build Perl with MAD?'
20077     . ./myread
20078 fi
20079 case "$ans" in
20080 y|Y)    val="$define"
20081         madlyh='madly.h madly.act madly.tab'
20082         madlysrc='madly.c'
20083         madlyobj="madly$_o" ;;
20084 *)      val="$undef"
20085         madlyh=''
20086         madlysrc=''
20087         madlyobj='' ;;
20088 esac
20089 set mad
20090 eval $setvar
20091
20092 : check whether make sets MAKE
20093 echo " "
20094 echo "Checking if your $make program sets \$(MAKE)..." >&4
20095 case "$make_set_make" in
20096 '')
20097         $sed 's/^X //' > testmake.mak << 'EOF'
20098 Xall:
20099 X       @echo 'maketemp="$(MAKE)"'
20100 EOF
20101         case "`$make -f testmake.mak 2>/dev/null`" in
20102         *maketemp=*) make_set_make='#' ;;
20103         *)      make_set_make="MAKE=$make" ;;
20104         esac
20105         $rm -f testmake.mak
20106         ;;
20107 esac
20108 case "$make_set_make" in
20109 '#') echo "Yup, it does.";;
20110 *) echo "Nope, it doesn't.";;
20111 esac
20112
20113 : see what type is used for mode_t
20114 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20115 set mode_t modetype int stdio.h sys/types.h
20116 eval $typedef_ask
20117
20118 : see if we need va_copy
20119 echo " "
20120 case "$i_stdarg" in
20121 "$define")
20122         $cat >try.c <<EOCP
20123 #include <stdarg.h>
20124 #include <stdio.h>
20125 #$i_stdlib I_STDLIB
20126 #ifdef I_STDLIB
20127 #include <stdlib.h>
20128 #endif
20129 #include <signal.h>
20130
20131 int
20132 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20133 {
20134   return vfprintf(f, fmt, *valp);
20135 }
20136
20137 int
20138 myvfprintf(FILE *f, const  char *fmt, va_list val)
20139 {
20140   return ivfprintf(f, fmt, &val);
20141 }
20142
20143 int
20144 myprintf(char *fmt, ...)
20145 {
20146   va_list val;
20147   va_start(val, fmt);
20148   return myvfprintf(stdout, fmt, val);
20149 }
20150
20151 int
20152 main(int ac, char **av)
20153 {
20154   signal(SIGSEGV, exit);
20155
20156   myprintf("%s%cs all right, then\n", "that", '\'');
20157   exit(0);
20158 }
20159 EOCP
20160         set try
20161         if eval $compile && $run ./try 2>&1 >/dev/null; then
20162                 case "`$run ./try`" in
20163                 "that's all right, then")
20164                         okay=yes
20165                         ;;
20166                 esac
20167         fi
20168         case "$okay" in
20169         yes)    echo "It seems that you don't need va_copy()." >&4
20170                 need_va_copy="$undef"
20171                 ;;
20172         *)      echo "It seems that va_copy() or similar will be needed." >&4
20173                 need_va_copy="$define"
20174                 ;;
20175         esac
20176         $rm_try
20177         ;;
20178 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20179         ;;
20180 esac
20181
20182 : see what type is used for size_t
20183 rp="What is the type used for the length parameter for string functions?"
20184 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20185 eval $typedef_ask
20186
20187 : check for type of arguments to gethostbyaddr. 
20188 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20189         case "$d_gethbyaddr" in
20190         $define)
20191                 $cat <<EOM
20192
20193 Checking to see what type of arguments are accepted by gethostbyaddr().
20194 EOM
20195                 hdrs="$define sys/types.h
20196                         $d_socket sys/socket.h 
20197                         $i_niin netinet/in.h 
20198                         $i_netdb netdb.h
20199                         $i_unistd unistd.h"
20200                 : The first arg can 'char *' or 'void *'
20201                 : The second arg is some of integral type
20202                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20203                         for yyy in size_t long int; do
20204                                 case "$netdb_host_type" in
20205                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20206                                         if ./protochk "$try" $hdrs; then
20207                                                 echo "Your system accepts $xxx for the first arg."
20208                                                 echo "...and $yyy for the second arg."
20209                                                 netdb_host_type="$xxx"
20210                                                 netdb_hlen_type="$yyy"
20211                                         fi
20212                                         ;;
20213                                 esac
20214                         done
20215                 done
20216                 : In case none of those worked, prompt the user.
20217                 case "$netdb_host_type" in
20218                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20219                         dflt='char *'
20220                         . ./myread
20221                         netdb_host_type=$ans
20222                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20223                         dflt="$sizetype"
20224                         . ./myread
20225                         netdb_hlen_type=$ans
20226                         ;;
20227                 esac
20228                 ;;
20229         *)      : no gethostbyaddr, so pick harmless defaults
20230                 netdb_host_type='char *'
20231                 netdb_hlen_type="$sizetype"
20232                 ;;
20233         esac
20234         # Remove the "const" if needed. -- but then we'll have a 
20235         # prototype clash!
20236         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20237 fi
20238
20239 : check for type of argument to gethostbyname. 
20240 if test "X$netdb_name_type" = X ; then
20241         case "$d_gethbyname" in
20242         $define)
20243                 $cat <<EOM
20244
20245 Checking to see what type of argument is accepted by gethostbyname().
20246 EOM
20247                 hdrs="$define sys/types.h
20248                         $d_socket sys/socket.h 
20249                         $i_niin netinet/in.h 
20250                         $i_netdb netdb.h
20251                         $i_unistd unistd.h"
20252                 for xxx in "const char *" "char *"; do
20253                         case "$netdb_name_type" in
20254                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20255                                 if ./protochk "$try" $hdrs; then
20256                                         echo "Your system accepts $xxx."
20257                                         netdb_name_type="$xxx"
20258                                 fi
20259                                 ;;
20260                         esac
20261                 done
20262                 : In case none of those worked, prompt the user.
20263                 case "$netdb_name_type" in
20264                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20265                         dflt='char *'
20266                         . ./myread
20267                         netdb_name_type=$ans
20268                         ;;
20269                 esac
20270                 ;;
20271         *)      : no gethostbyname, so pick harmless default
20272                 netdb_name_type='char *'
20273                 ;;
20274         esac
20275 fi
20276
20277 : check for type of 1st argument to getnetbyaddr. 
20278 if test "X$netdb_net_type" = X ; then
20279         case "$d_getnbyaddr" in
20280         $define)
20281                 $cat <<EOM
20282
20283 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20284 EOM
20285                 hdrs="$define sys/types.h
20286                         $d_socket sys/socket.h 
20287                         $i_niin netinet/in.h 
20288                         $i_netdb netdb.h
20289                         $i_unistd unistd.h"
20290                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20291                         case "$netdb_net_type" in
20292                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20293                                 if ./protochk "$try" $hdrs; then
20294                                         echo "Your system accepts $xxx."
20295                                         netdb_net_type="$xxx"
20296                                 fi
20297                                 ;;
20298                         esac
20299                 done
20300                 : In case none of those worked, prompt the user.
20301                 case "$netdb_net_type" in
20302                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20303                         dflt='long'
20304                         . ./myread
20305                         netdb_net_type=$ans
20306                         ;;
20307                 esac
20308                 ;;
20309         *)      : no getnetbyaddr, so pick harmless default
20310                 netdb_net_type='long'
20311                 ;;
20312         esac
20313 fi
20314 : locate the preferred pager for this system
20315 fn=f/
20316 case "$pager" in
20317 '')
20318         dflt=''
20319         case "$pg" in
20320         /*) dflt=$pg;;
20321         [a-zA-Z]:/*) dflt=$pg;;
20322         esac
20323         case "$more" in
20324         /*) dflt=$more;;
20325         [a-zA-Z]:/*) dflt=$more;;
20326         esac
20327         case "$less" in
20328         /*) dflt=$less;;
20329         [a-zA-Z]:/*) dflt=$less;;
20330         esac
20331         case "$dflt" in
20332         '') dflt=/usr/ucb/more;;
20333         esac
20334         ;;
20335 *)      dflt="$pager"
20336         fn="f/($pager)"
20337         ;;
20338 esac
20339 echo " "
20340 rp='What pager is used on your system?'
20341 . ./getfile
20342 pager="$ans"
20343
20344 : see what type pids are declared as in the kernel
20345 rp="What is the type of process ids on this system?"
20346 set pid_t pidtype int stdio.h sys/types.h
20347 eval $typedef_ask
20348
20349 : see if ar generates random libraries by itself
20350 echo " "
20351 echo "Checking how to generate random libraries on your machine..." >&4
20352 echo 'int bar1() { return bar2(); }' > bar1.c
20353 echo 'int bar2() { return 2; }' > bar2.c
20354 $cat > foo.c <<EOP
20355 #$i_stdlib I_STDLIB
20356 #ifdef I_STDLIB
20357 #include <stdlib.h>
20358 #endif
20359 int main() { printf("%d\n", bar1()); exit(0); }
20360 EOP
20361 $cc $ccflags -c bar1.c >/dev/null 2>&1
20362 $cc $ccflags -c bar2.c >/dev/null 2>&1
20363 $cc $ccflags -c foo.c >/dev/null 2>&1
20364 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20365 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20366         $run ./foobar >/dev/null 2>&1; then
20367         echo "$ar appears to generate random libraries itself."
20368         orderlib=false
20369         if [ "X$ranlib" = "X" ]; then
20370             ranlib=":"
20371         fi
20372 elif $ar s bar$_a >/dev/null 2>&1 &&
20373         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20374         $run ./foobar >/dev/null 2>&1; then
20375                 echo "a table of contents needs to be added with '$ar s'."
20376                 orderlib=false
20377                 ranlib="$ar s"
20378 elif $ar ts bar$_a >/dev/null 2>&1 &&
20379         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20380         $run ./foobar >/dev/null 2>&1; then
20381                 echo "a table of contents needs to be added with '$ar ts'."
20382                 orderlib=false
20383                 ranlib="$ar ts"
20384 else
20385         case "$ranlib" in
20386         :) ranlib='';;
20387         '')
20388                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20389                 $test -f $ranlib || ranlib=''
20390                 ;;
20391         esac
20392         if $test -n "$ranlib"; then
20393                 echo "your system has '$ranlib'; we'll use that."
20394                 orderlib=false
20395         else
20396                 echo "your system doesn't seem to support random libraries"
20397                 echo "so we'll use lorder and tsort to order the libraries."
20398                 orderlib=true
20399                 ranlib=":"
20400         fi
20401 fi
20402 $rm -f foo* bar*
20403
20404 : see if this is a values.h system
20405 set values.h i_values
20406 eval $inhdr
20407
20408 : Check the max offset that gmtime and localtime accept
20409 echo "Checking max offsets that gmtime () accepts"
20410
20411 case $i_values in
20412     define) yyy="#include <values.h>" ;;
20413     *)      yyy="" ;;
20414     esac
20415
20416 case "$sGMTIME_min/$sGMTIME_max" in
20417     0/0|/)
20418         $cat >try.c <<EOCP
20419 #include <sys/types.h>
20420 #include <stdio.h>
20421 #include <time.h>
20422 $yyy
20423
20424 int i;
20425 struct tm *tmp;
20426 time_t pt;
20427
20428 void gm_check (time_t t, int min_year, int max_year)
20429 {
20430     tmp = gmtime (&t);
20431     if ( tmp == NULL ||
20432         /* Check tm_year overflow */
20433          tmp->tm_year < min_year || tmp->tm_year > max_year)
20434         tmp = NULL;
20435     else
20436         pt = t;
20437     } /* gm_check */
20438
20439 int check_max ()
20440 {
20441     tmp = NULL;
20442     pt  = 0;
20443 #ifdef MAXLONG
20444     gm_check (MAXLONG, 69, 0x7fffffff);
20445 #endif
20446     if (tmp == NULL || tmp->tm_year < 0) {
20447         for (i = 63; i >= 0; i--) {
20448             time_t x = pt | ((time_t)1 << i);
20449             if (x < 0 || x < pt) continue;
20450             gm_check (x, 69, 0x7fffffff);
20451             }
20452         }
20453     printf ("sGMTIME_max=%ld\n", pt);
20454     return (0);
20455     } /* check_max */
20456
20457 int check_min ()
20458 {
20459     tmp = NULL;
20460     pt  = 0;
20461 #ifdef MINLONG
20462     gm_check (MINLONG, -1900, 70);
20463 #endif
20464     if (tmp == NULL) {
20465         for (i = 36; i >= 0; i--) {
20466             time_t x = pt - ((time_t)1 << i);
20467             if (x > 0) continue;
20468             gm_check (x, -1900, 70);
20469             }
20470         }
20471     printf ("sGMTIME_min=%ld\n", pt);
20472     return (0);
20473     } /* check_min */
20474
20475 int main (int argc, char *argv[])
20476 {
20477     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20478     check_max ();
20479     check_min ();
20480     return (0);
20481     } /* main */
20482 EOCP
20483         set try
20484         if eval $compile; then
20485             eval `$run ./try`
20486         else
20487             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20488             fi
20489         $rm_try
20490         ;;
20491     esac
20492
20493 echo "Checking max offsets that localtime () accepts"
20494
20495 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20496     0/0|/)
20497         $cat >try.c <<EOCP
20498 #include <sys/types.h>
20499 #include <stdio.h>
20500 #include <time.h>
20501 $yyy
20502
20503 int i;
20504 struct tm *tmp;
20505 time_t pt;
20506
20507 void local_check (time_t t, int min_year, int max_year)
20508 {
20509     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20510         tmp = NULL;
20511     else
20512         tmp = localtime (&t);
20513     if ( tmp == NULL ||
20514         /* Check tm_year overflow */
20515          tmp->tm_year < min_year || tmp->tm_year > max_year)
20516         tmp = NULL;
20517     else
20518         pt = t;
20519     } /* local_check */
20520
20521 int check_max ()
20522 {
20523     tmp = NULL;
20524     pt  = 0;
20525 #ifdef MAXLONG
20526     local_check (MAXLONG, 69, 0x7fffffff);
20527 #endif
20528     if (tmp == NULL || tmp->tm_year < 0) {
20529         for (i = 63; i >= 0; i--) {
20530             time_t x = pt | ((time_t)1 << i);
20531             if (x < 0 || x < pt) continue;
20532             local_check (x, 69, 0x7fffffff);
20533             }
20534         }
20535     printf ("sLOCALTIME_max=%ld\n", pt);
20536     return (0);
20537    } /* check_max */
20538
20539 int check_min ()
20540 {
20541     tmp = NULL;
20542     pt  = 0;
20543 #ifdef MINLONG
20544     local_check (MINLONG, -1900, 70);
20545 #endif
20546     if (tmp == NULL) {
20547         for (i = 36; i >= 0; i--) {
20548             time_t x = pt - ((time_t)1 << i);
20549             if (x > 0) continue;
20550             local_check (x, -1900, 70);
20551             }
20552         }
20553     printf ("sLOCALTIME_min=%ld\n", pt);
20554     return (0);
20555     } /* check_min */
20556
20557 int main (int argc, char *argv[])
20558 {
20559     check_max ();
20560     check_min ();
20561     return (0);
20562     } /* main */
20563 EOCP
20564         set try
20565         if eval $compile; then
20566             eval `$run ./try`
20567         else
20568             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20569             fi
20570         $rm_try
20571         ;;
20572     esac
20573
20574 : check for type of arguments to select.
20575 case "$selecttype" in
20576 '') case "$d_select" in
20577         $define)
20578                 echo " "
20579                 $cat <<EOM
20580 Checking to see what type of arguments are accepted by select().
20581 EOM
20582                 hdrs="$define sys/types.h
20583                         $i_systime sys/time.h
20584                         $i_sysselct sys/select.h
20585                         $d_socket sys/socket.h"
20586                 : The first arg can be int, unsigned, or size_t
20587                 : The last arg may or may not be 'const'
20588                 val=''
20589                 : void pointer has been seen but using that
20590                 : breaks the selectminbits test
20591                 for xxx in 'fd_set *' 'int *'; do
20592                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20593                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20594                                         case "$val" in
20595                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20596                                                 if ./protochk "$try" $hdrs; then
20597                                                         echo "Your system accepts $xxx."
20598                                                         val="$xxx"
20599                                                 fi
20600                                                 ;;
20601                                         esac
20602                                 done
20603                         done
20604                 done
20605                 case "$val" in
20606                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20607                         case "$d_fd_set" in
20608                                 $define) dflt="fd_set *" ;;
20609                                 *)              dflt="int *" ;;
20610                         esac
20611                         . ./myread
20612                         val=$ans
20613                         ;;
20614                 esac
20615                 selecttype="$val"
20616                 ;;
20617         *)      : no select, so pick a harmless default
20618                 selecttype='int *'
20619                 ;;
20620         esac
20621         ;;
20622 esac
20623
20624 : check for the select 'width'
20625 case "$selectminbits" in
20626 '') safebits=`expr $ptrsize \* 8`
20627     case "$d_select" in
20628         $define)
20629                 $cat <<EOM
20630
20631 Checking to see on how many bits at a time your select() operates...
20632 EOM
20633                 $cat >try.c <<EOCP
20634 #include <sys/types.h>
20635 #$i_time I_TIME
20636 #$i_systime I_SYS_TIME
20637 #$i_systimek I_SYS_TIME_KERNEL
20638 #ifdef I_TIME
20639 #   include <time.h>
20640 #endif
20641 #ifdef I_SYS_TIME
20642 #   ifdef I_SYS_TIME_KERNEL
20643 #       define KERNEL
20644 #   endif
20645 #   include <sys/time.h>
20646 #   ifdef I_SYS_TIME_KERNEL
20647 #       undef KERNEL
20648 #   endif
20649 #endif
20650 #$i_sysselct I_SYS_SELECT
20651 #ifdef I_SYS_SELECT
20652 #include <sys/select.h>
20653 #endif
20654 #$d_socket HAS_SOCKET
20655 #ifdef HAS_SOCKET
20656 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20657 #endif
20658 #include <stdio.h>
20659 #$i_stdlib I_STDLIB
20660 #ifdef I_STDLIB
20661 #include <stdlib.h>
20662 #endif
20663 $selecttype b;
20664 #define S sizeof(*(b))
20665 #define MINBITS 64
20666 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20667 #define NBITS  (NBYTES * 8)
20668 int main() {
20669     char *s = (char *)malloc(NBYTES);
20670     struct timeval t;
20671     int i;
20672     FILE* fp;
20673     int fd;
20674
20675     if (!s)
20676         exit(1);
20677     fclose(stdin);
20678     fp = fopen("try.c", "r");
20679     if (fp == 0)
20680       exit(2);
20681     fd = fileno(fp);
20682     if (fd < 0)
20683       exit(3);
20684     b = ($selecttype)s;
20685     for (i = 0; i < NBITS; i++)
20686         FD_SET(i, b);
20687     t.tv_sec  = 0;
20688     t.tv_usec = 0;
20689     select(fd + 1, b, 0, 0, &t);
20690     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20691     free(s);
20692     printf("%d\n", i + 1);
20693     return 0;
20694 }
20695 EOCP
20696                 set try
20697                 if eval $compile_ok; then
20698                         selectminbits=`$run ./try`
20699                         case "$selectminbits" in
20700                         '')     cat >&4 <<EOM
20701 Cannot figure out on how many bits at a time your select() operates.
20702 I'll play safe and guess it is $safebits bits.
20703 EOM
20704                                 selectminbits=$safebits
20705                                 bits="$safebits bits"
20706                                 ;;
20707                         1)      bits="1 bit" ;;
20708                         *)      bits="$selectminbits bits" ;;
20709                         esac
20710                         echo "Your select() operates on $bits at a time." >&4
20711                 else
20712                         rp='What is the minimum number of bits your select() operates on?'
20713                         case "$byteorder" in
20714                         12345678)       dflt=64 ;;
20715                         1234)           dflt=32 ;;
20716                         *)              dflt=1  ;;
20717                         esac
20718                         . ./myread
20719                         val=$ans
20720                         selectminbits="$val"
20721                 fi
20722                 $rm_try
20723                 ;;
20724         *)      : no select, so pick a harmless default
20725                 selectminbits=$safebits
20726                 ;;
20727         esac
20728         ;;
20729 esac
20730
20731 : Trace out the files included by signal.h, then look for SIGxxx names.
20732 if [ "X$fieldn" = X ]; then
20733         : Just make some guesses.  We check them later.
20734         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20735 else
20736         xxx=`echo '#include <signal.h>' |
20737         $cppstdin $cppminus $cppflags 2>/dev/null |
20738         $grep '^[       ]*#.*include' |
20739         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20740                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20741 fi
20742 xxxfiles=''
20743 for xx in $xxx /dev/null ; do
20744         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20745 done
20746 case "$xxxfiles" in
20747 '')     xxxfiles=`./findhdr signal.h` ;;
20748 esac
20749 xxx=`awk '
20750 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20751         print substr($2, 4, 20)
20752 }
20753 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20754         print substr($3, 4, 20)
20755 }' $xxxfiles`
20756 : Append some common names just in case the awk scan failed.
20757 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20758 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20759 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20760 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20761 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20762
20763 : generate a few handy files for later
20764 $cat > signal.c <<EOCP
20765 #include <sys/types.h>
20766 #include <signal.h>
20767 #$i_stdlib I_STDLIB
20768 #ifdef I_STDLIB
20769 #include <stdlib.h>
20770 #endif
20771 #include <stdio.h>
20772 int main() {
20773
20774 /* Strange style to avoid deeply-nested #if/#else/#endif */
20775 #ifndef NSIG
20776 #  ifdef _NSIG
20777 #    define NSIG (_NSIG)
20778 #  endif
20779 #endif
20780
20781 #ifndef NSIG
20782 #  ifdef SIGMAX
20783 #    define NSIG (SIGMAX+1)
20784 #  endif
20785 #endif
20786
20787 #ifndef NSIG
20788 #  ifdef SIG_MAX
20789 #    define NSIG (SIG_MAX+1)
20790 #  endif
20791 #endif
20792
20793 #ifndef NSIG
20794 #  ifdef _SIG_MAX
20795 #    define NSIG (_SIG_MAX+1)
20796 #  endif
20797 #endif
20798
20799 #ifndef NSIG
20800 #  ifdef MAXSIG
20801 #    define NSIG (MAXSIG+1)
20802 #  endif
20803 #endif
20804
20805 #ifndef NSIG
20806 #  ifdef MAX_SIG
20807 #    define NSIG (MAX_SIG+1)
20808 #  endif
20809 #endif
20810
20811 #ifndef NSIG
20812 #  ifdef SIGARRAYSIZE
20813 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20814 #  endif
20815 #endif
20816
20817 #ifndef NSIG
20818 #  ifdef _sys_nsig
20819 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20820 #  endif
20821 #endif
20822
20823 /* Default to some arbitrary number that's big enough to get most
20824    of the common signals.
20825 */
20826 #ifndef NSIG
20827 #    define NSIG 50
20828 #endif
20829
20830 printf("NSIG %d\n", NSIG);
20831
20832 #ifndef JUST_NSIG
20833
20834 EOCP
20835
20836 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20837 {
20838         printf "#ifdef SIG"; printf $1; printf "\n"
20839         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20840         printf $1; printf ");\n"
20841         printf "#endif\n"
20842 }
20843 END {
20844         printf "#endif /* JUST_NSIG */\n";
20845         printf "exit(0);\n}\n";
20846 }
20847 ' >>signal.c
20848 $cat >signal.awk <<'EOP'
20849 BEGIN { ndups = 0 }
20850 $1 ~ /^NSIG$/ { nsig = $2 }
20851 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20852     if ($2 > maxsig) { maxsig = $2 }
20853     if (sig_name[$2]) {
20854         dup_name[ndups] = $1
20855         dup_num[ndups] = $2
20856         ndups++
20857     }
20858     else {
20859         sig_name[$2] = $1
20860         sig_num[$2] = $2
20861     }
20862 }
20863 END {
20864     if (nsig == 0) {
20865         nsig = maxsig + 1
20866     }
20867     printf("NSIG %d\n", nsig);
20868     for (n = 1; n < nsig; n++) {
20869         if (sig_name[n]) {
20870             printf("%s %d\n", sig_name[n], sig_num[n])
20871         }
20872         else {
20873             printf("NUM%d %d\n", n, n)
20874         }
20875     }
20876     for (n = 0; n < ndups; n++) {
20877         printf("%s %d\n", dup_name[n], dup_num[n])
20878     }
20879 }
20880 EOP
20881 $cat >signal_cmd <<EOS
20882 $startsh
20883 if $test -s signal.lst; then
20884     echo "Using your existing signal.lst file"
20885         exit 0
20886 fi
20887 xxx="$xxx"
20888 EOS
20889 $cat >>signal_cmd <<'EOS'
20890
20891 set signal
20892 if eval $compile_ok; then
20893         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20894                 $uniq | $awk -f signal.awk >signal.lst
20895 else
20896         echo "(I can't seem be able to compile the whole test program)" >&4
20897         echo "(I'll try it in little pieces.)" >&4
20898         set signal -DJUST_NSIG
20899         if eval $compile_ok; then
20900                 $run ./signal$_exe > signal.nsg
20901                 $cat signal.nsg
20902         else
20903                 echo "I can't seem to figure out how many signals you have." >&4
20904                 echo "Guessing 50." >&4
20905                 echo 'NSIG 50' > signal.nsg
20906         fi
20907         : Now look at all the signal names, one at a time.
20908         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20909                 $cat > signal.c <<EOCP
20910 #include <sys/types.h>
20911 #include <signal.h>
20912 #include <stdio.h>
20913 int main() {
20914 printf("$xx %d\n", SIG${xx});
20915 return 0;
20916 }
20917 EOCP
20918                 set signal
20919                 if eval $compile; then
20920                         echo "SIG${xx} found."
20921                         $run ./signal$_exe  >> signal.ls1
20922                 else
20923                         echo "SIG${xx} NOT found."
20924                 fi
20925         done
20926         if $test -s signal.ls1; then
20927                 $cat signal.nsg signal.ls1 |
20928                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20929         fi
20930
20931 fi
20932 if $test -s signal.lst; then
20933         :
20934 else
20935         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20936         echo 'kill -l' >signal
20937         set X `csh -f <signal`
20938         $rm -f signal
20939         shift
20940         case $# in
20941         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20942         esac
20943         echo $@ | $tr ' ' $trnl | \
20944             $awk '{ printf "%s %d\n", $1, ++s; }
20945                   END { printf "NSIG %d\n", ++s }' >signal.lst
20946 fi
20947 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20948 EOS
20949 chmod a+x signal_cmd
20950 $eunicefix signal_cmd
20951
20952 : generate list of signal names
20953 echo " "
20954 case "$sig_name_init" in
20955 '') doinit=yes ;;
20956 *)  case "$sig_num_init" in
20957     ''|*,*) doinit=yes ;;
20958     esac ;;
20959 esac
20960 case "$doinit" in
20961 yes)
20962         echo "Generating a list of signal names and numbers..." >&4
20963         . ./signal_cmd
20964         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20965         sig_name=`$awk 'BEGIN { printf "ZERO " }
20966                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20967         sig_num=`$awk  'BEGIN { printf "0 " }
20968                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20969         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20970                              !/^NSIG/   { printf "\"%s\", ", $1 }
20971                              END        { printf "0\n" }' signal.lst`
20972         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20973                              !/^NSIG/   { printf "%d, ", $2}
20974                              END        { printf "0\n"}' signal.lst`
20975         ;;
20976 esac
20977 echo "The following $sig_count signals are available:"
20978 echo " "
20979 echo $sig_name | $awk \
20980 'BEGIN { linelen = 0 }
20981 {
20982         for (i = 1; i <= NF; i++) {
20983                 name = "SIG" $i " "
20984                 linelen = linelen + length(name)
20985                 if (linelen > 70) {
20986                         printf "\n"
20987                         linelen = length(name)
20988                 }
20989                 printf "%s", name
20990         }
20991         printf "\n"
20992 }'
20993 sig_size=`echo $sig_name | awk '{print NF}'`
20994 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20995
20996 : Check size of size
20997 echo " "
20998 case "$sizetype" in
20999 *_t) zzz="$sizetype"    ;;
21000 *)   zzz="filesize"     ;;
21001 esac
21002 echo "Checking the size of $zzz..." >&4
21003 cat > try.c <<EOCP
21004 #include <sys/types.h>
21005 #include <stdio.h>
21006 #$i_stdlib I_STDLIB
21007 #ifdef I_STDLIB
21008 #include <stdlib.h>
21009 #endif
21010 int main() {
21011     printf("%d\n", (int)sizeof($sizetype));
21012     exit(0);
21013 }
21014 EOCP
21015 set try
21016 if eval $compile_ok; then
21017         yyy=`$run ./try`
21018         case "$yyy" in
21019         '')     sizesize=4
21020                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21021                 ;;
21022         *)      sizesize=$yyy
21023                 echo "Your $zzz size is $sizesize bytes."
21024                 ;;
21025         esac
21026 else
21027         sizesize=4
21028         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21029 fi
21030
21031
21032 : check for socklen_t
21033 echo " "
21034 echo "Checking to see if you have socklen_t..." >&4
21035 $cat >try.c <<EOCP
21036 #include <sys/types.h>
21037 #$d_socket HAS_SOCKET
21038 #ifdef HAS_SOCKET
21039 #include <sys/socket.h>
21040 #endif
21041 int main() { socklen_t x = 16; }
21042 EOCP
21043 set try
21044 if eval $compile; then
21045         val="$define"
21046         echo "You have socklen_t."
21047 else
21048         val="$undef"
21049         echo "You do not have socklen_t."
21050         case "$sizetype" in
21051         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21052         esac
21053 fi
21054 $rm_try
21055 set d_socklen_t
21056 eval $setvar
21057
21058 : see if this is a socks.h system
21059 set socks.h i_socks
21060 eval $inhdr
21061
21062 : check for type of the size argument to socket calls
21063 case "$d_socket" in
21064 "$define")
21065         $cat <<EOM
21066
21067 Checking to see what type is the last argument of accept().
21068 EOM
21069         yyy=''
21070         case "$d_socklen_t" in
21071         "$define") yyy="$yyy socklen_t"
21072         esac
21073         yyy="$yyy $sizetype int long unsigned"
21074         for xxx in $yyy; do
21075                 case "$socksizetype" in
21076                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21077                         case "$usesocks" in
21078                         "$define")
21079                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21080                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21081                                         socksizetype="$xxx"
21082                                 fi
21083                                 ;;
21084                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21085                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21086                                         socksizetype="$xxx"
21087                                 fi
21088                                 ;;
21089                         esac
21090                         ;;
21091                 esac
21092         done
21093 : In case none of those worked, prompt the user.
21094         case "$socksizetype" in
21095         '')     rp='What is the type for socket address structure sizes?'
21096                 dflt='int'
21097                 . ./myread
21098                 socksizetype=$ans
21099                 ;;
21100         esac
21101         ;;
21102 *)      : no sockets, so pick relatively harmless default
21103         socksizetype='int'
21104         ;;
21105 esac
21106
21107 : see what type is used for signed size_t
21108 set ssize_t ssizetype int stdio.h sys/types.h
21109 eval $typedef
21110 dflt="$ssizetype"
21111 $cat > try.c <<EOM
21112 #include <stdio.h>
21113 #$i_stdlib I_STDLIB
21114 #ifdef I_STDLIB
21115 #include <stdlib.h>
21116 #endif
21117 #include <sys/types.h>
21118 #define Size_t $sizetype
21119 #define SSize_t $dflt
21120 int main()
21121 {
21122         if (sizeof(Size_t) == sizeof(SSize_t))
21123                 printf("$dflt\n");
21124         else if (sizeof(Size_t) == sizeof(int))
21125                 printf("int\n");
21126         else
21127                 printf("long\n");
21128         exit(0);
21129 }
21130 EOM
21131 echo " "
21132 set try
21133 if eval $compile_ok && $run ./try > /dev/null; then
21134         ssizetype=`$run ./try`
21135         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21136 else
21137         $cat >&4 <<EOM
21138 Help! I can't compile and run the ssize_t test program: please enlighten me!
21139 (This is probably a misconfiguration in your system or libraries, and
21140 you really ought to fix it.  Still, I'll try anyway.)
21141
21142 I need a type that is the same size as $sizetype, but is guaranteed to
21143 be signed.  Common values are ssize_t, int and long.
21144
21145 EOM
21146         rp="What signed type is the same size as $sizetype?"
21147         . ./myread
21148         ssizetype="$ans"
21149 fi
21150 $rm_try
21151
21152 : Check the size of st_ino
21153 $echo " "
21154 $echo "Checking the size of st_ino..." >&4
21155 $cat > try.c <<EOCP
21156 #include <sys/stat.h>
21157 #include <stdio.h>
21158 #$i_stdlib I_STDLIB
21159 #ifdef I_STDLIB
21160 #include <stdlib.h>
21161 #endif
21162 int main() {
21163     struct stat st;
21164     printf("%d\n", (int)sizeof(st.st_ino));
21165     exit(0);
21166 }
21167 EOCP
21168 set try
21169 if eval $compile_ok; then
21170         val=`$run ./try`
21171         case "$val" in
21172         '')     st_ino_size=4
21173                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21174                 ;;
21175         *)      st_ino_size=$val
21176                 $echo "Your st_ino is $st_ino_size bytes long."
21177                 ;;
21178         esac
21179 else
21180         st_ino_size=4
21181         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21182 fi
21183 $rm_try
21184
21185 : Check if st_ino is signed
21186 $echo " "
21187 $echo "Checking the sign of st_ino..." >&4
21188 $cat > try.c <<EOCP
21189 #include <sys/stat.h>
21190 #include <stdio.h>
21191 int main() {
21192         struct stat foo;
21193         foo.st_ino = -1;
21194         if (foo.st_ino < 0)
21195                 printf("-1\n");
21196         else
21197                 printf("1\n");
21198 }
21199 EOCP
21200 set try
21201 if eval $compile; then
21202         val=`$run ./try`
21203         case "$val" in
21204         '')     st_ino_sign=1
21205                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21206                 ;;
21207         *)      st_ino_sign=$val
21208                 case "$st_ino_sign" in
21209                  1) $echo "Your st_ino is unsigned." ;;
21210                 -1) $echo "Your st_ino is signed."   ;;
21211                 esac
21212                 ;;
21213         esac
21214 else
21215         st_ino_sign=1
21216         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21217 fi
21218 $rm_try
21219
21220 : see what type of char stdio uses.
21221 echo " "
21222 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21223 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21224         echo "Your stdio uses unsigned chars." >&4
21225         stdchar="unsigned char"
21226 else
21227         echo "Your stdio uses signed chars." >&4
21228         stdchar="char"
21229 fi
21230 $rm -f stdioh
21231
21232 : see what type uids are declared as in the kernel
21233 echo " "
21234 echo "Looking for the type for user ids returned by getuid()."
21235 set uid_t uidtype xxx stdio.h sys/types.h
21236 eval $typedef
21237 case "$uidtype" in
21238 xxx)
21239         xxx=`./findhdr sys/user.h`
21240         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21241         case $1 in
21242         unsigned) dflt="$1 $2" ;;
21243         *) dflt="$1" ;;
21244         esac
21245         ;;
21246 *) dflt="$uidtype";;
21247 esac
21248 case "$uidtype" in
21249 uid_t)  echo "uid_t found." ;;
21250 *)      rp="What is the type for user ids returned by getuid()?"
21251         . ./myread
21252         uidtype="$ans"
21253         ;;
21254 esac
21255
21256 : Check size of UID
21257 echo " "
21258 case "$uidtype" in
21259 *_t) zzz="$uidtype"     ;;
21260 *)   zzz="uid"          ;;
21261 esac
21262 echo "Checking the size of $zzz..." >&4
21263 cat > try.c <<EOCP
21264 #include <sys/types.h>
21265 #include <stdio.h>
21266 #$i_stdlib I_STDLIB
21267 #ifdef I_STDLIB
21268 #include <stdlib.h>
21269 #endif
21270 int main() {
21271     printf("%d\n", (int)sizeof($uidtype));
21272     exit(0);
21273 }
21274 EOCP
21275 set try
21276 if eval $compile_ok; then
21277         yyy=`$run ./try`
21278         case "$yyy" in
21279         '')     uidsize=4
21280                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21281                 ;;
21282         *)      uidsize=$yyy
21283                 echo "Your $zzz is $uidsize bytes long."
21284                 ;;
21285         esac
21286 else
21287         uidsize=4
21288         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21289 fi
21290
21291 : Check if UID is signed
21292 echo " "
21293 case "$uidtype" in
21294 *_t) zzz="$uidtype"     ;;
21295 *)   zzz="uid"          ;;
21296 esac
21297 echo "Checking the sign of $zzz..." >&4
21298 cat > try.c <<EOCP
21299 #include <sys/types.h>
21300 #include <stdio.h>
21301 int main() {
21302         $uidtype foo = -1;
21303         if (foo < 0)
21304                 printf("-1\n");
21305         else
21306                 printf("1\n");
21307 }
21308 EOCP
21309 set try
21310 if eval $compile; then
21311         yyy=`$run ./try`
21312         case "$yyy" in
21313         '')     uidsign=1
21314                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21315                 ;;
21316         *)      uidsign=$yyy
21317                 case "$uidsign" in
21318                  1) echo "Your $zzz is unsigned." ;;
21319                 -1) echo "Your $zzz is signed."   ;;
21320                 esac
21321                 ;;
21322         esac
21323 else
21324         uidsign=1
21325         echo "(I can't compile the test program--guessing unsigned.)" >&4
21326 fi
21327
21328
21329 : Check format string for UID
21330 echo " "
21331 $echo "Checking the format string to be used for uids..." >&4
21332
21333 case "$uidsign" in
21334 -1)     if $test X"$uidsize" = X"$ivsize"; then
21335                 uidformat="$ivdformat"
21336         else
21337                 if $test X"$uidsize" = X"$longsize"; then
21338                         uidformat='"ld"'
21339                 else
21340                         if $test X"$uidsize" = X"$intsize"; then
21341                                 uidformat='"d"'
21342                         else
21343                                 if $test X"$uidsize" = X"$shortsize"; then
21344                                         uidformat='"hd"'
21345                                 fi
21346                         fi
21347                 fi
21348         fi
21349         ;;
21350 *)      if $test X"$uidsize" = X"$uvsize"; then
21351                 uidformat="$uvuformat"
21352         else
21353                 if $test X"$uidsize" = X"$longsize"; then
21354                         uidformat='"lu"'
21355                 else
21356                         if $test X"$uidsize" = X"$intsize"; then
21357                                 uidformat='"u"'
21358                         else
21359                                 if $test X"$uidsize" = X"$shortsize"; then
21360                                         uidformat='"hu"'
21361                                 fi
21362                         fi
21363                 fi
21364         fi
21365         ;;
21366 esac
21367
21368 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21369 echo " "
21370 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21371 $cat >try.c <<'EOM'
21372 /* Intentionally a long probe as I'd like to sanity check that the exact
21373    approach is going to work, as thinking it will work, but only having it
21374    part working at runtime is worse than not having it.  */
21375
21376 #include <sys/types.h>
21377 #include <sys/sysctl.h>
21378 #include <sys/param.h>
21379 #include <stdio.h>
21380 #include <string.h>
21381 #include <stdlib.h>
21382 #include <unistd.h>
21383
21384 int
21385 main(int argc, char **argv) {
21386     char *buffer;
21387     char *argv_leaf = strrchr(argv[0], '/');
21388     char *buffer_leaf;
21389     size_t size = 0;
21390     int mib[4];
21391
21392     mib[0] = CTL_KERN;
21393     mib[1] = KERN_PROC;
21394     mib[2] = KERN_PROC_PATHNAME;
21395     mib[3] = -1;
21396
21397     if (!argv_leaf) {
21398         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21399         return 1;
21400     }
21401
21402     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21403         perror("sysctl");
21404         return 2;
21405     }
21406
21407     if (size < strlen(argv_leaf) + 1) {
21408         fprintf(stderr, "size %lu is too short for a path\n",
21409                 (unsigned long) size);
21410         return 3;
21411     }
21412
21413     if (size > MAXPATHLEN * MAXPATHLEN) {
21414         fprintf(stderr, "size %lu is too long for a path\n",
21415                 (unsigned long) size);
21416         return 4;
21417     }
21418
21419     buffer = malloc(size);
21420     if (!buffer) {
21421         perror("malloc");
21422         return 5;
21423     }
21424
21425     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21426         perror("sysctl");
21427         return 6;
21428     }
21429
21430     if (strlen(buffer) + 1 != size) {
21431         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21432                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21433         return 7;
21434     }
21435
21436
21437     if (*buffer != '/') {
21438         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21439         return 8;
21440     }
21441
21442     if (strstr(buffer, "/./")) {
21443         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21444         return 9;
21445     }
21446
21447     if (strstr(buffer, "/../")) {
21448         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21449         return 10;
21450     }
21451
21452     buffer_leaf = strrchr(buffer, '/');
21453     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21454         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21455         return 11;
21456     }
21457
21458     free(buffer);
21459
21460     return 0;
21461 }
21462 EOM
21463
21464 val=$undef
21465 set try
21466 if eval $compile_ok; then
21467         if $run ./try; then
21468                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21469                 val="$define"
21470         else
21471                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21472                 val="$undef"
21473         fi
21474 else
21475         echo "I'm unable to compile the test program." >&4
21476         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21477         val="$undef"
21478 fi
21479 $rm_try
21480 set usekernprocpathname
21481 eval $setvar
21482
21483 : Determine if we can use _NSGetExecutablePath to find executing program
21484 echo " "
21485 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21486 $cat >try.c <<'EOM'
21487 /* Intentionally a long probe as I'd like to sanity check that the exact
21488    approach is going to work, as thinking it will work, but only having it
21489    part working at runtime is worse than not having it.  */
21490 #include <mach-o/dyld.h>
21491 #include <stdio.h>
21492 #include <stdlib.h>
21493 #include <sys/param.h>
21494 #include <string.h>
21495
21496 int
21497 main(int argc, char **argv) {
21498     char buf[1];
21499     uint32_t size = sizeof(buf);
21500     int result;
21501     char *buffer;
21502     char *tidied;
21503     char *argv_leaf = strrchr(argv[0], '/');
21504     char *tidied_leaf;
21505
21506     if (!argv_leaf) {
21507         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21508         return 1;
21509     }
21510
21511     _NSGetExecutablePath(buf, &size);
21512     if (size > MAXPATHLEN * MAXPATHLEN) {
21513         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21514                 (unsigned int) size);
21515         return 2;
21516     }
21517
21518     buffer = malloc(size);
21519     if (!buffer) {
21520         perror("malloc");
21521         return 3;
21522     }
21523
21524     result = _NSGetExecutablePath(buffer, &size);
21525     if (result != 0) {
21526         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21527                 result, (unsigned int) size);
21528         return 4;
21529     }
21530
21531     tidied = realpath(buffer, NULL);
21532     if (!tidied) {
21533         perror("realpath");
21534         return 5;
21535     }
21536
21537     free(buffer);
21538
21539     if (*tidied != '/') {
21540         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21541         return 6;
21542     }
21543
21544     if (strstr(tidied, "/./")) {
21545         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21546         return 7;
21547     }
21548
21549     if (strstr(tidied, "/../")) {
21550         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21551         return 8;
21552     }
21553
21554     tidied_leaf = strrchr(tidied, '/');
21555     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21556         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21557         return 9;
21558     }
21559
21560     free(tidied);
21561
21562     return 0;
21563 }
21564 EOM
21565
21566 val=$undef
21567 set try
21568 if eval $compile_ok; then
21569         if $run ./try; then
21570                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21571                 val="$define"
21572         else
21573                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21574         fi
21575 else
21576         echo "I'm unable to compile the test program." >&4
21577         echo "I'll assume no _NSGetExecutablePath here." >&4
21578 fi
21579 $rm_try
21580 set usensgetexecutablepath
21581 eval $setvar
21582
21583 : Check if site customization support was requested
21584 case "$usesitecustomize" in
21585     $define|true|[Yy]*)
21586         usesitecustomize="$define"
21587         ;;
21588     *)
21589         usesitecustomize="$undef"
21590         ;;
21591     esac
21592
21593 : see if prototypes support variable argument declarations
21594 echo " "
21595 case "$prototype$i_stdarg" in
21596 $define$define)
21597         echo "It appears we'll be able to prototype varargs functions." >&4
21598         val="$define"
21599         ;;
21600 *)
21601         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21602         val="$undef"
21603         ;;
21604 esac
21605 set vaproto
21606 eval $setvar
21607
21608 : determine compiler compiler
21609 case "$yacc" in
21610 '')
21611         dflt=yacc;;
21612 *)
21613         dflt="$yacc";;
21614 esac
21615 echo " "
21616 comp='yacc'
21617 if $test -f "$byacc$_exe"; then
21618         dflt="$byacc"
21619         comp="byacc or $comp"
21620 fi
21621 if $test -f "$bison$_exe"; then
21622         comp="$comp or bison -y"
21623 fi
21624 rp="Which compiler compiler ($comp) shall I use?"
21625 . ./myread
21626 yacc="$ans"
21627 case "$yacc" in
21628 *bis*)
21629         case "$yacc" in
21630         *-y*) ;;
21631         *)
21632                 yacc="$yacc -y"
21633                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21634                 ;;
21635         esac
21636         ;;
21637 esac
21638
21639 : see if this is a assert.h system
21640 set assert.h i_assert
21641 eval $inhdr
21642
21643 : see if this is a fp.h system
21644 set fp.h i_fp
21645 eval $inhdr
21646
21647 : see if this is a fp_class.h system
21648 set fp_class.h i_fp_class
21649 eval $inhdr
21650
21651 : see if gdbm.h is available
21652 set gdbm.h t_gdbm
21653 eval $inhdr
21654 case "$t_gdbm" in
21655 $define)
21656         : see if gdbm_open exists
21657         set gdbm_open d_gdbm_open
21658         eval $inlibc
21659         case "$d_gdbm_open" in
21660         $undef)
21661                 t_gdbm="$undef"
21662                 echo "We won't be including <gdbm.h>"
21663                 ;;
21664         esac
21665         ;;
21666 esac
21667 val="$t_gdbm"
21668 set i_gdbm
21669 eval $setvar
21670
21671 : see if this is a ieeefp.h system
21672 case "$i_ieeefp" in
21673 '' ) set ieeefp.h i_ieeefp
21674      eval $inhdr
21675      ;;
21676 esac
21677
21678 : see if this is a libutil.h system
21679 set libutil.h i_libutil
21680 eval $inhdr
21681
21682 : see if mach cthreads are available
21683 if test "X$usethreads" = "X$define"; then
21684         set mach/cthreads.h i_machcthr
21685         eval $inhdr
21686 else
21687         i_machcthr="$undef"
21688 fi
21689
21690 : see if this is a mntent.h system
21691 set mntent.h i_mntent
21692 eval $inhdr
21693
21694 : see if net/errno.h is available
21695 val=''
21696 set net/errno.h val
21697 eval $inhdr
21698
21699 : Unfortunately, it causes problems on some systems.  Arrgh.
21700 case "$val" in
21701 $define)
21702         cat > try.c <<'EOM'
21703 #include <stdio.h>
21704 #include <errno.h>
21705 #include <net/errno.h>
21706 int func()
21707 {
21708         return ENOTSOCK;
21709 }
21710 EOM
21711         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21712                 echo "We'll be including <net/errno.h>." >&4
21713         else
21714                 echo "We won't be including <net/errno.h>." >&4
21715                 val="$undef"
21716         fi
21717         $rm_try
21718         ;;
21719 esac
21720 set i_neterrno
21721 eval $setvar
21722
21723 : see if netinet/tcp.h is available
21724 set netinet/tcp.h i_netinettcp
21725 eval $inhdr
21726
21727 : see if this is a poll.h system
21728 set poll.h i_poll
21729 eval $inhdr
21730
21731 : see if this is a prot.h system
21732 set prot.h i_prot
21733 eval $inhdr
21734
21735 : Preprocessor symbols
21736 echo " "
21737 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21738 $cat <<'EOSH' > Cppsym.know
21739 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21740 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21741 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21742 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21743 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21744 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21745 bull c cadmus clipper CMU COFF COMPILER_VERSION
21746 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21747 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21748 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21749 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21750 GLIBC GLIBC_MINOR
21751 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21752 H3050R H3050RX hbullx20 hcx host_mips
21753 hp200 hp300 hp700 HP700 hp800 hp9000
21754 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21755 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21756 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21757 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21758 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21759 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21760 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21761 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21762 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21763 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21764 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21765 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21766 MATH_HAS_NO_SIDE_EFFECTS
21767 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21768 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21769 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21770 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21771 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21772 NetBSD news1500 news1700 news1800 news1900 news3700
21773 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21774 ns32016 ns32332 ns32k nsc32000
21775 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21776 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21777 pc532 pdp11 PGC PIC plexus PORTAR posix
21778 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21779 POSIX_C_SOURCE POSIX_SOURCE POWER
21780 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21781 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21782 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21783 sony sony_news sonyrisc sparc sparclite spectrum
21784 stardent stdc STDC_EXT stratos sun sun3 sun386
21785 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21786 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21787 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21788 sysV68 sysV88 Tek4132 Tek4300 titan
21789 TM3200 TM5400 TM5600
21790 tower tower32 tower32_200 tower32_600 tower32_700
21791 tower32_800 tower32_850 tss
21792 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21793 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21794 unix UNIX95 UNIX99 unixpc unos
21795 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21796 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21797 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21798 USGr4 USGr4_2
21799 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21800 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21801 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21802 z8000
21803 EOSH
21804 # Maybe put other stuff here too.
21805 cat <<EOSH >>Cppsym.know
21806 $osname
21807 EOSH
21808 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21809 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21810 $cat Cppsym.know > Cppsym.c
21811 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21812 $rm -f Cppsym.a Cppsym.b Cppsym.c
21813 cat <<EOSH > Cppsym
21814 $startsh
21815 if $test \$# -gt 0; then
21816     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21817     if $test -s Cppsym.got; then
21818         $rm -f Cppsym.got
21819         exit 0
21820     fi
21821     $rm -f Cppsym.got
21822     exit 1
21823 else
21824     $tr " " "$trnl" | ./Cppsym.try
21825     exit 0
21826 fi
21827 EOSH
21828 chmod +x Cppsym
21829 $eunicefix Cppsym
21830 cat <<EOSH > Cppsym.try
21831 $startsh
21832 cat <<'EOCP' > try.c
21833 #include <stdio.h>
21834 #if cpp_stuff == 1
21835 #define STRINGIFY(a)    "a"
21836 #endif
21837 #if cpp_stuff == 42
21838 #define StGiFy(a)  #a
21839 #define STRINGIFY(a)    StGiFy(a)
21840 #endif
21841 #if $cpp_stuff != 1 && $cpp_stuff != 42
21842 #   include "Bletch: How does this C preprocessor stringify macros?"
21843 #endif
21844 int main() {
21845 EOCP
21846 $awk \\
21847 EOSH
21848 cat <<'EOSH' >> Cppsym.try
21849 'length($1) > 0 {
21850     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21851     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21852     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21853     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21854 }'       >> try.c
21855 echo 'return 0;}' >> try.c
21856 EOSH
21857 cat <<EOSH >> Cppsym.try
21858 ccflags="$ccflags"
21859 case "$osname-$gccversion" in
21860 irix-) ccflags="\$ccflags -woff 1178" ;;
21861 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21862 esac
21863 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21864 EOSH
21865 chmod +x Cppsym.try
21866 $eunicefix Cppsym.try
21867 ./Cppsym < Cppsym.know > Cppsym.true
21868 : Add in any linux cpp "predefined macros":
21869 case "$osname::$gccversion" in
21870   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21871     tHdrH=_tmpHdr
21872     rm -f $tHdrH'.h' $tHdrH
21873     touch $tHdrH'.h'
21874     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21875        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21876        if [ -s $tHdrH'_cppsym.real' ]; then
21877           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21878        fi
21879     fi
21880     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21881   ;;
21882 esac
21883 : now check the C compiler for additional symbols
21884 postprocess_cc_v=''
21885 case "$osname" in
21886 aix) postprocess_cc_v="|$tr , ' '" ;;
21887 esac
21888 $cat >ccsym <<EOS
21889 $startsh
21890 $cat >tmp.c <<EOF
21891 extern int foo;
21892 EOF
21893 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21894 do
21895         case "\$i" in
21896         -D*) echo "\$i" | $sed 's/^-D//';;
21897         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21898         esac
21899 done
21900 $rm_try
21901 EOS
21902 postprocess_cc_v=''
21903 chmod +x ccsym
21904 $eunicefix ccsym
21905 ./ccsym > ccsym1.raw
21906 if $test -s ccsym1.raw; then
21907        $sort ccsym1.raw | $uniq >ccsym.raw
21908 else
21909        mv ccsym1.raw ccsym.raw
21910 fi
21911
21912 $awk '/\=/ { print $0; next }
21913         { print $0"=1" }' ccsym.raw >ccsym.list
21914 $comm -13 Cppsym.true ccsym.list >ccsym.own
21915 $comm -12 Cppsym.true ccsym.list >ccsym.com
21916 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21917 also=''
21918 if $test -z ccsym.raw; then
21919         echo "Your C compiler doesn't seem to define any symbols!" >&4
21920         echo " "
21921         echo "However, your C preprocessor defines the following symbols:"
21922         $cat Cppsym.true
21923         ccsymbols=''
21924         cppsymbols=`$cat Cppsym.true`
21925         cppsymbols=`echo $cppsymbols`
21926         cppccsymbols="$cppsymbols"
21927 else
21928         if $test -s ccsym.com; then
21929                 echo "Your C compiler and pre-processor define these symbols:"
21930                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21931                 also='also '
21932                 symbols='ones'
21933                 cppccsymbols=`$cat ccsym.com`
21934                 cppccsymbols=`echo $cppccsymbols`
21935                 $test "$silent" || sleep 1
21936         fi
21937         if $test -s ccsym.cpp; then
21938                 $test "$also" && echo " "
21939                 echo "Your C pre-processor ${also}defines the following symbols:"
21940                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21941                 also='further '
21942                 cppsymbols=`$cat ccsym.cpp`
21943                 cppsymbols=`echo $cppsymbols`
21944                 $test "$silent" || sleep 1
21945         fi
21946         if $test -s ccsym.own; then
21947                 $test "$also" && echo " "
21948                 echo "Your C compiler ${also}defines the following cpp symbols:"
21949                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21950                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21951                 ccsymbols=`$cat ccsym.own`
21952                 ccsymbols=`echo $ccsymbols`
21953                 $test "$silent" || sleep 1
21954         fi
21955 fi
21956
21957 : see if this is a termio system
21958 val="$undef"
21959 val2="$undef"
21960 val3="$undef"
21961 if $test `./findhdr termios.h`; then
21962         set tcsetattr i_termios
21963         eval $inlibc
21964         val3="$i_termios"
21965 fi
21966 echo " "
21967 case "$val3" in
21968 "$define") echo "You have POSIX termios.h... good!" >&4;;
21969 *) if ./Cppsym pyr; then
21970                 case "`/bin/universe`" in
21971                 ucb) if $test `./findhdr sgtty.h`; then
21972                                 val2="$define"
21973                                 echo "<sgtty.h> found." >&4
21974                         else
21975                                 echo "System is pyramid with BSD universe."
21976                                 ./warn "<sgtty.h> not found--you could have problems."
21977                         fi;;
21978                 *) if $test `./findhdr termio.h`; then
21979                                 val="$define"
21980                                 echo "<termio.h> found." >&4
21981                         else
21982                                 echo "System is pyramid with USG universe."
21983                                 ./warn "<termio.h> not found--you could have problems."
21984                         fi;;
21985                 esac
21986         elif ./usg; then
21987                 if $test `./findhdr termio.h`; then
21988                         echo "<termio.h> found." >&4
21989                         val="$define"
21990                 elif $test `./findhdr sgtty.h`; then
21991                         echo "<sgtty.h> found." >&4
21992                         val2="$define"
21993                 else
21994                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21995                 fi
21996         else
21997                 if $test `./findhdr sgtty.h`; then
21998                         echo "<sgtty.h> found." >&4
21999                         val2="$define"
22000                 elif $test `./findhdr termio.h`; then
22001                         echo "<termio.h> found." >&4
22002                         val="$define"
22003                 else
22004                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22005                 fi
22006         fi;;
22007 esac
22008 set i_termio; eval $setvar
22009 val=$val2; set i_sgtty; eval $setvar
22010 val=$val3; set i_termios; eval $setvar
22011
22012 : see if stdbool is available
22013 : we want a real compile instead of Inhdr because some Solaris systems
22014 : have stdbool.h, but it can only be used if the compiler indicates it
22015 : is sufficiently c99-compliant.
22016 echo " "
22017 $cat >try.c <<EOCP
22018 #include <stdio.h>
22019 #include <stdbool.h>
22020 int func(bool x)
22021 {
22022     return x ? 1 : 0;
22023 }
22024 int main(int argc, char **argv)
22025 {
22026     return func(0);
22027 }
22028 EOCP
22029 set try
22030 if eval $compile; then
22031         echo "<stdbool.h> found." >&4
22032         val="$define"
22033 else
22034         echo "<stdbool.h> NOT found." >&4
22035         val="$undef"
22036 fi
22037 $rm_try
22038 set i_stdbool
22039 eval $setvar
22040
22041 : see if stddef is available
22042 set stddef.h i_stddef
22043 eval $inhdr
22044
22045 : see if sys/access.h is available
22046 set sys/access.h i_sysaccess
22047 eval $inhdr
22048
22049 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22050 set sys/filio.h i_sysfilio
22051 eval $inhdr
22052 echo " "
22053 if $test `./findhdr sys/ioctl.h`; then
22054         val="$define"
22055         echo '<sys/ioctl.h> found.' >&4
22056 else
22057         val="$undef"
22058         if $test $i_sysfilio = "$define"; then
22059             echo '<sys/ioctl.h> NOT found.' >&4
22060         else
22061                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22062                 $test $i_termio = "$define" && xxx="termio.h"
22063                 $test $i_termios = "$define" && xxx="termios.h"
22064 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22065         fi
22066 fi
22067 set i_sysioctl
22068 eval $setvar
22069
22070 : see if socket ioctl defs are in sys/sockio.h
22071 echo " "
22072 xxx=`./findhdr sys/sockio.h`
22073 if $test "$xxx"; then
22074         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22075                 val="$define"
22076                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22077         else
22078                 val="$undef"
22079                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22080         fi
22081 else
22082         val="$undef"
22083         $cat <<EOM
22084 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22085 EOM
22086 fi
22087 set i_syssockio
22088 eval $setvar
22089
22090 : see if this is a syslog.h system
22091 set syslog.h i_syslog
22092 eval $inhdr
22093
22094 : see if this is a sys/mode.h system
22095 set sys/mode.h i_sysmode
22096 eval $inhdr
22097
22098 : see if there is a sys/poll.h file
22099 set sys/poll.h i_syspoll
22100 eval $inhdr
22101
22102 : see if sys/resource.h has to be included
22103 set sys/resource.h i_sysresrc
22104 eval $inhdr
22105
22106 : see if sys/security.h is available
22107 set sys/security.h i_syssecrt
22108 eval $inhdr
22109
22110 : see if this is a sys/statvfs.h system
22111 set sys/statvfs.h i_sysstatvfs
22112 eval $inhdr
22113
22114 : see if this is a sys/un.h system
22115 set sys/un.h i_sysun
22116 eval $inhdr
22117
22118 : see if this is a sys/utsname.h system
22119 set sys/utsname.h i_sysutsname
22120 eval $inhdr
22121
22122 : see if this is a syswait system
22123 set sys/wait.h i_syswait
22124 eval $inhdr
22125
22126 : see if this is a ustat.h system
22127 set ustat.h i_ustat
22128 eval $inhdr
22129
22130 : see if this is an utime system
22131 set utime.h i_utime
22132 eval $inhdr
22133
22134 : see if this is a vfork system
22135 case "$d_vfork" in
22136 "$define")
22137         set vfork.h i_vfork
22138         eval $inhdr
22139         ;;
22140 *)
22141         i_vfork="$undef"
22142         ;;
22143 esac
22144
22145 : Check extensions
22146 echo " "
22147 echo "Looking for extensions..." >&4
22148 : If we are using the old config.sh, known_extensions may contain
22149 : old or inaccurate or duplicate values.
22150 known_extensions=''
22151 nonxs_extensions=''
22152 : We do not use find because it might not be available.
22153 : We do not just use MANIFEST because the user may have dropped
22154 : some additional extensions into the source tree and expect them
22155 : to be built.
22156
22157 : Function to recursively find available extensions, ignoring DynaLoader
22158 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22159 : In 5.10.1 and later, extensions are stored in directories
22160 : like File-Glob instead of the older File/Glob/.
22161 find_extensions='
22162     for xxx in *; do
22163         case "$xxx" in
22164             DynaLoader|dynaload) ;;
22165             *)
22166             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22167             leaf=`echo $xxx | $sed -e s/.*-//`;
22168             if $test -d File; then
22169                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22170                     known_extensions="$known_extensions $1$this_ext";
22171                 elif $test -f $xxx/Makefile.PL; then
22172                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22173                 else
22174                     if $test -d $xxx -a $# -lt 10; then
22175                         set $1$xxx/ $*;
22176                         cd "$xxx";
22177                         eval $find_extensions;
22178                         cd ..;
22179                         shift;
22180                     fi;
22181                 fi;
22182             else
22183                 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22184                 if $contains " $this_ext " $$.tmp; then
22185                     echo >&4;
22186                     echo "Duplicate directories detected for extension $xxx" >&4;
22187                     echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22188                     case "$knowitall" in
22189                     "") dflt=y;;
22190                     *) dflt=n;;
22191                     esac;
22192                     . ../UU/myread;
22193                     case "$ans" in
22194                     n*|N*) ;;
22195                     *) echo >&4;
22196                        echo "Ok.  Stopping Configure." >&4;
22197                        echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22198                         exit 1;;
22199                     esac;
22200                     echo "Ok.  You will need to correct config.sh before running make." >&4;
22201                 fi;
22202                 $ls -1 $xxx > $$.tmp;
22203                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22204                     known_extensions="$known_extensions $this_ext";
22205                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22206                     known_extensions="$known_extensions $this_ext";
22207                 elif $test -d $xxx; then
22208                     nonxs_extensions="$nonxs_extensions $this_ext";
22209                 fi;
22210                 $rm -f $$.tmp;
22211             fi
22212             ;;
22213         esac;
22214     done'
22215 tdir=`pwd`
22216 cd "$rsrc/cpan"
22217 set X
22218 shift
22219 eval $find_extensions
22220 cd "$rsrc/dist"
22221 set X
22222 shift
22223 eval $find_extensions
22224 cd "$rsrc/ext"
22225 set X
22226 shift
22227 eval $find_extensions
22228 if $test -d File-Glob; then
22229     : All ext/ flattened
22230 else
22231     # Special case:  Add in modules that nest beyond the first level.
22232     # Currently threads/shared and Hash/Util/FieldHash, since they are
22233     # not picked up by the recursive find above (and adding in general
22234     # recursive finding breaks SDBM_File/sdbm).
22235     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22236     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22237 fi
22238 set X $known_extensions
22239 shift
22240 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22241 set X $nonxs_extensions
22242 shift
22243 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22244 cd "$tdir"
22245
22246 : Now see which are supported on this system.
22247 avail_ext=''
22248 for xxx in $known_extensions ; do
22249         case "$xxx" in
22250         DB_File|db_file)
22251                 case "$i_db" in
22252                 $define) avail_ext="$avail_ext $xxx" ;;
22253                 esac
22254                 ;;
22255         GDBM_File|gdbm_fil)
22256                 case "$i_gdbm" in
22257                 $define) avail_ext="$avail_ext $xxx" ;;
22258                 esac
22259                 ;;
22260         I18N/Langinfo|i18n_lan)
22261                 case "$i_langinfo$d_nl_langinfo" in
22262                 $define$define) avail_ext="$avail_ext $xxx" ;;
22263                 esac
22264                 ;;
22265         IPC/SysV|ipc/sysv)
22266                 : XXX Do we need a useipcsysv variable here
22267                 case "${d_msg}${d_sem}${d_shm}" in
22268                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22269                 esac
22270                 ;;
22271         NDBM_File|ndbm_fil)
22272                 case "$d_ndbm" in
22273                 $define)
22274                     case "$osname-$use64bitint" in
22275                     hpux-define)
22276                         case "$libs" in
22277                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22278                         esac
22279                         ;;
22280                     *) avail_ext="$avail_ext $xxx" ;;
22281                     esac
22282                     ;;
22283                 esac
22284                 ;;
22285         ODBM_File|odbm_fil)
22286                 case "${i_dbm}${i_rpcsvcdbm}" in
22287                 *"${define}"*)
22288                     case "$d_cplusplus" in
22289                     define) ;; # delete as a function name will not work
22290                     *)  case "$osname-$use64bitint" in
22291                         hpux-define)
22292                             case "$libs" in
22293                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22294                             esac
22295                             ;;
22296                         *) avail_ext="$avail_ext $xxx" ;;
22297                         esac
22298                         ;;
22299                     esac
22300                     ;;
22301                 esac
22302                 ;;
22303         Opcode|opcode)
22304                 case "$useopcode" in
22305                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22306                 esac
22307                 ;;
22308         POSIX|posix)
22309                 case "$useposix" in
22310                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22311                 esac
22312                 ;;
22313         Socket|socket)
22314                 case "$d_socket" in
22315                 true|$define|y)
22316                     case "$osname" in
22317                     beos) ;; # not unless BONE
22318                     *) avail_ext="$avail_ext $xxx" ;;
22319                     esac
22320                     ;;
22321                 esac
22322                 ;;
22323         Sys/Syslog|sys/syslog)
22324                 : XXX syslog requires socket
22325                 case "$d_socket" in
22326                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22327                 esac
22328                 ;;
22329         Thread|thread)
22330                 case "$usethreads" in
22331                 true|$define|y)
22332                         case "$use5005threads" in
22333                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22334                         esac
22335                 esac
22336                 ;;
22337         threads|threads/shared)
22338                 # threads and threads::shared are special cases.
22339                 # To stop people from asking "Perl 5.8.0 was supposed
22340                 # to have this new fancy threads implementation but my
22341                 # perl doesn't have it" and from people trying to
22342                 # (re)install the threads module using CPAN.pm and
22343                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22344                 # the threads.pm and threads/shared.pm will always be
22345                 # there, croaking informatively ("you need to rebuild
22346                 # all of Perl with threads, sorry") when threads haven't
22347                 # been compiled in.
22348                 # --jhi
22349                 avail_ext="$avail_ext $xxx"
22350                 ;;
22351         VMS*)
22352                 ;;
22353         Win32*)
22354                 case "$osname" in
22355                 cygwin) avail_ext="$avail_ext $xxx" ;;
22356                 esac
22357                 ;;
22358         XS/APItest|xs/apitest)
22359                 # This is just for testing.  Skip it unless we have dynamic loading.
22360
22361                 case "$usedl" in
22362                 $define) avail_ext="$avail_ext $xxx" ;;
22363                 esac
22364                 ;;
22365         XS/Typemap|xs/typemap)
22366                 # This is just for testing.  Skip it unless we have dynamic loading.
22367                 case "$usedl" in
22368                 $define) avail_ext="$avail_ext $xxx" ;;
22369                 esac
22370                 ;;
22371         *)      avail_ext="$avail_ext $xxx"
22372                 ;;
22373         esac
22374 done
22375
22376 set X $avail_ext
22377 shift
22378 avail_ext="$*"
22379
22380 case "$onlyextensions" in
22381 '') ;;
22382 *)  keepextensions=''
22383     echo "You have requested that only certain extensions be included..." >&4
22384     for i in $onlyextensions; do
22385         case " $avail_ext " in
22386         *" $i "*)
22387             echo "Keeping extension $i."
22388             keepextensions="$keepextensions $i"
22389             ;;
22390         *) echo "Ignoring extension $i." ;;
22391         esac
22392     done
22393     avail_ext="$keepextensions"
22394     ;;
22395 esac
22396
22397 case "$noextensions" in
22398 '') ;;
22399 *)  keepextensions=''
22400     echo "You have requested that certain extensions be ignored..." >&4
22401     for i in $avail_ext; do
22402         case " $noextensions " in
22403         *" $i "*) echo "Ignoring extension $i." ;;
22404         *) echo "Keeping extension $i.";
22405            keepextensions="$keepextensions $i"
22406            ;;
22407         esac
22408     done
22409     avail_ext="$keepextensions"
22410     ;;
22411 esac
22412
22413 : Now see which nonxs extensions are supported on this system.
22414 : For now assume all are.
22415 nonxs_ext=''
22416 for xxx in $nonxs_extensions ; do
22417         case "$xxx" in
22418         *)      nonxs_ext="$nonxs_ext $xxx"
22419                 ;;
22420         esac
22421 done
22422
22423 set X $nonxs_ext
22424 shift
22425 nonxs_ext="$*"
22426
22427 case $usedl in
22428 $define)
22429         $cat <<EOM
22430 A number of extensions are supplied with $package.  You may choose to
22431 compile these extensions for dynamic loading (the default), compile
22432 them into the $package executable (static loading), or not include
22433 them at all.  Answer "none" to include no extensions.
22434 Note that DynaLoader is always built and need not be mentioned here.
22435
22436 EOM
22437         case "$dynamic_ext" in
22438         '')
22439                 : Exclude those listed in static_ext
22440                 dflt=''
22441                 for xxx in $avail_ext; do
22442                         case " $static_ext " in
22443                         *" $xxx "*) ;;
22444                         *) dflt="$dflt $xxx" ;;
22445                         esac
22446                 done
22447                 set X $dflt
22448                 shift
22449                 dflt="$*"
22450                 ;;
22451         *)      dflt="$dynamic_ext"
22452                 # Perhaps we are reusing an old out-of-date config.sh.
22453                 case "$hint" in
22454                 previous)
22455                         if test X"$dynamic_ext" != X"$avail_ext"; then
22456                                 $cat <<EOM
22457 NOTICE:  Your previous config.sh list may be incorrect.
22458 The extensions now available to you are
22459         ${avail_ext}
22460 but the default list from your previous config.sh is
22461         ${dynamic_ext}
22462
22463 EOM
22464                         fi
22465                         ;;
22466                 esac
22467                 ;;
22468         esac
22469         case "$dflt" in
22470         '')     dflt=none;;
22471         esac
22472         rp="What extensions do you wish to load dynamically?"
22473         . ./myread
22474         case "$ans" in
22475         none) dynamic_ext=' ' ;;
22476         *) dynamic_ext="$ans" ;;
22477         esac
22478
22479         case "$static_ext" in
22480         '')
22481                 : Exclude those already listed in dynamic linking
22482                 dflt=''
22483                 for xxx in $avail_ext; do
22484                         case " $dynamic_ext " in
22485                         *" $xxx "*) ;;
22486                         *) dflt="$dflt $xxx" ;;
22487                         esac
22488                 done
22489                 set X $dflt
22490                 shift
22491                 dflt="$*"
22492                 ;;
22493         *)  dflt="$static_ext"
22494                 ;;
22495         esac
22496
22497         case "$dflt" in
22498         '')     dflt=none;;
22499         esac
22500         rp="What extensions do you wish to load statically?"
22501         . ./myread
22502         case "$ans" in
22503         none) static_ext=' ' ;;
22504         *) static_ext="$ans" ;;
22505         esac
22506         ;;
22507 *)
22508         $cat <<EOM
22509 A number of extensions are supplied with $package.  Answer "none"
22510 to include no extensions.
22511 Note that DynaLoader is always built and need not be mentioned here.
22512
22513 EOM
22514         case "$static_ext" in
22515         '') dflt="$avail_ext" ;;
22516         *)      dflt="$static_ext"
22517                 # Perhaps we are reusing an old out-of-date config.sh.
22518                 case "$hint" in
22519                 previous)
22520                         if test X"$static_ext" != X"$avail_ext"; then
22521                                 $cat <<EOM
22522 NOTICE:  Your previous config.sh list may be incorrect.
22523 The extensions now available to you are
22524         ${avail_ext}
22525 but the default list from your previous config.sh is
22526         ${static_ext}
22527
22528 EOM
22529                         fi
22530                         ;;
22531                 esac
22532                 ;;
22533         esac
22534         : Exclude those that are not xs extensions
22535         case "$dflt" in
22536         '')     dflt=none;;
22537         esac
22538         rp="What extensions do you wish to include?"
22539         . ./myread
22540         case "$ans" in
22541         none) static_ext=' ' ;;
22542         *) static_ext="$ans" ;;
22543         esac
22544         ;;
22545 esac
22546 #
22547 # Encode is a special case.  If we are building Encode as a static
22548 # extension, we need to explicitly list its subextensions as well.
22549 # For other nested extensions, this is handled automatically by
22550 # the appropriate Makefile.PL.
22551 case " $static_ext " in
22552         *" Encode "*) # Add the subextensions of Encode
22553         cd "$rsrc/cpan"
22554         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22555                 static_ext="$static_ext Encode/$xxx"
22556         done
22557         cd "$tdir"
22558         ;;
22559 esac
22560
22561 set X $dynamic_ext $static_ext $nonxs_ext
22562 shift
22563 extensions="$*"
22564
22565 # Sanity check:  We require an extension suitable for use with
22566 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22567 # should show up as failures in the test suite, but it's helpful to
22568 # catch them now.) The 'extensions' list is normally sorted
22569 # alphabetically, so we need to accept either
22570 #    DB_File ... Fcntl ... IO  ....
22571 # or something like
22572 #    Fcntl ... NDBM_File ... IO  ....
22573 case " $extensions"  in
22574 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22575 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22576 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22577 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22578    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22579    ;;
22580 esac
22581
22582 : Remove libraries needed only for extensions
22583 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22584 : The exception is SunOS 4.x, which needs them.
22585 case "${osname}X${osvers}" in
22586 sunos*X4*)
22587     perllibs="$libs"
22588     ;;
22589 *) case "$usedl" in
22590     $define|true|[yY]*)
22591             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22592             shift
22593             perllibs="$*"
22594             ;;
22595     *)  perllibs="$libs"
22596             ;;
22597     esac
22598     ;;
22599 esac
22600
22601 : Remove build directory name from cppstdin so it can be used from
22602 : either the present location or the final installed location.
22603 echo " "
22604 : Get out of the UU directory to get correct path name.
22605 cd ..
22606 case "$cppstdin" in
22607 `pwd`/cppstdin)
22608         echo "Stripping down cppstdin path name"
22609         cppstdin=cppstdin
22610         ;;
22611 esac
22612 cd UU
22613
22614 : end of configuration questions
22615 echo " "
22616 echo "End of configuration questions."
22617 echo " "
22618
22619 : back to where it started
22620 if test -d ../UU; then
22621         cd ..
22622 fi
22623
22624 : configuration may be unconditionally patched via a 'config.arch' file
22625 if $test -f config.arch; then
22626         echo "I see a config.arch file, loading it." >&4
22627         . ./config.arch
22628 fi
22629
22630 : configuration may be patched via a 'config.over' file
22631 if $test -f config.over; then
22632         echo " "
22633         dflt=y
22634         rp='I see a config.over file.  Do you wish to load it?'
22635         . UU/myread
22636         case "$ans" in
22637         n*) echo "OK, I'll ignore it.";;
22638         *)      . ./config.over
22639                 echo "Configuration override changes have been loaded."
22640                 ;;
22641         esac
22642 fi
22643
22644 : in case they want portability, strip down executable paths
22645 case "$d_portable" in
22646 "$define")
22647         echo " "
22648         echo "Stripping down executable paths..." >&4
22649         for file in $loclist $trylist; do
22650                 eval temp=\$$file
22651                 eval $file=`basename $temp`
22652         done
22653         ;;
22654 esac
22655
22656 : create config.sh file
22657 echo " "
22658 echo "Creating config.sh..." >&4
22659 $spitshell <<EOT >config.sh
22660 $startsh
22661 #
22662 # This file was produced by running the Configure script. It holds all the
22663 # definitions figured out by Configure. Should you modify one of these values,
22664 # do not forget to propagate your changes by running "Configure -der". You may
22665 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22666 #
22667
22668 # Package name      : $package
22669 # Source directory  : $src
22670 # Configuration time: $cf_time
22671 # Configured by     : $cf_by
22672 # Target system     : $myuname
22673
22674 EOT
22675 : Add in command line options if available
22676 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22677
22678 $spitshell <<EOT >>config.sh
22679
22680 Author='$Author'
22681 Date='$Date'
22682 Header='$Header'
22683 Id='$Id'
22684 Locker='$Locker'
22685 Log='$Log'
22686 RCSfile='$RCSfile'
22687 Revision='$Revision'
22688 Source='$Source'
22689 State='$State'
22690 _a='$_a'
22691 _exe='$_exe'
22692 _o='$_o'
22693 afs='$afs'
22694 afsroot='$afsroot'
22695 alignbytes='$alignbytes'
22696 ansi2knr='$ansi2knr'
22697 aphostname='$aphostname'
22698 api_revision='$api_revision'
22699 api_subversion='$api_subversion'
22700 api_version='$api_version'
22701 api_versionstring='$api_versionstring'
22702 ar='$ar'
22703 archlib='$archlib'
22704 archlibexp='$archlibexp'
22705 archname64='$archname64'
22706 archname='$archname'
22707 archobjs='$archobjs'
22708 asctime_r_proto='$asctime_r_proto'
22709 awk='$awk'
22710 baserev='$baserev'
22711 bash='$bash'
22712 bin='$bin'
22713 bin_ELF='$bin_ELF'
22714 binexp='$binexp'
22715 bison='$bison'
22716 byacc='$byacc'
22717 byteorder='$byteorder'
22718 c='$c'
22719 castflags='$castflags'
22720 cat='$cat'
22721 cc='$cc'
22722 cccdlflags='$cccdlflags'
22723 ccdlflags='$ccdlflags'
22724 ccflags='$ccflags'
22725 ccflags_uselargefiles='$ccflags_uselargefiles'
22726 ccname='$ccname'
22727 ccsymbols='$ccsymbols'
22728 ccversion='$ccversion'
22729 cf_by='$cf_by'
22730 cf_email='$cf_email'
22731 cf_time='$cf_time'
22732 charbits='$charbits'
22733 charsize='$charsize'
22734 chgrp='$chgrp'
22735 chmod='$chmod'
22736 chown='$chown'
22737 clocktype='$clocktype'
22738 comm='$comm'
22739 compress='$compress'
22740 contains='$contains'
22741 cp='$cp'
22742 cpio='$cpio'
22743 cpp='$cpp'
22744 cpp_stuff='$cpp_stuff'
22745 cppccsymbols='$cppccsymbols'
22746 cppflags='$cppflags'
22747 cpplast='$cpplast'
22748 cppminus='$cppminus'
22749 cpprun='$cpprun'
22750 cppstdin='$cppstdin'
22751 cppsymbols='$cppsymbols'
22752 crypt_r_proto='$crypt_r_proto'
22753 cryptlib='$cryptlib'
22754 csh='$csh'
22755 ctermid_r_proto='$ctermid_r_proto'
22756 ctime_r_proto='$ctime_r_proto'
22757 d_Gconvert='$d_Gconvert'
22758 d_PRIEUldbl='$d_PRIEUldbl'
22759 d_PRIFUldbl='$d_PRIFUldbl'
22760 d_PRIGUldbl='$d_PRIGUldbl'
22761 d_PRIXU64='$d_PRIXU64'
22762 d_PRId64='$d_PRId64'
22763 d_PRIeldbl='$d_PRIeldbl'
22764 d_PRIfldbl='$d_PRIfldbl'
22765 d_PRIgldbl='$d_PRIgldbl'
22766 d_PRIi64='$d_PRIi64'
22767 d_PRIo64='$d_PRIo64'
22768 d_PRIu64='$d_PRIu64'
22769 d_PRIx64='$d_PRIx64'
22770 d_SCNfldbl='$d_SCNfldbl'
22771 d__fwalk='$d__fwalk'
22772 d_access='$d_access'
22773 d_accessx='$d_accessx'
22774 d_aintl='$d_aintl'
22775 d_alarm='$d_alarm'
22776 d_archlib='$d_archlib'
22777 d_asctime64='$d_asctime64'
22778 d_asctime_r='$d_asctime_r'
22779 d_atolf='$d_atolf'
22780 d_atoll='$d_atoll'
22781 d_attribute_deprecated='$d_attribute_deprecated'
22782 d_attribute_format='$d_attribute_format'
22783 d_attribute_malloc='$d_attribute_malloc'
22784 d_attribute_nonnull='$d_attribute_nonnull'
22785 d_attribute_noreturn='$d_attribute_noreturn'
22786 d_attribute_pure='$d_attribute_pure'
22787 d_attribute_unused='$d_attribute_unused'
22788 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22789 d_bcmp='$d_bcmp'
22790 d_bcopy='$d_bcopy'
22791 d_bsd='$d_bsd'
22792 d_bsdgetpgrp='$d_bsdgetpgrp'
22793 d_bsdsetpgrp='$d_bsdsetpgrp'
22794 d_builtin_choose_expr='$d_builtin_choose_expr'
22795 d_builtin_expect='$d_builtin_expect'
22796 d_bzero='$d_bzero'
22797 d_c99_variadic_macros='$d_c99_variadic_macros'
22798 d_casti32='$d_casti32'
22799 d_castneg='$d_castneg'
22800 d_charvspr='$d_charvspr'
22801 d_chown='$d_chown'
22802 d_chroot='$d_chroot'
22803 d_chsize='$d_chsize'
22804 d_class='$d_class'
22805 d_clearenv='$d_clearenv'
22806 d_closedir='$d_closedir'
22807 d_cmsghdr_s='$d_cmsghdr_s'
22808 d_const='$d_const'
22809 d_copysignl='$d_copysignl'
22810 d_cplusplus='$d_cplusplus'
22811 d_crypt='$d_crypt'
22812 d_crypt_r='$d_crypt_r'
22813 d_csh='$d_csh'
22814 d_ctermid='$d_ctermid'
22815 d_ctermid_r='$d_ctermid_r'
22816 d_ctime64='$d_ctime64'
22817 d_ctime_r='$d_ctime_r'
22818 d_cuserid='$d_cuserid'
22819 d_dbl_dig='$d_dbl_dig'
22820 d_dbminitproto='$d_dbminitproto'
22821 d_difftime64='$d_difftime64'
22822 d_difftime='$d_difftime'
22823 d_dir_dd_fd='$d_dir_dd_fd'
22824 d_dirfd='$d_dirfd'
22825 d_dirnamlen='$d_dirnamlen'
22826 d_dlerror='$d_dlerror'
22827 d_dlopen='$d_dlopen'
22828 d_dlsymun='$d_dlsymun'
22829 d_dosuid='$d_dosuid'
22830 d_drand48_r='$d_drand48_r'
22831 d_drand48proto='$d_drand48proto'
22832 d_dup2='$d_dup2'
22833 d_eaccess='$d_eaccess'
22834 d_endgrent='$d_endgrent'
22835 d_endgrent_r='$d_endgrent_r'
22836 d_endhent='$d_endhent'
22837 d_endhostent_r='$d_endhostent_r'
22838 d_endnent='$d_endnent'
22839 d_endnetent_r='$d_endnetent_r'
22840 d_endpent='$d_endpent'
22841 d_endprotoent_r='$d_endprotoent_r'
22842 d_endpwent='$d_endpwent'
22843 d_endpwent_r='$d_endpwent_r'
22844 d_endsent='$d_endsent'
22845 d_endservent_r='$d_endservent_r'
22846 d_eofnblk='$d_eofnblk'
22847 d_eunice='$d_eunice'
22848 d_faststdio='$d_faststdio'
22849 d_fchdir='$d_fchdir'
22850 d_fchmod='$d_fchmod'
22851 d_fchown='$d_fchown'
22852 d_fcntl='$d_fcntl'
22853 d_fcntl_can_lock='$d_fcntl_can_lock'
22854 d_fd_macros='$d_fd_macros'
22855 d_fd_set='$d_fd_set'
22856 d_fds_bits='$d_fds_bits'
22857 d_fgetpos='$d_fgetpos'
22858 d_finite='$d_finite'
22859 d_finitel='$d_finitel'
22860 d_flexfnam='$d_flexfnam'
22861 d_flock='$d_flock'
22862 d_flockproto='$d_flockproto'
22863 d_fork='$d_fork'
22864 d_fp_class='$d_fp_class'
22865 d_fpathconf='$d_fpathconf'
22866 d_fpclass='$d_fpclass'
22867 d_fpclassify='$d_fpclassify'
22868 d_fpclassl='$d_fpclassl'
22869 d_fpos64_t='$d_fpos64_t'
22870 d_frexpl='$d_frexpl'
22871 d_fs_data_s='$d_fs_data_s'
22872 d_fseeko='$d_fseeko'
22873 d_fsetpos='$d_fsetpos'
22874 d_fstatfs='$d_fstatfs'
22875 d_fstatvfs='$d_fstatvfs'
22876 d_fsync='$d_fsync'
22877 d_ftello='$d_ftello'
22878 d_ftime='$d_ftime'
22879 d_futimes='$d_futimes'
22880 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22881 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22882 d_getaddrinfo='$d_getaddrinfo'
22883 d_getcwd='$d_getcwd'
22884 d_getespwnam='$d_getespwnam'
22885 d_getfsstat='$d_getfsstat'
22886 d_getgrent='$d_getgrent'
22887 d_getgrent_r='$d_getgrent_r'
22888 d_getgrgid_r='$d_getgrgid_r'
22889 d_getgrnam_r='$d_getgrnam_r'
22890 d_getgrps='$d_getgrps'
22891 d_gethbyaddr='$d_gethbyaddr'
22892 d_gethbyname='$d_gethbyname'
22893 d_gethent='$d_gethent'
22894 d_gethname='$d_gethname'
22895 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22896 d_gethostbyname_r='$d_gethostbyname_r'
22897 d_gethostent_r='$d_gethostent_r'
22898 d_gethostprotos='$d_gethostprotos'
22899 d_getitimer='$d_getitimer'
22900 d_getlogin='$d_getlogin'
22901 d_getlogin_r='$d_getlogin_r'
22902 d_getmnt='$d_getmnt'
22903 d_getmntent='$d_getmntent'
22904 d_getnameinfo='$d_getnameinfo'
22905 d_getnbyaddr='$d_getnbyaddr'
22906 d_getnbyname='$d_getnbyname'
22907 d_getnent='$d_getnent'
22908 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22909 d_getnetbyname_r='$d_getnetbyname_r'
22910 d_getnetent_r='$d_getnetent_r'
22911 d_getnetprotos='$d_getnetprotos'
22912 d_getpagsz='$d_getpagsz'
22913 d_getpbyname='$d_getpbyname'
22914 d_getpbynumber='$d_getpbynumber'
22915 d_getpent='$d_getpent'
22916 d_getpgid='$d_getpgid'
22917 d_getpgrp2='$d_getpgrp2'
22918 d_getpgrp='$d_getpgrp'
22919 d_getppid='$d_getppid'
22920 d_getprior='$d_getprior'
22921 d_getprotobyname_r='$d_getprotobyname_r'
22922 d_getprotobynumber_r='$d_getprotobynumber_r'
22923 d_getprotoent_r='$d_getprotoent_r'
22924 d_getprotoprotos='$d_getprotoprotos'
22925 d_getprpwnam='$d_getprpwnam'
22926 d_getpwent='$d_getpwent'
22927 d_getpwent_r='$d_getpwent_r'
22928 d_getpwnam_r='$d_getpwnam_r'
22929 d_getpwuid_r='$d_getpwuid_r'
22930 d_getsbyname='$d_getsbyname'
22931 d_getsbyport='$d_getsbyport'
22932 d_getsent='$d_getsent'
22933 d_getservbyname_r='$d_getservbyname_r'
22934 d_getservbyport_r='$d_getservbyport_r'
22935 d_getservent_r='$d_getservent_r'
22936 d_getservprotos='$d_getservprotos'
22937 d_getspnam='$d_getspnam'
22938 d_getspnam_r='$d_getspnam_r'
22939 d_gettimeod='$d_gettimeod'
22940 d_gmtime64='$d_gmtime64'
22941 d_gmtime_r='$d_gmtime_r'
22942 d_gnulibc='$d_gnulibc'
22943 d_grpasswd='$d_grpasswd'
22944 d_hasmntopt='$d_hasmntopt'
22945 d_htonl='$d_htonl'
22946 d_ilogbl='$d_ilogbl'
22947 d_inc_version_list='$d_inc_version_list'
22948 d_index='$d_index'
22949 d_inetaton='$d_inetaton'
22950 d_inetntop='$d_inetntop'
22951 d_inetpton='$d_inetpton'
22952 d_int64_t='$d_int64_t'
22953 d_isascii='$d_isascii'
22954 d_isblank='$d_isblank'
22955 d_isfinite='$d_isfinite'
22956 d_isinf='$d_isinf'
22957 d_isnan='$d_isnan'
22958 d_isnanl='$d_isnanl'
22959 d_killpg='$d_killpg'
22960 d_lchown='$d_lchown'
22961 d_ldbl_dig='$d_ldbl_dig'
22962 d_libm_lib_version='$d_libm_lib_version'
22963 d_link='$d_link'
22964 d_localtime64='$d_localtime64'
22965 d_localtime_r='$d_localtime_r'
22966 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22967 d_locconv='$d_locconv'
22968 d_lockf='$d_lockf'
22969 d_longdbl='$d_longdbl'
22970 d_longlong='$d_longlong'
22971 d_lseekproto='$d_lseekproto'
22972 d_lstat='$d_lstat'
22973 d_madvise='$d_madvise'
22974 d_malloc_good_size='$d_malloc_good_size'
22975 d_malloc_size='$d_malloc_size'
22976 d_mblen='$d_mblen'
22977 d_mbstowcs='$d_mbstowcs'
22978 d_mbtowc='$d_mbtowc'
22979 d_memchr='$d_memchr'
22980 d_memcmp='$d_memcmp'
22981 d_memcpy='$d_memcpy'
22982 d_memmove='$d_memmove'
22983 d_memset='$d_memset'
22984 d_mkdir='$d_mkdir'
22985 d_mkdtemp='$d_mkdtemp'
22986 d_mkfifo='$d_mkfifo'
22987 d_mkstemp='$d_mkstemp'
22988 d_mkstemps='$d_mkstemps'
22989 d_mktime64='$d_mktime64'
22990 d_mktime='$d_mktime'
22991 d_mmap='$d_mmap'
22992 d_modfl='$d_modfl'
22993 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22994 d_modflproto='$d_modflproto'
22995 d_mprotect='$d_mprotect'
22996 d_msg='$d_msg'
22997 d_msg_ctrunc='$d_msg_ctrunc'
22998 d_msg_dontroute='$d_msg_dontroute'
22999 d_msg_oob='$d_msg_oob'
23000 d_msg_peek='$d_msg_peek'
23001 d_msg_proxy='$d_msg_proxy'
23002 d_msgctl='$d_msgctl'
23003 d_msgget='$d_msgget'
23004 d_msghdr_s='$d_msghdr_s'
23005 d_msgrcv='$d_msgrcv'
23006 d_msgsnd='$d_msgsnd'
23007 d_msync='$d_msync'
23008 d_munmap='$d_munmap'
23009 d_mymalloc='$d_mymalloc'
23010 d_ndbm='$d_ndbm'
23011 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23012 d_nice='$d_nice'
23013 d_nl_langinfo='$d_nl_langinfo'
23014 d_nv_preserves_uv='$d_nv_preserves_uv'
23015 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23016 d_off64_t='$d_off64_t'
23017 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23018 d_oldpthreads='$d_oldpthreads'
23019 d_oldsock='$d_oldsock'
23020 d_open3='$d_open3'
23021 d_pathconf='$d_pathconf'
23022 d_pause='$d_pause'
23023 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23024 d_phostname='$d_phostname'
23025 d_pipe='$d_pipe'
23026 d_poll='$d_poll'
23027 d_portable='$d_portable'
23028 d_prctl='$d_prctl'
23029 d_prctl_set_name='$d_prctl_set_name'
23030 d_printf_format_null='$d_printf_format_null'
23031 d_procselfexe='$d_procselfexe'
23032 d_pseudofork='$d_pseudofork'
23033 d_pthread_atfork='$d_pthread_atfork'
23034 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23035 d_pthread_yield='$d_pthread_yield'
23036 d_pwage='$d_pwage'
23037 d_pwchange='$d_pwchange'
23038 d_pwclass='$d_pwclass'
23039 d_pwcomment='$d_pwcomment'
23040 d_pwexpire='$d_pwexpire'
23041 d_pwgecos='$d_pwgecos'
23042 d_pwpasswd='$d_pwpasswd'
23043 d_pwquota='$d_pwquota'
23044 d_qgcvt='$d_qgcvt'
23045 d_quad='$d_quad'
23046 d_random_r='$d_random_r'
23047 d_readdir64_r='$d_readdir64_r'
23048 d_readdir='$d_readdir'
23049 d_readdir_r='$d_readdir_r'
23050 d_readlink='$d_readlink'
23051 d_readv='$d_readv'
23052 d_recvmsg='$d_recvmsg'
23053 d_rename='$d_rename'
23054 d_rewinddir='$d_rewinddir'
23055 d_rmdir='$d_rmdir'
23056 d_safebcpy='$d_safebcpy'
23057 d_safemcpy='$d_safemcpy'
23058 d_sanemcmp='$d_sanemcmp'
23059 d_sbrkproto='$d_sbrkproto'
23060 d_scalbnl='$d_scalbnl'
23061 d_sched_yield='$d_sched_yield'
23062 d_scm_rights='$d_scm_rights'
23063 d_seekdir='$d_seekdir'
23064 d_select='$d_select'
23065 d_sem='$d_sem'
23066 d_semctl='$d_semctl'
23067 d_semctl_semid_ds='$d_semctl_semid_ds'
23068 d_semctl_semun='$d_semctl_semun'
23069 d_semget='$d_semget'
23070 d_semop='$d_semop'
23071 d_sendmsg='$d_sendmsg'
23072 d_setegid='$d_setegid'
23073 d_seteuid='$d_seteuid'
23074 d_setgrent='$d_setgrent'
23075 d_setgrent_r='$d_setgrent_r'
23076 d_setgrps='$d_setgrps'
23077 d_sethent='$d_sethent'
23078 d_sethostent_r='$d_sethostent_r'
23079 d_setitimer='$d_setitimer'
23080 d_setlinebuf='$d_setlinebuf'
23081 d_setlocale='$d_setlocale'
23082 d_setlocale_r='$d_setlocale_r'
23083 d_setnent='$d_setnent'
23084 d_setnetent_r='$d_setnetent_r'
23085 d_setpent='$d_setpent'
23086 d_setpgid='$d_setpgid'
23087 d_setpgrp2='$d_setpgrp2'
23088 d_setpgrp='$d_setpgrp'
23089 d_setprior='$d_setprior'
23090 d_setproctitle='$d_setproctitle'
23091 d_setprotoent_r='$d_setprotoent_r'
23092 d_setpwent='$d_setpwent'
23093 d_setpwent_r='$d_setpwent_r'
23094 d_setregid='$d_setregid'
23095 d_setresgid='$d_setresgid'
23096 d_setresuid='$d_setresuid'
23097 d_setreuid='$d_setreuid'
23098 d_setrgid='$d_setrgid'
23099 d_setruid='$d_setruid'
23100 d_setsent='$d_setsent'
23101 d_setservent_r='$d_setservent_r'
23102 d_setsid='$d_setsid'
23103 d_setvbuf='$d_setvbuf'
23104 d_sfio='$d_sfio'
23105 d_shm='$d_shm'
23106 d_shmat='$d_shmat'
23107 d_shmatprototype='$d_shmatprototype'
23108 d_shmctl='$d_shmctl'
23109 d_shmdt='$d_shmdt'
23110 d_shmget='$d_shmget'
23111 d_sigaction='$d_sigaction'
23112 d_signbit='$d_signbit'
23113 d_sigprocmask='$d_sigprocmask'
23114 d_sigsetjmp='$d_sigsetjmp'
23115 d_sin6_scope_id='$d_sin6_scope_id'
23116 d_sitearch='$d_sitearch'
23117 d_snprintf='$d_snprintf'
23118 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23119 d_sockatmark='$d_sockatmark'
23120 d_sockatmarkproto='$d_sockatmarkproto'
23121 d_socket='$d_socket'
23122 d_socklen_t='$d_socklen_t'
23123 d_sockpair='$d_sockpair'
23124 d_socks5_init='$d_socks5_init'
23125 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23126 d_sqrtl='$d_sqrtl'
23127 d_srand48_r='$d_srand48_r'
23128 d_srandom_r='$d_srandom_r'
23129 d_sresgproto='$d_sresgproto'
23130 d_sresuproto='$d_sresuproto'
23131 d_statblks='$d_statblks'
23132 d_statfs_f_flags='$d_statfs_f_flags'
23133 d_statfs_s='$d_statfs_s'
23134 d_static_inline='$d_static_inline'
23135 d_statvfs='$d_statvfs'
23136 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23137 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23138 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23139 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23140 d_stdio_stream_array='$d_stdio_stream_array'
23141 d_stdiobase='$d_stdiobase'
23142 d_stdstdio='$d_stdstdio'
23143 d_strchr='$d_strchr'
23144 d_strcoll='$d_strcoll'
23145 d_strctcpy='$d_strctcpy'
23146 d_strerrm='$d_strerrm'
23147 d_strerror='$d_strerror'
23148 d_strerror_r='$d_strerror_r'
23149 d_strftime='$d_strftime'
23150 d_strlcat='$d_strlcat'
23151 d_strlcpy='$d_strlcpy'
23152 d_strtod='$d_strtod'
23153 d_strtol='$d_strtol'
23154 d_strtold='$d_strtold'
23155 d_strtoll='$d_strtoll'
23156 d_strtoq='$d_strtoq'
23157 d_strtoul='$d_strtoul'
23158 d_strtoull='$d_strtoull'
23159 d_strtouq='$d_strtouq'
23160 d_strxfrm='$d_strxfrm'
23161 d_suidsafe='$d_suidsafe'
23162 d_symlink='$d_symlink'
23163 d_syscall='$d_syscall'
23164 d_syscallproto='$d_syscallproto'
23165 d_sysconf='$d_sysconf'
23166 d_sysernlst='$d_sysernlst'
23167 d_syserrlst='$d_syserrlst'
23168 d_system='$d_system'
23169 d_tcgetpgrp='$d_tcgetpgrp'
23170 d_tcsetpgrp='$d_tcsetpgrp'
23171 d_telldir='$d_telldir'
23172 d_telldirproto='$d_telldirproto'
23173 d_time='$d_time'
23174 d_timegm='$d_timegm'
23175 d_times='$d_times'
23176 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23177 d_tm_tm_zone='$d_tm_tm_zone'
23178 d_tmpnam_r='$d_tmpnam_r'
23179 d_truncate='$d_truncate'
23180 d_ttyname_r='$d_ttyname_r'
23181 d_tzname='$d_tzname'
23182 d_u32align='$d_u32align'
23183 d_ualarm='$d_ualarm'
23184 d_umask='$d_umask'
23185 d_uname='$d_uname'
23186 d_union_semun='$d_union_semun'
23187 d_unordered='$d_unordered'
23188 d_unsetenv='$d_unsetenv'
23189 d_usleep='$d_usleep'
23190 d_usleepproto='$d_usleepproto'
23191 d_ustat='$d_ustat'
23192 d_vendorarch='$d_vendorarch'
23193 d_vendorbin='$d_vendorbin'
23194 d_vendorlib='$d_vendorlib'
23195 d_vendorscript='$d_vendorscript'
23196 d_vfork='$d_vfork'
23197 d_void_closedir='$d_void_closedir'
23198 d_voidsig='$d_voidsig'
23199 d_voidtty='$d_voidtty'
23200 d_volatile='$d_volatile'
23201 d_vprintf='$d_vprintf'
23202 d_vsnprintf='$d_vsnprintf'
23203 d_wait4='$d_wait4'
23204 d_waitpid='$d_waitpid'
23205 d_wcstombs='$d_wcstombs'
23206 d_wctomb='$d_wctomb'
23207 d_writev='$d_writev'
23208 d_xenix='$d_xenix'
23209 date='$date'
23210 db_hashtype='$db_hashtype'
23211 db_prefixtype='$db_prefixtype'
23212 db_version_major='$db_version_major'
23213 db_version_minor='$db_version_minor'
23214 db_version_patch='$db_version_patch'
23215 defvoidused='$defvoidused'
23216 direntrytype='$direntrytype'
23217 dlext='$dlext'
23218 dlsrc='$dlsrc'
23219 doublesize='$doublesize'
23220 drand01='$drand01'
23221 drand48_r_proto='$drand48_r_proto'
23222 dtrace='$dtrace'
23223 dynamic_ext='$dynamic_ext'
23224 eagain='$eagain'
23225 ebcdic='$ebcdic'
23226 echo='$echo'
23227 egrep='$egrep'
23228 emacs='$emacs'
23229 endgrent_r_proto='$endgrent_r_proto'
23230 endhostent_r_proto='$endhostent_r_proto'
23231 endnetent_r_proto='$endnetent_r_proto'
23232 endprotoent_r_proto='$endprotoent_r_proto'
23233 endpwent_r_proto='$endpwent_r_proto'
23234 endservent_r_proto='$endservent_r_proto'
23235 eunicefix='$eunicefix'
23236 exe_ext='$exe_ext'
23237 expr='$expr'
23238 extensions='$extensions'
23239 extern_C='$extern_C'
23240 extras='$extras'
23241 fflushNULL='$fflushNULL'
23242 fflushall='$fflushall'
23243 find='$find'
23244 firstmakefile='$firstmakefile'
23245 flex='$flex'
23246 fpossize='$fpossize'
23247 fpostype='$fpostype'
23248 freetype='$freetype'
23249 from='$from'
23250 full_ar='$full_ar'
23251 full_csh='$full_csh'
23252 full_sed='$full_sed'
23253 gccansipedantic='$gccansipedantic'
23254 gccosandvers='$gccosandvers'
23255 gccversion='$gccversion'
23256 getgrent_r_proto='$getgrent_r_proto'
23257 getgrgid_r_proto='$getgrgid_r_proto'
23258 getgrnam_r_proto='$getgrnam_r_proto'
23259 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23260 gethostbyname_r_proto='$gethostbyname_r_proto'
23261 gethostent_r_proto='$gethostent_r_proto'
23262 getlogin_r_proto='$getlogin_r_proto'
23263 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23264 getnetbyname_r_proto='$getnetbyname_r_proto'
23265 getnetent_r_proto='$getnetent_r_proto'
23266 getprotobyname_r_proto='$getprotobyname_r_proto'
23267 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23268 getprotoent_r_proto='$getprotoent_r_proto'
23269 getpwent_r_proto='$getpwent_r_proto'
23270 getpwnam_r_proto='$getpwnam_r_proto'
23271 getpwuid_r_proto='$getpwuid_r_proto'
23272 getservbyname_r_proto='$getservbyname_r_proto'
23273 getservbyport_r_proto='$getservbyport_r_proto'
23274 getservent_r_proto='$getservent_r_proto'
23275 getspnam_r_proto='$getspnam_r_proto'
23276 gidformat='$gidformat'
23277 gidsign='$gidsign'
23278 gidsize='$gidsize'
23279 gidtype='$gidtype'
23280 glibpth='$glibpth'
23281 gmake='$gmake'
23282 gmtime_r_proto='$gmtime_r_proto'
23283 gnulibc_version='$gnulibc_version'
23284 grep='$grep'
23285 groupcat='$groupcat'
23286 groupstype='$groupstype'
23287 gzip='$gzip'
23288 h_fcntl='$h_fcntl'
23289 h_sysfile='$h_sysfile'
23290 hint='$hint'
23291 hostcat='$hostcat'
23292 html1dir='$html1dir'
23293 html1direxp='$html1direxp'
23294 html3dir='$html3dir'
23295 html3direxp='$html3direxp'
23296 i16size='$i16size'
23297 i16type='$i16type'
23298 i32size='$i32size'
23299 i32type='$i32type'
23300 i64size='$i64size'
23301 i64type='$i64type'
23302 i8size='$i8size'
23303 i8type='$i8type'
23304 i_arpainet='$i_arpainet'
23305 i_assert='$i_assert'
23306 i_bsdioctl='$i_bsdioctl'
23307 i_crypt='$i_crypt'
23308 i_db='$i_db'
23309 i_dbm='$i_dbm'
23310 i_dirent='$i_dirent'
23311 i_dld='$i_dld'
23312 i_dlfcn='$i_dlfcn'
23313 i_fcntl='$i_fcntl'
23314 i_float='$i_float'
23315 i_fp='$i_fp'
23316 i_fp_class='$i_fp_class'
23317 i_gdbm='$i_gdbm'
23318 i_gdbm_ndbm='$i_gdbm_ndbm'
23319 i_gdbmndbm='$i_gdbmndbm'
23320 i_grp='$i_grp'
23321 i_ieeefp='$i_ieeefp'
23322 i_inttypes='$i_inttypes'
23323 i_langinfo='$i_langinfo'
23324 i_libutil='$i_libutil'
23325 i_limits='$i_limits'
23326 i_locale='$i_locale'
23327 i_machcthr='$i_machcthr'
23328 i_malloc='$i_malloc'
23329 i_mallocmalloc='$i_mallocmalloc'
23330 i_math='$i_math'
23331 i_memory='$i_memory'
23332 i_mntent='$i_mntent'
23333 i_ndbm='$i_ndbm'
23334 i_netdb='$i_netdb'
23335 i_neterrno='$i_neterrno'
23336 i_netinettcp='$i_netinettcp'
23337 i_niin='$i_niin'
23338 i_poll='$i_poll'
23339 i_prot='$i_prot'
23340 i_pthread='$i_pthread'
23341 i_pwd='$i_pwd'
23342 i_rpcsvcdbm='$i_rpcsvcdbm'
23343 i_sfio='$i_sfio'
23344 i_sgtty='$i_sgtty'
23345 i_shadow='$i_shadow'
23346 i_socks='$i_socks'
23347 i_stdarg='$i_stdarg'
23348 i_stdbool='$i_stdbool'
23349 i_stddef='$i_stddef'
23350 i_stdlib='$i_stdlib'
23351 i_string='$i_string'
23352 i_sunmath='$i_sunmath'
23353 i_sysaccess='$i_sysaccess'
23354 i_sysdir='$i_sysdir'
23355 i_sysfile='$i_sysfile'
23356 i_sysfilio='$i_sysfilio'
23357 i_sysin='$i_sysin'
23358 i_sysioctl='$i_sysioctl'
23359 i_syslog='$i_syslog'
23360 i_sysmman='$i_sysmman'
23361 i_sysmode='$i_sysmode'
23362 i_sysmount='$i_sysmount'
23363 i_sysndir='$i_sysndir'
23364 i_sysparam='$i_sysparam'
23365 i_syspoll='$i_syspoll'
23366 i_sysresrc='$i_sysresrc'
23367 i_syssecrt='$i_syssecrt'
23368 i_sysselct='$i_sysselct'
23369 i_syssockio='$i_syssockio'
23370 i_sysstat='$i_sysstat'
23371 i_sysstatfs='$i_sysstatfs'
23372 i_sysstatvfs='$i_sysstatvfs'
23373 i_systime='$i_systime'
23374 i_systimek='$i_systimek'
23375 i_systimes='$i_systimes'
23376 i_systypes='$i_systypes'
23377 i_sysuio='$i_sysuio'
23378 i_sysun='$i_sysun'
23379 i_sysutsname='$i_sysutsname'
23380 i_sysvfs='$i_sysvfs'
23381 i_syswait='$i_syswait'
23382 i_termio='$i_termio'
23383 i_termios='$i_termios'
23384 i_time='$i_time'
23385 i_unistd='$i_unistd'
23386 i_ustat='$i_ustat'
23387 i_utime='$i_utime'
23388 i_values='$i_values'
23389 i_varargs='$i_varargs'
23390 i_varhdr='$i_varhdr'
23391 i_vfork='$i_vfork'
23392 ignore_versioned_solibs='$ignore_versioned_solibs'
23393 inc_version_list='$inc_version_list'
23394 inc_version_list_init='$inc_version_list_init'
23395 incpath='$incpath'
23396 inews='$inews'
23397 initialinstalllocation='$initialinstalllocation'
23398 installarchlib='$installarchlib'
23399 installbin='$installbin'
23400 installhtml1dir='$installhtml1dir'
23401 installhtml3dir='$installhtml3dir'
23402 installman1dir='$installman1dir'
23403 installman3dir='$installman3dir'
23404 installprefix='$installprefix'
23405 installprefixexp='$installprefixexp'
23406 installprivlib='$installprivlib'
23407 installscript='$installscript'
23408 installsitearch='$installsitearch'
23409 installsitebin='$installsitebin'
23410 installsitehtml1dir='$installsitehtml1dir'
23411 installsitehtml3dir='$installsitehtml3dir'
23412 installsitelib='$installsitelib'
23413 installsiteman1dir='$installsiteman1dir'
23414 installsiteman3dir='$installsiteman3dir'
23415 installsitescript='$installsitescript'
23416 installstyle='$installstyle'
23417 installusrbinperl='$installusrbinperl'
23418 installvendorarch='$installvendorarch'
23419 installvendorbin='$installvendorbin'
23420 installvendorhtml1dir='$installvendorhtml1dir'
23421 installvendorhtml3dir='$installvendorhtml3dir'
23422 installvendorlib='$installvendorlib'
23423 installvendorman1dir='$installvendorman1dir'
23424 installvendorman3dir='$installvendorman3dir'
23425 installvendorscript='$installvendorscript'
23426 intsize='$intsize'
23427 issymlink='$issymlink'
23428 ivdformat='$ivdformat'
23429 ivsize='$ivsize'
23430 ivtype='$ivtype'
23431 known_extensions='$known_extensions'
23432 ksh='$ksh'
23433 ld='$ld'
23434 lddlflags='$lddlflags'
23435 ldflags='$ldflags'
23436 ldflags_uselargefiles='$ldflags_uselargefiles'
23437 ldlibpthname='$ldlibpthname'
23438 less='$less'
23439 lib_ext='$lib_ext'
23440 libc='$libc'
23441 libperl='$libperl'
23442 libpth='$libpth'
23443 libs='$libs'
23444 libsdirs='$libsdirs'
23445 libsfiles='$libsfiles'
23446 libsfound='$libsfound'
23447 libspath='$libspath'
23448 libswanted='$libswanted'
23449 libswanted_uselargefiles='$libswanted_uselargefiles'
23450 line='$line'
23451 lint='$lint'
23452 lkflags='$lkflags'
23453 ln='$ln'
23454 lns='$lns'
23455 localtime_r_proto='$localtime_r_proto'
23456 locincpth='$locincpth'
23457 loclibpth='$loclibpth'
23458 longdblsize='$longdblsize'
23459 longlongsize='$longlongsize'
23460 longsize='$longsize'
23461 lp='$lp'
23462 lpr='$lpr'
23463 ls='$ls'
23464 lseeksize='$lseeksize'
23465 lseektype='$lseektype'
23466 mad='$mad'
23467 madlyh='$madlyh'
23468 madlyobj='$madlyobj'
23469 madlysrc='$madlysrc'
23470 mail='$mail'
23471 mailx='$mailx'
23472 make='$make'
23473 make_set_make='$make_set_make'
23474 mallocobj='$mallocobj'
23475 mallocsrc='$mallocsrc'
23476 malloctype='$malloctype'
23477 man1dir='$man1dir'
23478 man1direxp='$man1direxp'
23479 man1ext='$man1ext'
23480 man3dir='$man3dir'
23481 man3direxp='$man3direxp'
23482 man3ext='$man3ext'
23483 mips_type='$mips_type'
23484 mistrustnm='$mistrustnm'
23485 mkdir='$mkdir'
23486 mmaptype='$mmaptype'
23487 modetype='$modetype'
23488 more='$more'
23489 multiarch='$multiarch'
23490 mv='$mv'
23491 myarchname='$myarchname'
23492 mydomain='$mydomain'
23493 myhostname='$myhostname'
23494 myuname='$myuname'
23495 n='$n'
23496 need_va_copy='$need_va_copy'
23497 netdb_hlen_type='$netdb_hlen_type'
23498 netdb_host_type='$netdb_host_type'
23499 netdb_name_type='$netdb_name_type'
23500 netdb_net_type='$netdb_net_type'
23501 nm='$nm'
23502 nm_opt='$nm_opt'
23503 nm_so_opt='$nm_so_opt'
23504 nonxs_ext='$nonxs_ext'
23505 nroff='$nroff'
23506 nvEUformat='$nvEUformat'
23507 nvFUformat='$nvFUformat'
23508 nvGUformat='$nvGUformat'
23509 nv_overflows_integers_at='$nv_overflows_integers_at'
23510 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23511 nveformat='$nveformat'
23512 nvfformat='$nvfformat'
23513 nvgformat='$nvgformat'
23514 nvsize='$nvsize'
23515 nvtype='$nvtype'
23516 o_nonblock='$o_nonblock'
23517 obj_ext='$obj_ext'
23518 old_pthread_create_joinable='$old_pthread_create_joinable'
23519 optimize='$optimize'
23520 orderlib='$orderlib'
23521 osname='$osname'
23522 osvers='$osvers'
23523 otherlibdirs='$otherlibdirs'
23524 package='$package'
23525 pager='$pager'
23526 passcat='$passcat'
23527 patchlevel='$patchlevel'
23528 path_sep='$path_sep'
23529 perl5='$perl5'
23530 perl='$perl'
23531 perl_patchlevel='$perl_patchlevel'
23532 perl_static_inline='$perl_static_inline'
23533 perladmin='$perladmin'
23534 perllibs='$perllibs'
23535 perlpath='$perlpath'
23536 pg='$pg'
23537 phostname='$phostname'
23538 pidtype='$pidtype'
23539 plibpth='$plibpth'
23540 pmake='$pmake'
23541 pr='$pr'
23542 prefix='$prefix'
23543 prefixexp='$prefixexp'
23544 privlib='$privlib'
23545 privlibexp='$privlibexp'
23546 procselfexe='$procselfexe'
23547 prototype='$prototype'
23548 ptrsize='$ptrsize'
23549 quadkind='$quadkind'
23550 quadtype='$quadtype'
23551 randbits='$randbits'
23552 randfunc='$randfunc'
23553 random_r_proto='$random_r_proto'
23554 randseedtype='$randseedtype'
23555 ranlib='$ranlib'
23556 rd_nodata='$rd_nodata'
23557 readdir64_r_proto='$readdir64_r_proto'
23558 readdir_r_proto='$readdir_r_proto'
23559 revision='$revision'
23560 rm='$rm'
23561 rm_try='$rm_try'
23562 rmail='$rmail'
23563 run='$run'
23564 runnm='$runnm'
23565 sGMTIME_max='$sGMTIME_max'
23566 sGMTIME_min='$sGMTIME_min'
23567 sLOCALTIME_max='$sLOCALTIME_max'
23568 sLOCALTIME_min='$sLOCALTIME_min'
23569 sPRIEUldbl='$sPRIEUldbl'
23570 sPRIFUldbl='$sPRIFUldbl'
23571 sPRIGUldbl='$sPRIGUldbl'
23572 sPRIXU64='$sPRIXU64'
23573 sPRId64='$sPRId64'
23574 sPRIeldbl='$sPRIeldbl'
23575 sPRIfldbl='$sPRIfldbl'
23576 sPRIgldbl='$sPRIgldbl'
23577 sPRIi64='$sPRIi64'
23578 sPRIo64='$sPRIo64'
23579 sPRIu64='$sPRIu64'
23580 sPRIx64='$sPRIx64'
23581 sSCNfldbl='$sSCNfldbl'
23582 sched_yield='$sched_yield'
23583 scriptdir='$scriptdir'
23584 scriptdirexp='$scriptdirexp'
23585 sed='$sed'
23586 seedfunc='$seedfunc'
23587 selectminbits='$selectminbits'
23588 selecttype='$selecttype'
23589 sendmail='$sendmail'
23590 setgrent_r_proto='$setgrent_r_proto'
23591 sethostent_r_proto='$sethostent_r_proto'
23592 setlocale_r_proto='$setlocale_r_proto'
23593 setnetent_r_proto='$setnetent_r_proto'
23594 setprotoent_r_proto='$setprotoent_r_proto'
23595 setpwent_r_proto='$setpwent_r_proto'
23596 setservent_r_proto='$setservent_r_proto'
23597 sh='$sh'
23598 shar='$shar'
23599 sharpbang='$sharpbang'
23600 shmattype='$shmattype'
23601 shortsize='$shortsize'
23602 shrpenv='$shrpenv'
23603 shsharp='$shsharp'
23604 sig_count='$sig_count'
23605 sig_name='$sig_name'
23606 sig_name_init='$sig_name_init'
23607 sig_num='$sig_num'
23608 sig_num_init='$sig_num_init'
23609 sig_size='$sig_size'
23610 signal_t='$signal_t'
23611 sitearch='$sitearch'
23612 sitearchexp='$sitearchexp'
23613 sitebin='$sitebin'
23614 sitebinexp='$sitebinexp'
23615 sitehtml1dir='$sitehtml1dir'
23616 sitehtml1direxp='$sitehtml1direxp'
23617 sitehtml3dir='$sitehtml3dir'
23618 sitehtml3direxp='$sitehtml3direxp'
23619 sitelib='$sitelib'
23620 sitelib_stem='$sitelib_stem'
23621 sitelibexp='$sitelibexp'
23622 siteman1dir='$siteman1dir'
23623 siteman1direxp='$siteman1direxp'
23624 siteman3dir='$siteman3dir'
23625 siteman3direxp='$siteman3direxp'
23626 siteprefix='$siteprefix'
23627 siteprefixexp='$siteprefixexp'
23628 sitescript='$sitescript'
23629 sitescriptexp='$sitescriptexp'
23630 sizesize='$sizesize'
23631 sizetype='$sizetype'
23632 sleep='$sleep'
23633 smail='$smail'
23634 so='$so'
23635 sockethdr='$sockethdr'
23636 socketlib='$socketlib'
23637 socksizetype='$socksizetype'
23638 sort='$sort'
23639 spackage='$spackage'
23640 spitshell='$spitshell'
23641 srand48_r_proto='$srand48_r_proto'
23642 srandom_r_proto='$srandom_r_proto'
23643 src='$src'
23644 ssizetype='$ssizetype'
23645 st_ino_sign='$st_ino_sign'
23646 st_ino_size='$st_ino_size'
23647 startperl='$startperl'
23648 startsh='$startsh'
23649 static_ext='$static_ext'
23650 stdchar='$stdchar'
23651 stdio_base='$stdio_base'
23652 stdio_bufsiz='$stdio_bufsiz'
23653 stdio_cnt='$stdio_cnt'
23654 stdio_filbuf='$stdio_filbuf'
23655 stdio_ptr='$stdio_ptr'
23656 stdio_stream_array='$stdio_stream_array'
23657 strerror_r_proto='$strerror_r_proto'
23658 strings='$strings'
23659 submit='$submit'
23660 subversion='$subversion'
23661 sysman='$sysman'
23662 tail='$tail'
23663 tar='$tar'
23664 targetarch='$targetarch'
23665 tbl='$tbl'
23666 tee='$tee'
23667 test='$test'
23668 timeincl='$timeincl'
23669 timetype='$timetype'
23670 tmpnam_r_proto='$tmpnam_r_proto'
23671 to='$to'
23672 touch='$touch'
23673 tr='$tr'
23674 trnl='$trnl'
23675 troff='$troff'
23676 ttyname_r_proto='$ttyname_r_proto'
23677 u16size='$u16size'
23678 u16type='$u16type'
23679 u32size='$u32size'
23680 u32type='$u32type'
23681 u64size='$u64size'
23682 u64type='$u64type'
23683 u8size='$u8size'
23684 u8type='$u8type'
23685 uidformat='$uidformat'
23686 uidsign='$uidsign'
23687 uidsize='$uidsize'
23688 uidtype='$uidtype'
23689 uname='$uname'
23690 uniq='$uniq'
23691 uquadtype='$uquadtype'
23692 use5005threads='$use5005threads'
23693 use64bitall='$use64bitall'
23694 use64bitint='$use64bitint'
23695 usecrosscompile='$usecrosscompile'
23696 usedevel='$usedevel'
23697 usedl='$usedl'
23698 usedtrace='$usedtrace'
23699 usefaststdio='$usefaststdio'
23700 useithreads='$useithreads'
23701 usekernprocpathname='$usekernprocpathname'
23702 uselargefiles='$uselargefiles'
23703 uselongdouble='$uselongdouble'
23704 usemallocwrap='$usemallocwrap'
23705 usemorebits='$usemorebits'
23706 usemultiplicity='$usemultiplicity'
23707 usemymalloc='$usemymalloc'
23708 usenm='$usenm'
23709 usensgetexecutablepath='$usensgetexecutablepath'
23710 useopcode='$useopcode'
23711 useperlio='$useperlio'
23712 useposix='$useposix'
23713 usereentrant='$usereentrant'
23714 userelocatableinc='$userelocatableinc'
23715 usesfio='$usesfio'
23716 useshrplib='$useshrplib'
23717 usesitecustomize='$usesitecustomize'
23718 usesocks='$usesocks'
23719 usethreads='$usethreads'
23720 usevendorprefix='$usevendorprefix'
23721 usevfork='$usevfork'
23722 usrinc='$usrinc'
23723 uuname='$uuname'
23724 uvXUformat='$uvXUformat'
23725 uvoformat='$uvoformat'
23726 uvsize='$uvsize'
23727 uvtype='$uvtype'
23728 uvuformat='$uvuformat'
23729 uvxformat='$uvxformat'
23730 vaproto='$vaproto'
23731 vendorarch='$vendorarch'
23732 vendorarchexp='$vendorarchexp'
23733 vendorbin='$vendorbin'
23734 vendorbinexp='$vendorbinexp'
23735 vendorhtml1dir='$vendorhtml1dir'
23736 vendorhtml1direxp='$vendorhtml1direxp'
23737 vendorhtml3dir='$vendorhtml3dir'
23738 vendorhtml3direxp='$vendorhtml3direxp'
23739 vendorlib='$vendorlib'
23740 vendorlib_stem='$vendorlib_stem'
23741 vendorlibexp='$vendorlibexp'
23742 vendorman1dir='$vendorman1dir'
23743 vendorman1direxp='$vendorman1direxp'
23744 vendorman3dir='$vendorman3dir'
23745 vendorman3direxp='$vendorman3direxp'
23746 vendorprefix='$vendorprefix'
23747 vendorprefixexp='$vendorprefixexp'
23748 vendorscript='$vendorscript'
23749 vendorscriptexp='$vendorscriptexp'
23750 version='$version'
23751 version_patchlevel_string='$version_patchlevel_string'
23752 versiononly='$versiononly'
23753 vi='$vi'
23754 voidflags='$voidflags'
23755 xlibpth='$xlibpth'
23756 yacc='$yacc'
23757 yaccflags='$yaccflags'
23758 zcat='$zcat'
23759 zip='$zip'
23760 EOT
23761
23762 : add special variables
23763 $test -f $src/patchlevel.h && \
23764 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23765 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23766 echo "PERL_CONFIG_SH=true" >>config.sh
23767
23768 : propagate old symbols
23769 if $test -f UU/config.sh; then
23770         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23771         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23772                 config.sh config.sh UU/oldconfig.sh |\
23773                 $sort | $uniq -u >UU/oldsyms
23774         set X `$cat UU/oldsyms`
23775         shift
23776         case $# in
23777         0) ;;
23778         *)
23779                 $cat <<EOM
23780 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23781 EOM
23782                 echo ": Variables propagated from previous config.sh file." >>config.sh
23783                 for sym in `$cat UU/oldsyms`; do
23784                         echo "    Propagating $hint variable "'$'"$sym..."
23785                         eval 'tmp="$'"${sym}"'"'
23786                         echo "$tmp" | \
23787                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23788                 done
23789                 ;;
23790         esac
23791 fi
23792
23793 : Finish up by extracting the .SH files
23794 case "$alldone" in
23795 exit)
23796         $rm -rf UU
23797         echo "Extraction done."
23798         exit 0
23799         ;;
23800 cont)
23801         ;;
23802 '')
23803         dflt=''
23804         nostick=true
23805         $cat <<EOM
23806
23807 If you'd like to make any changes to the config.sh file before I begin
23808 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23809
23810 EOM
23811         rp="Press return or use a shell escape to edit config.sh:"
23812         . UU/myread
23813         nostick=''
23814         case "$ans" in
23815         '') ;;
23816         *) : in case they cannot read
23817                 sh 1>&4 -c "$ans";;
23818         esac
23819         ;;
23820 esac
23821
23822 : if this fails, just run all the .SH files by hand
23823 . ./config.sh
23824
23825 echo " "
23826 exec 1>&4
23827 pwd=`pwd`
23828 . ./UU/extract
23829 cd "$pwd"
23830
23831 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23832         dflt=y
23833         case "$silent" in
23834         true) ;;
23835         *)
23836                 $cat <<EOM
23837
23838 Now you need to generate make dependencies by running "$make depend".
23839 You might prefer to run it in background: "$make depend > makedepend.out &"
23840 It can take a while, so you might not want to run it right now.
23841
23842 EOM
23843                 ;;
23844         esac
23845         rp="Run $make depend now?"
23846         . UU/myread
23847         case "$ans" in
23848         y*)
23849                 $make depend && echo "Now you must run '$make'."
23850                 ;;
23851         *)
23852                 echo "You must run '$make depend' then '$make'."
23853                 ;;
23854         esac
23855 elif test -f [Mm]akefile; then
23856         echo " "
23857         echo "Now you must run a $make."
23858 else
23859         echo "Configure done."
23860 fi
23861
23862 if $test -f Policy.sh; then
23863     $cat <<EOM
23864
23865 If you compile $package on a different machine or from a different object
23866 directory, copy the Policy.sh file from this object directory to the
23867 new one before you run Configure -- this will help you with most of
23868 the policy defaults.
23869
23870 EOM
23871 fi
23872 if $test -f config.msg; then
23873     echo "Hmm.  I also noted the following information while running:"
23874     echo " "
23875     $cat config.msg >&4
23876     $rm -f config.msg
23877 fi
23878 $rm -f kit*isdone ark*isdone
23879 $rm -rf UU
23880
23881 : End of Configure
23882