This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for 9a0c99494c and 06b58b76f31
[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 Wed Jul 11 16:58:32 CEST 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_ip_mreq=''
727 d_ipv6_mreq=''
728 d_msg_ctrunc=''
729 d_msg_dontroute=''
730 d_msg_oob=''
731 d_msg_peek=''
732 d_msg_proxy=''
733 d_oldsock=''
734 d_scm_rights=''
735 d_sin6_scope_id=''
736 d_sockaddr_in6=''
737 d_sockaddr_sa_len=''
738 d_socket=''
739 d_sockpair=''
740 sockethdr=''
741 socketlib=''
742 d_socklen_t=''
743 d_socks5_init=''
744 d_sprintf_returns_strlen=''
745 d_sqrtl=''
746 d_srand48_r=''
747 srand48_r_proto=''
748 d_srandom_r=''
749 srandom_r_proto=''
750 d_sresgproto=''
751 d_sresuproto=''
752 d_statblks=''
753 d_statfs_f_flags=''
754 d_statfs_s=''
755 d_static_inline=''
756 perl_static_inline=''
757 d_fstatvfs=''
758 d_statvfs=''
759 d_stdio_cnt_lval=''
760 d_stdio_ptr_lval=''
761 d_stdio_ptr_lval_nochange_cnt=''
762 d_stdio_ptr_lval_sets_cnt=''
763 d_stdiobase=''
764 d_stdstdio=''
765 stdio_base=''
766 stdio_bufsiz=''
767 stdio_cnt=''
768 stdio_filbuf=''
769 stdio_ptr=''
770 d_index=''
771 d_strchr=''
772 d_strcoll=''
773 d_strctcpy=''
774 d_strerrm=''
775 d_strerror=''
776 d_sysernlst=''
777 d_syserrlst=''
778 d_strerror_r=''
779 strerror_r_proto=''
780 d_strftime=''
781 d_strlcat=''
782 d_strlcpy=''
783 d_strtod=''
784 d_strtol=''
785 d_strtold=''
786 d_strtoll=''
787 d_strtoq=''
788 d_strtoul=''
789 d_strtoull=''
790 d_strtouq=''
791 d_strxfrm=''
792 d_symlink=''
793 d_syscall=''
794 d_syscallproto=''
795 d_sysconf=''
796 d_system=''
797 d_tcgetpgrp=''
798 d_tcsetpgrp=''
799 d_telldirproto=''
800 d_time=''
801 timetype=''
802 d_asctime64=''
803 d_ctime64=''
804 d_difftime64=''
805 d_gmtime64=''
806 d_localtime64=''
807 d_mktime64=''
808 d_timegm=''
809 clocktype=''
810 d_times=''
811 d_tmpnam_r=''
812 tmpnam_r_proto=''
813 d_truncate=''
814 d_ttyname_r=''
815 ttyname_r_proto=''
816 d_tzname=''
817 d_u32align=''
818 d_ualarm=''
819 d_umask=''
820 d_semctl_semid_ds=''
821 d_semctl_semun=''
822 d_union_semun=''
823 d_unordered=''
824 d_unsetenv=''
825 d_usleep=''
826 d_usleepproto=''
827 d_ustat=''
828 d_pseudofork=''
829 d_vfork=''
830 usevfork=''
831 d_voidsig=''
832 signal_t=''
833 d_volatile=''
834 d_charvspr=''
835 d_vprintf=''
836 d_wait4=''
837 d_waitpid=''
838 d_wcstombs=''
839 d_wctomb=''
840 d_writev=''
841 dlext=''
842 bin_ELF=''
843 cccdlflags=''
844 ccdlflags=''
845 dlsrc=''
846 ld=''
847 ld_can_script=''
848 lddlflags=''
849 usedl=''
850 doublesize=''
851 ebcdic=''
852 fflushNULL=''
853 fflushall=''
854 fpossize=''
855 fpostype=''
856 gccansipedantic=''
857 gccosandvers=''
858 gccversion=''
859 gidformat=''
860 gidsign=''
861 gidsize=''
862 gidtype=''
863 groupstype=''
864 h_fcntl=''
865 h_sysfile=''
866 html1dir=''
867 html1direxp=''
868 installhtml1dir=''
869 html3dir=''
870 html3direxp=''
871 installhtml3dir=''
872 i_arpainet=''
873 i_assert=''
874 i_crypt=''
875 db_hashtype=''
876 db_prefixtype=''
877 db_version_major=''
878 db_version_minor=''
879 db_version_patch=''
880 i_db=''
881 i_dbm=''
882 i_rpcsvcdbm=''
883 d_dirnamlen=''
884 direntrytype=''
885 i_dirent=''
886 i_dld=''
887 i_dlfcn=''
888 i_fcntl=''
889 i_float=''
890 i_fp=''
891 i_fp_class=''
892 i_gdbm=''
893 d_grpasswd=''
894 i_grp=''
895 i_ieeefp=''
896 i_inttypes=''
897 i_langinfo=''
898 i_libutil=''
899 i_limits=''
900 i_locale=''
901 i_machcthr=''
902 i_malloc=''
903 i_mallocmalloc=''
904 i_math=''
905 i_memory=''
906 i_mntent=''
907 d_gdbm_ndbm_h_uses_prototypes=''
908 d_gdbmndbm_h_uses_prototypes=''
909 d_ndbm=''
910 d_ndbm_h_uses_prototypes=''
911 i_gdbm_ndbm=''
912 i_gdbmndbm=''
913 i_ndbm=''
914 i_netdb=''
915 i_neterrno=''
916 i_netinettcp=''
917 i_niin=''
918 i_sysin=''
919 i_poll=''
920 i_prot=''
921 i_pthread=''
922 d_pwage=''
923 d_pwchange=''
924 d_pwclass=''
925 d_pwcomment=''
926 d_pwexpire=''
927 d_pwgecos=''
928 d_pwpasswd=''
929 d_pwquota=''
930 i_pwd=''
931 i_sfio=''
932 i_shadow=''
933 i_socks=''
934 i_stdbool=''
935 i_stddef=''
936 i_stdlib=''
937 i_string=''
938 strings=''
939 i_sunmath=''
940 i_sysaccess=''
941 i_sysdir=''
942 i_sysfile=''
943 d_voidtty=''
944 i_bsdioctl=''
945 i_sysfilio=''
946 i_sysioctl=''
947 i_syssockio=''
948 i_syslog=''
949 i_sysmman=''
950 i_sysmode=''
951 i_sysmount=''
952 i_sysndir=''
953 i_sysparam=''
954 i_syspoll=''
955 i_sysresrc=''
956 i_syssecrt=''
957 i_sysselct=''
958 i_sysstat=''
959 i_sysstatfs=''
960 i_sysstatvfs=''
961 i_systimes=''
962 i_systypes=''
963 i_sysuio=''
964 i_sysun=''
965 i_sysutsname=''
966 i_sysvfs=''
967 i_syswait=''
968 i_sgtty=''
969 i_termio=''
970 i_termios=''
971 d_tm_tm_gmtoff=''
972 d_tm_tm_zone=''
973 i_systime=''
974 i_systimek=''
975 i_time=''
976 timeincl=''
977 i_unistd=''
978 i_ustat=''
979 i_utime=''
980 i_values=''
981 i_stdarg=''
982 i_varargs=''
983 i_varhdr=''
984 i_vfork=''
985 d_inc_version_list=''
986 inc_version_list=''
987 inc_version_list_init=''
988 installprefix=''
989 installprefixexp=''
990 installstyle=''
991 installusrbinperl=''
992 intsize=''
993 longsize=''
994 shortsize=''
995 issymlink=''
996 libc=''
997 ldlibpthname=''
998 libperl=''
999 shrpenv=''
1000 useshrplib=''
1001 glibpth=''
1002 libpth=''
1003 loclibpth=''
1004 plibpth=''
1005 xlibpth=''
1006 ignore_versioned_solibs=''
1007 libs=''
1008 libsdirs=''
1009 libsfiles=''
1010 libsfound=''
1011 libspath=''
1012 lns=''
1013 d_PRIEUldbl=''
1014 d_PRIFUldbl=''
1015 d_PRIGUldbl=''
1016 d_PRIeldbl=''
1017 d_PRIfldbl=''
1018 d_PRIgldbl=''
1019 d_SCNfldbl=''
1020 sPRIEUldbl=''
1021 sPRIFUldbl=''
1022 sPRIGUldbl=''
1023 sPRIeldbl=''
1024 sPRIfldbl=''
1025 sPRIgldbl=''
1026 sSCNfldbl=''
1027 lseeksize=''
1028 lseektype=''
1029 mad=''
1030 madlyh=''
1031 madlyobj=''
1032 madlysrc=''
1033 make_set_make=''
1034 d_mymalloc=''
1035 freetype=''
1036 mallocobj=''
1037 mallocsrc=''
1038 malloctype=''
1039 usemallocwrap=''
1040 usemymalloc=''
1041 installman1dir=''
1042 man1dir=''
1043 man1direxp=''
1044 man1ext=''
1045 installman3dir=''
1046 man3dir=''
1047 man3direxp=''
1048 man3ext=''
1049 modetype=''
1050 multiarch=''
1051 mydomain=''
1052 myhostname=''
1053 phostname=''
1054 c=''
1055 n=''
1056 d_eofnblk=''
1057 eagain=''
1058 o_nonblock=''
1059 rd_nodata=''
1060 need_va_copy=''
1061 netdb_hlen_type=''
1062 netdb_host_type=''
1063 netdb_name_type=''
1064 netdb_net_type=''
1065 groupcat=''
1066 hostcat=''
1067 passcat=''
1068 orderlib=''
1069 ranlib=''
1070 d_perl_otherlibdirs=''
1071 otherlibdirs=''
1072 package=''
1073 spackage=''
1074 pager=''
1075 api_revision=''
1076 api_subversion=''
1077 api_version=''
1078 api_versionstring=''
1079 patchlevel=''
1080 perl_patchlevel=''
1081 revision=''
1082 subversion=''
1083 version=''
1084 version_patchlevel_string=''
1085 perl5=''
1086 perladmin=''
1087 perlpath=''
1088 d_nv_preserves_uv=''
1089 d_nv_zero_is_allbits_zero=''
1090 i16size=''
1091 i16type=''
1092 i32size=''
1093 i32type=''
1094 i64size=''
1095 i64type=''
1096 i8size=''
1097 i8type=''
1098 ivsize=''
1099 ivtype=''
1100 nv_overflows_integers_at=''
1101 nv_preserves_uv_bits=''
1102 nvsize=''
1103 nvtype=''
1104 u16size=''
1105 u16type=''
1106 u32size=''
1107 u32type=''
1108 u64size=''
1109 u64type=''
1110 u8size=''
1111 u8type=''
1112 uvsize=''
1113 uvtype=''
1114 ivdformat=''
1115 nvEUformat=''
1116 nvFUformat=''
1117 nvGUformat=''
1118 nveformat=''
1119 nvfformat=''
1120 nvgformat=''
1121 uvXUformat=''
1122 uvoformat=''
1123 uvuformat=''
1124 uvxformat=''
1125 pidtype=''
1126 prefix=''
1127 prefixexp=''
1128 installprivlib=''
1129 privlib=''
1130 privlibexp=''
1131 prototype=''
1132 ptrsize=''
1133 d_PRIXU64=''
1134 d_PRId64=''
1135 d_PRIi64=''
1136 d_PRIo64=''
1137 d_PRIu64=''
1138 d_PRIx64=''
1139 sPRIXU64=''
1140 sPRId64=''
1141 sPRIi64=''
1142 sPRIo64=''
1143 sPRIu64=''
1144 sPRIx64=''
1145 d_quad=''
1146 quadkind=''
1147 quadtype=''
1148 uquadtype=''
1149 drand01=''
1150 randbits=''
1151 randfunc=''
1152 randseedtype=''
1153 seedfunc=''
1154 installscript=''
1155 scriptdir=''
1156 scriptdirexp=''
1157 selectminbits=''
1158 selecttype=''
1159 sh=''
1160 sig_count=''
1161 sig_name=''
1162 sig_name_init=''
1163 sig_num=''
1164 sig_num_init=''
1165 sig_size=''
1166 d_sitearch=''
1167 installsitearch=''
1168 sitearch=''
1169 sitearchexp=''
1170 installsitebin=''
1171 sitebin=''
1172 sitebinexp=''
1173 installsitehtml1dir=''
1174 sitehtml1dir=''
1175 sitehtml1direxp=''
1176 installsitehtml3dir=''
1177 sitehtml3dir=''
1178 sitehtml3direxp=''
1179 installsitelib=''
1180 sitelib=''
1181 sitelib_stem=''
1182 sitelibexp=''
1183 installsiteman1dir=''
1184 siteman1dir=''
1185 siteman1direxp=''
1186 installsiteman3dir=''
1187 siteman3dir=''
1188 siteman3direxp=''
1189 siteprefix=''
1190 siteprefixexp=''
1191 installsitescript=''
1192 sitescript=''
1193 sitescriptexp=''
1194 sizesize=''
1195 sizetype=''
1196 so=''
1197 socksizetype=''
1198 sharpbang=''
1199 shsharp=''
1200 spitshell=''
1201 src=''
1202 ssizetype=''
1203 st_ino_sign=''
1204 st_ino_size=''
1205 startperl=''
1206 startsh=''
1207 stdchar=''
1208 d_stdio_stream_array=''
1209 stdio_stream_array=''
1210 sysman=''
1211 sGMTIME_max=''
1212 sGMTIME_min=''
1213 sLOCALTIME_max=''
1214 sLOCALTIME_min=''
1215 trnl=''
1216 uidformat=''
1217 uidsign=''
1218 uidsize=''
1219 uidtype=''
1220 archname64=''
1221 use64bitall=''
1222 use64bitint=''
1223 dtrace=''
1224 usedtrace=''
1225 usefaststdio=''
1226 usekernprocpathname=''
1227 ccflags_uselargefiles=''
1228 ldflags_uselargefiles=''
1229 libswanted_uselargefiles=''
1230 uselargefiles=''
1231 uselongdouble=''
1232 usemorebits=''
1233 usemultiplicity=''
1234 nm_opt=''
1235 nm_so_opt=''
1236 runnm=''
1237 usenm=''
1238 usensgetexecutablepath=''
1239 useperlio=''
1240 usesocks=''
1241 d_oldpthreads=''
1242 use5005threads=''
1243 useithreads=''
1244 usereentrant=''
1245 usethreads=''
1246 incpath=''
1247 mips_type=''
1248 usrinc=''
1249 vaproto=''
1250 d_vendorarch=''
1251 installvendorarch=''
1252 vendorarch=''
1253 vendorarchexp=''
1254 d_vendorbin=''
1255 installvendorbin=''
1256 vendorbin=''
1257 vendorbinexp=''
1258 installvendorhtml1dir=''
1259 vendorhtml1dir=''
1260 vendorhtml1direxp=''
1261 installvendorhtml3dir=''
1262 vendorhtml3dir=''
1263 vendorhtml3direxp=''
1264 d_vendorlib=''
1265 installvendorlib=''
1266 vendorlib=''
1267 vendorlib_stem=''
1268 vendorlibexp=''
1269 installvendorman1dir=''
1270 vendorman1dir=''
1271 vendorman1direxp=''
1272 installvendorman3dir=''
1273 vendorman3dir=''
1274 vendorman3direxp=''
1275 usevendorprefix=''
1276 vendorprefix=''
1277 vendorprefixexp=''
1278 d_vendorscript=''
1279 installvendorscript=''
1280 vendorscript=''
1281 vendorscriptexp=''
1282 versiononly=''
1283 defvoidused=''
1284 voidflags=''
1285 yacc=''
1286 yaccflags=''
1287 CONFIG=''
1288
1289 : Detect odd OSs
1290 define='define'
1291 undef='undef'
1292 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1293 rmlist=''
1294
1295 : We must find out about Eunice early
1296 eunicefix=':'
1297 if test -f /etc/unixtovms; then
1298         eunicefix=/etc/unixtovms
1299 fi
1300 if test -f /etc/unixtovms.exe; then
1301         eunicefix=/etc/unixtovms.exe
1302 fi
1303
1304 : Set executable suffix now -- needed before hints available
1305 if test -f "/libs/version.library"; then
1306 : Amiga OS
1307     _exe=""
1308 elif test -f "/system/gnu_library/bin/ar.pm"; then
1309 : Stratus VOS
1310     _exe=".pm"
1311 elif test -n "$DJGPP"; then
1312 : DOS DJGPP
1313     _exe=".exe"
1314 elif test -d c:/. -o -n "$is_os2" ; then
1315 : OS/2 or cygwin
1316     _exe=".exe"
1317 fi
1318
1319 groupstype=''
1320 i_whoami=''
1321 : Trailing extension.  Override this in a hint file, if needed.
1322 : Extra object files, if any, needed on this platform.
1323 archobjs=''
1324 archname=''
1325 : Possible local include directories to search.
1326 : Set locincpth to "" in a hint file to defeat local include searches.
1327 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1328 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1329 :
1330 : no include file wanted by default
1331 inclwanted=''
1332
1333 : Enable -DEBUGGING and -DDEBUGGING from the command line
1334 EBUGGING=''
1335 DEBUGGING=''
1336
1337 libnames=''
1338 : change the next line if compiling for Xenix/286 on Xenix/386
1339 xlibpth='/usr/lib/386 /lib/386'
1340 : Possible local library directories to search.
1341 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1342 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1343
1344 : general looking path for locating libraries
1345 glibpth="/lib /usr/lib $xlibpth"
1346 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1347 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1348 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1349 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1350
1351 : Private path used by Configure to find libraries.  Its value
1352 : is prepended to libpth. This variable takes care of special
1353 : machines, like the mips.  Usually, it should be empty.
1354 plibpth=''
1355
1356 : default library list
1357 libswanted=''
1358 : some systems want to use only the non-versioned libso:s
1359 ignore_versioned_solibs=''
1360 : set usethreads on the Configure command line to enable threads.
1361 usereentrant='undef'
1362 : full support for void wanted by default
1363 defvoidused=15
1364
1365 ccname=''
1366 ccversion=''
1367 perllibs=''
1368 : set useposix=false in your hint file to disable the POSIX extension.
1369 useposix=true
1370 : set useopcode=false in your hint file to disable the Opcode extension.
1371 useopcode=true
1372 archname64=''
1373 ccflags_uselargefiles=''
1374 ldflags_uselargefiles=''
1375 libswanted_uselargefiles=''
1376 : set usemultiplicity on the Configure command line to enable multiplicity.
1377 : set usesocks on the Configure command line to enable socks.
1378 : List of libraries we want.
1379 : If anyone needs extra -lxxx, put those in a hint file.
1380 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1381 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1382 : We probably want to search /usr/shlib before most other libraries.
1383 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1384 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1385 glibpth="/usr/shlib $glibpth"
1386 : Do not use vfork unless overridden by a hint file.
1387 usevfork=false
1388
1389 : Find the basic shell for Bourne shell scripts
1390 case "$sh" in
1391 '')
1392         case "$SYSTYPE" in
1393         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1394         *) xxx='/bin/sh';;
1395         esac
1396         if test -f "$xxx"; then
1397                 sh="$xxx"
1398         else
1399                 : Build up a list and do a single loop so we can 'break' out.
1400                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1401                 for xxx in sh bash ksh pdksh ash; do
1402                         for p in $pth; do
1403                                 try="$try ${p}/${xxx}"
1404                         done
1405                 done
1406                 for xxx in $try; do
1407                         if test -f "$xxx"; then
1408                                 sh="$xxx";
1409                                 break
1410                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1411                                 sh="$xxx";
1412                                 break
1413                         elif test -f "$xxx.exe"; then
1414                                 sh="$xxx";
1415                                 break
1416                         fi
1417                 done
1418         fi
1419         ;;
1420 esac
1421
1422 case "$sh" in
1423 '')     cat >&2 <<EOM
1424 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1425
1426 Usually it's in /bin/sh.  How did you even get this far?
1427 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1428 we'll try to straighten this all out.
1429 EOM
1430         exit 1
1431         ;;
1432 esac
1433
1434 : see if sh knows # comments
1435 if `$sh -c '#' >/dev/null 2>&1`; then
1436         shsharp=true
1437         spitshell=cat
1438         xcat=/bin/cat
1439         test -f $xcat$_exe || xcat=/usr/bin/cat
1440         if test ! -f $xcat$_exe; then
1441                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1442                         if test -f $p/cat$_exe; then
1443                                 xcat=$p/cat
1444                                 break
1445                         fi
1446                 done
1447                 if test ! -f $xcat$_exe; then
1448                         echo "Can't find cat anywhere!"
1449                         exit 1
1450                 fi
1451         fi
1452         echo "#!$xcat" >sharp
1453         $eunicefix sharp
1454         chmod +x sharp
1455         ./sharp > today 2>/dev/null
1456         if test -s today; then
1457                 sharpbang='#!'
1458         else
1459                 echo "#! $xcat" > sharp
1460                 $eunicefix sharp
1461                 chmod +x sharp
1462                 ./sharp > today 2>/dev/null
1463                 if test -s today; then
1464                         sharpbang='#! '
1465                 else
1466                         sharpbang=': use '
1467                 fi
1468         fi
1469 else
1470         echo " "
1471         echo "Your $sh doesn't grok # comments--I will strip them later on."
1472         shsharp=false
1473         cd ..
1474         echo "exec grep -v '^[  ]*#'" >spitshell
1475         chmod +x spitshell
1476         $eunicefix spitshell
1477         spitshell=`pwd`/spitshell
1478         cd UU
1479         echo "I presume that if # doesn't work, #! won't work either!"
1480         sharpbang=': use '
1481 fi
1482 rm -f sharp today
1483
1484 : figure out how to guarantee sh startup
1485 case "$startsh" in
1486 '') startsh=${sharpbang}${sh} ;;
1487 *)
1488 esac
1489 cat >sharp <<EOSS
1490 $startsh
1491 set abc
1492 test "$?abc" != 1
1493 EOSS
1494
1495 chmod +x sharp
1496 $eunicefix sharp
1497 if ./sharp; then
1498         : echo "Yup, it does."
1499 else
1500         echo "Hmm... '$startsh' does not guarantee sh startup..."
1501         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1502 fi
1503 rm -f sharp
1504
1505 : Save command line options in file UU/cmdline.opt for later use in
1506 : generating config.sh.
1507 cat > cmdline.opt <<EOSH
1508 : Configure command line arguments.
1509 config_arg0='$0'
1510 config_args='$*'
1511 config_argc=$#
1512 EOSH
1513 argn=1
1514 args_exp=''
1515 args_sep=''
1516 for arg in "$@"; do
1517         cat >>cmdline.opt <<EOSH
1518 config_arg$argn='$arg'
1519 EOSH
1520         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1521 $arg
1522 EOC
1523         arg_exp=`cat cmdl.opt`
1524         args_exp="$args_exp$args_sep'$arg_exp'"
1525         argn=`expr $argn + 1`
1526         args_sep=' '
1527 done
1528 rm -f cmdl.opt
1529
1530 : produce awk script to parse command line options
1531 cat >options.awk <<'EOF'
1532 BEGIN {
1533         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1534
1535         len = length(optstr);
1536         for (i = 1; i <= len; i++) {
1537                 c = substr(optstr, i, 1);
1538                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1539                 if (a == ":") {
1540                         arg[c] = 1;
1541                         i++;
1542                 }
1543                 opt[c] = 1;
1544         }
1545 }
1546 {
1547         expect = 0;
1548         str = $0;
1549         if (substr(str, 1, 1) != "-") {
1550                 printf("'%s'\n", str);
1551                 next;
1552         }
1553         len = length($0);
1554         for (i = 2; i <= len; i++) {
1555                 c = substr(str, i, 1);
1556                 if (!opt[c]) {
1557                         printf("-%s\n", substr(str, i));
1558                         next;
1559                 }
1560                 printf("-%s\n", c);
1561                 if (arg[c]) {
1562                         if (i < len)
1563                                 printf("'%s'\n", substr(str, i + 1));
1564                         else
1565                                 expect = 1;
1566                         next;
1567                 }
1568         }
1569 }
1570 END {
1571         if (expect)
1572                 print "?";
1573 }
1574 EOF
1575
1576 : process the command line options
1577 set X `for arg in "$@"; do echo "X$arg"; done |
1578         sed -e s/X// | awk -f options.awk`
1579 eval "set $*"
1580 shift
1581 rm -f options.awk
1582
1583 : set up default values
1584 fastread=''
1585 reuseval=false
1586 config_sh=''
1587 alldone=''
1588 error=''
1589 silent=''
1590 extractsh=''
1591 override=''
1592 knowitall=''
1593 rm -f optdef.sh posthint.sh
1594 cat >optdef.sh <<EOS
1595 $startsh
1596 EOS
1597
1598
1599 : option parsing
1600 while test $# -gt 0; do
1601         case "$1" in
1602         -d) shift; fastread=yes;;
1603         -e) shift; alldone=cont;;
1604         -f)
1605                 shift
1606                 cd ..
1607                 if test -r "$1"; then
1608                         config_sh="$1"
1609                 else
1610                         echo "$me: cannot read config file $1." >&2
1611                         error=true
1612                 fi
1613                 cd UU
1614                 shift;;
1615         --help|\
1616         -h) shift; error=true;;
1617         -r) shift; reuseval=true;;
1618         -s) shift; silent=true; realsilent=true;;
1619         -E) shift; alldone=exit;;
1620         -K) shift; knowitall=true;;
1621         -O) shift; override=true;;
1622         -S) shift; silent=true; extractsh=true;;
1623         -D)
1624                 shift
1625                 case "$1" in
1626                 *=)
1627                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1628                         echo "$me: ignoring -D $1" >&2
1629                         ;;
1630                 *=*) echo "$1" | \
1631                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1632                 *) echo "$1='define'" >> optdef.sh;;
1633                 esac
1634                 shift
1635                 ;;
1636         -U)
1637                 shift
1638                 case "$1" in
1639                 *=) echo "$1" >> optdef.sh;;
1640                 *=*)
1641                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1642                         echo "$me: ignoring -U $1" >&2
1643                         ;;
1644                 *) echo "$1='undef'" >> optdef.sh;;
1645                 esac
1646                 shift
1647                 ;;
1648         -A)
1649             shift
1650             xxx=''
1651             yyy="$1"
1652             zzz=''
1653             uuu=undef
1654             case "$yyy" in
1655             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1656                  case "$zzz" in
1657                  *:*) zzz='' ;;
1658                  *)   xxx=append
1659                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1660                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1661                  esac
1662                  ;;
1663             esac
1664             case "$xxx" in
1665             '')  case "$yyy" in
1666                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1667                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1668                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1669                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1670                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1671                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1672                  esac
1673                  ;;
1674             esac
1675             case "$xxx" in
1676             append)
1677                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1678             clear)
1679                 echo "$yyy=''"                  >> posthint.sh ;;
1680             define)
1681                 case "$zzz" in
1682                 '') zzz=define ;;
1683                 esac
1684                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1685             eval)
1686                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1687             prepend)
1688                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1689             undef)
1690                 case "$zzz" in
1691                 '') zzz="$uuu" ;;
1692                 esac
1693                 echo "$yyy=$zzz"                >> posthint.sh ;;
1694             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1695             esac
1696             shift
1697             ;;
1698         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1699             exit 0;;
1700         --) break;;
1701         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1702         *) break;;
1703         esac
1704 done
1705
1706 case "$error" in
1707 true)
1708         cat >&2 <<EOM
1709 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1710                  [-U symbol] [-U symbol=] [-A command:symbol...]
1711   -d : use defaults for all answers.
1712   -e : go on without questioning past the production of config.sh.
1713   -f : specify an alternate default configuration file.
1714   -h : print this help message and exit (with an error status).
1715   -r : reuse C symbols value if possible (skips costly nm extraction).
1716   -s : silent mode, only echoes questions and essential information.
1717   -D : define symbol to have some value:
1718          -D symbol         symbol gets the value 'define'
1719          -D symbol=value   symbol gets the value 'value'
1720        common used examples (see INSTALL for more info):
1721          -Duse64bitint            use 64bit integers
1722          -Duse64bitall            use 64bit integers and pointers
1723          -Dusethreads             use thread support
1724          -Dinc_version_list=none  do not include older perl trees in @INC
1725          -DEBUGGING=none          DEBUGGING options
1726          -Dcc=gcc                 choose your compiler
1727          -Dprefix=/opt/perl5      choose your destination
1728   -E : stop at the end of questions, after having produced config.sh.
1729   -K : do not use unless you know what you are doing.
1730   -O : let -D and -U override definitions from loaded configuration file.
1731   -S : perform variable substitutions on all .SH files (can mix with -f)
1732   -U : undefine symbol:
1733          -U symbol    symbol gets the value 'undef'
1734          -U symbol=   symbol gets completely empty
1735        e.g.:  -Uversiononly
1736   -A : manipulate symbol after the platform specific hints have been applied:
1737          -A append:symbol=value   append value to symbol
1738          -A symbol=value          like append:, but with a separating space
1739          -A define:symbol=value   define symbol to have value
1740          -A clear:symbol          define symbol to be ''
1741          -A define:symbol         define symbol to be 'define'
1742          -A eval:symbol=value     define symbol to be eval of value
1743          -A prepend:symbol=value  prepend value to symbol
1744          -A undef:symbol          define symbol to be 'undef'
1745          -A undef:symbol=         define symbol to be ''
1746        e.g.:  -A prepend:libswanted='cl pthread '
1747               -A ccflags=-DSOME_MACRO
1748   -V : print version number and exit (with a zero status).
1749 EOM
1750         exit 1
1751         ;;
1752 esac
1753
1754 : Sanity checks
1755 case "$fastread$alldone" in
1756 yescont|yesexit) ;;
1757 *)
1758         case "$extractsh" in
1759         true) ;;
1760         *)
1761                 if test ! -t 0; then
1762                         echo "Say 'sh Configure', not 'sh <Configure'"
1763                         exit 1
1764                 fi
1765                 ;;
1766         esac
1767         ;;
1768 esac
1769
1770 exec 4>&1
1771 case "$silent" in
1772 true) exec 1>/dev/null;;
1773 esac
1774
1775 : run the defines and the undefines, if any, but leave the file out there...
1776 touch optdef.sh
1777 . ./optdef.sh
1778 : create the posthint manipulation script and leave the file out there...
1779 touch posthint.sh
1780
1781 : set package name
1782 package='perl5'
1783 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1784 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1785 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1786 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1787 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1788 esac
1789
1790 : Some greps do not return status, grrr.
1791 echo "grimblepritz" >grimble
1792 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1793         contains=contains
1794 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1795         contains=grep
1796 else
1797         contains=contains
1798 fi
1799 rm -f grimble
1800 : the following should work in any shell
1801 case "$contains" in
1802 contains*)
1803         echo " "
1804         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1805         cat >contains <<'EOSS'
1806 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1807 EOSS
1808 chmod +x contains
1809 esac
1810
1811 : Find the path to the source tree
1812 case "$src" in
1813 '') case "$0" in
1814     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1815          case "$src" in
1816          /*)    ;;
1817          .)     ;;
1818          *)     src=`cd ../$src && pwd` ;;
1819          esac
1820          ;;
1821     *)   src='.';;
1822     esac;;
1823 esac
1824 case "$src" in
1825 '')     src=/
1826         rsrc=/
1827         ;;
1828 /*)     rsrc="$src";;
1829 *)      rsrc="../$src";;
1830 esac
1831 if test -f $rsrc/Configure && \
1832         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1833 then
1834    : found it, so we are ok.
1835 else
1836         rsrc=''
1837         for src in . .. ../.. ../../.. ../../../..; do
1838                 if test -f ../$src/Configure && \
1839                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1840                 then
1841                         rsrc=../$src
1842                         break
1843                 fi
1844         done
1845 fi
1846 case "$rsrc" in
1847 '')
1848         cat <<EOM >&4
1849
1850 Sorry, I can't seem to locate the source dir for $package.  Please start
1851 Configure with an explicit path -- i.e. /some/path/Configure.
1852
1853 EOM
1854         exit 1
1855         ;;
1856 ../.)   rsrc='..';;
1857 *)
1858         echo " "
1859         echo "Sources for $package found in \"$src\"." >&4
1860         ;;
1861 esac
1862
1863 : script used to extract .SH files with variable substitutions
1864 cat >extract <<'EOS'
1865 PERL_CONFIG_SH=true
1866 echo "Doing variable substitutions on .SH files..."
1867 if test -f MANIFEST; then
1868         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1869 else
1870         echo "(Looking for .SH files under the source directory.)"
1871         set x `(cd "$src"; find . -name "*.SH" -print)`
1872 fi
1873 shift
1874 case $# in
1875 0) set x `(cd "$src"; echo *.SH)`; shift;;
1876 esac
1877 if test ! -f "$src/$1"; then
1878         shift
1879 fi
1880 mkdir_p='
1881 name=$1;
1882 create="";
1883 while test $name; do
1884         if test ! -d "$name"; then
1885                 create="$name $create";
1886                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1887                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1888         else
1889                 name="";
1890         fi;
1891 done;
1892 for file in $create; do
1893         mkdir $file;
1894 done
1895 '
1896 for file in $*; do
1897         case "$src" in
1898         ".")
1899                 case "$file" in
1900                 */*)
1901                         dir=`expr X$file : 'X\(.*\)/'`
1902                         file=`expr X$file : 'X.*/\(.*\)'`
1903                         (cd "$dir" && . ./$file)
1904                         ;;
1905                 *)
1906                         . ./$file
1907                         ;;
1908                 esac
1909                 ;;
1910         *)
1911                 case "$file" in
1912                 */*)
1913                         dir=`expr X$file : 'X\(.*\)/'`
1914                         file=`expr X$file : 'X.*/\(.*\)'`
1915                         (set x $dir; shift; eval $mkdir_p)
1916                         sh <"$src/$dir/$file"
1917                         ;;
1918                 *)
1919                         sh <"$src/$file"
1920                         ;;
1921                 esac
1922                 ;;
1923         esac
1924 done
1925 if test -f "$src/config_h.SH"; then
1926         if test ! -f config.h; then
1927         : oops, they left it out of MANIFEST, probably, so do it anyway.
1928         . "$src/config_h.SH"
1929         fi
1930 fi
1931 EOS
1932
1933 : extract files and exit if asked to do so
1934 case "$extractsh" in
1935 true)
1936         case "$realsilent" in
1937         true) ;;
1938         *) exec 1>&4;;
1939         esac
1940         case "$config_sh" in
1941         '') config_sh='config.sh';;
1942         esac
1943         echo " "
1944         echo "Fetching answers from $config_sh..."
1945         cd ..
1946         . $config_sh
1947         test "$override" && . ./optdef.sh
1948         echo " "
1949         . UU/extract
1950         rm -rf UU
1951         echo "Extraction done."
1952         exit 0
1953         ;;
1954 esac
1955
1956 : Eunice requires " " instead of "", can you believe it
1957 echo " "
1958 : Here we go...
1959 echo "Beginning of configuration questions for $package."
1960
1961 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1962
1963 : first determine how to suppress newline on echo command
1964 echo " "
1965 echo "Checking echo to see how to suppress newlines..."
1966 (echo "hi there\c" ; echo " ") >.echotmp
1967 if $contains c .echotmp >/dev/null 2>&1 ; then
1968         echo "...using -n."
1969         n='-n'
1970         c=''
1971 else
1972         cat <<'EOM'
1973 ...using \c
1974 EOM
1975         n=''
1976         c='\c'
1977 fi
1978 echo $n "The star should be here-->$c"
1979 echo '*'
1980 rm -f .echotmp
1981
1982 : Now test for existence of everything in MANIFEST
1983 echo " "
1984 if test -f "$rsrc/MANIFEST"; then
1985         echo "First let's make sure your kit is complete.  Checking..." >&4
1986         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1987                 (split -l 50 2>/dev/null || split -50)
1988         rm -f missing
1989         tmppwd=`pwd`
1990         for filelist in x??; do
1991                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1992                         >/dev/null 2>>"$tmppwd/missing")
1993         done
1994         if test -s missing; then
1995                 cat missing >&4
1996                 cat >&4 <<'EOM'
1997
1998 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1999
2000 You have the option of continuing the configuration process, despite the
2001 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2002 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2003 and contact the author (perlbug@perl.org).
2004
2005 EOM
2006                 echo $n "Continue? [n] $c" >&4
2007                 read ans
2008                 case "$ans" in
2009                 y*)
2010                         echo "Continuing..." >&4
2011                         rm -f missing
2012                         ;;
2013                 *)
2014                         echo "ABORTING..." >&4
2015                         kill $$
2016                         ;;
2017                 esac
2018         else
2019                 echo "Looks good..."
2020         fi
2021 else
2022         echo "There is no MANIFEST file.  I hope your kit is complete !"
2023 fi
2024 rm -f missing x??
2025
2026 : Find the appropriate value for a newline for tr
2027 echo " "
2028 if test -n "$DJGPP"; then
2029        trnl='\012'
2030 fi
2031 if test X"$trnl" = X; then
2032         case "`echo foo|tr '\n' x 2>/dev/null`" in
2033         foox) trnl='\n' ;;
2034         esac
2035 fi
2036 if test X"$trnl" = X; then
2037         case "`echo foo|tr '\012' x 2>/dev/null`" in
2038         foox) trnl='\012' ;;
2039         esac
2040 fi
2041 if test X"$trnl" = X; then
2042        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2043        fooxy) trnl='\n\r' ;;
2044        esac
2045 fi
2046 if test X"$trnl" = X; then
2047         cat <<EOM >&2
2048
2049 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2050
2051 EOM
2052         exit 1
2053 fi
2054
2055 : compute the number of columns on the terminal for proper question formatting
2056 case "$COLUMNS" in
2057 '') COLUMNS='80';;
2058 esac
2059
2060 : set up the echo used in my read
2061 myecho="case \"\$xxxm\" in
2062 '') echo $n \"\$rp $c\" >&4;;
2063 *) case \"\$rp\" in
2064         '') echo $n \"[\$xxxm] $c\";;
2065         *)
2066                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2067                         echo \"\$rp\" >&4
2068                         echo $n \"[\$xxxm] $c\" >&4
2069                 else
2070                         echo $n \"\$rp [\$xxxm] $c\" >&4
2071                 fi
2072                 ;;
2073         esac;;
2074 esac"
2075
2076 : now set up to do reads with possible shell escape and default assignment
2077 cat <<EOSC >myread
2078 $startsh
2079 xxxm=\$dflt
2080 $myecho
2081 ans='!'
2082 case "\$fastread" in
2083 yes) case "\$dflt" in
2084         '') ;;
2085         *) ans='';
2086                 case "\$silent-\$rp" in
2087                 true-) ;;
2088                 *) echo " " >&4;;
2089                 esac;;
2090         esac;;
2091 *) case "\$silent" in
2092         true) case "\$rp" in
2093                 '') ans='';;
2094                 esac;;
2095         esac;;
2096 esac
2097 while expr "X\$ans" : "X!" >/dev/null; do
2098         read answ
2099         set x \$xxxm
2100         shift
2101         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2102         case  "\$answ" in
2103         "!")
2104                 sh 1>&4
2105                 echo " "
2106                 $myecho
2107                 ;;
2108         !*)
2109                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2110                 shift
2111                 sh 1>&4 -c "\$*"
2112                 echo " "
2113                 $myecho
2114                 ;;
2115         "\$ans")
2116                 case "\$ans" in
2117                 \\&*)
2118                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2119                         shift
2120                         case "\$1" in
2121                         -d)
2122                                 fastread=yes
2123                                 echo "(OK, I'll run with -d after this question.)" >&4
2124                                 ;;
2125                         -*)
2126                                 echo "*** Sorry, \$1 not supported yet." >&4
2127                                 ;;
2128                         esac
2129                         $myecho
2130                         ans=!
2131                         ;;
2132                 esac;;
2133         *)
2134                 case "\$aok" in
2135                 y)
2136                         echo "*** Substitution done -- please confirm."
2137                         xxxm="\$ans"
2138                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2139                         xxxm="\$ans"
2140                         ans=!
2141                         ;;
2142                 *)
2143                         echo "*** Error -- try again."
2144                         ans=!
2145                         ;;
2146                 esac
2147                 $myecho
2148                 ;;
2149         esac
2150         case "\$ans\$xxxm\$nostick" in
2151         '')
2152                 ans=!
2153                 $myecho
2154                 ;;
2155         esac
2156 done
2157 case "\$ans" in
2158 '') ans="\$xxxm";;
2159 esac
2160 EOSC
2161
2162 : create .config dir to save info across Configure sessions
2163 test -d ../.config || mkdir ../.config
2164 cat >../.config/README <<EOF
2165 This directory created by Configure to save information that should
2166 persist across sessions for $package.
2167
2168 You may safely delete it if you wish.
2169 EOF
2170
2171 : See if we are using a devel version and want that
2172 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2173 case "$usedevel" in
2174 $define|true|[yY]*)
2175     usedevel="$define" ;;
2176 *) case "$xversion" in
2177    *[13579])
2178         cat >&4 <<EOH
2179 *** WHOA THERE!!! ***
2180
2181     This is an UNSTABLE DEVELOPMENT release.
2182     The version of this $package distribution is $xversion, that is, odd,
2183     (as opposed to even) and that signifies a development release.
2184     If you want a maintenance release, you want an even-numbered version.
2185
2186     Do ***NOT*** install this into production use.
2187     Data corruption and crashes are possible.
2188
2189     It is most seriously suggested that you do not continue any further
2190     unless you want to help in developing and debugging Perl.
2191
2192     If you *still* want to build perl, you can answer 'y' now,
2193     or pass -Dusedevel to Configure.
2194
2195 EOH
2196         rp='Do you really want to continue?'
2197         dflt='n'
2198         . ./myread
2199         case "$ans" in
2200         [yY]) echo >&4 "Okay, continuing."
2201               usedevel="$define" ;;
2202         *) echo >&4 "Okay, bye."
2203            exit 1
2204            ;;
2205         esac
2206         ;;
2207     esac
2208     usedevel="$undef"
2209     ;;
2210 esac
2211 case "$usedevel" in
2212 $define|true|[yY]*)
2213         case "$versiononly" in
2214         '') versiononly="$define" ;;
2215         esac
2216         case "$installusrbinperl" in
2217         '') installusrbinperl="$undef" ;;
2218         esac
2219         ;;
2220 esac
2221
2222 : general instructions
2223 needman=true
2224 firsttime=true
2225 user=`(logname) 2>/dev/null`
2226 case "$user" in
2227 '') user=`whoami 2>&1`;;
2228 esac
2229 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2230         firsttime=false
2231         echo " "
2232         rp='Would you like to see the instructions?'
2233         dflt=n
2234         . ./myread
2235         case "$ans" in
2236         [yY]*) ;;
2237         *) needman=false;;
2238         esac
2239 fi
2240 if $needman; then
2241         cat <<EOH
2242
2243 This installation shell script will examine your system and ask you questions
2244 to determine how the perl5 package should be installed. If you get
2245 stuck on a question, you may use a ! shell escape to start a subshell or
2246 execute a command.  Many of the questions will have default answers in square
2247 brackets; typing carriage return will give you the default.
2248
2249 On some of the questions which ask for file or directory names you are allowed
2250 to use the ~name construct to specify the login directory belonging to "name",
2251 even if you don't have a shell which knows about that.  Questions where this is
2252 allowed will be marked "(~name ok)".
2253
2254 EOH
2255         rp=''
2256         dflt='Type carriage return to continue'
2257         . ./myread
2258         cat <<'EOH'
2259
2260 The prompter used in this script allows you to use shell variables and
2261 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2262 in the default answer, as if the default line was a set of arguments given to a
2263 script shell.  This means you may also use $* to repeat the whole default line,
2264 so you do not have to re-type everything to add something to the default.
2265
2266 Every time there is a substitution, you will have to confirm.  If there is an
2267 error (e.g. an unmatched backtick), the default answer will remain unchanged
2268 and you will be prompted again.
2269
2270 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2271 the questions and use the computed defaults (or the previous answers if there
2272 was already a config.sh file). Type 'Configure -h' for a list of options.
2273 You may also start interactively and then answer '& -d' at any prompt to turn
2274 on the non-interactive behaviour for the remainder of the execution.
2275
2276 EOH
2277         . ./myread
2278         cat <<EOH
2279
2280 Much effort has been expended to ensure that this shell script will run on any
2281 Unix system.  If despite that it blows up on yours, your best bet is to edit
2282 Configure and run it again.  If you can't run Configure for some reason,
2283 you'll have to generate a config.sh file by hand.  Whatever problems you
2284 have, let me (perlbug@perl.org) know how I blew it.
2285
2286 This installation script affects things in two ways:
2287
2288 1) it may do direct variable substitutions on some of the files included
2289    in this kit.
2290 2) it builds a config.h file for inclusion in C programs.  You may edit
2291    any of these files as the need arises after running this script.
2292
2293 If you make a mistake on a question, there is no easy way to back up to it
2294 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2295 files.  Configure will offer to let you do this before it runs the SH files.
2296
2297 EOH
2298         dflt='Type carriage return to continue'
2299         . ./myread
2300         case "$firsttime" in
2301         true) echo $user >>../.config/instruct;;
2302         esac
2303 fi
2304
2305 : find out where common programs are
2306 echo " "
2307 echo "Locating common programs..." >&4
2308 cat <<EOSC >loc
2309 $startsh
2310 case \$# in
2311 0) exit 1;;
2312 esac
2313 thing=\$1
2314 shift
2315 dflt=\$1
2316 shift
2317 for dir in \$*; do
2318         case "\$thing" in
2319         .)
2320         if test -d \$dir/\$thing; then
2321                 echo \$dir
2322                 exit 0
2323         fi
2324         ;;
2325         *)
2326         for thisthing in \$dir/\$thing; do
2327                 : just loop through to pick last item
2328         done
2329         if test -f \$thisthing; then
2330                 echo \$thisthing
2331                 exit 0
2332         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2333                 echo \$thisthing
2334                 exit 0
2335         elif test -f \$dir/\$thing.exe; then
2336                 if test -n "$DJGPP"; then
2337                         echo \$dir/\$thing.exe
2338                 elif test "$eunicefix" != ":"; then
2339                         : on Eunice apparently
2340                         echo \$dir/\$thing
2341                 fi
2342                 exit 0
2343         fi
2344         ;;
2345         esac
2346 done
2347 echo \$dflt
2348 exit 1
2349 EOSC
2350 chmod +x loc
2351 $eunicefix loc
2352 loclist="
2353 awk
2354 cat
2355 chmod
2356 comm
2357 cp
2358 echo
2359 expr
2360 grep
2361 ls
2362 mkdir
2363 rm
2364 sed
2365 sort
2366 touch
2367 tr
2368 uniq
2369 "
2370 trylist="
2371 ar
2372 bison
2373 byacc
2374 cpp
2375 csh
2376 date
2377 egrep
2378 gmake
2379 gzip
2380 less
2381 ln
2382 make
2383 more
2384 nm
2385 nroff
2386 perl
2387 pg
2388 test
2389 uname
2390 zip
2391 "
2392 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2393 pth="$pth /lib /usr/lib"
2394 for file in $loclist; do
2395         eval xxx=\$$file
2396         case "$xxx" in
2397         /*|?:[\\/]*)
2398                 if test -f "$xxx"; then
2399                         : ok
2400                 else
2401                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2402                         xxx=`./loc $file $file $pth`
2403                 fi
2404                 ;;
2405         '') xxx=`./loc $file $file $pth`;;
2406         *) xxx=`./loc $xxx $xxx $pth`;;
2407         esac
2408         eval $file=$xxx$_exe
2409         eval _$file=$xxx
2410         case "$xxx" in
2411         /*)
2412                 echo $file is in $xxx.
2413                 ;;
2414         ?:[\\/]*)
2415                 echo $file is in $xxx.
2416                 ;;
2417         *)
2418                 echo "I don't know where '$file' is, and my life depends on it." >&4
2419                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2420                 exit 1
2421                 ;;
2422         esac
2423 done
2424 echo " "
2425 echo "Don't worry if any of the following aren't found..."
2426 say=offhand
2427 for file in $trylist; do
2428         eval xxx=\$$file
2429         case "$xxx" in
2430         /*|?:[\\/]*)
2431                 if test -f "$xxx"; then
2432                         : ok
2433                 else
2434                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2435                         xxx=`./loc $file $file $pth`
2436                 fi
2437                 ;;
2438         '') xxx=`./loc $file $file $pth`;;
2439         *) xxx=`./loc $xxx $xxx $pth`;;
2440         esac
2441         eval $file=$xxx$_exe
2442         eval _$file=$xxx
2443         case "$xxx" in
2444         /*)
2445                 echo $file is in $xxx.
2446                 ;;
2447         ?:[\\/]*)
2448                 echo $file is in $xxx.
2449                 ;;
2450         *)
2451                 echo "I don't see $file out there, $say."
2452                 say=either
2453                 ;;
2454         esac
2455 done
2456 case "$egrep" in
2457 egrep)
2458         echo "Substituting grep for egrep."
2459         egrep=$grep
2460         _egrep=$grep
2461         ;;
2462 esac
2463 case "$less" in
2464 '')     ;;
2465 *)      if $less -R </dev/null >/dev/null; then
2466                echo "Substituting less -R for less."
2467                less="$less -R"
2468                _less=$less
2469         fi
2470         ;;
2471 esac
2472 case "$ln" in
2473 ln)
2474         echo "Substituting cp for ln."
2475         ln=$cp
2476         _ln=$cp
2477         ;;
2478 esac
2479 case "$make" in
2480 make)
2481         case "$gmake" in
2482         gmake)
2483         echo "I can't find make or gmake, and my life depends on it." >&4
2484         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2485         exit 1
2486         ;;
2487         esac
2488         ;;
2489 esac
2490 case "$gmake" in
2491 gmake)  ;;
2492 *)      # We can't have osname yet.
2493         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2494                 # Assume that gmake, if found, is definitely GNU make
2495                 # and prefer it over the system make.
2496                 echo "Substituting gmake for make."
2497                 make=$gmake
2498                 _make=$gmake
2499         fi
2500         ;;
2501 esac
2502 case "$test" in
2503 test)
2504         echo "Hopefully test is built into your sh."
2505         ;;
2506 *)
2507         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2508                 echo "Using the test built into your sh."
2509                 test=test
2510                 _test=test
2511         fi
2512         ;;
2513 esac
2514 case "$echo" in
2515 echo)
2516         echo "Hopefully echo is built into your sh."
2517         ;;
2518 '') ;;
2519 *)
2520         echo " "
2521 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2522         $echo $n "hi there$c" >foo1
2523         echo $n "hi there$c" >foo2
2524         if cmp foo1 foo2 >/dev/null 2>&1; then
2525                 echo "They are compatible.  In fact, they may be identical."
2526         else
2527                 case "$n" in
2528                 '-n') n='' c='\c';;
2529                 *) n='-n' c='';;
2530                 esac
2531                 cat <<FOO
2532 They are not compatible!  You are probably running ksh on a non-USG system.
2533 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2534 have echo built in and we may have to run some Bourne shell scripts.  That
2535 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2536
2537 FOO
2538                 $echo $n "The star should be here-->$c"
2539                 $echo "*"
2540         fi
2541         $rm -f foo1 foo2
2542         ;;
2543 esac
2544
2545 # This question was auctioned at YAPC::Europe-2007 in Vienna
2546 # I never promised you could answer it. I only auctioned the question.
2547 cat <<FOO
2548 The following message is sponsored by
2549
2550   Dresden.pm<--The stars should be here.
2551
2552 Dear Perl user, system administrator or package
2553 maintainer, the Perl community sends greetings to
2554 you. Do you (emblematical) greet back [Y/n]? n
2555
2556 FOO
2557
2558 : Check what type of C compiler we use
2559 cat <<EOS >trygcc
2560 $startsh
2561 EOS
2562 cat <<'EOSC' >>trygcc
2563 case "$cc" in
2564 '') ;;
2565 *)  $rm -f try try.*
2566     $cat >try.c <<EOM
2567 int main(int argc, char *argv[]) {
2568   return 0;
2569 }
2570 EOM
2571     if $cc -o try $ccflags $ldflags try.c; then
2572        :
2573     else
2574         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2575         despair=yes
2576         trygcc=yes
2577         case "$cc" in
2578         *gcc*) trygcc=no ;;
2579         esac
2580         # Skip this test because it gives a false match on output like:
2581         #    ./trygcc: line 23: cc: command not found
2582         # case "`$cc -v -c try.c 2>&1`" in
2583         # *gcc*) trygcc=no ;;
2584         # esac
2585         if $test X"$trygcc" = Xyes; then
2586             if gcc -o try -c try.c; then
2587                 echo " "
2588                 echo "You seem to have a working gcc, though." >&4
2589                 # Switching compilers may undo the work of hints files.
2590                 # The most common problem is -D_REENTRANT for threads.
2591                 # This heuristic catches that case, but gets false positives
2592                 # if -Dusethreads was not actually specified.  Better to
2593                 # bail out here with a useful message than fail 
2594                 # mysteriously later. Should we perhaps just try to
2595                 # re-invoke Configure -Dcc=gcc config_args ?
2596                 if $test -f usethreads.cbu; then
2597                         $cat >&4 <<EOM 
2598
2599 *** However, any setting of the C compiler flags (e.g. for thread support)
2600 *** will be lost.  It may be necessary for you to restart Configure and
2601 *** add -Dcc=gcc to your Configure command line.
2602
2603 EOM
2604                         rp="Would you like to go ahead and try gcc anyway?"
2605                         dflt=n
2606                 else
2607                         rp="Would you like to use it?"
2608                         dflt=y
2609                 fi
2610                 if $test -f myread; then
2611                     . ./myread
2612                 else
2613                     if $test -f UU/myread; then
2614                         . ./UU/myread
2615                     else
2616                         echo "Cannot find myread, sorry.  Aborting." >&2
2617                         exit 1
2618                     fi
2619                 fi  
2620                 case "$ans" in
2621                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2622                 esac
2623             fi
2624         fi
2625     fi
2626     $rm -f try try.*
2627     ;;
2628 esac
2629 EOSC
2630
2631 cat <<EOS >checkcc
2632 $startsh
2633 EOS
2634 cat <<'EOSC' >>checkcc
2635 case "$cc" in        
2636 '') ;;
2637 *)  $rm -f try try.*              
2638     $cat >try.c <<EOM
2639 int main(int argc, char *argv[]) {
2640   return 0;
2641 }
2642 EOM
2643     if $cc -o try $ccflags $ldflags try.c; then
2644        :
2645     else
2646         if $test X"$despair" = Xyes; then
2647            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2648         fi
2649         $cat >&4 <<EOM         
2650 You need to find a working C compiler.
2651 Either (purchase and) install the C compiler supplied by your OS vendor,
2652 or for a free C compiler try http://gcc.gnu.org/
2653 I cannot continue any further, aborting.
2654 EOM
2655         exit 1
2656     fi
2657     $rm -f try try.*
2658     ;;
2659 esac
2660 EOSC
2661
2662 : determine whether symbolic links are supported
2663 echo " "
2664 $touch blurfl
2665 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2666         echo "Symbolic links are supported." >&4
2667         lns="$ln -s"
2668 else
2669         echo "Symbolic links are NOT supported." >&4
2670         lns="$ln"
2671 fi
2672 $rm -f blurfl sym
2673
2674 : determine whether symbolic links are supported
2675 echo " "
2676 case "$lns" in
2677 *"ln"*" -s")
2678         echo "Checking how to test for symbolic links..." >&4
2679         $lns blurfl sym
2680         if $test "X$issymlink" = X; then
2681                 case "$newsh" in
2682                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2683                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2684                 esac
2685                 if test $? = 0; then
2686                         issymlink="test -h"
2687                 else
2688                         echo "Your builtin 'test -h' may be broken." >&4
2689                         case "$test" in
2690                         /*)     ;;
2691                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2692                                 for p in $pth
2693                                 do
2694                                         if test -f "$p/$test"; then
2695                                                 test="$p/$test"
2696                                                 break
2697                                         fi
2698                                 done
2699                                 ;;
2700                         esac
2701                         case "$test" in
2702                         /*)
2703                                 echo "Trying external '$test -h'." >&4
2704                                 issymlink="$test -h"
2705                                 if $test ! -h sym >/dev/null 2>&1; then
2706                                         echo "External '$test -h' is broken, too." >&4
2707                                         issymlink=''
2708                                 fi
2709                                 ;;
2710                         *)      issymlink='' ;;
2711                         esac
2712                 fi              
2713         fi
2714         if $test "X$issymlink" = X; then
2715                 if $test -L sym 2>/dev/null; then
2716                         issymlink="$test -L"
2717                         echo "The builtin '$test -L' worked." >&4
2718                 fi
2719         fi
2720         if $test "X$issymlink" != X; then
2721                 echo "You can test for symbolic links with '$issymlink'." >&4
2722         else
2723                 echo "I do not know how you can test for symbolic links." >&4
2724         fi
2725         $rm -f blurfl sym
2726         ;;
2727 *)      echo "No symbolic links, so not testing for their testing..." >&4
2728         ;;
2729 esac
2730 echo " "
2731
2732 : Make symlinks util
2733 case "$mksymlinks" in
2734 $define|true|[yY]*)
2735         case "$src" in
2736         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2737                 exit 1
2738                 ;;
2739         *)      case "$lns:$issymlink" in
2740                 *"ln"*" -s:"*"test -"?)
2741                         echo "Creating the symbolic links..." >&4
2742                         echo "(First creating the subdirectories...)" >&4
2743                         cd ..
2744                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2745                                 read directory
2746                                 test -z "$directory" && break
2747                                 mkdir -p $directory
2748                         done
2749                         # Sanity check 1.
2750                         if test ! -d t/base; then
2751                                 echo "Failed to create the subdirectories.  Aborting." >&4
2752                                 exit 1
2753                         fi
2754                         echo "(Then creating the symlinks...)" >&4
2755                         awk '{print $1}' $src/MANIFEST | while true; do
2756                                 read filename
2757                                 test -z "$filename" && break
2758                                 if test -f $filename; then
2759                                         if $issymlink $filename; then
2760                                                 rm -f $filename
2761                                         fi
2762                                 fi
2763                                 if test -f $filename; then
2764                                         echo "$filename already exists, not symlinking."
2765                                 else
2766                                         ln -s $src/$filename $filename
2767                                 fi
2768                         done
2769                         # Sanity check 2.
2770                         if test ! -f t/base/lex.t; then
2771                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2772                                 exit 1
2773                         fi
2774                         cd UU
2775                         ;;
2776                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2777                         ;;
2778                 esac
2779                 ;;
2780         esac
2781         ;;
2782 esac
2783
2784 : Check for Cross-Compilation
2785 case "$usecrosscompile" in
2786 $define|true|[yY]*)
2787         $echo "Cross-compiling..."
2788         croak=''
2789         case "$cc" in
2790         *-*-gcc) # A cross-compiling gcc, probably.
2791             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2792             ar=$targetarch-ar
2793             # leave out ld, choosing it is more complex
2794             nm=$targetarch-nm
2795             ranlib=$targetarch-ranlib
2796             $echo 'extern int foo;' > try.c
2797             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2798             shift
2799             if $test $# -gt 0; then
2800                 incpth="$incpth $*"
2801                 incpth="`$echo $incpth|$sed 's/^ //'`"
2802                 echo "Guessing incpth '$incpth'." >&4
2803                 for i in $*; do
2804                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2805                     if $test -d $j; then
2806                         libpth="$libpth $j"
2807                     fi
2808                 done   
2809                 libpth="`$echo $libpth|$sed 's/^ //'`"
2810                 echo "Guessing libpth '$libpth'." >&4
2811             fi
2812             $rm -f try.c
2813             ;;
2814         esac
2815         case "$targetarch" in
2816         '') echo "Targetarch not defined." >&4; croak=y ;;
2817         *)  echo "Using targetarch $targetarch." >&4 ;;
2818         esac
2819         case "$incpth" in
2820         '') echo "Incpth not defined." >&4; croak=y ;;
2821         *)  echo "Using incpth '$incpth'." >&4 ;;
2822         esac
2823         case "$libpth" in
2824         '') echo "Libpth not defined." >&4; croak=y ;;
2825         *)  echo "Using libpth '$libpth'." >&4 ;;
2826         esac
2827         case "$usrinc" in
2828         '') for i in $incpth; do
2829                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2830                     usrinc=$i
2831                     echo "Guessing usrinc $usrinc." >&4
2832                     break
2833                 fi
2834             done
2835             case "$usrinc" in
2836             '') echo "Usrinc not defined." >&4; croak=y ;;
2837             esac
2838             ;;
2839         *)  echo "Using usrinc $usrinc." >&4 ;;
2840         esac
2841         case "$targethost" in
2842         '') echo "Targethost not defined." >&4; croak=y ;;
2843         *)  echo "Using targethost $targethost." >&4
2844         esac
2845         locincpth=' '
2846         loclibpth=' '
2847         case "$croak" in
2848         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2849         esac
2850         case "$src" in
2851         /*) run=$src/Cross/run
2852             targetmkdir=$src/Cross/mkdir
2853             to=$src/Cross/to
2854             from=$src/Cross/from
2855             ;;
2856         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2857             run=$pwd/Cross/run
2858             targetmkdir=$pwd/Cross/mkdir
2859             to=$pwd/Cross/to
2860             from=$pwd/Cross/from
2861             ;;
2862         esac
2863         case "$targetrun" in
2864         '') targetrun=ssh ;;
2865         esac
2866         case "$targetto" in
2867         '') targetto=scp ;;
2868         esac
2869         case "$targetfrom" in
2870         '') targetfrom=scp ;;
2871         esac
2872         run=$run-$targetrun
2873         to=$to-$targetto
2874         from=$from-$targetfrom
2875         case "$targetdir" in
2876         '')  targetdir=/tmp
2877              echo "Guessing targetdir $targetdir." >&4
2878              ;;
2879         esac
2880         case "$targetuser" in
2881         '')  targetuser=root
2882              echo "Guessing targetuser $targetuser." >&4
2883              ;;
2884         esac
2885         case "$targetfrom" in
2886         scp)    q=-q ;;
2887         *)      q='' ;;
2888         esac
2889         case "$targetrun" in
2890         ssh|rsh)
2891             cat >$run <<EOF
2892 #!/bin/sh
2893 case "\$1" in
2894 -cwd)
2895   shift
2896   cwd=\$1
2897   shift
2898   ;;
2899 esac
2900 case "\$cwd" in
2901 '') cwd=$targetdir ;;
2902 esac
2903 exe=\$1
2904 shift
2905 if $test ! -f \$exe.xok; then
2906   $to \$exe
2907   $touch \$exe.xok
2908 fi
2909 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2910 EOF
2911             ;;
2912         *)  echo "Unknown targetrun '$targetrun'" >&4
2913             exit 1
2914             ;;
2915         esac
2916         case "$targetmkdir" in
2917         */Cross/mkdir)
2918             cat >$targetmkdir <<EOF
2919 #!/bin/sh
2920 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2921 EOF
2922             $chmod a+rx $targetmkdir
2923             ;;
2924         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2925             exit 1
2926             ;;
2927         esac
2928         case "$targetto" in
2929         scp|rcp)
2930             cat >$to <<EOF
2931 #!/bin/sh
2932 for f in \$@
2933 do
2934   case "\$f" in
2935   /*)
2936     $targetmkdir \`dirname \$f\`
2937     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2938     ;;
2939   *)
2940     $targetmkdir $targetdir/\`dirname \$f\`
2941     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2942     ;;
2943   esac
2944 done
2945 exit 0
2946 EOF
2947             ;;
2948         cp) cat >$to <<EOF
2949 #!/bin/sh
2950 for f in \$@
2951 do
2952   case "\$f" in
2953   /*)
2954     $mkdir -p $targetdir/\`dirname \$f\`
2955     $cp \$f $targetdir/\$f || exit 1
2956     ;;
2957   *)
2958     $targetmkdir $targetdir/\`dirname \$f\`
2959     $cp \$f $targetdir/\$f || exit 1
2960     ;;
2961   esac
2962 done
2963 exit 0
2964 EOF
2965             ;;
2966         *)  echo "Unknown targetto '$targetto'" >&4
2967             exit 1
2968             ;;
2969         esac
2970         case "$targetfrom" in
2971         scp|rcp)
2972           cat >$from <<EOF
2973 #!/bin/sh
2974 for f in \$@
2975 do
2976   $rm -f \$f
2977   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2978 done
2979 exit 0
2980 EOF
2981             ;;
2982         cp) cat >$from <<EOF
2983 #!/bin/sh
2984 for f in \$@
2985 do
2986   $rm -f \$f
2987   cp $targetdir/\$f . || exit 1
2988 done
2989 exit 0
2990 EOF
2991             ;;
2992         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2993             exit 1
2994             ;;
2995         esac
2996         if $test ! -f $run; then
2997             echo "Target 'run' script '$run' not found." >&4
2998         else
2999             $chmod a+rx $run
3000         fi
3001         if $test ! -f $to; then
3002             echo "Target 'to' script '$to' not found." >&4
3003         else
3004             $chmod a+rx $to
3005         fi
3006         if $test ! -f $from; then
3007             echo "Target 'from' script '$from' not found." >&4
3008         else
3009             $chmod a+rx $from
3010         fi
3011         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3012             exit 1
3013         fi
3014         cat >&4 <<EOF
3015 Using '$run' for remote execution,
3016 and '$from' and '$to'
3017 for remote file transfer.
3018 EOF
3019         ;;
3020 *)      run=''
3021         to=:
3022         from=:
3023         usecrosscompile='undef'
3024         targetarch=''
3025         ;;
3026 esac
3027
3028 : see whether [:lower:] and [:upper:] are supported character classes
3029 echo " "
3030 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3031 ABYZ)
3032         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3033         up='[:upper:]'
3034         low='[:lower:]'
3035         ;;
3036 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3037         # (0xd9 and 0xe2), therefore that is a nice testing point.
3038         if test "X$up" = X -o "X$low" = X; then
3039             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3040             rs) up='[A-Z]'
3041                 low='[a-z]'
3042                 ;;
3043             esac
3044         fi
3045         if test "X$up" = X -o "X$low" = X; then
3046             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3047             rs) up='A-Z'
3048                 low='a-z'
3049                 ;;
3050             esac
3051         fi
3052         if test "X$up" = X -o "X$low" = X; then
3053             case "`echo RS | od -x 2>/dev/null`" in
3054             *D9E2*|*d9e2*)
3055                 echo "Hey, this might be EBCDIC." >&4
3056                 if test "X$up" = X -o "X$low" = X; then
3057                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3058                     rs) up='[A-IJ-RS-Z]'
3059                         low='[a-ij-rs-z]'
3060                         ;;
3061                     esac
3062                 fi
3063                 if test "X$up" = X -o "X$low" = X; then
3064                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3065                     rs) up='A-IJ-RS-Z'
3066                         low='a-ij-rs-z'
3067                         ;;
3068                     esac
3069                 fi
3070                 ;;
3071             esac
3072         fi
3073 esac
3074 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3075 rs)
3076     echo "Using $up and $low to convert case." >&4
3077     ;;
3078 *)
3079     echo "I don't know how to translate letters from upper to lower case." >&4
3080     echo "Your tr is not acting any way I know of." >&4
3081     exit 1
3082     ;;
3083 esac
3084 : set up the translation script tr, must be called with ./tr of course
3085 cat >tr <<EOSC
3086 $startsh
3087 case "\$1\$2" in
3088 '[A-Z][a-z]') exec $tr '$up' '$low';;
3089 '[a-z][A-Z]') exec $tr '$low' '$up';;
3090 esac
3091 exec $tr "\$@"
3092 EOSC
3093 chmod +x tr
3094 $eunicefix tr
3095
3096 : Try to determine whether config.sh was made on this system
3097 case "$config_sh" in
3098 '')
3099 myuname=`$uname -a 2>/dev/null`
3100 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3101 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3102 # because the A-Z/a-z are not consecutive.
3103 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3104         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3105 newmyuname="$myuname"
3106 dflt=n
3107 case "$knowitall" in
3108 '')
3109         if test -f ../config.sh; then
3110                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3111                         eval "`grep myuname= ../config.sh`"
3112                 fi
3113                 if test "X$myuname" = "X$newmyuname"; then
3114                         dflt=y
3115                 fi
3116         fi
3117         ;;
3118 *) dflt=y;;
3119 esac
3120
3121 : Get old answers from old config file if Configure was run on the
3122 : same system, otherwise use the hints.
3123 hint=default
3124 cd ..
3125 if test -f config.sh; then
3126         echo " "
3127         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3128         . UU/myread
3129         case "$ans" in
3130         n*|N*) echo "OK, I'll ignore it."
3131                 mv config.sh config.sh.old
3132                 myuname="$newmyuname"
3133                 ;;
3134         *)  echo "Fetching default answers from your old config.sh file..." >&4
3135                 tmp_n="$n"
3136                 tmp_c="$c"
3137                 tmp_sh="$sh"
3138                 . ./config.sh
3139                 cp config.sh UU
3140                 n="$tmp_n"
3141                 c="$tmp_c"
3142                 : Older versions did not always set $sh.  Catch re-use of such
3143                 : an old config.sh.
3144                 case "$sh" in
3145                 '') sh="$tmp_sh" ;;
3146                 esac
3147                 hint=previous
3148                 ;;
3149         esac
3150 fi
3151 . ./UU/checkcc
3152 if test ! -f config.sh; then
3153         $cat <<EOM
3154
3155 First time through, eh?  I have some defaults handy for some systems
3156 that need some extra help getting the Configure answers right:
3157
3158 EOM
3159         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3160         dflt=''
3161         : Half the following guesses are probably wrong... If you have better
3162         : tests or hints, please send them to perlbug@perl.org
3163         : The metaconfig authors would also appreciate a copy...
3164         $test -f /irix && osname=irix
3165         $test -f /xenix && osname=sco_xenix
3166         $test -f /dynix && osname=dynix
3167         $test -f /dnix && osname=dnix
3168         $test -f /lynx.os && osname=lynxos
3169         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3170         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3171         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3172         $test -f /bin/mips && /bin/mips && osname=mips
3173         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3174                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3175         $test -d /usr/apollo/bin && osname=apollo
3176         $test -f /etc/saf/_sactab && osname=svr4
3177         $test -d /usr/include/minix && osname=minix
3178         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3179         if $test -d /MachTen -o -d /MachTen_Folder; then
3180                 osname=machten
3181                 if $test -x /sbin/version; then
3182                         osvers=`/sbin/version | $awk '{print $2}' |
3183                         $sed -e 's/[A-Za-z]$//'`
3184                 elif $test -x /usr/etc/version; then
3185                         osvers=`/usr/etc/version | $awk '{print $2}' |
3186                         $sed -e 's/[A-Za-z]$//'`
3187                 else
3188                         osvers="$2.$3"
3189                 fi
3190         fi
3191
3192         $test -f /sys/posix.dll &&
3193                 $test -f /usr/bin/what &&
3194                 set X `/usr/bin/what /sys/posix.dll` &&
3195                 $test "$3" = UWIN &&
3196                 osname=uwin &&
3197                 osvers="$5"
3198
3199         if $test -f $uname; then
3200                 set X $myuname
3201                 shift
3202
3203                 case "$5" in
3204                 fps*) osname=fps ;;
3205                 mips*)
3206                         case "$4" in
3207                         umips) osname=umips ;;
3208                         *) osname=mips ;;
3209                         esac;;
3210                 [23]100) osname=mips ;;
3211                 next*) osname=next ;;
3212                 i386*)
3213                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3214                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3215                                 osname='sco'
3216                                 osvers=$tmp
3217                         elif $test -f /etc/kconfig; then
3218                                 osname=isc
3219                                 if test "$lns" = "$ln -s"; then
3220                                         osvers=4
3221                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3222                                         osvers=3
3223                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3224                                         osvers=2
3225                                 fi
3226                         fi
3227                         tmp=''
3228                         ;;
3229                 pc*)
3230                         if test -n "$DJGPP"; then
3231                                 osname=dos
3232                                 osvers=djgpp
3233                         fi
3234                         ;;
3235                 esac
3236
3237                 case "$1" in
3238                 aix) osname=aix
3239                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3240                         case "$tmp" in
3241                         # oslevel can fail with:
3242                         # oslevel: Unable to acquire lock.
3243                         *not\ found) osvers="$4"."$3" ;;
3244                         '<3240'|'<>3240') osvers=3.2.0 ;;
3245                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3246                         '=3250'|'>3250') osvers=3.2.5 ;;
3247                         *) osvers=$tmp;;
3248                         esac
3249                         ;;
3250                 bsd386) osname=bsd386
3251                         osvers=`$uname -r`
3252                         ;;
3253                 cygwin*) osname=cygwin
3254                         osvers="$3"
3255                         ;;
3256                 *dc.osx) osname=dcosx
3257                         osvers="$3"
3258                         ;;
3259                 dnix) osname=dnix
3260                         osvers="$3"
3261                         ;;
3262                 domainos) osname=apollo
3263                         osvers="$3"
3264                         ;;
3265                 dgux)   osname=dgux
3266                         osvers="$3"
3267                         ;;
3268                 dragonfly) osname=dragonfly
3269                         osvers="$3"
3270                         ;;
3271                 dynixptx*) osname=dynixptx
3272                         osvers=`echo "$4"|sed 's/^v//'`
3273                         ;;
3274                 freebsd) osname=freebsd
3275                         osvers="$3" ;;
3276                 genix)  osname=genix ;;
3277                 gnu)    osname=gnu
3278                         osvers="$3" ;;
3279                 hp*)    osname=hpux
3280                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3281                         ;;
3282                 irix*)  osname=irix
3283                         case "$3" in
3284                         4*) osvers=4 ;;
3285                         5*) osvers=5 ;;
3286                         *)      osvers="$3" ;;
3287                         esac
3288                         ;;
3289                 linux)  osname=linux
3290                         case "$3" in
3291                         *)      osvers="$3" ;;
3292                         esac
3293                         ;;
3294                 MiNT)   osname=mint
3295                         ;;
3296                 netbsd*) osname=netbsd
3297                         osvers="$3"
3298                         ;;
3299                 news-os) osvers="$3"
3300                         case "$3" in
3301                         4*) osname=newsos4 ;;
3302                         *) osname=newsos ;;
3303                         esac
3304                         ;;
3305                 next*) osname=next ;;
3306                 nonstop-ux) osname=nonstopux ;;
3307                 openbsd) osname=openbsd
3308                         osvers="$3"
3309                         ;;
3310                 os2)    osname=os2
3311                         osvers="$4"
3312                         ;;
3313                 POSIX-BC | posix-bc ) osname=posix-bc
3314                         osvers="$3"
3315                         ;;
3316                 powerux | power_ux | powermax_os | powermaxos | \
3317                 powerunix | power_unix) osname=powerux
3318                         osvers="$3"
3319                         ;;
3320                 qnx) osname=qnx
3321                         osvers="$4"
3322                         ;;
3323                 solaris) osname=solaris
3324                         case "$3" in
3325                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3326                         *)      osvers="$3" ;;
3327                         esac
3328                         ;;
3329                 sunos) osname=sunos
3330                         case "$3" in
3331                         5*) osname=solaris
3332                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3333                         *)      osvers="$3" ;;
3334                         esac
3335                         ;;
3336                 titanos) osname=titanos
3337                         case "$3" in
3338                         1*) osvers=1 ;;
3339                         2*) osvers=2 ;;
3340                         3*) osvers=3 ;;
3341                         4*) osvers=4 ;;
3342                         *)      osvers="$3" ;;
3343                         esac
3344                         ;;
3345                 ultrix) osname=ultrix
3346                         osvers="$3"
3347                         ;;
3348                 osf1|mls+)      case "$5" in
3349                                 alpha)
3350                                         osname=dec_osf
3351                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3352                                         case "$osvers" in
3353                                         [1-9].[0-9]*) ;;
3354                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3355                                         esac
3356                                         ;;
3357                         hp*)    osname=hp_osf1  ;;
3358                         mips)   osname=mips_osf1 ;;
3359                         esac
3360                         ;;
3361                 # UnixWare 7.1.2 is known as Open UNIX 8
3362                 openunix|unixware) osname=svr5
3363                         osvers="$4"
3364                         ;;
3365                 uts)    osname=uts
3366                         osvers="$3"
3367                         ;;
3368                 vos) osvers="$3"
3369                         ;;
3370                 $2) case "$osname" in
3371                         *isc*) ;;
3372                         *freebsd*) ;;
3373                         svr*)
3374                                 : svr4.x or possibly later
3375                                 case "svr$3" in
3376                                 ${osname}*)
3377                                         osname=svr$3
3378                                         osvers=$4
3379                                         ;;
3380                                 esac
3381                                 case "$osname" in
3382                                 svr4.0)
3383                                         : Check for ESIX
3384                                         if test -f /stand/boot ; then
3385                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3386                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3387                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3388                                                         if test -n "$isesix"; then
3389                                                                 osname=esix4
3390                                                         fi
3391                                                 fi
3392                                         fi
3393                                         ;;
3394                                 esac
3395                                 ;;
3396                         *)      if test -f /etc/systemid; then
3397                                         osname=sco
3398                                         set `echo $3 | $sed 's/\./ /g'` $4
3399                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3400                                                 osvers=$1.$2.$3
3401                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3402                                                 osvers=$1.$2
3403                                         elif $test -f $src/hints/sco_$1.sh; then
3404                                                 osvers=$1
3405                                         fi
3406                                 else
3407                                         case "$osname" in
3408                                         '') : Still unknown.  Probably a generic Sys V.
3409                                                 osname="sysv"
3410                                                 osvers="$3"
3411                                                 ;;
3412                                         esac
3413                                 fi
3414                                 ;;
3415                         esac
3416                         ;;
3417                 *)      case "$osname" in
3418                         '') : Still unknown.  Probably a generic BSD.
3419                                 osname="$1"
3420                                 osvers="$3"
3421                                 ;;
3422                         esac
3423                         ;;
3424                 esac
3425         else
3426                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3427                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3428                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3429                                 osname=news_os
3430                         fi
3431                         $rm -f UU/kernel.what
3432                 elif test -d c:/. -o -n "$is_os2" ; then
3433                         set X $myuname
3434                         osname=os2
3435                         osvers="$5"
3436                 fi
3437         fi
3438
3439         case "$targetarch" in
3440         '') ;;
3441         *)  hostarch=$osname
3442             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3443             osvers=''
3444             ;;
3445         esac
3446
3447         : Now look for a hint file osname_osvers, unless one has been
3448         : specified already.
3449         case "$hintfile" in
3450         ''|' ')
3451                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3452                 : Also try without trailing minor version numbers.
3453                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3454                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3455                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3456                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3457                 case "$file" in
3458                 '') dflt=none ;;
3459                 *)  case "$osvers" in
3460                         '') dflt=$file
3461                                 ;;
3462                         *)  if $test -f $src/hints/$file.sh ; then
3463                                         dflt=$file
3464                                 elif $test -f $src/hints/$xfile.sh ; then
3465                                         dflt=$xfile
3466                                 elif $test -f $src/hints/$xxfile.sh ; then
3467                                         dflt=$xxfile
3468                                 elif $test -f $src/hints/$xxxfile.sh ; then
3469                                         dflt=$xxxfile
3470                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3471                                         dflt=$xxxxfile
3472                                 elif $test -f "$src/hints/${osname}.sh" ; then
3473                                         dflt="${osname}"
3474                                 else
3475                                         dflt=none
3476                                 fi
3477                                 ;;
3478                         esac
3479                         ;;
3480                 esac
3481                 if $test -f Policy.sh ; then
3482                         case "$dflt" in
3483                         *Policy*) ;;
3484                         none) dflt="Policy" ;;
3485                         *) dflt="Policy $dflt" ;;
3486                         esac
3487                 fi
3488                 ;;
3489         *)
3490                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3491                 ;;
3492         esac
3493
3494         if $test -f Policy.sh ; then
3495                 $cat <<EOM
3496
3497 There's also a Policy hint file available, which should make the
3498 site-specific (policy) questions easier to answer.
3499 EOM
3500
3501         fi
3502
3503         $cat <<EOM
3504
3505 You may give one or more space-separated answers, or "none" if appropriate.
3506 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3507 previous run of Configure, you may specify it as well as or instead of
3508 OS-specific hints.  If hints are provided for your OS, you should use them:
3509 although Perl can probably be built without hints on many platforms, using
3510 hints often improve performance and may enable features that Configure can't
3511 set up on its own. If there are no hints that match your OS, specify "none";
3512 DO NOT give a wrong version or a wrong OS.
3513
3514 EOM
3515
3516         rp="Which of these apply, if any?"
3517         . UU/myread
3518         tans=$ans
3519         for file in $tans; do
3520                 if $test X$file = XPolicy -a -f Policy.sh; then
3521                         . Policy.sh
3522                         $cat Policy.sh >> UU/config.sh
3523                 elif $test -f $src/hints/$file.sh; then
3524                         . $src/hints/$file.sh
3525                         $cat $src/hints/$file.sh >> UU/config.sh
3526                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3527                         : nothing
3528                 else
3529                         : Give one chance to correct a possible typo.
3530                         echo "$file.sh does not exist"
3531                         dflt=$file
3532                         rp="hint to use instead?"
3533                         . UU/myread
3534                         for file in $ans; do
3535                                 if $test -f "$src/hints/$file.sh"; then
3536                                         . $src/hints/$file.sh
3537                                         $cat $src/hints/$file.sh >> UU/config.sh
3538                                 elif $test X$ans = X -o X$ans = Xnone ; then
3539                                         : nothing
3540                                 else
3541                                         echo "$file.sh does not exist -- ignored."
3542                                 fi
3543                         done
3544                 fi
3545         done
3546
3547         hint=recommended
3548         : Remember our hint file for later.
3549         if $test -f "$src/hints/$file.sh" ; then
3550                 hintfile="$file"
3551         else
3552                 hintfile=''
3553         fi
3554 fi
3555 cd UU
3556 ;;
3557 *)
3558         echo " "
3559         echo "Fetching default answers from $config_sh..." >&4
3560         tmp_n="$n"
3561         tmp_c="$c"
3562         cd ..
3563         cp $config_sh config.sh 2>/dev/null
3564         chmod +w config.sh
3565         . ./config.sh
3566         cd UU
3567         cp ../config.sh .
3568         n="$tmp_n"
3569         c="$tmp_c"
3570         hint=previous
3571         ;;
3572 esac
3573 test "$override" && . ./optdef.sh
3574
3575 : Restore computed paths
3576 for file in $loclist $trylist; do
3577         eval $file="\$_$file"
3578 done
3579
3580 cat << EOM
3581
3582 Configure uses the operating system name and version to set some defaults.
3583 The default value is probably right if the name rings a bell. Otherwise,
3584 since spelling matters for me, either accept the default or answer "none"
3585 to leave it blank.
3586
3587 EOM
3588 case "$osname" in
3589         ''|' ')
3590                 case "$hintfile" in
3591                 ''|' '|none) dflt=none ;;
3592                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3593                 esac
3594                 ;;
3595         *) dflt="$osname" ;;
3596 esac
3597 rp="Operating system name?"
3598 . ./myread
3599 case "$ans" in
3600 none)  osname='' ;;
3601 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3602 esac
3603 echo " "
3604 case "$osvers" in
3605         ''|' ')
3606                 case "$hintfile" in
3607                 ''|' '|none) dflt=none ;;
3608                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3609                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3610                         case "$dflt" in
3611                         ''|' ') dflt=none ;;
3612                         esac
3613                         ;;
3614                 esac
3615                 ;;
3616         *) dflt="$osvers" ;;
3617 esac
3618 rp="Operating system version?"
3619 . ./myread
3620 case "$ans" in
3621 none)  osvers='' ;;
3622 *) osvers="$ans" ;;
3623 esac
3624
3625
3626 . ./posthint.sh
3627
3628 : who configured the system
3629 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3630 case "$cf_by" in
3631 "")
3632         cf_by=`(logname) 2>/dev/null`
3633         case "$cf_by" in
3634         "")
3635                 cf_by=`(whoami) 2>/dev/null`
3636                 case "$cf_by" in
3637                 "") cf_by=unknown ;;
3638                 esac ;;
3639         esac ;;
3640 esac
3641
3642 : decide how portable to be.  Allow command line overrides.
3643 case "$d_portable" in
3644 "$undef") ;;
3645 *)      d_portable="$define" ;;
3646 esac
3647
3648 : set up shell script to do ~ expansion
3649 cat >filexp <<EOSS
3650 $startsh
3651 : expand filename
3652 case "\$1" in
3653  \~/*|\~)
3654         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3655         ;;
3656  \~*)
3657         if $test -f /bin/csh; then
3658                 /bin/csh -f -c "glob \$1"
3659                 failed=\$?
3660                 echo ""
3661                 exit \$failed
3662         else
3663                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3664                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3665                 if $test ! -d "\$dir"; then
3666                         me=\`basename \$0\`
3667                         echo "\$me: can't locate home directory for: \$name" >&2
3668                         exit 1
3669                 fi
3670                 case "\$1" in
3671                 */*)
3672                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3673                         ;;
3674                 *)
3675                         echo \$dir
3676                         ;;
3677                 esac
3678         fi
3679         ;;
3680 *)
3681         echo \$1
3682         ;;
3683 esac
3684 EOSS
3685 chmod +x filexp
3686 $eunicefix filexp
3687
3688 : now set up to get a file name
3689 cat <<EOS >getfile
3690 $startsh
3691 EOS
3692 cat <<'EOSC' >>getfile
3693 tilde=''
3694 fullpath=''
3695 already=''
3696 skip=''
3697 none_ok=''
3698 exp_file=''
3699 nopath_ok=''
3700 orig_rp="$rp"
3701 orig_dflt="$dflt"
3702 case "$gfpth" in
3703 '') gfpth='.' ;;
3704 esac
3705
3706 case "$fn" in
3707 *\(*)
3708         : getfile will accept an answer from the comma-separated list
3709         : enclosed in parentheses even if it does not meet other criteria.
3710         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3711         fn=`echo $fn | sed 's/(.*)//'`
3712         ;;
3713 esac
3714
3715 case "$fn" in
3716 *:*)
3717         loc_file=`expr $fn : '.*:\(.*\)'`
3718         fn=`expr $fn : '\(.*\):.*'`
3719         ;;
3720 esac
3721
3722 case "$fn" in
3723 *~*) tilde=true;;
3724 esac
3725 case "$fn" in
3726 */*) fullpath=true;;
3727 esac
3728 case "$fn" in
3729 *+*) skip=true;;
3730 esac
3731 case "$fn" in
3732 *n*) none_ok=true;;
3733 esac
3734 case "$fn" in
3735 *e*) exp_file=true;;
3736 esac
3737 case "$fn" in
3738 *p*) nopath_ok=true;;
3739 esac
3740
3741 case "$fn" in
3742 *f*) type='File';;
3743 *d*) type='Directory';;
3744 *l*) type='Locate';;
3745 esac
3746
3747 what="$type"
3748 case "$what" in
3749 Locate) what='File';;
3750 esac
3751
3752 case "$exp_file" in
3753 '')
3754         case "$d_portable" in
3755         "$define") ;;
3756         *) exp_file=true;;
3757         esac
3758         ;;
3759 esac
3760
3761 cd ..
3762 while test "$type"; do
3763         redo=''
3764         rp="$orig_rp"
3765         dflt="$orig_dflt"
3766         case "$tilde" in
3767         true) rp="$rp (~name ok)";;
3768         esac
3769         . UU/myread
3770         if test -f UU/getfile.ok && \
3771                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3772         then
3773                 value="$ans"
3774                 ansexp="$ans"
3775                 break
3776         fi
3777         case "$ans" in
3778         none)
3779                 value=''
3780                 ansexp=''
3781                 case "$none_ok" in
3782                 true) type='';;
3783                 esac
3784                 ;;
3785         *)
3786                 case "$tilde" in
3787                 '') value="$ans"
3788                         ansexp="$ans";;
3789                 *)
3790                         value=`UU/filexp $ans`
3791                         case $? in
3792                         0)
3793                                 if test "$ans" != "$value"; then
3794                                         echo "(That expands to $value on this system.)"
3795                                 fi
3796                                 ;;
3797                         *) value="$ans";;
3798                         esac
3799                         ansexp="$value"
3800                         case "$exp_file" in
3801                         '') value="$ans";;
3802                         esac
3803                         ;;
3804                 esac
3805                 case "$fullpath" in
3806                 true)
3807                         case "$ansexp" in
3808                         /*) value="$ansexp" ;;
3809                         [a-zA-Z]:/*) value="$ansexp" ;;
3810                         *)
3811                                 redo=true
3812                                 case "$already" in
3813                                 true)
3814                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3815                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3816                                         ;;
3817                                 *)
3818                                 echo "Please give a full path name, starting with slash." >&4
3819                                         case "$tilde" in
3820                                         true)
3821                                 echo "Note that using ~name is ok provided it expands well." >&4
3822                                                 already=true
3823                                                 ;;
3824                                         esac
3825                                 esac
3826                                 ;;
3827                         esac
3828                         ;;
3829                 esac
3830                 case "$redo" in
3831                 '')
3832                         case "$type" in
3833                         File)
3834                                 for fp in $gfpth; do
3835                                         if test "X$fp" = X.; then
3836                                             pf="$ansexp"
3837                                         else    
3838                                             pf="$fp/$ansexp"
3839                                         fi
3840                                         if test -f "$pf"; then
3841                                                 type=''
3842                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3843                                         then
3844                                                 echo "($value is not a plain file, but that's ok.)"
3845                                                 type=''
3846                                         fi
3847                                         if test X"$type" = X; then
3848                                             value="$pf"
3849                                             break
3850                                         fi
3851                                 done
3852                                 ;;
3853                         Directory)
3854                                 for fp in $gfpth; do
3855                                         if test "X$fp" = X.; then
3856                                             dir="$ans"
3857                                             direxp="$ansexp"
3858                                         else    
3859                                             dir="$fp/$ansexp"
3860                                             direxp="$fp/$ansexp"
3861                                         fi
3862                                         if test -d "$direxp"; then
3863                                                 type=''
3864                                                 value="$dir"
3865                                                 break
3866                                         fi
3867                                 done
3868                                 ;;
3869                         Locate)
3870                                 if test -d "$ansexp"; then
3871                                         echo "(Looking for $loc_file in directory $value.)"
3872                                         value="$value/$loc_file"
3873                                         ansexp="$ansexp/$loc_file"
3874                                 fi
3875                                 if test -f "$ansexp"; then
3876                                         type=''
3877                                 fi
3878                                 case "$nopath_ok" in
3879                                 true)   case "$value" in
3880                                         */*) ;;
3881                                         *)      echo "Assuming $value will be in people's path."
3882                                                 type=''
3883                                                 ;;
3884                                         esac
3885                                         ;;
3886                                 esac
3887                                 ;;
3888                         esac
3889
3890                         case "$skip" in
3891                         true) type='';
3892                         esac
3893
3894                         case "$type" in
3895                         '') ;;
3896                         *)
3897                                 if test "$fastread" = yes; then
3898                                         dflt=y
3899                                 else
3900                                         dflt=n
3901                                 fi
3902                                 rp="$what $value doesn't exist.  Use that name anyway?"
3903                                 . UU/myread
3904                                 dflt=''
3905                                 case "$ans" in
3906                                 y*) type='';;
3907                                 *) echo " ";;
3908                                 esac
3909                                 ;;
3910                         esac
3911                         ;;
3912                 esac
3913                 ;;
3914         esac
3915 done
3916 cd UU
3917 ans="$value"
3918 rp="$orig_rp"
3919 dflt="$orig_dflt"
3920 rm -f getfile.ok
3921 test "X$gfpthkeep" != Xy && gfpth=""
3922 EOSC
3923
3924 : determine root of directory hierarchy where package will be installed.
3925 case "$prefix" in
3926 '')
3927         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3928         ;;
3929 *?/)
3930         dflt=`echo "$prefix" | sed 's/.$//'`
3931         ;;
3932 *)
3933         dflt="$prefix"
3934         ;;
3935 esac
3936 $cat <<EOM
3937
3938 By default, $package will be installed in $dflt/bin, manual pages
3939 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3940 installation directories. Typically this is something like /usr/local.
3941 If you wish to have binaries under /usr/bin but other parts of the
3942 installation under /usr/local, that's ok: you will be prompted
3943 separately for each of the installation directories, the prefix being
3944 only used to set the defaults.
3945
3946 EOM
3947 fn=d~
3948 rp='Installation prefix to use?'
3949 . ./getfile
3950 oldprefix=''
3951 case "$prefix" in
3952 '') ;;
3953 *)
3954         case "$ans" in
3955         "$prefix") ;;
3956         *) oldprefix="$prefix";;
3957         esac
3958         ;;
3959 esac
3960 prefix="$ans"
3961 prefixexp="$ansexp"
3962
3963 : allow them to override the AFS root
3964 case "$afsroot" in
3965 '')     afsroot=/afs ;;
3966 *)      afsroot=$afsroot ;;
3967 esac
3968
3969 : is AFS running?
3970 echo " "
3971 case "$afs" in
3972 $define|true)   afs=true ;;
3973 $undef|false)   afs=false ;;
3974 *)      if $test -d $afsroot; then
3975                 afs=true
3976         else
3977                 afs=false
3978         fi
3979         ;;
3980 esac
3981 if $afs; then
3982         echo "AFS may be running... I'll be extra cautious then..." >&4
3983 else
3984         echo "AFS does not seem to be running..." >&4
3985 fi
3986
3987 : determine installation prefix for where package is to be installed.
3988 if $afs; then 
3989 $cat <<EOM
3990
3991 Since you are running AFS, I need to distinguish the directory in which
3992 files will reside from the directory in which they are installed (and from
3993 which they are presumably copied to the former directory by occult means).
3994
3995 EOM
3996         case "$installprefix" in
3997         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3998         *) dflt="$installprefix";;
3999         esac
4000 else
4001 $cat <<EOM
4002
4003 In some special cases, particularly when building $package for distribution,
4004 it is convenient to distinguish the directory in which files should be
4005 installed from the directory ($prefix) in which they will
4006 eventually reside.  For most users, these two directories are the same.
4007
4008 EOM
4009         case "$installprefix" in
4010         '') dflt=$prefix ;;
4011         *) dflt=$installprefix;;
4012         esac
4013 fi
4014 fn=d~
4015 rp='What installation prefix should I use for installing files?'
4016 . ./getfile
4017 installprefix="$ans"
4018 installprefixexp="$ansexp"
4019
4020 : Perform the prefixexp/installprefixexp correction if necessary
4021 cat <<EOS >installprefix
4022 $startsh
4023 EOS
4024 cat <<'EOSC' >>installprefix
4025 : Change installation prefix, if necessary.
4026 if $test X"$prefix" != X"$installprefix"; then
4027     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4028 else
4029     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4030 fi
4031 EOSC
4032 chmod +x installprefix
4033 $eunicefix installprefix
4034
4035 : Set variables such as privlib and privlibexp from the output of ./getfile
4036 : performing the prefixexp/installprefixexp correction if necessary.
4037 cat <<EOS >setprefixvar
4038 $startsh
4039 EOS
4040 cat <<'EOSC' >>setprefixvar
4041 eval "${prefixvar}=\"\$ans\""
4042 eval "${prefixvar}exp=\"\$ansexp\""
4043 . ./installprefix
4044 EOSC
4045 chmod +x setprefixvar
4046 $eunicefix setprefixvar
4047
4048 : set up the script used to warn in case of inconsistency
4049 cat <<EOS >whoa
4050 $startsh
4051 EOS
4052 cat <<'EOSC' >>whoa
4053 dflt=y
4054 case "$hint" in
4055     recommended)
4056         case "$hintfile" in
4057         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4058                 ;;
4059         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4060                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4061                 ;;
4062         esac
4063         ;;
4064     *)  echo " "
4065         echo "*** WHOA THERE!!! ***" >&4
4066         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4067         ;;
4068 esac
4069 rp="    Keep the $hint value?"
4070 . ./myread
4071 case "$ans" in
4072 y) td=$was; tu=$was;;
4073 esac
4074 EOSC
4075
4076 : function used to set '$1' to '$val'
4077 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4078 case "$val$was" in
4079 $define$undef) . ./whoa; eval "$var=\$td";;
4080 $undef$define) . ./whoa; eval "$var=\$tu";;
4081 *) eval "$var=$val";;
4082 esac'
4083
4084 : get the patchlevel
4085 echo " "
4086 echo "Getting the current patchlevel..." >&4
4087 if $test -r $rsrc/patchlevel.h;then
4088         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4089         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4090         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4091         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4092         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4093         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4094         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4095 else
4096         revision=0
4097         patchlevel=0
4098         subversion=0
4099         api_revision=0
4100         api_version=0
4101         api_subversion=0
4102         perl_patchlevel=0
4103         $echo "(You do not have patchlevel.h.  Eek.)"
4104 fi
4105 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4106 version_patchlevel_string="version $patchlevel subversion $subversion"
4107 case "$perl_patchlevel" in
4108 0|'') ;;
4109 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4110     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4111     ;;
4112 esac
4113
4114 $echo "(You have $package $version_patchlevel_string.)"
4115
4116 case "$osname" in
4117 dos|vms)
4118         : XXX Should be a Configure test for double-dots in filenames.
4119         version=`echo $revision $patchlevel $subversion | \
4120                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4121         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4122                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4123         ;;
4124 *)
4125         version=`echo $revision $patchlevel $subversion | \
4126                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4127         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4128                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4129         ;;
4130 esac
4131 : Special case the 5.005_xx maintenance series, which used 5.005
4132 : without any subversion label as a subdirectory in $sitelib
4133 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4134         api_versionstring='5.005'
4135 fi
4136
4137 : Do we want threads support and if so, what type
4138 case "$usethreads" in
4139 $define|true|[yY]*)     dflt='y';;
4140 *)     # Catch case where user specified ithreads or 5005threads but
4141        # forgot -Dusethreads (A.D. 4/2002)
4142        case "$useithreads$use5005threads" in
4143        *$define*)       dflt='y';;
4144        *)               dflt='n';;
4145        esac
4146        ;;
4147 esac
4148 cat <<EOM
4149
4150 Perl can be built to take advantage of threads on some systems.
4151 To do so, Configure can be run with -Dusethreads.
4152
4153 Note that Perl built with threading support runs slightly slower
4154 and uses more memory than plain Perl. The current implementation
4155 is believed to be stable, but it is fairly new, and so should be
4156 treated with caution.
4157
4158 If this doesn't make any sense to you, just accept the default '$dflt'.
4159 EOM
4160 rp='Build a threading Perl?'
4161 . ./myread
4162 case "$ans" in
4163 y|Y)    val="$define" ;;
4164 *)      val="$undef" ;;
4165 esac
4166 set usethreads
4167 eval $setvar
4168
4169 if $test $patchlevel -lt 9; then
4170     case "$usethreads" in
4171     $define)
4172         $cat <<EOM
4173
4174 Since release 5.6, Perl has had two different threading implementations,
4175 the newer interpreter-based version (ithreads) with one interpreter per
4176 thread, and the older 5.005 version (5005threads).
4177 The 5005threads version is effectively unmaintained and will probably be
4178 removed in Perl 5.10, so there should be no need to build a Perl using it
4179 unless needed for backwards compatibility with some existing 5.005threads
4180 code.
4181
4182 EOM
4183         : Default to ithreads unless overridden on command line or with
4184         : old config.sh
4185         dflt='y'
4186         case "$use5005threads" in
4187                 $define|true|[yY]*) dflt='n';;
4188         esac
4189         case "$useithreads" in
4190                 $undef|false|[nN]*) dflt='n';;
4191         esac
4192         rp='Use the newer interpreter-based ithreads?'
4193         . ./myread
4194         case "$ans" in
4195         y|Y)    val="$define" ;;
4196         *)      val="$undef" ;;
4197         esac
4198         set useithreads
4199         eval $setvar
4200         : Now set use5005threads to the opposite value.
4201         case "$useithreads" in
4202         $define) val="$undef" ;;
4203         *) val="$define" ;;
4204         esac
4205         set use5005threads
4206         eval $setvar
4207         ;;
4208     *)
4209         useithreads="$undef"
4210         use5005threads="$undef"
4211         ;;
4212     esac
4213
4214     case "$useithreads$use5005threads" in
4215     "$define$define")
4216         $cat >&4 <<EOM
4217
4218 You cannot have both the ithreads and the 5.005 threads enabled
4219 at the same time.  Disabling the 5.005 threads since they are
4220 much less stable than the ithreads.
4221
4222 EOM
4223         use5005threads="$undef"
4224         ;;
4225     esac
4226
4227 else
4228 : perl-5.9.x and later
4229
4230     if test X"$usethreads" = "X$define"; then
4231         case "$use5005threads" in
4232             $define|true|[yY]*)
4233                 $cat >&4 <<EOM
4234
4235 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4236
4237 EOM
4238             ;;
4239         esac
4240     fi
4241
4242     use5005threads="$undef"
4243     useithreads="$usethreads"
4244 fi
4245
4246 case "$d_oldpthreads" in
4247 '')     : Configure tests would be welcome here.  For now, assume undef.
4248         val="$undef" ;;
4249 *)      val="$d_oldpthreads" ;;
4250 esac
4251 set d_oldpthreads
4252 eval $setvar
4253
4254
4255 : Look for a hint-file generated 'call-back-unit'.  If the
4256 : user has specified that a threading perl is to be built,
4257 : we may need to set or change some other defaults.
4258 if $test -f usethreads.cbu; then
4259     echo "Your platform has some specific hints regarding threaded builds, using them..."
4260     . ./usethreads.cbu
4261 else
4262     case "$usethreads" in
4263         "$define"|true|[yY]*)
4264                 $cat <<EOM
4265 (Your platform does not have any specific hints for threaded builds.
4266  Assuming POSIX threads, then.)
4267 EOM
4268         ;;
4269     esac
4270 fi
4271
4272 : Check if multiplicity is required
4273 cat <<EOM
4274
4275 Perl can be built so that multiple Perl interpreters can coexist
4276 within the same Perl executable.
4277 EOM
4278
4279 case "$useithreads" in
4280 $define)
4281         cat <<EOM
4282 This multiple interpreter support is required for interpreter-based threads.
4283 EOM
4284         val="$define"
4285         ;;
4286 *)      case "$usemultiplicity" in
4287         $define|true|[yY]*)     dflt='y';;
4288         *) dflt='n';;
4289         esac
4290         echo " "
4291         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4292         rp='Build Perl for multiplicity?'
4293         . ./myread
4294         case "$ans" in
4295         y|Y)    val="$define" ;;
4296         *)      val="$undef" ;;
4297         esac
4298         ;;
4299 esac
4300 set usemultiplicity
4301 eval $setvar
4302
4303 : Check if morebits is requested
4304 case "$usemorebits" in
4305 "$define"|true|[yY]*)
4306         use64bitint="$define"
4307         uselongdouble="$define"
4308         usemorebits="$define"
4309         ;;
4310 *)      usemorebits="$undef"
4311         ;;
4312 esac
4313
4314 : Determine the C compiler to be used
4315 echo " "
4316 case "$cc" in
4317 '') dflt=cc;;
4318 *) dflt="$cc";;
4319 esac
4320 rp="Use which C compiler?"
4321 . ./myread
4322 cc="$ans"
4323
4324 : See whether they have no cc but they do have gcc
4325 . ./trygcc
4326 if $test -f cc.cbu; then
4327     . ./cc.cbu
4328 fi
4329 . ./checkcc
4330
4331 : make some quick guesses about what we are up against
4332 echo " "
4333 $echo $n "Hmm...  $c"
4334 echo exit 1 >bsd
4335 echo exit 1 >usg
4336 echo exit 1 >v7
4337 echo exit 1 >osf1
4338 echo exit 1 >eunice
4339 echo exit 1 >xenix
4340 echo exit 1 >venix
4341 echo exit 1 >os2
4342 d_bsd="$undef"
4343 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4344 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4345 then
4346         echo "Looks kind of like an OSF/1 system, but we'll see..."
4347         echo exit 0 >osf1
4348 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4349         xxx=`./loc addbib blurfl $pth`
4350         if $test -f $xxx; then
4351         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4352                 echo exit 0 >bsd
4353                 echo exit 0 >usg
4354         else
4355                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4356                         echo "Looks kind of like an extended USG system, but we'll see..."
4357                 else
4358                         echo "Looks kind of like a USG system, but we'll see..."
4359                 fi
4360                 echo exit 0 >usg
4361         fi
4362 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4363         echo "Looks kind of like a BSD system, but we'll see..."
4364         d_bsd="$define"
4365         echo exit 0 >bsd
4366 else
4367         echo "Looks kind of like a Version 7 system, but we'll see..."
4368         echo exit 0 >v7
4369 fi
4370 case "$eunicefix" in
4371 *unixtovms*)
4372         $cat <<'EOI'
4373 There is, however, a strange, musty smell in the air that reminds me of
4374 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4375 EOI
4376         echo exit 0 >eunice
4377         d_eunice="$define"
4378 : it so happens the Eunice I know will not run shell scripts in Unix format
4379         ;;
4380 *)
4381         echo " "
4382         echo "Congratulations.  You aren't running Eunice."
4383         d_eunice="$undef"
4384         ;;
4385 esac
4386 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4387 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4388 : semicolon as a patch separator
4389 case "$p_" in
4390 :) ;;
4391 *)
4392         $cat <<'EOI'
4393 I have the feeling something is not exactly right, however...don't tell me...
4394 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4395 (Or you may be running DOS with DJGPP.)
4396 EOI
4397         echo exit 0 >os2
4398         ;;
4399 esac
4400 if test -f /xenix; then
4401         echo "Actually, this looks more like a XENIX system..."
4402         echo exit 0 >xenix
4403         d_xenix="$define"
4404 else
4405         echo " "
4406         echo "It's not Xenix..."
4407         d_xenix="$undef"
4408 fi
4409 chmod +x xenix
4410 $eunicefix xenix
4411 if test -f /venix; then
4412         echo "Actually, this looks more like a VENIX system..."
4413         echo exit 0 >venix
4414 else
4415         echo " "
4416         if ./xenix; then
4417                 : null
4418         else
4419                 echo "Nor is it Venix..."
4420         fi
4421 fi
4422 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4423 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4424 $rm -f foo
4425
4426 : Check if we are using GNU gcc and what its version is
4427 echo " "
4428 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4429 $cat >try.c <<EOM
4430 #include <stdio.h>
4431 int main() {
4432 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4433 #ifdef __VERSION__
4434         printf("%s\n", __VERSION__);
4435 #else
4436         printf("%s\n", "1");
4437 #endif
4438 #endif
4439         return(0);
4440 }
4441 EOM
4442 if $cc -o try $ccflags $ldflags try.c; then
4443         gccversion=`$run ./try`
4444         case "$gccversion" in
4445         '') echo "You are not using GNU cc." ;;
4446         *)  echo "You are using GNU cc $gccversion."
4447             ccname=gcc
4448             ;;
4449         esac
4450 else
4451         echo " "
4452         echo "*** WHOA THERE!!! ***" >&4
4453         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4454         case "$knowitall" in
4455         '')
4456         echo "    You'd better start hunting for one and let me know about it." >&4
4457                 exit 1
4458                 ;;
4459         esac
4460 fi
4461 $rm -f try try.*
4462 case "$gccversion" in
4463 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4464 esac
4465 case "$gccversion" in
4466 '') gccosandvers='' ;;
4467 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4468    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4469    gccshortvers=''
4470    case "$gccosandvers" in
4471    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4472    $osname$osvers) ;; # looking good
4473    $osname*) cat <<EOM >&4
4474
4475 *** WHOA THERE!!! ***
4476
4477     Your gcc has not been compiled for the exact release of
4478     your operating system ($gccosandvers versus $osname$osvers).
4479
4480     In general it is a good idea to keep gcc synchronized with
4481     the operating system because otherwise serious problems
4482     may ensue when trying to compile software, like Perl.
4483
4484     I'm trying to be optimistic here, though, and will continue.
4485     If later during the configuration and build icky compilation
4486     problems appear (headerfile conflicts being the most common
4487     manifestation), I suggest reinstalling the gcc to match
4488     your operating system release.
4489
4490 EOM
4491       ;;
4492    *) gccosandvers='' ;; # failed to parse, better be silent
4493    esac
4494    ;;
4495 esac
4496 case "$ccname" in
4497 '') ccname="$cc" ;;
4498 esac
4499
4500 # gcc 3.* complain about adding -Idirectories that they already know about,
4501 # so we will take those off from locincpth.
4502 case "$gccversion" in
4503 3*)
4504     echo "main(){}">try.c
4505     for incdir in $locincpth; do
4506        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4507              grep '^c[cp]p*[01]: warning: changing search order '`
4508        if test "X$warn" != X; then
4509            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4510        fi
4511     done
4512     $rm -f try try.*
4513 esac
4514
4515 : What should the include directory be ?
4516 echo " "
4517 $echo $n "Hmm...  $c"
4518 dflt='/usr/include'
4519 incpath=''
4520 mips_type=''
4521 if $test -f /bin/mips && /bin/mips; then
4522         echo "Looks like a MIPS system..."
4523         $cat >usr.c <<'EOCP'
4524 #ifdef SYSTYPE_BSD43
4525 /bsd43
4526 #endif
4527 EOCP
4528         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4529                 dflt='/bsd43/usr/include'
4530                 incpath='/bsd43'
4531                 mips_type='BSD 4.3'
4532         else
4533                 mips_type='System V'
4534         fi
4535         $rm -f usr.c usr.out
4536         echo "and you're compiling with the $mips_type compiler and libraries."
4537         xxx_prompt=y
4538         echo "exit 0" >mips
4539 else
4540         echo "Doesn't look like a MIPS system."
4541         xxx_prompt=n
4542         echo "exit 1" >mips
4543 fi
4544 chmod +x mips
4545 $eunicefix mips
4546 case "$usrinc" in
4547 '') ;;
4548 *) dflt="$usrinc";;
4549 esac
4550 case "$xxx_prompt" in
4551 y)      fn=d/
4552         echo " "
4553         rp='Where are the include files you want to use?'
4554         . ./getfile
4555         usrinc="$ans"
4556         ;;
4557 *)      usrinc="$dflt"
4558         ;;
4559 esac
4560
4561 : see how we invoke the C preprocessor
4562 echo " "
4563 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4564 cat <<'EOT' >testcpp.c
4565 #define ABC abc
4566 #define XYZ xyz
4567 ABC.XYZ
4568 EOT
4569 cd ..
4570 if test ! -f cppstdin; then
4571         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4572                 # AIX cc -E doesn't show the absolute headerfile
4573                 # locations but we'll cheat by using the -M flag.
4574                 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
4575         else
4576                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4577         fi
4578 else
4579         echo "Keeping your $hint cppstdin wrapper."
4580 fi
4581 chmod 755 cppstdin
4582 wrapper=`pwd`/cppstdin
4583 ok='false'
4584 cd UU
4585
4586 if $test "X$cppstdin" != "X" && \
4587         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4588         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4589 then
4590         echo "You used to use $cppstdin $cppminus so we'll use that again."
4591         case "$cpprun" in
4592         '') echo "But let's see if we can live without a wrapper..." ;;
4593         *)
4594                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4595                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4596                 then
4597                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4598                         ok='true'
4599                 else
4600                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4601                 fi
4602                 ;;
4603         esac
4604 else
4605         case "$cppstdin" in
4606         '') ;;
4607         *)
4608                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4609                 ;;
4610         esac
4611 fi
4612
4613 if $ok; then
4614         : nothing
4615 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4616         $cc -E <testcpp.c >testcpp.out 2>&1; \
4617         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4618         echo "Yup, it does."
4619         x_cpp="$cc -E"
4620         x_minus='';
4621 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4622         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4623         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4624         echo "Yup, it does."
4625         x_cpp="$cc -E"
4626         x_minus='-';
4627 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4628         $cc -P <testcpp.c >testcpp.out 2>&1; \
4629         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4630         echo "Yipee, that works!"
4631         x_cpp="$cc -P"
4632         x_minus='';
4633 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4634         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4635         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4636         echo "At long last!"
4637         x_cpp="$cc -P"
4638         x_minus='-';
4639 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4640         $cpp <testcpp.c >testcpp.out 2>&1; \
4641         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4642         echo "It works!"
4643         x_cpp="$cpp"
4644         x_minus='';
4645 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4646         $cpp - <testcpp.c >testcpp.out 2>&1; \
4647         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4648         echo "Hooray, it works!  I was beginning to wonder."
4649         x_cpp="$cpp"
4650         x_minus='-';
4651 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4652         $wrapper <testcpp.c >testcpp.out 2>&1; \
4653         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4654         x_cpp="$wrapper"
4655         x_minus=''
4656         echo "Eureka!"
4657 else
4658         dflt=''
4659         rp="No dice.  I can't find a C preprocessor.  Name one:"
4660         . ./myread
4661         x_cpp="$ans"
4662         x_minus=''
4663         $x_cpp <testcpp.c >testcpp.out 2>&1
4664         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4665                 echo "OK, that will do." >&4
4666         else
4667 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4668                 exit 1
4669         fi
4670 fi
4671
4672 case "$ok" in
4673 false)
4674         cppstdin="$x_cpp"
4675         cppminus="$x_minus"
4676         cpprun="$x_cpp"
4677         cpplast="$x_minus"
4678         set X $x_cpp
4679         shift
4680         case "$1" in
4681         "$cpp")
4682                 echo "Perhaps can we force $cc -E using a wrapper..."
4683                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4684                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4685                 then
4686                         echo "Yup, we can."
4687                         cppstdin="$wrapper"
4688                         cppminus='';
4689                 else
4690                         echo "Nope, we'll have to live without it..."
4691                 fi
4692                 ;;
4693         esac
4694         case "$cpprun" in
4695         "$wrapper")
4696                 cpprun=''
4697                 cpplast=''
4698                 ;;
4699         esac
4700         ;;
4701 esac
4702
4703 case "$cppstdin" in
4704 "$wrapper"|'cppstdin') ;;
4705 *) $rm -f $wrapper;;
4706 esac
4707 $rm -f testcpp.c testcpp.out
4708
4709 : Set private lib path
4710 case "$plibpth" in
4711 '') if ./mips; then
4712                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4713         fi;;
4714 esac
4715 case "$libpth" in
4716 ' ') dlist='';;
4717 '') dlist="$loclibpth $plibpth $glibpth";;
4718 *) dlist="$libpth";;
4719 esac
4720
4721 : Now check and see which directories actually exist, avoiding duplicates
4722 libpth=''
4723 for xxx in $dlist
4724 do
4725     if $test -d $xxx; then
4726                 case " $libpth " in
4727                 *" $xxx "*) ;;
4728                 *) libpth="$libpth $xxx";;
4729                 esac
4730     fi
4731 done
4732 $cat <<'EOM'
4733
4734 Some systems have incompatible or broken versions of libraries.  Among
4735 the directories listed in the question below, please remove any you
4736 know not to be holding relevant libraries, and add any that are needed.
4737 Say "none" for none.
4738
4739 EOM
4740 case "$libpth" in
4741 '') dflt='none';;
4742 *)
4743         set X $libpth
4744         shift
4745         dflt=${1+"$@"}
4746         ;;
4747 esac
4748 rp="Directories to use for library searches?"
4749 . ./myread
4750 case "$ans" in
4751 none) libpth=' ';;
4752 *) libpth="$ans";;
4753 esac
4754
4755 : compute shared library extension
4756 case "$so" in
4757 '')
4758         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4759                 dflt='sl'
4760         else
4761                 dflt='so'
4762         fi
4763         ;;
4764 *) dflt="$so";;
4765 esac
4766 $cat <<EOM
4767
4768 On some systems, shared libraries may be available.  Answer 'none' if
4769 you want to suppress searching of shared libraries for the remainder
4770 of this configuration.
4771
4772 EOM
4773 rp='What is the file extension used for shared libraries?'
4774 . ./myread
4775 so="$ans"
4776
4777 : Define several unixisms.
4778 : Hints files or command line option can be used to override them.
4779 : The convoluted testing is in case hints files set either the old
4780 : or the new name.
4781 case "$_exe" in
4782 '')     case "$exe_ext" in
4783         '')     ;;
4784         *)      _exe="$exe_ext" ;;
4785         esac
4786         ;;
4787 esac
4788 case "$_a" in
4789 '')     case "$lib_ext" in
4790     '') _a='.a';;
4791         *)      _a="$lib_ext" ;;
4792         esac
4793         ;;
4794 esac
4795 case "$_o" in
4796 '') case "$obj_ext" in
4797         '')     _o='.o';;
4798         *)      _o="$obj_ext";;
4799         esac
4800         ;;
4801 esac
4802 case "$p_" in
4803 '') case "$path_sep" in
4804         '')     p_=':';;
4805         *)      p_="$path_sep";;
4806         esac
4807         ;;
4808 esac
4809 exe_ext=$_exe
4810 lib_ext=$_a
4811 obj_ext=$_o
4812 path_sep=$p_
4813
4814 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4815
4816 : Which makefile gets called first.  This is used by make depend.
4817 case "$firstmakefile" in
4818 '') firstmakefile='makefile';;
4819 esac
4820
4821 : Check is we will use socks
4822 case "$usesocks" in
4823 $define|true|[yY]*)     dflt='y';;
4824 *) dflt='n';;
4825 esac
4826 cat <<EOM
4827
4828 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4829 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4830 to use the PerlIO abstraction layer, this will be implicitly selected.
4831
4832 If this doesn't make any sense to you, just accept the default '$dflt'.
4833 EOM
4834 rp='Build Perl for SOCKS?'
4835 . ./myread
4836 case "$ans" in
4837 y|Y)    val="$define" ;;
4838 *)      val="$undef" ;;
4839 esac
4840 set usesocks
4841 eval $setvar
4842
4843 : Check for uselongdouble support
4844 case "$ccflags" in
4845 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4846 esac
4847
4848 case "$uselongdouble" in
4849 $define|true|[yY]*)     dflt='y';;
4850 *) dflt='n';;
4851 esac
4852 cat <<EOM
4853
4854 Perl can be built to take advantage of long doubles which
4855 (if available) may give more accuracy and range for floating point numbers.
4856
4857 If this doesn't make any sense to you, just accept the default '$dflt'.
4858 EOM
4859 rp='Try to use long doubles if available?'
4860 . ./myread
4861 case "$ans" in
4862 y|Y)    val="$define"   ;;
4863 *)      val="$undef"    ;;
4864 esac
4865 set uselongdouble
4866 eval $setvar
4867
4868 case "$uselongdouble" in
4869 true|[yY]*) uselongdouble="$define" ;;
4870 esac
4871
4872 : Look for a hint-file generated 'call-back-unit'.  If the
4873 : user has specified that long doubles should be used,
4874 : we may need to set or change some other defaults.
4875 if $test -f uselongdouble.cbu; then
4876     echo "Your platform has some specific hints regarding long doubles, using them..."
4877     . ./uselongdouble.cbu
4878 else
4879     case "$uselongdouble" in
4880         $define)
4881                 $cat <<EOM
4882 (Your platform does not have any specific hints for long doubles.)
4883 EOM
4884         ;;
4885     esac
4886 fi
4887
4888 : Looking for optional libraries
4889 echo " "
4890 echo "Checking for optional libraries..." >&4
4891 case "$libs" in
4892 ' '|'') dflt='';;
4893 *) dflt="$libs";;
4894 esac
4895 case "$libswanted" in
4896 '') libswanted='c_s';;
4897 esac
4898 case "$usesocks" in
4899 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4900 esac
4901 libsfound=''
4902 libsfiles=''
4903 libsdirs=''
4904 libspath=''
4905 for thisdir in $libpth $xlibpth; do
4906   test -d $thisdir && libspath="$libspath $thisdir"
4907 done
4908 for thislib in $libswanted; do
4909         for thisdir in $libspath; do
4910             xxx=''
4911             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4912                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4913                 $test -f "$xxx" && eval $libscheck
4914                 $test -f "$xxx" && libstyle=shared
4915             fi
4916             if test ! -f "$xxx"; then
4917                 xxx=$thisdir/lib$thislib.$so
4918                 $test -f "$xxx" && eval $libscheck
4919                 $test -f "$xxx" && libstyle=shared
4920             fi
4921             if test ! -f "$xxx"; then
4922                 xxx=$thisdir/lib$thislib$_a
4923                 $test -f "$xxx" && eval $libscheck
4924                 $test -f "$xxx" && libstyle=static
4925             fi
4926             if test ! -f "$xxx"; then
4927                 xxx=$thisdir/$thislib$_a
4928                 $test -f "$xxx" && eval $libscheck
4929                 $test -f "$xxx" && libstyle=static
4930             fi
4931             if test ! -f "$xxx"; then
4932                 xxx=$thisdir/lib${thislib}_s$_a
4933                 $test -f "$xxx" && eval $libscheck
4934                 $test -f "$xxx" && libstyle=static
4935                 $test -f "$xxx" && thislib=${thislib}_s
4936             fi
4937             if test ! -f "$xxx"; then
4938                 xxx=$thisdir/Slib$thislib$_a
4939                 $test -f "$xxx" && eval $libscheck
4940                 $test -f "$xxx" && libstyle=static
4941             fi
4942             if $test -f "$xxx"; then
4943                 case "$libstyle" in
4944                 shared) echo "Found -l$thislib (shared)." ;;
4945                 static) echo "Found -l$thislib." ;;
4946                 *)      echo "Found -l$thislib ($libstyle)." ;;
4947                 esac
4948                 case " $dflt " in
4949                 *"-l$thislib "*);;
4950                 *) dflt="$dflt -l$thislib"
4951                    libsfound="$libsfound $xxx"
4952                    yyy=`basename $xxx`
4953                    libsfiles="$libsfiles $yyy"
4954                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4955                    case " $libsdirs " in
4956                    *" $yyy "*) ;;
4957                    *) libsdirs="$libsdirs $yyy" ;;
4958                    esac
4959                    ;;
4960                 esac
4961                 break
4962             fi
4963         done
4964         if $test ! -f "$xxx"; then
4965             echo "No -l$thislib."
4966         fi
4967 done
4968 set X $dflt
4969 shift
4970 dflt="$*"
4971 case "$libs" in
4972 '') dflt="$dflt";;
4973 *) dflt="$libs";;
4974 esac
4975 case "$dflt" in
4976 ' '|'') dflt='none';;
4977 esac
4978
4979 $cat <<EOM
4980
4981 In order to compile $package on your machine, a number of libraries
4982 are usually needed.  Include any other special libraries here as well.
4983 Say "none" for none.  The default list is almost always right.
4984 EOM
4985
4986 echo " "
4987 rp="What libraries to use?"
4988 . ./myread
4989 case "$ans" in
4990 none) libs=' ';;
4991 *) libs="$ans";;
4992 esac
4993
4994 : determine optimization, if desired, or use for debug flag also
4995 case "$optimize" in
4996 ' '|$undef) dflt='none';;
4997 '') dflt='-O';;
4998 *) dflt="$optimize";;
4999 esac
5000 $cat <<EOH
5001
5002 By default, $package compiles with the -O flag to use the optimizer.
5003 Alternately, you might want to use the symbolic debugger, which uses
5004 the -g flag (on traditional Unix systems).  Either flag can be
5005 specified here.  To use neither flag, specify the word "none".
5006
5007 EOH
5008 rp="What optimizer/debugger flag should be used?"
5009 . ./myread
5010 optimize="$ans"
5011 case "$optimize" in
5012 'none') optimize=" ";;
5013 esac
5014
5015 : Check what DEBUGGING is required from the command line
5016 : -DEBUGGING      or -DDEBUGGING or
5017 : -DEBUGGING=both                       = -g + -DDEBUGGING
5018 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5019 : -DEBUGGING=none or -UDEBUGGING        =
5020 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5021 case "$EBUGGING" in
5022 '')     ;;
5023 *)      DEBUGGING=$EBUGGING ;;
5024 esac
5025
5026 case "$DEBUGGING" in
5027 -g|both|$define)
5028     case "$optimize" in
5029         *-g*) ;;
5030         *)    optimize="$optimize -g" ;;
5031     esac ;;
5032 none|$undef)
5033     case "$optimize" in
5034         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5035                 shift
5036                 optimize="$*"
5037                 ;;
5038     esac ;;
5039 esac
5040
5041 dflt=''
5042 case "$DEBUGGING" in
5043 both|$define) dflt='-DDEBUGGING'
5044 esac
5045
5046 : argument order is deliberate, as the flag will start with - which set could
5047 : think is an option
5048 checkccflag='check=$1; flag=$2; callback=$3;
5049 echo " ";
5050 echo "Checking if your compiler accepts $flag" 2>&1;
5051 echo "int main(void) { return 0; }" > gcctest.c;
5052 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5053     echo "Yes, it does." 2>&1;
5054     if $test -s gcctest.out ; then
5055         echo "But your platform does not like it:";
5056         cat gcctest.out;
5057     else
5058         case "$ccflags" in
5059         *$check*)
5060             echo "Leaving current flags $ccflags alone." 2>&1
5061             ;;
5062         *) dflt="$dflt $flag";
5063             eval $callback
5064             ;;
5065         esac
5066     fi
5067 else
5068     echo "Nope, it does not, but that is ok." 2>&1;
5069 fi
5070 '
5071
5072 : We will not override a previous value, but we might want to
5073 : augment a hint file
5074 case "$hint" in
5075 default|recommended)
5076         case "$gccversion" in
5077         1*) dflt="$dflt -fpcc-struct-return" ;;
5078         esac
5079         case "$optimize:$DEBUGGING" in
5080         *-g*:old) dflt="$dflt -DDEBUGGING";;
5081         esac
5082         case "$gccversion" in
5083         2*) if $test -d /etc/conf/kconfig.d &&
5084                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5085                 then
5086                         # Interactive Systems (ISC) POSIX mode.
5087                         dflt="$dflt -posix"
5088                 fi
5089                 ;;
5090         esac
5091         case "$gccversion" in
5092         1*) ;;
5093         2.[0-8]*) ;;
5094         ?*)     set strict-aliasing -fno-strict-aliasing
5095                 eval $checkccflag
5096                 ;;
5097         esac
5098         # For gcc, adding -pipe speeds up compilations for some, but apparently
5099         # some assemblers can't read from stdin.  (It also slows down compilations
5100         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5101         case "$gccversion" in
5102         ?*)     set pipe -pipe
5103                 eval $checkccflag
5104                 ;;
5105         esac
5106
5107         # on x86_64 (at least) we require an extra library (libssp) in the
5108         # link command line. This library is not named, so I infer that it is
5109         # an implementation detail that may change. Hence the safest approach
5110         # is to add the flag to the flags passed to the compiler at link time,
5111         # as that way the compiler can do the right implementation dependant
5112         # thing. (NWC)
5113         case "$gccversion" in
5114         ?*)     set stack-protector -fstack-protector
5115                 eval $checkccflag
5116                 ;;
5117         esac
5118         ;;
5119 esac
5120
5121 case "$mips_type" in
5122 *BSD*|'') inclwanted="$locincpth $usrinc";;
5123 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5124 esac
5125 for thisincl in $inclwanted; do
5126         if $test -d $thisincl; then
5127                 if $test x$thisincl != x$usrinc; then
5128                         case "$dflt" in
5129                         *" -I$thisincl "*);;
5130                         *) dflt="$dflt -I$thisincl ";;
5131                         esac
5132                 fi
5133         fi
5134 done
5135
5136 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5137         xxx=true;
5138 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5139         xxx=true;
5140 else
5141         xxx=false;
5142 fi;
5143 if $xxx; then
5144         case "$dflt" in
5145         *$2*);;
5146         *) dflt="$dflt -D$2";;
5147         esac;
5148 fi'
5149
5150 set signal.h LANGUAGE_C; eval $inctest
5151
5152 case "$usesocks" in
5153 $define)
5154         ccflags="$ccflags -DSOCKS"
5155         ;;
5156 esac
5157
5158 case "$hint" in
5159 default|recommended) dflt="$ccflags $dflt" ;;
5160 *) dflt="$ccflags";;
5161 esac
5162
5163 case "$dflt" in
5164 ''|' ') dflt=none;;
5165 esac
5166
5167 $cat <<EOH
5168
5169 Your C compiler may want other flags.  For this question you should include
5170 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5171 but you should NOT include libraries or ld flags like -lwhatever.  If you
5172 want $package to honor its debug switch, you should include -DDEBUGGING here.
5173 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5174
5175 To use no flags, specify the word "none".
5176
5177 EOH
5178 set X $dflt
5179 shift
5180 dflt=${1+"$@"}
5181 rp="Any additional cc flags?"
5182 . ./myread
5183 case "$ans" in
5184 none) ccflags='';;
5185 *) ccflags="$ans";;
5186 esac
5187
5188 : the following weeds options from ccflags that are of no interest to cpp
5189 case "$cppflags" in
5190 '') cppflags="$ccflags" ;;
5191 *)  cppflags="$cppflags $ccflags" ;;
5192 esac
5193 case "$gccversion" in
5194 1*) cppflags="$cppflags -D__GNUC__"
5195 esac
5196 case "$mips_type" in
5197 '');;
5198 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5199 esac
5200 case "$cppflags" in
5201 '');;
5202 *)
5203         echo " "
5204         echo "Let me guess what the preprocessor flags are..." >&4
5205         set X $cppflags
5206         shift
5207         cppflags=''
5208         $cat >cpp.c <<'EOM'
5209 #define BLURFL foo
5210
5211 BLURFL xx LFRULB
5212 EOM
5213         previous=''
5214         for flag in $*
5215         do
5216                 case "$flag" in
5217                 -*) ftry="$flag";;
5218                 *) ftry="$previous $flag";;
5219                 esac
5220                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5221                         >cpp1.out 2>/dev/null && \
5222                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5223                         >cpp2.out 2>/dev/null && \
5224                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5225                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5226                 then
5227                         cppflags="$cppflags $ftry"
5228                         previous=''
5229                 else
5230                         previous="$flag"
5231                 fi
5232         done
5233         set X $cppflags
5234         shift
5235         cppflags=${1+"$@"}
5236         case "$cppflags" in
5237         *-*)  echo "They appear to be: $cppflags";;
5238         esac
5239         $rm -f cpp.c cpp?.out
5240         ;;
5241 esac
5242
5243 : flags used in final linking phase
5244 case "$ldflags" in
5245 '') if ./venix; then
5246                 dflt='-i -z'
5247         else
5248                 dflt=''
5249         fi
5250         case "$ccflags" in
5251         *-posix*) dflt="$dflt -posix" ;;
5252         esac
5253         ;;
5254 *) dflt="$ldflags";;
5255 esac
5256 # See note above about -fstack-protector
5257 case "$ccflags" in
5258 *-fstack-protector*) 
5259         case "$dflt" in
5260         *-fstack-protector*) ;; # Don't add it again
5261         *) dflt="$dflt -fstack-protector" ;; 
5262         esac
5263         ;;
5264 esac
5265
5266 : Try to guess additional flags to pick up local libraries.
5267 for thislibdir in $libpth; do
5268         case " $loclibpth " in
5269         *" $thislibdir "*)
5270                 case "$dflt " in
5271                 *"-L$thislibdir "*) ;;
5272                 *)  dflt="$dflt -L$thislibdir" ;;
5273                 esac
5274                 ;;
5275         esac
5276 done
5277
5278 case "$dflt" in
5279 '') dflt='none' ;;
5280 esac
5281
5282 $cat <<EOH
5283
5284 Your C linker may need flags.  For this question you should
5285 include -L/whatever and any other flags used by the C linker, but you
5286 should NOT include libraries like -lwhatever.
5287
5288 Make sure you include the appropriate -L/path flags if your C linker
5289 does not normally search all of the directories you specified above,
5290 namely
5291         $libpth
5292 To use no flags, specify the word "none".
5293
5294 EOH
5295
5296 rp="Any additional ld flags (NOT including libraries)?"
5297 . ./myread
5298 case "$ans" in
5299 none) ldflags='';;
5300 *) ldflags="$ans";;
5301 esac
5302 rmlist="$rmlist pdp11"
5303
5304 : coherency check
5305 echo " "
5306 echo "Checking your choice of C compiler and flags for coherency..." >&4
5307 $cat > try.c <<'EOF'
5308 #include <stdio.h>
5309 int main() { printf("Ok\n"); return(0); }
5310 EOF
5311 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5312 shift
5313 $cat >try.msg <<'EOM'
5314 I've tried to compile and run the following simple program:
5315
5316 EOM
5317 $cat try.c >> try.msg
5318
5319 $cat >> try.msg <<EOM
5320
5321 I used the command:
5322
5323         $*
5324         $run ./try
5325
5326 and I got the following output:
5327
5328 EOM
5329 dflt=y
5330 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5331         if $sh -c "$run ./try " >>try.msg 2>&1; then
5332                 xxx=`$run ./try`
5333                 case "$xxx" in
5334                 "Ok") dflt=n ;;
5335                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5336                         case " $libs " in
5337                         *" -lsfio "*)
5338                                 cat >> try.msg <<'EOQS'
5339 If $libs contains -lsfio, and sfio is mis-configured, then it
5340 sometimes (apparently) runs and exits with a 0 status, but with no
5341 output!  It may have to do with sfio's use of _exit vs. exit.
5342
5343 EOQS
5344                                 rp="You have a big problem.  Shall I abort Configure"
5345                                 dflt=y
5346                                 ;;
5347                         esac
5348                         ;;
5349                 esac
5350         else
5351                 echo "The program compiled OK, but exited with status $?." >>try.msg
5352                 rp="You have a problem.  Shall I abort Configure"
5353                 dflt=y
5354         fi
5355 else
5356         echo "I can't compile the test program." >>try.msg
5357         rp="You have a BIG problem.  Shall I abort Configure"
5358         dflt=y
5359 fi
5360 case "$dflt" in
5361 y)
5362         $cat try.msg >&4
5363         case "$knowitall" in
5364         '')
5365                 echo "(The supplied flags or libraries might be incorrect.)"
5366                 ;;
5367         *) dflt=n;;
5368         esac
5369         echo " "
5370         . ./myread
5371         case "$ans" in
5372         n*|N*) ;;
5373         *)      echo "Ok.  Stopping Configure." >&4
5374                 exit 1
5375                 ;;
5376         esac
5377         ;;
5378 n) echo "OK, that should do.";;
5379 esac
5380 $rm_try gcctest gcctest.out
5381
5382 : define a shorthand compile call
5383 compile='
5384 mc_file=$1;
5385 shift;
5386 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5387 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5388 exit 1;
5389 fi;
5390 esac;
5391 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5392 : define a shorthand compile call for compilations that should be ok.
5393 compile_ok='
5394 mc_file=$1;
5395 shift;
5396 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5397
5398 : determine filename position in cpp output
5399 echo " "
5400 echo "Computing filename position in cpp output for #include directives..." >&4
5401 case "$osname" in
5402 vos) testaccess=-e ;;
5403 *)   testaccess=-r ;;
5404 esac
5405 echo '#include <stdio.h>' > foo.c
5406 $cat >fieldn <<EOF
5407 $startsh
5408 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5409 $grep '^[       ]*#.*stdio\.h' | \
5410 while read cline; do
5411         pos=1
5412         set \$cline
5413         while $test \$# -gt 0; do
5414                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5415                         echo "\$pos"
5416                         exit 0
5417                 fi
5418                 shift
5419                 pos=\`expr \$pos + 1\`
5420         done
5421 done
5422 EOF
5423 chmod +x fieldn
5424 fieldn=`./fieldn`
5425 $rm -f foo.c fieldn
5426 case $fieldn in
5427 '') pos='???';;
5428 1) pos=first;;
5429 2) pos=second;;
5430 3) pos=third;;
5431 *) pos="${fieldn}th";;
5432 esac
5433 echo "Your cpp writes the filename in the $pos field of the line."
5434
5435 case "$osname" in
5436 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5437 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5438 *)   cppfilter='' ;;
5439 esac
5440 : locate header file
5441 $cat >findhdr <<EOF
5442 $startsh
5443 wanted=\$1
5444 name=''
5445 for usrincdir in $usrinc
5446 do
5447         if test -f \$usrincdir/\$wanted; then
5448                 echo "\$usrincdir/\$wanted"
5449                 exit 0
5450         fi
5451 done
5452 awkprg='{ print \$$fieldn }'
5453 echo "#include <\$wanted>" > foo\$\$.c
5454 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5455 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5456 while read cline; do
5457         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5458         case "\$name" in
5459         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5460         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5461         *) exit 2;;
5462         esac;
5463 done;
5464 #
5465 # status = 0: grep returned 0 lines, case statement not executed
5466 # status = 1: headerfile found
5467 # status = 2: while loop executed, no headerfile found
5468 #
5469 status=\$?
5470 $rm -f foo\$\$.c;
5471 if test \$status -eq 1; then
5472         exit 0;
5473 fi
5474 exit 1
5475 EOF
5476 chmod +x findhdr
5477
5478 : define an alternate in-header-list? function
5479 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5480 cont=true; xxf="echo \"<\$1> found.\" >&4";
5481 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5482 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5483 esac;
5484 case $# in 4) instead=instead;; *) instead="at last";; esac;
5485 while $test "$cont"; do
5486         xxx=`./findhdr $1`
5487         var=$2; eval "was=\$$2";
5488         if $test "$xxx" && $test -r "$xxx";
5489         then eval $xxf;
5490         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5491                 cont="";
5492         else eval $xxnf;
5493         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5494         set $yyy; shift; shift; yyy=$@;
5495         case $# in 0) cont="";;
5496         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5497                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5498         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5499                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5500         esac;
5501 done;
5502 while $test "$yyy";
5503 do set $yyy; var=$2; eval "was=\$$2";
5504         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5505         set $yyy; shift; shift; yyy=$@;
5506 done'
5507
5508 : see if stdlib is available
5509 set stdlib.h i_stdlib
5510 eval $inhdr
5511
5512 : check for lengths of integral types
5513 echo " "
5514 case "$intsize" in
5515 '')
5516         echo "Checking to see how big your integers are..." >&4
5517         $cat >try.c <<EOCP
5518 #include <stdio.h>
5519 #$i_stdlib I_STDLIB
5520 #ifdef I_STDLIB
5521 #include <stdlib.h>
5522 #endif
5523 int main()
5524 {
5525         printf("intsize=%d;\n", (int)sizeof(int));
5526         printf("longsize=%d;\n", (int)sizeof(long));
5527         printf("shortsize=%d;\n", (int)sizeof(short));
5528         exit(0);
5529 }
5530 EOCP
5531         set try
5532         if eval $compile_ok && $run ./try > /dev/null; then
5533                 eval `$run ./try`
5534                 echo "Your integers are $intsize bytes long."
5535                 echo "Your long integers are $longsize bytes long."
5536                 echo "Your short integers are $shortsize bytes long."
5537         else
5538                 $cat >&4 <<EOM
5539 !
5540 Help! I can't compile and run the intsize test program: please enlighten me!
5541 (This is probably a misconfiguration in your system or libraries, and
5542 you really ought to fix it.  Still, I'll try anyway.)
5543 !
5544 EOM
5545                 dflt=4
5546                 rp="What is the size of an integer (in bytes)?"
5547                 . ./myread
5548                 intsize="$ans"
5549                 dflt=$intsize
5550                 rp="What is the size of a long integer (in bytes)?"
5551                 . ./myread
5552                 longsize="$ans"
5553                 dflt=2
5554                 rp="What is the size of a short integer (in bytes)?"
5555                 . ./myread
5556                 shortsize="$ans"
5557         fi
5558         ;;
5559 esac
5560 $rm_try
5561
5562 : check for long long
5563 echo " "
5564 echo "Checking to see if you have long long..." >&4
5565 echo 'int main() { long long x = 7; return 0; }' > try.c
5566 set try
5567 if eval $compile; then
5568         val="$define"
5569         echo "You have long long."
5570 else
5571         val="$undef"
5572         echo "You do not have long long."
5573 fi
5574 $rm_try
5575 set d_longlong
5576 eval $setvar
5577
5578 : check for length of long long
5579 case "${d_longlong}${longlongsize}" in
5580 $define)
5581         echo " "
5582         echo "Checking to see how big your long longs are..." >&4
5583         $cat >try.c <<'EOCP'
5584 #include <stdio.h>
5585 int main()
5586 {
5587     printf("%d\n", (int)sizeof(long long));
5588     return(0);
5589 }
5590 EOCP
5591         set try
5592         if eval $compile_ok; then
5593                 longlongsize=`$run ./try`
5594                 echo "Your long longs are $longlongsize bytes long."
5595         else
5596                 dflt='8'
5597                 echo " "
5598                 echo "(I can't seem to compile the test program.  Guessing...)"
5599                 rp="What is the size of a long long (in bytes)?"
5600                 . ./myread
5601                 longlongsize="$ans"
5602         fi
5603         if $test "X$longsize" = "X$longlongsize"; then
5604                 echo "(That isn't any different from an ordinary long.)"
5605         fi
5606         ;;
5607 esac
5608 $rm_try
5609
5610 : see if inttypes.h is available
5611 : we want a real compile instead of Inhdr because some systems
5612 : have an inttypes.h which includes non-existent headers
5613 echo " "
5614 $cat >try.c <<EOCP
5615 #include <inttypes.h>
5616 int main() {
5617         static int32_t foo32 = 0x12345678;
5618 }
5619 EOCP
5620 set try
5621 if eval $compile; then
5622         echo "<inttypes.h> found." >&4
5623         val="$define"
5624 else
5625         echo "<inttypes.h> NOT found." >&4
5626         val="$undef"
5627 fi
5628 $rm_try
5629 set i_inttypes
5630 eval $setvar
5631
5632 : check for int64_t
5633 echo " "
5634 echo "Checking to see if you have int64_t..." >&4
5635 $cat >try.c <<EOCP
5636 #include <sys/types.h>
5637 #$i_inttypes I_INTTYPES
5638 #ifdef I_INTTYPES
5639 #include <inttypes.h>
5640 #endif
5641 int main() { int64_t x = 7; }
5642 EOCP
5643 set try
5644 if eval $compile; then
5645         val="$define"
5646         echo "You have int64_t."
5647 else
5648         val="$undef"
5649         echo "You do not have int64_t."
5650 fi
5651 $rm_try
5652 set d_int64_t
5653 eval $setvar
5654
5655 : Check if 64bit ints have a quad type
5656 echo " "
5657 echo "Checking which 64-bit integer type we could use..." >&4
5658
5659 case "$intsize" in
5660 8) val=int
5661    set quadtype
5662    eval $setvar
5663    val='"unsigned int"'
5664    set uquadtype
5665    eval $setvar
5666    quadkind=1
5667    ;;
5668 *) case "$longsize" in
5669    8) val=long
5670       set quadtype
5671       eval $setvar
5672       val='"unsigned long"'
5673       set uquadtype
5674       eval $setvar
5675       quadkind=2
5676       ;;
5677    *) case "$d_longlong:$longlongsize" in
5678       define:8)
5679         val='"long long"'
5680         set quadtype
5681         eval $setvar
5682         val='"unsigned long long"'
5683         set uquadtype
5684         eval $setvar
5685         quadkind=3
5686         ;;
5687       *) case "$d_int64_t" in
5688          define)
5689            val=int64_t
5690            set quadtype
5691            eval $setvar
5692            val=uint64_t
5693            set uquadtype
5694            eval $setvar
5695            quadkind=4
5696            ;;
5697          esac
5698          ;;
5699       esac
5700       ;;
5701    esac
5702    ;;
5703 esac
5704
5705 case "$quadtype" in
5706 '')     echo "Alas, no 64-bit integer types in sight." >&4
5707         d_quad="$undef"
5708         ;;
5709 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5710         d_quad="$define"
5711         ;;
5712 esac
5713
5714 : Do we want 64bit support
5715 case "$uselonglong" in
5716 "$define"|true|[yY]*)
5717         cat <<EOM >&4
5718
5719 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5720 EOM
5721         use64bitint="$define"
5722         ;;
5723 esac
5724 case "$use64bits" in
5725 "$define"|true|[yY]*)
5726         cat <<EOM >&4
5727
5728 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5729 EOM
5730         use64bitint="$define"
5731         ;;
5732 esac
5733 case "$use64bitints" in
5734 "$define"|true|[yY]*)
5735         cat <<EOM >&4
5736
5737 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5738 EOM
5739         use64bitint="$define"
5740         ;;
5741 esac
5742 case "$use64bitsint" in
5743 "$define"|true|[yY]*)
5744         cat <<EOM >&4
5745
5746 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5747 EOM
5748         use64bitint="$define"
5749         ;;
5750 esac
5751 case "$uselonglongs" in
5752 "$define"|true|[yY]*)
5753         cat <<EOM >&4
5754
5755 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5756 EOM
5757         use64bitint="$define"
5758         ;;
5759 esac
5760 case "$use64bitsall" in
5761 "$define"|true|[yY]*)
5762         cat <<EOM >&4
5763
5764 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5765 EOM
5766         use64bitall="$define"
5767         ;;
5768 esac
5769
5770 case "$ccflags" in
5771 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5772 esac
5773 case "$use64bitall" in
5774 "$define"|true|[yY]*) use64bitint="$define" ;;
5775 esac
5776
5777 case "$longsize" in
5778 8) cat <<EOM
5779
5780 You have natively 64-bit long integers.
5781 EOM
5782    val="$define"
5783    ;;
5784 *) case "$use64bitint" in
5785    "$define"|true|[yY]*) dflt='y';;
5786    *) dflt='n';;
5787    esac
5788    case "$d_quad" in
5789    "$define") ;;
5790    *) dflt='n' ;;
5791    esac
5792    cat <<EOM
5793
5794 Perl can be built to take advantage of 64-bit integer types
5795 on some systems.  To do so, Configure can be run with -Duse64bitint.
5796 Choosing this option will most probably introduce binary incompatibilities.
5797
5798 If this doesn't make any sense to you, just accept the default '$dflt'.
5799 (The default has been chosen based on your configuration.)
5800 EOM
5801    rp='Try to use 64-bit integers, if available?'
5802    . ./myread
5803    case "$ans" in
5804    [yY]*) val="$define" ;;
5805    *)     val="$undef"  ;;
5806    esac
5807    ;;
5808 esac
5809 set use64bitint
5810 eval $setvar
5811
5812 case "$use64bitall" in
5813 "$define"|true|[yY]*) dflt='y' ;;
5814 *) case "$longsize" in
5815    8) dflt='y' ;;
5816    *) dflt='n' ;;
5817    esac
5818    ;;
5819 esac
5820 cat <<EOM
5821
5822 You may also choose to try maximal 64-bitness.  It means using as much
5823 64-bitness as possible on the platform.  This in turn means even more
5824 binary incompatibilities.  On the other hand, your platform may not
5825 have any more 64-bitness available than what you already have chosen.
5826
5827 If this doesn't make any sense to you, just accept the default '$dflt'.
5828 (The default has been chosen based on your configuration.)
5829 EOM
5830 rp='Try to use maximal 64-bit support, if available?'
5831 . ./myread
5832 case "$ans" in
5833 [yY]*) val="$define" ;;
5834 *)     val="$undef"  ;;
5835 esac
5836 set use64bitall
5837 eval $setvar
5838 case "$use64bitall" in
5839 "$define")
5840         case "$use64bitint" in
5841         "$undef")
5842                 cat <<EOM
5843
5844 Since you have chosen a maximally 64-bit build, I'm also turning on
5845 the use of 64-bit integers.
5846 EOM
5847                 use64bitint="$define" ;;
5848         esac
5849         ;;
5850 esac
5851
5852 : Look for a hint-file generated 'call-back-unit'.  If the
5853 : user has specified that a 64-bit perl is to be built,
5854 : we may need to set or change some other defaults.
5855 if $test -f use64bitint.cbu; then
5856         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5857         . ./use64bitint.cbu
5858 fi
5859 case "$use64bitint" in
5860 "$define"|true|[yY]*)
5861         case "$longsize" in
5862         4) case "$archname64" in
5863            '') archname64=64int ;;
5864            esac
5865            ;;
5866         esac
5867         ;;
5868 esac
5869
5870 : Look for a hint-file generated 'call-back-unit'.  If the
5871 : user has specified that a maximally 64-bit perl is to be built,
5872 : we may need to set or change some other defaults.
5873 if $test -f use64bitall.cbu; then
5874         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5875         . ./use64bitall.cbu
5876 fi
5877 case "$use64bitall" in
5878 "$define"|true|[yY]*)
5879         case "$longsize" in
5880         4) case "$archname64" in
5881            ''|64int) archname64=64all ;;
5882            esac
5883            ;;
5884         esac
5885         ;;
5886 esac
5887
5888 case "$d_quad:$use64bitint" in
5889 $undef:$define)
5890         cat >&4 <<EOF
5891
5892 *** You have chosen to use 64-bit integers,
5893 *** but none can be found.
5894 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5895 *** Cannot continue, aborting.
5896
5897 EOF
5898         exit 1
5899         ;;
5900 esac
5901
5902 : check for length of double
5903 echo " "
5904 case "$doublesize" in
5905 '')
5906         echo "Checking to see how big your double precision numbers are..." >&4
5907         $cat >try.c <<EOCP
5908 #include <stdio.h>
5909 #$i_stdlib I_STDLIB
5910 #ifdef I_STDLIB
5911 #include <stdlib.h>
5912 #endif
5913 int main()
5914 {
5915     printf("%d\n", (int)sizeof(double));
5916     exit(0);
5917 }
5918 EOCP
5919         set try
5920         if eval $compile_ok; then
5921                 doublesize=`$run ./try`
5922                 echo "Your double is $doublesize bytes long."
5923         else
5924                 dflt='8'
5925                 echo "(I can't seem to compile the test program.  Guessing...)"
5926                 rp="What is the size of a double precision number (in bytes)?"
5927                 . ./myread
5928                 doublesize="$ans"
5929         fi
5930         ;;
5931 esac
5932 $rm_try
5933
5934 : check for long doubles
5935 echo " "
5936 echo "Checking to see if you have long double..." >&4
5937 echo 'int main() { long double x = 7.0; }' > try.c
5938 set try
5939 if eval $compile; then
5940         val="$define"
5941         echo "You have long double."
5942 else
5943         val="$undef"
5944         echo "You do not have long double."
5945 fi
5946 $rm_try
5947 set d_longdbl
5948 eval $setvar
5949
5950 : check for length of long double
5951 case "${d_longdbl}${longdblsize}" in
5952 $define)
5953         echo " "
5954         echo "Checking to see how big your long doubles are..." >&4
5955         $cat >try.c <<'EOCP'
5956 #include <stdio.h>
5957 int main()
5958 {
5959         printf("%d\n", sizeof(long double));
5960 }
5961 EOCP
5962         set try
5963         set try
5964         if eval $compile; then
5965                 longdblsize=`$run ./try`
5966                 echo "Your long doubles are $longdblsize bytes long."
5967         else
5968                 dflt='8'
5969                 echo " "
5970                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5971                 rp="What is the size of a long double (in bytes)?"
5972                 . ./myread
5973                 longdblsize="$ans"
5974         fi
5975         if $test "X$doublesize" = "X$longdblsize"; then
5976                 echo "That isn't any different from an ordinary double."
5977                 echo "I'll keep your setting anyway, but you may see some"
5978                 echo "harmless compilation warnings."
5979         fi
5980         ;;
5981 esac
5982 $rm_try
5983
5984 : determine the architecture name
5985 echo " "
5986 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5987         tarch=`arch`"-$osname"
5988 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5989         if uname -m > tmparch 2>&1 ; then
5990                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5991                         -e 's/$/'"-$osname/" tmparch`
5992         else
5993                 tarch="$osname"
5994         fi
5995         $rm -f tmparch
5996 else
5997         tarch="$osname"
5998 fi
5999 case "$myarchname" in
6000 ''|"$tarch") ;;
6001 *)
6002         echo "(Your architecture name used to be $myarchname.)"
6003         archname=''
6004         ;;
6005 esac
6006 case "$targetarch" in
6007 '') ;;
6008 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6009 esac
6010 myarchname="$tarch"
6011 case "$archname" in
6012 '') dflt="$tarch";;
6013 *) dflt="$archname";;
6014 esac
6015 rp='What is your architecture name'
6016 . ./myread
6017 archname="$ans"
6018 case "$usethreads" in
6019 $define)
6020         echo "Threads selected." >&4
6021         case "$archname" in
6022         *-thread*) echo "...and architecture name already has -thread." >&4
6023                 ;;
6024         *)      archname="$archname-thread"
6025                 echo "...setting architecture name to $archname." >&4
6026                 ;;
6027         esac
6028         ;;
6029 esac
6030 case "$usemultiplicity" in
6031 $define)
6032         echo "Multiplicity selected." >&4
6033         case "$archname" in
6034         *-multi*) echo "...and architecture name already has -multi." >&4
6035                 ;;
6036         *)      archname="$archname-multi"
6037                 echo "...setting architecture name to $archname." >&4
6038                 ;;
6039         esac
6040         ;;
6041 esac
6042 case "$use64bitint$use64bitall" in
6043 *"$define"*)
6044         case "$archname64" in
6045         '')
6046                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6047                 ;;
6048         *)
6049                 case "$use64bitint" in
6050                 "$define") echo "64 bit integers selected." >&4 ;;
6051                 esac
6052                 case "$use64bitall" in
6053                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6054                 esac
6055                 case "$archname" in
6056                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6057                         ;;
6058                 *)      archname="$archname-$archname64"
6059                         echo "...setting architecture name to $archname." >&4
6060                         ;;
6061                 esac
6062                 ;;
6063         esac
6064 esac
6065 case "$uselongdouble" in
6066 $define)
6067         echo "Long doubles selected." >&4
6068         case "$longdblsize" in
6069         $doublesize)
6070                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6071                 ;;
6072         *)
6073                 case "$archname" in
6074                 *-ld*) echo "...and architecture name already has -ld." >&4
6075                         ;;
6076                 *)      archname="$archname-ld"
6077                         echo "...setting architecture name to $archname." >&4
6078                         ;;
6079                 esac
6080                 ;;
6081         esac
6082         ;;
6083 esac
6084 if $test -f archname.cbu; then
6085         echo "Your platform has some specific hints for architecture name, using them..."
6086         . ./archname.cbu
6087 fi
6088
6089 : set the prefixit variable, to compute a suitable default value
6090 prefixit='case "$3" in
6091 ""|none)
6092         case "$oldprefix" in
6093         "") eval "$1=\"\$$2\"";;
6094         *)
6095                 case "$3" in
6096                 "") eval "$1=";;
6097                 none)
6098                         eval "tp=\"\$$2\"";
6099                         case "$tp" in
6100                         ""|" ") eval "$1=\"\$$2\"";;
6101                         *) eval "$1=";;
6102                         esac;;
6103                 esac;;
6104         esac;;
6105 *)
6106         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6107         case "$tp" in
6108         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6109         /*-$oldprefix/*|\~*-$oldprefix/*)
6110                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6111         *) eval "$1=\"\$$2\"";;
6112         esac;;
6113 esac'
6114
6115 : determine installation style
6116 : For now, try to deduce it from prefix unless it is already set.
6117 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6118 case "$installstyle" in
6119 '')     case "$prefix" in
6120                 *perl*) dflt='lib';;
6121                 *) dflt='lib/perl5' ;;
6122         esac
6123         ;;
6124 *)      dflt="$installstyle" ;;
6125 esac
6126 : Probably not worth prompting for this since we prompt for all
6127 : the directories individually, and the prompt would be too long and
6128 : confusing anyway.
6129 installstyle=$dflt
6130
6131 : determine where public executables go
6132 echo " "
6133 set dflt bin bin
6134 eval $prefixit
6135 fn=d~
6136 rp='Pathname where the public executables will reside?'
6137 . ./getfile
6138 if $test "X$ansexp" != "X$binexp"; then
6139         installbin=''
6140 fi
6141 prefixvar=bin
6142 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6143 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6144 :     this via initialinstalllocation
6145 . ./setprefixvar
6146
6147 case "$userelocatableinc" in
6148 $define|true|[yY]*)     dflt='y' ;;
6149 *)                      dflt='n' ;;
6150 esac
6151 cat <<EOM
6152
6153 Would you like to build Perl so that the installation is relocatable, so that
6154 library paths in @INC are determined relative to the path of the perl binary?
6155 This is not advised for system Perl installs, or if you need to run setid
6156 scripts or scripts under taint mode.
6157
6158 If this doesn't make any sense to you, just accept the default '$dflt'.
6159 EOM
6160 rp='Use relocatable @INC?'
6161 . ./myread
6162 case "$ans" in
6163 y|Y)    val="$define" ;;
6164 *)      val="$undef"  ;;
6165 esac
6166 set userelocatableinc
6167 eval $setvar
6168
6169 initialinstalllocation="$binexp"
6170 : Default prefix is now "up one level from where the binaries are"
6171 case "$userelocatableinc" in
6172 $define|true|[yY]*)
6173     bin=".../"
6174     binexp=".../"
6175     prefix=".../.."
6176     prefixexp=".../.."
6177     installprefixexp=".../.."
6178     ;;
6179 esac
6180
6181 : determine where private library files go
6182 : Usual default is /usr/local/lib/perl5/$version.
6183 : Also allow things like /opt/perl/lib/$version, since
6184 : /opt/perl/lib/perl5... would be redundant.
6185 : The default "style" setting is made in installstyle.U
6186 case "$installstyle" in
6187 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6188 *)       set dflt privlib lib/$version ;;
6189 esac
6190 eval $prefixit
6191 $cat <<EOM
6192
6193 There are some auxiliary files for $package that need to be put into a
6194 private library directory that is accessible by everyone.
6195
6196 EOM
6197 fn=$binexp
6198 fn=d~+
6199 rp='Pathname where the private library files will reside?'
6200 . ./getfile
6201 prefixvar=privlib
6202 . ./setprefixvar
6203
6204 : set the prefixup variable, to restore leading tilda escape
6205 prefixup='case "$prefixexp" in
6206 "$prefix") ;;
6207 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6208 esac'
6209
6210 : determine where public architecture dependent libraries go
6211 set archlib archlib
6212 eval $prefixit
6213 : privlib default is /usr/local/lib/$package/$version
6214 : archlib default is /usr/local/lib/$package/$version/$archname
6215 : privlib may have an optional trailing /share.
6216 tdflt=`echo $privlib | $sed 's,/share$,,'`
6217 tdflt=$tdflt/$archname
6218 case "$archlib" in
6219 '')     dflt=$tdflt
6220         ;;
6221 *)      dflt="$archlib"
6222     ;;
6223 esac
6224 $cat <<EOM
6225
6226 $spackage contains architecture-dependent library files.  If you are
6227 sharing libraries in a heterogeneous environment, you might store
6228 these files in a separate location.  Otherwise, you can just include
6229 them with the rest of the public library files.
6230
6231 EOM
6232 fn=$binexp
6233 fn=d+~
6234 rp='Where do you want to put the public architecture-dependent libraries?'
6235 . ./getfile
6236 prefixvar=archlib
6237 . ./setprefixvar
6238 if $test X"$archlib" = X"$privlib"; then
6239         d_archlib="$undef"
6240 else
6241         d_archlib="$define"
6242 fi
6243
6244 : see if setuid scripts can be secure
6245 $cat <<EOM
6246
6247 Some kernels have a bug that prevents setuid #! scripts from being
6248 secure.  Some sites have disabled setuid #! scripts because of this.
6249
6250 First let's decide if your kernel supports secure setuid #! scripts.
6251 (If setuid #! scripts would be secure but have been disabled anyway,
6252 don't say that they are secure if asked.)
6253
6254 EOM
6255
6256 val="$undef"
6257 if $test -d /dev/fd; then
6258         echo "#!$ls" >reflect
6259         chmod +x,u+s reflect
6260         ./reflect >flect 2>&1
6261         if $contains "/dev/fd" flect >/dev/null; then
6262                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6263                 val="$define"
6264         else
6265                 $cat <<EOM
6266 If you are not sure if they are secure, I can check but I'll need a
6267 username and password different from the one you are using right now.
6268 If you don't have such a username or don't want me to test, simply
6269 enter 'none'.
6270
6271 EOM
6272                 rp='Other username to test security of setuid scripts with?'
6273                 dflt='none'
6274                 . ./myread
6275                 case "$ans" in
6276                 n|none)
6277                         case "$d_suidsafe" in
6278                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6279                                 dflt=n;;
6280                         "$undef")
6281                                 echo "Well, the $hint value is *not* secure." >&4
6282                                 dflt=n;;
6283                         *)      echo "Well, the $hint value *is* secure." >&4
6284                                 dflt=y;;
6285                         esac
6286                         ;;
6287                 *)
6288                         $rm -f reflect flect
6289                         echo "#!$ls" >reflect
6290                         chmod +x,u+s reflect
6291                         echo >flect
6292                         chmod a+w flect
6293                         echo '"su" will (probably) prompt you for '"$ans's password."
6294                         su $ans -c './reflect >flect'
6295                         if $contains "/dev/fd" flect >/dev/null; then
6296                                 echo "Okay, it looks like setuid scripts are secure." >&4
6297                                 dflt=y
6298                         else
6299                                 echo "I don't think setuid scripts are secure." >&4
6300                                 dflt=n
6301                         fi
6302                         ;;
6303                 esac
6304                 rp='Does your kernel have *secure* setuid scripts?'
6305                 . ./myread
6306                 case "$ans" in
6307                 [yY]*)  val="$define";;
6308                 *)      val="$undef";;
6309                 esac
6310         fi
6311 else
6312         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6313         echo "(That's for file descriptors, not floppy disks.)"
6314         val="$undef"
6315 fi
6316 set d_suidsafe
6317 eval $setvar
6318
6319 $rm -f reflect flect
6320
6321 : now see if they want to do setuid emulation
6322 if $test $patchlevel -lt 11; then
6323 echo " "
6324 val="$undef"
6325 case "$d_suidsafe" in
6326 "$define")
6327         val="$undef"
6328         echo "No need to emulate SUID scripts since they are secure here." >&4
6329         ;;
6330 *)
6331         $cat <<EOM
6332 Some systems have disabled setuid scripts, especially systems where
6333 setuid scripts cannot be secure.  On systems where setuid scripts have
6334 been disabled, the setuid/setgid bits on scripts are currently
6335 useless.  It is possible for $package to detect those bits and emulate
6336 setuid/setgid in a secure fashion.  This emulation will only work if
6337 setuid scripts have been disabled in your kernel.
6338
6339 EOM
6340         case "$d_dosuid" in
6341         "$define") dflt=y ;;
6342         *) dflt=n ;;
6343         esac
6344         rp="Do you want to do setuid/setgid emulation?"
6345         . ./myread
6346         case "$ans" in
6347         [yY]*)  val="$define";;
6348         *)      val="$undef";;
6349         esac
6350         ;;
6351 esac
6352 set d_dosuid
6353 eval $setvar
6354 else
6355     case "$d_dosuid" in
6356         "$define")
6357         cat >&4 <<EOH
6358
6359 SUID emulation has been removed for 5.12
6360 Please re-run Configure without -Dd_dosuid
6361
6362 EOH
6363         exit 1;
6364         ;;
6365     esac
6366     d_dosuid=undef
6367 fi
6368
6369 : Find perl5.005 or later.
6370 echo "Looking for a previously installed perl5.005 or later... "
6371 case "$perl5" in
6372 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6373                 : Check if this perl is recent and can load a simple module
6374                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6375                         perl5=$tdir/perl
6376                         break;
6377                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6378                         perl5=$tdir/perl5
6379                         break;
6380                 fi
6381         done
6382         ;;
6383 *)      perl5="$perl5"
6384         ;;
6385 esac
6386 case "$perl5" in
6387 '')     echo "None found.  That's ok.";;
6388 *)      echo "Using $perl5." ;;
6389 esac
6390
6391 : Set the siteprefix variables
6392 $cat <<EOM
6393
6394 After $package is installed, you may wish to install various
6395 add-on modules and utilities.  Typically, these add-ons will
6396 be installed under $prefix with the rest
6397 of this package.  However, you may wish to install such add-ons
6398 elsewhere under a different prefix.
6399
6400 If you do not wish to put everything under a single prefix, that's
6401 ok.  You will be prompted for the individual locations; this siteprefix
6402 is only used to suggest the defaults.
6403
6404 The default should be fine for most people.
6405
6406 EOM
6407 fn=d~+
6408 rp='Installation prefix to use for add-on modules and utilities?'
6409 : XXX Here might be another good place for an installstyle setting.
6410 case "$siteprefix" in
6411 '') dflt=$prefix ;;
6412 *)  dflt=$siteprefix ;;
6413 esac
6414 . ./getfile
6415 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6416 oldsiteprefix=''
6417 case "$siteprefix" in
6418 '') ;;
6419 *)      case "$ans" in
6420         "$prefix") ;;
6421         *) oldsiteprefix="$prefix";;
6422         esac
6423         ;;
6424 esac
6425 siteprefix="$ans"
6426 siteprefixexp="$ansexp"
6427
6428 : determine where site specific libraries go.
6429 : Usual default is /usr/local/lib/perl5/site_perl/$version
6430 : The default "style" setting is made in installstyle.U
6431 : XXX No longer works with Prefixit stuff.
6432 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6433 case "$sitelib" in
6434 '') case "$installstyle" in
6435         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6436         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6437         esac
6438         ;;
6439 *)      dflt="$sitelib"
6440         ;;
6441 esac
6442 $cat <<EOM
6443
6444 The installation process will create a directory for
6445 site-specific extensions and modules.  Most users find it convenient
6446 to place all site-specific files in this directory rather than in the
6447 main distribution directory.
6448
6449 EOM
6450 fn=d~+
6451 rp='Pathname for the site-specific library files?'
6452 . ./getfile
6453 prefixvar=sitelib
6454 . ./setprefixvar
6455 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6456
6457 : Determine list of previous versions to include in @INC
6458 $cat > getverlist <<EOPL
6459 #!$perl5 -w
6460 use File::Basename;
6461 \$api_versionstring = "$api_versionstring";
6462 \$version = "$version";
6463 \$stem = "$sitelib_stem";
6464 \$archname = "$archname";
6465 EOPL
6466         $cat >> getverlist <<'EOPL'
6467 # The list found is store twice for each entry: the original name, and
6468 # the binary broken down version as pack "sss", so sorting is easy and
6469 # unambiguous. This will work for all versions that have a maximum of
6470 # three digit groups, separate by '.'s or '_'s. Names are extended with
6471 # ".0.0" to ensure at least three elements for the pack.
6472 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6473
6474 # Can't have leading @ because metaconfig interprets it as a command!
6475 ;@inc_version_list=();
6476 # XXX Redo to do opendir/readdir?
6477 if (-d $stem) {
6478     chdir($stem);
6479     ;@candidates = map {
6480         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6481     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6482 }
6483 else {
6484     ;@candidates = ();
6485 }
6486
6487 ($pversion, $aversion, $vsn5005) = map {
6488     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6489 foreach $d (@candidates) {
6490     if ($d->[1] lt $pversion) {
6491         if ($d->[1] ge $aversion) {
6492             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6493         }
6494         elsif ($d->[1] ge $vsn5005) {
6495             unshift(@inc_version_list, grep { -d } $d->[0]);
6496         }
6497     }
6498     else {
6499         # Skip newer version.  I.e. don't look in
6500         # 5.7.0 if we're installing 5.6.1.
6501     }
6502 }
6503
6504 if (@inc_version_list) {
6505     print join(' ', @inc_version_list);
6506 }
6507 else {
6508     # Blank space to preserve value for next Configure run.
6509     print " ";
6510 }
6511 EOPL
6512 chmod +x getverlist
6513 case "$inc_version_list" in
6514 '')     if test -x "$perl5$exe_ext"; then
6515                 dflt=`$perl5 getverlist`
6516         else
6517                 dflt='none'
6518         fi
6519         ;;
6520 $undef) dflt='none' ;;
6521 *)  eval dflt=\"$inc_version_list\" ;;
6522 esac
6523 case "$dflt" in
6524 ''|' ') dflt=none ;;
6525 esac
6526 case "$dflt" in
6527 5.005) dflt=none ;;
6528 esac
6529 $cat <<EOM
6530
6531 In order to ease the process of upgrading, this version of perl
6532 can be configured to use modules built and installed with earlier
6533 versions of perl that were installed under $prefix.  Specify here
6534 the list of earlier versions that this version of perl should check.
6535 If Configure detected no earlier versions of perl installed under
6536 $prefix, then the list will be empty.  Answer 'none' to tell perl
6537 to not search earlier versions.
6538
6539 The default should almost always be sensible, so if you're not sure,
6540 just accept the default.
6541 EOM
6542
6543 rp='List of earlier versions to include in @INC?'
6544 . ./myread
6545 case "$ans" in
6546 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6547 *) inc_version_list="$ans" ;;
6548 esac
6549 case "$inc_version_list" in
6550 ''|' ')
6551         inc_version_list_init='0'
6552         d_inc_version_list="$undef"
6553         ;;
6554 *)      inc_version_list_init=`echo $inc_version_list |
6555                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6556         d_inc_version_list="$define"
6557         ;;
6558 esac
6559 $rm -f getverlist
6560
6561 : see if malloc/malloc.h has to be included
6562 set malloc/malloc.h i_mallocmalloc
6563 eval $inhdr
6564
6565 : see if this is a malloc.h system
6566 : we want a real compile instead of Inhdr because some systems have a
6567 : malloc.h that just gives a compile error saying to use stdlib.h instead
6568 echo " "
6569 $cat >try.c <<EOCP
6570 #include <stdlib.h>
6571 #include <malloc.h>
6572 #$i_mallocmalloc I_MALLOCMALLOC
6573 #ifdef I_MALLOCMALLOC
6574 # include <malloc/malloc.h>
6575 #endif
6576
6577 int main () { return 0; }
6578 EOCP
6579 set try
6580 if eval $compile; then
6581     echo "<malloc.h> found." >&4
6582     val="$define"
6583 else
6584     echo "<malloc.h> NOT found." >&4
6585     val="$undef"
6586 fi
6587 $rm_try
6588 set i_malloc
6589 eval $setvar
6590
6591 : check for void type
6592 echo " "
6593 echo "Checking to see how well your C compiler groks the void type..." >&4
6594 case "$voidflags" in
6595 '')
6596         $cat >try.c <<EOCP
6597 #$i_stdlib I_STDLIB
6598 #ifdef I_STDLIB
6599 #include <stdlib.h>
6600 #endif
6601 #if TRY & 1
6602 void sub() {
6603 #else
6604 sub() {
6605 #endif
6606         extern void moo();      /* function returning void */
6607         void (*goo)();          /* ptr to func returning void */
6608 #if TRY & 8
6609         void *hue;              /* generic ptr */
6610 #endif
6611 #if TRY & 2
6612         void (*foo[10])();
6613 #endif
6614
6615 #if TRY & 4
6616         if(goo == moo) {
6617                 exit(0);
6618         }
6619 #endif
6620         exit(0);
6621 }
6622 int main() { sub(); }
6623 EOCP
6624         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6625                 voidflags=$defvoidused
6626         echo "Good.  It appears to support void to the level $package wants.">&4
6627                 if $contains warning .out >/dev/null 2>&1; then
6628                         echo "However, you might get some warnings that look like this:"
6629                         $cat .out
6630                 fi
6631         else
6632 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6633                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6634                         echo "It supports 1..."
6635                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6636                                 echo "It also supports 2..."
6637                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6638                                         voidflags=7
6639                                         echo "And it supports 4 but not 8 definitely."
6640                                 else
6641                                         echo "It doesn't support 4..."
6642                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6643                                                 voidflags=11
6644                                                 echo "But it supports 8."
6645                                         else
6646                                                 voidflags=3
6647                                                 echo "Neither does it support 8."
6648                                         fi
6649                                 fi
6650                         else
6651                                 echo "It does not support 2..."
6652                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6653                                         voidflags=13
6654                                         echo "But it supports 4 and 8."
6655                                 else
6656                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6657                                                 voidflags=5
6658                                                 echo "And it supports 4 but has not heard about 8."
6659                                         else
6660                                                 echo "However it supports 8 but not 4."
6661                                         fi
6662                                 fi
6663                         fi
6664                 else
6665                         echo "There is no support at all for void."
6666                         voidflags=0
6667                 fi
6668         fi
6669 esac
6670 case "$voidflags" in
6671 "$defvoidused") ;;
6672 *)      $cat >&4 <<'EOM'
6673   Support flag bits are:
6674     1: basic void declarations.
6675     2: arrays of pointers to functions returning void.
6676     4: operations between pointers to and addresses of void functions.
6677     8: generic void pointers.
6678 EOM
6679         dflt="$voidflags";
6680         rp="Your void support flags add up to what?"
6681         . ./myread
6682         voidflags="$ans"
6683         ;;
6684 esac
6685 $rm_try
6686
6687 : check for length of pointer
6688 echo " "
6689 case "$ptrsize" in
6690 '')
6691         echo "Checking to see how big your pointers are..." >&4
6692         if test "$voidflags" -gt 7; then
6693                 echo '#define VOID_PTR char *' > try.c
6694         else
6695                 echo '#define VOID_PTR void *' > try.c
6696         fi
6697         $cat >>try.c <<EOCP
6698 #include <stdio.h>
6699 #$i_stdlib I_STDLIB
6700 #ifdef I_STDLIB
6701 #include <stdlib.h>
6702 #endif
6703 int main()
6704 {
6705     printf("%d\n", (int)sizeof(VOID_PTR));
6706     exit(0);
6707 }
6708 EOCP
6709         set try
6710         if eval $compile_ok; then
6711                 ptrsize=`$run ./try`
6712                 echo "Your pointers are $ptrsize bytes long."
6713         else
6714                 dflt='4'
6715                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6716                 rp="What is the size of a pointer (in bytes)?"
6717                 . ./myread
6718                 ptrsize="$ans"
6719         fi
6720         ;;
6721 esac
6722 $rm_try
6723 case "$use64bitall" in
6724 "$define"|true|[yY]*)
6725         case "$ptrsize" in
6726         4)      cat <<EOM >&4
6727
6728 *** You have chosen a maximally 64-bit build,
6729 *** but your pointers are only 4 bytes wide.
6730 *** Please rerun Configure without -Duse64bitall.
6731 EOM
6732                 case "$d_quad" in
6733                 define)
6734                         cat <<EOM >&4
6735 *** Since you have quads, you could possibly try with -Duse64bitint.
6736 EOM
6737                         ;;
6738                 esac
6739                 cat <<EOM >&4
6740 *** Cannot continue, aborting.
6741
6742 EOM
6743
6744                 exit 1
6745                 ;;
6746         esac
6747         ;;
6748 esac
6749
6750
6751 : determine whether to use malloc wrapping
6752 echo " "
6753 case "$usemallocwrap" in
6754 [yY]*|true|$define)     dflt='y' ;;
6755 [nN]*|false|$undef)     dflt='n' ;;
6756 *)      case "$usedevel" in
6757         [yY]*|true|$define)     dflt='y' ;;
6758         *) dflt='n' ;;
6759         esac
6760         ;;
6761 esac
6762 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6763 . ./myread
6764 usemallocwrap="$ans"
6765 case "$ans" in
6766 y*|true)
6767         usemallocwrap="$define" ;;
6768 *)
6769         usemallocwrap="$undef" ;;
6770 esac
6771
6772 : determine which malloc to compile in
6773 echo " "
6774 case "$usemymalloc" in
6775 [yY]*|true|$define)     dflt='y' ;;
6776 [nN]*|false|$undef)     dflt='n' ;;
6777 *)      case "$ptrsize" in
6778         4) dflt='y' ;;
6779         *) dflt='n' ;;
6780         esac
6781         if test "$useithreads" = "$define"; then dflt='n'; fi
6782         ;;
6783 esac
6784 rp="Do you wish to attempt to use the malloc that comes with $package?"
6785 . ./myread
6786 usemymalloc="$ans"
6787 case "$ans" in
6788 y*|true)
6789         usemymalloc='y'
6790         mallocsrc='malloc.c'
6791         mallocobj="malloc$_o"
6792         d_mymalloc="$define"
6793         case "$libs" in
6794         *-lmalloc*)
6795                 : Remove malloc from list of libraries to use
6796                 echo "Removing unneeded -lmalloc from library list" >&4
6797                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6798                 shift
6799                 libs="$*"
6800                 echo "libs = $libs" >&4
6801                 ;;
6802         esac
6803         ;;
6804 *)
6805         usemymalloc='n'
6806         mallocsrc=''
6807         mallocobj=''
6808         d_mymalloc="$undef"
6809         ;;
6810 esac
6811
6812 : compute the return types of malloc and free
6813 echo " "
6814 $cat >malloc.c <<END
6815 #$i_malloc I_MALLOC
6816 #$i_stdlib I_STDLIB
6817 #include <stdio.h>
6818 #include <sys/types.h>
6819 #ifdef I_MALLOC
6820 #include <malloc.h>
6821 #endif
6822 #ifdef I_STDLIB
6823 #include <stdlib.h>
6824 #endif
6825 #ifdef TRY_MALLOC
6826 void *malloc();
6827 #endif
6828 #ifdef TRY_FREE
6829 void free();
6830 #endif
6831 END
6832 case "$malloctype" in
6833 '')
6834         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6835                 malloctype='void *'
6836         else
6837                 malloctype='char *'
6838         fi
6839         ;;
6840 esac
6841 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6842
6843 case "$freetype" in
6844 '')
6845         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6846                 freetype='void'
6847         else
6848                 freetype='int'
6849         fi
6850         ;;
6851 esac
6852 echo "Your system uses $freetype free(), it would seem." >&4
6853 $rm -f malloc.[co]
6854 : determine where site specific architecture-dependent libraries go.
6855 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6856 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6857 : sitelib may have an optional trailing /share.
6858 case "$sitearch" in
6859 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6860         dflt="$dflt/$archname"
6861         ;;
6862 *)      dflt="$sitearch"
6863         ;;
6864 esac
6865 set sitearch sitearch none
6866 eval $prefixit
6867 $cat <<EOM
6868
6869 The installation process will also create a directory for
6870 architecture-dependent site-specific extensions and modules.
6871
6872 EOM
6873 fn=d~+
6874 rp='Pathname for the site-specific architecture-dependent library files?'
6875 . ./getfile
6876 prefixvar=sitearch
6877 . ./setprefixvar
6878 if $test X"$sitearch" = X"$sitelib"; then
6879         d_sitearch="$undef"
6880 else
6881         d_sitearch="$define"
6882 fi
6883
6884 : Set the vendorprefix variables
6885 $cat <<EOM
6886
6887 The installation process will also create a directory for
6888 vendor-supplied add-ons.  Vendors who supply perl with their system
6889 may find it convenient to place all vendor-supplied files in this
6890 directory rather than in the main distribution directory.  This will
6891 ease upgrades between binary-compatible maintenance versions of perl.
6892
6893 Of course you may also use these directories in whatever way you see
6894 fit.  For example, you might use them to access modules shared over a
6895 company-wide network.
6896
6897 The default answer should be fine for most people.
6898 This causes further questions about vendor add-ons to be skipped
6899 and no vendor-specific directories will be configured for perl.
6900
6901 EOM
6902 rp='Do you want to configure vendor-specific add-on directories?'
6903 case "$usevendorprefix" in
6904 define|true|[yY]*) dflt=y ;;
6905 *)      : User may have set vendorprefix directly on Configure command line.
6906         case "$vendorprefix" in
6907         ''|' ') dflt=n ;;
6908         *)      dflt=y ;;
6909         esac
6910         ;;
6911 esac
6912 . ./myread
6913 case "$ans" in
6914 [yY]*)  fn=d~+
6915         rp='Installation prefix to use for vendor-supplied add-ons?'
6916         case "$vendorprefix" in
6917         '') dflt='' ;;
6918         *)  dflt=$vendorprefix ;;
6919         esac
6920         . ./getfile
6921         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6922         oldvendorprefix=''
6923         case "$vendorprefix" in
6924         '') ;;
6925         *)      case "$ans" in
6926                 "$prefix") ;;
6927                 *) oldvendorprefix="$prefix";;
6928                 esac
6929                 ;;
6930         esac
6931         usevendorprefix="$define"
6932         vendorprefix="$ans"
6933         vendorprefixexp="$ansexp"
6934         ;;
6935 *)      usevendorprefix="$undef"
6936         vendorprefix=''
6937         vendorprefixexp=''
6938         ;;
6939 esac
6940
6941 : Set the vendorlib variables
6942 case "$vendorprefix" in
6943 '')     d_vendorlib="$undef"
6944         vendorlib=''
6945         vendorlibexp=''
6946         ;;
6947 *)      d_vendorlib="$define"
6948         : determine where vendor-supplied modules go.
6949         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6950         case "$vendorlib" in
6951         '')
6952                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6953                 case "$installstyle" in
6954                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6955                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6956                 esac
6957                 ;;
6958         *)      dflt="$vendorlib"
6959                 ;;
6960         esac
6961         fn=d~+
6962         rp='Pathname for the vendor-supplied library files?'
6963         . ./getfile
6964         vendorlib="$ans"
6965         vendorlibexp="$ansexp"
6966         ;;
6967 esac
6968 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6969 prefixvar=vendorlib
6970 . ./installprefix
6971
6972 : Set the vendorarch variables
6973 case "$vendorprefix" in
6974 '')     d_vendorarch="$undef"
6975         vendorarch=''
6976         vendorarchexp=''
6977         ;;
6978 *)      d_vendorarch="$define"
6979         : determine where vendor-supplied architecture-dependent libraries go.
6980         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6981         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6982         : vendorlib may have an optional trailing /share.
6983         case "$vendorarch" in
6984         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6985                 dflt="$dflt/$archname"
6986                 ;;
6987         *)      dflt="$vendorarch" ;;
6988         esac
6989         fn=d~+
6990         rp='Pathname for vendor-supplied architecture-dependent files?'
6991         . ./getfile
6992         vendorarch="$ans"
6993         vendorarchexp="$ansexp"
6994         ;;
6995 esac
6996 prefixvar=vendorarch
6997 . ./installprefix
6998 if $test X"$vendorarch" = X"$vendorlib"; then
6999         d_vendorarch="$undef"
7000 else
7001         d_vendorarch="$define"
7002 fi
7003
7004 : Final catch-all directories to search
7005 $cat <<EOM
7006
7007 Lastly, you can have perl look in other directories for extensions and
7008 modules in addition to those already specified.
7009 These directories will be searched after 
7010         $sitearch 
7011         $sitelib 
7012 EOM
7013 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7014 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7015 echo ' '
7016 case "$otherlibdirs" in
7017 ''|' ') dflt='none' ;;
7018 *)      dflt="$otherlibdirs" ;;
7019 esac
7020 $cat <<EOM
7021 Enter a colon-separated set of extra paths to include in perl's @INC
7022 search path, or enter 'none' for no extra paths.
7023
7024 EOM
7025
7026 rp='Colon-separated list of additional directories for perl to search?'
7027 . ./myread
7028 case "$ans" in
7029 ' '|''|none)    otherlibdirs=' ' ;;     
7030 *)      otherlibdirs="$ans" ;;
7031 esac
7032 case "$otherlibdirs" in
7033 ' ') val=$undef ;;
7034 *)      val=$define ;;
7035 esac
7036 set d_perl_otherlibdirs
7037 eval $setvar
7038
7039 : Cruising for prototypes
7040 echo " "
7041 echo "Checking out function prototypes..." >&4
7042 $cat >prototype.c <<EOCP
7043 #$i_stdlib I_STDLIB
7044 #ifdef I_STDLIB
7045 #include <stdlib.h>
7046 #endif
7047 int main(int argc, char *argv[]) {
7048         exit(0);}
7049 EOCP
7050 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7051         echo "Your C compiler appears to support function prototypes."
7052         val="$define"
7053 else
7054         echo "Your C compiler doesn't seem to understand function prototypes."
7055         val="$undef"
7056 fi
7057 set prototype
7058 eval $setvar
7059 $rm -f prototype*
7060
7061 : Check if ansi2knr is required
7062 case "$prototype" in
7063 "$define") ;;
7064 *)      ansi2knr='ansi2knr'
7065         echo " "
7066         cat <<EOM >&4
7067
7068 $me:  FATAL ERROR:
7069 This version of $package can only be compiled by a compiler that 
7070 understands function prototypes.  Unfortunately, your C compiler 
7071         $cc $ccflags
7072 doesn't seem to understand them.  Sorry about that.
7073
7074 If GNU cc is available for your system, perhaps you could try that instead.  
7075
7076 Eventually, we hope to support building Perl with pre-ANSI compilers.
7077 If you would like to help in that effort, please contact <perlbug@perl.org>.
7078
7079 Aborting Configure now.
7080 EOM
7081         exit 2
7082         ;;
7083 esac
7084
7085 : DTrace support
7086 dflt_dtrace='/usr/sbin/dtrace'
7087 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7088
7089 cat <<EOM
7090
7091 Perl can be built to support DTrace on platforms that support it.
7092 DTrace is a diagnosis and performance analysis tool from Sun.
7093
7094 If this doesn't make any sense to you, just accept the default '$dflt'.
7095 EOM
7096
7097 while $test 1 ; do
7098         case "$usedtrace" in
7099         $define|true|[yY]*)
7100                 dflt='y'
7101                 ;;
7102         ?*)
7103                 dflt='y'
7104                 dflt_dtrace=$usedtrace
7105                 ;;
7106         *)
7107                 dflt='n'
7108                 ;;
7109         esac
7110
7111         rp='Support DTrace if available?'
7112         . ./myread
7113         case "$ans" in
7114         y|Y)    val="$define" ;;
7115         *)      val="$undef" ;;
7116         esac
7117         set usedtrace
7118         eval $setvar
7119
7120         test "X$usedtrace" != "X$define" && break
7121
7122         echo " "
7123         rp='Where is the dtrace executable?'
7124         dflt=$dflt_dtrace
7125         . ./getfile
7126         val="$ans"
7127         set dtrace
7128         eval $setvar
7129
7130         if $test -f $dtrace
7131         then
7132                 if $dtrace -h -s ../perldtrace.d \
7133                         -o perldtrace.tmp >/dev/null 2>&1 \
7134                         && rm -f perldtrace.tmp
7135                 then
7136                         echo " "
7137                         echo "Good: your $dtrace knows about the -h flag."
7138                 else
7139                         cat >&2 <<EOM
7140
7141 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7142 ***
7143 *** Your installed dtrace doesn't support the -h switch to compile a D
7144 *** program into a C header. Can't continue.
7145
7146 EOM
7147                         exit 1
7148                 fi
7149                 break;
7150         fi
7151
7152         case "$fastread" in
7153         yes)
7154                 cat >&2 <<EOM
7155
7156 *** $me:  Fatal Error:  $dtrace not found.
7157 *** Can't continue.
7158
7159 EOM
7160                 exit 1
7161                 ;;
7162         *)
7163                 echo "*** $dtrace was not found."
7164                 echo " "
7165                 ;;
7166         esac
7167 done
7168
7169 : See if we want extra modules installed
7170 echo " "
7171 case "$extras" in
7172 '') dflt='n';;
7173 *) dflt='y';;
7174 esac
7175 cat <<EOM
7176 Perl can be built with extra modules or bundles of modules which
7177 will be fetched from the CPAN and installed alongside Perl.
7178
7179 Notice that you will need access to the CPAN; either via the Internet,
7180 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7181 be asked later to configure the CPAN.pm module which will in turn do
7182 the installation of the rest of the extra modules or bundles.)
7183
7184 Notice also that if the modules require any external software such as
7185 libraries and headers (the libz library and the zlib.h header for the
7186 Compress::Zlib module, for example) you MUST have any such software
7187 already installed, this configuration process will NOT install such
7188 things for you.
7189
7190 If this doesn't make any sense to you, just accept the default '$dflt'.
7191 EOM
7192 rp='Install any extra modules (y or n)?'
7193 . ./myread
7194 case "$ans" in
7195 y|Y)
7196         cat <<EOM
7197
7198 Please list any extra modules or bundles to be installed from CPAN,
7199 with spaces between the names.  The names can be in any format the
7200 'install' command of CPAN.pm will understand.  (Answer 'none',
7201 without the quotes, to install no extra modules or bundles.)
7202 EOM
7203         rp='Extras?'
7204         dflt="$extras"
7205         . ./myread
7206         extras="$ans"
7207 esac
7208 case "$extras" in
7209 ''|'none')
7210         val=''
7211         $rm -f ../extras.lst
7212         ;;
7213 *)      echo "(Saving the list of extras for later...)"
7214         echo "$extras" > ../extras.lst
7215         val="'$extras'"
7216         ;;
7217 esac
7218 set extras
7219 eval $setvar
7220 echo " "
7221
7222 : determine where html pages for programs go
7223 set html1dir html1dir none
7224 eval $prefixit
7225 $cat <<EOM
7226
7227 If you wish to install html files for programs in $spackage, indicate
7228 the appropriate directory here.  To skip installing html files,
7229 answer "none".
7230 EOM
7231 case "$html1dir" in
7232 ''|none|$undef|' ') dflt=none ;;
7233 *) dflt=$html1dir ;;
7234 esac
7235 fn=dn+~
7236 rp="Directory for the main $spackage html pages?"
7237 . ./getfile
7238 prefixvar=html1dir
7239 . ./setprefixvar
7240 : Use ' ' for none so value is preserved next time through Configure
7241 $test X"$html1dir" = "X" && html1dir=' '
7242
7243 : determine where html pages for libraries and modules go
7244 set html3dir html3dir none
7245 eval $prefixit
7246 $cat <<EOM
7247
7248 If you wish to install html files for modules associated with $spackage,
7249 indicate the appropriate directory here.  To skip installing html files,
7250 answer "none".
7251 EOM
7252 : There is no obvious default.  If they have specified html1dir, then
7253 : try to key off that, possibly changing .../html1 into .../html3.
7254 case "$html3dir" in
7255 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7256 *) dflt=$html3dir ;;
7257 esac
7258 fn=dn+~
7259 rp="Directory for the $spackage module html pages?"
7260 . ./getfile
7261 prefixvar=html3dir
7262 . ./setprefixvar
7263 : Use ' ' for none so value is preserved next time through Configure
7264 $test X"$html3dir" = "X" && html3dir=' '
7265
7266 : determine whether to install perl also as /usr/bin/perl
7267
7268 echo " "
7269 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7270         $cat <<EOM
7271 Many scripts expect perl to be installed as /usr/bin/perl.
7272
7273 If you want to, I can install the perl you are about to compile
7274 as /usr/bin/perl (in addition to $bin/perl).
7275 EOM
7276         if test -f /usr/bin/perl; then
7277             $cat <<EOM
7278
7279 However, please note that because you already have a /usr/bin/perl,
7280 overwriting that with a new Perl would very probably cause problems.
7281 Therefore I'm assuming you don't want to do that (unless you insist).
7282
7283 EOM
7284             case "$installusrbinperl" in
7285             "$define"|[yY]*)    dflt='y';;
7286             *)                  dflt='n';;
7287             esac
7288         else
7289             $cat <<EOM
7290
7291 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7292
7293 EOM
7294             case "$installusrbinperl" in
7295             "$undef"|[nN]*)     dflt='n';;
7296             *)                  dflt='y';;
7297             esac
7298         fi
7299         rp="Do you want to install perl as /usr/bin/perl?"
7300         . ./myread
7301         case "$ans" in
7302         [yY]*)  val="$define";;
7303         *)      val="$undef" ;;
7304         esac
7305 else
7306         val="$undef"
7307 fi
7308 set installusrbinperl
7309 eval $setvar
7310
7311 : Check if we are using the GNU C library
7312 echo " "
7313 echo "Checking for GNU C Library..." >&4
7314 cat >try.c <<'EOCP'
7315 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7316    alone are insufficient to distinguish different versions, such as
7317    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7318    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7319 */
7320 #include <stdio.h>
7321 int main(void)
7322 {
7323 #ifdef __GLIBC__
7324 #   ifdef __GLIBC_MINOR__
7325 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7326 #           include <gnu/libc-version.h>
7327             printf("%s\n",  gnu_get_libc_version());
7328 #       else
7329             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7330 #       endif
7331 #   else
7332         printf("%d\n",  __GLIBC__);
7333 #   endif
7334     return 0;
7335 #else
7336     return 1;
7337 #endif
7338 }
7339 EOCP
7340 set try
7341 if eval $compile_ok && $run ./try > glibc.ver; then
7342         val="$define"
7343         gnulibc_version=`$cat glibc.ver`
7344         echo "You are using the GNU C Library version $gnulibc_version"
7345 else
7346         val="$undef"
7347         gnulibc_version=''
7348         echo "You are not using the GNU C Library"
7349 fi
7350 $rm_try glibc.ver
7351 set d_gnulibc
7352 eval $setvar
7353
7354 : see if nm is to be used to determine whether a symbol is defined or not
7355 case "$usenm" in
7356 '')
7357         dflt=''
7358         case "$d_gnulibc" in
7359         "$define")
7360                 echo " "
7361                 echo "nm probably won't work on the GNU C Library." >&4
7362                 dflt=n
7363                 ;;
7364         esac
7365         case "$dflt" in
7366         '') 
7367                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7368                         echo " "
7369                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7370                         echo "'nm' won't be sufficient on this sytem." >&4
7371                         dflt=n
7372                 fi
7373                 ;;
7374         esac
7375         case "$dflt" in
7376         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7377                 if $test $dflt -gt 20; then
7378                         dflt=y
7379                 else
7380                         dflt=n
7381                 fi
7382                 ;;
7383         esac
7384         ;;
7385 *)
7386         case "$usenm" in
7387         true|$define) dflt=y;;
7388         *) dflt=n;;
7389         esac
7390         ;;
7391 esac
7392 $cat <<EOM
7393
7394 I can use $nm to extract the symbols from your C libraries. This
7395 is a time consuming task which may generate huge output on the disk (up
7396 to 3 megabytes) but that should make the symbols extraction faster. The
7397 alternative is to skip the 'nm' extraction part and to compile a small
7398 test program instead to determine whether each symbol is present. If
7399 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7400 this may be the best solution.
7401
7402 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7403
7404 EOM
7405 rp="Shall I use $nm to extract C symbols from the libraries?"
7406 . ./myread
7407 case "$ans" in
7408 [Nn]*) usenm=false;;
7409 *) usenm=true;;
7410 esac
7411
7412 runnm=$usenm
7413 case "$reuseval" in
7414 true) runnm=false;;
7415 esac
7416
7417 : nm options which may be necessary
7418 case "$nm_opt" in
7419 '') if $test -f /mach_boot; then
7420                 nm_opt=''       # Mach
7421         elif $test -d /usr/ccs/lib; then
7422                 nm_opt='-p'     # Solaris (and SunOS?)
7423         elif $test -f /dgux; then
7424                 nm_opt='-p'     # DG-UX
7425         elif $test -f /lib64/rld; then
7426                 nm_opt='-p'     # 64-bit Irix
7427         else
7428                 nm_opt=''
7429         fi;;
7430 esac
7431
7432 : nm options which may be necessary for shared libraries but illegal
7433 : for archive libraries.  Thank you, Linux.
7434 case "$nm_so_opt" in
7435 '')     case "$myuname" in
7436         *linux*|gnu*)
7437                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7438                         nm_so_opt='--dynamic'
7439                 fi
7440                 ;;
7441         esac
7442         ;;
7443 esac
7444
7445 : Figure out where the libc is located
7446 case "$runnm" in
7447 true)
7448 : get list of predefined functions in a handy place
7449 echo " "
7450 case "$libc" in
7451 '') libc=unknown
7452         case "$libs" in
7453         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7454         esac
7455         ;;
7456 esac
7457 case "$libs" in
7458 '') ;;
7459 *)  for thislib in $libs; do
7460         case "$thislib" in
7461         -lc|-lc_s)
7462                 : Handle C library specially below.
7463                 ;;
7464         -l*)
7465                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7466                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7467                         :
7468                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7469                         :
7470                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7471                         :
7472                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7473                         :
7474                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7475                         :
7476                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7477                         :
7478                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7479                         :
7480                 else
7481                         try=''
7482                 fi
7483                 libnames="$libnames $try"
7484                 ;;
7485         *) libnames="$libnames $thislib" ;;
7486         esac
7487         done
7488         ;;
7489 esac
7490 xxx=normal
7491 case "$libc" in
7492 unknown)
7493         set /lib/libc.$so
7494         for xxx in $libpth; do
7495                 $test -r $1 || set $xxx/libc.$so
7496                 : The messy sed command sorts on library version numbers.
7497                 $test -r $1 || \
7498                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7499                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7500                                 h
7501                                 s/[0-9][0-9]*/0000&/g
7502                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7503                                 G
7504                                 s/\n/ /' | \
7505                          $sort | $sed -e 's/^.* //'`
7506                 eval set \$$#
7507         done
7508         $test -r $1 || set /usr/ccs/lib/libc.$so
7509         $test -r $1 || set /lib/libsys_s$_a
7510         ;;
7511 *)
7512         set blurfl
7513         ;;
7514 esac
7515 if $test -r "$1"; then
7516         echo "Your (shared) C library seems to be in $1."
7517         libc="$1"
7518 elif $test -r /lib/libc && $test -r /lib/clib; then
7519         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7520         xxx=apollo
7521         libc='/lib/clib /lib/libc'
7522         if $test -r /lib/syslib; then
7523                 echo "(Your math library is in /lib/syslib.)"
7524                 libc="$libc /lib/syslib"
7525         fi
7526 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7527         echo "Your C library seems to be in $libc, as you said before."
7528 elif $test -r $incpath/usr/lib/libc$_a; then
7529         libc=$incpath/usr/lib/libc$_a;
7530         echo "Your C library seems to be in $libc.  That's fine."
7531 elif $test -r /lib/libc$_a; then
7532         libc=/lib/libc$_a;
7533         echo "Your C library seems to be in $libc.  You're normal."
7534 else
7535         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7536                 :
7537         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7538                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7539         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7540                 :
7541         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7542                 :
7543         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7544                 :
7545         else
7546                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7547         fi
7548         if $test -r "$tans"; then
7549                 echo "Your C library seems to be in $tans, of all places."
7550                 libc=$tans
7551         else
7552                 libc='blurfl'
7553         fi
7554 fi
7555 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7556         dflt="$libc"
7557         cat <<EOM
7558
7559 If the guess above is wrong (which it might be if you're using a strange
7560 compiler, or your machine supports multiple models), you can override it here.
7561
7562 EOM
7563 else
7564         dflt=''
7565         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7566         cat >&4 <<EOM
7567 I can't seem to find your C library.  I've looked in the following places:
7568
7569 EOM
7570         $sed 's/^/      /' libpath
7571         cat <<EOM
7572
7573 None of these seems to contain your C library. I need to get its name...
7574
7575 EOM
7576 fi
7577 fn=f
7578 rp='Where is your C library?'
7579 . ./getfile
7580 libc="$ans"
7581
7582 echo " "
7583 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7584 set X `cat libnames`
7585 shift
7586 xxx=files
7587 case $# in 1) xxx=file; esac
7588 echo "Extracting names from the following $xxx for later perusal:" >&4
7589 echo " "
7590 $sed 's/^/      /' libnames >&4
7591 echo " "
7592 $echo $n "This may take a while...$c" >&4
7593
7594 for file in $*; do
7595         case $file in
7596         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7597         *) $nm $nm_opt $file 2>/dev/null;;
7598         esac
7599 done >libc.tmp
7600
7601 $echo $n ".$c"
7602 $grep fprintf libc.tmp > libc.ptf
7603 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7604 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7605 xxx='[ADTSIWi]'
7606 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7607         eval $xscan;\
7608         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7609                 eval $xrun
7610 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7611         eval $xscan;\
7612         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7613                 eval $xrun
7614 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7615         eval $xscan;\
7616         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7617                 eval $xrun
7618 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7619         eval $xscan;\
7620         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7621                 eval $xrun
7622 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7623         eval $xscan;\
7624         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7625                 eval $xrun
7626 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7627         eval $xscan;\
7628         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7629                 eval $xrun
7630 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7631                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7636         eval $xscan;\
7637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638                 eval $xrun
7639 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7640         eval $xscan;\
7641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7642                 eval $xrun
7643 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7644         eval $xscan;\
7645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7646                 eval $xrun
7647 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\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/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7652         eval $xscan;\
7653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7654                 eval $xrun
7655 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7656         eval $xscan;\
7657         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7658                 eval $xrun
7659 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7660         eval $xscan;\
7661         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7662                 eval $xrun
7663 else
7664         $nm -p $* 2>/dev/null >libc.tmp
7665         $grep fprintf libc.tmp > libc.ptf
7666         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7667                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7668         then
7669                 nm_opt='-p'
7670                 eval $xrun
7671         else
7672                 echo " "
7673                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7674                 com=''
7675                 if $ar t $libc > libc.tmp && \
7676                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7677                 then
7678                         for thisname in $libnames $libc; do
7679                                 $ar t $thisname >>libc.tmp
7680                         done
7681                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7682                         echo "Ok." >&4
7683                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7684                         for thisname in $libnames $libc; do
7685                                 $ar tv $thisname >>libc.tmp
7686                                 emximp -o tmp.imp $thisname \
7687                                     2>/dev/null && \
7688                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7689                                     < tmp.imp >>libc.tmp
7690                                 $rm -f tmp.imp
7691                         done
7692                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7693                         echo "Ok." >&4
7694                 else
7695                         echo "$ar didn't seem to work right." >&4
7696                         echo "Maybe this is a Cray...trying bld instead..." >&4
7697                         if  bld t $libc | \
7698                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7699                                 $test -s libc.list
7700                         then
7701                                 for thisname in $libnames; do
7702                                         bld t $libnames | \
7703                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7704                                         $ar t $thisname >>libc.tmp
7705                                 done
7706                                 echo "Ok." >&4
7707                         else
7708                                 echo "That didn't work either.  Giving up." >&4
7709                                 exit 1
7710                         fi
7711                 fi
7712         fi
7713 fi
7714 nm_extract="$com"
7715 case "$PASE" in
7716 define)
7717     echo " "
7718     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7719     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7720     ;;
7721 *)  if $test -f /lib/syscalls.exp; then
7722         echo " "
7723         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7724         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7725                 /lib/syscalls.exp >>libc.list
7726     fi
7727     ;;
7728 esac
7729 ;;
7730 esac
7731 $rm -f libnames libpath
7732
7733 : see if dld is available
7734 set dld.h i_dld
7735 eval $inhdr
7736
7737 : Check if we are using C++
7738 echo " "
7739 echo "Checking for C++..." >&4
7740 $cat >try.c <<'EOCP'
7741 #include <stdio.h>
7742 int main(void)
7743 {
7744 #ifdef __cplusplus
7745     return 0;
7746 #else
7747     return 1;
7748 #endif
7749 }
7750 EOCP
7751 set try
7752 if eval $compile_ok && $run ./try; then
7753         val="$define"
7754         echo "You are using a C++ compiler."
7755 else
7756         val="$undef"
7757         echo "You are not using a C++ compiler."
7758 fi
7759 $rm_try cplusplus$$
7760 set d_cplusplus
7761 eval $setvar
7762
7763 : is a C symbol defined?
7764 csym='tlook=$1;
7765 case "$3" in
7766 -v) tf=libc.tmp; tdc="";;
7767 -a) tf=libc.tmp; tdc="[]";;
7768 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7769 esac;
7770 case "$d_cplusplus" in
7771     $define)    extern_C="extern \"C\"" ;;
7772     *)          extern_C="extern"       ;;
7773 esac;
7774 tx=yes;
7775 case "$reuseval-$4" in
7776 true-) ;;
7777 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7778 esac;
7779 case "$tx" in
7780 yes)
7781         tval=false;
7782         if $test "$runnm" = true; then
7783                 if $contains $tlook $tf >/dev/null 2>&1; then
7784                         tval=true;
7785                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7786                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7787                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7788                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7789                         $rm_try;
7790                 fi;
7791         else
7792                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7793                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7794                 $rm_try;
7795         fi;
7796         ;;
7797 *)
7798         case "$tval" in
7799         $define) tval=true;;
7800         *) tval=false;;
7801         esac;
7802         ;;
7803 esac;
7804 eval "$2=$tval"'
7805
7806 : define an is-in-libc? function
7807 inlibc='echo " "; td=$define; tu=$undef;
7808 sym=$1; var=$2; eval "was=\$$2";
7809 tx=yes;
7810 case "$reuseval$was" in
7811 true) ;;
7812 true*) tx=no;;
7813 esac;
7814 case "$tx" in
7815 yes)
7816         set $sym tres -f;
7817         eval $csym;
7818         case "$tres" in
7819         true)
7820                 echo "$sym() found." >&4;
7821                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7822         *)
7823                 echo "$sym() NOT found." >&4;
7824                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7825         esac;;
7826 *)
7827         case "$was" in
7828         $define) echo "$sym() found." >&4;;
7829         *) echo "$sym() NOT found." >&4;;
7830         esac;;
7831 esac'
7832
7833 : see if dlopen exists
7834 xxx_runnm="$runnm"
7835 xxx_ccflags="$ccflags"
7836 runnm=false
7837 : with g++ one needs -shared to get is-in-libc to work for dlopen
7838 case "$gccversion" in
7839 '')     ;;
7840 *)      case "$d_cplusplus" in
7841         "$define") ccflags="$ccflags -shared" ;;
7842         esac
7843         ;;
7844 esac
7845 set dlopen d_dlopen
7846 eval $inlibc
7847 runnm="$xxx_runnm"
7848 ccflags="$xxx_ccflags"
7849
7850 : see if this is a unistd.h system
7851 set unistd.h i_unistd
7852 eval $inhdr
7853
7854 : determine which dynamic loading, if any, to compile in
7855 echo " "
7856 dldir="ext/DynaLoader"
7857 case "$usedl" in
7858 $define|y|true)
7859         dflt='y'
7860         usedl="$define"
7861         ;;
7862 $undef|n|false)
7863         dflt='n'
7864         usedl="$undef"
7865         ;;
7866 *)
7867         dflt='n'
7868         case "$d_dlopen" in
7869             $define) dflt='y' ;;
7870         esac
7871         case "$i_dld" in
7872             $define) dflt='y' ;;
7873         esac
7874         : Does a dl_xxx.xs file exist for this operating system
7875         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7876         ;;
7877 esac
7878 rp="Do you wish to use dynamic loading?"
7879 . ./myread
7880 usedl="$ans"
7881 bin_ELF="$undef"
7882 case "$ans" in
7883 y*) usedl="$define"
7884         case "$dlsrc" in
7885         '')
7886                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7887                         dflt="$dldir/dl_${osname}.xs"
7888                 elif $test "$d_dlopen" = "$define" ; then
7889                         dflt="$dldir/dl_dlopen.xs"
7890                 elif $test "$i_dld" = "$define" ; then
7891                         dflt="$dldir/dl_dld.xs"
7892                 else
7893                         dflt=''
7894                 fi
7895                 ;;
7896         *)      dflt="$dldir/$dlsrc"
7897                 ;;
7898         esac
7899     echo "The following dynamic loading files are available:"
7900         : Can not go over to $dldir because getfile has path hard-coded in.
7901         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7902         rp="Source file to use for dynamic loading"
7903         fn="fne"
7904         gfpth="$src"
7905         . ./getfile
7906         usedl="$define"
7907         : emulate basename
7908         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7909
7910         $cat << EOM
7911
7912 Some systems may require passing special flags to $cc -c to
7913 compile modules that will be used to create a shared library.
7914 To use no flags, say "none".
7915
7916 EOM
7917     case "$cccdlflags" in
7918     '') case "$gccversion" in
7919                 '') case "$osname" in
7920                         hpux)   dflt='+z' ;;
7921                         next)   dflt='none' ;;
7922                         irix*)  dflt='-KPIC' ;;
7923                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7924                         sunos)  dflt='-pic' ;;
7925                         *)      dflt='none' ;;
7926                     esac
7927                         ;;
7928                 *)  case "$osname" in
7929                         darwin) dflt='none' ;;
7930                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7931                         *)      dflt='-fpic' ;;
7932                     esac ;;
7933             esac ;;
7934         ' ') dflt='none' ;;
7935     *)  dflt="$cccdlflags" ;;
7936     esac
7937     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7938     . ./myread
7939     case "$ans" in
7940     none) cccdlflags=' ' ;;
7941     *) cccdlflags="$ans" ;;
7942     esac
7943
7944     cat << EOM
7945
7946 Some systems use ld to create libraries that can be dynamically loaded,
7947 while other systems (such as those using ELF) use $cc.
7948
7949 EOM
7950
7951 : Determine if this is ELF
7952         $cat >try.c <<EOM
7953 /* Test for whether ELF binaries are produced */
7954 #include <fcntl.h>
7955 #$i_stdlib I_STDLIB
7956 #ifdef I_STDLIB
7957 #include <stdlib.h>
7958 #endif
7959 #$i_unistd I_UNISTD
7960 #ifdef I_UNISTD
7961 #include <unistd.h>
7962 #endif
7963 int main() {
7964         char b[4];
7965         int i = open("a.out",O_RDONLY);
7966         if(i == -1)
7967                 exit(1); /* fail */
7968         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7969                 exit(0); /* succeed (yes, it is ELF) */
7970         else
7971                 exit(1); /* fail */
7972 }
7973 EOM
7974         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7975                 bin_ELF="$define"
7976         fi
7977         $rm_try
7978
7979         case "$ld" in
7980         '')     if $test $bin_ELF = "$define"; then
7981                         cat <<EOM
7982 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7983 EOM
7984                         dflt="$cc"
7985                 else
7986                         echo "I'll use ld to build dynamic libraries."
7987                         dflt='ld'
7988                 fi
7989                 ;;
7990         *)      dflt="$ld"
7991                 ;;
7992         esac
7993
7994     rp="What command should be used to create dynamic libraries?"
7995     . ./myread
7996         ld="$ans"
7997
7998     cat << EOM
7999
8000 Some systems may require passing special flags to $ld to create a
8001 library that can be dynamically loaded.  If your ld flags include
8002 -L/other/path options to locate libraries outside your loader's normal
8003 search path, you may need to specify those -L options here as well.  To
8004 use no flags, say "none".
8005
8006 EOM
8007     case "$lddlflags" in
8008     '') case "$osname" in
8009                         beos) dflt='-nostart' ;;
8010                         haiku) dflt='-shared' ;;
8011                         hpux) dflt='-b';
8012                               case "$gccversion" in
8013                               '') dflt="$dflt +vnocompatwarnings" ;;
8014                               esac
8015                               ;;
8016                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8017                         next)  dflt='none' ;;
8018                         solaris) dflt='-G' ;;
8019                         sunos) dflt='-assert nodefinitions' ;;
8020                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8021                 *)     dflt='none' ;;
8022                         esac
8023                         ;;
8024     *) dflt="$lddlflags" ;;
8025     esac
8026
8027         : Try to guess additional flags to pick up local libraries.
8028         : Be careful not to append to a plain 'none'
8029         case "$dflt" in
8030         none) dflt='' ;;
8031         esac
8032         for thisflag in $ldflags; do
8033                 case "$thisflag" in
8034                 -L*|-R*|-Wl,-R*)
8035                         case " $dflt " in
8036                         *" $thisflag "*) ;;
8037                         *) dflt="$dflt $thisflag" ;;
8038                         esac
8039                         ;;
8040                 esac
8041         done
8042
8043         case "$dflt" in
8044         ''|' ') dflt='none' ;;
8045         esac
8046
8047         case "$ldflags" in
8048         *-fstack-protector*)
8049             case "$dflt" in
8050                         *-fstack-protector*) ;; # Don't add it again
8051                         *) dflt="$dflt -fstack-protector" ;; 
8052                 esac
8053                 ;;
8054         esac
8055
8056
8057     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8058     . ./myread
8059     case "$ans" in
8060     none) lddlflags=' ' ;;
8061     *) lddlflags="$ans" ;;
8062     esac
8063
8064         cat <<EOM
8065
8066 Some systems may require passing special flags to $cc to indicate that
8067 the resulting executable will use dynamic linking.  To use no flags,
8068 say "none".
8069
8070 EOM
8071     case "$ccdlflags" in
8072     '') case "$osname" in
8073             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8074             next|sunos) dflt='none' ;;
8075             *)          dflt='none' ;;
8076             esac ;;
8077     ' ')  dflt='none' ;;
8078     *)  dflt="$ccdlflags" ;;
8079     esac
8080     rp="Any special flags to pass to $cc to use dynamic linking?"
8081     . ./myread
8082     case "$ans" in
8083     none) ccdlflags=' ' ;;
8084     *) ccdlflags="$ans" ;;
8085     esac
8086     ;;
8087 *)  usedl="$undef"
8088         ld='ld'
8089     dlsrc='dl_none.xs'
8090     lddlflags=''
8091     ccdlflags=''
8092     ;;
8093 esac
8094
8095 ld_can_script="$undef"
8096 case "$bin_ELF$usedl" in
8097 $define$define)
8098     # Abuse try.h and a.out names for neat cleanup
8099     $cat >try.c <<EOM
8100 void foo() {}
8101 void bar() {}
8102 EOM
8103     $cat >try.h <<EOM
8104 LIBTEST_42 {
8105  global:
8106   foo;
8107  local: *;
8108  };
8109 EOM
8110     if $cc $cccdlflags $ccdlflags $ccflags \
8111            $ldflags $lddlflags -o a.out try.c \
8112            -Wl,--version-script=try.h >/dev/null 2>&1 \
8113        &&  $test -s a.out ; then
8114         echo "ld supports scripting" >&4
8115         ld_can_script="$define"
8116     else
8117         echo "ld does not support scripting" >&4
8118     fi
8119     $rm_try
8120     ;;
8121 esac
8122
8123 : Do we want a shared libperl?
8124 also=''
8125 case "$usedl" in
8126 $undef)
8127         # No dynamic loading being used, so don't bother even to prompt.
8128         useshrplib='false'
8129         ;;
8130 *)      case "$useshrplib" in
8131         '')     case "$osname" in
8132                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8133                         dflt=y
8134                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8135                         ;;
8136                 next*)
8137                         case "$osvers" in
8138                         4*)     dflt=y
8139                                 also='Building a shared libperl is needed for MAB support.'
8140                                 ;;
8141                         *)      dflt=n
8142                                 ;;
8143                         esac
8144                         ;;
8145                 *)      dflt=n
8146                         ;;
8147                 esac
8148                 ;;
8149         $define|true|[Yy]*)
8150                 dflt=y
8151                 ;;
8152         *)      dflt=n
8153                 ;;
8154         esac
8155         $cat << EOM
8156
8157 The perl executable is normally obtained by linking perlmain.c with
8158 libperl${_a}, any static extensions (usually just DynaLoader), and
8159 any other libraries needed on this system (such as -lm, etc.).  Since
8160 your system supports dynamic loading, it is probably possible to build
8161 a shared libperl.$so.  If you will have more than one executable linked
8162 to libperl.$so, this will significantly reduce the size of each
8163 executable, but it may have a noticeable effect on performance.  The
8164 default is probably sensible for your system.
8165 $also
8166
8167 EOM
8168         rp="Build a shared libperl.$so (y/n)"
8169         . ./myread
8170         case "$ans" in
8171         true|$define|[Yy]*)
8172                 useshrplib='true'  ;;
8173         *)      useshrplib='false' ;;
8174         esac
8175         ;;
8176 esac
8177
8178 case "$useshrplib" in
8179 true)
8180         case "$userelocatableinc" in
8181         true|define)
8182                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8183                 echo "See INSTALL for an explanation why that won't work." >&4
8184                 exit 4
8185                 ;;
8186         esac
8187         case "$libperl" in
8188         '')
8189                 # Figure out a good name for libperl.so.  Since it gets stored in
8190                 # a version-specific architecture-dependent library, the version
8191                 # number isn't really that important, except for making cc/ld happy.
8192                 #
8193                 # A name such as libperl.so.10.1
8194                 majmin="libperl.$so.$patchlevel.$subversion"
8195                 # A name such as libperl.so.100
8196                 majonly=`echo $patchlevel $subversion |
8197                         $awk '{printf "%d%02d", $1, $2}'`
8198                 majonly=libperl.$so.$majonly
8199                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8200                 # rely on figuring it out from the naming of libc.
8201                 case "${osname}${osvers}" in
8202                 next4*)
8203                         dflt=libperl.5.$so
8204                         # XXX How handle the --version stuff for MAB?
8205                         ;;
8206                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8207                         dflt=libperl.$so
8208                         ;;
8209                 cygwin*) # ld links now against the dll directly
8210                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8211                         majonly=`echo $patchlevel $subversion |
8212                                 $awk '{printf "%03d%03d", $1, $2}'`
8213                         majonly=cygperl5.$majonly.$so
8214                         dflt=$majmin
8215                         ;;
8216                 *)      # Try to guess based on whether libc has major.minor.
8217                         case "$libc" in
8218                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8219                         *libc.$so.[0-9]*) dflt=$majonly ;;
8220                         *)      dflt=libperl.$so ;;
8221                         esac
8222                         ;;
8223                 esac
8224                 ;;
8225         *)      dflt=$libperl
8226                 ;;
8227         esac
8228         cat << EOM
8229
8230 I need to select a good name for the shared libperl.  If your system uses
8231 library names with major and minor numbers, then you might want something
8232 like $majmin.  Alternatively, if your system uses a single version
8233 number for shared libraries, then you might want to use $majonly.
8234 Or, your system might be quite happy with a simple libperl.$so.
8235
8236 Since the shared libperl will get installed into a version-specific
8237 architecture-dependent directory, the version number of the shared perl
8238 library probably isn't important, so the default should be o.k.
8239
8240 EOM
8241         rp='What name do you want to give to the shared libperl?'
8242         . ./myread
8243         libperl=$ans
8244         echo "Ok, I'll use $libperl"
8245         ;;
8246 *)
8247         libperl="libperl${_a}"
8248         ;;
8249 esac
8250
8251 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8252 case "$shrpdir" in
8253 '') ;;
8254 *)      $cat >&4 <<EOM
8255 WARNING:  Use of the shrpdir variable for the installation location of
8256 the shared $libperl is not supported.  It was never documented and
8257 will not work in this version.  Let me (perlbug@perl.org)
8258 know of any problems this may cause.
8259
8260 EOM
8261         case "$shrpdir" in
8262         "$archlibexp/CORE")
8263                 $cat >&4 <<EOM
8264 But your current setting of $shrpdir is
8265 the default anyway, so it's harmless.
8266 EOM
8267                 ;;
8268         *)
8269                 $cat >&4 <<EOM
8270 Further, your current attempted setting of $shrpdir
8271 conflicts with the value of $archlibexp/CORE
8272 that installperl will use.
8273 EOM
8274                 ;;
8275         esac
8276         ;;
8277 esac
8278
8279 # How will the perl executable find the installed shared $libperl?
8280 # Add $xxx to ccdlflags.
8281 # If we can't figure out a command-line option, use $shrpenv to
8282 # set env LD_RUN_PATH.  The main perl makefile uses this.
8283 shrpdir=$archlibexp/CORE
8284 xxx=''
8285 tmp_shrpenv=''
8286 if "$useshrplib"; then
8287     case "$osname" in
8288         aix)
8289                 # We'll set it in Makefile.SH...
8290                 ;;
8291         solaris)
8292                 xxx="-R $shrpdir"
8293                 ;;
8294         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8295                 xxx="-Wl,-R$shrpdir"
8296                 ;;
8297         bsdos|linux|irix*|dec_osf|gnu*)
8298                 xxx="-Wl,-rpath,$shrpdir"
8299                 ;;
8300         next)
8301                 # next doesn't like the default...
8302                 ;;
8303         beos)
8304                 # beos doesn't like the default, either.
8305                 ;;
8306         haiku)
8307                 # Haiku doesn't like the default, either.
8308                 ;;
8309         hpux*)
8310                 # hpux doesn't like the default, either.
8311                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8312                 ;;
8313         cygwin)
8314                 # cygwin needs only ldlibpth
8315                 ;;
8316         *)
8317                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8318                 ;;
8319         esac
8320         case "$xxx" in
8321         '') ;;
8322         *)
8323                 # Only add $xxx if it isn't already in ccdlflags.
8324                 case " $ccdlflags " in
8325                 *" $xxx "*)     ;;
8326                 *)      ccdlflags="$ccdlflags $xxx"
8327                         cat <<EOM >&4
8328
8329 Adding $xxx to the flags
8330 passed to $ld so that the perl executable will find the
8331 installed shared $libperl.
8332
8333 EOM
8334                         ;;
8335                 esac
8336                 ;;
8337         esac
8338 fi
8339 # Fix ccdlflags in AIX for building external extensions.
8340 # (For building Perl itself bare -bE:perl.exp is needed,
8341 #  Makefile.SH takes care of this.)
8342 case "$osname" in
8343 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8344 esac
8345 # Respect a hint or command-line value.
8346 case "$shrpenv" in
8347 '') shrpenv="$tmp_shrpenv" ;;
8348 esac
8349 case "$ldlibpthname" in
8350 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8351 none)   ldlibpthname='' ;;
8352 esac
8353
8354 : determine where manual pages are on this system
8355 echo " "
8356 case "$sysman" in
8357 '') 
8358         syspath='/usr/share/man/man1 /usr/man/man1'
8359         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8360         syspath="$syspath /usr/man/u_man/man1"
8361         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8362         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8363         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8364         sysman=`./loc . /usr/man/man1 $syspath`
8365         ;;
8366 esac
8367 if $test -d "$sysman"; then
8368         echo "System manual is in $sysman." >&4
8369 else
8370         echo "Could not find manual pages in source form." >&4
8371 fi
8372
8373 : determine where manual pages go
8374 set man1dir man1dir none
8375 eval $prefixit
8376 $cat <<EOM
8377
8378 $spackage has manual pages available in source form.
8379 EOM
8380 case "$nroff" in
8381 nroff)
8382         echo "However, you don't have nroff, so they're probably useless to you."
8383         case "$man1dir" in
8384         '') man1dir="none";;
8385         esac;;
8386 esac
8387 echo "If you don't want the manual sources installed, answer 'none'."
8388 case "$man1dir" in
8389 ' ') dflt=none
8390         ;;
8391 '')
8392         lookpath="$prefixexp/share/man/man1"
8393         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8394         lookpath="$lookpath $prefixexp/man/p_man/man1"
8395         lookpath="$lookpath $prefixexp/man/u_man/man1"
8396         lookpath="$lookpath $prefixexp/man/man.1"
8397         case "$sysman" in
8398         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8399         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8400         esac
8401         set dflt
8402         eval $prefixup
8403         ;;
8404 *)  dflt="$man1dir"
8405         ;;
8406 esac
8407 echo " "
8408 fn=dn+~
8409 rp="Where do the main $spackage manual pages (source) go?"
8410 . ./getfile
8411 if $test "X$man1direxp" != "X$ansexp"; then
8412         installman1dir=''
8413 fi
8414 prefixvar=man1dir
8415 . ./setprefixvar
8416
8417 case "$man1dir" in
8418 '')     man1dir=' '
8419         installman1dir='';;
8420 esac
8421
8422 : What suffix to use on installed man pages
8423
8424 case "$man1dir" in
8425 ' ')
8426         man1ext='0'
8427         ;;
8428 *)
8429         rp="What suffix should be used for the main $spackage man pages?"
8430         case "$man1ext" in
8431         '')     case "$man1dir" in
8432                 *1)  dflt=1 ;;
8433                 *1p) dflt=1p ;;
8434                 *1pm) dflt=1pm ;;
8435                 *l) dflt=l;;
8436                 *n) dflt=n;;
8437                 *o) dflt=o;;
8438                 *p) dflt=p;;
8439                 *C) dflt=C;;
8440                 *L) dflt=L;;
8441                 *L1) dflt=L1;;
8442                 *) dflt=1;;
8443                 esac
8444                 ;;
8445         *)      dflt="$man1ext";;
8446         esac
8447         . ./myread
8448         man1ext="$ans"
8449         ;;
8450 esac
8451
8452 : see if we can have long filenames
8453 echo " "
8454 first=123456789abcdef
8455 $rm -f $first
8456 if (echo hi >$first) 2>/dev/null; then
8457         if $test -f 123456789abcde; then
8458                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8459                 val="$undef"
8460         else
8461                 echo 'You can have filenames longer than 14 characters.'>&4
8462                 val="$define"
8463         fi
8464 else
8465         $cat <<'EOM'
8466 You can't have filenames longer than 14 chars.
8467 You can't even think about them!
8468 EOM
8469         val="$undef"
8470 fi
8471 set d_flexfnam
8472 eval $setvar
8473 $rm -rf 123456789abcde*
8474
8475 : determine where library module manual pages go
8476 set man3dir man3dir none
8477 eval $prefixit
8478 $cat <<EOM
8479
8480 $spackage has manual pages for many of the library modules.
8481 EOM
8482
8483 case "$nroff" in
8484 nroff)
8485         $cat <<'EOM'
8486 However, you don't have nroff, so they're probably useless to you.
8487 EOM
8488         case "$man3dir" in
8489         '') man3dir="none";;
8490         esac;;
8491 esac
8492
8493 case "$d_flexfnam" in
8494 undef)
8495         $cat <<'EOM'
8496 However, your system can't handle the long file names like File::Basename.3.
8497 EOM
8498         case "$man3dir" in
8499         '') man3dir="none";;
8500         esac;;
8501 esac
8502
8503 echo "If you don't want the manual sources installed, answer 'none'."
8504 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8505 case "$man3dir" in
8506 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8507         if $test -d "$privlib/man/man3"; then
8508                 cat <<EOM >&4
8509
8510 WARNING:  Previous versions of perl installed man3 pages into
8511 $privlib/man/man3.  This version will suggest a
8512 new default of $dflt.
8513 EOM
8514                 tdflt=$dflt
8515                 dflt='n'
8516                 rp='Do you wish to preserve the old behavior?(y/n)'
8517                 . ./myread
8518                 case "$ans" in
8519                 y*) dflt="$privlib/man/man3" ;;
8520                 *)  dflt=$tdflt ;;
8521                 esac
8522     fi
8523         ;;
8524 *)      dflt="$man3dir" ;;
8525 esac
8526 case "$dflt" in
8527 ' ') dflt=none ;;
8528 esac
8529 echo " "
8530 fn=dn+~
8531 rp="Where do the $package library man pages (source) go?"
8532 . ./getfile
8533 prefixvar=man3dir
8534 . ./setprefixvar
8535
8536 case "$man3dir" in
8537 '')     man3dir=' '
8538         installman3dir='';;
8539 esac
8540
8541 : What suffix to use on installed man pages
8542 case "$man3dir" in
8543 ' ')
8544         man3ext='0'
8545         ;;
8546 *)
8547         rp="What suffix should be used for the $package library man pages?"
8548         case "$man3ext" in
8549         '')     case "$man3dir" in
8550                 *3)  dflt=3 ;;
8551                 *3p) dflt=3p ;;
8552                 *3pm) dflt=3pm ;;
8553                 *l) dflt=l;;
8554                 *n) dflt=n;;
8555                 *o) dflt=o;;
8556                 *p) dflt=p;;
8557                 *C) dflt=C;;
8558                 *L) dflt=L;;
8559                 *L3) dflt=L3;;
8560                 *) dflt=3;;
8561                 esac
8562                 ;;
8563         *)      dflt="$man3ext";;
8564         esac
8565         . ./myread
8566         man3ext="$ans"
8567         ;;
8568 esac
8569
8570 : see if we have to deal with yellow pages, now NIS.
8571 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8572         if $test -f /usr/etc/nibindd; then
8573                 echo " "
8574                 echo "I'm fairly confident you're on a NeXT."
8575                 echo " "
8576                 rp='Do you get the hosts file via NetInfo?'
8577                 dflt=y
8578                 case "$hostcat" in
8579                 nidump*) ;;
8580                 '') ;;
8581                 *) dflt=n;;
8582                 esac
8583                 . ./myread
8584                 case "$ans" in
8585                 y*) hostcat='nidump hosts .';;
8586                 *)      case "$hostcat" in
8587                         nidump*) hostcat='';;
8588                         esac
8589                         ;;
8590                 esac
8591         fi
8592         case "$hostcat" in
8593         nidump*) ;;
8594         *)
8595                 case "$hostcat" in
8596                 *ypcat*) dflt=y;;
8597                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8598                                 dflt=y
8599                         else
8600                                 dflt=n
8601                         fi;;
8602                 *) dflt=n;;
8603                 esac
8604                 echo " "
8605                 rp='Are you getting the hosts file via yellow pages?'
8606                 . ./myread
8607                 case "$ans" in
8608                 y*) hostcat='ypcat hosts';;
8609                 *) hostcat='cat /etc/hosts';;
8610                 esac
8611                 ;;
8612         esac
8613 fi
8614 case "$hostcat" in
8615 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8616 esac
8617 case "$groupcat" in
8618 '') test -f /etc/group && groupcat='cat /etc/group';;
8619 esac
8620 case "$passcat" in
8621 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8622 esac
8623
8624 : now get the host name
8625 echo " "
8626 echo "Figuring out host name..." >&4
8627 case "$myhostname" in
8628 '') cont=true
8629         echo 'Maybe "hostname" will work...'
8630         if tans=`sh -c hostname 2>&1` ; then
8631                 myhostname=$tans
8632                 phostname=hostname
8633                 cont=''
8634         fi
8635         ;;
8636 *) cont='';;
8637 esac
8638 if $test "$cont"; then
8639         if ./xenix; then
8640                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8641                 if tans=`cat /etc/systemid 2>&1` ; then
8642                         myhostname=$tans
8643                         phostname='cat /etc/systemid'
8644                         echo "Whadyaknow.  Xenix always was a bit strange..."
8645                         cont=''
8646                 fi
8647         elif $test -r /etc/systemid; then
8648                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8649         fi
8650 fi
8651 if $test "$cont"; then
8652         echo 'No, maybe "uuname -l" will work...'
8653         if tans=`sh -c 'uuname -l' 2>&1` ; then
8654                 myhostname=$tans
8655                 phostname='uuname -l'
8656         else
8657                 echo 'Strange.  Maybe "uname -n" will work...'
8658                 if tans=`sh -c 'uname -n' 2>&1` ; then
8659                         myhostname=$tans
8660                         phostname='uname -n'
8661                 else
8662                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8663                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8664                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8665                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8666                         else
8667                                 case "$myhostname" in
8668                                 '') echo "Does this machine have an identity crisis or something?"
8669                                         phostname='';;
8670                                 *)
8671                                         echo "Well, you said $myhostname before..."
8672                                         phostname='echo $myhostname';;
8673                                 esac
8674                         fi
8675                 fi
8676         fi
8677 fi
8678 case "$myhostname" in
8679 '') myhostname=noname ;;
8680 esac
8681 : you do not want to know about this
8682 set $myhostname
8683 myhostname=$1
8684
8685 : verify guess
8686 if $test "$myhostname" ; then
8687         dflt=y
8688         rp='Your host name appears to be "'$myhostname'".'" Right?"
8689         . ./myread
8690         case "$ans" in
8691         y*) ;;
8692         *) myhostname='';;
8693         esac
8694 fi
8695
8696 : bad guess or no guess
8697 while $test "X$myhostname" = X ; do
8698         dflt=''
8699         rp="Please type the (one word) name of your host:"
8700         . ./myread
8701         myhostname="$ans"
8702 done
8703
8704 : translate upper to lower if necessary
8705 case "$myhostname" in
8706 *[A-Z]*)
8707         echo "(Normalizing case in your host name)"
8708         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8709         ;;
8710 esac
8711
8712 case "$myhostname" in
8713 *.*)
8714         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8715         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8716         echo "(Trimming domain name from host name--host name is now $myhostname)"
8717         ;;
8718 *) case "$mydomain" in
8719         '')
8720                 {
8721                         test "X$hostcat" = "Xypcat hosts" &&
8722                         ypmatch "$myhostname" hosts 2>/dev/null |\
8723                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8724                         $test -s hosts
8725                 } || {
8726                         test "X$hostcat" != "X" &&
8727                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8728                                         /[       ]$myhostname[  . ]/p" > hosts
8729                 }
8730                 tmp_re="[       . ]"
8731                 if $test -f hosts; then
8732                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8733                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8734                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8735                                 hosts | $sort | $uniq | \
8736                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8737                         case `$echo X$dflt` in
8738                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8739                                 dflt=.
8740                                 ;;
8741                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8742                                 ;;
8743                         esac
8744                 else
8745                         echo "(I cannot locate a hosts database anywhere)"
8746                         dflt=.
8747                 fi
8748                 case "$dflt" in
8749                 .)
8750                         tans=`./loc resolv.conf X /etc /usr/etc`
8751                         if $test -f "$tans"; then
8752                                 echo "(Attempting domain name extraction from $tans)"
8753                                 dflt=.`$sed -n -e 's/   / /g' \
8754                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8755                                   -e 1q 2>/dev/null`
8756                                 case "$dflt" in
8757                                 .) dflt=.`$sed -n -e 's/        / /g' \
8758                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8759                                      -e 1q 2>/dev/null`
8760                                         ;;
8761                                 esac
8762                         fi
8763                         ;;
8764                 esac
8765                 case "$dflt" in
8766                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8767                         dflt=.`sh -c domainname 2>/dev/null`
8768                         case "$dflt" in
8769                         '') dflt='.';;
8770                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8771                         esac
8772                         ;;
8773                 esac
8774                 case "$dflt$osname" in
8775                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8776                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8777                         ;;
8778                 esac
8779                 case "$dflt" in
8780                 .) echo "(Lost all hope -- silly guess then)"
8781                         dflt='.nonet'
8782                         ;;
8783                 esac
8784                 $rm -f hosts
8785                 ;;
8786         *) dflt="$mydomain";;
8787         esac;;
8788 esac
8789 echo " "
8790 rp="What is your domain name?"
8791 . ./myread
8792 tans="$ans"
8793 case "$ans" in
8794 '') ;;
8795 .*) ;;
8796 *) tans=".$tans";;
8797 esac
8798 mydomain="$tans"
8799
8800 : translate upper to lower if necessary
8801 case "$mydomain" in
8802 *[A-Z]*)
8803         echo "(Normalizing case in your domain name)"
8804         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8805         ;;
8806 esac
8807
8808 : a little sanity check here
8809 case "$phostname" in
8810 '') ;;
8811 *)
8812         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8813         $myhostname$mydomain|$myhostname) ;;
8814         *)
8815                 case "$phostname" in
8816                 sed*)
8817                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8818                         ;;
8819                 *)
8820                         echo "(That doesn't agree with your $phostname command, by the way.)"
8821                         ;;
8822                 esac
8823         ;;
8824         esac
8825         ;;
8826 esac
8827
8828 : determine the e-mail address of the user who is running us
8829 $cat <<EOM
8830
8831 I need to get your e-mail address in Internet format if possible, i.e.
8832 something like user@host.domain. Please answer accurately since I have
8833 no easy means to double check it. The default value provided below
8834 is most probably close to reality but may not be valid from outside
8835 your organization...
8836
8837 EOM
8838 cont=x
8839 while test "$cont"; do
8840         case "$cf_email" in
8841         '') dflt="$cf_by@$myhostname$mydomain";;
8842         *) dflt="$cf_email";;
8843         esac
8844         rp='What is your e-mail address?'
8845         . ./myread
8846         cf_email="$ans"
8847         case "$cf_email" in
8848         *@*.*) cont='' ;;
8849         *)
8850                 rp='Address does not look like an Internet one.  Use it anyway?'
8851                 case "$fastread" in
8852                 yes) dflt=y ;;
8853                 *) dflt=n ;;
8854                 esac
8855                 . ./myread
8856                 case "$ans" in
8857                 y*) cont='' ;;
8858                 *) echo " " ;;
8859                 esac
8860                 ;;
8861         esac
8862 done
8863
8864 : Ask e-mail of administrator
8865 $cat <<EOM
8866
8867 If you or somebody else will be maintaining perl at your site, please
8868 fill in the correct e-mail address here so that they may be contacted
8869 if necessary. Currently, the "perlbug" program included with perl
8870 will send mail to this address in addition to perlbug@perl.org. You may
8871 enter "none" for no administrator.
8872
8873 EOM
8874 case "$perladmin" in
8875 '') dflt="$cf_email";;
8876 *) dflt="$perladmin";;
8877 esac
8878 rp='Perl administrator e-mail address'
8879 . ./myread
8880 perladmin="$ans"
8881
8882 : determine whether to only install version-specific parts.
8883 echo " "
8884 $cat <<EOM
8885 Do you want to install only the version-specific parts of the perl
8886 distribution?  Usually you do *not* want to do this.
8887 EOM
8888 case "$versiononly" in
8889 "$define"|[Yy]*|true) dflt='y' ;;
8890 *) dflt='n';
8891 esac
8892 rp="Do you want to install only the version-specific parts of perl?"
8893 . ./myread
8894 case "$ans" in
8895 [yY]*)  val="$define";;
8896 *)      val="$undef" ;;
8897 esac
8898 set versiononly
8899 eval $setvar
8900
8901 case "$versiononly" in
8902 "$define") inc_version_list=''
8903            inc_version_list_init=0
8904            ;;
8905 esac
8906
8907 : figure out how to guarantee perl startup
8908 : XXX Note that this currently takes advantage of the bug that binexp ignores
8909 :     the Configure -Dinstallprefix setting, which in turn means that under
8910 :     relocatable @INC, initialinstalllocation is what binexp started as.
8911 case "$startperl" in
8912 '')
8913         case "$sharpbang" in
8914         *!)
8915                 $cat <<EOH
8916
8917 I can use the #! construct to start perl on your system. This will
8918 make startup of perl scripts faster, but may cause problems if you
8919 want to share those scripts and perl is not in a standard place
8920 ($initialinstalllocation/perl) on all your platforms. The alternative
8921 is to force a shell by starting the script with a single ':' character.
8922
8923 EOH
8924                 case "$versiononly" in
8925                 "$define")      dflt="$initialinstalllocation/perl$version";;
8926                 *)              dflt="$initialinstalllocation/perl";;
8927                 esac
8928                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8929                 . ./myread
8930                 case "$ans" in
8931                 none)   startperl=": # use perl";;
8932                 *)      startperl="#!$ans"
8933                         if $test 30 -lt `echo "$ans" | wc -c`; then
8934                                 $cat >&4 <<EOM
8935
8936 WARNING:  Some systems limit the #! command to 32 characters.
8937 If you experience difficulty running Perl scripts with #!, try
8938 installing Perl in a directory with a shorter pathname.
8939
8940 EOM
8941                         fi ;;
8942                 esac
8943                 ;;
8944         *) startperl=": # use perl"
8945                 ;;
8946         esac
8947         ;;
8948 esac
8949 echo "I'll use $startperl to start perl scripts."
8950
8951 : figure best path for perl in scripts
8952 case "$perlpath" in
8953 '')
8954         case "$versiononly" in
8955         "$define")      perlpath="$initialinstalllocation/perl$version";;
8956         *)              perlpath="$initialinstalllocation/perl";;
8957         esac
8958         case "$startperl" in
8959         *!*) ;;
8960         *)
8961                 $cat <<EOH
8962
8963 I will use the "eval 'exec'" idiom to start Perl on your system.
8964 I can use the full path of your Perl binary for this purpose, but
8965 doing so may cause problems if you want to share those scripts and
8966 Perl is not always in a standard place ($initialinstalllocation/perl).
8967
8968 EOH
8969                 dflt="$initialinstalllocation/perl"
8970                 rp="What path shall I use in \"eval 'exec'\"?"
8971                 . ./myread
8972                 perlpath="$ans"
8973                 ;;
8974         esac
8975         ;;
8976 esac
8977 case "$startperl" in
8978 *!*)    ;;
8979 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8980 esac
8981
8982 : determine where public executable scripts go
8983 set scriptdir scriptdir
8984 eval $prefixit
8985 case "$scriptdir" in
8986 '')
8987         dflt="$bin"
8988         : guess some guesses
8989         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8990         $test -d /usr/share/bin     && dflt=/usr/share/bin
8991         $test -d /usr/local/script  && dflt=/usr/local/script
8992         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8993         $test -d $prefixexp/script  && dflt=$prefixexp/script
8994         set dflt
8995         eval $prefixup
8996         ;;
8997 *)  dflt="$scriptdir"
8998         ;;
8999 esac
9000 $cat <<EOM
9001
9002 Some installations have a separate directory just for executable scripts so
9003 that they can mount it across multiple architectures but keep the scripts in
9004 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9005 Or you might just lump your scripts in with all your other executables.
9006
9007 EOM
9008 fn=d~
9009 rp='Where do you keep publicly executable scripts?'
9010 . ./getfile
9011 if $test "X$ansexp" != "X$scriptdirexp"; then
9012         installscript=''
9013 fi
9014 installscriptdir=''
9015 prefixvar=scriptdir
9016 . ./setprefixvar
9017 : A little fix up for an irregularly named variable.
9018 installscript="$installscriptdir"
9019
9020 : determine where add-on public executables go
9021 case "$sitebin" in
9022 '')     dflt=$siteprefix/bin ;;
9023 *)      dflt=$sitebin ;;
9024 esac
9025 fn=d~
9026 rp='Pathname where the add-on public executables should be installed?'
9027 . ./getfile
9028 prefixvar=sitebin
9029 . ./setprefixvar
9030
9031 : determine where add-on html pages go
9032 : There is no standard location, so try to copy the previously-selected
9033 : directory structure for the core html pages.
9034 case "$sitehtml1dir" in
9035 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9036 *)     dflt=$sitehtml1dir ;;
9037 esac
9038 case "$dflt" in
9039 ''|' ') dflt=none ;;
9040 esac
9041 fn=dn+~
9042 rp='Pathname where the site-specific html pages should be installed?'
9043 . ./getfile
9044 prefixvar=sitehtml1dir
9045 . ./setprefixvar
9046
9047 : determine where add-on library html pages go
9048 : There is no standard location, so try to copy the previously-selected
9049 : directory structure for the core html pages.
9050 case "$sitehtml3dir" in
9051 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9052 *)     dflt=$sitehtml3dir ;;
9053 esac
9054 case "$dflt" in
9055 ''|' ') dflt=none ;;
9056 esac
9057 fn=dn+~
9058 rp='Pathname where the site-specific library html pages should be installed?'
9059 . ./getfile
9060 prefixvar=sitehtml3dir
9061 . ./setprefixvar
9062
9063 : determine where add-on manual pages go
9064 case "$siteman1dir" in
9065 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9066 *)      dflt=$siteman1dir ;;
9067 esac
9068 case "$dflt" in
9069 ''|' ') dflt=none ;;
9070 esac
9071 fn=dn+~
9072 rp='Pathname where the site-specific manual pages should be installed?'
9073 . ./getfile
9074 prefixvar=siteman1dir
9075 . ./setprefixvar
9076
9077 : determine where add-on library man pages go
9078 case "$siteman3dir" in
9079 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9080 *)      dflt=$siteman3dir ;;
9081 esac
9082 case "$dflt" in
9083 ''|' ') dflt=none ;;
9084 esac
9085 fn=dn+~
9086 rp='Pathname where the site-specific library manual pages should be installed?'
9087 . ./getfile
9088 prefixvar=siteman3dir
9089 . ./setprefixvar
9090
9091 : determine where add-on public executable scripts go
9092 case "$sitescript" in
9093 '')     dflt=$siteprefix/script
9094         $test -d $dflt || dflt=$sitebin ;;
9095 *)  dflt="$sitescript" ;;
9096 esac
9097 fn=d~+
9098 rp='Pathname where add-on public executable scripts should be installed?'
9099 . ./getfile
9100 prefixvar=sitescript
9101 . ./setprefixvar
9102
9103 : Check if faststdio is requested and available
9104 case "$usefaststdio" in
9105 $define|true|[yY]*|'')
9106         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9107         case "$xversion" in
9108         [68])   dflt='y' ;;
9109         *)      dflt='n' ;;
9110         esac
9111         ;;
9112 *) dflt='n';;
9113 esac
9114 cat <<EOM
9115
9116 Perl can be built to use 'fast stdio', which means using the stdio
9117 library but also directly manipulating the stdio buffers to enable
9118 faster I/O.  Using stdio is better for backward compatibility (especially
9119 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9120 interface has been preferred instead of stdio.
9121
9122 If this doesn't make any sense to you, just accept the default '$dflt'.
9123 EOM
9124 rp='Use the "fast stdio" if available?'
9125 . ./myread
9126 case "$ans" in
9127 y|Y)    val="$define" ;;
9128 *)      val="$undef" ;;
9129 esac
9130 set usefaststdio
9131 eval $setvar
9132
9133
9134 : define an is-a-typedef? function
9135 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9136 case "$inclist" in
9137 "") inclist="sys/types.h";;
9138 esac;
9139 eval "varval=\$$var";
9140 case "$varval" in
9141 "")
9142         $rm -f temp.c;
9143         for inc in $inclist; do
9144                 echo "#include <$inc>" >>temp.c;
9145         done;
9146         echo "#ifdef $type" >> temp.c;
9147         echo "printf(\"We have $type\");" >> temp.c;
9148         echo "#endif" >> temp.c;
9149         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9150         if $contains $type temp.E >/dev/null 2>&1; then
9151                 eval "$var=\$type";
9152         else
9153                 eval "$var=\$def";
9154         fi;
9155         $rm -f temp.?;;
9156 *) eval "$var=\$varval";;
9157 esac'
9158
9159 : define an is-a-typedef? function that prompts if the type is not available.
9160 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9161 case "$inclist" in
9162 "") inclist="sys/types.h";;
9163 esac;
9164 eval "varval=\$$var";
9165 case "$varval" in
9166 "")
9167         $rm -f temp.c;
9168         for inc in $inclist; do
9169                 echo "#include <$inc>" >>temp.c;
9170         done;
9171         echo "#ifdef $type" >> temp.c;
9172         echo "printf(\"We have $type\");" >> temp.c;
9173         echo "#endif" >> temp.c;
9174         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9175         echo " " ;
9176         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9177         if $contains $type temp.E >/dev/null 2>&1; then
9178                 echo "$type found." >&4;
9179                 eval "$var=\$type";
9180         else
9181                 echo "$type NOT found." >&4;
9182                 dflt="$def";
9183                 . ./myread ;
9184                 eval "$var=\$ans";
9185         fi;
9186         $rm -f temp.?;;
9187 *) eval "$var=\$varval";;
9188 esac'
9189
9190 : see what type lseek is declared as in the kernel
9191 rp="What is the type used for lseek's offset on this system?"
9192 set off_t lseektype long stdio.h sys/types.h
9193 eval $typedef_ask
9194
9195 echo " "
9196 echo "Checking to see how big your file offsets are..." >&4
9197 $cat >try.c <<EOCP
9198 #include <sys/types.h>
9199 #include <stdio.h>
9200 int main()
9201 {
9202     printf("%d\n", (int)sizeof($lseektype));
9203     return(0);
9204 }
9205 EOCP
9206 set try
9207 if eval $compile_ok; then
9208         lseeksize=`$run ./try`
9209         echo "Your file offsets are $lseeksize bytes long."
9210 else
9211         dflt=$longsize
9212         echo " "
9213         echo "(I can't seem to compile the test program.  Guessing...)"
9214         rp="What is the size of your file offsets (in bytes)?"
9215         . ./myread
9216         lseeksize="$ans"
9217 fi
9218 $rm_try
9219
9220 : see what type file positions are declared as in the library
9221 rp="What is the type for file position used by fsetpos()?"
9222 set fpos_t fpostype long stdio.h sys/types.h
9223 eval $typedef_ask
9224
9225 : Check size for Fpos_t
9226 echo " "
9227 case "$fpostype" in
9228 *_t) zzz="$fpostype"    ;;
9229 *)   zzz="fpos_t"       ;;
9230 esac
9231 echo "Checking the size of $zzz..." >&4
9232 cat > try.c <<EOCP
9233 #include <sys/types.h>
9234 #include <stdio.h>
9235 #$i_stdlib I_STDLIB
9236 #ifdef I_STDLIB
9237 #include <stdlib.h>
9238 #endif
9239 int main() {
9240     printf("%d\n", (int)sizeof($fpostype));
9241     exit(0);
9242 }
9243 EOCP
9244 set try
9245 if eval $compile_ok; then
9246         yyy=`$run ./try`
9247         case "$yyy" in
9248         '')     fpossize=4
9249                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9250                 ;;
9251         *)      fpossize=$yyy
9252                 echo "Your $zzz is $fpossize bytes long."
9253                 ;;
9254         esac
9255 else
9256         dflt="$longsize"
9257         echo " " >&4
9258         echo "(I can't compile the test program.  Guessing...)" >&4
9259         rp="What is the size of your file positions (in bytes)?"
9260         . ./myread
9261         fpossize="$ans"
9262 fi
9263
9264 : Check for large file support
9265 # Backward compatibility (uselfs is deprecated).
9266 case "$uselfs" in
9267 "$define"|true|[yY]*)
9268         cat <<EOM >&4
9269
9270 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9271 EOM
9272         uselargefiles="$define"
9273         ;;
9274 esac
9275
9276 case "$lseeksize:$fpossize" in
9277 8:8) cat <<EOM
9278
9279 You can have files larger than 2 gigabytes.
9280 EOM
9281    val="$define" ;;
9282 *)    case "$uselargefiles" in
9283    "$undef"|false|[nN]*) dflt='n' ;;
9284    *)   dflt='y' ;;
9285    esac
9286    cat <<EOM
9287
9288 Perl can be built to understand large files (files larger than 2 gigabytes)
9289 on some systems.  To do so, Configure can be run with -Duselargefiles.
9290
9291 If this doesn't make any sense to you, just accept the default '$dflt'.
9292 EOM
9293    rp='Try to understand large files, if available?'
9294    . ./myread
9295    case "$ans" in
9296    y|Y)         val="$define" ;;
9297    *)           val="$undef"  ;;
9298    esac
9299    ;;
9300 esac
9301 set uselargefiles
9302 eval $setvar
9303 : Look for a hint-file generated 'call-back-unit'.  If the
9304 : user has specified that a large files perl is to be built,
9305 : we may need to set or change some other defaults.
9306 if $test -f uselargefiles.cbu; then
9307         echo "Your platform has some specific hints regarding large file builds, using them..."
9308         . ./uselargefiles.cbu
9309 fi
9310 case "$uselargefiles" in
9311 "$define")
9312         if $test -f uselargefiles.cbu; then
9313                 echo " "
9314                 echo "Rechecking to see how big your file offsets are..." >&4
9315                 $cat >try.c <<EOCP
9316 #include <sys/types.h>
9317 #include <stdio.h>
9318 int main()
9319 {
9320     printf("%d\n", (int)sizeof($lseektype));
9321     return(0);
9322 }
9323 EOCP
9324                 set try
9325                 if eval $compile_ok; then
9326                         lseeksize=`$run ./try`
9327                         $echo "Your file offsets are now $lseeksize bytes long."
9328                 else
9329                         dflt="$lseeksize"
9330                         echo " "
9331                         echo "(I can't seem to compile the test program.  Guessing...)"
9332                         rp="What is the size of your file offsets (in bytes)?"
9333                         . ./myread
9334                         lseeksize="$ans"
9335                 fi
9336                 case "$fpostype" in
9337                 *_t) zzz="$fpostype"    ;;
9338                 *)   zzz="fpos_t"       ;;
9339                 esac
9340                 $echo $n "Rechecking the size of $zzz...$c" >&4
9341                 $cat > try.c <<EOCP
9342 #include <sys/types.h>
9343 #include <stdio.h>
9344 #$i_stdlib I_STDLIB
9345 #ifdef I_STDLIB
9346 #include <stdlib.h>
9347 #endif
9348 int main() {
9349     printf("%d\n", (int)sizeof($fpostype));
9350     return(0);
9351 }
9352 EOCP
9353                 set try
9354                 if eval $compile_ok; then
9355                         yyy=`$run ./try`
9356                         dflt="$lseeksize"
9357                         case "$yyy" in
9358                         '')     echo " "
9359                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9360                                 ;;
9361                         *)      fpossize=$yyy
9362                                 echo " $fpossize bytes." >&4
9363                                 ;;
9364                         esac
9365                 else
9366                         dflt="$fpossize"
9367                         echo " "
9368                         echo "(I can't compile the test program.  Guessing...)" >&4
9369                         rp="What is the size of your file positions (in bytes)?"
9370                         . ./myread
9371                         fpossize="$ans"
9372                 fi
9373                 $rm_try
9374         fi
9375         ;;
9376 esac
9377
9378 : Check if we want perlio
9379 useperlio="$define"
9380
9381 : Set the vendorbin variables
9382 case "$vendorprefix" in
9383 '')     d_vendorbin="$undef"
9384         vendorbin=''
9385         vendorbinexp=''
9386         ;;
9387 *)      d_vendorbin="$define"
9388         : determine where vendor-supplied executables go.
9389         case "$vendorbin" in
9390         '') dflt=$vendorprefix/bin ;;
9391         *)      dflt="$vendorbin" ;;
9392         esac
9393         fn=d~+
9394         rp='Pathname for the vendor-supplied executables directory?'
9395         . ./getfile
9396         vendorbin="$ans"
9397         vendorbinexp="$ansexp"
9398         ;;
9399 esac
9400 prefixvar=vendorbin
9401 . ./installprefix
9402
9403 : Set the vendorhtml1dir variables
9404 case "$vendorprefix" in
9405 '')     vendorhtml1dir=''
9406         vendorhtml1direxp=''
9407         ;;
9408 *)      : determine where vendor-supplied html pages go.
9409         : There is no standard location, so try to copy the previously-selected
9410         : directory structure for the core html pages.
9411         : XXX Better default suggestions would be welcome.
9412         case "$vendorhtml1dir" in
9413         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9414         *)      dflt=$vendorhtml1dir ;;
9415         esac
9416         case "$dflt" in
9417         ''|' ') dflt=none ;;
9418         esac
9419         fn=dn+~
9420         rp='Pathname for the vendor-supplied html pages?'
9421         . ./getfile
9422         vendorhtml1dir="$ans"
9423         vendorhtml1direxp="$ansexp"
9424         ;;
9425 esac
9426 : Use ' ' for none so value is preserved next time through Configure
9427 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9428 prefixvar=vendorhtml1dir
9429 . ./installprefix
9430
9431 : Set the vendorhtml3dir variables
9432 case "$vendorprefix" in
9433 '')     vendorhtml3dir=''
9434         vendorhtml3direxp=''
9435         ;;
9436 *)      : determine where vendor-supplied module html pages go.
9437         : There is no standard location, so try to copy the previously-selected
9438         : directory structure for the core html pages.
9439         : XXX Better default suggestions would be welcome.
9440         case "$vendorhtml3dir" in
9441         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9442         *)      dflt=$vendorhtml3dir ;;
9443         esac
9444         case "$dflt" in
9445         ''|' ') dflt=none ;;
9446         esac
9447         fn=dn+~
9448         rp='Pathname for the vendor-supplied html pages?'
9449         . ./getfile
9450         vendorhtml3dir="$ans"
9451         vendorhtml3direxp="$ansexp"
9452         ;;
9453 esac
9454 : Use ' ' for none so value is preserved next time through Configure
9455 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9456 prefixvar=vendorhtml3dir
9457 . ./installprefix
9458
9459 : Set the vendorman1dir variables
9460 case "$vendorprefix" in
9461 '')     vendorman1dir=''
9462         vendorman1direxp=''
9463         ;;
9464 *)      : determine where vendor-supplied manual pages go.
9465         case "$vendorman1dir" in
9466         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9467         *)      dflt=$vendorman1dir ;;
9468         esac
9469         case "$dflt" in
9470         ''|' ') dflt=none ;;
9471         esac
9472         fn=nd~+
9473         rp='Pathname for the vendor-supplied manual section 1 pages?'
9474         . ./getfile
9475         vendorman1dir="$ans"
9476         vendorman1direxp="$ansexp"
9477         ;;
9478 esac
9479 : Use ' ' for none so value is preserved next time through Configure
9480 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9481 prefixvar=vendorman1dir
9482 . ./installprefix
9483
9484 : Set the vendorman3dir variables
9485 case "$vendorprefix" in
9486 '')     vendorman3dir=''
9487         vendorman3direxp=''
9488         ;;
9489 *)      : determine where vendor-supplied module manual pages go.
9490         case "$vendorman3dir" in
9491         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9492         *)      dflt=$vendorman3dir ;;
9493         esac
9494         case "$dflt" in
9495         ''|' ') dflt=none ;;
9496         esac
9497         fn=nd~+
9498         rp='Pathname for the vendor-supplied manual section 3 pages?'
9499         . ./getfile
9500         vendorman3dir="$ans"
9501         vendorman3direxp="$ansexp"
9502         ;;
9503 esac
9504 : Use ' ' for none so value is preserved next time through Configure
9505 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9506 prefixvar=vendorman3dir
9507 . ./installprefix
9508
9509 : Set the vendorscript variables
9510 case "$vendorprefix" in
9511 '')     d_vendorscript="$undef"
9512         vendorscript=''
9513         vendorscriptexp=''
9514         ;;
9515 *)      d_vendorscript="$define"
9516         : determine where vendor-supplied scripts go.
9517         case "$vendorscript" in
9518         '')     dflt=$vendorprefix/script
9519                 $test -d $dflt || dflt=$vendorbin ;;
9520         *)  dflt="$vendorscript" ;;
9521         esac
9522         $cat <<EOM
9523
9524 The installation process will create a directory for
9525 vendor-supplied scripts.
9526
9527 EOM
9528         fn=d~+
9529         rp='Pathname for the vendor-supplied scripts directory?'
9530         . ./getfile
9531         vendorscript="$ans"
9532         vendorscriptexp="$ansexp"
9533         ;;
9534 esac
9535 prefixvar=vendorscript
9536 . ./installprefix
9537
9538 : script used to emit important warnings
9539 cat >warn <<EOS
9540 $startsh
9541 if test \$# -gt 0; then
9542         echo "\$@" >msg
9543 else
9544         cat >msg
9545 fi
9546 echo "*** WARNING:" >&4
9547 sed -e 's/^/*** /' <msg >&4
9548 echo "*** " >&4
9549 cat msg >>config.msg
9550 echo " " >>config.msg
9551 rm -f msg
9552 EOS
9553 chmod +x warn
9554 $eunicefix warn
9555
9556 : see which of string.h or strings.h is needed
9557 echo " "
9558 strings=`./findhdr string.h`
9559 if $test "$strings" && $test -r "$strings"; then
9560         echo "Using <string.h> instead of <strings.h>." >&4
9561         val="$define"
9562 else
9563         val="$undef"
9564         strings=`./findhdr strings.h`
9565         if $test "$strings" && $test -r "$strings"; then
9566                 echo "Using <strings.h> instead of <string.h>." >&4
9567         else
9568                 ./warn "No string header found -- You'll surely have problems."
9569         fi
9570 fi
9571 set i_string
9572 eval $setvar
9573 case "$i_string" in
9574 "$undef") strings=`./findhdr strings.h`;;
9575 *)        strings=`./findhdr string.h`;;
9576 esac
9577
9578 : see if qgcvt exists
9579 set qgcvt d_qgcvt
9580 eval $inlibc
9581
9582 : Check print/scan long double stuff
9583 echo " "
9584
9585 if $test X"$d_longdbl" = X"$define"; then
9586
9587 echo "Checking how to print long doubles..." >&4
9588
9589 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9590         $cat >try.c <<'EOCP'
9591 #include <sys/types.h>
9592 #include <stdio.h>
9593 int main() {
9594   double d = 123.456;
9595   printf("%.3f\n", d);
9596 }
9597 EOCP
9598         set try
9599         if eval $compile; then
9600                 yyy=`$run ./try`
9601                 case "$yyy" in
9602                 123.456)
9603                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9604                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9605                         echo "We will use %f."
9606                         ;;
9607                 esac
9608         fi
9609 fi
9610
9611 if $test X"$sPRIfldbl" = X; then
9612         $cat >try.c <<'EOCP'
9613 #include <sys/types.h>
9614 #include <stdio.h>
9615 int main() {
9616   long double d = 123.456;
9617   printf("%.3Lf\n", d);
9618 }
9619 EOCP
9620         set try
9621         if eval $compile; then
9622                 yyy=`$run ./try`
9623                 case "$yyy" in
9624                 123.456)
9625                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9626                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9627                         echo "We will use %Lf."
9628                         ;;
9629                 esac
9630         fi
9631 fi
9632
9633 if $test X"$sPRIfldbl" = X; then
9634         $cat >try.c <<'EOCP'
9635 #include <sys/types.h>
9636 #include <stdio.h>
9637 int main() {
9638   long double d = 123.456;
9639   printf("%.3llf\n", d);
9640 }
9641 EOCP
9642         set try
9643         if eval $compile; then
9644                 yyy=`$run ./try`
9645                 case "$yyy" in
9646                 123.456)
9647                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9648                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9649                         echo "We will use %llf."
9650                         ;;
9651                 esac
9652         fi
9653 fi
9654
9655 if $test X"$sPRIfldbl" = X; then
9656         $cat >try.c <<'EOCP'
9657 #include <sys/types.h>
9658 #include <stdio.h>
9659 int main() {
9660   long double d = 123.456;
9661   printf("%.3lf\n", d);
9662 }
9663 EOCP
9664         set try
9665         if eval $compile; then
9666                 yyy=`$run ./try`
9667                 case "$yyy" in
9668                 123.456)
9669                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9670                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9671                         echo "We will use %lf."
9672                         ;;
9673                 esac
9674         fi
9675 fi
9676
9677 if $test X"$sPRIfldbl" = X; then
9678         echo "Cannot figure out how to print long doubles." >&4
9679 else
9680         sSCNfldbl=$sPRIfldbl    # expect consistency
9681 fi
9682
9683 $rm_try
9684
9685 fi # d_longdbl
9686
9687 case "$sPRIfldbl" in
9688 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9689         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9690         d_SCNfldbl="$undef";
9691         ;;
9692 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9693         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9694         d_SCNfldbl="$define";
9695         ;;
9696 esac
9697
9698 : Check how to convert floats to strings.
9699
9700 if test "X$d_Gconvert" = X; then
9701
9702 echo " "
9703 echo "Checking for an efficient way to convert floats to strings."
9704 echo " " > try.c
9705 case "$uselongdouble" in
9706 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9707 esac
9708 case "$d_longdbl" in
9709 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9710 esac
9711 case "$d_PRIgldbl" in
9712 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9713 esac
9714 $cat >>try.c <<EOP
9715 #ifdef TRY_gconvert
9716 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9717 char *myname = "gconvert";
9718 #endif
9719 #ifdef TRY_gcvt
9720 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9721 char *myname = "gcvt";
9722 #endif
9723 #ifdef TRY_qgcvt
9724 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9725 char *myname = "qgcvt";
9726 #define DOUBLETYPE long double
9727 #endif
9728 #ifdef TRY_sprintf
9729 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9730 #ifdef HAS_PRIgldbl
9731 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9732 #else
9733 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9734 #endif
9735 #else
9736 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9737 #endif
9738 char *myname = "sprintf";
9739 #endif
9740
9741 #ifndef DOUBLETYPE
9742 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9743 #define DOUBLETYPE long double
9744 #else
9745 #define DOUBLETYPE double
9746 #endif
9747 #endif
9748
9749 #include <stdio.h>
9750
9751 #$i_stdlib I_STDLIB
9752 #ifdef I_STDLIB
9753 #include <stdlib.h>
9754 #endif
9755 #$i_string I_STRING
9756 #ifdef I_STRING
9757 #  include <string.h>
9758 #else
9759 #  include <strings.h>
9760 #endif
9761
9762 int checkit(char *expect, char *got)
9763 {
9764     if (strcmp(expect, got)) {
9765                 printf("%s oddity:  Expected %s, got %s\n",
9766                         myname, expect, got);
9767                 exit(1);
9768         }
9769 }
9770
9771 int main()
9772 {
9773         char buf[64];
9774         buf[63] = '\0';
9775
9776         /* This must be 1st test on (which?) platform */
9777         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9778         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9779         checkit("0.1", buf);
9780
9781         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9782         checkit("0.01", buf);
9783
9784         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9785         checkit("0.001", buf);
9786
9787         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9788         checkit("0.0001", buf);
9789
9790         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9791         if (strlen(buf) > 5)
9792             checkit("9e-005", buf); /* for Microsoft ?? */
9793         else
9794             checkit("9e-05", buf);
9795
9796         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9797         checkit("1", buf);
9798
9799         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9800         checkit("1.1", buf);
9801
9802         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9803         checkit("1.01", buf);
9804
9805         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9806         checkit("1.001", buf);
9807
9808         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9809         checkit("1.0001", buf);
9810
9811         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9812         checkit("1.00001", buf);
9813
9814         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9815         checkit("1.000001", buf);
9816
9817         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9818         checkit("0", buf);
9819
9820         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9821         checkit("-1", buf);
9822
9823         /* Some Linux gcvt's give 1.e+5 here. */
9824         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9825         checkit("100000", buf);
9826
9827         /* Some Linux gcvt's give -1.e+5 here. */
9828         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9829         checkit("-100000", buf);
9830
9831         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9832         checkit("123.456", buf);
9833
9834         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9835         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9836         /* 34 should be enough to scare even long double
9837          * places into using the e notation. */
9838         if (strlen(buf) > 5)
9839             checkit("1e+034", buf); /* for Microsoft */
9840         else
9841             checkit("1e+34", buf);
9842
9843         /* For Perl, if you add additional tests here, also add them to
9844          * t/base/num.t for benefit of platforms not using Configure or
9845          * overriding d_Gconvert */
9846
9847         exit(0);
9848 }
9849 EOP
9850 : first add preferred functions to our list
9851 xxx_list=""
9852 for xxx_convert in $gconvert_preference; do
9853     case $xxx_convert in
9854     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9855     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9856     esac
9857 done
9858 : then add any others
9859 for xxx_convert in gconvert gcvt sprintf; do
9860     case "$xxx_list" in
9861     *$xxx_convert*) ;;
9862     *) xxx_list="$xxx_list $xxx_convert" ;;
9863     esac
9864 done
9865
9866 case "$d_longdbl$uselongdouble" in
9867 "$define$define")
9868     : again, add preferred functions to our list first
9869     xxx_ld_list=""
9870     for xxx_convert in $gconvert_ld_preference; do
9871         case $xxx_convert in
9872         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9873         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9874         esac
9875     done
9876     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9877     for xxx_convert in qgcvt sprintf $xxx_list; do
9878         case "$xxx_ld_list" in
9879         $xxx_convert*|*" $xxx_convert"*) ;;
9880         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9881         esac
9882     done
9883     : if sprintf cannot do long doubles, move it to the end
9884     if test "$d_PRIgldbl" != "$define"; then
9885         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9886     fi
9887     : if no qgcvt, remove it
9888     if test "$d_qgcvt" != "$define"; then
9889         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9890     fi
9891     : use the ld_list
9892     xxx_list="$xxx_ld_list"
9893     ;;
9894 esac
9895
9896 for xxx_convert in $xxx_list; do
9897         echo "Trying $xxx_convert..."
9898         $rm -f try try$_o core
9899         set try -DTRY_$xxx_convert
9900         if eval $compile; then
9901                 echo "$xxx_convert() found." >&4
9902                 if $run ./try; then
9903                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9904                         break;
9905                 else
9906                         echo "...But $xxx_convert didn't work as I expected."
9907                         xxx_convert=''
9908                 fi
9909         else
9910                 echo "$xxx_convert NOT found." >&4
9911         fi
9912 done
9913
9914 if test X$xxx_convert = X; then
9915     echo "*** WHOA THERE!!! ***" >&4
9916     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9917     xxx_convert=sprintf
9918 fi
9919
9920 case "$xxx_convert" in
9921 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9922 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9923 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9924 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9925    "$define$define$define")
9926       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9927    "$define$define$undef")
9928       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9929    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9930    esac
9931    ;;
9932 esac
9933
9934 fi
9935 $rm_try
9936
9937 : see if _fwalk exists
9938 set fwalk d__fwalk
9939 eval $inlibc
9940
9941 : Initialize h_fcntl
9942 h_fcntl=false
9943
9944 : Initialize h_sysfile
9945 h_sysfile=false
9946
9947 : access call always available on UNIX
9948 set access d_access
9949 eval $inlibc
9950
9951 : locate the flags for 'access()'
9952 case "$d_access" in
9953 "$define")
9954         echo " "
9955         $cat >access.c <<EOCP
9956 #include <sys/types.h>
9957 #ifdef I_FCNTL
9958 #include <fcntl.h>
9959 #endif
9960 #ifdef I_SYS_FILE
9961 #include <sys/file.h>
9962 #endif
9963 #ifdef I_UNISTD
9964 #include <unistd.h>
9965 #endif
9966 #$i_stdlib I_STDLIB
9967 #ifdef I_STDLIB
9968 #include <stdlib.h>
9969 #endif
9970 int main() {
9971         exit(R_OK);
9972 }
9973 EOCP
9974         : check sys/file.h first, no particular reason here
9975         if $test `./findhdr sys/file.h` && \
9976                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9977                 h_sysfile=true;
9978                 echo "<sys/file.h> defines the *_OK access constants." >&4
9979         elif $test `./findhdr fcntl.h` && \
9980                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9981                 h_fcntl=true;
9982                 echo "<fcntl.h> defines the *_OK access constants." >&4
9983         elif $test `./findhdr unistd.h` && \
9984                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9985                 echo "<unistd.h> defines the *_OK access constants." >&4
9986         else
9987                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9988         fi
9989         ;;
9990 esac
9991 $rm -f access*
9992
9993 : see if accessx exists
9994 set accessx d_accessx
9995 eval $inlibc
9996
9997 : see if aintl exists
9998 set aintl d_aintl
9999 eval $inlibc
10000
10001 : see if alarm exists
10002 set alarm d_alarm
10003 eval $inlibc
10004
10005 : see if 64bit time functions exists
10006
10007 set ctime64 d_ctime64
10008 eval $inlibc
10009
10010 set localtime64 d_localtime64
10011 eval $inlibc
10012
10013 set gmtime64 d_gmtime64
10014 eval $inlibc
10015
10016 set mktime64 d_mktime64
10017 eval $inlibc
10018
10019 set difftime64 d_difftime64
10020 eval $inlibc
10021
10022 set asctime64 d_asctime64
10023 eval $inlibc
10024
10025 : see if POSIX threads are available
10026 set pthread.h i_pthread
10027 eval $inhdr
10028
10029 : define a function to check prototypes
10030 $cat > protochk <<EOSH
10031 $startsh
10032 cc="$cc"
10033 optimize="$optimize"
10034 ccflags="$ccflags"
10035 prototype="$prototype"
10036 define="$define"
10037 rm_try="$rm_try"
10038 usethreads=$usethreads
10039 i_pthread=$i_pthread
10040 pthread_h_first=$pthread_h_first
10041 EOSH
10042
10043 $cat >> protochk <<'EOSH'
10044
10045 $rm_try
10046 foo="$1"
10047 shift
10048 while test $# -ge 2; do
10049         case "$1" in
10050                 $define) echo "#include <$2>" >> try.c ;;
10051                 literal) echo "$2" >> try.c ;;
10052         esac
10053     # Extra magic for the benefit of systems that need pthread.h
10054     # to be included early to correctly detect threadsafe functions.
10055     # Such functions must guarantee themselves, though, that the usethreads
10056     # and i_pthread have been defined, before calling protochk.
10057     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10058         echo "#include <pthread.h>" >> try.c
10059         pthread_h_done=yes
10060     fi
10061     shift 2
10062 done
10063 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10064 cat >> try.c <<'EOCP'
10065 #ifdef CAN_PROTOTYPE
10066 #define _(args) args
10067 #else
10068 #define _(args) ()
10069 #endif
10070 EOCP
10071 echo "$foo" >> try.c
10072 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10073 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10074 status=$?
10075 $rm_try
10076 exit $status
10077 EOSH
10078 chmod +x protochk
10079 $eunicefix protochk
10080
10081 : Define hasproto macro for Configure internal use
10082 hasproto='varname=$1; func=$2; shift; shift;
10083 while $test $# -ge 2; do
10084         case "$1" in
10085         $define) echo "#include <$2>";;
10086         esac ;
10087     shift 2;
10088 done > try.c;
10089 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10090 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10091         echo "$func() prototype found.";
10092         val="$define";
10093 else
10094         echo "$func() prototype NOT found.";
10095         val="$undef";
10096 fi;
10097 set $varname;
10098 eval $setvar;
10099 $rm_try tryout.c'
10100
10101 : see if sys/types.h has to be included
10102 set sys/types.h i_systypes
10103 eval $inhdr
10104
10105 : see if sys/select.h has to be included
10106 set sys/select.h i_sysselct
10107 eval $inhdr
10108
10109 : Define hasfield macro for Configure internal use
10110 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10111 while $test $# -ge 2; do
10112         case "$1" in
10113         $define) echo "#include <$2>";;
10114         esac ;
10115     shift 2;
10116 done > try.c;
10117 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10118 set try;
10119 if eval $compile; then
10120         val="$define";
10121 else
10122         val="$undef";
10123 fi;
10124 set $varname;
10125 eval $setvar;
10126 $rm_try'
10127
10128 : see if we should include time.h, sys/time.h, or both
10129 echo " "
10130 if test "X$timeincl" = X; then
10131         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10132         $echo $n "I'm now running the test program...$c"
10133         $cat >try.c <<EOCP
10134 #include <sys/types.h>
10135 #ifdef I_TIME
10136 #include <time.h>
10137 #endif
10138 #ifdef I_SYSTIME
10139 #ifdef SYSTIMEKERNEL
10140 #define KERNEL
10141 #endif
10142 #include <sys/time.h>
10143 #endif
10144 #ifdef I_SYSSELECT
10145 #include <sys/select.h>
10146 #endif
10147 #$i_stdlib I_STDLIB
10148 #ifdef I_STDLIB
10149 #include <stdlib.h>
10150 #endif
10151 int main()
10152 {
10153         struct tm foo;
10154 #ifdef S_TIMEVAL
10155         struct timeval bar;
10156 #endif
10157 #ifdef S_TIMEZONE
10158         struct timezone tzp;
10159 #endif
10160         if (foo.tm_sec == foo.tm_sec)
10161                 exit(0);
10162 #ifdef S_TIMEVAL
10163         if (bar.tv_sec == bar.tv_sec)
10164                 exit(0);
10165 #endif
10166         exit(1);
10167 }
10168 EOCP
10169         flags=''
10170         for s_timezone in '-DS_TIMEZONE' ''; do
10171         sysselect=''
10172         for s_timeval in '-DS_TIMEVAL' ''; do
10173         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10174         for i_time in '' '-DI_TIME'; do
10175         for i_systime in '-DI_SYSTIME' ''; do
10176                 case "$flags" in
10177                 '') $echo $n ".$c"
10178                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10179                         if eval $compile; then
10180                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10181                                 shift
10182                                 flags="$*"
10183                                 echo " "
10184                                 $echo $n "Succeeded with $flags$c"
10185                         fi
10186                         ;;
10187                 esac
10188         done
10189         done
10190         done
10191         done
10192         done
10193         timeincl=''
10194         echo " "
10195         case "$flags" in
10196         *SYSTIMEKERNEL*) i_systimek="$define"
10197                 timeincl=`./findhdr sys/time.h`
10198                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10199         *) i_systimek="$undef";;
10200         esac
10201         case "$flags" in
10202         *I_TIME*) i_time="$define"
10203                 timeincl=`./findhdr time.h`" $timeincl"
10204                 echo "We'll include <time.h>." >&4;;
10205         *) i_time="$undef";;
10206         esac
10207         case "$flags" in
10208         *I_SYSTIME*) i_systime="$define"
10209                 timeincl=`./findhdr sys/time.h`" $timeincl"
10210                 echo "We'll include <sys/time.h>." >&4;;
10211         *) i_systime="$undef";;
10212         esac
10213         $rm_try
10214 fi
10215 : see if struct tm knows about tm_zone
10216 case "$i_systime$i_time" in
10217 *$define*)
10218         echo " "
10219         echo "Checking to see if your struct tm has tm_zone field..." >&4
10220         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10221         eval $hasfield
10222         ;;
10223 *)      val="$undef"
10224         set d_tm_tm_zone
10225         eval $setvar
10226         ;;
10227 esac
10228 case "$d_tm_tm_zone" in
10229 "$define")      echo "Yes, it does."   ;;
10230 *)              echo "No, it doesn't." ;;
10231 esac
10232 : see if struct tm knows about tm_gmtoff
10233 case "$i_systime$i_time" in
10234 *$define*)
10235         echo " "
10236         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10237         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10238         eval $hasfield
10239         ;;
10240 *)      val="$undef"
10241         set d_tm_tm_gmtoff
10242         eval $setvar
10243         ;;
10244 esac
10245 case "$d_tm_tm_gmtoff" in
10246 "$define")      echo "Yes, it does."   ;;
10247 *)              echo "No, it doesn't." ;;
10248 esac
10249
10250 : see if asctime_r exists
10251 set asctime_r d_asctime_r
10252 eval $inlibc
10253 case "$d_asctime_r" in
10254 "$define")
10255         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10256         case "$d_asctime_r_proto:$usethreads" in
10257         ":define")      d_asctime_r_proto=define
10258                 set d_asctime_r_proto asctime_r $hdrs
10259                 eval $hasproto ;;
10260         *)      ;;
10261         esac
10262         case "$d_asctime_r_proto" in
10263         define)
10264         case "$asctime_r_proto" in
10265         ''|0) try='char* asctime_r(const struct tm*, char*);'
10266         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10267         esac
10268         case "$asctime_r_proto" in
10269         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10270         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10271         esac
10272         case "$asctime_r_proto" in
10273         ''|0) try='int asctime_r(const struct tm*, char*);'
10274         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10275         esac
10276         case "$asctime_r_proto" in
10277         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10278         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10279         esac
10280         case "$asctime_r_proto" in
10281         ''|0)   d_asctime_r=undef
10282                 asctime_r_proto=0
10283                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10284         * )     case "$asctime_r_proto" in
10285                 REENTRANT_PROTO*) ;;
10286                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10287                 esac
10288                 echo "Prototype: $try" ;;
10289         esac
10290         ;;
10291         *)      case "$usethreads" in
10292                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10293                 esac
10294                 d_asctime_r=undef
10295                 asctime_r_proto=0
10296                 ;;
10297         esac
10298         ;;
10299 *)      asctime_r_proto=0
10300         ;;
10301 esac
10302
10303 : see if atolf exists
10304 set atolf d_atolf
10305 eval $inlibc
10306
10307 : see if atoll exists
10308 set atoll d_atoll
10309 eval $inlibc
10310
10311 : Look for GCC-style attribute format
10312 case "$d_attribute_format" in
10313 '')
10314 echo " "
10315 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10316 $cat >attrib.c <<'EOCP'
10317 #include <stdio.h>
10318 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10319 EOCP
10320 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10321         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10322                 echo "Your C compiler doesn't support __attribute__((format))."
10323                 val="$undef"
10324         else
10325                 echo "Your C compiler supports __attribute__((format))."
10326                 val="$define"
10327         fi
10328 else
10329         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10330         val="$undef"
10331 fi
10332 ;;
10333 *) val="$d_attribute_format" ;;
10334 esac
10335 set d_attribute_format
10336 eval $setvar
10337 $rm -f attrib*
10338
10339 : Look for GCC-style attribute format with null format allowed
10340 case "$d_printf_format_null" in
10341 '') case "$d_attribute_format" in
10342     $define)
10343         echo " "
10344         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10345 $cat >attrib.c <<EOCP
10346 #include <stdio.h>
10347 #$i_stdlib I_STDLIB
10348 #ifdef I_STDLIB
10349 #include <stdlib.h>
10350 #endif
10351 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10352 int null_printf (char* pat,...) { return (int)pat; }
10353 int main () { exit(null_printf(NULL)); }
10354 EOCP
10355         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10356             : run the executable in case it produces a run-time warning
10357             if $run ./attrib >>attrib.out 2>&1; then
10358                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10359                     echo "Your C compiler doesn't allow __printf__ format to be null."
10360                     val="$undef"
10361                 else
10362                     echo "Your C compiler allows __printf__ format to be null."
10363                     val="$define"
10364                 fi
10365             else
10366             echo "Your C compiler executable failed with __printf__ format null."
10367             val="$undef"
10368         fi
10369     else
10370         echo "Your C compiler fails with __printf__ format null."
10371         val="$undef"
10372     fi
10373     ;;
10374     *)  val="$undef" ;;
10375     esac
10376 ;;
10377 *)  val="$d_printf_format_null" ;;
10378 esac
10379 set d_printf_format_null
10380 eval $setvar
10381 $rm -f attrib*
10382
10383 : Look for GCC-style attribute malloc
10384 case "$d_attribute_malloc" in
10385 '')
10386 echo " "
10387 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10388 $cat >attrib.c <<'EOCP'
10389 #include <stdio.h>
10390 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10391 EOCP
10392 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10393         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10394                 echo "Your C compiler doesn't support __attribute__((malloc))."
10395                 val="$undef"
10396         else
10397                 echo "Your C compiler supports __attribute__((malloc))."
10398                 val="$define"
10399         fi
10400 else
10401         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10402         val="$undef"
10403 fi
10404 ;;
10405 *) val="$d_attribute_malloc" ;;
10406 esac
10407 set d_attribute_malloc
10408 eval $setvar
10409 $rm -f attrib*
10410
10411 : Look for GCC-style attribute nonnull
10412 case "$d_attribute_nonnull" in
10413 '')
10414 echo " "
10415 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10416 $cat >attrib.c <<'EOCP'
10417 #include <stdio.h>
10418 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10419 EOCP
10420 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10421         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10422                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10423                 val="$undef"
10424         else
10425                 echo "Your C compiler supports __attribute__((nonnull))."
10426                 val="$define"
10427         fi
10428 else
10429         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10430         val="$undef"
10431 fi
10432 ;;
10433 *) val="$d_attribute_nonnull" ;;
10434 esac
10435 set d_attribute_nonnull
10436 eval $setvar
10437 $rm -f attrib*
10438
10439 : Look for GCC-style attribute noreturn
10440 case "$d_attribute_noreturn" in
10441 '')
10442 echo " "
10443 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10444 $cat >attrib.c <<'EOCP'
10445 #include <stdio.h>
10446 void fall_over_dead( void ) __attribute__((noreturn));
10447 EOCP
10448 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10449         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10450                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10451                 val="$undef"
10452         else
10453                 echo "Your C compiler supports __attribute__((noreturn))."
10454                 val="$define"
10455         fi
10456 else
10457         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10458         val="$undef"
10459 fi
10460 ;;
10461 *) val="$d_attribute_noreturn" ;;
10462 esac
10463 set d_attribute_noreturn
10464 eval $setvar
10465 $rm -f attrib*
10466
10467 : Look for GCC-style attribute pure
10468 case "$d_attribute_pure" in
10469 '')
10470 echo " "
10471 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10472 $cat >attrib.c <<'EOCP'
10473 #include <stdio.h>
10474 int square( int n ) __attribute__((pure));
10475 EOCP
10476 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10477         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10478                 echo "Your C compiler doesn't support __attribute__((pure))."
10479                 val="$undef"
10480         else
10481                 echo "Your C compiler supports __attribute__((pure))."
10482                 val="$define"
10483         fi
10484 else
10485         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10486         val="$undef"
10487 fi
10488 ;;
10489 *) val="$d_attribute_pure" ;;
10490 esac
10491 set d_attribute_pure
10492 eval $setvar
10493 $rm -f attrib*
10494
10495 : Look for GCC-style attribute unused
10496 case "$d_attribute_unused" in
10497 '')
10498 echo " "
10499 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10500 $cat >attrib.c <<'EOCP'
10501 #include <stdio.h>
10502 int do_something( int dummy __attribute__((unused)), int n );
10503 EOCP
10504 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10505         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10506                 echo "Your C compiler doesn't support __attribute__((unused))."
10507                 val="$undef"
10508         else
10509                 echo "Your C compiler supports __attribute__((unused))."
10510                 val="$define"
10511         fi
10512 else
10513         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10514         val="$undef"
10515 fi
10516 ;;
10517 *) val="$d_attribute_unused" ;;
10518 esac
10519 set d_attribute_unused
10520 eval $setvar
10521 $rm -f attrib*
10522
10523 : Look for GCC-style attribute deprecated
10524 case "$d_attribute_deprecated" in
10525 '')
10526 echo " "
10527 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10528 $cat >attrib.c <<'EOCP'
10529 #include <stdio.h>
10530 int I_am_deprecated(void) __attribute__((deprecated));
10531 EOCP
10532 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10533         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10534                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10535                 val="$undef"
10536         else
10537                 echo "Your C compiler supports __attribute__((deprecated))."
10538                 val="$define"
10539         fi
10540 else
10541         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10542         val="$undef"
10543 fi
10544 ;;
10545 *) val="$d_attribute_deprecated" ;;
10546 esac
10547 set d_attribute_deprecated
10548 eval $setvar
10549 $rm -f attrib*
10550
10551 : Look for GCC-style attribute warn_unused_result
10552 case "$d_attribute_warn_unused_result" in
10553 '')
10554 echo " "
10555 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10556 $cat >attrib.c <<'EOCP'
10557 #include <stdio.h>
10558 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10559 EOCP
10560 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10561         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10562                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10563                 val="$undef"
10564         else
10565                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10566                 val="$define"
10567         fi
10568 else
10569         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10570         val="$undef"
10571 fi
10572 ;;
10573 *) val="$d_attribute_warn_unused_result" ;;
10574 esac
10575 set d_attribute_warn_unused_result
10576 eval $setvar
10577 $rm -f attrib*
10578
10579 : see if bcmp exists
10580 set bcmp d_bcmp
10581 eval $inlibc
10582
10583 : see if bcopy exists
10584 set bcopy d_bcopy
10585 eval $inlibc
10586
10587 : see if getpgrp exists
10588 set getpgrp d_getpgrp
10589 eval $inlibc
10590
10591 case "$d_getpgrp" in
10592 "$define")
10593         echo " "
10594         echo "Checking to see which flavor of getpgrp is in use..."
10595         $cat >try.c <<EOP
10596 #$i_unistd I_UNISTD
10597 #include <sys/types.h>
10598 #ifdef I_UNISTD
10599 #  include <unistd.h>
10600 #endif
10601 #$i_stdlib I_STDLIB
10602 #ifdef I_STDLIB
10603 #include <stdlib.h>
10604 #endif
10605 int main()
10606 {
10607         if (getuid() == 0) {
10608                 printf("(I see you are running Configure as super-user...)\n");
10609                 setuid(1);
10610         }
10611 #ifdef TRY_BSD_PGRP
10612         if (getpgrp(1) == 0)
10613                 exit(0);
10614 #else
10615         if (getpgrp() > 0)
10616                 exit(0);
10617 #endif
10618         exit(1);
10619 }
10620 EOP
10621         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10622                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10623                 val="$define"
10624         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10625                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10626                 val="$undef"
10627         else
10628                 echo "I can't seem to compile and run the test program."
10629                 if ./usg; then
10630                         xxx="a USG one, i.e. you use getpgrp()."
10631                 else
10632                         # SVR4 systems can appear rather BSD-ish.
10633                         case "$i_unistd" in
10634                         $undef)
10635                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10636                                 val="$define"
10637                                 ;;
10638                         $define)
10639                                 xxx="probably a USG one, i.e. you use getpgrp()."
10640                                 val="$undef"
10641                                 ;;
10642                         esac
10643                 fi
10644                 echo "Assuming your getpgrp is $xxx" >&4
10645         fi
10646         ;;
10647 *) val="$undef";;
10648 esac
10649 set d_bsdgetpgrp
10650 eval $setvar
10651 $rm_try
10652
10653 : see if setpgrp exists
10654 set setpgrp d_setpgrp
10655 eval $inlibc
10656
10657 case "$d_setpgrp" in
10658 "$define")
10659         echo " "
10660         echo "Checking to see which flavor of setpgrp is in use..."
10661         $cat >try.c <<EOP
10662 #$i_unistd I_UNISTD
10663 #include <sys/types.h>
10664 #ifdef I_UNISTD
10665 #  include <unistd.h>
10666 #endif
10667 #$i_stdlib I_STDLIB
10668 #ifdef I_STDLIB
10669 #include <stdlib.h>
10670 #endif
10671 int main()
10672 {
10673         if (getuid() == 0) {
10674                 printf("(I see you are running Configure as super-user...)\n");
10675                 setuid(1);
10676         }
10677 #ifdef TRY_BSD_PGRP
10678         if (-1 == setpgrp(1, 1))
10679                 exit(0);
10680 #else
10681         if (setpgrp() != -1)
10682                 exit(0);
10683 #endif
10684         exit(1);
10685 }
10686 EOP
10687         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10688                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10689                 val="$define"
10690         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10691                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10692                 val="$undef"
10693         else
10694                 echo "(I can't seem to compile and run the test program.)"
10695                 if ./usg; then
10696                         xxx="a USG one, i.e. you use setpgrp()."
10697                 else
10698                         # SVR4 systems can appear rather BSD-ish.
10699                         case "$i_unistd" in
10700                         $undef)
10701                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10702                                 val="$define"
10703                                 ;;
10704                         $define)
10705                                 xxx="probably a USG one, i.e. you use setpgrp()."
10706                                 val="$undef"
10707                                 ;;
10708                         esac
10709                 fi
10710                 echo "Assuming your setpgrp is $xxx" >&4
10711         fi
10712         ;;
10713 *) val="$undef";;
10714 esac
10715 set d_bsdsetpgrp
10716 eval $setvar
10717 $rm_try
10718
10719 : Look for GCC-style __builtin_choose_expr
10720 case "$d_builtin_choose_expr" in
10721 '')
10722     echo " "
10723     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10724     $cat >try.c <<'EOCP'
10725 #include <assert.h>
10726 #include <stdlib.h>
10727 #include <stdio.h>
10728
10729 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10730
10731 int main(void) {
10732     assert( SYRINX(1) == 2112 );
10733     assert( SYRINX(1) != 5150 );
10734     assert( SYRINX(0) == 5150 );
10735     assert( SYRINX(0) != 2112 );
10736     puts( "All good!" );
10737     exit(0);
10738 }
10739
10740 EOCP
10741     set try
10742     if eval $compile && $run ./try; then
10743         echo "Your C compiler supports __builtin_choose_expr."
10744         val="$define"
10745     else
10746         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10747         val="$undef"
10748     fi
10749 ;;
10750 *) val="$d_builtin_choose_expr" ;;
10751 esac
10752
10753 set d_builtin_choose_expr
10754 eval $setvar
10755 $rm_try
10756
10757 : Look for GCC-style __builtin_expect
10758 case "$d_builtin_expect" in
10759 '')
10760     echo " "
10761     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10762     $cat >try.c <<'EOCP'
10763 int main(void) {
10764     int n = 50;
10765     if ( __builtin_expect(n, 0) ) n = 1;
10766     /* Remember shell exit code truth is 0, C truth is non-zero */
10767     return !(n == 1);
10768 }
10769 EOCP
10770     set try
10771     if eval $compile && $run ./try; then
10772         echo "Your C compiler supports __builtin_expect."
10773         val="$define"
10774     else
10775         echo "Your C compiler doesn't seem to understand __builtin_expect."
10776         val="$undef"
10777     fi
10778     ;;
10779 *) val="$d_builtin_expect" ;;
10780 esac
10781
10782 set d_builtin_expect
10783 eval $setvar
10784 $rm_try
10785
10786 : see if bzero exists
10787 set bzero d_bzero
10788 eval $inlibc
10789
10790 : see if stdarg is available
10791 echo " "
10792 if $test `./findhdr stdarg.h`; then
10793         echo "<stdarg.h> found." >&4
10794         valstd="$define"
10795 else
10796         echo "<stdarg.h> NOT found." >&4
10797         valstd="$undef"
10798 fi
10799
10800 : see if varags is available
10801 echo " "
10802 if $test `./findhdr varargs.h`; then
10803         echo "<varargs.h> found." >&4
10804 else
10805         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10806 fi
10807
10808 : set up the varargs testing programs
10809 $cat > varargs.c <<EOP
10810 #ifdef I_STDARG
10811 #include <stdarg.h>
10812 #endif
10813 #ifdef I_VARARGS
10814 #include <varargs.h>
10815 #endif
10816
10817 #ifdef I_STDARG
10818 int f(char *p, ...)
10819 #else
10820 int f(va_alist)
10821 va_dcl
10822 #endif
10823 {
10824         va_list ap;
10825 #ifndef I_STDARG
10826         char *p;
10827 #endif
10828 #ifdef I_STDARG
10829         va_start(ap,p);
10830 #else
10831         va_start(ap);
10832         p = va_arg(ap, char *);
10833 #endif
10834         va_end(ap);
10835         return 0;
10836 }
10837 EOP
10838 $cat > varargs <<EOP
10839 $startsh
10840 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10841         echo "true"
10842 else
10843         echo "false"
10844 fi
10845 $rm -f varargs$_o
10846 EOP
10847 chmod +x varargs
10848
10849 : now check which varargs header should be included
10850 echo " "
10851 i_varhdr=''
10852 case "$valstd" in
10853 "$define")
10854         if `./varargs I_STDARG`; then
10855                 val='stdarg.h'
10856         elif `./varargs I_VARARGS`; then
10857                 val='varargs.h'
10858         fi
10859         ;;
10860 *)
10861         if `./varargs I_VARARGS`; then
10862                 val='varargs.h'
10863         fi
10864         ;;
10865 esac
10866 case "$val" in
10867 '')
10868 echo "I could not find the definition for va_dcl... You have problems..." >&4
10869         val="$undef"; set i_stdarg; eval $setvar
10870         val="$undef"; set i_varargs; eval $setvar
10871         ;;
10872 *)
10873         set i_varhdr
10874         eval $setvar
10875         case "$i_varhdr" in
10876         stdarg.h)
10877                 val="$define"; set i_stdarg; eval $setvar
10878                 val="$undef"; set i_varargs; eval $setvar
10879                 ;;
10880         varargs.h)
10881                 val="$undef"; set i_stdarg; eval $setvar
10882                 val="$define"; set i_varargs; eval $setvar
10883                 ;;
10884         esac
10885         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10886 esac
10887 $rm -f varargs*
10888
10889 : see if the Compiler supports C99 variadic macros
10890 case "$i_stdarg$i_stdlib" in
10891     "$define$define")
10892     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10893     $cat >try.c <<EOCP
10894 #include <stdio.h>
10895 #include <stdarg.h>
10896
10897 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10898
10899 int main() {
10900   char buf[20];
10901   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10902   puts(buf);
10903   return 0;
10904 }
10905 EOCP
10906     set try
10907     if eval $compile && $run ./try 2>&1 >/dev/null; then
10908         case "`$run ./try`" in
10909             "123 456 789")
10910             echo "You have C99 variadic macros." >&4
10911             d_c99_variadic_macros="$define"
10912             ;;
10913             *)
10914             echo "You don't have functional C99 variadic macros." >&4
10915             d_c99_variadic_macros="$undef"
10916             ;;
10917         esac
10918     else
10919         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10920         d_c99_variadic_macros="$undef"
10921     fi
10922     $rm_try
10923     ;;
10924     *)
10925     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10926     d_c99_variadic_macros="$undef"
10927     ;;
10928 esac
10929
10930 : see if signal is declared as pointer to function returning int or void
10931 echo " "
10932 xxx=`./findhdr signal.h`
10933 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10934 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10935         echo "You have int (*signal())() instead of void." >&4
10936         val="$undef"
10937 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10938         echo "You have void (*signal())()." >&4
10939         val="$define"
10940 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10941         echo "You have int (*signal())() instead of void." >&4
10942         val="$undef"
10943 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10944         echo "You have void (*signal())()." >&4
10945         val="$define"
10946 else
10947         case "$d_voidsig" in
10948         '')
10949         echo "I can't determine whether signal handler returns void or int..." >&4
10950                 dflt=void
10951                 rp="What type does your signal handler return?"
10952                 . ./myread
10953                 case "$ans" in
10954                 v*) val="$define";;
10955                 *) val="$undef";;
10956                 esac;;
10957         "$define")
10958                 echo "As you already told me, signal handler returns void." >&4
10959                 val="$define"
10960                 ;;
10961         *)      echo "As you already told me, signal handler returns int." >&4
10962                 val="$undef"
10963                 ;;
10964         esac
10965 fi
10966 set d_voidsig
10967 eval $setvar
10968 case "$d_voidsig" in
10969 "$define") signal_t="void";;
10970 *) signal_t="int";;
10971 esac
10972 $rm -f $$.tmp
10973
10974 : check for ability to cast large floats to 32-bit ints.
10975 echo " "
10976 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10977 if $test "$intsize" -ge 4; then
10978         xxx=int
10979 else
10980         xxx=long
10981 fi
10982 $cat >try.c <<EOCP
10983 #include <stdio.h>
10984 #$i_stdlib I_STDLIB
10985 #ifdef I_STDLIB
10986 #include <stdlib.h>
10987 #endif
10988 #include <sys/types.h>
10989 #include <signal.h>
10990 $signal_t blech(int s) { exit(3); }
10991 int main()
10992 {
10993         $xxx i32;
10994         double f, g;
10995         int result = 0;
10996         char str[16];
10997         signal(SIGFPE, blech);
10998
10999         /* Don't let compiler optimize the test away.  Store the number
11000            in a writable string for gcc to pass to sscanf under HP-UX.
11001         */
11002         sprintf(str, "2147483647");
11003         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11004         g = 10 * f;
11005         i32  = ($xxx) g;
11006
11007         /* x86 processors will probably give 0x8000 0000, which is a
11008            sign change.  We don't want that.  We want to mimic SPARC
11009            behavior here, which is to preserve the sign and give
11010            back 0x7fff ffff.
11011         */
11012         if (i32 != ($xxx) f)
11013                 result |= 1;
11014         exit(result);
11015 }
11016 EOCP
11017 set try
11018 if eval $compile_ok; then
11019         $run ./try
11020         yyy=$?
11021 else
11022         echo "(I can't seem to compile the test program--assuming it can't)"
11023         yyy=1
11024 fi
11025 case "$yyy" in
11026 0)      val="$define"
11027         echo "Yup, it can."
11028         ;;
11029 *)      val="$undef"
11030         echo "Nope, it can't."
11031         ;;
11032 esac
11033 set d_casti32
11034 eval $setvar
11035 $rm_try
11036
11037 : check for ability to cast negative floats to unsigned
11038 echo " "
11039 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11040 $cat >try.c <<EOCP
11041 #include <stdio.h>
11042 #$i_stdlib I_STDLIB
11043 #ifdef I_STDLIB
11044 #include <stdlib.h>
11045 #endif
11046 #include <sys/types.h>
11047 #include <signal.h>
11048 $signal_t blech(int s) { exit(7); }
11049 $signal_t blech_in_list(int s) { exit(4); }
11050 unsigned long dummy_long(unsigned long p) { return p; }
11051 unsigned int dummy_int(unsigned int p) { return p; }
11052 unsigned short dummy_short(unsigned short p) { return p; }
11053 int main()
11054 {
11055         double f;
11056         unsigned long along;
11057         unsigned int aint;
11058         unsigned short ashort;
11059         int result = 0;
11060         char str[16];
11061
11062         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11063            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11064            optimized the whole file away
11065         */
11066         /* Store the number in a writable string for gcc to pass to
11067            sscanf under HP-UX.
11068         */
11069         sprintf(str, "-123");
11070         sscanf(str, "%lf", &f);  /* f = -123.; */
11071
11072         signal(SIGFPE, blech);
11073         along = (unsigned long)f;
11074         aint = (unsigned int)f;
11075         ashort = (unsigned short)f;
11076         if (along != (unsigned long)-123)
11077                 result |= 1;
11078         if (aint != (unsigned int)-123)
11079                 result |= 1;
11080         if (ashort != (unsigned short)-123)
11081                 result |= 1;
11082         sprintf(str, "1073741824.");
11083         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11084         f = f + f;
11085         along = 0;
11086         along = (unsigned long)f;
11087         if (along != 0x80000000)
11088                 result |= 2;
11089         f -= 1.;
11090         along = 0;
11091         along = (unsigned long)f;
11092         if (along != 0x7fffffff)
11093                 result |= 1;
11094         f += 2.;
11095         along = 0;
11096         along = (unsigned long)f;
11097         if (along != 0x80000001)
11098                 result |= 2;
11099         if (result)
11100                 exit(result);
11101         signal(SIGFPE, blech_in_list);
11102         sprintf(str, "123.");
11103         sscanf(str, "%lf", &f);  /* f = 123.; */
11104         along = dummy_long((unsigned long)f);
11105         aint = dummy_int((unsigned int)f);
11106         ashort = dummy_short((unsigned short)f);
11107         if (along != (unsigned long)123)
11108                 result |= 4;
11109         if (aint != (unsigned int)123)
11110                 result |= 4;
11111         if (ashort != (unsigned short)123)
11112                 result |= 4;
11113         exit(result);
11114
11115 }
11116 EOCP
11117 set try
11118 if eval $compile_ok; then
11119         $run ./try
11120         castflags=$?
11121 else
11122         echo "(I can't seem to compile the test program--assuming it can't)"
11123         castflags=7
11124 fi
11125 case "$castflags" in
11126 0)      val="$define"
11127         echo "Yup, it can."
11128         ;;
11129 *)      val="$undef"
11130         echo "Nope, it can't."
11131         ;;
11132 esac
11133 set d_castneg
11134 eval $setvar
11135 $rm_try
11136
11137 : see if vprintf exists
11138 echo " "
11139 if set vprintf val -f d_vprintf; eval $csym; $val; then
11140         echo 'vprintf() found.' >&4
11141         val="$define"
11142         $cat >try.c <<EOF
11143 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11144 #$i_varargs I_VARARGS
11145
11146 #$i_stdlib I_STDLIB
11147 #$i_unistd I_UNISTD
11148
11149 #ifdef I_STDARG
11150 #  include <stdarg.h>
11151 #else /* I_VARARGS */
11152 #  include <varargs.h>
11153 #endif
11154
11155 #ifdef I_UNISTD
11156 #  include <unistd.h>
11157 #endif
11158
11159 #ifdef I_STDLIB
11160 #  include <stdlib.h>
11161 #endif
11162
11163 #include <stdio.h> /* vsprintf prototype */
11164
11165 #ifdef I_STDARG
11166 void xxx(int n, ...)
11167 {
11168     va_list args;
11169     char buf[10];
11170     va_start(args, n);
11171     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11172 }
11173 int main() { xxx(1, "foo"); }
11174
11175 #else /* I_VARARGS */
11176
11177 xxx(va_alist)
11178 va_dcl
11179 {
11180     va_list args;
11181     char buf[10];
11182     va_start(args);
11183     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11184 }
11185 int main() { xxx("foo"); }
11186
11187 #endif
11188
11189 EOF
11190         set try
11191         if eval $compile_ok; then
11192                 if $run ./try; then
11193                         echo "Your vsprintf() returns (int)." >&4
11194                         val2="$undef"
11195                 else
11196                         echo "Your vsprintf() returns (char*)." >&4
11197                         val2="$define"
11198                 fi
11199         else
11200                 echo 'I am unable to compile the vsprintf() test program.' >&4
11201                 # We shouldn't get here.  If we do, assume the standard signature,
11202                 # not the old BSD one.
11203                 echo 'Guessing that vsprintf() returns (int).' >&4
11204                 val2="$undef"
11205         fi
11206 else
11207         echo 'vprintf() NOT found.' >&4
11208         val="$undef"
11209         val2="$undef"
11210 fi
11211 $rm_try
11212 set d_vprintf
11213 eval $setvar
11214 val=$val2
11215 set d_charvspr
11216 eval $setvar
11217
11218 : see if chown exists
11219 set chown d_chown
11220 eval $inlibc
11221
11222 : see if chroot exists
11223 set chroot d_chroot
11224 eval $inlibc
11225
11226 : see if chsize exists
11227 set chsize d_chsize
11228 eval $inlibc
11229
11230 : see if class exists
11231 set class d_class
11232 eval $inlibc
11233
11234 : see if clearenv exists
11235 set clearenv d_clearenv
11236 eval $inlibc
11237
11238 : Define hasstruct macro for Configure internal use
11239 hasstruct='varname=$1; struct=$2; shift; shift;
11240 while $test $# -ge 2; do
11241         case "$1" in
11242         $define) echo "#include <$2>";;
11243         esac ;
11244     shift 2;
11245 done > try.c;
11246 echo "int main () { struct $struct foo; }" >> try.c;
11247 set try;
11248 if eval $compile; then
11249         val="$define";
11250 else
11251         val="$undef";
11252 fi;
11253 set $varname;
11254 eval $setvar;
11255 $rm_try'
11256
11257 : see whether socket exists
11258 socketlib=''
11259 sockethdr=''
11260 echo " "
11261 $echo $n "Hmm... $c" >&4
11262 if set socket val -f d_socket; eval $csym; $val; then
11263         echo "Looks like you have Berkeley networking support." >&4
11264         d_socket="$define"
11265         if set setsockopt val -f; eval $csym; $val; then
11266                 d_oldsock="$undef"
11267         else
11268                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11269                 d_oldsock="$define"
11270         fi
11271 else
11272         if $contains socklib libc.list >/dev/null 2>&1; then
11273                 echo "Looks like you have Berkeley networking support." >&4
11274                 d_socket="$define"
11275                 : we will have to assume that it supports the 4.2 BSD interface
11276                 d_oldsock="$undef"
11277         else
11278                 echo "You don't have Berkeley networking in libc$_a..." >&4
11279                 if test "X$d_socket" = "X$define"; then
11280                    echo "...but you seem to believe that you have sockets." >&4
11281                 else
11282                         for net in net socket
11283                         do
11284                                 if test -f /usr/lib/lib$net$_a; then
11285                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11286                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11287                                         if $contains socket libc.list >/dev/null 2>&1; then
11288                                                 d_socket="$define"
11289                                                 socketlib="-l$net"
11290                                                 case "$net" in
11291                                                 net)
11292                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11293                                                         sockethdr="-I/usr/netinclude"
11294                                                         ;;
11295                                                 esac
11296                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11297                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11298                                                         d_oldsock="$undef"
11299                                                 else
11300                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11301                                                         d_oldsock="$define"
11302                                                 fi
11303                                                 break
11304                                         fi
11305                                 fi
11306                         done
11307                         if test "X$d_socket" != "X$define"; then
11308                            echo "or anywhere else I see." >&4
11309                            d_socket="$undef"
11310                            d_oldsock="$undef"
11311                         fi
11312                 fi
11313         fi
11314 fi
11315
11316 : see if socketpair exists
11317 set socketpair d_sockpair
11318 eval $inlibc
11319
11320
11321 echo " "
11322 echo "Checking the availability sa_len in the sock struct ..." >&4
11323 $cat >try.c <<EOF
11324 #include <sys/types.h>
11325 #include <sys/socket.h>
11326 int main() {
11327 struct sockaddr sa;
11328 return (sa.sa_len);
11329 }
11330 EOF
11331 val="$undef"
11332 set try; if eval $compile; then
11333         val="$define"
11334 fi
11335 set d_sockaddr_sa_len; eval $setvar
11336 $rm_try
11337
11338 echo " "
11339 echo "Checking the availability struct sockaddr_in6 ..." >&4
11340 $cat >try.c <<EOF
11341 #include <sys/types.h>
11342 #include <sys/socket.h>
11343 #include <netinet/in.h>
11344 int main() {
11345 struct sockaddr_in6 sin6;
11346 return (sin6.sin6_family);
11347 }
11348 EOF
11349 val="$undef"
11350 set try; if eval $compile; then
11351         val="$define"
11352 fi
11353 set d_sockaddr_in6; eval $setvar
11354 $rm_try
11355
11356 echo " "
11357 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11358 $cat >try.c <<EOF
11359 #include <sys/types.h>
11360 #include <sys/socket.h>
11361 #include <netinet/in.h>
11362 int main() {
11363 struct sockaddr_in6 sin6;
11364 return (sin6.sin6_scope_id);
11365 }
11366 EOF
11367 val="$undef"
11368 set try; if eval $compile; then
11369         val="$define"
11370 fi
11371 set d_sin6_scope_id; eval $setvar
11372 $rm_try
11373
11374 echo " "
11375 echo "Checking the availability struct ip_mreq ..." >&4
11376 $cat >try.c <<EOF
11377 #include <sys/types.h>
11378 #include <sys/socket.h>
11379 #include <netinet/in.h>
11380 int main() {
11381 struct ip_mreq mreq;
11382 return (mreq.imr_multiaddr.s_addr);
11383 }
11384 EOF
11385 val="$undef"
11386 set try; if eval $compile; then
11387        val="$define"
11388 fi
11389 set d_ip_mreq; eval $setvar
11390 $rm_try
11391
11392 echo " "
11393 echo "Checking the availability struct ipv6_mreq ..." >&4
11394 $cat >try.c <<EOF
11395 #include <sys/types.h>
11396 #include <sys/socket.h>
11397 #include <netinet/in.h>
11398 int main() {
11399 struct ipv6_mreq mreq;
11400 return (mreq.ipv6mr_interface);
11401 }
11402 EOF
11403 val="$undef"
11404 set try; if eval $compile; then
11405         val="$define"
11406 fi
11407 set d_ipv6_mreq; eval $setvar
11408 $rm_try
11409
11410 echo " "
11411 echo "Checking the availability of certain socket constants..." >&4
11412 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11413         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11414         $cat >try.c <<EOF
11415 #include <sys/types.h>
11416 #include <sys/socket.h>
11417 int main() {
11418     int i = $ENUM;
11419 }
11420 EOF
11421         val="$undef"
11422         set try; if eval $compile; then
11423                 val="$define"
11424         fi
11425         set d_${enum}; eval $setvar
11426         $rm_try
11427 done
11428
11429 : see if this is a sys/uio.h system
11430 set sys/uio.h i_sysuio
11431 eval $inhdr
11432
11433 : Check for cmsghdr support
11434 echo " "
11435 echo "Checking to see if your system supports struct cmsghdr..." >&4
11436 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11437 eval $hasstruct
11438 case "$d_cmsghdr_s" in
11439 "$define")      echo "Yes, it does."   ;;
11440 *)              echo "No, it doesn't." ;;
11441 esac
11442
11443
11444 : check for const keyword
11445 echo " "
11446 echo 'Checking to see if your C compiler knows about "const"...' >&4
11447 $cat >const.c <<'EOCP'
11448 typedef struct spug { int drokk; } spug;
11449 int main()
11450 {
11451         const char *foo;
11452         const spug y = { 0 };
11453 }
11454 EOCP
11455 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11456         val="$define"
11457         echo "Yup, it does."
11458 else
11459         val="$undef"
11460         echo "Nope, it doesn't."
11461 fi
11462 set d_const
11463 eval $setvar
11464
11465 : see if copysignl exists
11466 set copysignl d_copysignl
11467 eval $inlibc
11468
11469 : see if crypt exists
11470 echo " "
11471 set crypt d_crypt
11472 eval $inlibc
11473 case "$d_crypt" in
11474 $define) cryptlib='' ;;
11475 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11476                 echo 'crypt() found.' >&4
11477                 val="$define"
11478                 cryptlib=''
11479         else
11480                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11481                 if $test -z "$cryptlib"; then
11482                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11483                 else
11484                         cryptlib=-lcrypt
11485                 fi
11486                 if $test -z "$cryptlib"; then
11487                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11488                 else
11489                         cryptlib=-lcrypt
11490                 fi
11491                 if $test -z "$cryptlib"; then
11492                         cryptlib=`./loc libcrypt$_a "" $libpth`
11493                 else
11494                         cryptlib=-lcrypt
11495                 fi
11496                 if $test -z "$cryptlib"; then
11497                         echo 'crypt() NOT found.' >&4
11498                         val="$undef"
11499                 else
11500                         val="$define"
11501                 fi
11502         fi
11503         set d_crypt
11504         eval $setvar
11505         ;;
11506 esac
11507
11508 : see if this is a crypt.h system
11509 set crypt.h i_crypt
11510 eval $inhdr
11511
11512 : see if crypt_r exists
11513 set crypt_r d_crypt_r
11514 eval $inlibc
11515 case "$d_crypt_r" in
11516 "$define")
11517         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11518         case "$d_crypt_r_proto:$usethreads" in
11519         ":define")      d_crypt_r_proto=define
11520                 set d_crypt_r_proto crypt_r $hdrs
11521                 eval $hasproto ;;
11522         *)      ;;
11523         esac
11524         case "$d_crypt_r_proto" in
11525         define)
11526         case "$crypt_r_proto" in
11527         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11528         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11529         esac
11530         case "$crypt_r_proto" in
11531         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11532         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11533         esac
11534         case "$crypt_r_proto" in
11535         ''|0)   d_crypt_r=undef
11536                 crypt_r_proto=0
11537                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11538         * )     case "$crypt_r_proto" in
11539                 REENTRANT_PROTO*) ;;
11540                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11541                 esac
11542                 echo "Prototype: $try" ;;
11543         esac
11544         ;;
11545         *)      case "$usethreads" in
11546                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11547                 esac
11548                 d_crypt_r=undef
11549                 crypt_r_proto=0
11550                 ;;
11551         esac
11552         ;;
11553 *)      crypt_r_proto=0
11554         ;;
11555 esac
11556
11557 : get csh whereabouts
11558 case "$csh" in
11559 'csh') val="$undef" ;;
11560 *) val="$define" ;;
11561 esac
11562 set d_csh
11563 eval $setvar
11564 : Respect a hint or command line value for full_csh.
11565 case "$full_csh" in
11566 '') full_csh=$csh ;;
11567 esac
11568
11569 : see if ctermid exists
11570 set ctermid d_ctermid
11571 eval $inlibc
11572
11573 : see if ctermid_r exists
11574 set ctermid_r d_ctermid_r
11575 eval $inlibc
11576 case "$d_ctermid_r" in
11577 "$define")
11578         hdrs="$i_systypes sys/types.h define stdio.h "
11579         case "$d_ctermid_r_proto:$usethreads" in
11580         ":define")      d_ctermid_r_proto=define
11581                 set d_ctermid_r_proto ctermid_r $hdrs
11582                 eval $hasproto ;;
11583         *)      ;;
11584         esac
11585         case "$d_ctermid_r_proto" in
11586         define)
11587         case "$ctermid_r_proto" in
11588         ''|0) try='char* ctermid_r(char*);'
11589         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11590         esac
11591         case "$ctermid_r_proto" in
11592         ''|0)   d_ctermid_r=undef
11593                 ctermid_r_proto=0
11594                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11595         * )     case "$ctermid_r_proto" in
11596                 REENTRANT_PROTO*) ;;
11597                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11598                 esac
11599                 echo "Prototype: $try" ;;
11600         esac
11601         ;;
11602         *)      case "$usethreads" in
11603                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11604                 esac
11605                 d_ctermid_r=undef
11606                 ctermid_r_proto=0
11607                 ;;
11608         esac
11609         ;;
11610 *)      ctermid_r_proto=0
11611         ;;
11612 esac
11613
11614 : see if ctime_r exists
11615 set ctime_r d_ctime_r
11616 eval $inlibc
11617 case "$d_ctime_r" in
11618 "$define")
11619         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11620         case "$d_ctime_r_proto:$usethreads" in
11621         ":define")      d_ctime_r_proto=define
11622                 set d_ctime_r_proto ctime_r $hdrs
11623                 eval $hasproto ;;
11624         *)      ;;
11625         esac
11626         case "$d_ctime_r_proto" in
11627         define)
11628         case "$ctime_r_proto" in
11629         ''|0) try='char* ctime_r(const time_t*, char*);'
11630         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11631         esac
11632         case "$ctime_r_proto" in
11633         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11634         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11635         esac
11636         case "$ctime_r_proto" in
11637         ''|0) try='int ctime_r(const time_t*, char*);'
11638         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11639         esac
11640         case "$ctime_r_proto" in
11641         ''|0) try='int ctime_r(const time_t*, char*, int);'
11642         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11643         esac
11644         case "$ctime_r_proto" in
11645         ''|0)   d_ctime_r=undef
11646                 ctime_r_proto=0
11647                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11648         * )     case "$ctime_r_proto" in
11649                 REENTRANT_PROTO*) ;;
11650                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11651                 esac
11652                 echo "Prototype: $try" ;;
11653         esac
11654         ;;
11655         *)      case "$usethreads" in
11656                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11657                 esac
11658                 d_ctime_r=undef
11659                 ctime_r_proto=0
11660                 ;;
11661         esac
11662         ;;
11663 *)      ctime_r_proto=0
11664         ;;
11665 esac
11666
11667 : see if cuserid exists
11668 set cuserid d_cuserid
11669 eval $inlibc
11670
11671 : see if this is a limits.h system
11672 set limits.h i_limits
11673 eval $inhdr
11674
11675 : see if this is a float.h system
11676 set float.h i_float
11677 eval $inhdr
11678
11679 : See if number of significant digits in a double precision number is known
11680 echo " "
11681 $cat >dbl_dig.c <<EOM
11682 #$i_limits I_LIMITS
11683 #$i_float I_FLOAT
11684 #ifdef I_LIMITS
11685 #include <limits.h>
11686 #endif
11687 #ifdef I_FLOAT
11688 #include <float.h>
11689 #endif
11690 #ifdef DBL_DIG
11691 printf("Contains DBL_DIG");
11692 #endif
11693 EOM
11694 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11695 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11696         echo "DBL_DIG found." >&4
11697         val="$define"
11698 else
11699         echo "DBL_DIG NOT found." >&4
11700         val="$undef"
11701 fi
11702 $rm -f dbl_dig.?
11703 set d_dbl_dig
11704 eval $setvar
11705
11706 : see if dbm.h is available
11707 : see if dbmclose exists
11708 set dbmclose d_dbmclose
11709 eval $inlibc
11710
11711 case "$d_dbmclose" in
11712 $define)
11713         set dbm.h i_dbm
11714         eval $inhdr
11715         case "$i_dbm" in
11716         $define)
11717                 val="$undef"
11718                 set i_rpcsvcdbm
11719                 eval $setvar
11720                 ;;
11721         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11722                 eval $inhdr
11723                 ;;
11724         esac
11725         ;;
11726 *)      echo "We won't be including <dbm.h>"
11727         val="$undef"
11728         set i_dbm
11729         eval $setvar
11730         val="$undef"
11731         set i_rpcsvcdbm
11732         eval $setvar
11733         ;;
11734 esac
11735
11736 : see if prototype for dbminit is available
11737 echo " "
11738 set d_dbminitproto dbminit $i_dbm dbm.h
11739 eval $hasproto
11740
11741 : see if difftime exists
11742 set difftime d_difftime
11743 eval $inlibc
11744
11745 : see if this is a dirent system
11746 echo " "
11747 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11748         val="$define"
11749         echo "<dirent.h> found." >&4
11750 else
11751         val="$undef"
11752         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11753                 echo "<sys/dir.h> found." >&4
11754                 echo " "
11755         else
11756                 xinc=`./findhdr sys/ndir.h`
11757         fi
11758         echo "<dirent.h> NOT found." >&4
11759 fi
11760 set i_dirent
11761 eval $setvar
11762
11763 : Look for type of directory structure.
11764 echo " "
11765 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11766
11767 case "$direntrytype" in
11768 ''|' ')
11769         case "$i_dirent" in
11770         $define) guess1='struct dirent' ;;
11771         *) guess1='struct direct'  ;;
11772         esac
11773         ;;
11774 *)      guess1="$direntrytype"
11775         ;;
11776 esac
11777
11778 case "$guess1" in
11779 'struct dirent') guess2='struct direct' ;;
11780 *) guess2='struct dirent' ;;
11781 esac
11782
11783 if $contains "$guess1" try.c >/dev/null 2>&1; then
11784         direntrytype="$guess1"
11785         echo "Your directory entries are $direntrytype." >&4
11786 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11787         direntrytype="$guess2"
11788         echo "Your directory entries seem to be $direntrytype." >&4
11789 else
11790         echo "I don't recognize your system's directory entries." >&4
11791         rp="What type is used for directory entries on this system?"
11792         dflt="$guess1"
11793         . ./myread
11794         direntrytype="$ans"
11795 fi
11796 $rm_try
11797
11798 : see if the directory entry stores field length
11799 echo " "
11800 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11801 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11802         echo "Good, your directory entry keeps length information in d_namlen." >&4
11803         val="$define"
11804 else
11805         echo "Your directory entry does not know about the d_namlen field." >&4
11806         val="$undef"
11807 fi
11808 set d_dirnamlen
11809 eval $setvar
11810 $rm_try
11811
11812 : Look for DIR.dd_fd
11813 case "$i_dirent" in
11814 "$define")
11815     echo "Checking to see if DIR has a dd_fd member variable" >&4
11816     $cat >try.c <<EOCP
11817 #$i_stdlib I_STDLIB
11818 #ifdef I_STDLIB
11819 #include <stdlib.h>
11820 #endif
11821 #include <dirent.h>
11822
11823 int main() {
11824     DIR dir;
11825     dir.dd_fd = 1;
11826     return 0;
11827 }
11828 EOCP
11829     val=$undef
11830     set try
11831     if eval $compile; then
11832         echo "Yes, it does."
11833         val="$define"
11834     else
11835         echo "No, it does not."
11836         val="$undef"
11837     fi
11838     ;;
11839 *)
11840     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11841     val="$undef"
11842     ;;
11843 esac
11844 set d_dir_dd_fd
11845 eval $setvar
11846 $rm_try
11847
11848 : see if this is an sysdir system
11849 set sys/dir.h i_sysdir
11850 eval $inhdr
11851
11852 : see if this is an sysndir system
11853 set sys/ndir.h i_sysndir
11854 eval $inhdr
11855
11856 : Look for dirfd
11857 echo " "
11858 $cat >dirfd.c <<EOM
11859 #include <stdio.h>
11860 #$i_stdlib I_STDLIB
11861 #ifdef I_STDLIB
11862 #include <stdlib.h>
11863 #endif
11864 #$i_dirent I_DIRENT             /**/
11865 #$i_sysdir I_SYS_DIR            /**/
11866 #$i_sysndir I_SYS_NDIR          /**/
11867 #$i_systypes I_SYS_TYPES        /**/
11868 #if defined(I_SYS_TYPES)
11869 #include <sys/types.h>
11870 #endif
11871 #if defined(I_DIRENT)
11872 #include <dirent.h>
11873 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11874 #include <sys/dir.h>
11875 #endif
11876 #else
11877 #ifdef I_SYS_NDIR
11878 #include <sys/ndir.h>
11879 #else
11880 #ifdef I_SYS_DIR
11881 #ifdef hp9000s500
11882 #include <ndir.h>       /* may be wrong in the future */
11883 #else
11884 #include <sys/dir.h>
11885 #endif
11886 #endif
11887 #endif
11888 #endif 
11889 int main() {
11890         DIR *dirp = opendir(".");
11891         if (dirfd(dirp) >= 0)
11892                 exit(0);
11893         else
11894                 exit(1);
11895 }
11896 EOM
11897 val=$undef
11898 set dirfd
11899 if eval $compile; then
11900         val="$define"
11901 fi
11902 case "$val" in
11903 $define)        echo "dirfd() found." >&4       ;;
11904 *)              echo "dirfd() NOT found." >&4   ;;
11905 esac
11906 set d_dirfd
11907 eval $setvar
11908 $rm -f dirfd*
11909
11910 : see if dlerror exists
11911 xxx_runnm="$runnm"
11912 runnm=false
11913 set dlerror d_dlerror
11914 eval $inlibc
11915 runnm="$xxx_runnm"
11916
11917 : see if dlfcn is available
11918 set dlfcn.h i_dlfcn
11919 eval $inhdr
11920
11921 : Check what extension to use for shared libs
11922 case "$usedl" in
11923 $define|y|true)
11924         $cat << EOM
11925
11926 On a few systems, the dynamically loaded modules that perl generates and uses
11927 will need a different extension than shared libs. The default will probably
11928 be appropriate.
11929
11930 EOM
11931         case "$dlext" in
11932         '')     dflt="$so" ;;
11933         *)      dflt="$dlext" ;;
11934         esac
11935         rp='What is the extension of dynamically loaded modules'
11936         . ./myread
11937         dlext="$ans"
11938         ;;
11939 *)
11940         dlext="none"
11941         ;;
11942 esac
11943
11944 : Check if dlsym need a leading underscore
11945 echo " "
11946 val="$undef"
11947
11948 case "$dlsrc" in
11949 dl_dlopen.xs)
11950         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11951         $cat >dyna.c <<'EOM'
11952 fred () { }
11953 EOM
11954
11955 $cat >fred.c<<EOM
11956
11957 #include <stdio.h>
11958 #$i_stdlib I_STDLIB
11959 #ifdef I_STDLIB
11960 #include <stdlib.h>
11961 #endif
11962 #$i_dlfcn I_DLFCN
11963 #ifdef I_DLFCN
11964 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11965 #else
11966 #include <sys/types.h>
11967 #include <nlist.h>
11968 #include <link.h>
11969 #endif
11970
11971 extern int fred() ;
11972
11973 int main()
11974 {
11975     void * handle ;
11976     void * symbol ;
11977 #ifndef RTLD_LAZY
11978     int mode = 1 ;
11979 #else
11980     int mode = RTLD_LAZY ;
11981 #endif
11982     handle = dlopen("./dyna.$dlext", mode) ;
11983     if (handle == NULL) {
11984         printf ("1\n") ;
11985         fflush (stdout) ;
11986         exit(0);
11987     }
11988     symbol = dlsym(handle, "fred") ;
11989     if (symbol == NULL) {
11990         /* try putting a leading underscore */
11991         symbol = dlsym(handle, "_fred") ;
11992         if (symbol == NULL) {
11993             printf ("2\n") ;
11994             fflush (stdout) ;
11995             exit(0);
11996         }
11997         printf ("3\n") ;
11998     }
11999     else
12000         printf ("4\n") ;
12001     fflush (stdout) ;
12002     exit(0);
12003 }
12004 EOM
12005         : Call the object file tmp-dyna.o in case dlext=o.
12006         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12007                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12008                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12009                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12010                 xxx=`$run ./fred`
12011                 case $xxx in
12012                 1)      echo "Test program failed using dlopen." >&4
12013                         echo "Perhaps you should not use dynamic loading." >&4;;
12014                 2)      echo "Test program failed using dlsym." >&4
12015                         echo "Perhaps you should not use dynamic loading." >&4;;
12016                 3)      echo "dlsym needs a leading underscore" >&4
12017                         val="$define" ;;
12018                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12019                 esac
12020         else
12021                 echo "I can't compile and run the test program." >&4
12022                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12023         fi
12024         ;;
12025 esac
12026
12027 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12028
12029 set d_dlsymun
12030 eval $setvar
12031
12032 : see if drand48_r exists
12033 set drand48_r d_drand48_r
12034 eval $inlibc
12035 case "$d_drand48_r" in
12036 "$define")
12037         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12038         case "$d_drand48_r_proto:$usethreads" in
12039         ":define")      d_drand48_r_proto=define
12040                 set d_drand48_r_proto drand48_r $hdrs
12041                 eval $hasproto ;;
12042         *)      ;;
12043         esac
12044         case "$d_drand48_r_proto" in
12045         define)
12046         case "$drand48_r_proto" in
12047         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12048         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12049         esac
12050         case "$drand48_r_proto" in
12051         ''|0)   d_drand48_r=undef
12052                 drand48_r_proto=0
12053                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12054         * )     case "$drand48_r_proto" in
12055                 REENTRANT_PROTO*) ;;
12056                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12057                 esac
12058                 echo "Prototype: $try" ;;
12059         esac
12060         ;;
12061         *)      case "$usethreads" in
12062                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12063                 esac
12064                 d_drand48_r=undef
12065                 drand48_r_proto=0
12066                 ;;
12067         esac
12068         ;;
12069 *)      drand48_r_proto=0
12070         ;;
12071 esac
12072
12073 : see if prototype for drand48 is available
12074 echo " "
12075 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12076 eval $hasproto
12077
12078 : see if dup2 exists
12079 set dup2 d_dup2
12080 eval $inlibc
12081
12082 : see if eaccess exists
12083 set eaccess d_eaccess
12084 eval $inlibc
12085
12086 : see if endgrent exists
12087 set endgrent d_endgrent
12088 eval $inlibc
12089
12090 : see if this is an grp system
12091 set grp.h i_grp
12092 eval $inhdr
12093
12094 case "$i_grp" in
12095 $define)
12096         xxx=`./findhdr grp.h`
12097         $cppstdin $cppflags $cppminus < $xxx >$$.h
12098
12099         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12100                 val="$define"
12101         else
12102                 val="$undef"
12103         fi
12104         set d_grpasswd
12105         eval $setvar
12106
12107         $rm -f $$.h
12108         ;;
12109 *)
12110         val="$undef";
12111         set d_grpasswd; eval $setvar
12112         ;;
12113 esac
12114
12115 : see if endgrent_r exists
12116 set endgrent_r d_endgrent_r
12117 eval $inlibc
12118 case "$d_endgrent_r" in
12119 "$define")
12120         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12121         case "$d_endgrent_r_proto:$usethreads" in
12122         ":define")      d_endgrent_r_proto=define
12123                 set d_endgrent_r_proto endgrent_r $hdrs
12124                 eval $hasproto ;;
12125         *)      ;;
12126         esac
12127         case "$d_endgrent_r_proto" in
12128         define)
12129         case "$endgrent_r_proto" in
12130         ''|0) try='int endgrent_r(FILE**);'
12131         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12132         esac
12133         case "$endgrent_r_proto" in
12134         ''|0) try='void endgrent_r(FILE**);'
12135         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12136         esac
12137         case "$endgrent_r_proto" in
12138         ''|0)   d_endgrent_r=undef
12139                 endgrent_r_proto=0
12140                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12141         * )     case "$endgrent_r_proto" in
12142                 REENTRANT_PROTO*) ;;
12143                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12144                 esac
12145                 echo "Prototype: $try" ;;
12146         esac
12147         ;;
12148         *)      case "$usethreads" in
12149                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12150                 esac
12151                 d_endgrent_r=undef
12152                 endgrent_r_proto=0
12153                 ;;
12154         esac
12155         ;;
12156 *)      endgrent_r_proto=0
12157         ;;
12158 esac
12159
12160 : see if endhostent exists
12161 set endhostent d_endhent
12162 eval $inlibc
12163
12164 : see if this is a netdb.h system
12165 set netdb.h i_netdb
12166 eval $inhdr
12167
12168 : see if endhostent_r exists
12169 set endhostent_r d_endhostent_r
12170 eval $inlibc
12171 case "$d_endhostent_r" in
12172 "$define")
12173         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12174         case "$d_endhostent_r_proto:$usethreads" in
12175         ":define")      d_endhostent_r_proto=define
12176                 set d_endhostent_r_proto endhostent_r $hdrs
12177                 eval $hasproto ;;
12178         *)      ;;
12179         esac
12180         case "$d_endhostent_r_proto" in
12181         define)
12182         case "$endhostent_r_proto" in
12183         ''|0) try='int endhostent_r(struct hostent_data*);'
12184         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12185         esac
12186         case "$endhostent_r_proto" in
12187         ''|0) try='void endhostent_r(struct hostent_data*);'
12188         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12189         esac
12190         case "$endhostent_r_proto" in
12191         ''|0)   d_endhostent_r=undef
12192                 endhostent_r_proto=0
12193                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12194         * )     case "$endhostent_r_proto" in
12195                 REENTRANT_PROTO*) ;;
12196                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12197                 esac
12198                 echo "Prototype: $try" ;;
12199         esac
12200         ;;
12201         *)      case "$usethreads" in
12202                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12203                 esac
12204                 d_endhostent_r=undef
12205                 endhostent_r_proto=0
12206                 ;;
12207         esac
12208         ;;
12209 *)      endhostent_r_proto=0
12210         ;;
12211 esac
12212
12213 : see if endnetent exists
12214 set endnetent d_endnent
12215 eval $inlibc
12216
12217 : see if endnetent_r exists
12218 set endnetent_r d_endnetent_r
12219 eval $inlibc
12220 case "$d_endnetent_r" in
12221 "$define")
12222         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12223         case "$d_endnetent_r_proto:$usethreads" in
12224         ":define")      d_endnetent_r_proto=define
12225                 set d_endnetent_r_proto endnetent_r $hdrs
12226                 eval $hasproto ;;
12227         *)      ;;
12228         esac
12229         case "$d_endnetent_r_proto" in
12230         define)
12231         case "$endnetent_r_proto" in
12232         ''|0) try='int endnetent_r(struct netent_data*);'
12233         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12234         esac
12235         case "$endnetent_r_proto" in
12236         ''|0) try='void endnetent_r(struct netent_data*);'
12237         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12238         esac
12239         case "$endnetent_r_proto" in
12240         ''|0)   d_endnetent_r=undef
12241                 endnetent_r_proto=0
12242                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12243         * )     case "$endnetent_r_proto" in
12244                 REENTRANT_PROTO*) ;;
12245                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12246                 esac
12247                 echo "Prototype: $try" ;;
12248         esac
12249         ;;
12250         *)      case "$usethreads" in
12251                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12252                 esac
12253                 d_endnetent_r=undef
12254                 endnetent_r_proto=0
12255                 ;;
12256         esac
12257         ;;
12258 *)      endnetent_r_proto=0
12259         ;;
12260 esac
12261
12262 : see if endprotoent exists
12263 set endprotoent d_endpent
12264 eval $inlibc
12265
12266 : see if endprotoent_r exists
12267 set endprotoent_r d_endprotoent_r
12268 eval $inlibc
12269 case "$d_endprotoent_r" in
12270 "$define")
12271         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12272         case "$d_endprotoent_r_proto:$usethreads" in
12273         ":define")      d_endprotoent_r_proto=define
12274                 set d_endprotoent_r_proto endprotoent_r $hdrs
12275                 eval $hasproto ;;
12276         *)      ;;
12277         esac
12278         case "$d_endprotoent_r_proto" in
12279         define)
12280         case "$endprotoent_r_proto" in
12281         ''|0) try='int endprotoent_r(struct protoent_data*);'
12282         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12283         esac
12284         case "$endprotoent_r_proto" in
12285         ''|0) try='void endprotoent_r(struct protoent_data*);'
12286         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12287         esac
12288         case "$endprotoent_r_proto" in
12289         ''|0)   d_endprotoent_r=undef
12290                 endprotoent_r_proto=0
12291                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12292         * )     case "$endprotoent_r_proto" in
12293                 REENTRANT_PROTO*) ;;
12294                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12295                 esac
12296                 echo "Prototype: $try" ;;
12297         esac
12298         ;;
12299         *)      case "$usethreads" in
12300                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12301                 esac
12302                 d_endprotoent_r=undef
12303                 endprotoent_r_proto=0
12304                 ;;
12305         esac
12306         ;;
12307 *)      endprotoent_r_proto=0
12308         ;;
12309 esac
12310
12311 : see if endpwent exists
12312 set endpwent d_endpwent
12313 eval $inlibc
12314
12315 : see if this is a pwd.h system
12316 set pwd.h i_pwd
12317 eval $inhdr
12318
12319 case "$i_pwd" in
12320 $define)
12321         xxx=`./findhdr pwd.h`
12322         $cppstdin $cppflags $cppminus < $xxx >$$.h
12323
12324         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12325                 val="$define"
12326         else
12327                 val="$undef"
12328         fi
12329         set d_pwquota
12330         eval $setvar
12331
12332         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12333                 val="$define"
12334         else
12335                 val="$undef"
12336         fi
12337         set d_pwage
12338         eval $setvar
12339
12340         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12341                 val="$define"
12342         else
12343                 val="$undef"
12344         fi
12345         set d_pwchange
12346         eval $setvar
12347
12348         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12349                 val="$define"
12350         else
12351                 val="$undef"
12352         fi
12353         set d_pwclass
12354         eval $setvar
12355
12356         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12357                 val="$define"
12358         else
12359                 val="$undef"
12360         fi
12361         set d_pwexpire
12362         eval $setvar
12363
12364         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12365                 val="$define"
12366         else
12367                 val="$undef"
12368         fi
12369         set d_pwcomment
12370         eval $setvar
12371
12372         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12373                 val="$define"
12374         else
12375                 val="$undef"
12376         fi
12377         set d_pwgecos
12378         eval $setvar
12379
12380         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12381                 val="$define"
12382         else
12383                 val="$undef"
12384         fi
12385         set d_pwpasswd
12386         eval $setvar
12387
12388         $rm -f $$.h
12389         ;;
12390 *)
12391         val="$undef"; 
12392         set d_pwquota; eval $setvar
12393         set d_pwage; eval $setvar
12394         set d_pwchange; eval $setvar
12395         set d_pwclass; eval $setvar
12396         set d_pwexpire; eval $setvar
12397         set d_pwcomment; eval $setvar
12398         set d_pwgecos; eval $setvar
12399         set d_pwpasswd; eval $setvar
12400         ;;
12401 esac
12402
12403 : see if endpwent_r exists
12404 set endpwent_r d_endpwent_r
12405 eval $inlibc
12406 case "$d_endpwent_r" in
12407 "$define")
12408         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12409         case "$d_endpwent_r_proto:$usethreads" in
12410         ":define")      d_endpwent_r_proto=define
12411                 set d_endpwent_r_proto endpwent_r $hdrs
12412                 eval $hasproto ;;
12413         *)      ;;
12414         esac
12415         case "$d_endpwent_r_proto" in
12416         define)
12417         case "$endpwent_r_proto" in
12418         ''|0) try='int endpwent_r(FILE**);'
12419         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12420         esac
12421         case "$endpwent_r_proto" in
12422         ''|0) try='void endpwent_r(FILE**);'
12423         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12424         esac
12425         case "$endpwent_r_proto" in
12426         ''|0)   d_endpwent_r=undef
12427                 endpwent_r_proto=0
12428                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12429         * )     case "$endpwent_r_proto" in
12430                 REENTRANT_PROTO*) ;;
12431                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12432                 esac
12433                 echo "Prototype: $try" ;;
12434         esac
12435         ;;
12436         *)      case "$usethreads" in
12437                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12438                 esac
12439                 d_endpwent_r=undef
12440                 endpwent_r_proto=0
12441                 ;;
12442         esac
12443         ;;
12444 *)      endpwent_r_proto=0
12445         ;;
12446 esac
12447
12448 : see if endservent exists
12449 set endservent d_endsent
12450 eval $inlibc
12451
12452 : see if endservent_r exists
12453 set endservent_r d_endservent_r
12454 eval $inlibc
12455 case "$d_endservent_r" in
12456 "$define")
12457         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12458         case "$d_endservent_r_proto:$usethreads" in
12459         ":define")      d_endservent_r_proto=define
12460                 set d_endservent_r_proto endservent_r $hdrs
12461                 eval $hasproto ;;
12462         *)      ;;
12463         esac
12464         case "$d_endservent_r_proto" in
12465         define)
12466         case "$endservent_r_proto" in
12467         ''|0) try='int endservent_r(struct servent_data*);'
12468         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12469         esac
12470         case "$endservent_r_proto" in
12471         ''|0) try='void endservent_r(struct servent_data*);'
12472         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12473         esac
12474         case "$endservent_r_proto" in
12475         ''|0)   d_endservent_r=undef
12476                 endservent_r_proto=0
12477                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12478         * )     case "$endservent_r_proto" in
12479                 REENTRANT_PROTO*) ;;
12480                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12481                 esac
12482                 echo "Prototype: $try" ;;
12483         esac
12484         ;;
12485         *)      case "$usethreads" in
12486                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12487                 esac
12488                 d_endservent_r=undef
12489                 endservent_r_proto=0
12490                 ;;
12491         esac
12492         ;;
12493 *)      endservent_r_proto=0
12494         ;;
12495 esac
12496
12497 : Locate the flags for 'open()'
12498 echo " "
12499 $cat >try.c <<EOCP
12500 #include <sys/types.h>
12501 #ifdef I_FCNTL
12502 #include <fcntl.h>
12503 #endif
12504 #ifdef I_SYS_FILE
12505 #include <sys/file.h>
12506 #endif
12507 #$i_stdlib I_STDLIB
12508 #ifdef I_STDLIB
12509 #include <stdlib.h>
12510 #endif
12511 int main() {
12512         if(O_RDONLY);
12513 #ifdef O_TRUNC
12514         exit(0);
12515 #else
12516         exit(1);
12517 #endif
12518 }
12519 EOCP
12520 : check sys/file.h first to get FREAD on Sun
12521 if $test `./findhdr sys/file.h` && \
12522                 set try -DI_SYS_FILE && eval $compile; then
12523         h_sysfile=true;
12524         echo "<sys/file.h> defines the O_* constants..." >&4
12525         if $run ./try; then
12526                 echo "and you have the 3 argument form of open()." >&4
12527                 val="$define"
12528         else
12529                 echo "but not the 3 argument form of open().  Oh, well." >&4
12530                 val="$undef"
12531         fi
12532 elif $test `./findhdr fcntl.h` && \
12533                 set try -DI_FCNTL && eval $compile; then
12534         h_fcntl=true;
12535         echo "<fcntl.h> defines the O_* constants..." >&4
12536         if $run ./try; then
12537                 echo "and you have the 3 argument form of open()." >&4
12538                 val="$define"
12539         else
12540                 echo "but not the 3 argument form of open().  Oh, well." >&4
12541                 val="$undef"
12542         fi
12543 else
12544         val="$undef"
12545         echo "I can't find the O_* constant definitions!  You got problems." >&4
12546 fi
12547 set d_open3
12548 eval $setvar
12549 $rm_try
12550
12551 : see if this is a sys/file.h system
12552 val=''
12553 set sys/file.h val
12554 eval $inhdr
12555
12556 : do we need to include sys/file.h ?
12557 case "$val" in
12558 "$define")
12559         echo " "
12560         if $h_sysfile; then
12561                 val="$define"
12562                 echo "We'll be including <sys/file.h>." >&4
12563         else
12564                 val="$undef"
12565                 echo "We won't be including <sys/file.h>." >&4
12566         fi
12567         ;;
12568 *)
12569         h_sysfile=false
12570         ;;
12571 esac
12572 set i_sysfile
12573 eval $setvar
12574
12575 : see if fcntl.h is there
12576 val=''
12577 set fcntl.h val
12578 eval $inhdr
12579
12580 : see if we can include fcntl.h
12581 case "$val" in
12582 "$define")
12583         echo " "
12584         if $h_fcntl; then
12585                 val="$define"
12586                 echo "We'll be including <fcntl.h>." >&4
12587         else
12588                 val="$undef"
12589                 if $h_sysfile; then
12590         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12591                 else
12592                         echo "We won't be including <fcntl.h>." >&4
12593                 fi
12594         fi
12595         ;;
12596 *)
12597         h_fcntl=false
12598         val="$undef"
12599         ;;
12600 esac
12601 set i_fcntl
12602 eval $setvar
12603
12604 : see if fork exists
12605 set fork d_fork
12606 eval $inlibc
12607
12608 : see if pipe exists
12609 set pipe d_pipe
12610 eval $inlibc
12611
12612 : check for non-blocking I/O stuff
12613 case "$h_sysfile" in
12614 true) echo "#include <sys/file.h>" > head.c;;
12615 *)
12616        case "$h_fcntl" in
12617        true) echo "#include <fcntl.h>" > head.c;;
12618        *) echo "#include <sys/fcntl.h>" > head.c;;
12619        esac
12620        ;;
12621 esac
12622 echo " "
12623 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12624 case "$o_nonblock" in
12625 '')
12626         $cat head.c > try.c
12627         $cat >>try.c <<EOCP
12628 #include <stdio.h>
12629 #$i_stdlib I_STDLIB
12630 #ifdef I_STDLIB
12631 #include <stdlib.h>
12632 #endif
12633 #$i_fcntl I_FCNTL
12634 #ifdef I_FCNTL
12635 #include <fcntl.h>
12636 #endif
12637 int main() {
12638 #ifdef O_NONBLOCK
12639         printf("O_NONBLOCK\n");
12640         exit(0);
12641 #endif
12642 #ifdef O_NDELAY
12643         printf("O_NDELAY\n");
12644         exit(0);
12645 #endif
12646 #ifdef FNDELAY
12647         printf("FNDELAY\n");
12648         exit(0);
12649 #endif
12650         exit(0);
12651 }
12652 EOCP
12653         set try
12654         if eval $compile_ok; then
12655                 o_nonblock=`$run ./try`
12656                 case "$o_nonblock" in
12657                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12658                 *) echo "Seems like we can use $o_nonblock.";;
12659                 esac
12660         else
12661                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12662         fi
12663         ;;
12664 *) echo "Using $hint value $o_nonblock.";;
12665 esac
12666 $rm_try
12667
12668 echo " "
12669 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12670 case "$eagain" in
12671 '')
12672         case "$d_fork:$d_pipe" in
12673         define:define)
12674         $cat head.c > try.c
12675         $cat >>try.c <<EOCP
12676 #include <errno.h>
12677 #include <sys/types.h>
12678 #include <signal.h>
12679 #include <stdio.h>
12680 #$i_stdlib I_STDLIB
12681 #ifdef I_STDLIB
12682 #include <stdlib.h>
12683 #endif
12684 #$i_fcntl I_FCNTL
12685 #ifdef I_FCNTL
12686 #include <fcntl.h>
12687 #endif
12688 #define MY_O_NONBLOCK $o_nonblock
12689 #ifndef errno  /* XXX need better Configure test */
12690 extern int errno;
12691 #endif
12692 #$i_unistd I_UNISTD
12693 #ifdef I_UNISTD
12694 #include <unistd.h>
12695 #endif
12696 #$i_string I_STRING
12697 #ifdef I_STRING
12698 #include <string.h>
12699 #else
12700 #include <strings.h>
12701 #endif
12702 $signal_t blech(int x) { exit(3); }
12703 EOCP
12704         $cat >> try.c <<'EOCP'
12705 int main()
12706 {
12707         int pd[2];
12708         int pu[2];
12709         char buf[1];
12710         char string[100];
12711
12712         pipe(pd);       /* Down: child -> parent */
12713         pipe(pu);       /* Up: parent -> child */
12714         if (0 != fork()) {
12715                 int ret;
12716                 close(pd[1]);   /* Parent reads from pd[0] */
12717                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12718 #ifdef F_SETFL
12719                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12720                         exit(1);
12721 #else
12722                 exit(4);
12723 #endif
12724                 signal(SIGALRM, blech);
12725                 alarm(5);
12726                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12727                         exit(2);
12728                 sprintf(string, "%d\n", ret);
12729                 write(2, string, strlen(string));
12730                 alarm(0);
12731 #ifdef EAGAIN
12732                 if (errno == EAGAIN) {
12733                         printf("EAGAIN\n");
12734                         goto ok;
12735                 }
12736 #endif
12737 #ifdef EWOULDBLOCK
12738                 if (errno == EWOULDBLOCK)
12739                         printf("EWOULDBLOCK\n");
12740 #endif
12741         ok:
12742                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12743                 sleep(2);                               /* Give it time to close our pipe */
12744                 alarm(5);
12745                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12746                 alarm(0);
12747                 sprintf(string, "%d\n", ret);
12748                 write(4, string, strlen(string));
12749                 exit(0);
12750         }
12751
12752         close(pd[0]);                   /* We write to pd[1] */
12753         close(pu[1]);                   /* We read from pu[0] */
12754         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12755         close(pd[1]);                   /* Pipe pd is now fully closed! */
12756         exit(0);                                /* Bye bye, thank you for playing! */
12757 }
12758 EOCP
12759         set try
12760         if eval $compile_ok; then
12761                 echo "$startsh" >mtry
12762                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12763                 chmod +x mtry
12764                 ./mtry >/dev/null 2>&1
12765                 case $? in
12766                 0) eagain=`$cat try.out`;;
12767                 1) echo "Could not perform non-blocking setting!";;
12768                 2) echo "I did a successful read() for something that was not there!";;
12769                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12770                 4) echo "Could not find F_SETFL!";;
12771                 *) echo "Something terribly wrong happened during testing.";;
12772                 esac
12773                 rd_nodata=`$cat try.ret`
12774                 echo "A read() system call with no data present returns $rd_nodata."
12775                 case "$rd_nodata" in
12776                 0|-1) ;;
12777                 *)
12778                         echo "(That's peculiar, fixing that to be -1.)"
12779                         rd_nodata=-1
12780                         ;;
12781                 esac
12782                 case "$eagain" in
12783                 '')
12784                         echo "Forcing errno EAGAIN on read() with no data available."
12785                         eagain=EAGAIN
12786                         ;;
12787                 *)
12788                         echo "Your read() sets errno to $eagain when no data is available."
12789                         ;;
12790                 esac
12791                 status=`$cat try.err`
12792                 case "$status" in
12793                 0) echo "And it correctly returns 0 to signal EOF.";;
12794                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12795                 *) echo "However, your read() returns '$status' on EOF??";;
12796                 esac
12797                 val="$define"
12798                 if test "$status" = "$rd_nodata"; then
12799                         echo "WARNING: you can't distinguish between EOF and no data!"
12800                         val="$undef"
12801                 fi
12802         else
12803                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12804                 eagain=EAGAIN
12805         fi
12806         ;;
12807         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12808                 eagain=EAGAIN
12809                 val="$define"
12810                 ;;
12811         esac
12812         set d_eofnblk
12813         eval $setvar
12814         ;;
12815 *)
12816         echo "Using $hint value $eagain."
12817         echo "Your read() returns $rd_nodata when no data is present."
12818         case "$d_eofnblk" in
12819         "$define") echo "And you can see EOF because read() returns 0.";;
12820         "$undef") echo "But you can't see EOF status from read() returned value.";;
12821         *)
12822                 echo "(Assuming you can't see EOF status from read anyway.)"
12823                 d_eofnblk=$undef
12824                 ;;
12825         esac
12826         ;;
12827 esac
12828 $rm_try head.c mtry
12829
12830 : see if _ptr and _cnt from stdio act std
12831 echo " "
12832
12833 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12834         echo "(Looks like you have stdio.h from BSD.)"
12835         case "$stdio_ptr" in
12836         '') stdio_ptr='((fp)->_p)'
12837                 ptr_lval=$define
12838                 ;;
12839         *)      ptr_lval=$d_stdio_ptr_lval;;
12840         esac
12841         case "$stdio_cnt" in
12842         '') stdio_cnt='((fp)->_r)'
12843                 cnt_lval=$define
12844                 ;;
12845         *)      cnt_lval=$d_stdio_cnt_lval;;
12846         esac
12847         case "$stdio_base" in
12848         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12849         esac
12850         case "$stdio_bufsiz" in
12851         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12852         esac
12853 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12854         echo "(Looks like you have stdio.h from Linux.)"
12855         case "$stdio_ptr" in
12856         '') stdio_ptr='((fp)->_IO_read_ptr)'
12857                 ptr_lval=$define
12858                 ;;
12859         *)      ptr_lval=$d_stdio_ptr_lval;;
12860         esac
12861         case "$stdio_cnt" in
12862         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12863                 cnt_lval=$undef
12864                 ;;
12865         *)      cnt_lval=$d_stdio_cnt_lval;;
12866         esac
12867         case "$stdio_base" in
12868         '') stdio_base='((fp)->_IO_read_base)';;
12869         esac
12870         case "$stdio_bufsiz" in
12871         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12872         esac
12873 else
12874         case "$stdio_ptr" in
12875         '') stdio_ptr='((fp)->_ptr)'
12876                 ptr_lval=$define
12877                 ;;
12878         *)      ptr_lval=$d_stdio_ptr_lval;;
12879         esac
12880         case "$stdio_cnt" in
12881         '') stdio_cnt='((fp)->_cnt)'
12882                 cnt_lval=$define
12883                 ;;
12884         *)      cnt_lval=$d_stdio_cnt_lval;;
12885         esac
12886         case "$stdio_base" in
12887         '') stdio_base='((fp)->_base)';;
12888         esac
12889         case "$stdio_bufsiz" in
12890         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12891         esac
12892 fi
12893
12894 : test whether _ptr and _cnt really work
12895 echo "Checking how std your stdio is..." >&4
12896 $cat >try.c <<EOP
12897 #include <stdio.h>
12898 #$i_stdlib I_STDLIB
12899 #ifdef I_STDLIB
12900 #include <stdlib.h>
12901 #endif
12902 #define FILE_ptr(fp)    $stdio_ptr
12903 #define FILE_cnt(fp)    $stdio_cnt
12904 int main() {
12905         FILE *fp = fopen("try.c", "r");
12906         char c = getc(fp);
12907         if (
12908                 18 <= FILE_cnt(fp) &&
12909                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12910         )
12911                 exit(0);
12912         exit(1);
12913 }
12914 EOP
12915 val="$undef"
12916 set try
12917 if eval $compile && $to try.c; then
12918         if $run ./try; then
12919                 echo "Your stdio acts pretty std."
12920                 val="$define"
12921         else
12922                 echo "Your stdio isn't very std."
12923         fi
12924 else
12925         echo "Your stdio doesn't appear very std."
12926 fi
12927 $rm_try
12928
12929 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12930 # direct buffer manipulation no longer works.  The Configure tests
12931 # should be changed to correctly detect this, but until then,
12932 # the following check should at least let perl compile and run.
12933 # (This quick fix should be updated before 5.8.1.)
12934 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12935 # A. Dougherty, June 3, 2002.
12936 case "$d_gnulibc" in
12937 $define)
12938         case "$gnulibc_version" in
12939         2.[01]*)  ;;
12940         2.2) ;;
12941         2.2.[0-9]) ;;
12942         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12943                 val="$undef"
12944                 ;;
12945         esac
12946         ;;
12947 esac
12948 set d_stdstdio
12949 eval $setvar
12950
12951 : Can _ptr be used as an lvalue?
12952 case "$d_stdstdio$ptr_lval" in
12953 $define$define) val=$define ;;
12954 *) val=$undef ;;
12955 esac
12956 set d_stdio_ptr_lval
12957 eval $setvar
12958
12959 : Can _cnt be used as an lvalue?
12960 case "$d_stdstdio$cnt_lval" in
12961 $define$define) val=$define ;;
12962 *) val=$undef ;;
12963 esac
12964 set d_stdio_cnt_lval
12965 eval $setvar
12966
12967
12968 : test whether setting _ptr sets _cnt as a side effect
12969 d_stdio_ptr_lval_sets_cnt="$undef"
12970 d_stdio_ptr_lval_nochange_cnt="$undef"
12971 case "$d_stdio_ptr_lval$d_stdstdio" in
12972 $define$define)
12973         echo "Checking to see what happens if we set the stdio ptr..." >&4
12974 $cat >try.c <<EOP
12975 #include <stdio.h>
12976 /* Can we scream? */
12977 /* Eat dust sed :-) */
12978 /* In the buffer space, no one can hear you scream. */
12979 #$i_stdlib I_STDLIB
12980 #ifdef I_STDLIB
12981 #include <stdlib.h>
12982 #endif
12983 #define FILE_ptr(fp)    $stdio_ptr
12984 #define FILE_cnt(fp)    $stdio_cnt
12985 #include <sys/types.h>
12986 int main() {
12987         FILE *fp = fopen("try.c", "r");
12988         int c;
12989         char *ptr;
12990         size_t cnt;
12991         if (!fp) {
12992             puts("Fail even to read");
12993             exit(1);
12994         }
12995         c = getc(fp); /* Read away the first # */
12996         if (c == EOF) {
12997             puts("Fail even to read");
12998             exit(1);
12999         }
13000         if (!(
13001                 18 <= FILE_cnt(fp) &&
13002                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13003         )) {
13004                 puts("Fail even to read");
13005                 exit (1);
13006         }
13007         ptr = (char*) FILE_ptr(fp);
13008         cnt = (size_t)FILE_cnt(fp);
13009
13010         FILE_ptr(fp) += 42;
13011
13012         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13013                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13014                 exit (1);
13015         }
13016         if (FILE_cnt(fp) <= 20) {
13017                 printf ("Fail (<20 chars to test)");
13018                 exit (1);
13019         }
13020         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13021                 puts("Fail compare");
13022                 exit (1);
13023         }
13024         if (cnt == FILE_cnt(fp)) {
13025                 puts("Pass_unchanged");
13026                 exit (0);
13027         }
13028         if (FILE_cnt(fp) == (cnt - 42)) {
13029                 puts("Pass_changed");
13030                 exit (0);
13031         }
13032         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13033         return 1;
13034
13035 }
13036 EOP
13037         set try
13038         if eval $compile && $to try.c; then
13039                 case `$run ./try` in
13040                 Pass_changed)
13041                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13042                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13043                 Pass_unchanged)
13044                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13045                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13046                 Fail*)
13047                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13048                 *)
13049                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13050         esac
13051         else
13052                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13053         fi
13054         $rm_try
13055         ;;
13056 esac
13057
13058 : see if _base is also standard
13059 val="$undef"
13060 case "$d_stdstdio" in
13061 $define)
13062         $cat >try.c <<EOP
13063 #include <stdio.h>
13064 #$i_stdlib I_STDLIB
13065 #ifdef I_STDLIB
13066 #include <stdlib.h>
13067 #endif
13068 #define FILE_base(fp)   $stdio_base
13069 #define FILE_bufsiz(fp) $stdio_bufsiz
13070 int main() {
13071         FILE *fp = fopen("try.c", "r");
13072         char c = getc(fp);
13073         if (
13074                 19 <= FILE_bufsiz(fp) &&
13075                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13076         )
13077                 exit(0);
13078         exit(1);
13079 }
13080 EOP
13081         set try
13082         if eval $compile && $to try.c; then
13083                 if $run ./try; then
13084                         echo "And its _base field acts std."
13085                         val="$define"
13086                 else
13087                         echo "But its _base field isn't std."
13088                 fi
13089         else
13090                 echo "However, it seems to be lacking the _base field."
13091         fi
13092         $rm_try
13093         ;;
13094 esac
13095 set d_stdiobase
13096 eval $setvar
13097
13098 : see if fast_stdio exists
13099 val="$undef"
13100 case "$d_stdstdio:$d_stdio_ptr_lval" in
13101 "$define:$define")
13102         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13103         *$define*)
13104                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13105                 val="$define"
13106                 ;;
13107         esac
13108         ;;
13109 esac
13110 set d_faststdio
13111 eval $setvar
13112
13113
13114
13115 : see if fchdir exists
13116 set fchdir d_fchdir
13117 eval $inlibc
13118
13119 : see if fchmod exists
13120 set fchmod d_fchmod
13121 eval $inlibc
13122
13123 : see if fchown exists
13124 set fchown d_fchown
13125 eval $inlibc
13126
13127 : see if this is an fcntl system
13128 set fcntl d_fcntl
13129 eval $inlibc
13130
13131 : See if fcntl-based locking works.
13132 echo " "
13133 $cat >try.c <<EOCP
13134 #$i_stdlib I_STDLIB
13135 #ifdef I_STDLIB
13136 #include <stdlib.h>
13137 #endif
13138 #include <unistd.h>
13139 #include <fcntl.h>
13140 #include <signal.h>
13141 $signal_t blech(int x) { exit(3); }
13142 int main() {
13143 #if defined(F_SETLK) && defined(F_SETLKW)
13144      struct flock flock;
13145      int retval, fd;
13146      fd = open("try.c", O_RDONLY);
13147      flock.l_type = F_RDLCK;
13148      flock.l_whence = SEEK_SET;
13149      flock.l_start = flock.l_len = 0;
13150      signal(SIGALRM, blech);
13151      alarm(10);
13152      retval = fcntl(fd, F_SETLK, &flock);
13153      close(fd);
13154      (retval < 0 ? exit(2) : exit(0));
13155 #else
13156      exit(2);
13157 #endif
13158 }
13159 EOCP
13160 echo "Checking if fcntl-based file locking works... "
13161 case "$d_fcntl" in
13162 "$define")
13163         set try
13164         if eval $compile_ok; then
13165                 if $run ./try; then
13166                         echo "Yes, it seems to work."
13167                         val="$define"
13168                 else
13169                         echo "Nope, it didn't work."
13170                         val="$undef"
13171                         case "$?" in
13172                         3) $cat >&4 <<EOM
13173 ***
13174 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13175 *** This is (almost) impossible.
13176 *** If your NFS lock daemons are not feeling well, something like
13177 *** this may happen, please investigate.  Cannot continue, aborting.
13178 ***
13179 EOM
13180                                 exit 1
13181                                 ;;
13182                         esac
13183                 fi
13184         else
13185                 echo "I'm unable to compile the test program, so I'll assume not."
13186                 val="$undef"
13187         fi
13188         ;;
13189 *) val="$undef";
13190         echo "Nope, since you don't even have fcntl()."
13191         ;;
13192 esac
13193 set d_fcntl_can_lock
13194 eval $setvar
13195 $rm_try
13196
13197 : check for fd_set items
13198 $cat <<EOM
13199
13200 Checking to see how well your C compiler handles fd_set and friends ...
13201 EOM
13202 $cat >try.c <<EOCP
13203 #$i_stdlib I_STDLIB
13204 #ifdef I_STDLIB
13205 #include <stdlib.h>
13206 #endif
13207 #$i_systime I_SYS_TIME
13208 #$i_sysselct I_SYS_SELECT
13209 #$d_socket HAS_SOCKET
13210 #include <sys/types.h>
13211 #ifdef HAS_SOCKET
13212 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13213 #endif
13214 #ifdef I_SYS_TIME
13215 #include <sys/time.h>
13216 #endif
13217 #ifdef I_SYS_SELECT
13218 #include <sys/select.h>
13219 #endif
13220 int main() {
13221         fd_set fds;
13222
13223 #ifdef TRYBITS
13224         if(fds.fds_bits);
13225 #endif
13226
13227 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13228         exit(0);
13229 #else
13230         exit(1);
13231 #endif
13232 }
13233 EOCP
13234 set try -DTRYBITS
13235 if eval $compile; then
13236         d_fds_bits="$define"
13237         d_fd_set="$define"
13238         echo "Well, your system knows about the normal fd_set typedef..." >&4
13239         if $run ./try; then
13240                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13241                 d_fd_macros="$define"
13242         else
13243                 $cat >&4 <<'EOM'
13244 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13245 EOM
13246                 d_fd_macros="$undef"
13247         fi
13248 else
13249         $cat <<'EOM'
13250 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13251 EOM
13252         set try
13253         if eval $compile; then
13254                 d_fds_bits="$undef"
13255                 d_fd_set="$define"
13256                 echo "Well, your system has some sort of fd_set available..." >&4
13257                 if $run ./try; then
13258                         echo "and you have the normal fd_set macros." >&4
13259                         d_fd_macros="$define"
13260                 else
13261                         $cat <<'EOM'
13262 but not the normal fd_set macros!  Gross!  More work for me...
13263 EOM
13264                         d_fd_macros="$undef"
13265                 fi
13266         else
13267         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13268                 d_fd_set="$undef"
13269                 d_fds_bits="$undef"
13270                 d_fd_macros="$undef"
13271         fi
13272 fi
13273 $rm_try
13274
13275 : see if fgetpos exists
13276 set fgetpos d_fgetpos
13277 eval $inlibc
13278
13279 : see if finite exists
13280 set finite d_finite
13281 eval $inlibc
13282
13283 : see if finitel exists
13284 set finitel d_finitel
13285 eval $inlibc
13286
13287 : see if flock exists
13288 set flock d_flock
13289 eval $inlibc
13290
13291 : see if prototype for flock is available
13292 echo " "
13293 set d_flockproto flock $i_sysfile sys/file.h
13294 eval $hasproto
13295
13296 : see if fp_class exists
13297 set fp_class d_fp_class
13298 eval $inlibc
13299
13300 : see if pathconf exists
13301 set pathconf d_pathconf
13302 eval $inlibc
13303
13304 : see if fpathconf exists
13305 set fpathconf d_fpathconf
13306 eval $inlibc
13307
13308 : see if fpclass exists
13309 set fpclass d_fpclass
13310 eval $inlibc
13311
13312 : see if fpclassify exists
13313 set fpclassify d_fpclassify
13314 eval $inlibc
13315
13316 : see if fpclassl exists
13317 set fpclassl d_fpclassl
13318 eval $inlibc
13319
13320 : check for fpos64_t
13321 echo " "
13322 echo "Checking to see if you have fpos64_t..." >&4
13323 $cat >try.c <<EOCP
13324 #include <stdio.h>
13325 int main() { fpos64_t x = 7; }
13326 EOCP
13327 set try
13328 if eval $compile; then
13329         val="$define"
13330         echo "You have fpos64_t."
13331 else
13332         val="$undef"
13333         echo "You do not have fpos64_t."
13334         case "$fpossize" in
13335         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13336         esac
13337 fi
13338 $rm_try
13339 set d_fpos64_t
13340 eval $setvar
13341
13342 : see if frexpl exists
13343 set frexpl d_frexpl
13344 eval $inlibc
13345
13346 : see if this is a sys/param system
13347 set sys/param.h i_sysparam
13348 eval $inhdr
13349
13350 : see if this is a sys/mount.h system
13351 set sys/mount.h i_sysmount
13352 eval $inhdr
13353
13354 : Check for fs_data_s
13355 echo " "
13356 echo "Checking to see if your system supports struct fs_data..." >&4
13357 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13358 eval $hasstruct
13359 case "$d_fs_data_s" in
13360 "$define")      echo "Yes, it does."   ;;
13361 *)              echo "No, it doesn't." ;;
13362 esac
13363
13364 : see if fseeko exists
13365 set fseeko d_fseeko
13366 eval $inlibc
13367 case "$longsize" in
13368 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13369 esac
13370
13371 : see if fsetpos exists
13372 set fsetpos d_fsetpos
13373 eval $inlibc
13374
13375 : see if fstatfs exists
13376 set fstatfs d_fstatfs
13377 eval $inlibc
13378
13379 : see if statvfs exists
13380 set statvfs d_statvfs
13381 eval $inlibc
13382
13383 : see if fstatvfs exists
13384 set fstatvfs d_fstatvfs
13385 eval $inlibc
13386
13387
13388 : see if fsync exists
13389 set fsync d_fsync
13390 eval $inlibc
13391
13392 : see if ftello exists
13393 set ftello d_ftello
13394 eval $inlibc
13395 case "$longsize" in
13396 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13397 esac
13398
13399 : check for a working futimes
13400 d_futimes="$undef"
13401 echo " "
13402 echo "Checking if you have a working futimes()" >&4
13403 $cat >try.c <<EOCP
13404 #include <stdio.h>
13405 #include <sys/time.h>
13406 #include <errno.h>
13407 #include <fcntl.h>
13408
13409 int main ()
13410 {
13411     int fd, rv;
13412     fd = open ("try.c", O_RDWR);
13413     if (-1 == fd) exit (1);
13414     rv = futimes (fd, NULL);
13415     exit (rv == -1 ? errno : 0);
13416 }
13417 EOCP
13418 set try
13419 if eval $compile; then
13420     `$run ./try`
13421     rc=$?
13422     case "$rc" in
13423         0)  echo "Yes, you have" >&4
13424             d_futimes="$define"
13425             ;;
13426         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13427             ;;
13428     esac
13429 else
13430     echo "No, it does not (probably harmless)" >&4
13431 fi
13432 $rm_try
13433
13434 : see if ndbm.h is available
13435 set ndbm.h i_ndbm
13436 eval $inhdr
13437 : Compatibility location for RedHat 7.1
13438 set gdbm/ndbm.h i_gdbmndbm
13439 eval $inhdr
13440 : Compatibility location for Debian 4.0
13441 set gdbm-ndbm.h i_gdbm_ndbm
13442 eval $inhdr
13443
13444 val="$undef"
13445 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13446         : see if dbm_open exists
13447         set dbm_open d_dbm_open
13448         eval $inlibc
13449         case "$d_dbm_open" in
13450         $undef)
13451                 i_ndbm="$undef"
13452                 i_gdbmndbm="$undef"
13453                 i_gdbm_ndbm="$undef"
13454                 echo "We won't be including <ndbm.h>"
13455                 val="$undef"
13456                 ;;
13457         *) val="$define"
13458            ;;
13459         esac
13460 fi
13461 set d_ndbm
13462 eval $setvar
13463
13464 ndbm_hdr_protochk='name=$1; hdr=$2;
13465 eval "ihdr=\$""i_$name";
13466 val="$undef";
13467 if $test "$ihdr" = "$define"; then
13468         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13469         case "$d_cplusplus" in
13470         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13471         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13472         esac;
13473         case "$val" in
13474         $define) $echo "Your <$hdr> seems to have prototypes";;
13475         *) $echo "Your <$hdr> does not seem to have prototypes";;
13476         esac;
13477 fi;
13478 set "d_${name}_h_uses_prototypes";
13479 eval $setvar'
13480
13481 set ndbm ndbm.h
13482 eval $ndbm_hdr_protochk
13483 set gdbmndbm gdbm/ndbm.h
13484 eval $ndbm_hdr_protochk
13485 set gdbm_ndbm gdbm-ndbm.h
13486 eval $ndbm_hdr_protochk
13487
13488 : see if getaddrinfo exists
13489 set getaddrinfo d_getaddrinfo
13490 eval $inlibc
13491
13492 : see if getcwd exists
13493 set getcwd d_getcwd
13494 eval $inlibc
13495
13496 : see if getespwnam exists
13497 set getespwnam d_getespwnam
13498 eval $inlibc
13499
13500 : see if getfsstat exists
13501 set getfsstat d_getfsstat
13502 eval $inlibc
13503
13504 : see if getgrent exists
13505 set getgrent d_getgrent
13506 eval $inlibc
13507
13508 : see if getgrent_r exists
13509 set getgrent_r d_getgrent_r
13510 eval $inlibc
13511 case "$d_getgrent_r" in
13512 "$define")
13513         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13514         case "$d_getgrent_r_proto:$usethreads" in
13515         ":define")      d_getgrent_r_proto=define
13516                 set d_getgrent_r_proto getgrent_r $hdrs
13517                 eval $hasproto ;;
13518         *)      ;;
13519         esac
13520         case "$d_getgrent_r_proto" in
13521         define)
13522         case "$getgrent_r_proto" in
13523         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13524         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13525         esac
13526         case "$getgrent_r_proto" in
13527         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13528         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13529         esac
13530         case "$getgrent_r_proto" in
13531         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13532         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13533         esac
13534         case "$getgrent_r_proto" in
13535         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13536         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13537         esac
13538         case "$getgrent_r_proto" in
13539         ''|0) try='int getgrent_r(struct group*, char*, int);'
13540         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13541         esac
13542         case "$getgrent_r_proto" in
13543         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13544         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13545         esac
13546         case "$getgrent_r_proto" in
13547         ''|0)   d_getgrent_r=undef
13548                 getgrent_r_proto=0
13549                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13550         * )     case "$getgrent_r_proto" in
13551                 REENTRANT_PROTO*) ;;
13552                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13553                 esac
13554                 echo "Prototype: $try" ;;
13555         esac
13556         ;;
13557         *)      case "$usethreads" in
13558                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13559                 esac
13560                 d_getgrent_r=undef
13561                 getgrent_r_proto=0
13562                 ;;
13563         esac
13564         ;;
13565 *)      getgrent_r_proto=0
13566         ;;
13567 esac
13568
13569 : see if getgrgid_r exists
13570 set getgrgid_r d_getgrgid_r
13571 eval $inlibc
13572 case "$d_getgrgid_r" in
13573 "$define")
13574         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13575         case "$d_getgrgid_r_proto:$usethreads" in
13576         ":define")      d_getgrgid_r_proto=define
13577                 set d_getgrgid_r_proto getgrgid_r $hdrs
13578                 eval $hasproto ;;
13579         *)      ;;
13580         esac
13581         case "$d_getgrgid_r_proto" in
13582         define)
13583         case "$getgrgid_r_proto" in
13584         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13585         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13586         esac
13587         case "$getgrgid_r_proto" in
13588         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13589         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13590         esac
13591         case "$getgrgid_r_proto" in
13592         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13593         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13594         esac
13595         case "$getgrgid_r_proto" in
13596         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13597         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13598         esac
13599         case "$getgrgid_r_proto" in
13600         ''|0)   d_getgrgid_r=undef
13601                 getgrgid_r_proto=0
13602                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13603         * )     case "$getgrgid_r_proto" in
13604                 REENTRANT_PROTO*) ;;
13605                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13606                 esac
13607                 echo "Prototype: $try" ;;
13608         esac
13609         ;;
13610         *)      case "$usethreads" in
13611                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13612                 esac
13613                 d_getgrgid_r=undef
13614                 getgrgid_r_proto=0
13615                 ;;
13616         esac
13617         ;;
13618 *)      getgrgid_r_proto=0
13619         ;;
13620 esac
13621
13622 : see if getgrnam_r exists
13623 set getgrnam_r d_getgrnam_r
13624 eval $inlibc
13625 case "$d_getgrnam_r" in
13626 "$define")
13627         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13628         case "$d_getgrnam_r_proto:$usethreads" in
13629         ":define")      d_getgrnam_r_proto=define
13630                 set d_getgrnam_r_proto getgrnam_r $hdrs
13631                 eval $hasproto ;;
13632         *)      ;;
13633         esac
13634         case "$d_getgrnam_r_proto" in
13635         define)
13636         case "$getgrnam_r_proto" in
13637         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13638         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13639         esac
13640         case "$getgrnam_r_proto" in
13641         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13642         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13643         esac
13644         case "$getgrnam_r_proto" in
13645         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13646         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13647         esac
13648         case "$getgrnam_r_proto" in
13649         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13650         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13651         esac
13652         case "$getgrnam_r_proto" in
13653         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13654         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13655         esac
13656         case "$getgrnam_r_proto" in
13657         ''|0)   d_getgrnam_r=undef
13658                 getgrnam_r_proto=0
13659                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13660         * )     case "$getgrnam_r_proto" in
13661                 REENTRANT_PROTO*) ;;
13662                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13663                 esac
13664                 echo "Prototype: $try" ;;
13665         esac
13666         ;;
13667         *)      case "$usethreads" in
13668                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13669                 esac
13670                 d_getgrnam_r=undef
13671                 getgrnam_r_proto=0
13672                 ;;
13673         esac
13674         ;;
13675 *)      getgrnam_r_proto=0
13676         ;;
13677 esac
13678
13679 : see if gethostbyaddr exists
13680 set gethostbyaddr d_gethbyaddr
13681 eval $inlibc
13682
13683 : see if gethostbyname exists
13684 set gethostbyname d_gethbyname
13685 eval $inlibc
13686
13687 : see if gethostent exists
13688 set gethostent d_gethent
13689 eval $inlibc
13690
13691 : see how we will look up host name
13692 echo " "
13693 call=''
13694 if set gethostname val -f d_gethname; eval $csym; $val; then
13695         echo 'gethostname() found.' >&4
13696         d_gethname="$define"
13697         call=gethostname
13698 fi
13699 if set uname val -f d_uname; eval $csym; $val; then
13700         if ./xenix; then
13701                 $cat <<'EOM'
13702 uname() was found, but you're running xenix, and older versions of xenix
13703 have a broken uname(). If you don't really know whether your xenix is old
13704 enough to have a broken system call, use the default answer.
13705
13706 EOM
13707                 dflt=y
13708                 case "$d_uname" in
13709                 "$define") dflt=n;;
13710                 esac
13711                 rp='Is your uname() broken?'
13712                 . ./myread
13713                 case "$ans" in
13714                 n*) d_uname="$define"; call=uname;;
13715                 esac
13716         else
13717                 echo 'uname() found.' >&4
13718                 d_uname="$define"
13719                 case "$call" in
13720                 '') call=uname ;;
13721                 esac
13722         fi
13723 fi
13724 case "$d_gethname" in
13725 '') d_gethname="$undef";;
13726 esac
13727 case "$d_uname" in
13728 '') d_uname="$undef";;
13729 esac
13730 case "$d_uname$d_gethname" in
13731 *define*)
13732         dflt=n
13733         cat <<EOM
13734
13735 Every now and then someone has a $call() that lies about the hostname
13736 but can't be fixed for political or economic reasons.  If you wish, I can
13737 pretend $call() isn't there and maybe compute hostname at run-time
13738 thanks to the '$phostname' command.
13739
13740 EOM
13741         rp="Shall I ignore $call() from now on?"
13742         . ./myread
13743         case "$ans" in
13744         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13745         esac;;
13746 esac
13747 case "$phostname" in
13748 '') aphostname='';;
13749 *) case "$aphostname" in
13750         /*) ;;
13751         *) set X $phostname
13752                 shift
13753                 file=$1
13754                 shift
13755                 file=`./loc $file $file $pth`
13756                 aphostname=`echo $file $*`
13757                 ;;
13758         esac
13759         ;;
13760 esac
13761 case "$d_uname$d_gethname" in
13762 *define*) ;;
13763 *)
13764         case "$phostname" in
13765         '')
13766                 echo "There will be no way for $package to get your hostname." >&4;;
13767         *)
13768         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13769                 ;;
13770         esac;;
13771 esac
13772 case "$d_phostname" in
13773 '') d_phostname="$undef";;
13774 esac
13775
13776 : see if gethostbyaddr_r exists
13777 set gethostbyaddr_r d_gethostbyaddr_r
13778 eval $inlibc
13779 case "$d_gethostbyaddr_r" in
13780 "$define")
13781         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13782         case "$d_gethostbyaddr_r_proto:$usethreads" in
13783         ":define")      d_gethostbyaddr_r_proto=define
13784                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13785                 eval $hasproto ;;
13786         *)      ;;
13787         esac
13788         case "$d_gethostbyaddr_r_proto" in
13789         define)
13790         case "$gethostbyaddr_r_proto" in
13791         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13792         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13793         esac
13794         case "$gethostbyaddr_r_proto" in
13795         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13796         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13797         esac
13798         case "$gethostbyaddr_r_proto" in
13799         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13800         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13801         esac
13802         case "$gethostbyaddr_r_proto" in
13803         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13804         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13805         esac
13806         case "$gethostbyaddr_r_proto" in
13807         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13808         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13809         esac
13810         case "$gethostbyaddr_r_proto" in
13811         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13812         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13813         esac
13814         case "$gethostbyaddr_r_proto" in
13815         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13816         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13817         esac
13818         case "$gethostbyaddr_r_proto" in
13819         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13820         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13821         esac
13822         case "$gethostbyaddr_r_proto" in
13823         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13824         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13825         esac
13826         case "$gethostbyaddr_r_proto" in
13827         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13828         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13829         esac
13830         case "$gethostbyaddr_r_proto" in
13831         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13832         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13833         esac
13834         case "$gethostbyaddr_r_proto" in
13835         ''|0)   d_gethostbyaddr_r=undef
13836                 gethostbyaddr_r_proto=0
13837                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13838         * )     case "$gethostbyaddr_r_proto" in
13839                 REENTRANT_PROTO*) ;;
13840                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13841                 esac
13842                 echo "Prototype: $try" ;;
13843         esac
13844         ;;
13845         *)      case "$usethreads" in
13846                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13847                 esac
13848                 d_gethostbyaddr_r=undef
13849                 gethostbyaddr_r_proto=0
13850                 ;;
13851         esac
13852         ;;
13853 *)      gethostbyaddr_r_proto=0
13854         ;;
13855 esac
13856
13857 : see if gethostbyname_r exists
13858 set gethostbyname_r d_gethostbyname_r
13859 eval $inlibc
13860 case "$d_gethostbyname_r" in
13861 "$define")
13862         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13863         case "$d_gethostbyname_r_proto:$usethreads" in
13864         ":define")      d_gethostbyname_r_proto=define
13865                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13866                 eval $hasproto ;;
13867         *)      ;;
13868         esac
13869         case "$d_gethostbyname_r_proto" in
13870         define)
13871         case "$gethostbyname_r_proto" in
13872         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13873         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13874         esac
13875         case "$gethostbyname_r_proto" in
13876         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13877         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13878         esac
13879         case "$gethostbyname_r_proto" in
13880         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13881         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13882         esac
13883         case "$gethostbyname_r_proto" in
13884         ''|0)   d_gethostbyname_r=undef
13885                 gethostbyname_r_proto=0
13886                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13887         * )     case "$gethostbyname_r_proto" in
13888                 REENTRANT_PROTO*) ;;
13889                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13890                 esac
13891                 echo "Prototype: $try" ;;
13892         esac
13893         ;;
13894         *)      case "$usethreads" in
13895                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13896                 esac
13897                 d_gethostbyname_r=undef
13898                 gethostbyname_r_proto=0
13899                 ;;
13900         esac
13901         ;;
13902 *)      gethostbyname_r_proto=0
13903         ;;
13904 esac
13905
13906 : see if gethostent_r exists
13907 set gethostent_r d_gethostent_r
13908 eval $inlibc
13909 case "$d_gethostent_r" in
13910 "$define")
13911         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13912         case "$d_gethostent_r_proto:$usethreads" in
13913         ":define")      d_gethostent_r_proto=define
13914                 set d_gethostent_r_proto gethostent_r $hdrs
13915                 eval $hasproto ;;
13916         *)      ;;
13917         esac
13918         case "$d_gethostent_r_proto" in
13919         define)
13920         case "$gethostent_r_proto" in
13921         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13922         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13923         esac
13924         case "$gethostent_r_proto" in
13925         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13926         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13927         esac
13928         case "$gethostent_r_proto" in
13929         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13930         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13931         esac
13932         case "$gethostent_r_proto" in
13933         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13934         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13935         esac
13936         case "$gethostent_r_proto" in
13937         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13938         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13939         esac
13940         case "$gethostent_r_proto" in
13941         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13942         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13943         esac
13944         case "$gethostent_r_proto" in
13945         ''|0)   d_gethostent_r=undef
13946                 gethostent_r_proto=0
13947                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13948         * )     case "$gethostent_r_proto" in
13949                 REENTRANT_PROTO*) ;;
13950                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13951                 esac
13952                 echo "Prototype: $try" ;;
13953         esac
13954         ;;
13955         *)      case "$usethreads" in
13956                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13957                 esac
13958                 d_gethostent_r=undef
13959                 gethostent_r_proto=0
13960                 ;;
13961         esac
13962         ;;
13963 *)      gethostent_r_proto=0
13964         ;;
13965 esac
13966
13967 : see if prototypes for various gethostxxx netdb.h functions are available
13968 echo " "
13969 set d_gethostprotos gethostent $i_netdb netdb.h
13970 eval $hasproto
13971
13972 : see if getitimer exists
13973 set getitimer d_getitimer
13974 eval $inlibc
13975
13976 : see if getlogin exists
13977 set getlogin d_getlogin
13978 eval $inlibc
13979
13980 : see if getlogin_r exists
13981 set getlogin_r d_getlogin_r
13982 eval $inlibc
13983 case "$d_getlogin_r" in
13984 "$define")
13985         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13986         case "$d_getlogin_r_proto:$usethreads" in
13987         ":define")      d_getlogin_r_proto=define
13988                 set d_getlogin_r_proto getlogin_r $hdrs
13989                 eval $hasproto ;;
13990         *)      ;;
13991         esac
13992         case "$d_getlogin_r_proto" in
13993         define)
13994         case "$getlogin_r_proto" in
13995         ''|0) try='int getlogin_r(char*, size_t);'
13996         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13997         esac
13998         case "$getlogin_r_proto" in
13999         ''|0) try='int getlogin_r(char*, int);'
14000         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14001         esac
14002         case "$getlogin_r_proto" in
14003         ''|0) try='char* getlogin_r(char*, size_t);'
14004         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14005         esac
14006         case "$getlogin_r_proto" in
14007         ''|0) try='char* getlogin_r(char*, int);'
14008         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14009         esac
14010         case "$getlogin_r_proto" in
14011         ''|0)   d_getlogin_r=undef
14012                 getlogin_r_proto=0
14013                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14014         * )     case "$getlogin_r_proto" in
14015                 REENTRANT_PROTO*) ;;
14016                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14017                 esac
14018                 echo "Prototype: $try" ;;
14019         esac
14020         ;;
14021         *)      case "$usethreads" in
14022                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14023                 esac
14024                 d_getlogin_r=undef
14025                 getlogin_r_proto=0
14026                 ;;
14027         esac
14028         ;;
14029 *)      getlogin_r_proto=0
14030         ;;
14031 esac
14032
14033 : see if getmnt exists
14034 set getmnt d_getmnt
14035 eval $inlibc
14036
14037 : see if getmntent exists
14038 set getmntent d_getmntent
14039 eval $inlibc
14040
14041 : see if getnameinfo exists
14042 set getnameinfo d_getnameinfo
14043 eval $inlibc
14044
14045 : see if getnetbyaddr exists
14046 set getnetbyaddr d_getnbyaddr
14047 eval $inlibc
14048
14049 : see if getnetbyname exists
14050 set getnetbyname d_getnbyname
14051 eval $inlibc
14052
14053 : see if getnetent exists
14054 set getnetent d_getnent
14055 eval $inlibc
14056
14057 : see if getnetbyaddr_r exists
14058 set getnetbyaddr_r d_getnetbyaddr_r
14059 eval $inlibc
14060 case "$d_getnetbyaddr_r" in
14061 "$define")
14062         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14063         case "$d_getnetbyaddr_r_proto:$usethreads" in
14064         ":define")      d_getnetbyaddr_r_proto=define
14065                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14066                 eval $hasproto ;;
14067         *)      ;;
14068         esac
14069         case "$d_getnetbyaddr_r_proto" in
14070         define)
14071         case "$getnetbyaddr_r_proto" in
14072         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14073         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14074         esac
14075         case "$getnetbyaddr_r_proto" in
14076         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14077         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14078         esac
14079         case "$getnetbyaddr_r_proto" in
14080         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14081         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14082         esac
14083         case "$getnetbyaddr_r_proto" in
14084         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14085         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14086         esac
14087         case "$getnetbyaddr_r_proto" in
14088         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14089         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14090         esac
14091         case "$getnetbyaddr_r_proto" in
14092         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14093         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14094         esac
14095         case "$getnetbyaddr_r_proto" in
14096         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14097         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14098         esac
14099         case "$getnetbyaddr_r_proto" in
14100         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14101         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14102         esac
14103         case "$getnetbyaddr_r_proto" in
14104         ''|0)   d_getnetbyaddr_r=undef
14105                 getnetbyaddr_r_proto=0
14106                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14107         * )     case "$getnetbyaddr_r_proto" in
14108                 REENTRANT_PROTO*) ;;
14109                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14110                 esac
14111                 echo "Prototype: $try" ;;
14112         esac
14113         ;;
14114         *)      case "$usethreads" in
14115                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14116                 esac
14117                 d_getnetbyaddr_r=undef
14118                 getnetbyaddr_r_proto=0
14119                 ;;
14120         esac
14121         ;;
14122 *)      getnetbyaddr_r_proto=0
14123         ;;
14124 esac
14125
14126 : see if getnetbyname_r exists
14127 set getnetbyname_r d_getnetbyname_r
14128 eval $inlibc
14129 case "$d_getnetbyname_r" in
14130 "$define")
14131         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14132         case "$d_getnetbyname_r_proto:$usethreads" in
14133         ":define")      d_getnetbyname_r_proto=define
14134                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14135                 eval $hasproto ;;
14136         *)      ;;
14137         esac
14138         case "$d_getnetbyname_r_proto" in
14139         define)
14140         case "$getnetbyname_r_proto" in
14141         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14142         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14143         esac
14144         case "$getnetbyname_r_proto" in
14145         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14146         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14147         esac
14148         case "$getnetbyname_r_proto" in
14149         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14150         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14151         esac
14152         case "$getnetbyname_r_proto" in
14153         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14154         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14155         esac
14156         case "$getnetbyname_r_proto" in
14157         ''|0)   d_getnetbyname_r=undef
14158                 getnetbyname_r_proto=0
14159                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14160         * )     case "$getnetbyname_r_proto" in
14161                 REENTRANT_PROTO*) ;;
14162                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14163                 esac
14164                 echo "Prototype: $try" ;;
14165         esac
14166         ;;
14167         *)      case "$usethreads" in
14168                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14169                 esac
14170                 d_getnetbyname_r=undef
14171                 getnetbyname_r_proto=0
14172                 ;;
14173         esac
14174         ;;
14175 *)      getnetbyname_r_proto=0
14176         ;;
14177 esac
14178
14179 : see if getnetent_r exists
14180 set getnetent_r d_getnetent_r
14181 eval $inlibc
14182 case "$d_getnetent_r" in
14183 "$define")
14184         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14185         case "$d_getnetent_r_proto:$usethreads" in
14186         ":define")      d_getnetent_r_proto=define
14187                 set d_getnetent_r_proto getnetent_r $hdrs
14188                 eval $hasproto ;;
14189         *)      ;;
14190         esac
14191         case "$d_getnetent_r_proto" in
14192         define)
14193         case "$getnetent_r_proto" in
14194         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14195         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14196         esac
14197         case "$getnetent_r_proto" in
14198         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14199         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14200         esac
14201         case "$getnetent_r_proto" in
14202         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14203         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14204         esac
14205         case "$getnetent_r_proto" in
14206         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14207         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14208         esac
14209         case "$getnetent_r_proto" in
14210         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14211         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14212         esac
14213         case "$getnetent_r_proto" in
14214         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14215         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14216         esac
14217         case "$getnetent_r_proto" in
14218         ''|0)   d_getnetent_r=undef
14219                 getnetent_r_proto=0
14220                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14221         * )     case "$getnetent_r_proto" in
14222                 REENTRANT_PROTO*) ;;
14223                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14224                 esac
14225                 echo "Prototype: $try" ;;
14226         esac
14227         ;;
14228         *)      case "$usethreads" in
14229                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14230                 esac
14231                 d_getnetent_r=undef
14232                 getnetent_r_proto=0
14233                 ;;
14234         esac
14235         ;;
14236 *)      getnetent_r_proto=0
14237         ;;
14238 esac
14239
14240 : see if prototypes for various getnetxxx netdb.h functions are available
14241 echo " "
14242 set d_getnetprotos getnetent $i_netdb netdb.h
14243 eval $hasproto
14244
14245 : see if getpagesize exists
14246 set getpagesize d_getpagsz
14247 eval $inlibc
14248
14249 : Optional checks for getprotobyname and getprotobynumber
14250
14251 : see if getprotobyname exists
14252 set getprotobyname d_getpbyname
14253 eval $inlibc
14254
14255 : see if getprotobynumber exists
14256 set getprotobynumber d_getpbynumber
14257 eval $inlibc
14258
14259 : see if getprotoent exists
14260 set getprotoent d_getpent
14261 eval $inlibc
14262
14263 : see if getpgid exists
14264 set getpgid d_getpgid
14265 eval $inlibc
14266
14267 : see if getpgrp2 exists
14268 set getpgrp2 d_getpgrp2
14269 eval $inlibc
14270
14271 : see if getppid exists
14272 set getppid d_getppid
14273 eval $inlibc
14274
14275 : see if getpriority exists
14276 set getpriority d_getprior
14277 eval $inlibc
14278
14279 : see if getprotobyname_r exists
14280 set getprotobyname_r d_getprotobyname_r
14281 eval $inlibc
14282 case "$d_getprotobyname_r" in
14283 "$define")
14284         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14285         case "$d_getprotobyname_r_proto:$usethreads" in
14286         ":define")      d_getprotobyname_r_proto=define
14287                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14288                 eval $hasproto ;;
14289         *)      ;;
14290         esac
14291         case "$d_getprotobyname_r_proto" in
14292         define)
14293         case "$getprotobyname_r_proto" in
14294         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14295         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14296         esac
14297         case "$getprotobyname_r_proto" in
14298         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14299         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14300         esac
14301         case "$getprotobyname_r_proto" in
14302         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14303         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14304         esac
14305         case "$getprotobyname_r_proto" in
14306         ''|0)   d_getprotobyname_r=undef
14307                 getprotobyname_r_proto=0
14308                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14309         * )     case "$getprotobyname_r_proto" in
14310                 REENTRANT_PROTO*) ;;
14311                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14312                 esac
14313                 echo "Prototype: $try" ;;
14314         esac
14315         ;;
14316         *)      case "$usethreads" in
14317                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14318                 esac
14319                 d_getprotobyname_r=undef
14320                 getprotobyname_r_proto=0
14321                 ;;
14322         esac
14323         ;;
14324 *)      getprotobyname_r_proto=0
14325         ;;
14326 esac
14327
14328 : see if getprotobynumber_r exists
14329 set getprotobynumber_r d_getprotobynumber_r
14330 eval $inlibc
14331 case "$d_getprotobynumber_r" in
14332 "$define")
14333         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14334         case "$d_getprotobynumber_r_proto:$usethreads" in
14335         ":define")      d_getprotobynumber_r_proto=define
14336                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14337                 eval $hasproto ;;
14338         *)      ;;
14339         esac
14340         case "$d_getprotobynumber_r_proto" in
14341         define)
14342         case "$getprotobynumber_r_proto" in
14343         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14344         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14345         esac
14346         case "$getprotobynumber_r_proto" in
14347         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14348         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14349         esac
14350         case "$getprotobynumber_r_proto" in
14351         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14352         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14353         esac
14354         case "$getprotobynumber_r_proto" in
14355         ''|0)   d_getprotobynumber_r=undef
14356                 getprotobynumber_r_proto=0
14357                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14358         * )     case "$getprotobynumber_r_proto" in
14359                 REENTRANT_PROTO*) ;;
14360                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14361                 esac
14362                 echo "Prototype: $try" ;;
14363         esac
14364         ;;
14365         *)      case "$usethreads" in
14366                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14367                 esac
14368                 d_getprotobynumber_r=undef
14369                 getprotobynumber_r_proto=0
14370                 ;;
14371         esac
14372         ;;
14373 *)      getprotobynumber_r_proto=0
14374         ;;
14375 esac
14376
14377 : see if getprotoent_r exists
14378 set getprotoent_r d_getprotoent_r
14379 eval $inlibc
14380 case "$d_getprotoent_r" in
14381 "$define")
14382         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14383         case "$d_getprotoent_r_proto:$usethreads" in
14384         ":define")      d_getprotoent_r_proto=define
14385                 set d_getprotoent_r_proto getprotoent_r $hdrs
14386                 eval $hasproto ;;
14387         *)      ;;
14388         esac
14389         case "$d_getprotoent_r_proto" in
14390         define)
14391         case "$getprotoent_r_proto" in
14392         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14393         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14394         esac
14395         case "$getprotoent_r_proto" in
14396         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14397         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14398         esac
14399         case "$getprotoent_r_proto" in
14400         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14401         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14402         esac
14403         case "$getprotoent_r_proto" in
14404         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14405         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14406         esac
14407         case "$getprotoent_r_proto" in
14408         ''|0)   d_getprotoent_r=undef
14409                 getprotoent_r_proto=0
14410                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14411         * )     case "$getprotoent_r_proto" in
14412                 REENTRANT_PROTO*) ;;
14413                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14414                 esac
14415                 echo "Prototype: $try" ;;
14416         esac
14417         ;;
14418         *)      case "$usethreads" in
14419                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14420                 esac
14421                 d_getprotoent_r=undef
14422                 getprotoent_r_proto=0
14423                 ;;
14424         esac
14425         ;;
14426 *)      getprotoent_r_proto=0
14427         ;;
14428 esac
14429
14430 : see if prototypes for various getprotoxxx netdb.h functions are available
14431 echo " "
14432 set d_getprotoprotos getprotoent $i_netdb netdb.h
14433 eval $hasproto
14434
14435 : see if getprpwnam exists
14436 set getprpwnam d_getprpwnam
14437 eval $inlibc
14438
14439 : see if getpwent exists
14440 set getpwent d_getpwent
14441 eval $inlibc
14442
14443 : see if getpwent_r exists
14444 set getpwent_r d_getpwent_r
14445 eval $inlibc
14446 case "$d_getpwent_r" in
14447 "$define")
14448         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14449         case "$d_getpwent_r_proto:$usethreads" in
14450         ":define")      d_getpwent_r_proto=define
14451                 set d_getpwent_r_proto getpwent_r $hdrs
14452                 eval $hasproto ;;
14453         *)      ;;
14454         esac
14455         case "$d_getpwent_r_proto" in
14456         define)
14457         case "$getpwent_r_proto" in
14458         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14459         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14460         esac
14461         case "$getpwent_r_proto" in
14462         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14463         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14464         esac
14465         case "$getpwent_r_proto" in
14466         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14467         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14468         esac
14469         case "$getpwent_r_proto" in
14470         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14471         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14472         esac
14473         case "$getpwent_r_proto" in
14474         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14475         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14476         esac
14477         case "$getpwent_r_proto" in
14478         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14479         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14480         esac
14481         case "$getpwent_r_proto" in
14482         ''|0)   d_getpwent_r=undef
14483                 getpwent_r_proto=0
14484                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14485         * )     case "$getpwent_r_proto" in
14486                 REENTRANT_PROTO*) ;;
14487                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14488                 esac
14489                 echo "Prototype: $try" ;;
14490         esac
14491         ;;
14492         *)      case "$usethreads" in
14493                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14494                 esac
14495                 d_getpwent_r=undef
14496                 getpwent_r_proto=0
14497                 ;;
14498         esac
14499         ;;
14500 *)      getpwent_r_proto=0
14501         ;;
14502 esac
14503
14504 : see if getpwnam_r exists
14505 set getpwnam_r d_getpwnam_r
14506 eval $inlibc
14507 case "$d_getpwnam_r" in
14508 "$define")
14509         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14510         case "$d_getpwnam_r_proto:$usethreads" in
14511         ":define")      d_getpwnam_r_proto=define
14512                 set d_getpwnam_r_proto getpwnam_r $hdrs
14513                 eval $hasproto ;;
14514         *)      ;;
14515         esac
14516         case "$d_getpwnam_r_proto" in
14517         define)
14518         case "$getpwnam_r_proto" in
14519         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14520         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14521         esac
14522         case "$getpwnam_r_proto" in
14523         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14524         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14525         esac
14526         case "$getpwnam_r_proto" in
14527         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14528         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14529         esac
14530         case "$getpwnam_r_proto" in
14531         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14532         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14533         esac
14534         case "$getpwnam_r_proto" in
14535         ''|0)   d_getpwnam_r=undef
14536                 getpwnam_r_proto=0
14537                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14538         * )     case "$getpwnam_r_proto" in
14539                 REENTRANT_PROTO*) ;;
14540                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14541                 esac
14542                 echo "Prototype: $try" ;;
14543         esac
14544         ;;
14545         *)      case "$usethreads" in
14546                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14547                 esac
14548                 d_getpwnam_r=undef
14549                 getpwnam_r_proto=0
14550                 ;;
14551         esac
14552         ;;
14553 *)      getpwnam_r_proto=0
14554         ;;
14555 esac
14556
14557 : see if getpwuid_r exists
14558 set getpwuid_r d_getpwuid_r
14559 eval $inlibc
14560 case "$d_getpwuid_r" in
14561 "$define")
14562         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14563         case "$d_getpwuid_r_proto:$usethreads" in
14564         ":define")      d_getpwuid_r_proto=define
14565                 set d_getpwuid_r_proto getpwuid_r $hdrs
14566                 eval $hasproto ;;
14567         *)      ;;
14568         esac
14569         case "$d_getpwuid_r_proto" in
14570         define)
14571         case "$getpwuid_r_proto" in
14572         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14573         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14574         esac
14575         case "$getpwuid_r_proto" in
14576         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14577         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14578         esac
14579         case "$getpwuid_r_proto" in
14580         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14581         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14582         esac
14583         case "$getpwuid_r_proto" in
14584         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14585         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14586         esac
14587         case "$getpwuid_r_proto" in
14588         ''|0)   d_getpwuid_r=undef
14589                 getpwuid_r_proto=0
14590                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14591         * )     case "$getpwuid_r_proto" in
14592                 REENTRANT_PROTO*) ;;
14593                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14594                 esac
14595                 echo "Prototype: $try" ;;
14596         esac
14597         ;;
14598         *)      case "$usethreads" in
14599                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14600                 esac
14601                 d_getpwuid_r=undef
14602                 getpwuid_r_proto=0
14603                 ;;
14604         esac
14605         ;;
14606 *)      getpwuid_r_proto=0
14607         ;;
14608 esac
14609
14610 : Optional checks for getsbyname and getsbyport
14611
14612 : see if getservbyname exists
14613 set getservbyname d_getsbyname
14614 eval $inlibc
14615
14616 : see if getservbyport exists
14617 set getservbyport d_getsbyport
14618 eval $inlibc
14619
14620 : see if getservent exists
14621 set getservent d_getsent
14622 eval $inlibc
14623
14624 : see if getservbyname_r exists
14625 set getservbyname_r d_getservbyname_r
14626 eval $inlibc
14627 case "$d_getservbyname_r" in
14628 "$define")
14629         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14630         case "$d_getservbyname_r_proto:$usethreads" in
14631         ":define")      d_getservbyname_r_proto=define
14632                 set d_getservbyname_r_proto getservbyname_r $hdrs
14633                 eval $hasproto ;;
14634         *)      ;;
14635         esac
14636         case "$d_getservbyname_r_proto" in
14637         define)
14638         case "$getservbyname_r_proto" in
14639         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14640         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14641         esac
14642         case "$getservbyname_r_proto" in
14643         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14644         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14645         esac
14646         case "$getservbyname_r_proto" in
14647         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14648         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14649         esac
14650         case "$getservbyname_r_proto" in
14651         ''|0)   d_getservbyname_r=undef
14652                 getservbyname_r_proto=0
14653                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14654         * )     case "$getservbyname_r_proto" in
14655                 REENTRANT_PROTO*) ;;
14656                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14657                 esac
14658                 echo "Prototype: $try" ;;
14659         esac
14660         ;;
14661         *)      case "$usethreads" in
14662                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14663                 esac
14664                 d_getservbyname_r=undef
14665                 getservbyname_r_proto=0
14666                 ;;
14667         esac
14668         ;;
14669 *)      getservbyname_r_proto=0
14670         ;;
14671 esac
14672
14673 : see if getservbyport_r exists
14674 set getservbyport_r d_getservbyport_r
14675 eval $inlibc
14676 case "$d_getservbyport_r" in
14677 "$define")
14678         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14679         case "$d_getservbyport_r_proto:$usethreads" in
14680         ":define")      d_getservbyport_r_proto=define
14681                 set d_getservbyport_r_proto getservbyport_r $hdrs
14682                 eval $hasproto ;;
14683         *)      ;;
14684         esac
14685         case "$d_getservbyport_r_proto" in
14686         define)
14687         case "$getservbyport_r_proto" in
14688         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14689         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14690         esac
14691         case "$getservbyport_r_proto" in
14692         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14693         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14694         esac
14695         case "$getservbyport_r_proto" in
14696         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14697         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14698         esac
14699         case "$getservbyport_r_proto" in
14700         ''|0)   d_getservbyport_r=undef
14701                 getservbyport_r_proto=0
14702                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14703         * )     case "$getservbyport_r_proto" in
14704                 REENTRANT_PROTO*) ;;
14705                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14706                 esac
14707                 echo "Prototype: $try" ;;
14708         esac
14709         ;;
14710         *)      case "$usethreads" in
14711                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14712                 esac
14713                 d_getservbyport_r=undef
14714                 getservbyport_r_proto=0
14715                 ;;
14716         esac
14717         ;;
14718 *)      getservbyport_r_proto=0
14719         ;;
14720 esac
14721
14722 : see if getservent_r exists
14723 set getservent_r d_getservent_r
14724 eval $inlibc
14725 case "$d_getservent_r" in
14726 "$define")
14727         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14728         case "$d_getservent_r_proto:$usethreads" in
14729         ":define")      d_getservent_r_proto=define
14730                 set d_getservent_r_proto getservent_r $hdrs
14731                 eval $hasproto ;;
14732         *)      ;;
14733         esac
14734         case "$d_getservent_r_proto" in
14735         define)
14736         case "$getservent_r_proto" in
14737         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14738         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14739         esac
14740         case "$getservent_r_proto" in
14741         ''|0) try='int getservent_r(struct servent*, char*, int);'
14742         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14743         esac
14744         case "$getservent_r_proto" in
14745         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14746         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14747         esac
14748         case "$getservent_r_proto" in
14749         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14750         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14751         esac
14752         case "$getservent_r_proto" in
14753         ''|0)   d_getservent_r=undef
14754                 getservent_r_proto=0
14755                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14756         * )     case "$getservent_r_proto" in
14757                 REENTRANT_PROTO*) ;;
14758                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14759                 esac
14760                 echo "Prototype: $try" ;;
14761         esac
14762         ;;
14763         *)      case "$usethreads" in
14764                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14765                 esac
14766                 d_getservent_r=undef
14767                 getservent_r_proto=0
14768                 ;;
14769         esac
14770         ;;
14771 *)      getservent_r_proto=0
14772         ;;
14773 esac
14774
14775 : see if prototypes for various getservxxx netdb.h functions are available
14776 echo " "
14777 set d_getservprotos getservent $i_netdb netdb.h
14778 eval $hasproto
14779
14780 : see if getspnam exists
14781 set getspnam d_getspnam
14782 eval $inlibc
14783
14784 : see if this is a shadow.h system
14785 set shadow.h i_shadow
14786 eval $inhdr
14787
14788 : see if getspnam_r exists
14789 set getspnam_r d_getspnam_r
14790 eval $inlibc
14791 case "$d_getspnam_r" in
14792 "$define")
14793         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14794         case "$d_getspnam_r_proto:$usethreads" in
14795         ":define")      d_getspnam_r_proto=define
14796                 set d_getspnam_r_proto getspnam_r $hdrs
14797                 eval $hasproto ;;
14798         *)      ;;
14799         esac
14800         case "$d_getspnam_r_proto" in
14801         define)
14802         case "$getspnam_r_proto" in
14803         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14804         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14805         esac
14806         case "$getspnam_r_proto" in
14807         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14808         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14809         esac
14810         case "$getspnam_r_proto" in
14811         ''|0)   d_getspnam_r=undef
14812                 getspnam_r_proto=0
14813                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14814         * )     case "$getspnam_r_proto" in
14815                 REENTRANT_PROTO*) ;;
14816                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14817                 esac
14818                 echo "Prototype: $try" ;;
14819         esac
14820         ;;
14821         *)      case "$usethreads" in
14822                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14823                 esac
14824                 d_getspnam_r=undef
14825                 getspnam_r_proto=0
14826                 ;;
14827         esac
14828         ;;
14829 *)      getspnam_r_proto=0
14830         ;;
14831 esac
14832
14833 : see if gettimeofday or ftime exists
14834 set gettimeofday d_gettimeod
14835 eval $inlibc
14836 case "$d_gettimeod" in
14837 "$undef")
14838         set ftime d_ftime 
14839         eval $inlibc
14840         ;;
14841 *)
14842         val="$undef"; set d_ftime; eval $setvar
14843         ;;
14844 esac
14845 case "$d_gettimeod$d_ftime" in
14846 "$undef$undef")
14847         echo " "
14848         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14849         ;;
14850 esac
14851
14852 : see if gmtime_r exists
14853 set gmtime_r d_gmtime_r
14854 eval $inlibc
14855 case "$d_gmtime_r" in
14856 "$define")
14857         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14858         case "$d_gmtime_r_proto:$usethreads" in
14859         ":define")      d_gmtime_r_proto=define
14860                 set d_gmtime_r_proto gmtime_r $hdrs
14861                 eval $hasproto ;;
14862         *)      ;;
14863         esac
14864         case "$d_gmtime_r_proto" in
14865         define)
14866         case "$gmtime_r_proto" in
14867         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14868         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14869         esac
14870         case "$gmtime_r_proto" in
14871         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14872         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14873         esac
14874         case "$gmtime_r_proto" in
14875         ''|0)   d_gmtime_r=undef
14876                 gmtime_r_proto=0
14877                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14878         * )     case "$gmtime_r_proto" in
14879                 REENTRANT_PROTO*) ;;
14880                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14881                 esac
14882                 echo "Prototype: $try" ;;
14883         esac
14884         ;;
14885         *)      case "$usethreads" in
14886                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14887                 esac
14888                 d_gmtime_r=undef
14889                 gmtime_r_proto=0
14890                 ;;
14891         esac
14892         ;;
14893 *)      gmtime_r_proto=0
14894         ;;
14895 esac
14896
14897 : see if hasmntopt exists
14898 set hasmntopt d_hasmntopt
14899 eval $inlibc
14900
14901 : see if this is a netinet/in.h or sys/in.h system
14902 set netinet/in.h i_niin sys/in.h i_sysin
14903 eval $inhdr
14904
14905 : see if arpa/inet.h has to be included
14906 set arpa/inet.h i_arpainet
14907 eval $inhdr
14908
14909 : see if htonl --and friends-- exists
14910 val=''
14911 set htonl val
14912 eval $inlibc
14913
14914 : Maybe they are macros.
14915 case "$val" in
14916 $undef)
14917         $cat >htonl.c <<EOM
14918 #include <stdio.h>
14919 #include <sys/types.h>
14920 #$i_niin I_NETINET_IN
14921 #$i_sysin I_SYS_IN
14922 #$i_arpainet I_ARPA_INET
14923 #ifdef I_NETINET_IN
14924 #include <netinet/in.h>
14925 #endif
14926 #ifdef I_SYS_IN
14927 #include <sys/in.h>
14928 #endif
14929 #ifdef I_ARPA_INET
14930 #include <arpa/inet.h>
14931 #endif
14932 #ifdef htonl
14933 printf("Defined as a macro.");
14934 #endif
14935 EOM
14936         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14937         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14938                 val="$define"
14939                 echo "But it seems to be defined as a macro." >&4
14940         fi
14941         $rm -f htonl.?
14942         ;;
14943 esac
14944 set d_htonl
14945 eval $setvar
14946
14947 : see if ilogbl exists
14948 set ilogbl d_ilogbl
14949 eval $inlibc
14950
14951 : index or strchr
14952 echo " "
14953 if set index val -f; eval $csym; $val; then
14954         if set strchr val -f d_strchr; eval $csym; $val; then
14955                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14956                         val="$define"
14957                         vali="$undef"
14958                         echo "strchr() found." >&4
14959                 else
14960                         val="$undef"
14961                         vali="$define"
14962                         echo "index() found." >&4
14963                 fi
14964         else
14965                 val="$undef"
14966                 vali="$define"
14967                 echo "index() found." >&4
14968         fi
14969 else
14970         if set strchr val -f d_strchr; eval $csym; $val; then
14971                 val="$define"
14972                 vali="$undef"
14973                 echo "strchr() found." >&4
14974         else
14975                 echo "No index() or strchr() found!" >&4
14976                 val="$undef"
14977                 vali="$undef"
14978         fi
14979 fi
14980 set d_strchr; eval $setvar
14981 val="$vali"
14982 set d_index; eval $setvar
14983
14984 : check whether inet_aton exists
14985 set inet_aton d_inetaton
14986 eval $inlibc
14987
14988 : see if inet_ntop exists
14989 set inet_ntop d_inetntop
14990 eval $inlibc
14991
14992 : see if inet_pton exists
14993 set inet_pton d_inetpton
14994 eval $inlibc
14995
14996 : Look for isascii
14997 echo " "
14998 $cat >isascii.c <<EOCP
14999 #include <stdio.h>
15000 #include <ctype.h>
15001 #$i_stdlib I_STDLIB
15002 #ifdef I_STDLIB
15003 #include <stdlib.h>
15004 #endif
15005 int main() {
15006         int c = 'A';
15007         if (isascii(c))
15008                 exit(0);
15009         else
15010                 exit(1);
15011 }
15012 EOCP
15013 set isascii
15014 if eval $compile; then
15015         echo "isascii() found." >&4
15016         val="$define"
15017 else
15018         echo "isascii() NOT found." >&4
15019         val="$undef"
15020 fi
15021 set d_isascii
15022 eval $setvar
15023 $rm -f isascii*
15024
15025 : Look for isblank
15026 echo " "
15027 $cat >isblank.c <<'EOCP'
15028 #include <stdio.h>
15029 #include <ctype.h>
15030 int main() {
15031         int c = ' ';
15032         if (isblank(c))
15033                 exit(0);
15034         else
15035                 exit(1);
15036 }
15037 EOCP
15038 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15039         echo "isblank() found." >&4
15040         val="$define"
15041 else
15042         echo "isblank() NOT found." >&4
15043         val="$undef"
15044 fi
15045 set d_isblank
15046 eval $setvar
15047 $rm -f isblank*
15048
15049 : see if isfinite exists
15050 set isfinite d_isfinite
15051 eval $inlibc
15052
15053 : see if isinf exists
15054 set isinf d_isinf
15055 eval $inlibc
15056
15057 : see if isnan exists
15058 set isnan d_isnan
15059 eval $inlibc
15060
15061 : see if isnanl exists
15062 set isnanl d_isnanl
15063 eval $inlibc
15064
15065 : see if killpg exists
15066 set killpg d_killpg
15067 eval $inlibc
15068
15069 : see if lchown exists
15070 echo " "
15071 $cat > try.c <<'EOCP'
15072 /* System header to define __stub macros and hopefully few prototypes,
15073     which can conflict with char lchown(); below.  */
15074 #include <assert.h>
15075 /* Override any gcc2 internal prototype to avoid an error.  */
15076 /* We use char because int might match the return type of a gcc2
15077    builtin and then its argument prototype would still apply.  */
15078 char lchown();
15079 int main() {
15080     /*  The GNU C library defines this for functions which it implements
15081         to always fail with ENOSYS.  Some functions are actually named
15082         something starting with __ and the normal name is an alias.  */
15083 #if defined (__stub_lchown) || defined (__stub___lchown)
15084 choke me
15085 #else
15086 lchown();
15087 #endif
15088 ; return 0; }
15089 EOCP
15090 set try
15091 if eval $compile; then
15092     $echo "lchown() found." >&4
15093     val="$define"
15094 else
15095     $echo "lchown() NOT found." >&4
15096     val="$undef"
15097 fi
15098 set d_lchown
15099 eval $setvar
15100
15101 : See if number of significant digits in a double precision number is known
15102 echo " "
15103 $cat >ldbl_dig.c <<EOM
15104 #$i_limits I_LIMITS
15105 #$i_float I_FLOAT
15106 #ifdef I_LIMITS
15107 #include <limits.h>
15108 #endif
15109 #ifdef I_FLOAT
15110 #include <float.h>
15111 #endif
15112 #ifdef LDBL_DIG
15113 printf("Contains LDBL_DIG");
15114 #endif
15115 EOM
15116 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15117 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15118         echo "LDBL_DIG found." >&4
15119         val="$define"
15120 else
15121         echo "LDBL_DIG NOT found." >&4
15122         val="$undef"
15123 fi
15124 $rm -f ldbl_dig.?
15125 set d_ldbl_dig
15126 eval $setvar
15127
15128 : see if this is a math.h system
15129 set math.h i_math
15130 eval $inhdr
15131
15132 : check to see if math.h defines _LIB_VERSION
15133 d_libm_lib_version="$undef"
15134 case $i_math in
15135     $define)
15136         echo " "
15137         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15138         $cat >try.c <<EOCP
15139 #include <unistd.h>
15140 #include <math.h>
15141 int main (int argc, char *argv[])
15142 {
15143     printf ("%d\n", _LIB_VERSION);
15144     return (0);
15145     } /* main */
15146 EOCP
15147         set try
15148         if eval $compile; then
15149             foo=`$run ./try`
15150             echo "Yes, it does ($foo)" >&4
15151             d_libm_lib_version="$define"
15152         else
15153             echo "No, it does not (probably harmless)" >&4
15154             fi
15155         $rm_try
15156         ;;
15157
15158     esac
15159
15160 : see if link exists
15161 set link d_link
15162 eval $inlibc
15163
15164 : see if localtime_r exists
15165 set localtime_r d_localtime_r
15166 eval $inlibc
15167 case "$d_localtime_r" in
15168 "$define")
15169         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15170         case "$d_localtime_r_proto:$usethreads" in
15171         ":define")      d_localtime_r_proto=define
15172                 set d_localtime_r_proto localtime_r $hdrs
15173                 eval $hasproto ;;
15174         *)      ;;
15175         esac
15176         case "$d_localtime_r_proto" in
15177         define)
15178         case "$localtime_r_proto" in
15179         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15180         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15181         esac
15182         case "$localtime_r_proto" in
15183         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15184         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15185         esac
15186         case "$localtime_r_proto" in
15187         ''|0)   d_localtime_r=undef
15188                 localtime_r_proto=0
15189                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15190         * )     case "$localtime_r_proto" in
15191                 REENTRANT_PROTO*) ;;
15192                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15193                 esac
15194                 echo "Prototype: $try" ;;
15195         esac
15196         ;;
15197         *)      case "$usethreads" in
15198                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15199                 esac
15200                 d_localtime_r=undef
15201                 localtime_r_proto=0
15202                 ;;
15203         esac
15204         ;;
15205 *)      localtime_r_proto=0
15206         ;;
15207 esac
15208
15209 : see if localtime_r calls tzset
15210 case "$localtime_r_proto" in
15211 REENTRANT_PROTO*)
15212         $cat >try.c <<EOCP
15213 /*  Does our libc's localtime_r call tzset ?
15214  *  return 0 if so, 1 otherwise.
15215  */
15216 #$i_systypes    I_SYS_TYPES
15217 #$i_unistd      I_UNISTD
15218 #$i_time        I_TIME
15219 #$i_stdlib      I_STDLIB
15220 #$i_string      I_STRING
15221 #$i_malloc      I_MALLOC
15222 #ifdef I_SYS_TYPES
15223 #  include <sys/types.h>
15224 #endif
15225 #ifdef I_UNISTD
15226 #  include <unistd.h>
15227 #endif
15228 #ifdef I_TIME
15229 #  include <time.h>
15230 #endif
15231 #ifdef I_STDLIB
15232 #include <stdlib.h>
15233 #endif
15234 #ifdef I_STRING
15235 #  include <string.h>
15236 #else
15237 #  include <strings.h>
15238 #endif
15239 #ifdef I_MALLOC
15240 #  include <malloc.h>
15241 #endif
15242 int main()
15243 {
15244     time_t t = time(0L);
15245     char w_tz[]="TZ" "=GMT+5",
15246          e_tz[]="TZ" "=GMT-5",
15247         *tz_e = (char*)malloc(16),
15248         *tz_w = (char*)malloc(16);
15249     struct tm tm_e, tm_w;
15250     memset(&tm_e,'\0',sizeof(struct tm));
15251     memset(&tm_w,'\0',sizeof(struct tm));
15252     strcpy(tz_e,e_tz);
15253     strcpy(tz_w,w_tz);
15254
15255     putenv(tz_e);
15256     localtime_r(&t, &tm_e);
15257
15258     putenv(tz_w);
15259     localtime_r(&t, &tm_w);
15260
15261     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15262         return 1;
15263     return 0;
15264 }
15265 EOCP
15266         set try
15267         if eval $compile; then
15268             if $run ./try; then
15269                 d_localtime_r_needs_tzset=undef;
15270             else
15271                 d_localtime_r_needs_tzset=define;
15272             fi;
15273         else
15274             d_localtime_r_needs_tzset=undef;
15275         fi;
15276      ;;
15277   *)
15278      d_localtime_r_needs_tzset=undef;
15279      ;;
15280 esac
15281 $rm_try
15282
15283 : see if localeconv exists
15284 set localeconv d_locconv
15285 eval $inlibc
15286
15287 : see if lockf exists
15288 set lockf d_lockf
15289 eval $inlibc
15290
15291 : see if prototype for lseek is available
15292 echo " "
15293 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15294 eval $hasproto
15295
15296 : see if lstat exists
15297 set lstat d_lstat
15298 eval $inlibc
15299
15300 : see if madvise exists
15301 set madvise d_madvise
15302 eval $inlibc
15303
15304 : see if malloc_size exists
15305 set malloc_size d_malloc_size
15306 eval $inlibc
15307
15308 : see if malloc_size_good exists
15309 set malloc_good_size d_malloc_good_size
15310 eval $inlibc
15311
15312 : see if mblen exists
15313 set mblen d_mblen
15314 eval $inlibc
15315
15316 : see if mbstowcs exists
15317 set mbstowcs d_mbstowcs
15318 eval $inlibc
15319
15320 : see if mbtowc exists
15321 set mbtowc d_mbtowc
15322 eval $inlibc
15323
15324 : see if memchr exists
15325 set memchr d_memchr
15326 eval $inlibc
15327
15328 : see if memcmp exists
15329 set memcmp d_memcmp
15330 eval $inlibc
15331
15332 : see if memcpy exists
15333 set memcpy d_memcpy
15334 eval $inlibc
15335
15336 : see if memmove exists
15337 set memmove d_memmove
15338 eval $inlibc
15339
15340 : see if memset exists
15341 set memset d_memset
15342 eval $inlibc
15343
15344 : see if mkdir exists
15345 set mkdir d_mkdir
15346 eval $inlibc
15347
15348 : see if mkdtemp exists
15349 set mkdtemp d_mkdtemp
15350 eval $inlibc
15351
15352 : see if mkfifo exists
15353 set mkfifo d_mkfifo
15354 eval $inlibc
15355
15356 : see if mkstemp exists
15357 set mkstemp d_mkstemp
15358 eval $inlibc
15359
15360 : see if mkstemps exists
15361 set mkstemps d_mkstemps
15362 eval $inlibc
15363
15364 : see if mktime exists
15365 set mktime d_mktime
15366 eval $inlibc
15367
15368 : see if this is a sys/mman.h system
15369 set sys/mman.h i_sysmman
15370 eval $inhdr
15371
15372 : see if mmap exists
15373 set mmap d_mmap
15374 eval $inlibc
15375 : see what shmat returns
15376 : default to something harmless
15377 mmaptype='void *'
15378 case "$i_sysmman$d_mmap" in
15379 "$define$define")
15380         $cat >mmap.c <<'END'
15381 #include <sys/mman.h>
15382 void *mmap();
15383 END
15384         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15385                 mmaptype='void *'
15386         else
15387                 mmaptype='caddr_t'
15388         fi
15389         echo "and it returns ($mmaptype)." >&4
15390         ;;
15391 esac
15392
15393
15394
15395 : see if sqrtl exists
15396 set sqrtl d_sqrtl
15397 eval $inlibc
15398
15399 : see if scalbnl exists
15400 set scalbnl d_scalbnl
15401 eval $inlibc
15402
15403 : see if modfl exists
15404 set modfl d_modfl
15405 eval $inlibc
15406
15407 : see if prototype for modfl is available
15408 echo " "
15409 set d_modflproto modfl $i_math math.h
15410 eval $hasproto
15411
15412 d_modfl_pow32_bug="$undef"
15413
15414 case "$d_longdbl$d_modfl" in
15415 $define$define)
15416         $cat <<EOM
15417 Checking to see whether your modfl() is okay for large values...
15418 EOM
15419 $cat >try.c <<EOCP
15420 #include <math.h>
15421 #include <stdio.h>
15422 EOCP
15423 if $test "X$d_modflproto" != "X$define"; then
15424         $cat >>try.c <<EOCP
15425 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15426 long double modfl (long double, long double *);
15427 EOCP
15428 fi
15429 $cat >>try.c <<EOCP
15430 int main() {
15431     long double nv = 4294967303.15;
15432     long double v, w;
15433     v = modfl(nv, &w);
15434 #ifdef __GLIBC__
15435     printf("glibc");
15436 #endif
15437     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15438     return 0;
15439 }
15440 EOCP
15441         case "$osname:$gccversion" in
15442         aix:)   saveccflags="$ccflags"
15443                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15444         esac
15445         set try
15446         if eval $compile; then
15447                 foo=`$run ./try`
15448                 case "$foo" in
15449                 *" 4294967303.150000 1.150000 4294967302.000000")
15450                         echo >&4 "Your modfl() is broken for large values."
15451                         d_modfl_pow32_bug="$define"
15452                         case "$foo" in
15453                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15454                         ;;
15455                         esac
15456                         ;;
15457                 *" 4294967303.150000 0.150000 4294967303.000000")
15458                         echo >&4 "Your modfl() seems okay for large values."
15459                         ;;
15460                 *)      echo >&4 "I don't understand your modfl() at all."
15461                         d_modfl="$undef"
15462                         ;;
15463                 esac
15464                 $rm_try
15465         else
15466                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15467                 d_modfl="$undef"
15468         fi
15469         case "$osname:$gccversion" in
15470         aix:)   ccflags="$saveccflags" ;; # restore
15471         esac
15472         ;;
15473 esac
15474
15475 if $test "$uselongdouble" = "$define"; then
15476     message=""
15477     if $test "$d_sqrtl" != "$define"; then
15478         message="$message sqrtl"
15479     fi
15480     if $test "$d_modfl" != "$define"; then
15481         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15482             echo "You have both aintl and copysignl, so I can emulate modfl."
15483         else
15484             message="$message modfl"
15485         fi
15486     fi
15487     if $test "$d_frexpl" != "$define"; then
15488         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15489             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15490         else
15491             message="$message frexpl"
15492         fi
15493     fi
15494
15495     if $test "$message" != ""; then
15496         $cat <<EOM >&4
15497
15498 *** You requested the use of long doubles but you do not seem to have
15499 *** the following mathematical functions needed for long double support:
15500 ***    $message
15501 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15502 *** Cannot continue, aborting.
15503
15504 EOM
15505
15506         exit 1
15507     fi
15508 fi
15509
15510 : see if mprotect exists
15511 set mprotect d_mprotect
15512 eval $inlibc
15513
15514 : see if msgctl exists
15515 set msgctl d_msgctl
15516 eval $inlibc
15517
15518 : see if msgget exists
15519 set msgget d_msgget
15520 eval $inlibc
15521
15522 : see if msgsnd exists
15523 set msgsnd d_msgsnd
15524 eval $inlibc
15525
15526 : see if msgrcv exists
15527 set msgrcv d_msgrcv
15528 eval $inlibc
15529
15530 : see how much of the 'msg*(2)' library is present.
15531 h_msg=true
15532 echo " "
15533 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15534 *"$undef"*) h_msg=false;;
15535 esac
15536 case "$osname" in
15537 freebsd)
15538     case "`ipcs 2>&1`" in
15539     "SVID messages"*"not configured"*)
15540         echo "Your $osname does not have the msg*(2) configured." >&4
15541         h_msg=false
15542         val="$undef"
15543         set msgctl d_msgctl
15544         eval $setvar
15545         set msgget d_msgget
15546         eval $setvar
15547         set msgsnd d_msgsnd
15548         eval $setvar
15549         set msgrcv d_msgrcv
15550         eval $setvar
15551         ;;
15552     esac
15553     ;;
15554 esac
15555 : we could also check for sys/ipc.h ...
15556 if $h_msg && $test `./findhdr sys/msg.h`; then
15557         echo "You have the full msg*(2) library." >&4
15558         val="$define"
15559 else
15560         echo "You don't have the full msg*(2) library." >&4
15561         val="$undef"
15562 fi
15563 set d_msg
15564 eval $setvar
15565
15566 : Check for msghdr_s
15567 echo " "
15568 echo "Checking to see if your system supports struct msghdr..." >&4
15569 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15570 eval $hasstruct
15571 case "$d_msghdr_s" in
15572 "$define")      echo "Yes, it does."   ;;
15573 *)              echo "No, it doesn't." ;;
15574 esac
15575
15576
15577 : see if msync exists
15578 set msync d_msync
15579 eval $inlibc
15580
15581 : see if munmap exists
15582 set munmap d_munmap
15583 eval $inlibc
15584
15585 : see if nice exists
15586 set nice d_nice
15587 eval $inlibc
15588
15589 : see if this is a langinfo.h system
15590 set langinfo.h i_langinfo
15591 eval $inhdr
15592
15593 : see if nl_langinfo exists
15594 set nl_langinfo d_nl_langinfo
15595 eval $inlibc
15596
15597 : check for volatile keyword
15598 echo " "
15599 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15600 $cat >try.c <<'EOCP'
15601 int main()
15602 {
15603         typedef struct _goo_struct goo_struct;
15604         goo_struct * volatile goo = ((goo_struct *)0);
15605         struct _goo_struct {
15606                 long long_int;
15607                 int reg_int;
15608                 char char_var;
15609         };
15610         typedef unsigned short foo_t;
15611         char *volatile foo;
15612         volatile int bar;
15613         volatile foo_t blech;
15614         foo = foo;
15615 }
15616 EOCP
15617 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15618         val="$define"
15619         echo "Yup, it does."
15620 else
15621         val="$undef"
15622         echo "Nope, it doesn't."
15623 fi
15624 set d_volatile
15625 eval $setvar
15626 $rm_try
15627
15628 : Check basic sizes
15629 echo " "
15630 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15631
15632 case "$use64bitint:$d_quad:$quadtype" in
15633 define:define:?*)
15634         ivtype="$quadtype"
15635         uvtype="$uquadtype"
15636         ivsize=8
15637         uvsize=8
15638         ;;
15639 *)      ivtype="long"
15640         uvtype="unsigned long"
15641         ivsize=$longsize
15642         uvsize=$longsize
15643         ;;
15644 esac
15645
15646 case "$uselongdouble:$d_longdbl" in
15647 define:define)
15648         nvtype="long double"
15649         nvsize=$longdblsize
15650         ;;
15651 *)      nvtype=double
15652         nvsize=$doublesize
15653         ;;
15654 esac
15655
15656 $echo "(IV will be "$ivtype", $ivsize bytes)"
15657 $echo "(UV will be "$uvtype", $uvsize bytes)"
15658 $echo "(NV will be "$nvtype", $nvsize bytes)"
15659
15660 $cat >try.c <<EOCP
15661 #$i_inttypes I_INTTYPES
15662 #ifdef I_INTTYPES
15663 #include <inttypes.h>
15664 #endif
15665 #include <stdio.h>
15666 int main() {
15667 #ifdef INT8
15668    int8_t i =  INT8_MAX;
15669   uint8_t u = UINT8_MAX;
15670   printf("int8_t\n");
15671 #endif
15672 #ifdef INT16
15673    int16_t i =  INT16_MAX;
15674   uint16_t i = UINT16_MAX;
15675   printf("int16_t\n");
15676 #endif
15677 #ifdef INT32
15678    int32_t i =  INT32_MAX;
15679   uint32_t u = UINT32_MAX;
15680   printf("int32_t\n");
15681 #endif
15682 }
15683 EOCP
15684
15685 i8type="signed char"
15686 u8type="unsigned char"
15687 i8size=1
15688 u8size=1
15689
15690 case "$i16type" in
15691 '')     case "$shortsize" in
15692         2)      i16type=short
15693                 u16type="unsigned short"
15694                 i16size=$shortsize
15695                 u16size=$shortsize
15696                 ;;
15697         esac
15698         ;;
15699 esac
15700 case "$i16type" in
15701 '')     set try -DINT16
15702         if eval $compile; then
15703                 case "`$run ./try`" in
15704                 int16_t)
15705                         i16type=int16_t
15706                         u16type=uint16_t
15707                         i16size=2
15708                         u16size=2
15709                         ;;
15710                 esac
15711         fi
15712         ;;
15713 esac
15714 case "$i16type" in
15715 '')     if $test $shortsize -ge 2; then
15716                 i16type=short
15717                 u16type="unsigned short"
15718                 i16size=$shortsize
15719                 u16size=$shortsize
15720         fi
15721         ;;
15722 esac
15723
15724 case "$i32type" in
15725 '')     case "$longsize" in
15726         4)      i32type=long
15727                 u32type="unsigned long"
15728                 i32size=$longsize
15729                 u32size=$longsize
15730                 ;;
15731         *)      case "$intsize" in
15732                 4)      i32type=int
15733                         u32type="unsigned int"
15734                         i32size=$intsize
15735                         u32size=$intsize
15736                         ;;
15737                 esac
15738                 ;;
15739         esac
15740         ;;
15741 esac
15742 case "$i32type" in
15743 '')     set try -DINT32
15744         if eval $compile; then
15745                 case "`$run ./try`" in
15746                 int32_t)
15747                         i32type=int32_t
15748                         u32type=uint32_t
15749                         i32size=4
15750                         u32size=4
15751                         ;;
15752                 esac
15753         fi
15754         ;;
15755 esac
15756 case "$i32type" in
15757 '')     if $test $intsize -ge 4; then
15758                 i32type=int
15759                 u32type="unsigned int"
15760                 i32size=$intsize
15761                 u32size=$intsize
15762         fi
15763         ;;
15764 esac
15765
15766 case "$i64type" in
15767 '')     case "$d_quad:$quadtype" in
15768         define:?*)
15769                 i64type="$quadtype"
15770                 u64type="$uquadtype"
15771                 i64size=8
15772                 u64size=8
15773                 ;;
15774         esac
15775         ;;
15776 esac
15777
15778 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15779 : volatile so that the compiler has to store it out to memory.
15780 if test X"$d_volatile" = X"$define"; then
15781         volatile=volatile
15782 fi
15783 $cat <<EOP >try.c
15784 #include <stdio.h>
15785 #$i_stdlib I_STDLIB
15786 #ifdef I_STDLIB
15787 #include <stdlib.h>
15788 #endif
15789 #include <sys/types.h>
15790 #include <signal.h>
15791 #ifdef SIGFPE
15792 $volatile int bletched = 0;
15793 $signal_t blech(int s) { bletched = 1; }
15794 #endif
15795 int main() {
15796     $uvtype u = 0;
15797     $nvtype d;
15798     int     n = 8 * $uvsize;
15799     int     i;
15800 #ifdef SIGFPE
15801     signal(SIGFPE, blech);
15802 #endif
15803
15804     for (i = 0; i < n; i++) {
15805       u = u << 1 | ($uvtype)1;
15806       d = ($nvtype)u;
15807       if (($uvtype)d != u)
15808         break;
15809       if (d <= 0)
15810         break;
15811       d = ($nvtype)(u - 1);
15812       if (($uvtype)d != (u - 1))
15813         break;
15814 #ifdef SIGFPE
15815       if (bletched)
15816         break;
15817 #endif
15818     }
15819     printf("%d\n", ((i == n) ? -n : i));
15820     exit(0);
15821 }
15822 EOP
15823 set try
15824
15825 d_nv_preserves_uv="$undef"
15826 if eval $compile; then
15827         nv_preserves_uv_bits="`$run ./try`"
15828 fi
15829 case "$nv_preserves_uv_bits" in
15830 \-[1-9]*)
15831         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15832         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15833         d_nv_preserves_uv="$define"
15834         ;;
15835 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15836         d_nv_preserves_uv="$undef" ;;
15837 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15838         nv_preserves_uv_bits="0" ;;
15839 esac
15840 $rm_try
15841
15842 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15843 : volatile so that the compiler has to store it out to memory.
15844 if test X"$d_volatile" = X"$define"; then
15845         volatile=volatile
15846 fi
15847 $cat <<EOP >try.c
15848 #include <stdio.h>
15849
15850 typedef $nvtype NV;
15851
15852 int
15853 main() {
15854   NV value = 2;
15855   int count = 1;
15856
15857   while(count < 256) {
15858     $volatile NV up = value + 1.0;
15859     $volatile NV negated = -value;
15860     $volatile NV down = negated - 1.0;
15861     $volatile NV got_up = up - value;
15862     int up_good = got_up == 1.0;
15863     int got_down = down - negated;
15864     int down_good = got_down == -1.0;
15865
15866     if (down_good != up_good) {
15867       fprintf(stderr,
15868               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15869               up_good, (double) got_up, down_good, (double) got_down,
15870               count, (double) value);
15871       return 1;
15872     }
15873     if (!up_good) {
15874       while (1) {
15875         if (count > 8) {
15876           count -= 8;
15877           fputs("256.0", stdout);
15878         } else {
15879           count--;
15880           fputs("2.0", stdout);
15881         }
15882         if (!count) {
15883           puts("");
15884           return 0;
15885         }
15886         fputs("*", stdout);
15887       }
15888     }
15889     value *= 2;
15890     ++count;
15891   }
15892   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15893           count, (double) value);
15894   return 1;
15895 }
15896 EOP
15897 set try
15898
15899 nv_overflows_integers_at='0'
15900 if eval $compile; then
15901     xxx="`$run ./try`"
15902     case "$?" in
15903         0)
15904             case "$xxx" in
15905                 2*)  cat >&4 <<EOM
15906 The largest integer your NVs can preserve is equal to $xxx
15907 EOM
15908                     nv_overflows_integers_at="$xxx"
15909                     ;;
15910                 *)  cat >&4 <<EOM
15911 Cannot determine the largest integer value your NVs can hold, unexpected output
15912 '$xxx'
15913 EOM
15914                     ;;
15915             esac
15916             ;;
15917         *)  cat >&4 <<EOM
15918 Cannot determine the largest integer value your NVs can hold
15919 EOM
15920             ;;
15921     esac
15922 fi
15923 $rm_try
15924
15925 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15926 : volatile so that the compiler has to store it out to memory.
15927 if test X"$d_volatile" = X"$define"; then
15928         volatile=volatile
15929 fi
15930 $cat <<EOP >try.c
15931 #include <stdio.h>
15932 #$i_stdlib I_STDLIB
15933 #ifdef I_STDLIB
15934 #include <stdlib.h>
15935 #endif
15936 #$i_string I_STRING
15937 #ifdef I_STRING
15938 #  include <string.h>
15939 #else
15940 #  include <strings.h>
15941 #endif
15942 #include <sys/types.h>
15943 #include <signal.h>
15944 #ifdef SIGFPE
15945 $volatile int bletched = 0;
15946 $signal_t blech(int s) { bletched = 1; }
15947 #endif
15948
15949 int checkit($nvtype d, char *where) {
15950     unsigned char *p = (char *)&d;
15951     unsigned char *end = p + sizeof(d);
15952     int fail = 0;
15953
15954     while (p < end)
15955         fail += *p++;
15956
15957     if (!fail)
15958         return 0;
15959
15960     p = (char *)&d;
15961     printf("No - %s: 0x", where);
15962     while (p < end)
15963         printf ("%02X", *p++);
15964     printf("\n");
15965     return 1;
15966 }
15967
15968 int main(int argc, char **argv) {
15969     $nvtype d = 0.0;
15970     int fail = 0;
15971     fail += checkit(d, "0.0");
15972
15973     /* The compiler shouldn't be assuming that bletched is 0  */
15974     d = bletched;
15975
15976     fail += checkit(d, "bleched");
15977
15978 #ifdef SIGFPE
15979     signal(SIGFPE, blech);
15980 #endif
15981
15982     /* Paranoia - the compiler should have no way of knowing that ANSI says
15983        that argv[argc] will always be NULL.  Actually, if it did assume this it
15984        would be buggy, as this is C and main() can be called from elsewhere in
15985        the program.  */
15986     d = argv[argc] ? 1 : 0;
15987
15988     if (d) {
15989         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15990     }
15991
15992     fail += checkit(d, "ternary");
15993
15994     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15995
15996     if (d != 0.0) {
15997         printf("No - memset doesn't give 0.0\n");
15998         /* This might just blow up:  */
15999         printf("(gives %g)\n", d);
16000         return 1;
16001     }
16002
16003 #ifdef SIGFPE
16004     if (bletched) {
16005         printf("No - something bleched\n");
16006         return 1;
16007     }
16008 #endif
16009     if (fail) {
16010       printf("No - %d fail(s)\n", fail);
16011       return 1;
16012     }
16013     printf("Yes\n");
16014     return 0;
16015 }
16016 EOP
16017 set try
16018
16019 d_nv_zero_is_allbits_zero="$undef"
16020 if eval $compile; then
16021     xxx="`$run ./try`"
16022     case "$?" in
16023         0)
16024             case "$xxx" in
16025                 Yes)  cat >&4 <<EOM
16026 0.0 is represented as all bits zero in memory
16027 EOM
16028                     d_nv_zero_is_allbits_zero="$define"
16029                     ;;
16030                 *)  cat >&4 <<EOM
16031 0.0 is not represented as all bits zero in memory
16032 EOM
16033                     d_nv_zero_is_allbits_zero="$undef"
16034                     ;;
16035             esac
16036             ;;
16037         *)  cat >&4 <<EOM
16038 0.0 is not represented as all bits zero in memory
16039 EOM
16040             d_nv_zero_is_allbits_zero="$undef"
16041             ;;
16042     esac
16043 fi
16044 $rm_try
16045
16046 : check for off64_t
16047 echo " "
16048 echo "Checking to see if you have off64_t..." >&4
16049 $cat >try.c <<EOCP
16050 #include <sys/types.h>
16051 #include <unistd.h>
16052 int main() { off64_t x = 7; }
16053 EOCP
16054 set try
16055 if eval $compile; then
16056         val="$define"
16057         echo "You have off64_t."
16058 else
16059         val="$undef"
16060         echo "You do not have off64_t."
16061         case "$lseeksize" in
16062         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16063         esac
16064 fi
16065 $rm_try
16066 set d_off64_t
16067 eval $setvar
16068
16069 : how to create joinable pthreads
16070 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16071         echo " "
16072         echo "Checking what constant to use for creating joinable pthreads..." >&4
16073         $cat >try.c <<'EOCP'
16074 #include <pthread.h>
16075 int main() {
16076     int detachstate = JOINABLE;
16077 }
16078 EOCP
16079         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16080         if eval $compile; then
16081                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16082                 val="$undef" # Yes, undef.
16083                 set d_old_pthread_create_joinable
16084                 eval $setvar
16085                 val=""
16086                 set old_pthread_create_joinable
16087                 eval $setvar
16088         else
16089                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16090                 if eval $compile; then
16091                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16092                         val="$define"
16093                         set d_old_pthread_create_joinable
16094                         eval $setvar
16095                         val=PTHREAD_CREATE_UNDETACHED
16096                         set old_pthread_create_joinable
16097                         eval $setvar
16098                 else
16099                         set try -DJOINABLE=__UNDETACHED
16100                         if eval $compile; then
16101                                 echo "You seem to use __UNDETACHED." >&4
16102                                 val="$define"
16103                                 set d_old_pthread_create_joinable
16104                                 eval $setvar
16105                                 val=__UNDETACHED
16106                                 set old_pthread_create_joinable
16107                                 eval $setvar
16108                         else
16109                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16110                                 val="$define"
16111                                 set d_old_pthread_create_joinable
16112                                 eval $setvar
16113                                 val=0
16114                                 set old_pthread_create_joinable
16115                                 eval $setvar
16116                         fi
16117                 fi
16118         fi
16119         $rm_try
16120 else
16121     d_old_pthread_create_joinable="$undef"
16122     old_pthread_create_joinable=""
16123 fi
16124
16125 : see if pause exists
16126 set pause d_pause
16127 eval $inlibc
16128
16129 : see if poll exists
16130 set poll d_poll
16131 eval $inlibc
16132
16133 : see if prctl exists
16134 set prctl d_prctl
16135 eval $inlibc
16136
16137 : see if prctl supports PR_SET_NAME
16138 d_prctl_set_name=$undef
16139 case $d_prctl in
16140     $define)
16141         $cat >try.c <<EOM
16142 #include <sys/prctl.h>
16143
16144 int main (int argc, char *argv[])
16145 {
16146     return (prctl (PR_SET_NAME, "Test"));
16147     } /* main */
16148 EOM
16149         set try
16150         if eval $compile_ok && $run ./try; then
16151             echo "Your prctl (PR_SET_NAME, ...) works"
16152             d_prctl_set_name=$define
16153             fi
16154         $rm_try
16155         ;;
16156     esac
16157
16158 : see if readlink exists
16159 set readlink d_readlink
16160 eval $inlibc
16161
16162 : Check if exe is symlink to abs path of executing program
16163 echo " "
16164 procselfexe=''
16165 val="$undef"
16166 case "$d_readlink" in
16167     "$define")
16168         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16169         : more tidy to avoid an extra level of symlink
16170         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16171         while test $# -gt 0; do
16172             type=$1; try=$2
16173             shift; shift
16174             if $issymlink $try; then
16175                 $ls -l $try > reflect
16176                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16177                     echo "You have $type-like $try."
16178                     procselfexe='"'$try'"'
16179                     val="$define"
16180                     : This will break out of the loop
16181                     set X; shift
16182                 fi
16183             fi
16184         done
16185         ;;
16186 esac
16187 $rm -f reflect
16188 set d_procselfexe
16189 eval $setvar
16190
16191 : backward compatibility for d_hvfork
16192 if test X$d_hvfork != X; then
16193         d_vfork="$d_hvfork"
16194         d_hvfork=''
16195 fi
16196 : see if there is a vfork
16197 val=''
16198 set vfork val
16199 eval $inlibc
16200
16201 d_pseudofork=$undef
16202
16203 : Ok, but do we want to use it. vfork is reportedly unreliable in
16204 : perl on Solaris 2.x, and probably elsewhere.
16205 case "$val" in
16206 $define)
16207         echo " "
16208         case "$usevfork" in
16209         false) dflt='n';;
16210         *) dflt='y';;
16211         esac
16212         cat <<'EOM'
16213
16214 Perl can only use a vfork() that doesn't suffer from strict
16215 restrictions on calling functions or modifying global data in
16216 the child.  For example, glibc-2.1 contains such a vfork()
16217 that is unsuitable.  If your system provides a proper fork()
16218 call, chances are that you do NOT want perl to use vfork().
16219
16220 EOM
16221         rp="Do you still want to use vfork()?"
16222         . ./myread
16223         case "$ans" in
16224         y|Y) ;;
16225         *)
16226                 echo "Ok, we won't use vfork()."
16227                 val="$undef"
16228                 ;;
16229         esac
16230         ;;
16231 esac
16232 set d_vfork
16233 eval $setvar
16234 case "$d_vfork" in
16235 $define) usevfork='true';;
16236 *) usevfork='false';;
16237 esac
16238
16239 : see whether the pthread_atfork exists
16240 $cat >try.c <<EOP
16241 #include <pthread.h>
16242 #include <stdio.h>
16243 int main() {
16244 #ifdef  PTHREAD_ATFORK
16245         pthread_atfork(NULL,NULL,NULL);
16246 #endif
16247 }
16248 EOP
16249
16250 : see if pthread_atfork exists
16251 set try -DPTHREAD_ATFORK
16252 if eval $compile; then
16253     val="$define"
16254 else
16255     val="$undef"
16256 fi
16257 case "$usethreads" in
16258 $define)
16259         case "$val" in
16260         $define) echo 'pthread_atfork found.' >&4        ;;
16261         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16262         esac
16263 esac
16264 set d_pthread_atfork
16265 eval $setvar
16266
16267 : see if pthread_attr_setscope exists
16268 set pthread_attr_setscope d_pthread_attr_setscope
16269 eval $inlibc
16270
16271 : see whether the various POSIXish _yields exist
16272 $cat >try.c <<EOP
16273 #include <pthread.h>
16274 #include <stdio.h>
16275 int main() {
16276 #ifdef SCHED_YIELD
16277         sched_yield();
16278 #else
16279 #ifdef PTHREAD_YIELD
16280         pthread_yield();
16281 #else
16282 #ifdef PTHREAD_YIELD_NULL
16283         pthread_yield(NULL);
16284 #endif
16285 #endif
16286 #endif
16287 }
16288 EOP
16289 : see if sched_yield exists
16290 set try -DSCHED_YIELD
16291 if eval $compile; then
16292     val="$define"
16293     sched_yield='sched_yield()'
16294 else
16295     val="$undef"
16296 fi
16297 case "$usethreads" in
16298 $define)
16299         case "$val" in
16300         $define) echo 'sched_yield() found.' >&4        ;;
16301         *)       echo 'sched_yield() NOT found.' >&4    ;;
16302         esac
16303 esac
16304 set d_sched_yield
16305 eval $setvar
16306
16307 : see if pthread_yield exists
16308 set try -DPTHREAD_YIELD
16309 if eval $compile; then
16310     val="$define"
16311     case "$sched_yield" in
16312     '') sched_yield='pthread_yield()' ;;
16313     esac
16314 else
16315     set try -DPTHREAD_YIELD_NULL
16316     if eval $compile; then
16317         val="$define"
16318         case "$sched_yield" in
16319         '') sched_yield='pthread_yield(NULL)' ;;
16320         esac
16321     else
16322         val="$undef"
16323     fi
16324 fi
16325 case "$usethreads" in
16326 $define)
16327         case "$val" in
16328         $define) echo 'pthread_yield() found.' >&4      ;;
16329         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16330         esac
16331         ;;
16332 esac
16333 set d_pthread_yield
16334 eval $setvar
16335 case "$sched_yield" in
16336 '') sched_yield=undef ;;
16337 esac
16338 $rm_try
16339
16340 : see if random_r exists
16341 set random_r d_random_r
16342 eval $inlibc
16343 case "$d_random_r" in
16344 "$define")
16345         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16346         case "$d_random_r_proto:$usethreads" in
16347         ":define")      d_random_r_proto=define
16348                 set d_random_r_proto random_r $hdrs
16349                 eval $hasproto ;;
16350         *)      ;;
16351         esac
16352         case "$d_random_r_proto" in
16353         define)
16354         case "$random_r_proto" in
16355         ''|0) try='int random_r(int*, struct random_data*);'
16356         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16357         esac
16358         case "$random_r_proto" in
16359         ''|0) try='int random_r(long*, struct random_data*);'
16360         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16361         esac
16362         case "$random_r_proto" in
16363         ''|0) try='int random_r(struct random_data*, int32_t*);'
16364         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16365         esac
16366         case "$random_r_proto" in
16367         ''|0)   d_random_r=undef
16368                 random_r_proto=0
16369                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16370         * )     case "$random_r_proto" in
16371                 REENTRANT_PROTO*) ;;
16372                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16373                 esac
16374                 echo "Prototype: $try" ;;
16375         esac
16376         ;;
16377         *)      case "$usethreads" in
16378                 define) echo "random_r has no prototype, not using it." >&4 ;;
16379                 esac
16380                 d_random_r=undef
16381                 random_r_proto=0
16382                 ;;
16383         esac
16384         ;;
16385 *)      random_r_proto=0
16386         ;;
16387 esac
16388
16389 : see if readdir and friends exist
16390 set readdir d_readdir
16391 eval $inlibc
16392 set seekdir d_seekdir
16393 eval $inlibc
16394 set telldir d_telldir
16395 eval $inlibc
16396 set rewinddir d_rewinddir
16397 eval $inlibc
16398
16399 : see if readdir64_r exists
16400 set readdir64_r d_readdir64_r
16401 eval $inlibc
16402 case "$d_readdir64_r" in
16403 "$define")
16404         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16405         case "$d_readdir64_r_proto:$usethreads" in
16406         ":define")      d_readdir64_r_proto=define
16407                 set d_readdir64_r_proto readdir64_r $hdrs
16408                 eval $hasproto ;;
16409         *)      ;;
16410         esac
16411         case "$d_readdir64_r_proto" in
16412         define)
16413         case "$readdir64_r_proto" in
16414         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16415         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16416         esac
16417         case "$readdir64_r_proto" in
16418         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16419         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16420         esac
16421         case "$readdir64_r_proto" in
16422         ''|0)   d_readdir64_r=undef
16423                 readdir64_r_proto=0
16424                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16425         * )     case "$readdir64_r_proto" in
16426                 REENTRANT_PROTO*) ;;
16427                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16428                 esac
16429                 echo "Prototype: $try" ;;
16430         esac
16431         ;;
16432         *)      case "$usethreads" in
16433                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16434                 esac
16435                 d_readdir64_r=undef
16436                 readdir64_r_proto=0
16437                 ;;
16438         esac
16439         ;;
16440 *)      readdir64_r_proto=0
16441         ;;
16442 esac
16443
16444 : see if readdir_r exists
16445 set readdir_r d_readdir_r
16446 eval $inlibc
16447 case "$d_readdir_r" in
16448 "$define")
16449         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16450         case "$d_readdir_r_proto:$usethreads" in
16451         ":define")      d_readdir_r_proto=define
16452                 set d_readdir_r_proto readdir_r $hdrs
16453                 eval $hasproto ;;
16454         *)      ;;
16455         esac
16456         case "$d_readdir_r_proto" in
16457         define)
16458         case "$readdir_r_proto" in
16459         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16460         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16461         esac
16462         case "$readdir_r_proto" in
16463         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16464         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16465         esac
16466         case "$readdir_r_proto" in
16467         ''|0)   d_readdir_r=undef
16468                 readdir_r_proto=0
16469                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16470         * )     case "$readdir_r_proto" in
16471                 REENTRANT_PROTO*) ;;
16472                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16473                 esac
16474                 echo "Prototype: $try" ;;
16475         esac
16476         ;;
16477         *)      case "$usethreads" in
16478                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16479                 esac
16480                 d_readdir_r=undef
16481                 readdir_r_proto=0
16482                 ;;
16483         esac
16484         ;;
16485 *)      readdir_r_proto=0
16486         ;;
16487 esac
16488
16489 : see if readv exists
16490 set readv d_readv
16491 eval $inlibc
16492
16493 : see if recvmsg exists
16494 set recvmsg d_recvmsg
16495 eval $inlibc
16496
16497 : see if rename exists
16498 set rename d_rename
16499 eval $inlibc
16500
16501 : see if rmdir exists
16502 set rmdir d_rmdir
16503 eval $inlibc
16504
16505 : see if memory.h is available.
16506 val=''
16507 set memory.h val
16508 eval $inhdr
16509
16510 : See if it conflicts with string.h
16511 case "$val" in
16512 $define)
16513         case "$strings" in
16514         '') ;;
16515         *)
16516                 $cppstdin $cppflags $cppminus < $strings > mem.h
16517                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16518                         echo " "
16519                         echo "We won't be including <memory.h>."
16520                         val="$undef"
16521                 fi
16522                 $rm -f mem.h
16523                 ;;
16524         esac
16525 esac
16526 set i_memory
16527 eval $setvar
16528
16529 : can bcopy handle overlapping blocks?
16530 echo " "
16531 val="$undef"
16532 case "$d_memmove" in
16533 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16534 *)      case "$d_bcopy" in
16535         "$define")
16536                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16537                 $cat >try.c <<EOCP
16538 #$i_memory I_MEMORY
16539 #$i_stdlib I_STDLIB
16540 #$i_string I_STRING
16541 #$i_unistd I_UNISTD
16542 EOCP
16543         $cat >>try.c <<'EOCP'
16544 #include <stdio.h>
16545 #ifdef I_MEMORY
16546 #  include <memory.h>
16547 #endif
16548 #ifdef I_STDLIB
16549 #  include <stdlib.h>
16550 #endif
16551 #ifdef I_STRING
16552 #  include <string.h>
16553 #else
16554 #  include <strings.h>
16555 #endif
16556 #ifdef I_UNISTD
16557 #  include <unistd.h>  /* Needed for NetBSD */
16558 #endif
16559 int main()
16560 {
16561 char buf[128], abc[128];
16562 char *b;
16563 int len;
16564 int off;
16565 int align;
16566
16567 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16568    try to store the string in read-only memory. */
16569 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16570
16571 for (align = 7; align >= 0; align--) {
16572         for (len = 36; len; len--) {
16573                 b = buf+align;
16574                 bcopy(abc, b, len);
16575                 for (off = 1; off <= len; off++) {
16576                         bcopy(b, b+off, len);
16577                         bcopy(b+off, b, len);
16578                         if (bcmp(b, abc, len))
16579                                 exit(1);
16580                 }
16581         }
16582 }
16583 exit(0);
16584 }
16585 EOCP
16586                 set try
16587                 if eval $compile_ok; then
16588                         if $run ./try 2>/dev/null; then
16589                                 echo "Yes, it can."
16590                                 val="$define"
16591                         else
16592                                 echo "It can't, sorry."
16593                         fi
16594                 else
16595                         echo "(I can't compile the test program, so we'll assume not...)"
16596                 fi
16597                 ;;
16598         esac
16599         $rm_try
16600         ;;
16601 esac
16602 set d_safebcpy
16603 eval $setvar
16604
16605 : can memcpy handle overlapping blocks?
16606 echo " "
16607 val="$undef"
16608 case "$d_memmove" in
16609 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16610 *)      case "$d_memcpy" in
16611         "$define")
16612                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16613                 $cat >try.c <<EOCP
16614 #$i_memory I_MEMORY
16615 #$i_stdlib I_STDLIB
16616 #$i_string I_STRING
16617 #$i_unistd I_UNISTD
16618 EOCP
16619         $cat >>try.c <<'EOCP'
16620 #include <stdio.h>
16621 #ifdef I_MEMORY
16622 #  include <memory.h>
16623 #endif
16624 #ifdef I_STDLIB
16625 #  include <stdlib.h>
16626 #endif
16627 #ifdef I_STRING
16628 #  include <string.h>
16629 #else
16630 #  include <strings.h>
16631 #endif
16632 #ifdef I_UNISTD
16633 #  include <unistd.h>  /* Needed for NetBSD */
16634 #endif
16635 int main()
16636 {
16637 char buf[128], abc[128];
16638 char *b;
16639 int len;
16640 int off;
16641 int align;
16642
16643 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16644    try to store the string in read-only memory. */
16645 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16646
16647 for (align = 7; align >= 0; align--) {
16648         for (len = 36; len; len--) {
16649                 b = buf+align;
16650                 memcpy(b, abc, len);
16651                 for (off = 1; off <= len; off++) {
16652                         memcpy(b+off, b, len);
16653                         memcpy(b, b+off, len);
16654                         if (memcmp(b, abc, len))
16655                                 exit(1);
16656                 }
16657         }
16658 }
16659 exit(0);
16660 }
16661 EOCP
16662                 set try
16663                 if eval $compile_ok; then
16664                         if $run ./try 2>/dev/null; then
16665                                 echo "Yes, it can."
16666                                 val="$define"
16667                         else
16668                                 echo "It can't, sorry."
16669                         fi
16670                 else
16671                         echo "(I can't compile the test program, so we'll assume not...)"
16672                 fi
16673                 ;;
16674         esac
16675         $rm_try
16676         ;;
16677 esac
16678 set d_safemcpy
16679 eval $setvar
16680
16681 : can memcmp be trusted to compare relative magnitude?
16682 val="$undef"
16683 case "$d_memcmp" in
16684 "$define")
16685         echo " "
16686         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16687         $cat >try.c <<EOCP
16688 #$i_memory I_MEMORY
16689 #$i_stdlib I_STDLIB
16690 #$i_string I_STRING
16691 #$i_unistd I_UNISTD
16692 EOCP
16693         $cat >>try.c <<'EOCP'
16694 #include <stdio.h>
16695 #ifdef I_MEMORY
16696 #  include <memory.h>
16697 #endif
16698 #ifdef I_STDLIB
16699 #  include <stdlib.h>
16700 #endif
16701 #ifdef I_STRING
16702 #  include <string.h>
16703 #else
16704 #  include <strings.h>
16705 #endif
16706 #ifdef I_UNISTD
16707 #  include <unistd.h>  /* Needed for NetBSD */
16708 #endif
16709 int main()
16710 {
16711 char a = -1;
16712 char b = 0;
16713 if ((a < b) && memcmp(&a, &b, 1) < 0)
16714         exit(1);
16715 exit(0);
16716 }
16717 EOCP
16718         set try
16719         if eval $compile_ok; then
16720                 if $run ./try 2>/dev/null; then
16721                         echo "Yes, it can."
16722                         val="$define"
16723                 else
16724                         echo "No, it can't (it uses signed chars)."
16725                 fi
16726         else
16727                 echo "(I can't compile the test program, so we'll assume not...)"
16728         fi
16729         ;;
16730 esac
16731 $rm_try
16732 set d_sanemcmp
16733 eval $setvar
16734
16735 : see if prototype for sbrk is available
16736 echo " "
16737 set d_sbrkproto sbrk $i_unistd unistd.h
16738 eval $hasproto
16739
16740 : see if select exists
16741 set select d_select
16742 eval $inlibc
16743
16744 : see if semctl exists
16745 set semctl d_semctl
16746 eval $inlibc
16747
16748 : see if semget exists
16749 set semget d_semget
16750 eval $inlibc
16751
16752 : see if semop exists
16753 set semop d_semop
16754 eval $inlibc
16755
16756 : see how much of the 'sem*(2)' library is present.
16757 h_sem=true
16758 echo " "
16759 case "$d_semctl$d_semget$d_semop" in
16760 *"$undef"*) h_sem=false;;
16761 esac
16762 case "$osname" in
16763 freebsd)
16764     case "`ipcs 2>&1`" in
16765     "SVID messages"*"not configured"*)
16766         echo "Your $osname does not have the sem*(2) configured." >&4
16767         h_sem=false
16768         val="$undef"
16769         set semctl d_semctl
16770         eval $setvar
16771         set semget d_semget
16772         eval $setvar
16773         set semop d_semop
16774         eval $setvar
16775         ;;
16776     esac
16777     ;;
16778 esac
16779 : we could also check for sys/ipc.h ...
16780 if $h_sem && $test `./findhdr sys/sem.h`; then
16781         echo "You have the full sem*(2) library." >&4
16782         val="$define"
16783 else
16784         echo "You don't have the full sem*(2) library." >&4
16785         val="$undef"
16786 fi
16787 set d_sem
16788 eval $setvar
16789
16790 : see whether sys/sem.h defines union semun
16791 echo " "
16792 $cat > try.c <<'END'
16793 #include <sys/types.h>
16794 #include <sys/ipc.h>
16795 #include <sys/sem.h>
16796 int main () { union semun semun; semun.buf = 0; }
16797 END
16798 set try
16799 if eval $compile; then
16800     echo "You have union semun in <sys/sem.h>." >&4
16801     val="$define"
16802 else
16803     echo "You do not have union semun in <sys/sem.h>." >&4
16804     val="$undef"
16805 fi
16806 $rm_try
16807 set d_union_semun
16808 eval $setvar
16809
16810 : see how to do semctl IPC_STAT
16811 case "$d_sem" in
16812 $define)
16813     echo " "
16814     $cat > tryh.h <<END
16815 #ifndef S_IRUSR
16816 #   ifdef S_IREAD
16817 #       define S_IRUSR S_IREAD
16818 #       define S_IWUSR S_IWRITE
16819 #       define S_IXUSR S_IEXEC
16820 #   else
16821 #       define S_IRUSR 0400
16822 #       define S_IWUSR 0200
16823 #       define S_IXUSR 0100
16824 #   endif
16825 #   define S_IRGRP (S_IRUSR>>3)
16826 #   define S_IWGRP (S_IWUSR>>3)
16827 #   define S_IXGRP (S_IXUSR>>3)
16828 #   define S_IROTH (S_IRUSR>>6)
16829 #   define S_IWOTH (S_IWUSR>>6)
16830 #   define S_IXOTH (S_IXUSR>>6)
16831 #endif
16832 #ifndef S_IRWXU
16833 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16834 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16835 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16836 #endif
16837 END
16838     : see whether semctl IPC_STAT can use union semun
16839     case "$d_semctl_semun" in
16840     '')
16841       val="$undef"
16842       $cat > try.c <<END
16843 #include <sys/types.h>
16844 #include <sys/ipc.h>
16845 #include <sys/sem.h>
16846 #include <sys/stat.h>
16847 #include <stdio.h>
16848 #include <errno.h>
16849 #include "tryh.h"
16850 #ifndef errno
16851 extern int errno;
16852 #endif
16853 #$d_union_semun HAS_UNION_SEMUN
16854 int main() {
16855     union semun
16856 #ifndef HAS_UNION_SEMUN
16857     {
16858         int val;
16859         struct semid_ds *buf;
16860         unsigned short *array;
16861     }
16862 #endif
16863     arg;
16864     int sem, st;
16865
16866 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16867     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16868     if (sem > -1) {
16869         struct semid_ds argbuf;
16870         arg.buf = &argbuf;
16871 #       ifdef IPC_STAT
16872         st = semctl(sem, 0, IPC_STAT, arg);
16873         if (st == 0)
16874             printf("semun\n");
16875         else
16876 #       endif /* IPC_STAT */
16877             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16878 #       ifdef IPC_RMID
16879         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16880 #       endif /* IPC_RMID */
16881             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16882     } else
16883 #endif /* IPC_PRIVATE && ... */
16884         printf("semget failed: errno = %d\n", errno);
16885   return 0;
16886 }
16887 END
16888       set try
16889       if eval $compile; then
16890           xxx=`$run ./try`
16891           case "$xxx" in
16892           semun) val="$define" ;;
16893           esac
16894       fi
16895       $rm_try
16896       set d_semctl_semun
16897       eval $setvar
16898       ;;
16899     esac
16900     case "$d_semctl_semun" in
16901     $define)
16902         echo "You can use union semun for semctl IPC_STAT." >&4
16903         also='also'
16904         ;;
16905     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16906         also=''
16907         ;;
16908     esac
16909
16910     : see whether semctl IPC_STAT can use struct semid_ds pointer
16911     case "$d_semctl_semid_ds" in
16912     '')
16913       val="$undef"
16914       $cat > try.c <<'END'
16915 #include <sys/types.h>
16916 #include <sys/ipc.h>
16917 #include <sys/sem.h>
16918 #include <sys/stat.h>
16919 #include "tryh.h"
16920 #include <stdio.h>
16921 #include <errno.h>
16922 #ifndef errno
16923 extern int errno;
16924 #endif
16925 int main() {
16926     struct semid_ds arg;
16927     int sem, st;
16928
16929 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16930     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16931     if (sem > -1) {
16932 #       ifdef IPC_STAT
16933         st = semctl(sem, 0, IPC_STAT, &arg);
16934         if (st == 0)
16935             printf("semid_ds\n");
16936         else
16937 #       endif /* IPC_STAT */
16938             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16939 #       ifdef IPC_RMID
16940         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16941 #       endif /* IPC_RMID */
16942             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16943     } else
16944 #endif /* IPC_PRIVATE && ... */
16945         printf("semget failed: errno = %d\n", errno);
16946
16947     return 0;
16948 }
16949 END
16950       set try
16951       if eval $compile; then
16952           xxx=`$run ./try`
16953           case "$xxx" in
16954           semid_ds) val="$define" ;;
16955           esac
16956       fi
16957       $rm_try
16958       set d_semctl_semid_ds
16959       eval $setvar
16960       ;;
16961     esac
16962     case "$d_semctl_semid_ds" in
16963     $define)
16964         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16965         ;;
16966     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16967         ;;
16968     esac
16969     ;;
16970 *)  val="$undef"
16971
16972     # We do not have the full sem*(2) library, so assume we can not
16973     # use either.
16974
16975     set d_semctl_semun
16976     eval $setvar
16977
16978     set d_semctl_semid_ds
16979     eval $setvar
16980     ;;
16981 esac
16982 $rm_try tryh.h
16983
16984 : see if sendmsg exists
16985 set sendmsg d_sendmsg
16986 eval $inlibc
16987
16988 : see if setegid exists
16989 set setegid d_setegid
16990 eval $inlibc
16991
16992 : see if seteuid exists
16993 set seteuid d_seteuid
16994 eval $inlibc
16995
16996 : see if setgrent exists
16997 set setgrent d_setgrent
16998 eval $inlibc
16999
17000 : see if setgrent_r exists
17001 set setgrent_r d_setgrent_r
17002 eval $inlibc
17003 case "$d_setgrent_r" in
17004 "$define")
17005         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17006         case "$d_setgrent_r_proto:$usethreads" in
17007         ":define")      d_setgrent_r_proto=define
17008                 set d_setgrent_r_proto setgrent_r $hdrs
17009                 eval $hasproto ;;
17010         *)      ;;
17011         esac
17012         case "$d_setgrent_r_proto" in
17013         define)
17014         case "$setgrent_r_proto" in
17015         ''|0) try='int setgrent_r(FILE**);'
17016         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17017         esac
17018         case "$setgrent_r_proto" in
17019         ''|0) try='void setgrent_r(FILE**);'
17020         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17021         esac
17022         case "$setgrent_r_proto" in
17023         ''|0)   d_setgrent_r=undef
17024                 setgrent_r_proto=0
17025                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17026         * )     case "$setgrent_r_proto" in
17027                 REENTRANT_PROTO*) ;;
17028                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17029                 esac
17030                 echo "Prototype: $try" ;;
17031         esac
17032         ;;
17033         *)      case "$usethreads" in
17034                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17035                 esac
17036                 d_setgrent_r=undef
17037                 setgrent_r_proto=0
17038                 ;;
17039         esac
17040         ;;
17041 *)      setgrent_r_proto=0
17042         ;;
17043 esac
17044
17045 : see if sethostent exists
17046 set sethostent d_sethent
17047 eval $inlibc
17048
17049 : see if sethostent_r exists
17050 set sethostent_r d_sethostent_r
17051 eval $inlibc
17052 case "$d_sethostent_r" in
17053 "$define")
17054         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17055         case "$d_sethostent_r_proto:$usethreads" in
17056         ":define")      d_sethostent_r_proto=define
17057                 set d_sethostent_r_proto sethostent_r $hdrs
17058                 eval $hasproto ;;
17059         *)      ;;
17060         esac
17061         case "$d_sethostent_r_proto" in
17062         define)
17063         case "$sethostent_r_proto" in
17064         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17065         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17066         esac
17067         case "$sethostent_r_proto" in
17068         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17069         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17070         esac
17071         case "$sethostent_r_proto" in
17072         ''|0)   d_sethostent_r=undef
17073                 sethostent_r_proto=0
17074                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17075         * )     case "$sethostent_r_proto" in
17076                 REENTRANT_PROTO*) ;;
17077                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17078                 esac
17079                 echo "Prototype: $try" ;;
17080         esac
17081         ;;
17082         *)      case "$usethreads" in
17083                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17084                 esac
17085                 d_sethostent_r=undef
17086                 sethostent_r_proto=0
17087                 ;;
17088         esac
17089         ;;
17090 *)      sethostent_r_proto=0
17091         ;;
17092 esac
17093
17094 : see if setitimer exists
17095 set setitimer d_setitimer
17096 eval $inlibc
17097
17098 : see if setlinebuf exists
17099 set setlinebuf d_setlinebuf
17100 eval $inlibc
17101
17102 : see if setlocale exists
17103 set setlocale d_setlocale
17104 eval $inlibc
17105
17106 : see if locale.h is available
17107 set locale.h i_locale
17108 eval $inhdr
17109
17110 : see if setlocale_r exists
17111 set setlocale_r d_setlocale_r
17112 eval $inlibc
17113 case "$d_setlocale_r" in
17114 "$define")
17115         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17116         case "$d_setlocale_r_proto:$usethreads" in
17117         ":define")      d_setlocale_r_proto=define
17118                 set d_setlocale_r_proto setlocale_r $hdrs
17119                 eval $hasproto ;;
17120         *)      ;;
17121         esac
17122         case "$d_setlocale_r_proto" in
17123         define)
17124         case "$setlocale_r_proto" in
17125         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17126         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17127         esac
17128         case "$setlocale_r_proto" in
17129         ''|0)   d_setlocale_r=undef
17130                 setlocale_r_proto=0
17131                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17132         * )     case "$setlocale_r_proto" in
17133                 REENTRANT_PROTO*) ;;
17134                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17135                 esac
17136                 echo "Prototype: $try" ;;
17137         esac
17138         ;;
17139         *)      case "$usethreads" in
17140                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17141                 esac
17142                 d_setlocale_r=undef
17143                 setlocale_r_proto=0
17144                 ;;
17145         esac
17146         ;;
17147 *)      setlocale_r_proto=0
17148         ;;
17149 esac
17150
17151 : see if setnetent exists
17152 set setnetent d_setnent
17153 eval $inlibc
17154
17155 : see if setnetent_r exists
17156 set setnetent_r d_setnetent_r
17157 eval $inlibc
17158 case "$d_setnetent_r" in
17159 "$define")
17160         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17161         case "$d_setnetent_r_proto:$usethreads" in
17162         ":define")      d_setnetent_r_proto=define
17163                 set d_setnetent_r_proto setnetent_r $hdrs
17164                 eval $hasproto ;;
17165         *)      ;;
17166         esac
17167         case "$d_setnetent_r_proto" in
17168         define)
17169         case "$setnetent_r_proto" in
17170         ''|0) try='int setnetent_r(int, struct netent_data*);'
17171         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17172         esac
17173         case "$setnetent_r_proto" in
17174         ''|0) try='void setnetent_r(int, struct netent_data*);'
17175         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17176         esac
17177         case "$setnetent_r_proto" in
17178         ''|0)   d_setnetent_r=undef
17179                 setnetent_r_proto=0
17180                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17181         * )     case "$setnetent_r_proto" in
17182                 REENTRANT_PROTO*) ;;
17183                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17184                 esac
17185                 echo "Prototype: $try" ;;
17186         esac
17187         ;;
17188         *)      case "$usethreads" in
17189                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17190                 esac
17191                 d_setnetent_r=undef
17192                 setnetent_r_proto=0
17193                 ;;
17194         esac
17195         ;;
17196 *)      setnetent_r_proto=0
17197         ;;
17198 esac
17199
17200 : see if setprotoent exists
17201 set setprotoent d_setpent
17202 eval $inlibc
17203
17204 : see if setpgid exists
17205 set setpgid d_setpgid
17206 eval $inlibc
17207
17208 : see if setpgrp2 exists
17209 set setpgrp2 d_setpgrp2
17210 eval $inlibc
17211
17212 : see if setpriority exists
17213 set setpriority d_setprior
17214 eval $inlibc
17215
17216 : see if setproctitle exists
17217 set setproctitle d_setproctitle
17218 eval $inlibc
17219
17220 : see if setprotoent_r exists
17221 set setprotoent_r d_setprotoent_r
17222 eval $inlibc
17223 case "$d_setprotoent_r" in
17224 "$define")
17225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17226         case "$d_setprotoent_r_proto:$usethreads" in
17227         ":define")      d_setprotoent_r_proto=define
17228                 set d_setprotoent_r_proto setprotoent_r $hdrs
17229                 eval $hasproto ;;
17230         *)      ;;
17231         esac
17232         case "$d_setprotoent_r_proto" in
17233         define)
17234         case "$setprotoent_r_proto" in
17235         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17236         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17237         esac
17238         case "$setprotoent_r_proto" in
17239         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17240         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17241         esac
17242         case "$setprotoent_r_proto" in
17243         ''|0)   d_setprotoent_r=undef
17244                 setprotoent_r_proto=0
17245                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17246         * )     case "$setprotoent_r_proto" in
17247                 REENTRANT_PROTO*) ;;
17248                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17249                 esac
17250                 echo "Prototype: $try" ;;
17251         esac
17252         ;;
17253         *)      case "$usethreads" in
17254                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17255                 esac
17256                 d_setprotoent_r=undef
17257                 setprotoent_r_proto=0
17258                 ;;
17259         esac
17260         ;;
17261 *)      setprotoent_r_proto=0
17262         ;;
17263 esac
17264
17265 : see if setpwent exists
17266 set setpwent d_setpwent
17267 eval $inlibc
17268
17269 : see if setpwent_r exists
17270 set setpwent_r d_setpwent_r
17271 eval $inlibc
17272 case "$d_setpwent_r" in
17273 "$define")
17274         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17275         case "$d_setpwent_r_proto:$usethreads" in
17276         ":define")      d_setpwent_r_proto=define
17277                 set d_setpwent_r_proto setpwent_r $hdrs
17278                 eval $hasproto ;;
17279         *)      ;;
17280         esac
17281         case "$d_setpwent_r_proto" in
17282         define)
17283         case "$setpwent_r_proto" in
17284         ''|0) try='int setpwent_r(FILE**);'
17285         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17286         esac
17287         case "$setpwent_r_proto" in
17288         ''|0) try='void setpwent_r(FILE**);'
17289         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17290         esac
17291         case "$setpwent_r_proto" in
17292         ''|0)   d_setpwent_r=undef
17293                 setpwent_r_proto=0
17294                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17295         * )     case "$setpwent_r_proto" in
17296                 REENTRANT_PROTO*) ;;
17297                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17298                 esac
17299                 echo "Prototype: $try" ;;
17300         esac
17301         ;;
17302         *)      case "$usethreads" in
17303                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17304                 esac
17305                 d_setpwent_r=undef
17306                 setpwent_r_proto=0
17307                 ;;
17308         esac
17309         ;;
17310 *)      setpwent_r_proto=0
17311         ;;
17312 esac
17313
17314 : see if setregid exists
17315 set setregid d_setregid
17316 eval $inlibc
17317 set setresgid d_setresgid
17318 eval $inlibc
17319
17320 : see if setreuid exists
17321 set setreuid d_setreuid
17322 eval $inlibc
17323 set setresuid d_setresuid
17324 eval $inlibc
17325
17326 : see if setrgid exists
17327 set setrgid d_setrgid
17328 eval $inlibc
17329
17330 : see if setruid exists
17331 set setruid d_setruid
17332 eval $inlibc
17333
17334 : see if setservent exists
17335 set setservent d_setsent
17336 eval $inlibc
17337
17338 : see if setservent_r exists
17339 set setservent_r d_setservent_r
17340 eval $inlibc
17341 case "$d_setservent_r" in
17342 "$define")
17343         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17344         case "$d_setservent_r_proto:$usethreads" in
17345         ":define")      d_setservent_r_proto=define
17346                 set d_setservent_r_proto setservent_r $hdrs
17347                 eval $hasproto ;;
17348         *)      ;;
17349         esac
17350         case "$d_setservent_r_proto" in
17351         define)
17352         case "$setservent_r_proto" in
17353         ''|0) try='int setservent_r(int, struct servent_data*);'
17354         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17355         esac
17356         case "$setservent_r_proto" in
17357         ''|0) try='void setservent_r(int, struct servent_data*);'
17358         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17359         esac
17360         case "$setservent_r_proto" in
17361         ''|0)   d_setservent_r=undef
17362                 setservent_r_proto=0
17363                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17364         * )     case "$setservent_r_proto" in
17365                 REENTRANT_PROTO*) ;;
17366                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17367                 esac
17368                 echo "Prototype: $try" ;;
17369         esac
17370         ;;
17371         *)      case "$usethreads" in
17372                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17373                 esac
17374                 d_setservent_r=undef
17375                 setservent_r_proto=0
17376                 ;;
17377         esac
17378         ;;
17379 *)      setservent_r_proto=0
17380         ;;
17381 esac
17382
17383 : see if setsid exists
17384 set setsid d_setsid
17385 eval $inlibc
17386
17387 : see if setvbuf exists
17388 set setvbuf d_setvbuf
17389 eval $inlibc
17390
17391 : see if sfio.h is available
17392 set sfio.h i_sfio
17393 eval $inhdr
17394
17395 : see if sfio library is available
17396 case "$i_sfio" in
17397 $define)
17398         val=''
17399         set sfreserve val
17400         eval $inlibc
17401         ;;
17402 *)
17403         val="$undef"
17404         ;;
17405 esac
17406 : Ok, but do we want to use it.
17407 case "$val" in
17408 $define)
17409         case "$usesfio" in
17410         true|$define|[yY]*) dflt='y';;
17411         *) dflt='n';;
17412         esac
17413         echo "$package can use the sfio library, but it is experimental."
17414         rp="You seem to have sfio available, do you want to try using it?"
17415         . ./myread
17416         case "$ans" in
17417         y|Y)    echo "Ok, turning on sfio then."
17418                 val="$define"
17419                 ;;
17420         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17421                 val="$undef"
17422                 ;;
17423         esac
17424         ;;
17425 *)      case "$usesfio" in
17426         true|$define|[yY]*)
17427                 echo "Sorry, cannot find sfio on this machine." >&4
17428                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17429                 val="$undef"
17430                 ;;
17431         esac
17432         ;;
17433 esac
17434 set d_sfio
17435 eval $setvar
17436 case "$d_sfio" in
17437 $define) usesfio='true';;
17438 *) usesfio='false';;
17439 esac
17440 case "$d_sfio" in
17441 $define) ;;
17442 *)      : Remove sfio from list of libraries to use
17443         case "$libs" in
17444         *-lsfio*)
17445                 echo "Removing unneeded -lsfio from library list" >&4
17446                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17447                 shift
17448                 libs="$*"
17449                 echo "libs = $libs" >&4
17450                 ;;
17451         esac
17452 ;;
17453 esac
17454
17455
17456 : see if shmctl exists
17457 set shmctl d_shmctl
17458 eval $inlibc
17459
17460 : see if shmget exists
17461 set shmget d_shmget
17462 eval $inlibc
17463
17464 : see if shmat exists
17465 set shmat d_shmat
17466 eval $inlibc
17467 : see what shmat returns
17468 case "$d_shmat" in
17469 "$define")
17470         $cat >shmat.c <<'END'
17471 #include <sys/shm.h>
17472 void *shmat();
17473 END
17474         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17475                 shmattype='void *'
17476         else
17477                 shmattype='char *'
17478         fi
17479         echo "and it returns ($shmattype)." >&4
17480         : see if a prototype for shmat is available
17481         xxx=`./findhdr sys/shm.h`
17482         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17483         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17484                 val="$define"
17485         else
17486                 val="$undef"
17487         fi
17488         $rm -f shmat.[co]
17489         ;;
17490 *)
17491         val="$undef"
17492         ;;
17493 esac
17494 set d_shmatprototype
17495 eval $setvar
17496
17497 : see if shmdt exists
17498 set shmdt d_shmdt
17499 eval $inlibc
17500
17501 : see how much of the 'shm*(2)' library is present.
17502 h_shm=true
17503 echo " "
17504 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17505 *"$undef"*) h_shm=false;;
17506 esac
17507 case "$osname" in
17508 freebsd)
17509     case "`ipcs 2>&1`" in
17510     "SVID shared memory"*"not configured"*)
17511         echo "Your $osname does not have the shm*(2) configured." >&4
17512         h_shm=false
17513         val="$undef"
17514         set shmctl d_shmctl
17515         evat $setvar
17516         set shmget d_shmget
17517         evat $setvar
17518         set shmat d_shmat
17519         evat $setvar
17520         set shmdt d_shmdt
17521         evat $setvar
17522         ;;
17523     esac
17524     ;;
17525 esac
17526 : we could also check for sys/ipc.h ...
17527 if $h_shm && $test `./findhdr sys/shm.h`; then
17528         echo "You have the full shm*(2) library." >&4
17529         val="$define"
17530 else
17531         echo "You don't have the full shm*(2) library." >&4
17532         val="$undef"
17533 fi
17534 set d_shm
17535 eval $setvar
17536
17537 : see if we have sigaction
17538 echo " "
17539 if set sigaction val -f d_sigaction; eval $csym; $val; then
17540         echo 'sigaction() found.' >&4
17541         $cat > try.c <<EOP
17542 #include <stdio.h>
17543 #include <sys/types.h>
17544 #include <signal.h>
17545 #$i_stdlib I_STDLIB
17546 #ifdef I_STDLIB
17547 #include <stdlib.h>
17548 #endif
17549 int main()
17550 {
17551     struct sigaction act, oact;
17552     act.sa_flags = 0;
17553     oact.sa_handler = 0;
17554     /* so that act and oact are used */
17555     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17556 }
17557 EOP
17558         set try
17559         if eval $compile_ok; then
17560                 val="$define"
17561         else
17562                 echo "But you don't seem to have a useable struct sigaction." >&4
17563                 val="$undef"
17564         fi
17565 else
17566         echo 'sigaction NOT found.' >&4
17567         val="$undef"
17568 fi
17569 set d_sigaction; eval $setvar
17570 $rm_try
17571
17572 : see if this is a sunmath.h system
17573 set sunmath.h i_sunmath
17574 eval $inhdr
17575
17576 : see if signbit exists
17577 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17578 $cat >try.c <<EOCP
17579 #$i_math I_MATH
17580 #$i_sunmath I_SUNMATH
17581 #ifdef I_MATH
17582 #  include <math.h>
17583 #endif
17584 #ifdef I_SUNMATH  /* Solaris special math library */
17585 #  include <sunmath.h>
17586 #endif
17587 #define NV $nvtype
17588 int main(int argc, char **argv)
17589 {
17590     NV x = 0.0;
17591     NV y = -0.0;
17592     if ((signbit(x) == 0) && (signbit(y) != 0))
17593         return 0;
17594     else
17595         return 1;
17596 }
17597 EOCP
17598 val="$undef"
17599 set try
17600 if eval $compile; then
17601     if $run ./try; then
17602         $echo "Yes." >&4
17603         val="$define"
17604     else
17605         $echo "Signbit seems to be available, but doesn't work as I expected."
17606         $echo "I won't use it." >&4
17607         val="$undef"
17608     fi
17609 else
17610     $echo "Nope." >&4
17611     dflt="$undef"
17612 fi
17613 set d_signbit
17614 eval $setvar
17615 $rm_try
17616
17617 : see if sigprocmask exists
17618 set sigprocmask d_sigprocmask
17619 eval $inlibc
17620
17621 : see if sigsetjmp exists
17622 echo " "
17623 case "$d_sigsetjmp" in
17624 '')
17625         $cat >try.c <<EOP
17626 #include <setjmp.h>
17627 #$i_stdlib I_STDLIB
17628 #ifdef I_STDLIB
17629 #include <stdlib.h>
17630 #endif
17631 sigjmp_buf env;
17632 int set = 1;
17633 int main()
17634 {
17635         if (sigsetjmp(env,1))
17636                 exit(set);
17637         set = 0;
17638         siglongjmp(env, 1);
17639         exit(1);
17640 }
17641 EOP
17642         set try
17643         if eval $compile; then
17644                 if $run ./try >/dev/null 2>&1; then
17645                         echo "POSIX sigsetjmp found." >&4
17646                         val="$define"
17647                 else
17648                         $cat >&4 <<EOM
17649 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17650 I'll ignore them.
17651 EOM
17652                         val="$undef"
17653                 fi
17654         else
17655                 echo "sigsetjmp not found." >&4
17656                 val="$undef"
17657         fi
17658         ;;
17659 *) val="$d_sigsetjmp"
17660         case "$d_sigsetjmp" in
17661         $define) echo "POSIX sigsetjmp found." >&4;;
17662         $undef) echo "sigsetjmp not found." >&4;;
17663         esac
17664         ;;
17665 esac
17666 set d_sigsetjmp
17667 eval $setvar
17668 $rm_try
17669
17670 : see if snprintf exists
17671 set snprintf d_snprintf
17672 eval $inlibc
17673
17674 : see if vsnprintf exists
17675 set vsnprintf d_vsnprintf
17676 eval $inlibc
17677
17678 case "$d_snprintf-$d_vsnprintf" in
17679 "$define-$define")
17680     $cat <<EOM
17681 Checking whether your snprintf() and vsnprintf() work okay...
17682 EOM
17683     $cat >try.c <<'EOCP'
17684 /* v?snprintf testing logic courtesy of Russ Allbery.
17685  * According to C99:
17686  * - if the buffer is too short it still must be \0-terminated
17687  * - if the buffer is too short the potentially required length
17688  *   must be returned and not -1
17689  * - if the buffer is NULL the potentially required length
17690  *   must be returned and not -1 or core dump
17691  */
17692 #include <stdio.h>
17693 #include <stdarg.h>
17694
17695 char buf[2];
17696
17697 int test (char *format, ...)
17698 {
17699     va_list args;
17700     int count;
17701
17702     va_start (args, format);
17703     count = vsnprintf (buf, sizeof buf, format, args);
17704     va_end (args);
17705     return count;
17706 }
17707
17708 int main ()
17709 {
17710     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17711              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17712 }
17713 EOCP
17714     set try
17715     if eval $compile; then
17716         `$run ./try`
17717         case "$?" in
17718         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17719         *) cat <<EOM >&4
17720 Your snprintf() and snprintf() don't seem to be working okay.
17721 EOM
17722            d_snprintf="$undef"
17723            d_vsnprintf="$undef"
17724            ;;
17725         esac
17726     else
17727         echo "(I can't seem to compile the test program--assuming they don't)"
17728         d_snprintf="$undef"
17729         d_vsnprintf="$undef"
17730     fi
17731     $rm_try
17732     ;;
17733 esac
17734
17735 : see if sockatmark exists
17736 set sockatmark d_sockatmark
17737 eval $inlibc
17738
17739 : see if prototype for sockatmark is available
17740 echo " "
17741 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17742 eval $hasproto
17743
17744 : see if socks5_init exists
17745 set socks5_init d_socks5_init
17746 eval $inlibc
17747
17748 : see if sprintf returns the length of the string in the buffer as per ANSI
17749 $echo "Checking whether sprintf returns the length of the string..." >&4
17750 $cat <<EOP >try.c
17751 #include <stdio.h>
17752 #$i_stdlib I_STDLIB
17753 #ifdef I_STDLIB
17754 #include <stdlib.h>
17755 #endif
17756 #$i_string I_STRING
17757 #ifdef I_STRING
17758 #  include <string.h>
17759 #else
17760 #  include <strings.h>
17761 #endif
17762 #$i_math I_MATH
17763 #ifdef I_MATH
17764 #include <math.h>
17765 #endif
17766
17767 char buffer[256];
17768
17769 int check (size_t expect, int test) {
17770   size_t got = strlen(buffer);
17771   if (expect == got)
17772     return 0;
17773
17774   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17775        test, buffer);
17776   exit (test);
17777 }
17778
17779 int main(int argc, char **argv) {
17780   int test = 0;
17781
17782   check(sprintf(buffer, ""), ++test);
17783   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17784   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17785
17786   return 0;
17787 }
17788 EOP
17789 set try
17790
17791 if eval $compile; then
17792     xxx="`$run ./try`"
17793     case "$?" in
17794         0) cat >&4 <<EOM
17795 sprintf returns the length of the string (as ANSI says it should)
17796 EOM
17797         d_sprintf_returns_strlen="$define"
17798         ;;
17799         *) cat >&4 <<EOM
17800 sprintf does not return the length of the string (how old is this system?)
17801 EOM
17802         d_sprintf_returns_strlen="$undef"
17803         ;;
17804     esac
17805 else
17806     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17807     d_sprintf_returns_strlen="$undef"
17808 fi
17809 $rm_try
17810
17811 : see if srand48_r exists
17812 set srand48_r d_srand48_r
17813 eval $inlibc
17814 case "$d_srand48_r" in
17815 "$define")
17816         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17817         case "$d_srand48_r_proto:$usethreads" in
17818         ":define")      d_srand48_r_proto=define
17819                 set d_srand48_r_proto srand48_r $hdrs
17820                 eval $hasproto ;;
17821         *)      ;;
17822         esac
17823         case "$d_srand48_r_proto" in
17824         define)
17825         case "$srand48_r_proto" in
17826         ''|0) try='int srand48_r(long, struct drand48_data*);'
17827         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17828         esac
17829         case "$srand48_r_proto" in
17830         ''|0)   d_srand48_r=undef
17831                 srand48_r_proto=0
17832                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17833         * )     case "$srand48_r_proto" in
17834                 REENTRANT_PROTO*) ;;
17835                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17836                 esac
17837                 echo "Prototype: $try" ;;
17838         esac
17839         ;;
17840         *)      case "$usethreads" in
17841                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17842                 esac
17843                 d_srand48_r=undef
17844                 srand48_r_proto=0
17845                 ;;
17846         esac
17847         ;;
17848 *)      srand48_r_proto=0
17849         ;;
17850 esac
17851
17852 : see if srandom_r exists
17853 set srandom_r d_srandom_r
17854 eval $inlibc
17855 case "$d_srandom_r" in
17856 "$define")
17857         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17858         case "$d_srandom_r_proto:$usethreads" in
17859         ":define")      d_srandom_r_proto=define
17860                 set d_srandom_r_proto srandom_r $hdrs
17861                 eval $hasproto ;;
17862         *)      ;;
17863         esac
17864         case "$d_srandom_r_proto" in
17865         define)
17866         case "$srandom_r_proto" in
17867         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17868         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17869         esac
17870         case "$srandom_r_proto" in
17871         ''|0)   d_srandom_r=undef
17872                 srandom_r_proto=0
17873                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17874         * )     case "$srandom_r_proto" in
17875                 REENTRANT_PROTO*) ;;
17876                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17877                 esac
17878                 echo "Prototype: $try" ;;
17879         esac
17880         ;;
17881         *)      case "$usethreads" in
17882                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17883                 esac
17884                 d_srandom_r=undef
17885                 srandom_r_proto=0
17886                 ;;
17887         esac
17888         ;;
17889 *)      srandom_r_proto=0
17890         ;;
17891 esac
17892
17893 : see if prototype for setresgid is available
17894 echo " "
17895 set d_sresgproto setresgid $i_unistd unistd.h
17896 eval $hasproto
17897
17898 : see if prototype for setresuid is available
17899 echo " "
17900 set d_sresuproto setresuid $i_unistd unistd.h
17901 eval $hasproto
17902
17903 : see if sys/stat.h is available
17904 set sys/stat.h i_sysstat
17905 eval $inhdr
17906
17907 : see if stat knows about block sizes
17908 echo " "
17909 echo "Checking to see if your struct stat has st_blocks field..." >&4
17910 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17911 eval $hasfield
17912
17913 : see if this is a sys/vfs.h system
17914 set sys/vfs.h i_sysvfs
17915 eval $inhdr
17916
17917 : see if this is a sys/statfs.h system
17918 set sys/statfs.h i_sysstatfs
17919 eval $inhdr
17920
17921 : Check for statfs_s
17922 echo " "
17923 echo "Checking to see if your system supports struct statfs..." >&4
17924 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
17925 eval $hasstruct
17926 case "$d_statfs_s" in
17927 "$define")      echo "Yes, it does."   ;;
17928 *)              echo "No, it doesn't." ;;
17929 esac
17930
17931
17932 : see if struct statfs knows about f_flags
17933 case "$d_statfs_s" in
17934 define)
17935         echo " "
17936         echo "Checking to see if your struct statfs has f_flags field..." >&4
17937         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
17938         eval $hasfield
17939         ;;
17940 *)      val="$undef"
17941         set d_statfs_f_flags
17942         eval $setvar
17943         ;;
17944 esac
17945 case "$d_statfs_f_flags" in
17946 "$define")      echo "Yes, it does."   ;;
17947 *)              echo "No, it doesn't." ;;
17948 esac
17949
17950 : see what flavor, if any, of static inline is supported
17951 echo " "
17952 echo "Checking to see if your system supports static inline..."
17953 $cat > try.c <<'EOCP'
17954 #include <stdlib.h>
17955 extern int f_via_a(int x);
17956 extern int f_via_b(int x);
17957 int main(int argc, char **argv)
17958 {
17959     int y;
17960
17961     y = f_via_a(0);
17962 #ifdef USE_B
17963     y = f_via_b(0);
17964 #endif
17965     if (y == 42) {
17966         return EXIT_SUCCESS;
17967     }
17968     else {
17969         return EXIT_FAILURE;
17970     }
17971 }
17972 EOCP
17973 $cat > a.c <<'EOCP'
17974 static INLINE int f(int x) {
17975     int y;
17976     y = x + 42;
17977     return y;
17978 }
17979
17980 int f_via_a(int x)
17981 {
17982     return f(x);
17983 }
17984 EOCP
17985 $cat > b.c <<'EOCP'
17986 extern int f(int x);
17987
17988 int f_via_b(int x)
17989 {
17990     return f(x);
17991 }
17992 EOCP
17993
17994 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17995 case "$perl_static_inline" in
17996 '')     # Check the various possibilities, and break out on success.
17997         # For gcc, prefer __inline__, which will still permit 
17998         # cflags.SH to add in -ansi.
17999         case "$gccversion" in
18000                 '') xxx="inline __inline__ __inline _inline";;
18001                 *)  xxx="__inline__ inline __inline _inline";;
18002         esac
18003         for inline in $xxx; do
18004                 set try -DINLINE=$inline a.c
18005                 if eval $compile && $run ./try; then
18006                         # Now make sure there is no external linkage of static
18007                         # functions
18008                         set try -DINLINE=$inline -DUSE_B a.c b.c
18009                         if eval $compile && $run ./try; then
18010                                 $echo "Your compiler supports static $inline, " >&4
18011                                 $echo "but it also creates an external definition," >&4
18012                                 $echo "so I won't use it." >&4
18013                                 val=$undef
18014                         else
18015                                 $echo "Your compiler supports static $inline." >&4
18016                                 val=$define
18017                                 perl_static_inline="static $inline";
18018                                 break;
18019                         fi
18020                 else
18021                         $echo "Your compiler does NOT support static $inline." >&4
18022                         val="$undef"
18023                 fi
18024         done
18025         ;;
18026 *inline*) # Some variant of inline exists.
18027         echo "Keeping your $hint value of $perl_static_inline."
18028         val=$define
18029         ;;
18030 static)  # No inline capabilities
18031         echo "Keeping your $hint value of $perl_static_inline."
18032         val=$undef
18033         ;;
18034 *)  # Unrecognized previous value -- blindly trust the supplied
18035         # value and hope it makes sense.  Use old value for
18036         # d_static_inline, if there is one.
18037         echo "Keeping your $hint value of $perl_static_inline."
18038         case "$d_static_inline" in
18039                 '') val=$define ;;
18040                 *)  val=$d_static_inline ;;
18041         esac
18042         ;;
18043 esac
18044 # Fallback to plain 'static' if nothing worked.
18045 case "$perl_static_inline" in
18046 '')
18047         perl_static_inline="static"
18048         val=$undef
18049         ;;
18050 esac
18051 set d_static_inline
18052 eval $setvar
18053 $rm -f a.[co] b.[co]
18054 $rm_try
18055
18056 : Check stream access
18057 $cat >&4 <<EOM
18058 Checking how to access stdio streams by file descriptor number...
18059 EOM
18060 case "$stdio_stream_array" in
18061 '')     $cat >try.c <<EOCP
18062 #include <stdio.h>
18063 int main() {
18064   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18065     printf("yes\n");
18066 }
18067 EOCP
18068         for s in _iob __iob __sF
18069         do
18070                 set try -DSTDIO_STREAM_ARRAY=$s
18071                 if eval $compile; then
18072                         case "`$run ./try`" in
18073                         yes)    stdio_stream_array=$s; break ;;
18074                         esac
18075                 fi
18076         done
18077         $rm_try
18078 esac
18079 case "$stdio_stream_array" in
18080 '')     $cat >&4 <<EOM
18081 I can't figure out how to access stdio streams by file descriptor number.
18082 EOM
18083         d_stdio_stream_array="$undef"
18084         ;;
18085 *)      $cat >&4 <<EOM
18086 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18087 EOM
18088         d_stdio_stream_array="$define"
18089         ;;
18090 esac
18091
18092 : see if strcoll exists
18093 set strcoll d_strcoll
18094 eval $inlibc
18095
18096 : check for structure copying
18097 echo " "
18098 echo "Checking to see if your C compiler can copy structs..." >&4
18099 $cat >try.c <<'EOCP'
18100 int main()
18101 {
18102         struct blurfl {
18103                 int dyick;
18104         } foo, bar;
18105
18106         foo = bar;
18107 }
18108 EOCP
18109 if $cc -c try.c >/dev/null 2>&1 ; then
18110         val="$define"
18111         echo "Yup, it can."
18112 else
18113         val="$undef"
18114         echo "Nope, it can't."
18115 fi
18116 set d_strctcpy
18117 eval $setvar
18118 $rm_try
18119
18120 : see if strerror and/or sys_errlist[] exist
18121 echo " "
18122 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18123     if set strerror val -f d_strerror; eval $csym; $val; then
18124                 echo 'strerror() found.' >&4
18125                 d_strerror="$define"
18126                 d_strerrm='strerror(e)'
18127                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18128                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18129                         d_syserrlst="$define"
18130                 else
18131                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18132                         d_syserrlst="$undef"
18133                 fi
18134     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18135                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18136                 echo 'strerror() found in string header.' >&4
18137                 d_strerror="$define"
18138                 d_strerrm='strerror(e)'
18139                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18140                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18141                                 d_syserrlst="$define"
18142                 else
18143                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18144                         d_syserrlst="$undef"
18145                 fi
18146     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18147                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18148                 d_strerror="$undef"
18149                 d_syserrlst="$define"
18150                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18151     else
18152                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18153                 d_strerror="$undef"
18154                 d_syserrlst="$undef"
18155                 d_strerrm='"unknown"'
18156     fi
18157 fi
18158
18159 : see if strerror_r exists
18160 set strerror_r d_strerror_r
18161 eval $inlibc
18162 case "$d_strerror_r" in
18163 "$define")
18164         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18165         case "$d_strerror_r_proto:$usethreads" in
18166         ":define")      d_strerror_r_proto=define
18167                 set d_strerror_r_proto strerror_r $hdrs
18168                 eval $hasproto ;;
18169         *)      ;;
18170         esac
18171         case "$d_strerror_r_proto" in
18172         define)
18173         case "$strerror_r_proto" in
18174         ''|0) try='int strerror_r(int, char*, size_t);'
18175         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18176         esac
18177         case "$strerror_r_proto" in
18178         ''|0) try='int strerror_r(int, char*, int);'
18179         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18180         esac
18181         case "$strerror_r_proto" in
18182         ''|0) try='char* strerror_r(int, char*, size_t);'
18183         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18184         esac
18185         case "$strerror_r_proto" in
18186         ''|0)   d_strerror_r=undef
18187                 strerror_r_proto=0
18188                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18189         * )     case "$strerror_r_proto" in
18190                 REENTRANT_PROTO*) ;;
18191                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18192                 esac
18193                 echo "Prototype: $try" ;;
18194         esac
18195         ;;
18196         *)      case "$usethreads" in
18197                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18198                 esac
18199                 d_strerror_r=undef
18200                 strerror_r_proto=0
18201                 ;;
18202         esac
18203         ;;
18204 *)      strerror_r_proto=0
18205         ;;
18206 esac
18207
18208 : see if strftime exists
18209 set strftime d_strftime
18210 eval $inlibc
18211
18212 : see if strlcat exists
18213 set strlcat d_strlcat
18214 eval $inlibc
18215
18216 : see if strlcpy exists
18217 set strlcpy d_strlcpy
18218 eval $inlibc
18219
18220 : see if strtod exists
18221 set strtod d_strtod
18222 eval $inlibc
18223
18224 : see if strtol exists
18225 set strtol d_strtol
18226 eval $inlibc
18227
18228 : see if strtold exists
18229 set strtold d_strtold
18230 eval $inlibc
18231
18232 : see if strtoll exists
18233 set strtoll d_strtoll
18234 eval $inlibc
18235
18236 case "$d_longlong-$d_strtoll" in
18237 "$define-$define")
18238         $cat <<EOM
18239 Checking whether your strtoll() works okay...
18240 EOM
18241         $cat >try.c <<'EOCP'
18242 #include <errno.h>
18243 #ifdef __hpux
18244 #define strtoll __strtoll
18245 #endif
18246 #ifdef __EMX__
18247 #define strtoll _strtoll
18248 #endif
18249 #include <stdio.h>
18250 extern long long int strtoll(char *s, char **, int);
18251 static int bad = 0;
18252 int check(char *s, long long ell, int een) {
18253         long long gll;
18254         errno = 0;
18255         gll = strtoll(s, 0, 10);
18256         if (!((gll == ell) && (errno == een)))
18257                 bad++;
18258 }
18259 int main() {
18260         check(" 1",                                      1LL, 0);
18261         check(" 0",                                      0LL, 0);
18262         check("-1",                                     -1LL, 0);
18263         check("-9223372036854775808", -9223372036854775808LL, 0);
18264         check("-9223372036854775808", -9223372036854775808LL, 0);
18265         check(" 9223372036854775807",  9223372036854775807LL, 0);
18266         check("-9223372036854775808", -9223372036854775808LL, 0);
18267         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18268         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18269         if (!bad)
18270                 printf("ok\n");
18271 }
18272 EOCP
18273         set try
18274         if eval $compile; then
18275                 yyy=`$run ./try`
18276                 case "$yyy" in
18277                 ok) echo "Your strtoll() seems to be working okay." ;;
18278                 *) cat <<EOM >&4
18279 Your strtoll() doesn't seem to be working okay.
18280 EOM
18281                    d_strtoll="$undef"
18282                    ;;
18283                 esac
18284         else
18285                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18286                 d_strtoll="$undef"
18287         fi
18288         ;;
18289 esac
18290
18291 : see if strtoq exists
18292 set strtoq d_strtoq
18293 eval $inlibc
18294
18295 : see if strtoul exists
18296 set strtoul d_strtoul
18297 eval $inlibc
18298
18299 case "$d_strtoul" in
18300 "$define")
18301         $cat <<EOM
18302 Checking whether your strtoul() works okay...
18303 EOM
18304         $cat >try.c <<'EOCP'
18305 #include <errno.h>
18306 #include <stdio.h>
18307 extern unsigned long int strtoul(char *s, char **, int);
18308 static int bad = 0;
18309 void check(char *s, unsigned long eul, int een) {
18310         unsigned long gul;
18311         errno = 0;
18312         gul = strtoul(s, 0, 10);
18313         if (!((gul == eul) && (errno == een)))
18314                 bad++;
18315 }
18316 int main() {
18317         check(" 1", 1L, 0);
18318         check(" 0", 0L, 0);
18319 EOCP
18320         case "$longsize" in
18321         8)
18322             $cat >>try.c <<'EOCP'
18323         check("18446744073709551615", 18446744073709551615UL, 0);
18324         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18325 #if 0 /* strtoul() for /^-/ strings is undefined. */
18326         check("-1", 18446744073709551615UL, 0);
18327         check("-18446744073709551614", 2, 0);
18328         check("-18446744073709551615", 1, 0);
18329         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18330         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18331 #endif
18332 EOCP
18333                 ;;
18334         4)
18335                     $cat >>try.c <<'EOCP'
18336         check("4294967295", 4294967295UL, 0);
18337         check("4294967296", 4294967295UL, ERANGE);
18338 #if 0 /* strtoul() for /^-/ strings is undefined. */
18339         check("-1", 4294967295UL, 0);
18340         check("-4294967294", 2, 0);
18341         check("-4294967295", 1, 0);
18342         check("-4294967296", 4294967295UL, ERANGE);
18343         check("-4294967297", 4294967295UL, ERANGE);
18344 #endif
18345 EOCP
18346                 ;;
18347         *)
18348 : Should we write these tests to be more portable by sprintf-ing
18349 : ~0 and then manipulating that char string as input for strtol?
18350                 ;;
18351         esac
18352         $cat >>try.c <<'EOCP'
18353         if (!bad)
18354                 printf("ok\n");
18355         return 0;
18356 }
18357 EOCP
18358         set try
18359         if eval $compile; then
18360                 case "`$run ./try`" in
18361                 ok) echo "Your strtoul() seems to be working okay." ;;
18362                 *) cat <<EOM >&4
18363 Your strtoul() doesn't seem to be working okay.
18364 EOM
18365                    d_strtoul="$undef"
18366                    ;;
18367                 esac
18368         else
18369                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18370                 d_strtoul="$undef"
18371         fi
18372         ;;
18373 esac
18374
18375 : see if strtoull exists
18376 set strtoull d_strtoull
18377 eval $inlibc
18378
18379 case "$d_longlong-$d_strtoull" in
18380 "$define-$define")
18381         $cat <<EOM
18382 Checking whether your strtoull() works okay...
18383 EOM
18384         $cat >try.c <<'EOCP'
18385 #include <errno.h>
18386 #ifdef __hpux
18387 #define strtoull __strtoull
18388 #endif
18389 #include <stdio.h>
18390 extern unsigned long long int strtoull(char *s, char **, int);
18391 static int bad = 0;
18392 int check(char *s, long long eull, int een) {
18393         long long gull;
18394         errno = 0;
18395         gull = strtoull(s, 0, 10);
18396         if (!((gull == eull) && (errno == een)))
18397                 bad++;
18398 }
18399 int main() {
18400         check(" 1",                                        1LL, 0);
18401         check(" 0",                                        0LL, 0);
18402         check("18446744073709551615",  18446744073709551615ULL, 0);
18403         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18404 #if 0 /* strtoull() for /^-/ strings is undefined. */
18405         check("-1",                    18446744073709551615ULL, 0);
18406         check("-18446744073709551614",                     2LL, 0);
18407         check("-18446744073709551615",                     1LL, 0);
18408         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18409         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18410 #endif
18411         if (!bad)
18412                 printf("ok\n");
18413 }
18414 EOCP
18415         set try
18416         if eval $compile; then
18417                 case "`$run ./try`" in
18418                 ok) echo "Your strtoull() seems to be working okay." ;;
18419                 *) cat <<EOM >&4
18420 Your strtoull() doesn't seem to be working okay.
18421 EOM
18422                    d_strtoull="$undef"
18423                    ;;
18424                 esac
18425         else
18426                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18427                 d_strtoull="$undef"
18428         fi
18429         ;;
18430 esac
18431
18432 : see if strtouq exists
18433 set strtouq d_strtouq
18434 eval $inlibc
18435
18436 case "$d_strtouq" in
18437 "$define")
18438         $cat <<EOM
18439 Checking whether your strtouq() works okay...
18440 EOM
18441         $cat >try.c <<'EOCP'
18442 #include <errno.h>
18443 #include <stdio.h>
18444 extern unsigned long long int strtouq(char *s, char **, int);
18445 static int bad = 0;
18446 void check(char *s, unsigned long long eull, int een) {
18447         unsigned long long gull;
18448         errno = 0;
18449         gull = strtouq(s, 0, 10);
18450         if (!((gull == eull) && (errno == een)))
18451                 bad++;
18452 }
18453 int main() {
18454         check(" 1",                                        1LL, 0);
18455         check(" 0",                                        0LL, 0);
18456         check("18446744073709551615",  18446744073709551615ULL, 0);
18457         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18458 #if 0 /* strtouq() for /^-/ strings is undefined. */
18459         check("-1",                    18446744073709551615ULL, 0);
18460         check("-18446744073709551614",                     2LL, 0);
18461         check("-18446744073709551615",                     1LL, 0);
18462         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18463         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18464 #endif
18465         if (!bad)
18466                 printf("ok\n");
18467         return 0;
18468 }
18469 EOCP
18470         set try
18471         if eval $compile; then
18472                 case "`$run ./try`" in
18473                 ok) echo "Your strtouq() seems to be working okay." ;;
18474                 *) cat <<EOM >&4
18475 Your strtouq() doesn't seem to be working okay.
18476 EOM
18477                    d_strtouq="$undef"
18478                    ;;
18479                 esac
18480         else
18481                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18482                 d_strtouq="$undef"
18483         fi
18484         ;;
18485 esac
18486
18487 : see if strxfrm exists
18488 set strxfrm d_strxfrm
18489 eval $inlibc
18490
18491 : see if symlink exists
18492 set symlink d_symlink
18493 eval $inlibc
18494
18495 : see if syscall exists
18496 set syscall d_syscall
18497 eval $inlibc
18498
18499 : see if prototype for syscall is available
18500 echo " "
18501 set d_syscallproto syscall $i_unistd unistd.h
18502 eval $hasproto
18503
18504 : see if sysconf exists
18505 set sysconf d_sysconf
18506 eval $inlibc
18507
18508 : see if system exists
18509 set system d_system
18510 eval $inlibc
18511
18512 : see if tcgetpgrp exists
18513 set tcgetpgrp d_tcgetpgrp
18514 eval $inlibc
18515
18516 : see if tcsetpgrp exists
18517 set tcsetpgrp d_tcsetpgrp
18518 eval $inlibc
18519
18520 : see if prototype for telldir is available
18521 echo " "
18522 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18523 eval $hasproto
18524
18525 : see if time exists
18526 echo " "
18527 if test "X$d_time" = X -o X"$timetype" = X; then
18528     if set time val -f d_time; eval $csym; $val; then
18529                 echo 'time() found.' >&4
18530                 val="$define"
18531                 rp="What is the type returned by time() on this system?"
18532                 set time_t timetype long stdio.h sys/types.h
18533                 eval $typedef_ask
18534     else
18535                 echo 'time() not found, hope that will do.' >&4
18536                 val="$undef"
18537                 timetype='int';
18538     fi
18539     set d_time
18540     eval $setvar
18541 fi
18542
18543 : see if timegm exists
18544 set timegm d_timegm
18545 eval $inlibc
18546
18547 : see if this is a sys/times.h system
18548 set sys/times.h i_systimes
18549 eval $inhdr
18550
18551 : see if times exists
18552 echo " "
18553 if set times val -f d_times; eval $csym; $val; then
18554         echo 'times() found.' >&4
18555         d_times="$define"
18556         inc=''
18557         case "$i_systimes" in
18558         "$define") inc='sys/times.h';;
18559         esac
18560         rp="What is the type returned by times() on this system?"
18561         set clock_t clocktype long stdio.h sys/types.h $inc
18562         eval $typedef_ask
18563 else
18564         echo 'times() NOT found, hope that will do.' >&4
18565         d_times="$undef"
18566         clocktype='int'
18567 fi
18568
18569 : see if tmpnam_r exists
18570 set tmpnam_r d_tmpnam_r
18571 eval $inlibc
18572 case "$d_tmpnam_r" in
18573 "$define")
18574         hdrs="$i_systypes sys/types.h define stdio.h "
18575         case "$d_tmpnam_r_proto:$usethreads" in
18576         ":define")      d_tmpnam_r_proto=define
18577                 set d_tmpnam_r_proto tmpnam_r $hdrs
18578                 eval $hasproto ;;
18579         *)      ;;
18580         esac
18581         case "$d_tmpnam_r_proto" in
18582         define)
18583         case "$tmpnam_r_proto" in
18584         ''|0) try='char* tmpnam_r(char*);'
18585         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18586         esac
18587         case "$tmpnam_r_proto" in
18588         ''|0)   d_tmpnam_r=undef
18589                 tmpnam_r_proto=0
18590                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18591         * )     case "$tmpnam_r_proto" in
18592                 REENTRANT_PROTO*) ;;
18593                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18594                 esac
18595                 echo "Prototype: $try" ;;
18596         esac
18597         ;;
18598         *)      case "$usethreads" in
18599                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18600                 esac
18601                 d_tmpnam_r=undef
18602                 tmpnam_r_proto=0
18603                 ;;
18604         esac
18605         ;;
18606 *)      tmpnam_r_proto=0
18607         ;;
18608 esac
18609
18610 : see if truncate exists
18611 set truncate d_truncate
18612 eval $inlibc
18613
18614 : see if ttyname_r exists
18615 set ttyname_r d_ttyname_r
18616 eval $inlibc
18617 case "$d_ttyname_r" in
18618 "$define")
18619         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18620         case "$d_ttyname_r_proto:$usethreads" in
18621         ":define")      d_ttyname_r_proto=define
18622                 set d_ttyname_r_proto ttyname_r $hdrs
18623                 eval $hasproto ;;
18624         *)      ;;
18625         esac
18626         case "$d_ttyname_r_proto" in
18627         define)
18628         case "$ttyname_r_proto" in
18629         ''|0) try='int ttyname_r(int, char*, size_t);'
18630         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18631         esac
18632         case "$ttyname_r_proto" in
18633         ''|0) try='int ttyname_r(int, char*, int);'
18634         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18635         esac
18636         case "$ttyname_r_proto" in
18637         ''|0) try='char* ttyname_r(int, char*, int);'
18638         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18639         esac
18640         case "$ttyname_r_proto" in
18641         ''|0)   d_ttyname_r=undef
18642                 ttyname_r_proto=0
18643                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18644         * )     case "$ttyname_r_proto" in
18645                 REENTRANT_PROTO*) ;;
18646                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18647                 esac
18648                 echo "Prototype: $try" ;;
18649         esac
18650         ;;
18651         *)      case "$usethreads" in
18652                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18653                 esac
18654                 d_ttyname_r=undef
18655                 ttyname_r_proto=0
18656                 ;;
18657         esac
18658         ;;
18659 *)      ttyname_r_proto=0
18660         ;;
18661 esac
18662
18663 : see if tzname[] exists
18664 echo " "
18665 if set tzname val -a d_tzname; eval $csym; $val; then
18666         val="$define"
18667         echo 'tzname[] found.' >&4
18668 else
18669         val="$undef"
18670         echo 'tzname[] NOT found.' >&4
18671 fi
18672 set d_tzname
18673 eval $setvar
18674
18675 : Check if is a multiplatform env
18676 case "$osname" in
18677 next|rhapsody|darwin) multiarch="$define" ;;
18678 esac
18679 case "$multiarch" in
18680 ''|[nN]*) multiarch="$undef" ;;
18681 esac
18682
18683 : check for ordering of bytes in a UV
18684 echo " "
18685 case "$usecrosscompile$multiarch" in
18686 *$define*)
18687         $cat <<EOM
18688 You seem to be either cross-compiling or doing a multiarchitecture build,
18689 skipping the byteorder check.
18690
18691 EOM
18692         byteorder='ffff'
18693         ;;
18694 *)
18695         case "$byteorder" in
18696         '')
18697                 $cat <<'EOM'
18698 In the following, larger digits indicate more significance.  A big-endian
18699 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18700 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18701 machines may have weird orders like 3412.  A Cray will report 87654321,
18702 an Alpha will report 12345678. If the test program works the default is
18703 probably right.
18704 I'm now running the test program...
18705 EOM
18706                 $cat >try.c <<EOCP
18707 #include <stdio.h>
18708 #$i_stdlib I_STDLIB
18709 #ifdef I_STDLIB
18710 #include <stdlib.h>
18711 #endif
18712 #include <sys/types.h>
18713 typedef $uvtype UV;
18714 int main()
18715 {
18716         int i;
18717         union {
18718                 UV l;
18719                 char c[$uvsize];
18720         } u;
18721
18722         if ($uvsize > 4)
18723                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18724         else
18725                 u.l = (UV)0x04030201;
18726         for (i = 0; i < $uvsize; i++)
18727                 printf("%c", u.c[i]+'0');
18728         printf("\n");
18729         exit(0);
18730 }
18731 EOCP
18732                 xxx_prompt=y
18733                 set try
18734                 if eval $compile && $run ./try > /dev/null; then
18735                         dflt=`$run ./try`
18736                         case "$dflt" in
18737                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18738                                 echo "(The test program ran ok.)"
18739                                 echo "byteorder=$dflt"
18740                                 xxx_prompt=n
18741                         ;;
18742                         ????|????????) echo "(The test program ran ok.)" ;;
18743                         *) echo "(The test program didn't run right for some reason.)" ;;
18744                         esac
18745                 else
18746                         dflt='4321'
18747                         cat <<'EOM'
18748 (I can't seem to compile the test program.  Guessing big-endian...)
18749 EOM
18750                 fi
18751                 case "$xxx_prompt" in
18752                 y)
18753                         rp="What is the order of bytes in $uvtype?"
18754                         . ./myread
18755                         byteorder="$ans"
18756                         ;;
18757                 *)      byteorder=$dflt
18758                         ;;
18759                 esac
18760                 ;;
18761         esac
18762         $rm_try
18763         ;;
18764 esac
18765
18766 : Checking 32bit alignedness
18767 $cat <<EOM
18768
18769 Checking to see whether you can access character data unalignedly...
18770 EOM
18771 case "$d_u32align" in
18772 '')   $cat >try.c <<EOCP
18773 #include <stdio.h>
18774 #$i_stdlib I_STDLIB
18775 #ifdef I_STDLIB
18776 #include <stdlib.h>
18777 #endif
18778 #define U32 $u32type
18779 #define BYTEORDER 0x$byteorder
18780 #define U8 $u8type
18781 #include <signal.h>
18782 #ifdef SIGBUS
18783 $signal_t bletch(int s) { exit(4); }
18784 #endif
18785 int main() {
18786 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18787     volatile U8 buf[8];
18788     volatile U32 *up;
18789     int i;
18790
18791     if (sizeof(U32) != 4) {
18792         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18793         exit(1);
18794     }
18795
18796     fflush(stdout);
18797
18798 #ifdef SIGBUS
18799     signal(SIGBUS, bletch);
18800 #endif
18801
18802     buf[0] = 0;
18803     buf[1] = 0;
18804     buf[2] = 0;
18805     buf[3] = 1;
18806     buf[4] = 0;
18807     buf[5] = 0;
18808     buf[6] = 0;
18809     buf[7] = 1;
18810
18811     for (i = 0; i < 4; i++) {
18812         up = (U32*)(buf + i);
18813         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18814                (*up == 1 << (8*(3-i)))  /* little-endian */
18815               )
18816            )
18817         {
18818             printf("read failed (%x)\n", *up);
18819             exit(2);
18820         }
18821     }
18822
18823     /* write test */
18824     for (i = 0; i < 4; i++) {
18825         up = (U32*)(buf + i);
18826         *up = 0xBeef;
18827         if (*up != 0xBeef) {
18828             printf("write failed (%x)\n", *up);
18829             exit(3);
18830         }
18831     }
18832
18833     exit(0);
18834 #else
18835     printf("1\n");
18836     exit(1);
18837 #endif
18838     return 0;
18839 }
18840 EOCP
18841 set try
18842 if eval $compile_ok; then
18843         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18844         $run ./try 2>&1 >/dev/null
18845         case "$?" in
18846         0)      cat >&4 <<EOM
18847 You can access character data pretty unalignedly.
18848 EOM
18849                 d_u32align="$undef"
18850                 ;;
18851         *)      cat >&4 <<EOM
18852 It seems that you must access character data in an aligned manner.
18853 EOM
18854                 d_u32align="$define"
18855                 ;;
18856         esac
18857 else
18858         rp='Can you access character data at unaligned addresses?'
18859         dflt='n'
18860         . ./myread
18861         case "$ans" in
18862         [yY]*)  d_u32align="$undef"  ;;
18863         *)      d_u32align="$define" ;;
18864         esac
18865 fi
18866 $rm_try
18867 ;;
18868 esac
18869
18870 : see if ualarm exists
18871 set ualarm d_ualarm
18872 eval $inlibc
18873
18874 : see if umask exists
18875 set umask d_umask
18876 eval $inlibc
18877
18878 : see if unordered exists
18879 set unordered d_unordered
18880 eval $inlibc
18881
18882 : see if unsetenv exists
18883 set unsetenv d_unsetenv
18884 eval $inlibc
18885
18886 : see if usleep exists
18887 set usleep d_usleep
18888 eval $inlibc
18889
18890 : see if prototype for usleep is available
18891 echo " "
18892 set d_usleepproto usleep $i_unistd unistd.h
18893 eval $hasproto
18894
18895 : see if ustat exists
18896 set ustat d_ustat
18897 eval $inlibc
18898
18899 : see if closedir exists
18900 set closedir d_closedir
18901 eval $inlibc
18902
18903 case "$d_closedir" in
18904 "$define")
18905         echo " "
18906         echo "Checking whether closedir() returns a status..." >&4
18907         cat > try.c <<EOM
18908 #$i_dirent I_DIRENT             /**/
18909 #$i_sysdir I_SYS_DIR            /**/
18910 #$i_sysndir I_SYS_NDIR          /**/
18911 #$i_systypes I_SYS_TYPES        /**/
18912
18913 #if defined(I_SYS_TYPES)
18914 #include <sys/types.h>
18915 #endif
18916 #if defined(I_DIRENT)
18917 #include <dirent.h>
18918 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18919 #include <sys/dir.h>
18920 #endif
18921 #else
18922 #ifdef I_SYS_NDIR
18923 #include <sys/ndir.h>
18924 #else
18925 #ifdef I_SYS_DIR
18926 #ifdef hp9000s500
18927 #include <ndir.h>       /* may be wrong in the future */
18928 #else
18929 #include <sys/dir.h>
18930 #endif
18931 #endif
18932 #endif
18933 #endif
18934 int main() { return closedir(opendir(".")); }
18935 EOM
18936         set try
18937         if eval $compile_ok; then
18938                 if $run ./try > /dev/null 2>&1 ; then
18939                         echo "Yes, it does."
18940                         val="$undef"
18941                 else
18942                         echo "No, it doesn't."
18943                         val="$define"
18944                 fi
18945         else
18946                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18947                 val="$define"
18948         fi
18949         ;;
18950 *)
18951         val="$undef";
18952         ;;
18953 esac
18954 set d_void_closedir
18955 eval $setvar
18956 $rm_try
18957
18958 : see if there is a wait4
18959 set wait4 d_wait4
18960 eval $inlibc
18961
18962 : see if waitpid exists
18963 set waitpid d_waitpid
18964 eval $inlibc
18965
18966 : see if wcstombs exists
18967 set wcstombs d_wcstombs
18968 eval $inlibc
18969
18970 : see if wctomb exists
18971 set wctomb d_wctomb
18972 eval $inlibc
18973
18974 : see if writev exists
18975 set writev d_writev
18976 eval $inlibc
18977
18978 : preserve RCS keywords in files with variable substitution, grrr
18979 Date='$Date'
18980 Id='$Id'
18981 Log='$Log'
18982 RCSfile='$RCSfile'
18983 Revision='$Revision'
18984
18985 : check for alignment requirements
18986 echo " "
18987 case "$usecrosscompile$multiarch" in
18988 *$define*)
18989         $cat <<EOM
18990 You seem to be either cross-compiling or doing a multiarchitecture build,
18991 skipping the memory alignment check.
18992
18993 EOM
18994         case "$alignbytes" in
18995         '') alignbytes=8 ;;
18996         esac
18997         ;;
18998 *)
18999         case "$alignbytes" in
19000         '') echo "Checking alignment constraints..." >&4
19001                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19002                         $cat >try.c <<'EOCP'
19003 typedef long double NV;
19004 EOCP
19005                 else
19006                         $cat >try.c <<'EOCP'
19007 typedef double NV;
19008 EOCP
19009                 fi
19010                 $cat >>try.c <<'EOCP'
19011 #include <stdio.h>
19012 struct foobar {
19013         char foo;
19014         NV bar;
19015 } try_algn;
19016 int main()
19017 {
19018     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19019     return(0);
19020 }
19021 EOCP
19022                 set try
19023                 if eval $compile_ok; then
19024                         dflt=`$run ./try`
19025                 else
19026                         dflt='8'
19027                         echo "(I can't seem to compile the test program...)"
19028                 fi
19029                 ;;
19030         *) dflt="$alignbytes"
19031                 ;;
19032         esac
19033         rp="Doubles must be aligned on a how-many-byte boundary?"
19034         . ./myread
19035         alignbytes="$ans"
19036         $rm_try
19037         ;;
19038 esac
19039
19040
19041 : set the base revision
19042 baserev=5.0
19043
19044 : length of character in bytes. Is always 1, otherwise it isnt C
19045 : This used to be a test using sizeof
19046 charsize=1
19047
19048 : Check for the number of bits in a character
19049 case "$charbits" in
19050 '')     echo "Checking how long a character is (in bits)..." >&4
19051         $cat >try.c <<EOCP
19052 #include <stdio.h>
19053 int main ()
19054 {
19055     int n;
19056     unsigned char c;
19057     for (c = 1, n = 0; c; c <<= 1, n++) ;
19058     printf ("%d\n", n);
19059     return (0);
19060     }
19061 EOCP
19062         set try
19063         if eval $compile_ok; then
19064                 dflt=`$run ./try`
19065         else
19066                 dflt='8'
19067                 echo "(I can't seem to compile the test program.  Guessing...)"
19068         fi
19069         ;;
19070 *)
19071         dflt="$charbits"
19072         ;;
19073 esac
19074 rp="What is the length of a character (in bits)?"
19075 . ./myread
19076 charbits="$ans"
19077 $rm_try
19078 case "$charbits" in
19079 8)      ;;
19080 *)      cat >&4 << EOM
19081 Your system has an unsigned character size of $charbits bits, which
19082 is rather unusual (normally it is 8 bits).  Perl likely will not work
19083 correctly on your system, with subtle bugs in various places.
19084 EOM
19085         rp='Do you really want to continue?'
19086         dflt='n'
19087         . ./myread
19088         case "$ans" in
19089                 [yY])   echo >&4 "Okay, continuing."    ;;
19090                 *)      exit 1                          ;;
19091         esac
19092 esac
19093
19094 : how do we concatenate cpp tokens here?
19095 echo " "
19096 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19097 $cat >cpp_stuff.c <<'EOCP'
19098 #define RCAT(a,b)a/**/b
19099 #define ACAT(a,b)a ## b
19100 RCAT(Rei,ser)
19101 ACAT(Cir,cus)
19102 EOCP
19103 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19104 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19105         echo "Oh!  Smells like ANSI's been here." >&4
19106         echo "We can catify or stringify, separately or together!"
19107         cpp_stuff=42
19108 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19109         echo "Ah, yes!  The good old days!" >&4
19110         echo "However, in the good old days we don't know how to stringify and"
19111         echo "catify at the same time."
19112         cpp_stuff=1
19113 else
19114         $cat >&4 <<EOM
19115 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19116 You're going to have to edit the values of CAT[2-5] in config.h...
19117 EOM
19118         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19119 fi
19120 $rm -f cpp_stuff.*
19121
19122 : see if this is a db.h system
19123 set db.h i_db
19124 eval $inhdr
19125
19126 case "$i_db" in
19127 $define)
19128         : Check db version.
19129         echo " "
19130         echo "Checking Berkeley DB version ..." >&4
19131         $cat >try.c <<EOCP
19132 #$d_const HASCONST
19133 #ifndef HASCONST
19134 #define const
19135 #endif
19136 #include <sys/types.h>
19137 #include <stdio.h>
19138 #$i_stdlib I_STDLIB
19139 #ifdef I_STDLIB
19140 #include <stdlib.h>
19141 #endif
19142 #include <db.h>
19143 int main(int argc, char *argv[])
19144 {
19145 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19146     int Major, Minor, Patch ;
19147     unsigned long Version ;
19148     (void)db_version(&Major, &Minor, &Patch) ;
19149     if (argc == 2) {
19150         printf("%d %d %d %d %d %d\n",
19151                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19152                Major, Minor, Patch);
19153         exit(0);
19154     }
19155     printf("You have Berkeley DB Version 2 or greater.\n");
19156
19157     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19158                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19159     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19160                 Major, Minor, Patch) ;
19161
19162     /* check that db.h & libdb are compatible */
19163     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19164         printf("db.h and libdb are incompatible.\n") ;
19165         exit(3);
19166     }
19167
19168     printf("db.h and libdb are compatible.\n") ;
19169
19170     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19171                 + DB_VERSION_PATCH ;
19172
19173     /* needs to be >= 2.3.4 */
19174     if (Version < 2003004) {
19175     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19176         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19177         exit(2);
19178     }
19179
19180     exit(0);
19181 #else
19182 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19183     if (argc == 2) {
19184         printf("1 0 0\n");
19185         exit(0);
19186     }
19187     printf("You have Berkeley DB Version 1.\n");
19188     exit(0);    /* DB version < 2: the coast is clear. */
19189 #else
19190     exit(1);    /* <db.h> not Berkeley DB? */
19191 #endif
19192 #endif
19193 }
19194 EOCP
19195         set try
19196         if eval $compile_ok && $run ./try; then
19197                 echo 'Looks OK.' >&4
19198                 set `$run ./try 1`
19199                 db_version_major=$1
19200                 db_version_minor=$2
19201                 db_version_patch=$3
19202         else
19203                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19204                 i_db=$undef
19205                 case " $libs " in
19206                 *"-ldb "*)
19207                         : Remove db from list of libraries to use
19208                         echo "Removing unusable -ldb from library list" >&4
19209                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19210                         shift
19211                         libs="$*"
19212                         echo "libs = $libs" >&4
19213                         ;;
19214                 esac
19215         fi
19216         $rm_try
19217         ;;
19218 esac
19219
19220 case "$i_db" in
19221 define)
19222         : Check the return type needed for hash
19223         echo " "
19224         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19225         $cat >try.c <<EOCP
19226 #$d_const HASCONST
19227 #ifndef HASCONST
19228 #define const
19229 #endif
19230 #include <sys/types.h>
19231 #include <db.h>
19232
19233 #ifndef DB_VERSION_MAJOR
19234 u_int32_t hash_cb (ptr, size)
19235 const void *ptr;
19236 size_t size;
19237 {
19238 }
19239 HASHINFO info;
19240 int main()
19241 {
19242         info.hash = hash_cb;
19243 }
19244 #endif
19245 EOCP
19246         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19247                 if $contains warning try.out >>/dev/null 2>&1 ; then
19248                         db_hashtype='int'
19249                 else
19250                         db_hashtype='u_int32_t'
19251                 fi
19252         else
19253                 : XXX Maybe we should just give up here.
19254                 db_hashtype=u_int32_t
19255                 $cat try.out >&4
19256                 echo "Help:  I can't seem to compile the db test program." >&4
19257                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19258         fi
19259         $rm_try
19260         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19261         ;;
19262 *)      db_hashtype=u_int32_t
19263         ;;
19264 esac
19265 case "$i_db" in
19266 define)
19267         : Check the return type needed for prefix
19268         echo " "
19269         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19270         cat >try.c <<EOCP
19271 #$d_const HASCONST
19272 #ifndef HASCONST
19273 #define const
19274 #endif
19275 #include <sys/types.h>
19276 #include <db.h>
19277
19278 #ifndef DB_VERSION_MAJOR
19279 size_t prefix_cb (key1, key2)
19280 const DBT *key1;
19281 const DBT *key2;
19282 {
19283 }
19284 BTREEINFO info;
19285 int main()
19286 {
19287         info.prefix = prefix_cb;
19288 }
19289 #endif
19290 EOCP
19291         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19292                 if $contains warning try.out >>/dev/null 2>&1 ; then
19293                         db_prefixtype='int'
19294                 else
19295                         db_prefixtype='size_t'
19296                 fi
19297         else
19298                 db_prefixtype='size_t'
19299                 : XXX Maybe we should just give up here.
19300                 $cat try.out >&4
19301                 echo "Help:  I can't seem to compile the db test program." >&4
19302                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19303         fi
19304         $rm_try
19305         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19306         ;;
19307 *)      db_prefixtype='size_t'
19308         ;;
19309 esac
19310
19311 : How can we generate normalized random numbers ?
19312 echo " "
19313 echo "Looking for a random number function..." >&4
19314 case "$randfunc" in
19315 '')
19316         if set drand48 val -f; eval $csym; $val; then
19317                 dflt="drand48"
19318                 echo "Good, found drand48()." >&4
19319         elif set random val -f; eval $csym; $val; then
19320                 dflt="random"
19321                 echo "OK, found random()." >&4
19322         else
19323                 dflt="rand"
19324                 echo "Yick, looks like I have to use rand()." >&4
19325         fi
19326         echo " "
19327         ;;
19328 *)
19329         dflt="$randfunc"
19330         ;;
19331 esac
19332 cont=true
19333
19334 case "$ccflags" in
19335 *-Dmy_rand=*|*-Dmy_srand=*)
19336         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19337         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19338         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19339         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19340         ;;
19341 esac
19342
19343 while $test "$cont"; do
19344         rp="Use which function to generate random numbers?"
19345         . ./myread
19346         if $test "$ans" = "$dflt"; then
19347                 : null
19348         else
19349                 randbits=''
19350         fi
19351         randfunc="$ans"
19352         if set $ans val -f; eval $csym; $val; then
19353                 cont=''
19354         else
19355                 dflt=y
19356                 rp="I cannot find function $ans. Use that name anyway?"
19357                 . ./myread
19358                 dflt=rand
19359                 case "$ans" in
19360                         [yY]*) cont='';;
19361                 esac
19362         fi
19363         case "$cont" in
19364         '')
19365                 case "$randfunc" in
19366                 drand48)
19367                         drand01="drand48()"
19368                         seedfunc="srand48"
19369                         randbits=48
19370                         randseedtype=long
19371                         ;;
19372                 rand|random)
19373                         case "$randbits" in
19374                         '')
19375 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19376                                 $cat >try.c <<EOCP
19377 #$i_unistd I_UNISTD
19378 #$i_stdlib I_STDLIB
19379 #include <stdio.h>
19380 #ifdef I_UNISTD
19381 #  include <unistd.h>
19382 #endif
19383 #ifdef I_STDLIB
19384 #  include <stdlib.h>
19385 #endif
19386 int main()
19387 {
19388         register int i;
19389         register unsigned long tmp;
19390         register unsigned long max = 0L;
19391
19392         for (i = 1000; i; i--) {
19393                 tmp = (unsigned long) $randfunc();
19394                 if (tmp > max) max = tmp;
19395         }
19396         for (i = 0; max; i++)
19397                 max /= 2;
19398         printf("%d\n",i);
19399 }
19400 EOCP
19401                                 set try
19402                                 if eval $compile_ok; then
19403                                         dflt=`try`
19404                                 else
19405                                         dflt='?'
19406                                         echo "(I can't seem to compile the test program...)"
19407                                 fi
19408                                 ;;
19409                         *)
19410                                 dflt="$randbits"
19411                                 ;;
19412                         esac
19413                         rp="How many bits does your $randfunc() function produce?"
19414                         . ./myread
19415                         randbits="$ans"
19416                         $rm_try
19417                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19418                         seedfunc="s$randfunc"
19419                         randseedtype=unsigned
19420                         ;;
19421                 *)
19422                         dflt="31"
19423                         rp="How many bits does your $randfunc() function produce?"
19424                         . ./myread
19425                         randbits="$ans"
19426                         seedfunc="s$randfunc"
19427                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19428                         if set $seedfunc val -f; eval $csym; $val; then
19429                                 echo "(Using $seedfunc() to seed random generator)"
19430                         else
19431                                 echo "(Warning: no $seedfunc() to seed random generator)"
19432                                 seedfunc=rand
19433                         fi
19434                         randseedtype=unsigned
19435                         ;;
19436                 esac
19437                 ;;
19438         esac
19439 done
19440
19441 : Determine if this is an EBCDIC system
19442 echo " "
19443 echo "Determining whether or not we are on an EBCDIC system..." >&4
19444 $cat >try.c <<'EOM'
19445 int main()
19446 {
19447   if ('M'==0xd4) return 0;
19448   return 1;
19449 }
19450 EOM
19451
19452 val=$undef
19453 set try
19454 if eval $compile_ok; then
19455         if $run ./try; then
19456                 echo "You seem to speak EBCDIC." >&4
19457                 val="$define"
19458         else
19459                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19460         fi
19461 else
19462         echo "I'm unable to compile the test program." >&4
19463         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19464 fi
19465 $rm_try
19466 set ebcdic
19467 eval $setvar
19468
19469 : Check how to flush
19470 echo " "
19471 $cat >&4 <<EOM
19472 Checking how to flush all pending stdio output...
19473 EOM
19474 # I only know how to find the first 32 possibly open files on SunOS.
19475 # See also hints/sunos_4_1.sh and util.c  --AD
19476 case "$osname" in
19477 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19478 esac
19479 $cat >>try.c <<EOCP
19480 #include <stdio.h>
19481 #$i_stdlib I_STDLIB
19482 #ifdef I_STDLIB
19483 #include <stdlib.h>
19484 #endif
19485 #$i_unistd I_UNISTD
19486 #ifdef I_UNISTD
19487 # include <unistd.h>
19488 #endif
19489 #$d_sysconf HAS_SYSCONF
19490 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19491 #ifdef HAS_STDIO_STREAM_ARRAY
19492 # define STDIO_STREAM_ARRAY $stdio_stream_array
19493 #endif
19494 int main() {
19495   FILE* p;
19496   unlink("try.out");
19497   p = fopen("try.out", "w");
19498 #ifdef TRY_FPUTC
19499   fputc('x', p);
19500 #else
19501 # ifdef TRY_FPRINTF
19502   fprintf(p, "x");
19503 # endif
19504 #endif
19505 #ifdef TRY_FFLUSH_NULL
19506   fflush(NULL);
19507 #endif
19508 #ifdef TRY_FFLUSH_ALL
19509   {
19510     long open_max = -1;
19511 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19512     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19513 # else
19514 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19515     open_max = sysconf(_SC_OPEN_MAX);
19516 #  else
19517 #   ifdef FOPEN_MAX
19518     open_max = FOPEN_MAX;
19519 #   else
19520 #    ifdef OPEN_MAX
19521     open_max = OPEN_MAX;
19522 #    else
19523 #     ifdef _NFILE
19524     open_max = _NFILE;
19525 #     endif
19526 #    endif
19527 #   endif
19528 #  endif
19529 # endif
19530 # ifdef HAS_STDIO_STREAM_ARRAY
19531     if (open_max > 0) {
19532       long i;
19533       for (i = 0; i < open_max; i++)
19534             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19535                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19536                 STDIO_STREAM_ARRAY[i]._flag)
19537                 fflush(&STDIO_STREAM_ARRAY[i]);
19538     }
19539   }
19540 # endif
19541 #endif
19542   _exit(42);
19543 }
19544 EOCP
19545 : first we have to find out how _not_ to flush
19546 $to try.c
19547 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19548     output=''
19549     set try -DTRY_FPUTC
19550     if eval $compile; then
19551             $run ./try 2>/dev/null
19552             code="$?"
19553             $from try.out
19554             if $test ! -s try.out -a "X$code" = X42; then
19555                 output=-DTRY_FPUTC
19556             fi
19557     fi
19558     case "$output" in
19559     '')
19560             set try -DTRY_FPRINTF
19561             if eval $compile; then
19562                     $run ./try 2>/dev/null
19563                     code="$?"
19564                     $from try.out
19565                     if $test ! -s try.out -a "X$code" = X42; then
19566                         output=-DTRY_FPRINTF
19567                     fi
19568             fi
19569         ;;
19570     esac
19571 fi
19572 : check for fflush NULL behaviour
19573 case "$fflushNULL" in
19574 '')     set try -DTRY_FFLUSH_NULL $output
19575         if eval $compile; then
19576                 $run ./try 2>/dev/null
19577                 code="$?"
19578                 $from try.out
19579                 if $test -s try.out -a "X$code" = X42; then
19580                         fflushNULL="`$cat try.out`"
19581                 else
19582                         if $test "X$code" != X42; then
19583                                 $cat >&4 <<EOM
19584 (If this test failed, don't worry, we'll try another method shortly.)
19585 EOM
19586                         fi
19587                 fi
19588         fi
19589         $rm -f core try.core core.try.*
19590         case "$fflushNULL" in
19591         x)      $cat >&4 <<EOM
19592 Your fflush(NULL) works okay for output streams.
19593 Let's see if it clobbers input pipes...
19594 EOM
19595 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19596 # bug that improperly flushes the input end of pipes.  So we avoid the
19597 # autoflush on fork/system/exec support for now. :-(
19598 $cat >tryp.c <<EOCP
19599 #include <stdio.h>
19600 int
19601 main(int argc, char **argv)
19602 {
19603     char buf[1024];
19604     int i;
19605     char *bp = buf;
19606     while (1) {
19607         while ((i = getc(stdin)) != -1
19608                && (*bp++ = i) != '\n'
19609                && bp < &buf[1024])
19610         /* DO NOTHING */ ;
19611         *bp = '\0';
19612         fprintf(stdout, "%s", buf);
19613         fflush(NULL);
19614         if (i == -1)
19615             return 0;
19616         bp = buf;
19617     }
19618 }
19619 EOCP
19620                 fflushNULL="$define"
19621                 set tryp
19622                 if eval $compile; then
19623                     $rm -f tryp.out
19624                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19625                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19626                        $cat >&4 <<EOM
19627 fflush(NULL) seems to behave okay with input streams.
19628 EOM
19629                         fflushNULL="$define"
19630                     else
19631                         $cat >&4 <<EOM
19632 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19633 EOM
19634                         fflushNULL="$undef"
19635                     fi
19636                 fi
19637                 $rm -f core tryp.c tryp.core core.tryp.*
19638                 ;;
19639         '')     $cat >&4 <<EOM
19640 Your fflush(NULL) isn't working (contrary to ANSI C).
19641 EOM
19642                 fflushNULL="$undef"
19643                 ;;
19644         *)      $cat >&4 <<EOM
19645 Cannot figure out whether your fflush(NULL) works or not.
19646 I'm assuming it doesn't (contrary to ANSI C).
19647 EOM
19648                 fflushNULL="$undef"
19649                 ;;
19650         esac
19651         ;;
19652 $define|true|[yY]*)
19653         fflushNULL="$define"
19654         ;;
19655 *)
19656         fflushNULL="$undef"
19657         ;;
19658 esac
19659 : check explicit looping only if NULL did not work, and if the pipe
19660 : bug does not show up on an explicit flush too
19661 case "$fflushNULL" in
19662 "$undef")
19663         $cat >tryp.c <<EOCP
19664 #include <stdio.h>
19665 int
19666 main(int argc, char **argv)
19667 {
19668     char buf[1024];
19669     int i;
19670     char *bp = buf;
19671     while (1) {
19672         while ((i = getc(stdin)) != -1
19673                && (*bp++ = i) != '\n'
19674                && bp < &buf[1024])
19675         /* DO NOTHING */ ;
19676         *bp = '\0';
19677         fprintf(stdout, "%s", buf);
19678         fflush(stdin);
19679         if (i == -1)
19680             return 0;
19681         bp = buf;
19682     }
19683 }
19684 EOCP
19685         set tryp
19686         if eval $compile; then
19687             $rm -f tryp.out
19688             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19689             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19690                $cat >&4 <<EOM
19691 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19692 EOM
19693                 : now check for fflushall behaviour
19694                 case "$fflushall" in
19695                 '')     set try -DTRY_FFLUSH_ALL $output
19696                         if eval $compile; then
19697                                 $cat >&4 <<EOM
19698 (Now testing the other method--but note that this also may fail.)
19699 EOM
19700                                 $run ./try 2>/dev/null
19701                                 code=$?
19702                                 $from try.out
19703                                 if $test -s try.out -a "X$code" = X42; then
19704                                         fflushall="`$cat try.out`"
19705                                 fi
19706                         fi
19707                         $rm_try
19708                         case "$fflushall" in
19709                         x)      $cat >&4 <<EOM
19710 Whew. Flushing explicitly all the stdio streams works.
19711 EOM
19712                                 fflushall="$define"
19713                                 ;;
19714                         '')     $cat >&4 <<EOM
19715 Sigh. Flushing explicitly all the stdio streams doesn't work.
19716 EOM
19717                                 fflushall="$undef"
19718                                 ;;
19719                         *)      $cat >&4 <<EOM
19720 Cannot figure out whether flushing stdio streams explicitly works or not.
19721 I'm assuming it doesn't.
19722 EOM
19723                                 fflushall="$undef"
19724                                 ;;
19725                         esac
19726                         ;;
19727                 "$define"|true|[yY]*)
19728                         fflushall="$define"
19729                         ;;
19730                 *)
19731                         fflushall="$undef"
19732                         ;;
19733                 esac
19734             else
19735                 $cat >&4 <<EOM
19736 All is futile.  Even fflush(stdin) clobbers input pipes!
19737 EOM
19738                 fflushall="$undef"
19739             fi
19740         else
19741             fflushall="$undef"
19742         fi
19743         $rm -f core tryp.c tryp.core core.tryp.*
19744         ;;
19745 *)      fflushall="$undef"
19746         ;;
19747 esac
19748
19749 case "$fflushNULL$fflushall" in
19750 undefundef)
19751         $cat <<EOM
19752 OK, I give up.  I cannot figure out how to flush pending stdio output.
19753 We won't be flushing handles at all before fork/exec/popen.
19754 EOM
19755         ;;
19756 esac
19757 $rm_try tryp
19758
19759 : Store the full pathname to the ar program for use in the C program
19760 : Respect a hint or command line value for full_ar.
19761 case "$full_ar" in
19762 '') full_ar=$ar ;;
19763 esac
19764
19765 : Store the full pathname to the sed program for use in the C program
19766 full_sed=$sed
19767
19768 : see what type gids are declared as in the kernel
19769 echo " "
19770 echo "Looking for the type for group ids returned by getgid()."
19771 set gid_t gidtype xxx stdio.h sys/types.h
19772 eval $typedef
19773 case "$gidtype" in
19774 xxx)
19775         xxx=`./findhdr sys/user.h`
19776         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19777         case $1 in
19778         unsigned) dflt="$1 $2" ;;
19779         *) dflt="$1" ;;
19780         esac
19781         ;;
19782 *) dflt="$gidtype";;
19783 esac
19784 case "$gidtype" in
19785 gid_t) echo "gid_t found." ;;
19786 *)      rp="What is the type for group ids returned by getgid()?"
19787         . ./myread
19788         gidtype="$ans"
19789         ;;
19790 esac
19791
19792 : Check the size of GID
19793 echo " "
19794 case "$gidtype" in
19795 *_t) zzz="$gidtype"     ;;
19796 *)   zzz="gid"          ;;
19797 esac
19798 echo "Checking the size of $zzz..." >&4
19799 cat > try.c <<EOCP
19800 #include <sys/types.h>
19801 #include <stdio.h>
19802 #$i_stdlib I_STDLIB
19803 #ifdef I_STDLIB
19804 #include <stdlib.h>
19805 #endif
19806 int main() {
19807     printf("%d\n", (int)sizeof($gidtype));
19808     exit(0);
19809 }
19810 EOCP
19811 set try
19812 if eval $compile_ok; then
19813         yyy=`$run ./try`
19814         case "$yyy" in
19815         '')     gidsize=4
19816                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19817                 ;;
19818         *)      gidsize=$yyy
19819                 echo "Your $zzz is $gidsize bytes long."
19820                 ;;
19821         esac
19822 else
19823         gidsize=4
19824         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19825 fi
19826
19827
19828 : Check if GID is signed
19829 echo " "
19830 case "$gidtype" in
19831 *_t) zzz="$gidtype"     ;;
19832 *)   zzz="gid"          ;;
19833 esac
19834 echo "Checking the sign of $zzz..." >&4
19835 cat > try.c <<EOCP
19836 #include <sys/types.h>
19837 #include <stdio.h>
19838 int main() {
19839         $gidtype foo = -1;
19840         if (foo < 0)
19841                 printf("-1\n");
19842         else
19843                 printf("1\n");
19844 }
19845 EOCP
19846 set try
19847 if eval $compile; then
19848         yyy=`$run ./try`
19849         case "$yyy" in
19850         '')     gidsign=1
19851                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19852                 ;;
19853         *)      gidsign=$yyy
19854                 case "$gidsign" in
19855                  1) echo "Your $zzz is unsigned." ;;
19856                 -1) echo "Your $zzz is signed."   ;;
19857                 esac
19858                 ;;
19859         esac
19860 else
19861         gidsign=1
19862         echo "(I can't compile the test program--guessing unsigned.)" >&4
19863 fi
19864
19865
19866 : Check 64bit sizes
19867 echo " "
19868
19869 if $test X"$quadtype" != X; then
19870
19871 echo "Checking how to print 64-bit integers..." >&4
19872
19873 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19874         $cat >try.c <<'EOCP'
19875 #include <sys/types.h>
19876 #include <stdio.h>
19877 int main() {
19878   int q = 12345678901;
19879   printf("%ld\n", q);
19880 }
19881 EOCP
19882         set try
19883         if eval $compile; then
19884                 yyy=`$run ./try`
19885                 case "$yyy" in
19886                 12345678901)
19887                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19888                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19889                         echo "We will use %d."
19890                         ;;
19891                 esac
19892         fi
19893 fi
19894
19895 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19896         $cat >try.c <<'EOCP'
19897 #include <sys/types.h>
19898 #include <stdio.h>
19899 int main() {
19900   long q = 12345678901;
19901   printf("%ld\n", q);
19902 }
19903 EOCP
19904         set try
19905         if eval $compile; then
19906                 yyy=`$run ./try`
19907                 case "$yyy" in
19908                 12345678901)
19909                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19910                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19911                         echo "We will use %ld."
19912                         ;;
19913                 esac
19914         fi
19915 fi
19916
19917 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19918         $cat >try.c <<'EOCP'
19919 #include <sys/types.h>
19920 #include <inttypes.h>
19921 #include <stdio.h>
19922 int main() {
19923   int64_t q = 12345678901;
19924   printf("%" PRId64 "\n", q);
19925 }
19926 EOCP
19927         set try
19928         if eval $compile; then
19929                 yyy=`$run ./try`
19930                 case "$yyy" in
19931                 12345678901)
19932                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19933                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19934                         echo "We will use the C9X style."
19935                         ;;
19936                 esac
19937         fi
19938 fi
19939
19940 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19941         $cat >try.c <<EOCP
19942 #include <sys/types.h>
19943 #include <stdio.h>
19944 int main() {
19945   $quadtype q = 12345678901;
19946   printf("%Ld\n", q);
19947 }
19948 EOCP
19949         set try
19950         if eval $compile; then
19951                 yyy=`$run ./try`
19952                 case "$yyy" in
19953                 12345678901)
19954                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19955                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19956                         echo "We will use %Ld."
19957                         ;;
19958                 esac
19959         fi
19960 fi
19961
19962 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19963         $cat >try.c <<'EOCP'
19964 #include <sys/types.h>
19965 #include <stdio.h>
19966 int main() {
19967   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19968   printf("%lld\n", q);
19969 }
19970 EOCP
19971         set try
19972         if eval $compile; then
19973                 yyy=`$run ./try`
19974                 case "$yyy" in
19975                 12345678901)
19976                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19977                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19978                         echo "We will use the %lld style."
19979                         ;;
19980                 esac
19981         fi
19982 fi
19983
19984 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19985         $cat >try.c <<EOCP
19986 #include <sys/types.h>
19987 #include <stdio.h>
19988 int main() {
19989   $quadtype q = 12345678901;
19990   printf("%qd\n", q);
19991 }
19992 EOCP
19993         set try
19994         if eval $compile; then
19995                 yyy=`$run ./try`
19996                 case "$yyy" in
19997                 12345678901)
19998                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19999                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20000                         echo "We will use %qd."
20001                         ;;
20002                 esac
20003         fi
20004 fi
20005
20006 if $test X"$sPRId64" = X; then
20007         echo "Cannot figure out how to print 64-bit integers." >&4
20008 fi
20009 $rm_try
20010
20011 fi
20012
20013 case "$sPRId64" in
20014 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20015         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20016         ;;
20017 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20018         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20019         ;;
20020 esac
20021
20022 : Check format strings for internal types
20023 echo " "
20024 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20025
20026 if $test X"$ivsize" = X8; then
20027         ivdformat="$sPRId64"
20028         uvuformat="$sPRIu64"
20029         uvoformat="$sPRIo64"
20030         uvxformat="$sPRIx64"
20031         uvXUformat="$sPRIXU64"
20032 else
20033         if $test X"$ivsize" = X"$longsize"; then
20034                 ivdformat='"ld"'
20035                 uvuformat='"lu"'
20036                 uvoformat='"lo"'
20037                 uvxformat='"lx"'
20038                 uvXUformat='"lX"'
20039         else
20040                 if $test X"$ivsize" = X"$intsize"; then
20041                         ivdformat='"d"'
20042                         uvuformat='"u"'
20043                         uvoformat='"o"'
20044                         uvxformat='"x"'
20045                         uvXUformat='"X"'
20046                 else
20047                         : far out
20048                         if $test X"$ivsize" = X"$shortsize"; then
20049                                 ivdformat='"hd"'
20050                                 uvuformat='"hu"'
20051                                 uvoformat='"ho"'
20052                                 uvxformat='"hx"'
20053                                 uvXUformat='"hX"'
20054                         fi
20055                 fi
20056         fi
20057 fi
20058
20059 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20060         nveformat="$sPRIeldbl"
20061         nvfformat="$sPRIfldbl"
20062         nvgformat="$sPRIgldbl"
20063         nvEUformat="$sPRIEUldbl"
20064         nvFUformat="$sPRIFUldbl"
20065         nvGUformat="$sPRIGUldbl"
20066 else
20067         nveformat='"e"'
20068         nvfformat='"f"'
20069         nvgformat='"g"'
20070         nvEUformat='"E"'
20071         nvFUformat='"F"'
20072         nvGUformat='"G"'
20073 fi
20074
20075 case "$ivdformat" in
20076 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20077     exit 1
20078     ;;
20079 esac
20080
20081 : Check format string for GID
20082
20083 echo " "
20084 $echo "Checking the format string to be used for gids..." >&4
20085
20086 case "$gidsign" in
20087 -1)     if $test X"$gidsize" = X"$ivsize"; then
20088                 gidformat="$ivdformat"
20089         else
20090                 if $test X"$gidsize" = X"$longsize"; then
20091                         gidformat='"ld"'
20092                 else
20093                         if $test X"$gidsize" = X"$intsize"; then
20094                                 gidformat='"d"'
20095                         else
20096                                 if $test X"$gidsize" = X"$shortsize"; then
20097                                         gidformat='"hd"'
20098                                 fi
20099                         fi
20100                 fi
20101         fi
20102         ;;
20103 *)      if $test X"$gidsize" = X"$uvsize"; then
20104                 gidformat="$uvuformat"
20105         else
20106                 if $test X"$gidsize" = X"$longsize"; then
20107                         gidformat='"lu"'
20108                 else
20109                         if $test X"$gidsize" = X"$intsize"; then
20110                                 gidformat='"u"'
20111                         else
20112                                 if $test X"$gidsize" = X"$shortsize"; then
20113                                         gidformat='"hu"'
20114                                 fi
20115                         fi
20116                 fi
20117         fi
20118         ;;
20119 esac
20120
20121 : see if getgroups exists
20122 set getgroups d_getgrps
20123 eval $inlibc
20124
20125 : see if setgroups exists
20126 set setgroups d_setgrps
20127 eval $inlibc
20128
20129 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20130 echo " "
20131 case "$d_getgrps$d_setgrps" in
20132 *define*)
20133         case "$groupstype" in
20134         '') dflt="$gidtype" ;;
20135         *)  dflt="$groupstype" ;;
20136         esac
20137         $cat <<EOM
20138 What type of pointer is the second argument to getgroups() and setgroups()?
20139 Usually this is the same as group ids, $gidtype, but not always.
20140
20141 EOM
20142         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20143         . ./myread
20144         groupstype="$ans"
20145         ;;
20146 *)  groupstype="$gidtype";;
20147 esac
20148
20149 : MAD = Misc Attribute Definition
20150
20151 if $test $patchlevel -lt 9; then
20152 : MAD is not available in 5.8.x or earlier.
20153     ans=n;
20154 else
20155     case "$mad" in
20156     $define|true|[yY]*) dflt='y' ;;
20157     *)                  dflt='n' ;;
20158     esac
20159     cat <<EOM
20160
20161 Would you like to build with Misc Attribute Decoration? This is development
20162 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20163 overhead on the interpreter.
20164
20165 If this doesn't make any sense to you, just accept the default '$dflt'.
20166 EOM
20167     rp='Build Perl with MAD?'
20168     . ./myread
20169 fi
20170 case "$ans" in
20171 y|Y)    val="$define"
20172         madlyh='madly.h madly.act madly.tab'
20173         madlysrc='madly.c'
20174         madlyobj="madly$_o" ;;
20175 *)      val="$undef"
20176         madlyh=''
20177         madlysrc=''
20178         madlyobj='' ;;
20179 esac
20180 set mad
20181 eval $setvar
20182
20183 : check whether make sets MAKE
20184 echo " "
20185 echo "Checking if your $make program sets \$(MAKE)..." >&4
20186 case "$make_set_make" in
20187 '')
20188         $sed 's/^X //' > testmake.mak << 'EOF'
20189 Xall:
20190 X       @echo 'maketemp="$(MAKE)"'
20191 EOF
20192         case "`$make -f testmake.mak 2>/dev/null`" in
20193         *maketemp=*) make_set_make='#' ;;
20194         *)      make_set_make="MAKE=$make" ;;
20195         esac
20196         $rm -f testmake.mak
20197         ;;
20198 esac
20199 case "$make_set_make" in
20200 '#') echo "Yup, it does.";;
20201 *) echo "Nope, it doesn't.";;
20202 esac
20203
20204 : see what type is used for mode_t
20205 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20206 set mode_t modetype int stdio.h sys/types.h
20207 eval $typedef_ask
20208
20209 : see if we need va_copy
20210 echo " "
20211 case "$i_stdarg" in
20212 "$define")
20213         $cat >try.c <<EOCP
20214 #include <stdarg.h>
20215 #include <stdio.h>
20216 #$i_stdlib I_STDLIB
20217 #ifdef I_STDLIB
20218 #include <stdlib.h>
20219 #endif
20220 #include <signal.h>
20221
20222 int
20223 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20224 {
20225   return vfprintf(f, fmt, *valp);
20226 }
20227
20228 int
20229 myvfprintf(FILE *f, const  char *fmt, va_list val)
20230 {
20231   return ivfprintf(f, fmt, &val);
20232 }
20233
20234 int
20235 myprintf(char *fmt, ...)
20236 {
20237   va_list val;
20238   va_start(val, fmt);
20239   return myvfprintf(stdout, fmt, val);
20240 }
20241
20242 int
20243 main(int ac, char **av)
20244 {
20245   signal(SIGSEGV, exit);
20246
20247   myprintf("%s%cs all right, then\n", "that", '\'');
20248   exit(0);
20249 }
20250 EOCP
20251         set try
20252         if eval $compile && $run ./try 2>&1 >/dev/null; then
20253                 case "`$run ./try`" in
20254                 "that's all right, then")
20255                         okay=yes
20256                         ;;
20257                 esac
20258         fi
20259         case "$okay" in
20260         yes)    echo "It seems that you don't need va_copy()." >&4
20261                 need_va_copy="$undef"
20262                 ;;
20263         *)      echo "It seems that va_copy() or similar will be needed." >&4
20264                 need_va_copy="$define"
20265                 ;;
20266         esac
20267         $rm_try
20268         ;;
20269 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20270         ;;
20271 esac
20272
20273 : see what type is used for size_t
20274 rp="What is the type used for the length parameter for string functions?"
20275 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20276 eval $typedef_ask
20277
20278 : check for type of arguments to gethostbyaddr. 
20279 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20280         case "$d_gethbyaddr" in
20281         $define)
20282                 $cat <<EOM
20283
20284 Checking to see what type of arguments are accepted by gethostbyaddr().
20285 EOM
20286                 hdrs="$define sys/types.h
20287                         $d_socket sys/socket.h 
20288                         $i_niin netinet/in.h 
20289                         $i_netdb netdb.h
20290                         $i_unistd unistd.h"
20291                 : The first arg can 'char *' or 'void *'
20292                 : The second arg is some of integral type
20293                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20294                         for yyy in size_t long int; do
20295                                 case "$netdb_host_type" in
20296                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20297                                         if ./protochk "$try" $hdrs; then
20298                                                 echo "Your system accepts $xxx for the first arg."
20299                                                 echo "...and $yyy for the second arg."
20300                                                 netdb_host_type="$xxx"
20301                                                 netdb_hlen_type="$yyy"
20302                                         fi
20303                                         ;;
20304                                 esac
20305                         done
20306                 done
20307                 : In case none of those worked, prompt the user.
20308                 case "$netdb_host_type" in
20309                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20310                         dflt='char *'
20311                         . ./myread
20312                         netdb_host_type=$ans
20313                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20314                         dflt="$sizetype"
20315                         . ./myread
20316                         netdb_hlen_type=$ans
20317                         ;;
20318                 esac
20319                 ;;
20320         *)      : no gethostbyaddr, so pick harmless defaults
20321                 netdb_host_type='char *'
20322                 netdb_hlen_type="$sizetype"
20323                 ;;
20324         esac
20325         # Remove the "const" if needed. -- but then we'll have a 
20326         # prototype clash!
20327         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20328 fi
20329
20330 : check for type of argument to gethostbyname. 
20331 if test "X$netdb_name_type" = X ; then
20332         case "$d_gethbyname" in
20333         $define)
20334                 $cat <<EOM
20335
20336 Checking to see what type of argument is accepted by gethostbyname().
20337 EOM
20338                 hdrs="$define sys/types.h
20339                         $d_socket sys/socket.h 
20340                         $i_niin netinet/in.h 
20341                         $i_netdb netdb.h
20342                         $i_unistd unistd.h"
20343                 for xxx in "const char *" "char *"; do
20344                         case "$netdb_name_type" in
20345                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20346                                 if ./protochk "$try" $hdrs; then
20347                                         echo "Your system accepts $xxx."
20348                                         netdb_name_type="$xxx"
20349                                 fi
20350                                 ;;
20351                         esac
20352                 done
20353                 : In case none of those worked, prompt the user.
20354                 case "$netdb_name_type" in
20355                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20356                         dflt='char *'
20357                         . ./myread
20358                         netdb_name_type=$ans
20359                         ;;
20360                 esac
20361                 ;;
20362         *)      : no gethostbyname, so pick harmless default
20363                 netdb_name_type='char *'
20364                 ;;
20365         esac
20366 fi
20367
20368 : check for type of 1st argument to getnetbyaddr. 
20369 if test "X$netdb_net_type" = X ; then
20370         case "$d_getnbyaddr" in
20371         $define)
20372                 $cat <<EOM
20373
20374 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20375 EOM
20376                 hdrs="$define sys/types.h
20377                         $d_socket sys/socket.h 
20378                         $i_niin netinet/in.h 
20379                         $i_netdb netdb.h
20380                         $i_unistd unistd.h"
20381                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20382                         case "$netdb_net_type" in
20383                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20384                                 if ./protochk "$try" $hdrs; then
20385                                         echo "Your system accepts $xxx."
20386                                         netdb_net_type="$xxx"
20387                                 fi
20388                                 ;;
20389                         esac
20390                 done
20391                 : In case none of those worked, prompt the user.
20392                 case "$netdb_net_type" in
20393                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20394                         dflt='long'
20395                         . ./myread
20396                         netdb_net_type=$ans
20397                         ;;
20398                 esac
20399                 ;;
20400         *)      : no getnetbyaddr, so pick harmless default
20401                 netdb_net_type='long'
20402                 ;;
20403         esac
20404 fi
20405 : locate the preferred pager for this system
20406 fn=f/
20407 case "$pager" in
20408 '')
20409         dflt=''
20410         case "$pg" in
20411         /*) dflt=$pg;;
20412         [a-zA-Z]:/*) dflt=$pg;;
20413         esac
20414         case "$more" in
20415         /*) dflt=$more;;
20416         [a-zA-Z]:/*) dflt=$more;;
20417         esac
20418         case "$less" in
20419         /*) dflt=$less;;
20420         [a-zA-Z]:/*) dflt=$less;;
20421         esac
20422         case "$dflt" in
20423         '') dflt=/usr/ucb/more;;
20424         esac
20425         ;;
20426 *)      dflt="$pager"
20427         fn="f/($pager)"
20428         ;;
20429 esac
20430 echo " "
20431 rp='What pager is used on your system?'
20432 . ./getfile
20433 pager="$ans"
20434
20435 : see what type pids are declared as in the kernel
20436 rp="What is the type of process ids on this system?"
20437 set pid_t pidtype int stdio.h sys/types.h
20438 eval $typedef_ask
20439
20440 : see if ar generates random libraries by itself
20441 echo " "
20442 echo "Checking how to generate random libraries on your machine..." >&4
20443 echo 'int bar1() { return bar2(); }' > bar1.c
20444 echo 'int bar2() { return 2; }' > bar2.c
20445 $cat > foo.c <<EOP
20446 #$i_stdlib I_STDLIB
20447 #ifdef I_STDLIB
20448 #include <stdlib.h>
20449 #endif
20450 int main() { printf("%d\n", bar1()); exit(0); }
20451 EOP
20452 $cc $ccflags -c bar1.c >/dev/null 2>&1
20453 $cc $ccflags -c bar2.c >/dev/null 2>&1
20454 $cc $ccflags -c foo.c >/dev/null 2>&1
20455 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20456 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20457         $run ./foobar >/dev/null 2>&1; then
20458         echo "$ar appears to generate random libraries itself."
20459         orderlib=false
20460         if [ "X$ranlib" = "X" ]; then
20461             ranlib=":"
20462         fi
20463 elif $ar s bar$_a >/dev/null 2>&1 &&
20464         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20465         $run ./foobar >/dev/null 2>&1; then
20466                 echo "a table of contents needs to be added with '$ar s'."
20467                 orderlib=false
20468                 ranlib="$ar s"
20469 elif $ar ts bar$_a >/dev/null 2>&1 &&
20470         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20471         $run ./foobar >/dev/null 2>&1; then
20472                 echo "a table of contents needs to be added with '$ar ts'."
20473                 orderlib=false
20474                 ranlib="$ar ts"
20475 else
20476         case "$ranlib" in
20477         :) ranlib='';;
20478         '')
20479                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20480                 $test -f $ranlib || ranlib=''
20481                 ;;
20482         esac
20483         if $test -n "$ranlib"; then
20484                 echo "your system has '$ranlib'; we'll use that."
20485                 orderlib=false
20486         else
20487                 echo "your system doesn't seem to support random libraries"
20488                 echo "so we'll use lorder and tsort to order the libraries."
20489                 orderlib=true
20490                 ranlib=":"
20491         fi
20492 fi
20493 $rm -f foo* bar*
20494
20495 : see if this is a values.h system
20496 set values.h i_values
20497 eval $inhdr
20498
20499 : Check the max offset that gmtime and localtime accept
20500 echo "Checking max offsets that gmtime () accepts"
20501
20502 case $i_values in
20503     define) yyy="#include <values.h>" ;;
20504     *)      yyy="" ;;
20505     esac
20506
20507 case "$sGMTIME_min/$sGMTIME_max" in
20508     0/0|/)
20509         $cat >try.c <<EOCP
20510 #include <sys/types.h>
20511 #include <stdio.h>
20512 #include <time.h>
20513 $yyy
20514
20515 int i;
20516 struct tm *tmp;
20517 time_t pt;
20518
20519 void gm_check (time_t t, int min_year, int max_year)
20520 {
20521     tmp = gmtime (&t);
20522     if ( tmp == NULL ||
20523         /* Check tm_year overflow */
20524          tmp->tm_year < min_year || tmp->tm_year > max_year)
20525         tmp = NULL;
20526     else
20527         pt = t;
20528     } /* gm_check */
20529
20530 int check_max ()
20531 {
20532     tmp = NULL;
20533     pt  = 0;
20534 #ifdef MAXLONG
20535     gm_check (MAXLONG, 69, 0x7fffffff);
20536 #endif
20537     if (tmp == NULL || tmp->tm_year < 0) {
20538         for (i = 63; i >= 0; i--) {
20539             time_t x = pt | ((time_t)1 << i);
20540             if (x < 0 || x < pt) continue;
20541             gm_check (x, 69, 0x7fffffff);
20542             }
20543         }
20544     printf ("sGMTIME_max=%ld\n", pt);
20545     return (0);
20546     } /* check_max */
20547
20548 int check_min ()
20549 {
20550     tmp = NULL;
20551     pt  = 0;
20552 #ifdef MINLONG
20553     gm_check (MINLONG, -1900, 70);
20554 #endif
20555     if (tmp == NULL) {
20556         for (i = 36; i >= 0; i--) {
20557             time_t x = pt - ((time_t)1 << i);
20558             if (x > 0) continue;
20559             gm_check (x, -1900, 70);
20560             }
20561         }
20562     printf ("sGMTIME_min=%ld\n", pt);
20563     return (0);
20564     } /* check_min */
20565
20566 int main (int argc, char *argv[])
20567 {
20568     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20569     check_max ();
20570     check_min ();
20571     return (0);
20572     } /* main */
20573 EOCP
20574         set try
20575         if eval $compile; then
20576             eval `$run ./try`
20577         else
20578             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20579             fi
20580         $rm_try
20581         ;;
20582     esac
20583
20584 echo "Checking max offsets that localtime () accepts"
20585
20586 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20587     0/0|/)
20588         $cat >try.c <<EOCP
20589 #include <sys/types.h>
20590 #include <stdio.h>
20591 #include <time.h>
20592 $yyy
20593
20594 int i;
20595 struct tm *tmp;
20596 time_t pt;
20597
20598 void local_check (time_t t, int min_year, int max_year)
20599 {
20600     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20601         tmp = NULL;
20602     else
20603         tmp = localtime (&t);
20604     if ( tmp == NULL ||
20605         /* Check tm_year overflow */
20606          tmp->tm_year < min_year || tmp->tm_year > max_year)
20607         tmp = NULL;
20608     else
20609         pt = t;
20610     } /* local_check */
20611
20612 int check_max ()
20613 {
20614     tmp = NULL;
20615     pt  = 0;
20616 #ifdef MAXLONG
20617     local_check (MAXLONG, 69, 0x7fffffff);
20618 #endif
20619     if (tmp == NULL || tmp->tm_year < 0) {
20620         for (i = 63; i >= 0; i--) {
20621             time_t x = pt | ((time_t)1 << i);
20622             if (x < 0 || x < pt) continue;
20623             local_check (x, 69, 0x7fffffff);
20624             }
20625         }
20626     printf ("sLOCALTIME_max=%ld\n", pt);
20627     return (0);
20628    } /* check_max */
20629
20630 int check_min ()
20631 {
20632     tmp = NULL;
20633     pt  = 0;
20634 #ifdef MINLONG
20635     local_check (MINLONG, -1900, 70);
20636 #endif
20637     if (tmp == NULL) {
20638         for (i = 36; i >= 0; i--) {
20639             time_t x = pt - ((time_t)1 << i);
20640             if (x > 0) continue;
20641             local_check (x, -1900, 70);
20642             }
20643         }
20644     printf ("sLOCALTIME_min=%ld\n", pt);
20645     return (0);
20646     } /* check_min */
20647
20648 int main (int argc, char *argv[])
20649 {
20650     check_max ();
20651     check_min ();
20652     return (0);
20653     } /* main */
20654 EOCP
20655         set try
20656         if eval $compile; then
20657             eval `$run ./try`
20658         else
20659             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20660             fi
20661         $rm_try
20662         ;;
20663     esac
20664
20665 : check for type of arguments to select.
20666 case "$selecttype" in
20667 '') case "$d_select" in
20668         $define)
20669                 echo " "
20670                 $cat <<EOM
20671 Checking to see what type of arguments are accepted by select().
20672 EOM
20673                 hdrs="$define sys/types.h
20674                         $i_systime sys/time.h
20675                         $i_sysselct sys/select.h
20676                         $d_socket sys/socket.h"
20677                 : The first arg can be int, unsigned, or size_t
20678                 : The last arg may or may not be 'const'
20679                 val=''
20680                 : void pointer has been seen but using that
20681                 : breaks the selectminbits test
20682                 for xxx in 'fd_set *' 'int *'; do
20683                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20684                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20685                                         case "$val" in
20686                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20687                                                 if ./protochk "$try" $hdrs; then
20688                                                         echo "Your system accepts $xxx."
20689                                                         val="$xxx"
20690                                                 fi
20691                                                 ;;
20692                                         esac
20693                                 done
20694                         done
20695                 done
20696                 case "$val" in
20697                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20698                         case "$d_fd_set" in
20699                                 $define) dflt="fd_set *" ;;
20700                                 *)              dflt="int *" ;;
20701                         esac
20702                         . ./myread
20703                         val=$ans
20704                         ;;
20705                 esac
20706                 selecttype="$val"
20707                 ;;
20708         *)      : no select, so pick a harmless default
20709                 selecttype='int *'
20710                 ;;
20711         esac
20712         ;;
20713 esac
20714
20715 : check for the select 'width'
20716 case "$selectminbits" in
20717 '') safebits=`expr $ptrsize \* 8`
20718     case "$d_select" in
20719         $define)
20720                 $cat <<EOM
20721
20722 Checking to see on how many bits at a time your select() operates...
20723 EOM
20724                 $cat >try.c <<EOCP
20725 #include <sys/types.h>
20726 #$i_time I_TIME
20727 #$i_systime I_SYS_TIME
20728 #$i_systimek I_SYS_TIME_KERNEL
20729 #ifdef I_TIME
20730 #   include <time.h>
20731 #endif
20732 #ifdef I_SYS_TIME
20733 #   ifdef I_SYS_TIME_KERNEL
20734 #       define KERNEL
20735 #   endif
20736 #   include <sys/time.h>
20737 #   ifdef I_SYS_TIME_KERNEL
20738 #       undef KERNEL
20739 #   endif
20740 #endif
20741 #$i_sysselct I_SYS_SELECT
20742 #ifdef I_SYS_SELECT
20743 #include <sys/select.h>
20744 #endif
20745 #$d_socket HAS_SOCKET
20746 #ifdef HAS_SOCKET
20747 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20748 #endif
20749 #include <stdio.h>
20750 #$i_stdlib I_STDLIB
20751 #ifdef I_STDLIB
20752 #include <stdlib.h>
20753 #endif
20754 $selecttype b;
20755 #define S sizeof(*(b))
20756 #define MINBITS 64
20757 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20758 #define NBITS  (NBYTES * 8)
20759 int main() {
20760     char *s = (char *)malloc(NBYTES);
20761     struct timeval t;
20762     int i;
20763     FILE* fp;
20764     int fd;
20765
20766     if (!s)
20767         exit(1);
20768     fclose(stdin);
20769     fp = fopen("try.c", "r");
20770     if (fp == 0)
20771       exit(2);
20772     fd = fileno(fp);
20773     if (fd < 0)
20774       exit(3);
20775     b = ($selecttype)s;
20776     for (i = 0; i < NBITS; i++)
20777         FD_SET(i, b);
20778     t.tv_sec  = 0;
20779     t.tv_usec = 0;
20780     select(fd + 1, b, 0, 0, &t);
20781     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20782     free(s);
20783     printf("%d\n", i + 1);
20784     return 0;
20785 }
20786 EOCP
20787                 set try
20788                 if eval $compile_ok; then
20789                         selectminbits=`$run ./try`
20790                         case "$selectminbits" in
20791                         '')     cat >&4 <<EOM
20792 Cannot figure out on how many bits at a time your select() operates.
20793 I'll play safe and guess it is $safebits bits.
20794 EOM
20795                                 selectminbits=$safebits
20796                                 bits="$safebits bits"
20797                                 ;;
20798                         1)      bits="1 bit" ;;
20799                         *)      bits="$selectminbits bits" ;;
20800                         esac
20801                         echo "Your select() operates on $bits at a time." >&4
20802                 else
20803                         rp='What is the minimum number of bits your select() operates on?'
20804                         case "$byteorder" in
20805                         12345678)       dflt=64 ;;
20806                         1234)           dflt=32 ;;
20807                         *)              dflt=1  ;;
20808                         esac
20809                         . ./myread
20810                         val=$ans
20811                         selectminbits="$val"
20812                 fi
20813                 $rm_try
20814                 ;;
20815         *)      : no select, so pick a harmless default
20816                 selectminbits=$safebits
20817                 ;;
20818         esac
20819         ;;
20820 esac
20821
20822 : Trace out the files included by signal.h, then look for SIGxxx names.
20823 if [ "X$fieldn" = X ]; then
20824         : Just make some guesses.  We check them later.
20825         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20826 else
20827         xxx=`echo '#include <signal.h>' |
20828         $cppstdin $cppminus $cppflags 2>/dev/null |
20829         $grep '^[       ]*#.*include' |
20830         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20831                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20832 fi
20833 xxxfiles=''
20834 for xx in $xxx /dev/null ; do
20835         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20836 done
20837 case "$xxxfiles" in
20838 '')     xxxfiles=`./findhdr signal.h` ;;
20839 esac
20840 xxx=`awk '
20841 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20842         print substr($2, 4, 20)
20843 }
20844 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20845         print substr($3, 4, 20)
20846 }' $xxxfiles`
20847 : Append some common names just in case the awk scan failed.
20848 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20849 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20850 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20851 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20852 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20853
20854 : generate a few handy files for later
20855 $cat > signal.c <<EOCP
20856 #include <sys/types.h>
20857 #include <signal.h>
20858 #$i_stdlib I_STDLIB
20859 #ifdef I_STDLIB
20860 #include <stdlib.h>
20861 #endif
20862 #include <stdio.h>
20863 int main() {
20864
20865 /* Strange style to avoid deeply-nested #if/#else/#endif */
20866 #ifndef NSIG
20867 #  ifdef _NSIG
20868 #    define NSIG (_NSIG)
20869 #  endif
20870 #endif
20871
20872 #ifndef NSIG
20873 #  ifdef SIGMAX
20874 #    define NSIG (SIGMAX+1)
20875 #  endif
20876 #endif
20877
20878 #ifndef NSIG
20879 #  ifdef SIG_MAX
20880 #    define NSIG (SIG_MAX+1)
20881 #  endif
20882 #endif
20883
20884 #ifndef NSIG
20885 #  ifdef _SIG_MAX
20886 #    define NSIG (_SIG_MAX+1)
20887 #  endif
20888 #endif
20889
20890 #ifndef NSIG
20891 #  ifdef MAXSIG
20892 #    define NSIG (MAXSIG+1)
20893 #  endif
20894 #endif
20895
20896 #ifndef NSIG
20897 #  ifdef MAX_SIG
20898 #    define NSIG (MAX_SIG+1)
20899 #  endif
20900 #endif
20901
20902 #ifndef NSIG
20903 #  ifdef SIGARRAYSIZE
20904 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20905 #  endif
20906 #endif
20907
20908 #ifndef NSIG
20909 #  ifdef _sys_nsig
20910 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20911 #  endif
20912 #endif
20913
20914 /* Default to some arbitrary number that's big enough to get most
20915    of the common signals.
20916 */
20917 #ifndef NSIG
20918 #    define NSIG 50
20919 #endif
20920
20921 printf("NSIG %d\n", NSIG);
20922
20923 #ifndef JUST_NSIG
20924
20925 EOCP
20926
20927 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20928 {
20929         printf "#ifdef SIG"; printf $1; printf "\n"
20930         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20931         printf $1; printf ");\n"
20932         printf "#endif\n"
20933 }
20934 END {
20935         printf "#endif /* JUST_NSIG */\n";
20936         printf "exit(0);\n}\n";
20937 }
20938 ' >>signal.c
20939 $cat >signal.awk <<'EOP'
20940 BEGIN { ndups = 0 }
20941 $1 ~ /^NSIG$/ { nsig = $2 }
20942 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20943     if ($2 > maxsig) { maxsig = $2 }
20944     if (sig_name[$2]) {
20945         dup_name[ndups] = $1
20946         dup_num[ndups] = $2
20947         ndups++
20948     }
20949     else {
20950         sig_name[$2] = $1
20951         sig_num[$2] = $2
20952     }
20953 }
20954 END {
20955     if (nsig == 0) {
20956         nsig = maxsig + 1
20957     }
20958     printf("NSIG %d\n", nsig);
20959     for (n = 1; n < nsig; n++) {
20960         if (sig_name[n]) {
20961             printf("%s %d\n", sig_name[n], sig_num[n])
20962         }
20963         else {
20964             printf("NUM%d %d\n", n, n)
20965         }
20966     }
20967     for (n = 0; n < ndups; n++) {
20968         printf("%s %d\n", dup_name[n], dup_num[n])
20969     }
20970 }
20971 EOP
20972 $cat >signal_cmd <<EOS
20973 $startsh
20974 if $test -s signal.lst; then
20975     echo "Using your existing signal.lst file"
20976         exit 0
20977 fi
20978 xxx="$xxx"
20979 EOS
20980 $cat >>signal_cmd <<'EOS'
20981
20982 set signal
20983 if eval $compile_ok; then
20984         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20985                 $uniq | $awk -f signal.awk >signal.lst
20986 else
20987         echo "(I can't seem be able to compile the whole test program)" >&4
20988         echo "(I'll try it in little pieces.)" >&4
20989         set signal -DJUST_NSIG
20990         if eval $compile_ok; then
20991                 $run ./signal$_exe > signal.nsg
20992                 $cat signal.nsg
20993         else
20994                 echo "I can't seem to figure out how many signals you have." >&4
20995                 echo "Guessing 50." >&4
20996                 echo 'NSIG 50' > signal.nsg
20997         fi
20998         : Now look at all the signal names, one at a time.
20999         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21000                 $cat > signal.c <<EOCP
21001 #include <sys/types.h>
21002 #include <signal.h>
21003 #include <stdio.h>
21004 int main() {
21005 printf("$xx %d\n", SIG${xx});
21006 return 0;
21007 }
21008 EOCP
21009                 set signal
21010                 if eval $compile; then
21011                         echo "SIG${xx} found."
21012                         $run ./signal$_exe  >> signal.ls1
21013                 else
21014                         echo "SIG${xx} NOT found."
21015                 fi
21016         done
21017         if $test -s signal.ls1; then
21018                 $cat signal.nsg signal.ls1 |
21019                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21020         fi
21021
21022 fi
21023 if $test -s signal.lst; then
21024         :
21025 else
21026         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21027         echo 'kill -l' >signal
21028         set X `csh -f <signal`
21029         $rm -f signal
21030         shift
21031         case $# in
21032         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21033         esac
21034         echo $@ | $tr ' ' $trnl | \
21035             $awk '{ printf "%s %d\n", $1, ++s; }
21036                   END { printf "NSIG %d\n", ++s }' >signal.lst
21037 fi
21038 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21039 EOS
21040 chmod a+x signal_cmd
21041 $eunicefix signal_cmd
21042
21043 : generate list of signal names
21044 echo " "
21045 case "$sig_name_init" in
21046 '') doinit=yes ;;
21047 *)  case "$sig_num_init" in
21048     ''|*,*) doinit=yes ;;
21049     esac ;;
21050 esac
21051 case "$doinit" in
21052 yes)
21053         echo "Generating a list of signal names and numbers..." >&4
21054         . ./signal_cmd
21055         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21056         sig_name=`$awk 'BEGIN { printf "ZERO " }
21057                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21058         sig_num=`$awk  'BEGIN { printf "0 " }
21059                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21060         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21061                              !/^NSIG/   { printf "\"%s\", ", $1 }
21062                              END        { printf "0\n" }' signal.lst`
21063         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21064                              !/^NSIG/   { printf "%d, ", $2}
21065                              END        { printf "0\n"}' signal.lst`
21066         ;;
21067 esac
21068 echo "The following $sig_count signals are available:"
21069 echo " "
21070 echo $sig_name | $awk \
21071 'BEGIN { linelen = 0 }
21072 {
21073         for (i = 1; i <= NF; i++) {
21074                 name = "SIG" $i " "
21075                 linelen = linelen + length(name)
21076                 if (linelen > 70) {
21077                         printf "\n"
21078                         linelen = length(name)
21079                 }
21080                 printf "%s", name
21081         }
21082         printf "\n"
21083 }'
21084 sig_size=`echo $sig_name | awk '{print NF}'`
21085 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21086
21087 : Check size of size
21088 echo " "
21089 case "$sizetype" in
21090 *_t) zzz="$sizetype"    ;;
21091 *)   zzz="filesize"     ;;
21092 esac
21093 echo "Checking the size of $zzz..." >&4
21094 cat > try.c <<EOCP
21095 #include <sys/types.h>
21096 #include <stdio.h>
21097 #$i_stdlib I_STDLIB
21098 #ifdef I_STDLIB
21099 #include <stdlib.h>
21100 #endif
21101 int main() {
21102     printf("%d\n", (int)sizeof($sizetype));
21103     exit(0);
21104 }
21105 EOCP
21106 set try
21107 if eval $compile_ok; then
21108         yyy=`$run ./try`
21109         case "$yyy" in
21110         '')     sizesize=4
21111                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21112                 ;;
21113         *)      sizesize=$yyy
21114                 echo "Your $zzz size is $sizesize bytes."
21115                 ;;
21116         esac
21117 else
21118         sizesize=4
21119         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21120 fi
21121
21122
21123 : check for socklen_t
21124 echo " "
21125 echo "Checking to see if you have socklen_t..." >&4
21126 $cat >try.c <<EOCP
21127 #include <sys/types.h>
21128 #$d_socket HAS_SOCKET
21129 #ifdef HAS_SOCKET
21130 #include <sys/socket.h>
21131 #endif
21132 int main() { socklen_t x = 16; }
21133 EOCP
21134 set try
21135 if eval $compile; then
21136         val="$define"
21137         echo "You have socklen_t."
21138 else
21139         val="$undef"
21140         echo "You do not have socklen_t."
21141         case "$sizetype" in
21142         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21143         esac
21144 fi
21145 $rm_try
21146 set d_socklen_t
21147 eval $setvar
21148
21149 : see if this is a socks.h system
21150 set socks.h i_socks
21151 eval $inhdr
21152
21153 : check for type of the size argument to socket calls
21154 case "$d_socket" in
21155 "$define")
21156         $cat <<EOM
21157
21158 Checking to see what type is the last argument of accept().
21159 EOM
21160         yyy=''
21161         case "$d_socklen_t" in
21162         "$define") yyy="$yyy socklen_t"
21163         esac
21164         yyy="$yyy $sizetype int long unsigned"
21165         for xxx in $yyy; do
21166                 case "$socksizetype" in
21167                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21168                         case "$usesocks" in
21169                         "$define")
21170                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21171                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21172                                         socksizetype="$xxx"
21173                                 fi
21174                                 ;;
21175                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21176                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21177                                         socksizetype="$xxx"
21178                                 fi
21179                                 ;;
21180                         esac
21181                         ;;
21182                 esac
21183         done
21184 : In case none of those worked, prompt the user.
21185         case "$socksizetype" in
21186         '')     rp='What is the type for socket address structure sizes?'
21187                 dflt='int'
21188                 . ./myread
21189                 socksizetype=$ans
21190                 ;;
21191         esac
21192         ;;
21193 *)      : no sockets, so pick relatively harmless default
21194         socksizetype='int'
21195         ;;
21196 esac
21197
21198 : see what type is used for signed size_t
21199 set ssize_t ssizetype int stdio.h sys/types.h
21200 eval $typedef
21201 dflt="$ssizetype"
21202 $cat > try.c <<EOM
21203 #include <stdio.h>
21204 #$i_stdlib I_STDLIB
21205 #ifdef I_STDLIB
21206 #include <stdlib.h>
21207 #endif
21208 #include <sys/types.h>
21209 #define Size_t $sizetype
21210 #define SSize_t $dflt
21211 int main()
21212 {
21213         if (sizeof(Size_t) == sizeof(SSize_t))
21214                 printf("$dflt\n");
21215         else if (sizeof(Size_t) == sizeof(int))
21216                 printf("int\n");
21217         else
21218                 printf("long\n");
21219         exit(0);
21220 }
21221 EOM
21222 echo " "
21223 set try
21224 if eval $compile_ok && $run ./try > /dev/null; then
21225         ssizetype=`$run ./try`
21226         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21227 else
21228         $cat >&4 <<EOM
21229 Help! I can't compile and run the ssize_t test program: please enlighten me!
21230 (This is probably a misconfiguration in your system or libraries, and
21231 you really ought to fix it.  Still, I'll try anyway.)
21232
21233 I need a type that is the same size as $sizetype, but is guaranteed to
21234 be signed.  Common values are ssize_t, int and long.
21235
21236 EOM
21237         rp="What signed type is the same size as $sizetype?"
21238         . ./myread
21239         ssizetype="$ans"
21240 fi
21241 $rm_try
21242
21243 : Check the size of st_ino
21244 $echo " "
21245 $echo "Checking the size of st_ino..." >&4
21246 $cat > try.c <<EOCP
21247 #include <sys/stat.h>
21248 #include <stdio.h>
21249 #$i_stdlib I_STDLIB
21250 #ifdef I_STDLIB
21251 #include <stdlib.h>
21252 #endif
21253 int main() {
21254     struct stat st;
21255     printf("%d\n", (int)sizeof(st.st_ino));
21256     exit(0);
21257 }
21258 EOCP
21259 set try
21260 if eval $compile_ok; then
21261         val=`$run ./try`
21262         case "$val" in
21263         '')     st_ino_size=4
21264                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21265                 ;;
21266         *)      st_ino_size=$val
21267                 $echo "Your st_ino is $st_ino_size bytes long."
21268                 ;;
21269         esac
21270 else
21271         st_ino_size=4
21272         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21273 fi
21274 $rm_try
21275
21276 : Check if st_ino is signed
21277 $echo " "
21278 $echo "Checking the sign of st_ino..." >&4
21279 $cat > try.c <<EOCP
21280 #include <sys/stat.h>
21281 #include <stdio.h>
21282 int main() {
21283         struct stat foo;
21284         foo.st_ino = -1;
21285         if (foo.st_ino < 0)
21286                 printf("-1\n");
21287         else
21288                 printf("1\n");
21289 }
21290 EOCP
21291 set try
21292 if eval $compile; then
21293         val=`$run ./try`
21294         case "$val" in
21295         '')     st_ino_sign=1
21296                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21297                 ;;
21298         *)      st_ino_sign=$val
21299                 case "$st_ino_sign" in
21300                  1) $echo "Your st_ino is unsigned." ;;
21301                 -1) $echo "Your st_ino is signed."   ;;
21302                 esac
21303                 ;;
21304         esac
21305 else
21306         st_ino_sign=1
21307         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21308 fi
21309 $rm_try
21310
21311 : see what type of char stdio uses.
21312 echo " "
21313 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21314 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21315         echo "Your stdio uses unsigned chars." >&4
21316         stdchar="unsigned char"
21317 else
21318         echo "Your stdio uses signed chars." >&4
21319         stdchar="char"
21320 fi
21321 $rm -f stdioh
21322
21323 : see what type uids are declared as in the kernel
21324 echo " "
21325 echo "Looking for the type for user ids returned by getuid()."
21326 set uid_t uidtype xxx stdio.h sys/types.h
21327 eval $typedef
21328 case "$uidtype" in
21329 xxx)
21330         xxx=`./findhdr sys/user.h`
21331         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21332         case $1 in
21333         unsigned) dflt="$1 $2" ;;
21334         *) dflt="$1" ;;
21335         esac
21336         ;;
21337 *) dflt="$uidtype";;
21338 esac
21339 case "$uidtype" in
21340 uid_t)  echo "uid_t found." ;;
21341 *)      rp="What is the type for user ids returned by getuid()?"
21342         . ./myread
21343         uidtype="$ans"
21344         ;;
21345 esac
21346
21347 : Check size of UID
21348 echo " "
21349 case "$uidtype" in
21350 *_t) zzz="$uidtype"     ;;
21351 *)   zzz="uid"          ;;
21352 esac
21353 echo "Checking the size of $zzz..." >&4
21354 cat > try.c <<EOCP
21355 #include <sys/types.h>
21356 #include <stdio.h>
21357 #$i_stdlib I_STDLIB
21358 #ifdef I_STDLIB
21359 #include <stdlib.h>
21360 #endif
21361 int main() {
21362     printf("%d\n", (int)sizeof($uidtype));
21363     exit(0);
21364 }
21365 EOCP
21366 set try
21367 if eval $compile_ok; then
21368         yyy=`$run ./try`
21369         case "$yyy" in
21370         '')     uidsize=4
21371                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21372                 ;;
21373         *)      uidsize=$yyy
21374                 echo "Your $zzz is $uidsize bytes long."
21375                 ;;
21376         esac
21377 else
21378         uidsize=4
21379         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21380 fi
21381
21382 : Check if UID is signed
21383 echo " "
21384 case "$uidtype" in
21385 *_t) zzz="$uidtype"     ;;
21386 *)   zzz="uid"          ;;
21387 esac
21388 echo "Checking the sign of $zzz..." >&4
21389 cat > try.c <<EOCP
21390 #include <sys/types.h>
21391 #include <stdio.h>
21392 int main() {
21393         $uidtype foo = -1;
21394         if (foo < 0)
21395                 printf("-1\n");
21396         else
21397                 printf("1\n");
21398 }
21399 EOCP
21400 set try
21401 if eval $compile; then
21402         yyy=`$run ./try`
21403         case "$yyy" in
21404         '')     uidsign=1
21405                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21406                 ;;
21407         *)      uidsign=$yyy
21408                 case "$uidsign" in
21409                  1) echo "Your $zzz is unsigned." ;;
21410                 -1) echo "Your $zzz is signed."   ;;
21411                 esac
21412                 ;;
21413         esac
21414 else
21415         uidsign=1
21416         echo "(I can't compile the test program--guessing unsigned.)" >&4
21417 fi
21418
21419
21420 : Check format string for UID
21421 echo " "
21422 $echo "Checking the format string to be used for uids..." >&4
21423
21424 case "$uidsign" in
21425 -1)     if $test X"$uidsize" = X"$ivsize"; then
21426                 uidformat="$ivdformat"
21427         else
21428                 if $test X"$uidsize" = X"$longsize"; then
21429                         uidformat='"ld"'
21430                 else
21431                         if $test X"$uidsize" = X"$intsize"; then
21432                                 uidformat='"d"'
21433                         else
21434                                 if $test X"$uidsize" = X"$shortsize"; then
21435                                         uidformat='"hd"'
21436                                 fi
21437                         fi
21438                 fi
21439         fi
21440         ;;
21441 *)      if $test X"$uidsize" = X"$uvsize"; then
21442                 uidformat="$uvuformat"
21443         else
21444                 if $test X"$uidsize" = X"$longsize"; then
21445                         uidformat='"lu"'
21446                 else
21447                         if $test X"$uidsize" = X"$intsize"; then
21448                                 uidformat='"u"'
21449                         else
21450                                 if $test X"$uidsize" = X"$shortsize"; then
21451                                         uidformat='"hu"'
21452                                 fi
21453                         fi
21454                 fi
21455         fi
21456         ;;
21457 esac
21458
21459 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21460 echo " "
21461 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21462 $cat >try.c <<'EOM'
21463 /* Intentionally a long probe as I'd like to sanity check that the exact
21464    approach is going to work, as thinking it will work, but only having it
21465    part working at runtime is worse than not having it.  */
21466
21467 #include <sys/types.h>
21468 #include <sys/sysctl.h>
21469 #include <sys/param.h>
21470 #include <stdio.h>
21471 #include <string.h>
21472 #include <stdlib.h>
21473 #include <unistd.h>
21474
21475 int
21476 main(int argc, char **argv) {
21477     char *buffer;
21478     char *argv_leaf = strrchr(argv[0], '/');
21479     char *buffer_leaf;
21480     size_t size = 0;
21481     int mib[4];
21482
21483     mib[0] = CTL_KERN;
21484     mib[1] = KERN_PROC;
21485     mib[2] = KERN_PROC_PATHNAME;
21486     mib[3] = -1;
21487
21488     if (!argv_leaf) {
21489         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21490         return 1;
21491     }
21492
21493     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21494         perror("sysctl");
21495         return 2;
21496     }
21497
21498     if (size < strlen(argv_leaf) + 1) {
21499         fprintf(stderr, "size %lu is too short for a path\n",
21500                 (unsigned long) size);
21501         return 3;
21502     }
21503
21504     if (size > MAXPATHLEN * MAXPATHLEN) {
21505         fprintf(stderr, "size %lu is too long for a path\n",
21506                 (unsigned long) size);
21507         return 4;
21508     }
21509
21510     buffer = malloc(size);
21511     if (!buffer) {
21512         perror("malloc");
21513         return 5;
21514     }
21515
21516     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21517         perror("sysctl");
21518         return 6;
21519     }
21520
21521     if (strlen(buffer) + 1 != size) {
21522         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21523                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21524         return 7;
21525     }
21526
21527
21528     if (*buffer != '/') {
21529         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21530         return 8;
21531     }
21532
21533     if (strstr(buffer, "/./")) {
21534         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21535         return 9;
21536     }
21537
21538     if (strstr(buffer, "/../")) {
21539         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21540         return 10;
21541     }
21542
21543     buffer_leaf = strrchr(buffer, '/');
21544     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21545         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21546         return 11;
21547     }
21548
21549     free(buffer);
21550
21551     return 0;
21552 }
21553 EOM
21554
21555 val=$undef
21556 set try
21557 if eval $compile; then
21558         if $run ./try; then
21559                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21560                 val="$define"
21561         else
21562                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21563                 val="$undef"
21564         fi
21565 else
21566         echo "I'm unable to compile the test program." >&4
21567         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21568         val="$undef"
21569 fi
21570 $rm_try
21571 set usekernprocpathname
21572 eval $setvar
21573
21574 : Determine if we can use _NSGetExecutablePath to find executing program
21575 echo " "
21576 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21577 $cat >try.c <<'EOM'
21578 /* Intentionally a long probe as I'd like to sanity check that the exact
21579    approach is going to work, as thinking it will work, but only having it
21580    part working at runtime is worse than not having it.  */
21581 #include <mach-o/dyld.h>
21582 #include <stdio.h>
21583 #include <stdlib.h>
21584 #include <sys/param.h>
21585 #include <string.h>
21586
21587 int
21588 main(int argc, char **argv) {
21589     char buf[1];
21590     uint32_t size = sizeof(buf);
21591     int result;
21592     char *buffer;
21593     char *tidied;
21594     char *argv_leaf = strrchr(argv[0], '/');
21595     char *tidied_leaf;
21596
21597     if (!argv_leaf) {
21598         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21599         return 1;
21600     }
21601
21602     _NSGetExecutablePath(buf, &size);
21603     if (size > MAXPATHLEN * MAXPATHLEN) {
21604         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21605                 (unsigned int) size);
21606         return 2;
21607     }
21608
21609     buffer = malloc(size);
21610     if (!buffer) {
21611         perror("malloc");
21612         return 3;
21613     }
21614
21615     result = _NSGetExecutablePath(buffer, &size);
21616     if (result != 0) {
21617         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21618                 result, (unsigned int) size);
21619         return 4;
21620     }
21621
21622     tidied = realpath(buffer, NULL);
21623     if (!tidied) {
21624         perror("realpath");
21625         return 5;
21626     }
21627
21628     free(buffer);
21629
21630     if (*tidied != '/') {
21631         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21632         return 6;
21633     }
21634
21635     if (strstr(tidied, "/./")) {
21636         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21637         return 7;
21638     }
21639
21640     if (strstr(tidied, "/../")) {
21641         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21642         return 8;
21643     }
21644
21645     tidied_leaf = strrchr(tidied, '/');
21646     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21647         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21648         return 9;
21649     }
21650
21651     free(tidied);
21652
21653     return 0;
21654 }
21655 EOM
21656
21657 val=$undef
21658 set try
21659 if eval $compile; then
21660         if $run ./try; then
21661                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21662                 val="$define"
21663         else
21664                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21665         fi
21666 else
21667         echo "I'm unable to compile the test program." >&4
21668         echo "I'll assume no _NSGetExecutablePath here." >&4
21669 fi
21670 $rm_try
21671 set usensgetexecutablepath
21672 eval $setvar
21673
21674 : Check if site customization support was requested
21675 case "$usesitecustomize" in
21676     $define|true|[Yy]*)
21677         usesitecustomize="$define"
21678         ;;
21679     *)
21680         usesitecustomize="$undef"
21681         ;;
21682     esac
21683
21684 : see if prototypes support variable argument declarations
21685 echo " "
21686 case "$prototype$i_stdarg" in
21687 $define$define)
21688         echo "It appears we'll be able to prototype varargs functions." >&4
21689         val="$define"
21690         ;;
21691 *)
21692         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21693         val="$undef"
21694         ;;
21695 esac
21696 set vaproto
21697 eval $setvar
21698
21699 : determine compiler compiler
21700 case "$yacc" in
21701 '')
21702         dflt=yacc;;
21703 *)
21704         dflt="$yacc";;
21705 esac
21706 echo " "
21707 comp='yacc'
21708 if $test -f "$byacc$_exe"; then
21709         dflt="$byacc"
21710         comp="byacc or $comp"
21711 fi
21712 if $test -f "$bison$_exe"; then
21713         comp="$comp or bison -y"
21714 fi
21715 rp="Which compiler compiler ($comp) shall I use?"
21716 . ./myread
21717 yacc="$ans"
21718 case "$yacc" in
21719 *bis*)
21720         case "$yacc" in
21721         *-y*) ;;
21722         *)
21723                 yacc="$yacc -y"
21724                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21725                 ;;
21726         esac
21727         ;;
21728 esac
21729
21730 : see if this is a assert.h system
21731 set assert.h i_assert
21732 eval $inhdr
21733
21734 : see if this is a fp.h system
21735 set fp.h i_fp
21736 eval $inhdr
21737
21738 : see if this is a fp_class.h system
21739 set fp_class.h i_fp_class
21740 eval $inhdr
21741
21742 : see if gdbm.h is available
21743 set gdbm.h t_gdbm
21744 eval $inhdr
21745 case "$t_gdbm" in
21746 $define)
21747         : see if gdbm_open exists
21748         set gdbm_open d_gdbm_open
21749         eval $inlibc
21750         case "$d_gdbm_open" in
21751         $undef)
21752                 t_gdbm="$undef"
21753                 echo "We won't be including <gdbm.h>"
21754                 ;;
21755         esac
21756         ;;
21757 esac
21758 val="$t_gdbm"
21759 set i_gdbm
21760 eval $setvar
21761
21762 : see if this is a ieeefp.h system
21763 case "$i_ieeefp" in
21764 '' ) set ieeefp.h i_ieeefp
21765      eval $inhdr
21766      ;;
21767 esac
21768
21769 : see if this is a libutil.h system
21770 set libutil.h i_libutil
21771 eval $inhdr
21772
21773 : see if mach cthreads are available
21774 if test "X$usethreads" = "X$define"; then
21775         set mach/cthreads.h i_machcthr
21776         eval $inhdr
21777 else
21778         i_machcthr="$undef"
21779 fi
21780
21781 : see if this is a mntent.h system
21782 set mntent.h i_mntent
21783 eval $inhdr
21784
21785 : see if net/errno.h is available
21786 val=''
21787 set net/errno.h val
21788 eval $inhdr
21789
21790 : Unfortunately, it causes problems on some systems.  Arrgh.
21791 case "$val" in
21792 $define)
21793         cat > try.c <<'EOM'
21794 #include <stdio.h>
21795 #include <errno.h>
21796 #include <net/errno.h>
21797 int func()
21798 {
21799         return ENOTSOCK;
21800 }
21801 EOM
21802         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21803                 echo "We'll be including <net/errno.h>." >&4
21804         else
21805                 echo "We won't be including <net/errno.h>." >&4
21806                 val="$undef"
21807         fi
21808         $rm_try
21809         ;;
21810 esac
21811 set i_neterrno
21812 eval $setvar
21813
21814 : see if netinet/tcp.h is available
21815 set netinet/tcp.h i_netinettcp
21816 eval $inhdr
21817
21818 : see if this is a poll.h system
21819 set poll.h i_poll
21820 eval $inhdr
21821
21822 : see if this is a prot.h system
21823 set prot.h i_prot
21824 eval $inhdr
21825
21826 : Preprocessor symbols
21827 echo " "
21828 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21829 $cat <<'EOSH' > Cppsym.know
21830 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21831 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21832 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21833 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21834 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21835 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21836 bull c cadmus clipper CMU COFF COMPILER_VERSION
21837 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21838 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21839 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21840 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21841 GLIBC GLIBC_MINOR
21842 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21843 H3050R H3050RX hbullx20 hcx host_mips
21844 hp200 hp300 hp700 HP700 hp800 hp9000
21845 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21846 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21847 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21848 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21849 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21850 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21851 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21852 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21853 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21854 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21855 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21856 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21857 MATH_HAS_NO_SIDE_EFFECTS
21858 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21859 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21860 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21861 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21862 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21863 NetBSD news1500 news1700 news1800 news1900 news3700
21864 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21865 ns32016 ns32332 ns32k nsc32000
21866 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21867 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21868 pc532 pdp11 PGC PIC plexus PORTAR posix
21869 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21870 POSIX_C_SOURCE POSIX_SOURCE POWER
21871 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21872 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21873 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21874 sony sony_news sonyrisc sparc sparclite spectrum
21875 stardent stdc STDC_EXT stratos sun sun3 sun386
21876 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21877 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21878 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21879 sysV68 sysV88 Tek4132 Tek4300 titan
21880 TM3200 TM5400 TM5600
21881 tower tower32 tower32_200 tower32_600 tower32_700
21882 tower32_800 tower32_850 tss
21883 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21884 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21885 unix UNIX95 UNIX99 unixpc unos
21886 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21887 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21888 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21889 USGr4 USGr4_2
21890 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21891 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21892 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21893 z8000
21894 EOSH
21895 # Maybe put other stuff here too.
21896 cat <<EOSH >>Cppsym.know
21897 $osname
21898 EOSH
21899 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21900 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21901 $cat Cppsym.know > Cppsym.c
21902 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21903 $rm -f Cppsym.a Cppsym.b Cppsym.c
21904 cat <<EOSH > Cppsym
21905 $startsh
21906 if $test \$# -gt 0; then
21907     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21908     if $test -s Cppsym.got; then
21909         $rm -f Cppsym.got
21910         exit 0
21911     fi
21912     $rm -f Cppsym.got
21913     exit 1
21914 else
21915     $tr " " "$trnl" | ./Cppsym.try
21916     exit 0
21917 fi
21918 EOSH
21919 chmod +x Cppsym
21920 $eunicefix Cppsym
21921 cat <<EOSH > Cppsym.try
21922 $startsh
21923 cat <<'EOCP' > try.c
21924 #include <stdio.h>
21925 #if cpp_stuff == 1
21926 #define STRINGIFY(a)    "a"
21927 #endif
21928 #if cpp_stuff == 42
21929 #define StGiFy(a)  #a
21930 #define STRINGIFY(a)    StGiFy(a)
21931 #endif
21932 #if $cpp_stuff != 1 && $cpp_stuff != 42
21933 #   include "Bletch: How does this C preprocessor stringify macros?"
21934 #endif
21935 int main() {
21936 EOCP
21937 $awk \\
21938 EOSH
21939 cat <<'EOSH' >> Cppsym.try
21940 'length($1) > 0 {
21941     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21942     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21943     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21944     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21945 }'       >> try.c
21946 echo 'return 0;}' >> try.c
21947 EOSH
21948 cat <<EOSH >> Cppsym.try
21949 ccflags="$ccflags"
21950 case "$osname-$gccversion" in
21951 irix-) ccflags="\$ccflags -woff 1178" ;;
21952 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21953 esac
21954 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21955 EOSH
21956 chmod +x Cppsym.try
21957 $eunicefix Cppsym.try
21958 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
21959 : Add in any linux cpp "predefined macros":
21960 case "$osname::$gccversion" in
21961   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21962     tHdrH=_tmpHdr
21963     rm -f $tHdrH'.h' $tHdrH
21964     touch $tHdrH'.h'
21965     # Filter out macro arguments, such as Linux's __INT8_C(c)
21966     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21967        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21968        if [ -s $tHdrH'_cppsym.real' ]; then
21969           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21970        fi
21971     fi
21972     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21973   ;;
21974 esac
21975 : now check the C compiler for additional symbols
21976 postprocess_cc_v=''
21977 case "$osname" in
21978 aix) postprocess_cc_v="|$tr , ' '" ;;
21979 esac
21980 $cat >ccsym <<EOS
21981 $startsh
21982 $cat >tmp.c <<EOF
21983 extern int foo;
21984 EOF
21985 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21986 do
21987         case "\$i" in
21988         -D*) echo "\$i" | $sed 's/^-D//';;
21989         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21990         esac
21991 done
21992 $rm_try
21993 EOS
21994 postprocess_cc_v=''
21995 chmod +x ccsym
21996 $eunicefix ccsym
21997 ./ccsym > ccsym1.raw
21998 if $test -s ccsym1.raw; then
21999        $sort ccsym1.raw | $uniq >ccsym.raw
22000 else
22001        mv ccsym1.raw ccsym.raw
22002 fi
22003
22004 $awk '/\=/ { print $0; next }
22005         { print $0"=1" }' ccsym.raw >ccsym.list
22006 $comm -13 Cppsym.true ccsym.list >ccsym.own
22007 $comm -12 Cppsym.true ccsym.list >ccsym.com
22008 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22009 also=''
22010 if $test -z ccsym.raw; then
22011         echo "Your C compiler doesn't seem to define any symbols!" >&4
22012         echo " "
22013         echo "However, your C preprocessor defines the following symbols:"
22014         $cat Cppsym.true
22015         ccsymbols=''
22016         cppsymbols=`$cat Cppsym.true`
22017         cppsymbols=`echo $cppsymbols`
22018         cppccsymbols="$cppsymbols"
22019 else
22020         if $test -s ccsym.com; then
22021                 echo "Your C compiler and pre-processor define these symbols:"
22022                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22023                 also='also '
22024                 symbols='ones'
22025                 cppccsymbols=`$cat ccsym.com`
22026                 cppccsymbols=`echo $cppccsymbols`
22027                 $test "$silent" || sleep 1
22028         fi
22029         if $test -s ccsym.cpp; then
22030                 $test "$also" && echo " "
22031                 echo "Your C pre-processor ${also}defines the following symbols:"
22032                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22033                 also='further '
22034                 cppsymbols=`$cat ccsym.cpp`
22035                 cppsymbols=`echo $cppsymbols`
22036                 $test "$silent" || sleep 1
22037         fi
22038         if $test -s ccsym.own; then
22039                 $test "$also" && echo " "
22040                 echo "Your C compiler ${also}defines the following cpp symbols:"
22041                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22042                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22043                 ccsymbols=`$cat ccsym.own`
22044                 ccsymbols=`echo $ccsymbols`
22045                 $test "$silent" || sleep 1
22046         fi
22047 fi
22048
22049 : see if this is a termio system
22050 val="$undef"
22051 val2="$undef"
22052 val3="$undef"
22053 if $test `./findhdr termios.h`; then
22054         set tcsetattr i_termios
22055         eval $inlibc
22056         val3="$i_termios"
22057 fi
22058 echo " "
22059 case "$val3" in
22060 "$define") echo "You have POSIX termios.h... good!" >&4;;
22061 *) if ./Cppsym pyr; then
22062                 case "`/bin/universe`" in
22063                 ucb) if $test `./findhdr sgtty.h`; then
22064                                 val2="$define"
22065                                 echo "<sgtty.h> found." >&4
22066                         else
22067                                 echo "System is pyramid with BSD universe."
22068                                 ./warn "<sgtty.h> not found--you could have problems."
22069                         fi;;
22070                 *) if $test `./findhdr termio.h`; then
22071                                 val="$define"
22072                                 echo "<termio.h> found." >&4
22073                         else
22074                                 echo "System is pyramid with USG universe."
22075                                 ./warn "<termio.h> not found--you could have problems."
22076                         fi;;
22077                 esac
22078         elif ./usg; then
22079                 if $test `./findhdr termio.h`; then
22080                         echo "<termio.h> found." >&4
22081                         val="$define"
22082                 elif $test `./findhdr sgtty.h`; then
22083                         echo "<sgtty.h> found." >&4
22084                         val2="$define"
22085                 else
22086                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22087                 fi
22088         else
22089                 if $test `./findhdr sgtty.h`; then
22090                         echo "<sgtty.h> found." >&4
22091                         val2="$define"
22092                 elif $test `./findhdr termio.h`; then
22093                         echo "<termio.h> found." >&4
22094                         val="$define"
22095                 else
22096                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22097                 fi
22098         fi;;
22099 esac
22100 set i_termio; eval $setvar
22101 val=$val2; set i_sgtty; eval $setvar
22102 val=$val3; set i_termios; eval $setvar
22103
22104 : see if stdbool is available
22105 : we want a real compile instead of Inhdr because some Solaris systems
22106 : have stdbool.h, but it can only be used if the compiler indicates it
22107 : is sufficiently c99-compliant.
22108 echo " "
22109 $cat >try.c <<EOCP
22110 #include <stdio.h>
22111 #include <stdbool.h>
22112 int func(bool x)
22113 {
22114     return x ? 1 : 0;
22115 }
22116 int main(int argc, char **argv)
22117 {
22118     return func(0);
22119 }
22120 EOCP
22121 set try
22122 if eval $compile; then
22123         echo "<stdbool.h> found." >&4
22124         val="$define"
22125 else
22126         echo "<stdbool.h> NOT found." >&4
22127         val="$undef"
22128 fi
22129 $rm_try
22130 set i_stdbool
22131 eval $setvar
22132
22133 : see if stddef is available
22134 set stddef.h i_stddef
22135 eval $inhdr
22136
22137 : see if sys/access.h is available
22138 set sys/access.h i_sysaccess
22139 eval $inhdr
22140
22141 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22142 set sys/filio.h i_sysfilio
22143 eval $inhdr
22144 echo " "
22145 if $test `./findhdr sys/ioctl.h`; then
22146         val="$define"
22147         echo '<sys/ioctl.h> found.' >&4
22148 else
22149         val="$undef"
22150         if $test $i_sysfilio = "$define"; then
22151             echo '<sys/ioctl.h> NOT found.' >&4
22152         else
22153                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22154                 $test $i_termio = "$define" && xxx="termio.h"
22155                 $test $i_termios = "$define" && xxx="termios.h"
22156 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22157         fi
22158 fi
22159 set i_sysioctl
22160 eval $setvar
22161
22162 : see if socket ioctl defs are in sys/sockio.h
22163 echo " "
22164 xxx=`./findhdr sys/sockio.h`
22165 if $test "$xxx"; then
22166         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22167                 val="$define"
22168                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22169         else
22170                 val="$undef"
22171                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22172         fi
22173 else
22174         val="$undef"
22175         $cat <<EOM
22176 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22177 EOM
22178 fi
22179 set i_syssockio
22180 eval $setvar
22181
22182 : see if this is a syslog.h system
22183 set syslog.h i_syslog
22184 eval $inhdr
22185
22186 : see if this is a sys/mode.h system
22187 set sys/mode.h i_sysmode
22188 eval $inhdr
22189
22190 : see if there is a sys/poll.h file
22191 set sys/poll.h i_syspoll
22192 eval $inhdr
22193
22194 : see if sys/resource.h has to be included
22195 set sys/resource.h i_sysresrc
22196 eval $inhdr
22197
22198 : see if sys/security.h is available
22199 set sys/security.h i_syssecrt
22200 eval $inhdr
22201
22202 : see if this is a sys/statvfs.h system
22203 set sys/statvfs.h i_sysstatvfs
22204 eval $inhdr
22205
22206 : see if this is a sys/un.h system
22207 set sys/un.h i_sysun
22208 eval $inhdr
22209
22210 : see if this is a sys/utsname.h system
22211 set sys/utsname.h i_sysutsname
22212 eval $inhdr
22213
22214 : see if this is a syswait system
22215 set sys/wait.h i_syswait
22216 eval $inhdr
22217
22218 : see if this is a ustat.h system
22219 set ustat.h i_ustat
22220 eval $inhdr
22221
22222 : see if this is an utime system
22223 set utime.h i_utime
22224 eval $inhdr
22225
22226 : see if this is a vfork system
22227 case "$d_vfork" in
22228 "$define")
22229         set vfork.h i_vfork
22230         eval $inhdr
22231         ;;
22232 *)
22233         i_vfork="$undef"
22234         ;;
22235 esac
22236
22237 : Check extensions
22238 echo " "
22239 echo "Looking for extensions..." >&4
22240 : If we are using the old config.sh, known_extensions may contain
22241 : old or inaccurate or duplicate values.
22242 known_extensions=''
22243 nonxs_extensions=''
22244 : We do not use find because it might not be available.
22245 : We do not just use MANIFEST because the user may have dropped
22246 : some additional extensions into the source tree and expect them
22247 : to be built.
22248
22249 : Function to recursively find available extensions, ignoring DynaLoader
22250 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22251 : In 5.10.1 and later, extensions are stored in directories
22252 : like File-Glob instead of the older File/Glob/.
22253 find_extensions='
22254     for xxx in *; do
22255         case "$xxx" in
22256             DynaLoader|dynaload) ;;
22257             *)
22258             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22259             leaf=`echo $xxx | $sed -e s/.*-//`;
22260             if $test -d File; then
22261                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22262                     known_extensions="$known_extensions $1$this_ext";
22263                 elif $test -f $xxx/Makefile.PL; then
22264                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22265                 else
22266                     if $test -d $xxx -a $# -lt 10; then
22267                         set $1$xxx/ $*;
22268                         cd "$xxx";
22269                         eval $find_extensions;
22270                         cd ..;
22271                         shift;
22272                     fi;
22273                 fi;
22274             else
22275                 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22276                 if $contains " $this_ext " $$.tmp; then
22277                     echo >&4;
22278                     echo "Duplicate directories detected for extension $xxx" >&4;
22279                     echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22280                     case "$knowitall" in
22281                     "") dflt=y;;
22282                     *) dflt=n;;
22283                     esac;
22284                     . ../UU/myread;
22285                     case "$ans" in
22286                     n*|N*) ;;
22287                     *) echo >&4;
22288                        echo "Ok.  Stopping Configure." >&4;
22289                        echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22290                         exit 1;;
22291                     esac;
22292                     echo "Ok.  You will need to correct config.sh before running make." >&4;
22293                 fi;
22294                 $ls -1 $xxx > $$.tmp;
22295                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22296                     known_extensions="$known_extensions $this_ext";
22297                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22298                     known_extensions="$known_extensions $this_ext";
22299                 elif $test -d $xxx; then
22300                     nonxs_extensions="$nonxs_extensions $this_ext";
22301                 fi;
22302                 $rm -f $$.tmp;
22303             fi
22304             ;;
22305         esac;
22306     done'
22307 tdir=`pwd`
22308 cd "$rsrc/cpan"
22309 set X
22310 shift
22311 eval $find_extensions
22312 cd "$rsrc/dist"
22313 set X
22314 shift
22315 eval $find_extensions
22316 cd "$rsrc/ext"
22317 set X
22318 shift
22319 eval $find_extensions
22320 if $test -d File-Glob; then
22321     : All ext/ flattened
22322 else
22323     # Special case:  Add in modules that nest beyond the first level.
22324     # Currently threads/shared and Hash/Util/FieldHash, since they are
22325     # not picked up by the recursive find above (and adding in general
22326     # recursive finding breaks SDBM_File/sdbm).
22327     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22328     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22329 fi
22330 set X $known_extensions
22331 shift
22332 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22333 set X $nonxs_extensions
22334 shift
22335 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22336 cd "$tdir"
22337
22338 : Now see which are supported on this system.
22339 avail_ext=''
22340 for xxx in $known_extensions ; do
22341         case "$xxx" in
22342         DB_File|db_file)
22343                 case "$i_db" in
22344                 $define) avail_ext="$avail_ext $xxx" ;;
22345                 esac
22346                 ;;
22347         GDBM_File|gdbm_fil)
22348                 case "$i_gdbm" in
22349                 $define) avail_ext="$avail_ext $xxx" ;;
22350                 esac
22351                 ;;
22352         I18N/Langinfo|i18n_lan)
22353                 case "$i_langinfo$d_nl_langinfo" in
22354                 $define$define) avail_ext="$avail_ext $xxx" ;;
22355                 esac
22356                 ;;
22357         IPC/SysV|ipc/sysv)
22358                 : XXX Do we need a useipcsysv variable here
22359                 case "${d_msg}${d_sem}${d_shm}" in
22360                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22361                 esac
22362                 ;;
22363         NDBM_File|ndbm_fil)
22364                 case "$d_ndbm" in
22365                 $define)
22366                     case "$osname-$use64bitint" in
22367                     hpux-define)
22368                         case "$libs" in
22369                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22370                         esac
22371                         ;;
22372                     *) avail_ext="$avail_ext $xxx" ;;
22373                     esac
22374                     ;;
22375                 esac
22376                 ;;
22377         ODBM_File|odbm_fil)
22378                 case "${i_dbm}${i_rpcsvcdbm}" in
22379                 *"${define}"*)
22380                     case "$d_cplusplus" in
22381                     define) ;; # delete as a function name will not work
22382                     *)  case "$osname-$use64bitint" in
22383                         hpux-define)
22384                             case "$libs" in
22385                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22386                             esac
22387                             ;;
22388                         *) avail_ext="$avail_ext $xxx" ;;
22389                         esac
22390                         ;;
22391                     esac
22392                     ;;
22393                 esac
22394                 ;;
22395         Opcode|opcode)
22396                 case "$useopcode" in
22397                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22398                 esac
22399                 ;;
22400         POSIX|posix)
22401                 case "$useposix" in
22402                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22403                 esac
22404                 ;;
22405         Socket|socket)
22406                 case "$d_socket" in
22407                 true|$define|y)
22408                     case "$osname" in
22409                     beos) ;; # not unless BONE
22410                     *) avail_ext="$avail_ext $xxx" ;;
22411                     esac
22412                     ;;
22413                 esac
22414                 ;;
22415         Sys/Syslog|sys/syslog)
22416                 : XXX syslog requires socket
22417                 case "$d_socket" in
22418                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22419                 esac
22420                 ;;
22421         Thread|thread)
22422                 case "$usethreads" in
22423                 true|$define|y)
22424                         case "$use5005threads" in
22425                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22426                         esac
22427                 esac
22428                 ;;
22429         threads|threads/shared)
22430                 # threads and threads::shared are special cases.
22431                 # To stop people from asking "Perl 5.8.0 was supposed
22432                 # to have this new fancy threads implementation but my
22433                 # perl doesn't have it" and from people trying to
22434                 # (re)install the threads module using CPAN.pm and
22435                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22436                 # the threads.pm and threads/shared.pm will always be
22437                 # there, croaking informatively ("you need to rebuild
22438                 # all of Perl with threads, sorry") when threads haven't
22439                 # been compiled in.
22440                 # --jhi
22441                 avail_ext="$avail_ext $xxx"
22442                 ;;
22443         VMS*)
22444                 ;;
22445         Win32*)
22446                 case "$osname" in
22447                 cygwin) avail_ext="$avail_ext $xxx" ;;
22448                 esac
22449                 ;;
22450         XS/APItest|xs/apitest)
22451                 # This is just for testing.  Skip it unless we have dynamic loading.
22452
22453                 case "$usedl" in
22454                 $define) avail_ext="$avail_ext $xxx" ;;
22455                 esac
22456                 ;;
22457         XS/Typemap|xs/typemap)
22458                 # This is just for testing.  Skip it unless we have dynamic loading.
22459                 case "$usedl" in
22460                 $define) avail_ext="$avail_ext $xxx" ;;
22461                 esac
22462                 ;;
22463         *)      avail_ext="$avail_ext $xxx"
22464                 ;;
22465         esac
22466 done
22467
22468 set X $avail_ext
22469 shift
22470 avail_ext="$*"
22471
22472 case "$onlyextensions" in
22473 '') ;;
22474 *)  keepextensions=''
22475     echo "You have requested that only certain extensions be included..." >&4
22476     for i in $onlyextensions; do
22477         case " $avail_ext " in
22478         *" $i "*)
22479             echo "Keeping extension $i."
22480             keepextensions="$keepextensions $i"
22481             ;;
22482         *) echo "Ignoring extension $i." ;;
22483         esac
22484     done
22485     avail_ext="$keepextensions"
22486     ;;
22487 esac
22488
22489 case "$noextensions" in
22490 '') ;;
22491 *)  keepextensions=''
22492     echo "You have requested that certain extensions be ignored..." >&4
22493     for i in $avail_ext; do
22494         case " $noextensions " in
22495         *" $i "*) echo "Ignoring extension $i." ;;
22496         *) echo "Keeping extension $i.";
22497            keepextensions="$keepextensions $i"
22498            ;;
22499         esac
22500     done
22501     avail_ext="$keepextensions"
22502     ;;
22503 esac
22504
22505 : Now see which nonxs extensions are supported on this system.
22506 : For now assume all are.
22507 nonxs_ext=''
22508 for xxx in $nonxs_extensions ; do
22509         case "$xxx" in
22510         *)      nonxs_ext="$nonxs_ext $xxx"
22511                 ;;
22512         esac
22513 done
22514
22515 set X $nonxs_ext
22516 shift
22517 nonxs_ext="$*"
22518
22519 case $usedl in
22520 $define)
22521         $cat <<EOM
22522 A number of extensions are supplied with $package.  You may choose to
22523 compile these extensions for dynamic loading (the default), compile
22524 them into the $package executable (static loading), or not include
22525 them at all.  Answer "none" to include no extensions.
22526 Note that DynaLoader is always built and need not be mentioned here.
22527
22528 EOM
22529         case "$dynamic_ext" in
22530         '')
22531                 : Exclude those listed in static_ext
22532                 dflt=''
22533                 for xxx in $avail_ext; do
22534                         case " $static_ext " in
22535                         *" $xxx "*) ;;
22536                         *) dflt="$dflt $xxx" ;;
22537                         esac
22538                 done
22539                 set X $dflt
22540                 shift
22541                 dflt="$*"
22542                 ;;
22543         *)      dflt="$dynamic_ext"
22544                 # Perhaps we are reusing an old out-of-date config.sh.
22545                 case "$hint" in
22546                 previous)
22547                         if test X"$dynamic_ext" != X"$avail_ext"; then
22548                                 $cat <<EOM
22549 NOTICE:  Your previous config.sh list may be incorrect.
22550 The extensions now available to you are
22551         ${avail_ext}
22552 but the default list from your previous config.sh is
22553         ${dynamic_ext}
22554
22555 EOM
22556                         fi
22557                         ;;
22558                 esac
22559                 ;;
22560         esac
22561         case "$dflt" in
22562         '')     dflt=none;;
22563         esac
22564         rp="What extensions do you wish to load dynamically?"
22565         . ./myread
22566         case "$ans" in
22567         none) dynamic_ext=' ' ;;
22568         *) dynamic_ext="$ans" ;;
22569         esac
22570
22571         case "$static_ext" in
22572         '')
22573                 : Exclude those already listed in dynamic linking
22574                 dflt=''
22575                 for xxx in $avail_ext; do
22576                         case " $dynamic_ext " in
22577                         *" $xxx "*) ;;
22578                         *) dflt="$dflt $xxx" ;;
22579                         esac
22580                 done
22581                 set X $dflt
22582                 shift
22583                 dflt="$*"
22584                 ;;
22585         *)  dflt="$static_ext"
22586                 ;;
22587         esac
22588
22589         case "$dflt" in
22590         '')     dflt=none;;
22591         esac
22592         rp="What extensions do you wish to load statically?"
22593         . ./myread
22594         case "$ans" in
22595         none) static_ext=' ' ;;
22596         *) static_ext="$ans" ;;
22597         esac
22598         ;;
22599 *)
22600         $cat <<EOM
22601 A number of extensions are supplied with $package.  Answer "none"
22602 to include no extensions.
22603 Note that DynaLoader is always built and need not be mentioned here.
22604
22605 EOM
22606         case "$static_ext" in
22607         '') dflt="$avail_ext" ;;
22608         *)      dflt="$static_ext"
22609                 # Perhaps we are reusing an old out-of-date config.sh.
22610                 case "$hint" in
22611                 previous)
22612                         if test X"$static_ext" != X"$avail_ext"; then
22613                                 $cat <<EOM
22614 NOTICE:  Your previous config.sh list may be incorrect.
22615 The extensions now available to you are
22616         ${avail_ext}
22617 but the default list from your previous config.sh is
22618         ${static_ext}
22619
22620 EOM
22621                         fi
22622                         ;;
22623                 esac
22624                 ;;
22625         esac
22626         : Exclude those that are not xs extensions
22627         case "$dflt" in
22628         '')     dflt=none;;
22629         esac
22630         rp="What extensions do you wish to include?"
22631         . ./myread
22632         case "$ans" in
22633         none) static_ext=' ' ;;
22634         *) static_ext="$ans" ;;
22635         esac
22636         ;;
22637 esac
22638 #
22639 # Encode is a special case.  If we are building Encode as a static
22640 # extension, we need to explicitly list its subextensions as well.
22641 # For other nested extensions, this is handled automatically by
22642 # the appropriate Makefile.PL.
22643 case " $static_ext " in
22644         *" Encode "*) # Add the subextensions of Encode
22645         cd "$rsrc/cpan"
22646         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22647                 static_ext="$static_ext Encode/$xxx"
22648         done
22649         cd "$tdir"
22650         ;;
22651 esac
22652
22653 set X $dynamic_ext $static_ext $nonxs_ext
22654 shift
22655 extensions="$*"
22656
22657 # Sanity check:  We require an extension suitable for use with
22658 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22659 # should show up as failures in the test suite, but it's helpful to
22660 # catch them now.) The 'extensions' list is normally sorted
22661 # alphabetically, so we need to accept either
22662 #    DB_File ... Fcntl ... IO  ....
22663 # or something like
22664 #    Fcntl ... NDBM_File ... IO  ....
22665 case " $extensions"  in
22666 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22667 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22668 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22669 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22670    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22671    ;;
22672 esac
22673
22674 : Remove libraries needed only for extensions
22675 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22676 : The exception is SunOS 4.x, which needs them.
22677 case "${osname}X${osvers}" in
22678 sunos*X4*)
22679     perllibs="$libs"
22680     ;;
22681 *) case "$usedl" in
22682     $define|true|[yY]*)
22683             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22684             shift
22685             perllibs="$*"
22686             ;;
22687     *)  perllibs="$libs"
22688             ;;
22689     esac
22690     ;;
22691 esac
22692
22693 : Remove build directory name from cppstdin so it can be used from
22694 : either the present location or the final installed location.
22695 echo " "
22696 : Get out of the UU directory to get correct path name.
22697 cd ..
22698 case "$cppstdin" in
22699 `pwd`/cppstdin)
22700         echo "Stripping down cppstdin path name"
22701         cppstdin=cppstdin
22702         ;;
22703 esac
22704 cd UU
22705
22706 : end of configuration questions
22707 echo " "
22708 echo "End of configuration questions."
22709 echo " "
22710
22711 : back to where it started
22712 if test -d ../UU; then
22713         cd ..
22714 fi
22715
22716 : configuration may be unconditionally patched via a 'config.arch' file
22717 if $test -f config.arch; then
22718         echo "I see a config.arch file, loading it." >&4
22719         . ./config.arch
22720 fi
22721
22722 : configuration may be patched via a 'config.over' file
22723 if $test -f config.over; then
22724         echo " "
22725         dflt=y
22726         rp='I see a config.over file.  Do you wish to load it?'
22727         . UU/myread
22728         case "$ans" in
22729         n*) echo "OK, I'll ignore it.";;
22730         *)      . ./config.over
22731                 echo "Configuration override changes have been loaded."
22732                 ;;
22733         esac
22734 fi
22735
22736 : in case they want portability, strip down executable paths
22737 case "$d_portable" in
22738 "$define")
22739         echo " "
22740         echo "Stripping down executable paths..." >&4
22741         for file in $loclist $trylist; do
22742                 eval temp=\$$file
22743                 eval $file=`basename $temp`
22744         done
22745         ;;
22746 esac
22747
22748 : create config.sh file
22749 echo " "
22750 echo "Creating config.sh..." >&4
22751 $spitshell <<EOT >config.sh
22752 $startsh
22753 #
22754 # This file was produced by running the Configure script. It holds all the
22755 # definitions figured out by Configure. Should you modify one of these values,
22756 # do not forget to propagate your changes by running "Configure -der". You may
22757 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22758 #
22759
22760 # Package name      : $package
22761 # Source directory  : $src
22762 # Configuration time: $cf_time
22763 # Configured by     : $cf_by
22764 # Target system     : $myuname
22765
22766 EOT
22767 : Add in command line options if available
22768 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22769
22770 $spitshell <<EOT >>config.sh
22771
22772 Author='$Author'
22773 Date='$Date'
22774 Header='$Header'
22775 Id='$Id'
22776 Locker='$Locker'
22777 Log='$Log'
22778 RCSfile='$RCSfile'
22779 Revision='$Revision'
22780 Source='$Source'
22781 State='$State'
22782 _a='$_a'
22783 _exe='$_exe'
22784 _o='$_o'
22785 afs='$afs'
22786 afsroot='$afsroot'
22787 alignbytes='$alignbytes'
22788 ansi2knr='$ansi2knr'
22789 aphostname='$aphostname'
22790 api_revision='$api_revision'
22791 api_subversion='$api_subversion'
22792 api_version='$api_version'
22793 api_versionstring='$api_versionstring'
22794 ar='$ar'
22795 archlib='$archlib'
22796 archlibexp='$archlibexp'
22797 archname64='$archname64'
22798 archname='$archname'
22799 archobjs='$archobjs'
22800 asctime_r_proto='$asctime_r_proto'
22801 awk='$awk'
22802 baserev='$baserev'
22803 bash='$bash'
22804 bin='$bin'
22805 bin_ELF='$bin_ELF'
22806 binexp='$binexp'
22807 bison='$bison'
22808 byacc='$byacc'
22809 byteorder='$byteorder'
22810 c='$c'
22811 castflags='$castflags'
22812 cat='$cat'
22813 cc='$cc'
22814 cccdlflags='$cccdlflags'
22815 ccdlflags='$ccdlflags'
22816 ccflags='$ccflags'
22817 ccflags_uselargefiles='$ccflags_uselargefiles'
22818 ccname='$ccname'
22819 ccsymbols='$ccsymbols'
22820 ccversion='$ccversion'
22821 cf_by='$cf_by'
22822 cf_email='$cf_email'
22823 cf_time='$cf_time'
22824 charbits='$charbits'
22825 charsize='$charsize'
22826 chgrp='$chgrp'
22827 chmod='$chmod'
22828 chown='$chown'
22829 clocktype='$clocktype'
22830 comm='$comm'
22831 compress='$compress'
22832 contains='$contains'
22833 cp='$cp'
22834 cpio='$cpio'
22835 cpp='$cpp'
22836 cpp_stuff='$cpp_stuff'
22837 cppccsymbols='$cppccsymbols'
22838 cppflags='$cppflags'
22839 cpplast='$cpplast'
22840 cppminus='$cppminus'
22841 cpprun='$cpprun'
22842 cppstdin='$cppstdin'
22843 cppsymbols='$cppsymbols'
22844 crypt_r_proto='$crypt_r_proto'
22845 cryptlib='$cryptlib'
22846 csh='$csh'
22847 ctermid_r_proto='$ctermid_r_proto'
22848 ctime_r_proto='$ctime_r_proto'
22849 d_Gconvert='$d_Gconvert'
22850 d_PRIEUldbl='$d_PRIEUldbl'
22851 d_PRIFUldbl='$d_PRIFUldbl'
22852 d_PRIGUldbl='$d_PRIGUldbl'
22853 d_PRIXU64='$d_PRIXU64'
22854 d_PRId64='$d_PRId64'
22855 d_PRIeldbl='$d_PRIeldbl'
22856 d_PRIfldbl='$d_PRIfldbl'
22857 d_PRIgldbl='$d_PRIgldbl'
22858 d_PRIi64='$d_PRIi64'
22859 d_PRIo64='$d_PRIo64'
22860 d_PRIu64='$d_PRIu64'
22861 d_PRIx64='$d_PRIx64'
22862 d_SCNfldbl='$d_SCNfldbl'
22863 d__fwalk='$d__fwalk'
22864 d_access='$d_access'
22865 d_accessx='$d_accessx'
22866 d_aintl='$d_aintl'
22867 d_alarm='$d_alarm'
22868 d_archlib='$d_archlib'
22869 d_asctime64='$d_asctime64'
22870 d_asctime_r='$d_asctime_r'
22871 d_atolf='$d_atolf'
22872 d_atoll='$d_atoll'
22873 d_attribute_deprecated='$d_attribute_deprecated'
22874 d_attribute_format='$d_attribute_format'
22875 d_attribute_malloc='$d_attribute_malloc'
22876 d_attribute_nonnull='$d_attribute_nonnull'
22877 d_attribute_noreturn='$d_attribute_noreturn'
22878 d_attribute_pure='$d_attribute_pure'
22879 d_attribute_unused='$d_attribute_unused'
22880 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22881 d_bcmp='$d_bcmp'
22882 d_bcopy='$d_bcopy'
22883 d_bsd='$d_bsd'
22884 d_bsdgetpgrp='$d_bsdgetpgrp'
22885 d_bsdsetpgrp='$d_bsdsetpgrp'
22886 d_builtin_choose_expr='$d_builtin_choose_expr'
22887 d_builtin_expect='$d_builtin_expect'
22888 d_bzero='$d_bzero'
22889 d_c99_variadic_macros='$d_c99_variadic_macros'
22890 d_casti32='$d_casti32'
22891 d_castneg='$d_castneg'
22892 d_charvspr='$d_charvspr'
22893 d_chown='$d_chown'
22894 d_chroot='$d_chroot'
22895 d_chsize='$d_chsize'
22896 d_class='$d_class'
22897 d_clearenv='$d_clearenv'
22898 d_closedir='$d_closedir'
22899 d_cmsghdr_s='$d_cmsghdr_s'
22900 d_const='$d_const'
22901 d_copysignl='$d_copysignl'
22902 d_cplusplus='$d_cplusplus'
22903 d_crypt='$d_crypt'
22904 d_crypt_r='$d_crypt_r'
22905 d_csh='$d_csh'
22906 d_ctermid='$d_ctermid'
22907 d_ctermid_r='$d_ctermid_r'
22908 d_ctime64='$d_ctime64'
22909 d_ctime_r='$d_ctime_r'
22910 d_cuserid='$d_cuserid'
22911 d_dbl_dig='$d_dbl_dig'
22912 d_dbminitproto='$d_dbminitproto'
22913 d_difftime64='$d_difftime64'
22914 d_difftime='$d_difftime'
22915 d_dir_dd_fd='$d_dir_dd_fd'
22916 d_dirfd='$d_dirfd'
22917 d_dirnamlen='$d_dirnamlen'
22918 d_dlerror='$d_dlerror'
22919 d_dlopen='$d_dlopen'
22920 d_dlsymun='$d_dlsymun'
22921 d_dosuid='$d_dosuid'
22922 d_drand48_r='$d_drand48_r'
22923 d_drand48proto='$d_drand48proto'
22924 d_dup2='$d_dup2'
22925 d_eaccess='$d_eaccess'
22926 d_endgrent='$d_endgrent'
22927 d_endgrent_r='$d_endgrent_r'
22928 d_endhent='$d_endhent'
22929 d_endhostent_r='$d_endhostent_r'
22930 d_endnent='$d_endnent'
22931 d_endnetent_r='$d_endnetent_r'
22932 d_endpent='$d_endpent'
22933 d_endprotoent_r='$d_endprotoent_r'
22934 d_endpwent='$d_endpwent'
22935 d_endpwent_r='$d_endpwent_r'
22936 d_endsent='$d_endsent'
22937 d_endservent_r='$d_endservent_r'
22938 d_eofnblk='$d_eofnblk'
22939 d_eunice='$d_eunice'
22940 d_faststdio='$d_faststdio'
22941 d_fchdir='$d_fchdir'
22942 d_fchmod='$d_fchmod'
22943 d_fchown='$d_fchown'
22944 d_fcntl='$d_fcntl'
22945 d_fcntl_can_lock='$d_fcntl_can_lock'
22946 d_fd_macros='$d_fd_macros'
22947 d_fd_set='$d_fd_set'
22948 d_fds_bits='$d_fds_bits'
22949 d_fgetpos='$d_fgetpos'
22950 d_finite='$d_finite'
22951 d_finitel='$d_finitel'
22952 d_flexfnam='$d_flexfnam'
22953 d_flock='$d_flock'
22954 d_flockproto='$d_flockproto'
22955 d_fork='$d_fork'
22956 d_fp_class='$d_fp_class'
22957 d_fpathconf='$d_fpathconf'
22958 d_fpclass='$d_fpclass'
22959 d_fpclassify='$d_fpclassify'
22960 d_fpclassl='$d_fpclassl'
22961 d_fpos64_t='$d_fpos64_t'
22962 d_frexpl='$d_frexpl'
22963 d_fs_data_s='$d_fs_data_s'
22964 d_fseeko='$d_fseeko'
22965 d_fsetpos='$d_fsetpos'
22966 d_fstatfs='$d_fstatfs'
22967 d_fstatvfs='$d_fstatvfs'
22968 d_fsync='$d_fsync'
22969 d_ftello='$d_ftello'
22970 d_ftime='$d_ftime'
22971 d_futimes='$d_futimes'
22972 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22973 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22974 d_getaddrinfo='$d_getaddrinfo'
22975 d_getcwd='$d_getcwd'
22976 d_getespwnam='$d_getespwnam'
22977 d_getfsstat='$d_getfsstat'
22978 d_getgrent='$d_getgrent'
22979 d_getgrent_r='$d_getgrent_r'
22980 d_getgrgid_r='$d_getgrgid_r'
22981 d_getgrnam_r='$d_getgrnam_r'
22982 d_getgrps='$d_getgrps'
22983 d_gethbyaddr='$d_gethbyaddr'
22984 d_gethbyname='$d_gethbyname'
22985 d_gethent='$d_gethent'
22986 d_gethname='$d_gethname'
22987 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22988 d_gethostbyname_r='$d_gethostbyname_r'
22989 d_gethostent_r='$d_gethostent_r'
22990 d_gethostprotos='$d_gethostprotos'
22991 d_getitimer='$d_getitimer'
22992 d_getlogin='$d_getlogin'
22993 d_getlogin_r='$d_getlogin_r'
22994 d_getmnt='$d_getmnt'
22995 d_getmntent='$d_getmntent'
22996 d_getnameinfo='$d_getnameinfo'
22997 d_getnbyaddr='$d_getnbyaddr'
22998 d_getnbyname='$d_getnbyname'
22999 d_getnent='$d_getnent'
23000 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23001 d_getnetbyname_r='$d_getnetbyname_r'
23002 d_getnetent_r='$d_getnetent_r'
23003 d_getnetprotos='$d_getnetprotos'
23004 d_getpagsz='$d_getpagsz'
23005 d_getpbyname='$d_getpbyname'
23006 d_getpbynumber='$d_getpbynumber'
23007 d_getpent='$d_getpent'
23008 d_getpgid='$d_getpgid'
23009 d_getpgrp2='$d_getpgrp2'
23010 d_getpgrp='$d_getpgrp'
23011 d_getppid='$d_getppid'
23012 d_getprior='$d_getprior'
23013 d_getprotobyname_r='$d_getprotobyname_r'
23014 d_getprotobynumber_r='$d_getprotobynumber_r'
23015 d_getprotoent_r='$d_getprotoent_r'
23016 d_getprotoprotos='$d_getprotoprotos'
23017 d_getprpwnam='$d_getprpwnam'
23018 d_getpwent='$d_getpwent'
23019 d_getpwent_r='$d_getpwent_r'
23020 d_getpwnam_r='$d_getpwnam_r'
23021 d_getpwuid_r='$d_getpwuid_r'
23022 d_getsbyname='$d_getsbyname'
23023 d_getsbyport='$d_getsbyport'
23024 d_getsent='$d_getsent'
23025 d_getservbyname_r='$d_getservbyname_r'
23026 d_getservbyport_r='$d_getservbyport_r'
23027 d_getservent_r='$d_getservent_r'
23028 d_getservprotos='$d_getservprotos'
23029 d_getspnam='$d_getspnam'
23030 d_getspnam_r='$d_getspnam_r'
23031 d_gettimeod='$d_gettimeod'
23032 d_gmtime64='$d_gmtime64'
23033 d_gmtime_r='$d_gmtime_r'
23034 d_gnulibc='$d_gnulibc'
23035 d_grpasswd='$d_grpasswd'
23036 d_hasmntopt='$d_hasmntopt'
23037 d_htonl='$d_htonl'
23038 d_ilogbl='$d_ilogbl'
23039 d_inc_version_list='$d_inc_version_list'
23040 d_index='$d_index'
23041 d_inetaton='$d_inetaton'
23042 d_inetntop='$d_inetntop'
23043 d_inetpton='$d_inetpton'
23044 d_int64_t='$d_int64_t'
23045 d_ip_mreq='$d_ip_mreq'
23046 d_ipv6_mreq='$d_ipv6_mreq'
23047 d_isascii='$d_isascii'
23048 d_isblank='$d_isblank'
23049 d_isfinite='$d_isfinite'
23050 d_isinf='$d_isinf'
23051 d_isnan='$d_isnan'
23052 d_isnanl='$d_isnanl'
23053 d_killpg='$d_killpg'
23054 d_lchown='$d_lchown'
23055 d_ldbl_dig='$d_ldbl_dig'
23056 d_libm_lib_version='$d_libm_lib_version'
23057 d_link='$d_link'
23058 d_localtime64='$d_localtime64'
23059 d_localtime_r='$d_localtime_r'
23060 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23061 d_locconv='$d_locconv'
23062 d_lockf='$d_lockf'
23063 d_longdbl='$d_longdbl'
23064 d_longlong='$d_longlong'
23065 d_lseekproto='$d_lseekproto'
23066 d_lstat='$d_lstat'
23067 d_madvise='$d_madvise'
23068 d_malloc_good_size='$d_malloc_good_size'
23069 d_malloc_size='$d_malloc_size'
23070 d_mblen='$d_mblen'
23071 d_mbstowcs='$d_mbstowcs'
23072 d_mbtowc='$d_mbtowc'
23073 d_memchr='$d_memchr'
23074 d_memcmp='$d_memcmp'
23075 d_memcpy='$d_memcpy'
23076 d_memmove='$d_memmove'
23077 d_memset='$d_memset'
23078 d_mkdir='$d_mkdir'
23079 d_mkdtemp='$d_mkdtemp'
23080 d_mkfifo='$d_mkfifo'
23081 d_mkstemp='$d_mkstemp'
23082 d_mkstemps='$d_mkstemps'
23083 d_mktime64='$d_mktime64'
23084 d_mktime='$d_mktime'
23085 d_mmap='$d_mmap'
23086 d_modfl='$d_modfl'
23087 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23088 d_modflproto='$d_modflproto'
23089 d_mprotect='$d_mprotect'
23090 d_msg='$d_msg'
23091 d_msg_ctrunc='$d_msg_ctrunc'
23092 d_msg_dontroute='$d_msg_dontroute'
23093 d_msg_oob='$d_msg_oob'
23094 d_msg_peek='$d_msg_peek'
23095 d_msg_proxy='$d_msg_proxy'
23096 d_msgctl='$d_msgctl'
23097 d_msgget='$d_msgget'
23098 d_msghdr_s='$d_msghdr_s'
23099 d_msgrcv='$d_msgrcv'
23100 d_msgsnd='$d_msgsnd'
23101 d_msync='$d_msync'
23102 d_munmap='$d_munmap'
23103 d_mymalloc='$d_mymalloc'
23104 d_ndbm='$d_ndbm'
23105 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23106 d_nice='$d_nice'
23107 d_nl_langinfo='$d_nl_langinfo'
23108 d_nv_preserves_uv='$d_nv_preserves_uv'
23109 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23110 d_off64_t='$d_off64_t'
23111 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23112 d_oldpthreads='$d_oldpthreads'
23113 d_oldsock='$d_oldsock'
23114 d_open3='$d_open3'
23115 d_pathconf='$d_pathconf'
23116 d_pause='$d_pause'
23117 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23118 d_phostname='$d_phostname'
23119 d_pipe='$d_pipe'
23120 d_poll='$d_poll'
23121 d_portable='$d_portable'
23122 d_prctl='$d_prctl'
23123 d_prctl_set_name='$d_prctl_set_name'
23124 d_printf_format_null='$d_printf_format_null'
23125 d_procselfexe='$d_procselfexe'
23126 d_pseudofork='$d_pseudofork'
23127 d_pthread_atfork='$d_pthread_atfork'
23128 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23129 d_pthread_yield='$d_pthread_yield'
23130 d_pwage='$d_pwage'
23131 d_pwchange='$d_pwchange'
23132 d_pwclass='$d_pwclass'
23133 d_pwcomment='$d_pwcomment'
23134 d_pwexpire='$d_pwexpire'
23135 d_pwgecos='$d_pwgecos'
23136 d_pwpasswd='$d_pwpasswd'
23137 d_pwquota='$d_pwquota'
23138 d_qgcvt='$d_qgcvt'
23139 d_quad='$d_quad'
23140 d_random_r='$d_random_r'
23141 d_readdir64_r='$d_readdir64_r'
23142 d_readdir='$d_readdir'
23143 d_readdir_r='$d_readdir_r'
23144 d_readlink='$d_readlink'
23145 d_readv='$d_readv'
23146 d_recvmsg='$d_recvmsg'
23147 d_rename='$d_rename'
23148 d_rewinddir='$d_rewinddir'
23149 d_rmdir='$d_rmdir'
23150 d_safebcpy='$d_safebcpy'
23151 d_safemcpy='$d_safemcpy'
23152 d_sanemcmp='$d_sanemcmp'
23153 d_sbrkproto='$d_sbrkproto'
23154 d_scalbnl='$d_scalbnl'
23155 d_sched_yield='$d_sched_yield'
23156 d_scm_rights='$d_scm_rights'
23157 d_seekdir='$d_seekdir'
23158 d_select='$d_select'
23159 d_sem='$d_sem'
23160 d_semctl='$d_semctl'
23161 d_semctl_semid_ds='$d_semctl_semid_ds'
23162 d_semctl_semun='$d_semctl_semun'
23163 d_semget='$d_semget'
23164 d_semop='$d_semop'
23165 d_sendmsg='$d_sendmsg'
23166 d_setegid='$d_setegid'
23167 d_seteuid='$d_seteuid'
23168 d_setgrent='$d_setgrent'
23169 d_setgrent_r='$d_setgrent_r'
23170 d_setgrps='$d_setgrps'
23171 d_sethent='$d_sethent'
23172 d_sethostent_r='$d_sethostent_r'
23173 d_setitimer='$d_setitimer'
23174 d_setlinebuf='$d_setlinebuf'
23175 d_setlocale='$d_setlocale'
23176 d_setlocale_r='$d_setlocale_r'
23177 d_setnent='$d_setnent'
23178 d_setnetent_r='$d_setnetent_r'
23179 d_setpent='$d_setpent'
23180 d_setpgid='$d_setpgid'
23181 d_setpgrp2='$d_setpgrp2'
23182 d_setpgrp='$d_setpgrp'
23183 d_setprior='$d_setprior'
23184 d_setproctitle='$d_setproctitle'
23185 d_setprotoent_r='$d_setprotoent_r'
23186 d_setpwent='$d_setpwent'
23187 d_setpwent_r='$d_setpwent_r'
23188 d_setregid='$d_setregid'
23189 d_setresgid='$d_setresgid'
23190 d_setresuid='$d_setresuid'
23191 d_setreuid='$d_setreuid'
23192 d_setrgid='$d_setrgid'
23193 d_setruid='$d_setruid'
23194 d_setsent='$d_setsent'
23195 d_setservent_r='$d_setservent_r'
23196 d_setsid='$d_setsid'
23197 d_setvbuf='$d_setvbuf'
23198 d_sfio='$d_sfio'
23199 d_shm='$d_shm'
23200 d_shmat='$d_shmat'
23201 d_shmatprototype='$d_shmatprototype'
23202 d_shmctl='$d_shmctl'
23203 d_shmdt='$d_shmdt'
23204 d_shmget='$d_shmget'
23205 d_sigaction='$d_sigaction'
23206 d_signbit='$d_signbit'
23207 d_sigprocmask='$d_sigprocmask'
23208 d_sigsetjmp='$d_sigsetjmp'
23209 d_sin6_scope_id='$d_sin6_scope_id'
23210 d_sitearch='$d_sitearch'
23211 d_snprintf='$d_snprintf'
23212 d_sockaddr_in6='$d_sockaddr_in6'
23213 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23214 d_sockatmark='$d_sockatmark'
23215 d_sockatmarkproto='$d_sockatmarkproto'
23216 d_socket='$d_socket'
23217 d_socklen_t='$d_socklen_t'
23218 d_sockpair='$d_sockpair'
23219 d_socks5_init='$d_socks5_init'
23220 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23221 d_sqrtl='$d_sqrtl'
23222 d_srand48_r='$d_srand48_r'
23223 d_srandom_r='$d_srandom_r'
23224 d_sresgproto='$d_sresgproto'
23225 d_sresuproto='$d_sresuproto'
23226 d_statblks='$d_statblks'
23227 d_statfs_f_flags='$d_statfs_f_flags'
23228 d_statfs_s='$d_statfs_s'
23229 d_static_inline='$d_static_inline'
23230 d_statvfs='$d_statvfs'
23231 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23232 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23233 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23234 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23235 d_stdio_stream_array='$d_stdio_stream_array'
23236 d_stdiobase='$d_stdiobase'
23237 d_stdstdio='$d_stdstdio'
23238 d_strchr='$d_strchr'
23239 d_strcoll='$d_strcoll'
23240 d_strctcpy='$d_strctcpy'
23241 d_strerrm='$d_strerrm'
23242 d_strerror='$d_strerror'
23243 d_strerror_r='$d_strerror_r'
23244 d_strftime='$d_strftime'
23245 d_strlcat='$d_strlcat'
23246 d_strlcpy='$d_strlcpy'
23247 d_strtod='$d_strtod'
23248 d_strtol='$d_strtol'
23249 d_strtold='$d_strtold'
23250 d_strtoll='$d_strtoll'
23251 d_strtoq='$d_strtoq'
23252 d_strtoul='$d_strtoul'
23253 d_strtoull='$d_strtoull'
23254 d_strtouq='$d_strtouq'
23255 d_strxfrm='$d_strxfrm'
23256 d_suidsafe='$d_suidsafe'
23257 d_symlink='$d_symlink'
23258 d_syscall='$d_syscall'
23259 d_syscallproto='$d_syscallproto'
23260 d_sysconf='$d_sysconf'
23261 d_sysernlst='$d_sysernlst'
23262 d_syserrlst='$d_syserrlst'
23263 d_system='$d_system'
23264 d_tcgetpgrp='$d_tcgetpgrp'
23265 d_tcsetpgrp='$d_tcsetpgrp'
23266 d_telldir='$d_telldir'
23267 d_telldirproto='$d_telldirproto'
23268 d_time='$d_time'
23269 d_timegm='$d_timegm'
23270 d_times='$d_times'
23271 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23272 d_tm_tm_zone='$d_tm_tm_zone'
23273 d_tmpnam_r='$d_tmpnam_r'
23274 d_truncate='$d_truncate'
23275 d_ttyname_r='$d_ttyname_r'
23276 d_tzname='$d_tzname'
23277 d_u32align='$d_u32align'
23278 d_ualarm='$d_ualarm'
23279 d_umask='$d_umask'
23280 d_uname='$d_uname'
23281 d_union_semun='$d_union_semun'
23282 d_unordered='$d_unordered'
23283 d_unsetenv='$d_unsetenv'
23284 d_usleep='$d_usleep'
23285 d_usleepproto='$d_usleepproto'
23286 d_ustat='$d_ustat'
23287 d_vendorarch='$d_vendorarch'
23288 d_vendorbin='$d_vendorbin'
23289 d_vendorlib='$d_vendorlib'
23290 d_vendorscript='$d_vendorscript'
23291 d_vfork='$d_vfork'
23292 d_void_closedir='$d_void_closedir'
23293 d_voidsig='$d_voidsig'
23294 d_voidtty='$d_voidtty'
23295 d_volatile='$d_volatile'
23296 d_vprintf='$d_vprintf'
23297 d_vsnprintf='$d_vsnprintf'
23298 d_wait4='$d_wait4'
23299 d_waitpid='$d_waitpid'
23300 d_wcstombs='$d_wcstombs'
23301 d_wctomb='$d_wctomb'
23302 d_writev='$d_writev'
23303 d_xenix='$d_xenix'
23304 date='$date'
23305 db_hashtype='$db_hashtype'
23306 db_prefixtype='$db_prefixtype'
23307 db_version_major='$db_version_major'
23308 db_version_minor='$db_version_minor'
23309 db_version_patch='$db_version_patch'
23310 defvoidused='$defvoidused'
23311 direntrytype='$direntrytype'
23312 dlext='$dlext'
23313 dlsrc='$dlsrc'
23314 doublesize='$doublesize'
23315 drand01='$drand01'
23316 drand48_r_proto='$drand48_r_proto'
23317 dtrace='$dtrace'
23318 dynamic_ext='$dynamic_ext'
23319 eagain='$eagain'
23320 ebcdic='$ebcdic'
23321 echo='$echo'
23322 egrep='$egrep'
23323 emacs='$emacs'
23324 endgrent_r_proto='$endgrent_r_proto'
23325 endhostent_r_proto='$endhostent_r_proto'
23326 endnetent_r_proto='$endnetent_r_proto'
23327 endprotoent_r_proto='$endprotoent_r_proto'
23328 endpwent_r_proto='$endpwent_r_proto'
23329 endservent_r_proto='$endservent_r_proto'
23330 eunicefix='$eunicefix'
23331 exe_ext='$exe_ext'
23332 expr='$expr'
23333 extensions='$extensions'
23334 extern_C='$extern_C'
23335 extras='$extras'
23336 fflushNULL='$fflushNULL'
23337 fflushall='$fflushall'
23338 find='$find'
23339 firstmakefile='$firstmakefile'
23340 flex='$flex'
23341 fpossize='$fpossize'
23342 fpostype='$fpostype'
23343 freetype='$freetype'
23344 from='$from'
23345 full_ar='$full_ar'
23346 full_csh='$full_csh'
23347 full_sed='$full_sed'
23348 gccansipedantic='$gccansipedantic'
23349 gccosandvers='$gccosandvers'
23350 gccversion='$gccversion'
23351 getgrent_r_proto='$getgrent_r_proto'
23352 getgrgid_r_proto='$getgrgid_r_proto'
23353 getgrnam_r_proto='$getgrnam_r_proto'
23354 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23355 gethostbyname_r_proto='$gethostbyname_r_proto'
23356 gethostent_r_proto='$gethostent_r_proto'
23357 getlogin_r_proto='$getlogin_r_proto'
23358 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23359 getnetbyname_r_proto='$getnetbyname_r_proto'
23360 getnetent_r_proto='$getnetent_r_proto'
23361 getprotobyname_r_proto='$getprotobyname_r_proto'
23362 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23363 getprotoent_r_proto='$getprotoent_r_proto'
23364 getpwent_r_proto='$getpwent_r_proto'
23365 getpwnam_r_proto='$getpwnam_r_proto'
23366 getpwuid_r_proto='$getpwuid_r_proto'
23367 getservbyname_r_proto='$getservbyname_r_proto'
23368 getservbyport_r_proto='$getservbyport_r_proto'
23369 getservent_r_proto='$getservent_r_proto'
23370 getspnam_r_proto='$getspnam_r_proto'
23371 gidformat='$gidformat'
23372 gidsign='$gidsign'
23373 gidsize='$gidsize'
23374 gidtype='$gidtype'
23375 glibpth='$glibpth'
23376 gmake='$gmake'
23377 gmtime_r_proto='$gmtime_r_proto'
23378 gnulibc_version='$gnulibc_version'
23379 grep='$grep'
23380 groupcat='$groupcat'
23381 groupstype='$groupstype'
23382 gzip='$gzip'
23383 h_fcntl='$h_fcntl'
23384 h_sysfile='$h_sysfile'
23385 hint='$hint'
23386 hostcat='$hostcat'
23387 html1dir='$html1dir'
23388 html1direxp='$html1direxp'
23389 html3dir='$html3dir'
23390 html3direxp='$html3direxp'
23391 i16size='$i16size'
23392 i16type='$i16type'
23393 i32size='$i32size'
23394 i32type='$i32type'
23395 i64size='$i64size'
23396 i64type='$i64type'
23397 i8size='$i8size'
23398 i8type='$i8type'
23399 i_arpainet='$i_arpainet'
23400 i_assert='$i_assert'
23401 i_bsdioctl='$i_bsdioctl'
23402 i_crypt='$i_crypt'
23403 i_db='$i_db'
23404 i_dbm='$i_dbm'
23405 i_dirent='$i_dirent'
23406 i_dld='$i_dld'
23407 i_dlfcn='$i_dlfcn'
23408 i_fcntl='$i_fcntl'
23409 i_float='$i_float'
23410 i_fp='$i_fp'
23411 i_fp_class='$i_fp_class'
23412 i_gdbm='$i_gdbm'
23413 i_gdbm_ndbm='$i_gdbm_ndbm'
23414 i_gdbmndbm='$i_gdbmndbm'
23415 i_grp='$i_grp'
23416 i_ieeefp='$i_ieeefp'
23417 i_inttypes='$i_inttypes'
23418 i_langinfo='$i_langinfo'
23419 i_libutil='$i_libutil'
23420 i_limits='$i_limits'
23421 i_locale='$i_locale'
23422 i_machcthr='$i_machcthr'
23423 i_malloc='$i_malloc'
23424 i_mallocmalloc='$i_mallocmalloc'
23425 i_math='$i_math'
23426 i_memory='$i_memory'
23427 i_mntent='$i_mntent'
23428 i_ndbm='$i_ndbm'
23429 i_netdb='$i_netdb'
23430 i_neterrno='$i_neterrno'
23431 i_netinettcp='$i_netinettcp'
23432 i_niin='$i_niin'
23433 i_poll='$i_poll'
23434 i_prot='$i_prot'
23435 i_pthread='$i_pthread'
23436 i_pwd='$i_pwd'
23437 i_rpcsvcdbm='$i_rpcsvcdbm'
23438 i_sfio='$i_sfio'
23439 i_sgtty='$i_sgtty'
23440 i_shadow='$i_shadow'
23441 i_socks='$i_socks'
23442 i_stdarg='$i_stdarg'
23443 i_stdbool='$i_stdbool'
23444 i_stddef='$i_stddef'
23445 i_stdlib='$i_stdlib'
23446 i_string='$i_string'
23447 i_sunmath='$i_sunmath'
23448 i_sysaccess='$i_sysaccess'
23449 i_sysdir='$i_sysdir'
23450 i_sysfile='$i_sysfile'
23451 i_sysfilio='$i_sysfilio'
23452 i_sysin='$i_sysin'
23453 i_sysioctl='$i_sysioctl'
23454 i_syslog='$i_syslog'
23455 i_sysmman='$i_sysmman'
23456 i_sysmode='$i_sysmode'
23457 i_sysmount='$i_sysmount'
23458 i_sysndir='$i_sysndir'
23459 i_sysparam='$i_sysparam'
23460 i_syspoll='$i_syspoll'
23461 i_sysresrc='$i_sysresrc'
23462 i_syssecrt='$i_syssecrt'
23463 i_sysselct='$i_sysselct'
23464 i_syssockio='$i_syssockio'
23465 i_sysstat='$i_sysstat'
23466 i_sysstatfs='$i_sysstatfs'
23467 i_sysstatvfs='$i_sysstatvfs'
23468 i_systime='$i_systime'
23469 i_systimek='$i_systimek'
23470 i_systimes='$i_systimes'
23471 i_systypes='$i_systypes'
23472 i_sysuio='$i_sysuio'
23473 i_sysun='$i_sysun'
23474 i_sysutsname='$i_sysutsname'
23475 i_sysvfs='$i_sysvfs'
23476 i_syswait='$i_syswait'
23477 i_termio='$i_termio'
23478 i_termios='$i_termios'
23479 i_time='$i_time'
23480 i_unistd='$i_unistd'
23481 i_ustat='$i_ustat'
23482 i_utime='$i_utime'
23483 i_values='$i_values'
23484 i_varargs='$i_varargs'
23485 i_varhdr='$i_varhdr'
23486 i_vfork='$i_vfork'
23487 ignore_versioned_solibs='$ignore_versioned_solibs'
23488 inc_version_list='$inc_version_list'
23489 inc_version_list_init='$inc_version_list_init'
23490 incpath='$incpath'
23491 inews='$inews'
23492 initialinstalllocation='$initialinstalllocation'
23493 installarchlib='$installarchlib'
23494 installbin='$installbin'
23495 installhtml1dir='$installhtml1dir'
23496 installhtml3dir='$installhtml3dir'
23497 installman1dir='$installman1dir'
23498 installman3dir='$installman3dir'
23499 installprefix='$installprefix'
23500 installprefixexp='$installprefixexp'
23501 installprivlib='$installprivlib'
23502 installscript='$installscript'
23503 installsitearch='$installsitearch'
23504 installsitebin='$installsitebin'
23505 installsitehtml1dir='$installsitehtml1dir'
23506 installsitehtml3dir='$installsitehtml3dir'
23507 installsitelib='$installsitelib'
23508 installsiteman1dir='$installsiteman1dir'
23509 installsiteman3dir='$installsiteman3dir'
23510 installsitescript='$installsitescript'
23511 installstyle='$installstyle'
23512 installusrbinperl='$installusrbinperl'
23513 installvendorarch='$installvendorarch'
23514 installvendorbin='$installvendorbin'
23515 installvendorhtml1dir='$installvendorhtml1dir'
23516 installvendorhtml3dir='$installvendorhtml3dir'
23517 installvendorlib='$installvendorlib'
23518 installvendorman1dir='$installvendorman1dir'
23519 installvendorman3dir='$installvendorman3dir'
23520 installvendorscript='$installvendorscript'
23521 intsize='$intsize'
23522 issymlink='$issymlink'
23523 ivdformat='$ivdformat'
23524 ivsize='$ivsize'
23525 ivtype='$ivtype'
23526 known_extensions='$known_extensions'
23527 ksh='$ksh'
23528 ld='$ld'
23529 ld_can_script='$ld_can_script'
23530 lddlflags='$lddlflags'
23531 ldflags='$ldflags'
23532 ldflags_uselargefiles='$ldflags_uselargefiles'
23533 ldlibpthname='$ldlibpthname'
23534 less='$less'
23535 lib_ext='$lib_ext'
23536 libc='$libc'
23537 libperl='$libperl'
23538 libpth='$libpth'
23539 libs='$libs'
23540 libsdirs='$libsdirs'
23541 libsfiles='$libsfiles'
23542 libsfound='$libsfound'
23543 libspath='$libspath'
23544 libswanted='$libswanted'
23545 libswanted_uselargefiles='$libswanted_uselargefiles'
23546 line='$line'
23547 lint='$lint'
23548 lkflags='$lkflags'
23549 ln='$ln'
23550 lns='$lns'
23551 localtime_r_proto='$localtime_r_proto'
23552 locincpth='$locincpth'
23553 loclibpth='$loclibpth'
23554 longdblsize='$longdblsize'
23555 longlongsize='$longlongsize'
23556 longsize='$longsize'
23557 lp='$lp'
23558 lpr='$lpr'
23559 ls='$ls'
23560 lseeksize='$lseeksize'
23561 lseektype='$lseektype'
23562 mad='$mad'
23563 madlyh='$madlyh'
23564 madlyobj='$madlyobj'
23565 madlysrc='$madlysrc'
23566 mail='$mail'
23567 mailx='$mailx'
23568 make='$make'
23569 make_set_make='$make_set_make'
23570 mallocobj='$mallocobj'
23571 mallocsrc='$mallocsrc'
23572 malloctype='$malloctype'
23573 man1dir='$man1dir'
23574 man1direxp='$man1direxp'
23575 man1ext='$man1ext'
23576 man3dir='$man3dir'
23577 man3direxp='$man3direxp'
23578 man3ext='$man3ext'
23579 mips_type='$mips_type'
23580 mistrustnm='$mistrustnm'
23581 mkdir='$mkdir'
23582 mmaptype='$mmaptype'
23583 modetype='$modetype'
23584 more='$more'
23585 multiarch='$multiarch'
23586 mv='$mv'
23587 myarchname='$myarchname'
23588 mydomain='$mydomain'
23589 myhostname='$myhostname'
23590 myuname='$myuname'
23591 n='$n'
23592 need_va_copy='$need_va_copy'
23593 netdb_hlen_type='$netdb_hlen_type'
23594 netdb_host_type='$netdb_host_type'
23595 netdb_name_type='$netdb_name_type'
23596 netdb_net_type='$netdb_net_type'
23597 nm='$nm'
23598 nm_opt='$nm_opt'
23599 nm_so_opt='$nm_so_opt'
23600 nonxs_ext='$nonxs_ext'
23601 nroff='$nroff'
23602 nvEUformat='$nvEUformat'
23603 nvFUformat='$nvFUformat'
23604 nvGUformat='$nvGUformat'
23605 nv_overflows_integers_at='$nv_overflows_integers_at'
23606 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23607 nveformat='$nveformat'
23608 nvfformat='$nvfformat'
23609 nvgformat='$nvgformat'
23610 nvsize='$nvsize'
23611 nvtype='$nvtype'
23612 o_nonblock='$o_nonblock'
23613 obj_ext='$obj_ext'
23614 old_pthread_create_joinable='$old_pthread_create_joinable'
23615 optimize='$optimize'
23616 orderlib='$orderlib'
23617 osname='$osname'
23618 osvers='$osvers'
23619 otherlibdirs='$otherlibdirs'
23620 package='$package'
23621 pager='$pager'
23622 passcat='$passcat'
23623 patchlevel='$patchlevel'
23624 path_sep='$path_sep'
23625 perl5='$perl5'
23626 perl='$perl'
23627 perl_patchlevel='$perl_patchlevel'
23628 perl_static_inline='$perl_static_inline'
23629 perladmin='$perladmin'
23630 perllibs='$perllibs'
23631 perlpath='$perlpath'
23632 pg='$pg'
23633 phostname='$phostname'
23634 pidtype='$pidtype'
23635 plibpth='$plibpth'
23636 pmake='$pmake'
23637 pr='$pr'
23638 prefix='$prefix'
23639 prefixexp='$prefixexp'
23640 privlib='$privlib'
23641 privlibexp='$privlibexp'
23642 procselfexe='$procselfexe'
23643 prototype='$prototype'
23644 ptrsize='$ptrsize'
23645 quadkind='$quadkind'
23646 quadtype='$quadtype'
23647 randbits='$randbits'
23648 randfunc='$randfunc'
23649 random_r_proto='$random_r_proto'
23650 randseedtype='$randseedtype'
23651 ranlib='$ranlib'
23652 rd_nodata='$rd_nodata'
23653 readdir64_r_proto='$readdir64_r_proto'
23654 readdir_r_proto='$readdir_r_proto'
23655 revision='$revision'
23656 rm='$rm'
23657 rm_try='$rm_try'
23658 rmail='$rmail'
23659 run='$run'
23660 runnm='$runnm'
23661 sGMTIME_max='$sGMTIME_max'
23662 sGMTIME_min='$sGMTIME_min'
23663 sLOCALTIME_max='$sLOCALTIME_max'
23664 sLOCALTIME_min='$sLOCALTIME_min'
23665 sPRIEUldbl='$sPRIEUldbl'
23666 sPRIFUldbl='$sPRIFUldbl'
23667 sPRIGUldbl='$sPRIGUldbl'
23668 sPRIXU64='$sPRIXU64'
23669 sPRId64='$sPRId64'
23670 sPRIeldbl='$sPRIeldbl'
23671 sPRIfldbl='$sPRIfldbl'
23672 sPRIgldbl='$sPRIgldbl'
23673 sPRIi64='$sPRIi64'
23674 sPRIo64='$sPRIo64'
23675 sPRIu64='$sPRIu64'
23676 sPRIx64='$sPRIx64'
23677 sSCNfldbl='$sSCNfldbl'
23678 sched_yield='$sched_yield'
23679 scriptdir='$scriptdir'
23680 scriptdirexp='$scriptdirexp'
23681 sed='$sed'
23682 seedfunc='$seedfunc'
23683 selectminbits='$selectminbits'
23684 selecttype='$selecttype'
23685 sendmail='$sendmail'
23686 setgrent_r_proto='$setgrent_r_proto'
23687 sethostent_r_proto='$sethostent_r_proto'
23688 setlocale_r_proto='$setlocale_r_proto'
23689 setnetent_r_proto='$setnetent_r_proto'
23690 setprotoent_r_proto='$setprotoent_r_proto'
23691 setpwent_r_proto='$setpwent_r_proto'
23692 setservent_r_proto='$setservent_r_proto'
23693 sh='$sh'
23694 shar='$shar'
23695 sharpbang='$sharpbang'
23696 shmattype='$shmattype'
23697 shortsize='$shortsize'
23698 shrpenv='$shrpenv'
23699 shsharp='$shsharp'
23700 sig_count='$sig_count'
23701 sig_name='$sig_name'
23702 sig_name_init='$sig_name_init'
23703 sig_num='$sig_num'
23704 sig_num_init='$sig_num_init'
23705 sig_size='$sig_size'
23706 signal_t='$signal_t'
23707 sitearch='$sitearch'
23708 sitearchexp='$sitearchexp'
23709 sitebin='$sitebin'
23710 sitebinexp='$sitebinexp'
23711 sitehtml1dir='$sitehtml1dir'
23712 sitehtml1direxp='$sitehtml1direxp'
23713 sitehtml3dir='$sitehtml3dir'
23714 sitehtml3direxp='$sitehtml3direxp'
23715 sitelib='$sitelib'
23716 sitelib_stem='$sitelib_stem'
23717 sitelibexp='$sitelibexp'
23718 siteman1dir='$siteman1dir'
23719 siteman1direxp='$siteman1direxp'
23720 siteman3dir='$siteman3dir'
23721 siteman3direxp='$siteman3direxp'
23722 siteprefix='$siteprefix'
23723 siteprefixexp='$siteprefixexp'
23724 sitescript='$sitescript'
23725 sitescriptexp='$sitescriptexp'
23726 sizesize='$sizesize'
23727 sizetype='$sizetype'
23728 sleep='$sleep'
23729 smail='$smail'
23730 so='$so'
23731 sockethdr='$sockethdr'
23732 socketlib='$socketlib'
23733 socksizetype='$socksizetype'
23734 sort='$sort'
23735 spackage='$spackage'
23736 spitshell='$spitshell'
23737 srand48_r_proto='$srand48_r_proto'
23738 srandom_r_proto='$srandom_r_proto'
23739 src='$src'
23740 ssizetype='$ssizetype'
23741 st_ino_sign='$st_ino_sign'
23742 st_ino_size='$st_ino_size'
23743 startperl='$startperl'
23744 startsh='$startsh'
23745 static_ext='$static_ext'
23746 stdchar='$stdchar'
23747 stdio_base='$stdio_base'
23748 stdio_bufsiz='$stdio_bufsiz'
23749 stdio_cnt='$stdio_cnt'
23750 stdio_filbuf='$stdio_filbuf'
23751 stdio_ptr='$stdio_ptr'
23752 stdio_stream_array='$stdio_stream_array'
23753 strerror_r_proto='$strerror_r_proto'
23754 strings='$strings'
23755 submit='$submit'
23756 subversion='$subversion'
23757 sysman='$sysman'
23758 tail='$tail'
23759 tar='$tar'
23760 targetarch='$targetarch'
23761 tbl='$tbl'
23762 tee='$tee'
23763 test='$test'
23764 timeincl='$timeincl'
23765 timetype='$timetype'
23766 tmpnam_r_proto='$tmpnam_r_proto'
23767 to='$to'
23768 touch='$touch'
23769 tr='$tr'
23770 trnl='$trnl'
23771 troff='$troff'
23772 ttyname_r_proto='$ttyname_r_proto'
23773 u16size='$u16size'
23774 u16type='$u16type'
23775 u32size='$u32size'
23776 u32type='$u32type'
23777 u64size='$u64size'
23778 u64type='$u64type'
23779 u8size='$u8size'
23780 u8type='$u8type'
23781 uidformat='$uidformat'
23782 uidsign='$uidsign'
23783 uidsize='$uidsize'
23784 uidtype='$uidtype'
23785 uname='$uname'
23786 uniq='$uniq'
23787 uquadtype='$uquadtype'
23788 use5005threads='$use5005threads'
23789 use64bitall='$use64bitall'
23790 use64bitint='$use64bitint'
23791 usecrosscompile='$usecrosscompile'
23792 usedevel='$usedevel'
23793 usedl='$usedl'
23794 usedtrace='$usedtrace'
23795 usefaststdio='$usefaststdio'
23796 useithreads='$useithreads'
23797 usekernprocpathname='$usekernprocpathname'
23798 uselargefiles='$uselargefiles'
23799 uselongdouble='$uselongdouble'
23800 usemallocwrap='$usemallocwrap'
23801 usemorebits='$usemorebits'
23802 usemultiplicity='$usemultiplicity'
23803 usemymalloc='$usemymalloc'
23804 usenm='$usenm'
23805 usensgetexecutablepath='$usensgetexecutablepath'
23806 useopcode='$useopcode'
23807 useperlio='$useperlio'
23808 useposix='$useposix'
23809 usereentrant='$usereentrant'
23810 userelocatableinc='$userelocatableinc'
23811 usesfio='$usesfio'
23812 useshrplib='$useshrplib'
23813 usesitecustomize='$usesitecustomize'
23814 usesocks='$usesocks'
23815 usethreads='$usethreads'
23816 usevendorprefix='$usevendorprefix'
23817 usevfork='$usevfork'
23818 usrinc='$usrinc'
23819 uuname='$uuname'
23820 uvXUformat='$uvXUformat'
23821 uvoformat='$uvoformat'
23822 uvsize='$uvsize'
23823 uvtype='$uvtype'
23824 uvuformat='$uvuformat'
23825 uvxformat='$uvxformat'
23826 vaproto='$vaproto'
23827 vendorarch='$vendorarch'
23828 vendorarchexp='$vendorarchexp'
23829 vendorbin='$vendorbin'
23830 vendorbinexp='$vendorbinexp'
23831 vendorhtml1dir='$vendorhtml1dir'
23832 vendorhtml1direxp='$vendorhtml1direxp'
23833 vendorhtml3dir='$vendorhtml3dir'
23834 vendorhtml3direxp='$vendorhtml3direxp'
23835 vendorlib='$vendorlib'
23836 vendorlib_stem='$vendorlib_stem'
23837 vendorlibexp='$vendorlibexp'
23838 vendorman1dir='$vendorman1dir'
23839 vendorman1direxp='$vendorman1direxp'
23840 vendorman3dir='$vendorman3dir'
23841 vendorman3direxp='$vendorman3direxp'
23842 vendorprefix='$vendorprefix'
23843 vendorprefixexp='$vendorprefixexp'
23844 vendorscript='$vendorscript'
23845 vendorscriptexp='$vendorscriptexp'
23846 version='$version'
23847 version_patchlevel_string='$version_patchlevel_string'
23848 versiononly='$versiononly'
23849 vi='$vi'
23850 voidflags='$voidflags'
23851 xlibpth='$xlibpth'
23852 yacc='$yacc'
23853 yaccflags='$yaccflags'
23854 zcat='$zcat'
23855 zip='$zip'
23856 EOT
23857
23858 : add special variables
23859 $test -f $src/patchlevel.h && \
23860 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23861 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23862 echo "PERL_CONFIG_SH=true" >>config.sh
23863
23864 : propagate old symbols
23865 if $test -f UU/config.sh; then
23866         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23867         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23868                 config.sh config.sh UU/oldconfig.sh |\
23869                 $sort | $uniq -u >UU/oldsyms
23870         set X `$cat UU/oldsyms`
23871         shift
23872         case $# in
23873         0) ;;
23874         *)
23875                 $cat <<EOM
23876 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23877 EOM
23878                 echo ": Variables propagated from previous config.sh file." >>config.sh
23879                 for sym in `$cat UU/oldsyms`; do
23880                         echo "    Propagating $hint variable "'$'"$sym..."
23881                         eval 'tmp="$'"${sym}"'"'
23882                         echo "$tmp" | \
23883                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23884                 done
23885                 ;;
23886         esac
23887 fi
23888
23889 : Finish up by extracting the .SH files
23890 case "$alldone" in
23891 exit)
23892         $rm -rf UU
23893         echo "Extraction done."
23894         exit 0
23895         ;;
23896 cont)
23897         ;;
23898 '')
23899         dflt=''
23900         nostick=true
23901         $cat <<EOM
23902
23903 If you'd like to make any changes to the config.sh file before I begin
23904 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23905
23906 EOM
23907         rp="Press return or use a shell escape to edit config.sh:"
23908         . UU/myread
23909         nostick=''
23910         case "$ans" in
23911         '') ;;
23912         *) : in case they cannot read
23913                 sh 1>&4 -c "$ans";;
23914         esac
23915         ;;
23916 esac
23917
23918 : if this fails, just run all the .SH files by hand
23919 . ./config.sh
23920
23921 echo " "
23922 exec 1>&4
23923 pwd=`pwd`
23924 . ./UU/extract
23925 cd "$pwd"
23926
23927 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23928         dflt=y
23929         case "$silent" in
23930         true) ;;
23931         *)
23932                 $cat <<EOM
23933
23934 Now you need to generate make dependencies by running "$make depend".
23935 You might prefer to run it in background: "$make depend > makedepend.out &"
23936 It can take a while, so you might not want to run it right now.
23937
23938 EOM
23939                 ;;
23940         esac
23941         rp="Run $make depend now?"
23942         . UU/myread
23943         case "$ans" in
23944         y*)
23945                 $make depend && echo "Now you must run '$make'."
23946                 ;;
23947         *)
23948                 echo "You must run '$make depend' then '$make'."
23949                 ;;
23950         esac
23951 elif test -f [Mm]akefile; then
23952         echo " "
23953         echo "Now you must run a $make."
23954 else
23955         echo "Configure done."
23956 fi
23957
23958 if $test -f Policy.sh; then
23959     $cat <<EOM
23960
23961 If you compile $package on a different machine or from a different object
23962 directory, copy the Policy.sh file from this object directory to the
23963 new one before you run Configure -- this will help you with most of
23964 the policy defaults.
23965
23966 EOM
23967 fi
23968 if $test -f config.msg; then
23969     echo "Hmm.  I also noted the following information while running:"
23970     echo " "
23971     $cat config.msg >&4
23972     $rm -f config.msg
23973 fi
23974 $rm -f kit*isdone ark*isdone
23975 $rm -rf UU
23976
23977 : End of Configure
23978