This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
simplify the return code in (??{})
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated on Sun Apr  1 12:00:35 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_ipv6_mreq=''
727 d_msg_ctrunc=''
728 d_msg_dontroute=''
729 d_msg_oob=''
730 d_msg_peek=''
731 d_msg_proxy=''
732 d_oldsock=''
733 d_scm_rights=''
734 d_sin6_scope_id=''
735 d_sockaddr_in6=''
736 d_sockaddr_sa_len=''
737 d_socket=''
738 d_sockpair=''
739 sockethdr=''
740 socketlib=''
741 d_socklen_t=''
742 d_socks5_init=''
743 d_sprintf_returns_strlen=''
744 d_sqrtl=''
745 d_srand48_r=''
746 srand48_r_proto=''
747 d_srandom_r=''
748 srandom_r_proto=''
749 d_sresgproto=''
750 d_sresuproto=''
751 d_statblks=''
752 d_statfs_f_flags=''
753 d_statfs_s=''
754 d_static_inline=''
755 perl_static_inline=''
756 d_fstatvfs=''
757 d_statvfs=''
758 d_stdio_cnt_lval=''
759 d_stdio_ptr_lval=''
760 d_stdio_ptr_lval_nochange_cnt=''
761 d_stdio_ptr_lval_sets_cnt=''
762 d_stdiobase=''
763 d_stdstdio=''
764 stdio_base=''
765 stdio_bufsiz=''
766 stdio_cnt=''
767 stdio_filbuf=''
768 stdio_ptr=''
769 d_index=''
770 d_strchr=''
771 d_strcoll=''
772 d_strctcpy=''
773 d_strerrm=''
774 d_strerror=''
775 d_sysernlst=''
776 d_syserrlst=''
777 d_strerror_r=''
778 strerror_r_proto=''
779 d_strftime=''
780 d_strlcat=''
781 d_strlcpy=''
782 d_strtod=''
783 d_strtol=''
784 d_strtold=''
785 d_strtoll=''
786 d_strtoq=''
787 d_strtoul=''
788 d_strtoull=''
789 d_strtouq=''
790 d_strxfrm=''
791 d_symlink=''
792 d_syscall=''
793 d_syscallproto=''
794 d_sysconf=''
795 d_system=''
796 d_tcgetpgrp=''
797 d_tcsetpgrp=''
798 d_telldirproto=''
799 d_time=''
800 timetype=''
801 d_asctime64=''
802 d_ctime64=''
803 d_difftime64=''
804 d_gmtime64=''
805 d_localtime64=''
806 d_mktime64=''
807 d_timegm=''
808 clocktype=''
809 d_times=''
810 d_tmpnam_r=''
811 tmpnam_r_proto=''
812 d_truncate=''
813 d_ttyname_r=''
814 ttyname_r_proto=''
815 d_tzname=''
816 d_u32align=''
817 d_ualarm=''
818 d_umask=''
819 d_semctl_semid_ds=''
820 d_semctl_semun=''
821 d_union_semun=''
822 d_unordered=''
823 d_unsetenv=''
824 d_usleep=''
825 d_usleepproto=''
826 d_ustat=''
827 d_pseudofork=''
828 d_vfork=''
829 usevfork=''
830 d_voidsig=''
831 signal_t=''
832 d_volatile=''
833 d_charvspr=''
834 d_vprintf=''
835 d_wait4=''
836 d_waitpid=''
837 d_wcstombs=''
838 d_wctomb=''
839 d_writev=''
840 dlext=''
841 bin_ELF=''
842 cccdlflags=''
843 ccdlflags=''
844 dlsrc=''
845 ld=''
846 ld_can_script=''
847 lddlflags=''
848 usedl=''
849 doublesize=''
850 ebcdic=''
851 fflushNULL=''
852 fflushall=''
853 fpossize=''
854 fpostype=''
855 gccansipedantic=''
856 gccosandvers=''
857 gccversion=''
858 gidformat=''
859 gidsign=''
860 gidsize=''
861 gidtype=''
862 groupstype=''
863 h_fcntl=''
864 h_sysfile=''
865 html1dir=''
866 html1direxp=''
867 installhtml1dir=''
868 html3dir=''
869 html3direxp=''
870 installhtml3dir=''
871 i_arpainet=''
872 i_assert=''
873 i_crypt=''
874 db_hashtype=''
875 db_prefixtype=''
876 db_version_major=''
877 db_version_minor=''
878 db_version_patch=''
879 i_db=''
880 i_dbm=''
881 i_rpcsvcdbm=''
882 d_dirnamlen=''
883 direntrytype=''
884 i_dirent=''
885 i_dld=''
886 i_dlfcn=''
887 i_fcntl=''
888 i_float=''
889 i_fp=''
890 i_fp_class=''
891 i_gdbm=''
892 d_grpasswd=''
893 i_grp=''
894 i_ieeefp=''
895 i_inttypes=''
896 i_langinfo=''
897 i_libutil=''
898 i_limits=''
899 i_locale=''
900 i_machcthr=''
901 i_malloc=''
902 i_mallocmalloc=''
903 i_math=''
904 i_memory=''
905 i_mntent=''
906 d_gdbm_ndbm_h_uses_prototypes=''
907 d_gdbmndbm_h_uses_prototypes=''
908 d_ndbm=''
909 d_ndbm_h_uses_prototypes=''
910 i_gdbm_ndbm=''
911 i_gdbmndbm=''
912 i_ndbm=''
913 i_netdb=''
914 i_neterrno=''
915 i_netinettcp=''
916 i_niin=''
917 i_sysin=''
918 i_poll=''
919 i_prot=''
920 i_pthread=''
921 d_pwage=''
922 d_pwchange=''
923 d_pwclass=''
924 d_pwcomment=''
925 d_pwexpire=''
926 d_pwgecos=''
927 d_pwpasswd=''
928 d_pwquota=''
929 i_pwd=''
930 i_sfio=''
931 i_shadow=''
932 i_socks=''
933 i_stdbool=''
934 i_stddef=''
935 i_stdlib=''
936 i_string=''
937 strings=''
938 i_sunmath=''
939 i_sysaccess=''
940 i_sysdir=''
941 i_sysfile=''
942 d_voidtty=''
943 i_bsdioctl=''
944 i_sysfilio=''
945 i_sysioctl=''
946 i_syssockio=''
947 i_syslog=''
948 i_sysmman=''
949 i_sysmode=''
950 i_sysmount=''
951 i_sysndir=''
952 i_sysparam=''
953 i_syspoll=''
954 i_sysresrc=''
955 i_syssecrt=''
956 i_sysselct=''
957 i_sysstat=''
958 i_sysstatfs=''
959 i_sysstatvfs=''
960 i_systimes=''
961 i_systypes=''
962 i_sysuio=''
963 i_sysun=''
964 i_sysutsname=''
965 i_sysvfs=''
966 i_syswait=''
967 i_sgtty=''
968 i_termio=''
969 i_termios=''
970 d_tm_tm_gmtoff=''
971 d_tm_tm_zone=''
972 i_systime=''
973 i_systimek=''
974 i_time=''
975 timeincl=''
976 i_unistd=''
977 i_ustat=''
978 i_utime=''
979 i_values=''
980 i_stdarg=''
981 i_varargs=''
982 i_varhdr=''
983 i_vfork=''
984 d_inc_version_list=''
985 inc_version_list=''
986 inc_version_list_init=''
987 installprefix=''
988 installprefixexp=''
989 installstyle=''
990 installusrbinperl=''
991 intsize=''
992 longsize=''
993 shortsize=''
994 issymlink=''
995 libc=''
996 ldlibpthname=''
997 libperl=''
998 shrpenv=''
999 useshrplib=''
1000 glibpth=''
1001 libpth=''
1002 loclibpth=''
1003 plibpth=''
1004 xlibpth=''
1005 ignore_versioned_solibs=''
1006 libs=''
1007 libsdirs=''
1008 libsfiles=''
1009 libsfound=''
1010 libspath=''
1011 lns=''
1012 d_PRIEUldbl=''
1013 d_PRIFUldbl=''
1014 d_PRIGUldbl=''
1015 d_PRIeldbl=''
1016 d_PRIfldbl=''
1017 d_PRIgldbl=''
1018 d_SCNfldbl=''
1019 sPRIEUldbl=''
1020 sPRIFUldbl=''
1021 sPRIGUldbl=''
1022 sPRIeldbl=''
1023 sPRIfldbl=''
1024 sPRIgldbl=''
1025 sSCNfldbl=''
1026 lseeksize=''
1027 lseektype=''
1028 mad=''
1029 madlyh=''
1030 madlyobj=''
1031 madlysrc=''
1032 make_set_make=''
1033 d_mymalloc=''
1034 freetype=''
1035 mallocobj=''
1036 mallocsrc=''
1037 malloctype=''
1038 usemallocwrap=''
1039 usemymalloc=''
1040 installman1dir=''
1041 man1dir=''
1042 man1direxp=''
1043 man1ext=''
1044 installman3dir=''
1045 man3dir=''
1046 man3direxp=''
1047 man3ext=''
1048 modetype=''
1049 multiarch=''
1050 mydomain=''
1051 myhostname=''
1052 phostname=''
1053 c=''
1054 n=''
1055 d_eofnblk=''
1056 eagain=''
1057 o_nonblock=''
1058 rd_nodata=''
1059 need_va_copy=''
1060 netdb_hlen_type=''
1061 netdb_host_type=''
1062 netdb_name_type=''
1063 netdb_net_type=''
1064 groupcat=''
1065 hostcat=''
1066 passcat=''
1067 orderlib=''
1068 ranlib=''
1069 d_perl_otherlibdirs=''
1070 otherlibdirs=''
1071 package=''
1072 spackage=''
1073 pager=''
1074 api_revision=''
1075 api_subversion=''
1076 api_version=''
1077 api_versionstring=''
1078 patchlevel=''
1079 perl_patchlevel=''
1080 revision=''
1081 subversion=''
1082 version=''
1083 version_patchlevel_string=''
1084 perl5=''
1085 perladmin=''
1086 perlpath=''
1087 d_nv_preserves_uv=''
1088 d_nv_zero_is_allbits_zero=''
1089 i16size=''
1090 i16type=''
1091 i32size=''
1092 i32type=''
1093 i64size=''
1094 i64type=''
1095 i8size=''
1096 i8type=''
1097 ivsize=''
1098 ivtype=''
1099 nv_overflows_integers_at=''
1100 nv_preserves_uv_bits=''
1101 nvsize=''
1102 nvtype=''
1103 u16size=''
1104 u16type=''
1105 u32size=''
1106 u32type=''
1107 u64size=''
1108 u64type=''
1109 u8size=''
1110 u8type=''
1111 uvsize=''
1112 uvtype=''
1113 ivdformat=''
1114 nvEUformat=''
1115 nvFUformat=''
1116 nvGUformat=''
1117 nveformat=''
1118 nvfformat=''
1119 nvgformat=''
1120 uvXUformat=''
1121 uvoformat=''
1122 uvuformat=''
1123 uvxformat=''
1124 pidtype=''
1125 prefix=''
1126 prefixexp=''
1127 installprivlib=''
1128 privlib=''
1129 privlibexp=''
1130 prototype=''
1131 ptrsize=''
1132 d_PRIXU64=''
1133 d_PRId64=''
1134 d_PRIi64=''
1135 d_PRIo64=''
1136 d_PRIu64=''
1137 d_PRIx64=''
1138 sPRIXU64=''
1139 sPRId64=''
1140 sPRIi64=''
1141 sPRIo64=''
1142 sPRIu64=''
1143 sPRIx64=''
1144 d_quad=''
1145 quadkind=''
1146 quadtype=''
1147 uquadtype=''
1148 drand01=''
1149 randbits=''
1150 randfunc=''
1151 randseedtype=''
1152 seedfunc=''
1153 installscript=''
1154 scriptdir=''
1155 scriptdirexp=''
1156 selectminbits=''
1157 selecttype=''
1158 sh=''
1159 sig_count=''
1160 sig_name=''
1161 sig_name_init=''
1162 sig_num=''
1163 sig_num_init=''
1164 sig_size=''
1165 d_sitearch=''
1166 installsitearch=''
1167 sitearch=''
1168 sitearchexp=''
1169 installsitebin=''
1170 sitebin=''
1171 sitebinexp=''
1172 installsitehtml1dir=''
1173 sitehtml1dir=''
1174 sitehtml1direxp=''
1175 installsitehtml3dir=''
1176 sitehtml3dir=''
1177 sitehtml3direxp=''
1178 installsitelib=''
1179 sitelib=''
1180 sitelib_stem=''
1181 sitelibexp=''
1182 installsiteman1dir=''
1183 siteman1dir=''
1184 siteman1direxp=''
1185 installsiteman3dir=''
1186 siteman3dir=''
1187 siteman3direxp=''
1188 siteprefix=''
1189 siteprefixexp=''
1190 installsitescript=''
1191 sitescript=''
1192 sitescriptexp=''
1193 sizesize=''
1194 sizetype=''
1195 so=''
1196 socksizetype=''
1197 sharpbang=''
1198 shsharp=''
1199 spitshell=''
1200 src=''
1201 ssizetype=''
1202 st_ino_sign=''
1203 st_ino_size=''
1204 startperl=''
1205 startsh=''
1206 stdchar=''
1207 d_stdio_stream_array=''
1208 stdio_stream_array=''
1209 sysman=''
1210 sGMTIME_max=''
1211 sGMTIME_min=''
1212 sLOCALTIME_max=''
1213 sLOCALTIME_min=''
1214 trnl=''
1215 uidformat=''
1216 uidsign=''
1217 uidsize=''
1218 uidtype=''
1219 archname64=''
1220 use64bitall=''
1221 use64bitint=''
1222 dtrace=''
1223 usedtrace=''
1224 usefaststdio=''
1225 usekernprocpathname=''
1226 ccflags_uselargefiles=''
1227 ldflags_uselargefiles=''
1228 libswanted_uselargefiles=''
1229 uselargefiles=''
1230 uselongdouble=''
1231 usemorebits=''
1232 usemultiplicity=''
1233 nm_opt=''
1234 nm_so_opt=''
1235 runnm=''
1236 usenm=''
1237 usensgetexecutablepath=''
1238 useperlio=''
1239 usesocks=''
1240 d_oldpthreads=''
1241 use5005threads=''
1242 useithreads=''
1243 usereentrant=''
1244 usethreads=''
1245 incpath=''
1246 mips_type=''
1247 usrinc=''
1248 vaproto=''
1249 d_vendorarch=''
1250 installvendorarch=''
1251 vendorarch=''
1252 vendorarchexp=''
1253 d_vendorbin=''
1254 installvendorbin=''
1255 vendorbin=''
1256 vendorbinexp=''
1257 installvendorhtml1dir=''
1258 vendorhtml1dir=''
1259 vendorhtml1direxp=''
1260 installvendorhtml3dir=''
1261 vendorhtml3dir=''
1262 vendorhtml3direxp=''
1263 d_vendorlib=''
1264 installvendorlib=''
1265 vendorlib=''
1266 vendorlib_stem=''
1267 vendorlibexp=''
1268 installvendorman1dir=''
1269 vendorman1dir=''
1270 vendorman1direxp=''
1271 installvendorman3dir=''
1272 vendorman3dir=''
1273 vendorman3direxp=''
1274 usevendorprefix=''
1275 vendorprefix=''
1276 vendorprefixexp=''
1277 d_vendorscript=''
1278 installvendorscript=''
1279 vendorscript=''
1280 vendorscriptexp=''
1281 versiononly=''
1282 defvoidused=''
1283 voidflags=''
1284 yacc=''
1285 yaccflags=''
1286 CONFIG=''
1287
1288 : Detect odd OSs
1289 define='define'
1290 undef='undef'
1291 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1292 rmlist=''
1293
1294 : We must find out about Eunice early
1295 eunicefix=':'
1296 if test -f /etc/unixtovms; then
1297         eunicefix=/etc/unixtovms
1298 fi
1299 if test -f /etc/unixtovms.exe; then
1300         eunicefix=/etc/unixtovms.exe
1301 fi
1302
1303 : Set executable suffix now -- needed before hints available
1304 if test -f "/libs/version.library"; then
1305 : Amiga OS
1306     _exe=""
1307 elif test -f "/system/gnu_library/bin/ar.pm"; then
1308 : Stratus VOS
1309     _exe=".pm"
1310 elif test -n "$DJGPP"; then
1311 : DOS DJGPP
1312     _exe=".exe"
1313 elif test -d c:/. -o -n "$is_os2" ; then
1314 : OS/2 or cygwin
1315     _exe=".exe"
1316 fi
1317
1318 groupstype=''
1319 i_whoami=''
1320 : Trailing extension.  Override this in a hint file, if needed.
1321 : Extra object files, if any, needed on this platform.
1322 archobjs=''
1323 archname=''
1324 : Possible local include directories to search.
1325 : Set locincpth to "" in a hint file to defeat local include searches.
1326 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1327 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1328 :
1329 : no include file wanted by default
1330 inclwanted=''
1331
1332 : Enable -DEBUGGING and -DDEBUGGING from the command line
1333 EBUGGING=''
1334 DEBUGGING=''
1335
1336 libnames=''
1337 : change the next line if compiling for Xenix/286 on Xenix/386
1338 xlibpth='/usr/lib/386 /lib/386'
1339 : Possible local library directories to search.
1340 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1341 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1342
1343 : general looking path for locating libraries
1344 glibpth="/lib /usr/lib $xlibpth"
1345 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1346 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1347 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1348 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1349
1350 : Private path used by Configure to find libraries.  Its value
1351 : is prepended to libpth. This variable takes care of special
1352 : machines, like the mips.  Usually, it should be empty.
1353 plibpth=''
1354
1355 : default library list
1356 libswanted=''
1357 : some systems want to use only the non-versioned libso:s
1358 ignore_versioned_solibs=''
1359 : set usethreads on the Configure command line to enable threads.
1360 usereentrant='undef'
1361 : full support for void wanted by default
1362 defvoidused=15
1363
1364 ccname=''
1365 ccversion=''
1366 perllibs=''
1367 : set useposix=false in your hint file to disable the POSIX extension.
1368 useposix=true
1369 : set useopcode=false in your hint file to disable the Opcode extension.
1370 useopcode=true
1371 archname64=''
1372 ccflags_uselargefiles=''
1373 ldflags_uselargefiles=''
1374 libswanted_uselargefiles=''
1375 : set usemultiplicity on the Configure command line to enable multiplicity.
1376 : set usesocks on the Configure command line to enable socks.
1377 : List of libraries we want.
1378 : If anyone needs extra -lxxx, put those in a hint file.
1379 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1380 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1381 : We probably want to search /usr/shlib before most other libraries.
1382 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1383 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1384 glibpth="/usr/shlib $glibpth"
1385 : Do not use vfork unless overridden by a hint file.
1386 usevfork=false
1387
1388 : Find the basic shell for Bourne shell scripts
1389 case "$sh" in
1390 '')
1391         case "$SYSTYPE" in
1392         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1393         *) xxx='/bin/sh';;
1394         esac
1395         if test -f "$xxx"; then
1396                 sh="$xxx"
1397         else
1398                 : Build up a list and do a single loop so we can 'break' out.
1399                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1400                 for xxx in sh bash ksh pdksh ash; do
1401                         for p in $pth; do
1402                                 try="$try ${p}/${xxx}"
1403                         done
1404                 done
1405                 for xxx in $try; do
1406                         if test -f "$xxx"; then
1407                                 sh="$xxx";
1408                                 break
1409                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1410                                 sh="$xxx";
1411                                 break
1412                         elif test -f "$xxx.exe"; then
1413                                 sh="$xxx";
1414                                 break
1415                         fi
1416                 done
1417         fi
1418         ;;
1419 esac
1420
1421 case "$sh" in
1422 '')     cat >&2 <<EOM
1423 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1424
1425 Usually it's in /bin/sh.  How did you even get this far?
1426 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1427 we'll try to straighten this all out.
1428 EOM
1429         exit 1
1430         ;;
1431 esac
1432
1433 : see if sh knows # comments
1434 if `$sh -c '#' >/dev/null 2>&1`; then
1435         shsharp=true
1436         spitshell=cat
1437         xcat=/bin/cat
1438         test -f $xcat$_exe || xcat=/usr/bin/cat
1439         if test ! -f $xcat$_exe; then
1440                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1441                         if test -f $p/cat$_exe; then
1442                                 xcat=$p/cat
1443                                 break
1444                         fi
1445                 done
1446                 if test ! -f $xcat$_exe; then
1447                         echo "Can't find cat anywhere!"
1448                         exit 1
1449                 fi
1450         fi
1451         echo "#!$xcat" >sharp
1452         $eunicefix sharp
1453         chmod +x sharp
1454         ./sharp > today 2>/dev/null
1455         if test -s today; then
1456                 sharpbang='#!'
1457         else
1458                 echo "#! $xcat" > sharp
1459                 $eunicefix sharp
1460                 chmod +x sharp
1461                 ./sharp > today 2>/dev/null
1462                 if test -s today; then
1463                         sharpbang='#! '
1464                 else
1465                         sharpbang=': use '
1466                 fi
1467         fi
1468 else
1469         echo " "
1470         echo "Your $sh doesn't grok # comments--I will strip them later on."
1471         shsharp=false
1472         cd ..
1473         echo "exec grep -v '^[  ]*#'" >spitshell
1474         chmod +x spitshell
1475         $eunicefix spitshell
1476         spitshell=`pwd`/spitshell
1477         cd UU
1478         echo "I presume that if # doesn't work, #! won't work either!"
1479         sharpbang=': use '
1480 fi
1481 rm -f sharp today
1482
1483 : figure out how to guarantee sh startup
1484 case "$startsh" in
1485 '') startsh=${sharpbang}${sh} ;;
1486 *)
1487 esac
1488 cat >sharp <<EOSS
1489 $startsh
1490 set abc
1491 test "$?abc" != 1
1492 EOSS
1493
1494 chmod +x sharp
1495 $eunicefix sharp
1496 if ./sharp; then
1497         : echo "Yup, it does."
1498 else
1499         echo "Hmm... '$startsh' does not guarantee sh startup..."
1500         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1501 fi
1502 rm -f sharp
1503
1504 : Save command line options in file UU/cmdline.opt for later use in
1505 : generating config.sh.
1506 cat > cmdline.opt <<EOSH
1507 : Configure command line arguments.
1508 config_arg0='$0'
1509 config_args='$*'
1510 config_argc=$#
1511 EOSH
1512 argn=1
1513 args_exp=''
1514 args_sep=''
1515 for arg in "$@"; do
1516         cat >>cmdline.opt <<EOSH
1517 config_arg$argn='$arg'
1518 EOSH
1519         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1520 $arg
1521 EOC
1522         arg_exp=`cat cmdl.opt`
1523         args_exp="$args_exp$args_sep'$arg_exp'"
1524         argn=`expr $argn + 1`
1525         args_sep=' '
1526 done
1527 rm -f cmdl.opt
1528
1529 : produce awk script to parse command line options
1530 cat >options.awk <<'EOF'
1531 BEGIN {
1532         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1533
1534         len = length(optstr);
1535         for (i = 1; i <= len; i++) {
1536                 c = substr(optstr, i, 1);
1537                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1538                 if (a == ":") {
1539                         arg[c] = 1;
1540                         i++;
1541                 }
1542                 opt[c] = 1;
1543         }
1544 }
1545 {
1546         expect = 0;
1547         str = $0;
1548         if (substr(str, 1, 1) != "-") {
1549                 printf("'%s'\n", str);
1550                 next;
1551         }
1552         len = length($0);
1553         for (i = 2; i <= len; i++) {
1554                 c = substr(str, i, 1);
1555                 if (!opt[c]) {
1556                         printf("-%s\n", substr(str, i));
1557                         next;
1558                 }
1559                 printf("-%s\n", c);
1560                 if (arg[c]) {
1561                         if (i < len)
1562                                 printf("'%s'\n", substr(str, i + 1));
1563                         else
1564                                 expect = 1;
1565                         next;
1566                 }
1567         }
1568 }
1569 END {
1570         if (expect)
1571                 print "?";
1572 }
1573 EOF
1574
1575 : process the command line options
1576 set X `for arg in "$@"; do echo "X$arg"; done |
1577         sed -e s/X// | awk -f options.awk`
1578 eval "set $*"
1579 shift
1580 rm -f options.awk
1581
1582 : set up default values
1583 fastread=''
1584 reuseval=false
1585 config_sh=''
1586 alldone=''
1587 error=''
1588 silent=''
1589 extractsh=''
1590 override=''
1591 knowitall=''
1592 rm -f optdef.sh posthint.sh
1593 cat >optdef.sh <<EOS
1594 $startsh
1595 EOS
1596
1597
1598 : option parsing
1599 while test $# -gt 0; do
1600         case "$1" in
1601         -d) shift; fastread=yes;;
1602         -e) shift; alldone=cont;;
1603         -f)
1604                 shift
1605                 cd ..
1606                 if test -r "$1"; then
1607                         config_sh="$1"
1608                 else
1609                         echo "$me: cannot read config file $1." >&2
1610                         error=true
1611                 fi
1612                 cd UU
1613                 shift;;
1614         --help|\
1615         -h) shift; error=true;;
1616         -r) shift; reuseval=true;;
1617         -s) shift; silent=true; realsilent=true;;
1618         -E) shift; alldone=exit;;
1619         -K) shift; knowitall=true;;
1620         -O) shift; override=true;;
1621         -S) shift; silent=true; extractsh=true;;
1622         -D)
1623                 shift
1624                 case "$1" in
1625                 *=)
1626                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1627                         echo "$me: ignoring -D $1" >&2
1628                         ;;
1629                 *=*) echo "$1" | \
1630                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1631                 *) echo "$1='define'" >> optdef.sh;;
1632                 esac
1633                 shift
1634                 ;;
1635         -U)
1636                 shift
1637                 case "$1" in
1638                 *=) echo "$1" >> optdef.sh;;
1639                 *=*)
1640                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1641                         echo "$me: ignoring -U $1" >&2
1642                         ;;
1643                 *) echo "$1='undef'" >> optdef.sh;;
1644                 esac
1645                 shift
1646                 ;;
1647         -A)
1648             shift
1649             xxx=''
1650             yyy="$1"
1651             zzz=''
1652             uuu=undef
1653             case "$yyy" in
1654             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1655                  case "$zzz" in
1656                  *:*) zzz='' ;;
1657                  *)   xxx=append
1658                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1659                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1660                  esac
1661                  ;;
1662             esac
1663             case "$xxx" in
1664             '')  case "$yyy" in
1665                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1666                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1667                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1668                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1669                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1670                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1671                  esac
1672                  ;;
1673             esac
1674             case "$xxx" in
1675             append)
1676                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1677             clear)
1678                 echo "$yyy=''"                  >> posthint.sh ;;
1679             define)
1680                 case "$zzz" in
1681                 '') zzz=define ;;
1682                 esac
1683                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1684             eval)
1685                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1686             prepend)
1687                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1688             undef)
1689                 case "$zzz" in
1690                 '') zzz="$uuu" ;;
1691                 esac
1692                 echo "$yyy=$zzz"                >> posthint.sh ;;
1693             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1694             esac
1695             shift
1696             ;;
1697         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1698             exit 0;;
1699         --) break;;
1700         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1701         *) break;;
1702         esac
1703 done
1704
1705 case "$error" in
1706 true)
1707         cat >&2 <<EOM
1708 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1709                  [-U symbol] [-U symbol=] [-A command:symbol...]
1710   -d : use defaults for all answers.
1711   -e : go on without questioning past the production of config.sh.
1712   -f : specify an alternate default configuration file.
1713   -h : print this help message and exit (with an error status).
1714   -r : reuse C symbols value if possible (skips costly nm extraction).
1715   -s : silent mode, only echoes questions and essential information.
1716   -D : define symbol to have some value:
1717          -D symbol         symbol gets the value 'define'
1718          -D symbol=value   symbol gets the value 'value'
1719        common used examples (see INSTALL for more info):
1720          -Duse64bitint            use 64bit integers
1721          -Duse64bitall            use 64bit integers and pointers
1722          -Dusethreads             use thread support
1723          -Dinc_version_list=none  do not include older perl trees in @INC
1724          -DEBUGGING=none          DEBUGGING options
1725          -Dcc=gcc                 choose your compiler
1726          -Dprefix=/opt/perl5      choose your destination
1727   -E : stop at the end of questions, after having produced config.sh.
1728   -K : do not use unless you know what you are doing.
1729   -O : let -D and -U override definitions from loaded configuration file.
1730   -S : perform variable substitutions on all .SH files (can mix with -f)
1731   -U : undefine symbol:
1732          -U symbol    symbol gets the value 'undef'
1733          -U symbol=   symbol gets completely empty
1734        e.g.:  -Uversiononly
1735   -A : manipulate symbol after the platform specific hints have been applied:
1736          -A append:symbol=value   append value to symbol
1737          -A symbol=value          like append:, but with a separating space
1738          -A define:symbol=value   define symbol to have value
1739          -A clear:symbol          define symbol to be ''
1740          -A define:symbol         define symbol to be 'define'
1741          -A eval:symbol=value     define symbol to be eval of value
1742          -A prepend:symbol=value  prepend value to symbol
1743          -A undef:symbol          define symbol to be 'undef'
1744          -A undef:symbol=         define symbol to be ''
1745        e.g.:  -A prepend:libswanted='cl pthread '
1746               -A ccflags=-DSOME_MACRO
1747   -V : print version number and exit (with a zero status).
1748 EOM
1749         exit 1
1750         ;;
1751 esac
1752
1753 : Sanity checks
1754 case "$fastread$alldone" in
1755 yescont|yesexit) ;;
1756 *)
1757         case "$extractsh" in
1758         true) ;;
1759         *)
1760                 if test ! -t 0; then
1761                         echo "Say 'sh Configure', not 'sh <Configure'"
1762                         exit 1
1763                 fi
1764                 ;;
1765         esac
1766         ;;
1767 esac
1768
1769 exec 4>&1
1770 case "$silent" in
1771 true) exec 1>/dev/null;;
1772 esac
1773
1774 : run the defines and the undefines, if any, but leave the file out there...
1775 touch optdef.sh
1776 . ./optdef.sh
1777 : create the posthint manipulation script and leave the file out there...
1778 touch posthint.sh
1779
1780 : set package name
1781 package='perl5'
1782 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1783 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1784 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1785 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1786 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1787 esac
1788
1789 : Some greps do not return status, grrr.
1790 echo "grimblepritz" >grimble
1791 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1792         contains=contains
1793 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1794         contains=grep
1795 else
1796         contains=contains
1797 fi
1798 rm -f grimble
1799 : the following should work in any shell
1800 case "$contains" in
1801 contains*)
1802         echo " "
1803         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1804         cat >contains <<'EOSS'
1805 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1806 EOSS
1807 chmod +x contains
1808 esac
1809
1810 : Find the path to the source tree
1811 case "$src" in
1812 '') case "$0" in
1813     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1814          case "$src" in
1815          /*)    ;;
1816          .)     ;;
1817          *)     src=`cd ../$src && pwd` ;;
1818          esac
1819          ;;
1820     *)   src='.';;
1821     esac;;
1822 esac
1823 case "$src" in
1824 '')     src=/
1825         rsrc=/
1826         ;;
1827 /*)     rsrc="$src";;
1828 *)      rsrc="../$src";;
1829 esac
1830 if test -f $rsrc/Configure && \
1831         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1832 then
1833    : found it, so we are ok.
1834 else
1835         rsrc=''
1836         for src in . .. ../.. ../../.. ../../../..; do
1837                 if test -f ../$src/Configure && \
1838                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1839                 then
1840                         rsrc=../$src
1841                         break
1842                 fi
1843         done
1844 fi
1845 case "$rsrc" in
1846 '')
1847         cat <<EOM >&4
1848
1849 Sorry, I can't seem to locate the source dir for $package.  Please start
1850 Configure with an explicit path -- i.e. /some/path/Configure.
1851
1852 EOM
1853         exit 1
1854         ;;
1855 ../.)   rsrc='..';;
1856 *)
1857         echo " "
1858         echo "Sources for $package found in \"$src\"." >&4
1859         ;;
1860 esac
1861
1862 : script used to extract .SH files with variable substitutions
1863 cat >extract <<'EOS'
1864 PERL_CONFIG_SH=true
1865 echo "Doing variable substitutions on .SH files..."
1866 if test -f MANIFEST; then
1867         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1868 else
1869         echo "(Looking for .SH files under the source directory.)"
1870         set x `(cd "$src"; find . -name "*.SH" -print)`
1871 fi
1872 shift
1873 case $# in
1874 0) set x `(cd "$src"; echo *.SH)`; shift;;
1875 esac
1876 if test ! -f "$src/$1"; then
1877         shift
1878 fi
1879 mkdir_p='
1880 name=$1;
1881 create="";
1882 while test $name; do
1883         if test ! -d "$name"; then
1884                 create="$name $create";
1885                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1886                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1887         else
1888                 name="";
1889         fi;
1890 done;
1891 for file in $create; do
1892         mkdir $file;
1893 done
1894 '
1895 for file in $*; do
1896         case "$src" in
1897         ".")
1898                 case "$file" in
1899                 */*)
1900                         dir=`expr X$file : 'X\(.*\)/'`
1901                         file=`expr X$file : 'X.*/\(.*\)'`
1902                         (cd "$dir" && . ./$file)
1903                         ;;
1904                 *)
1905                         . ./$file
1906                         ;;
1907                 esac
1908                 ;;
1909         *)
1910                 case "$file" in
1911                 */*)
1912                         dir=`expr X$file : 'X\(.*\)/'`
1913                         file=`expr X$file : 'X.*/\(.*\)'`
1914                         (set x $dir; shift; eval $mkdir_p)
1915                         sh <"$src/$dir/$file"
1916                         ;;
1917                 *)
1918                         sh <"$src/$file"
1919                         ;;
1920                 esac
1921                 ;;
1922         esac
1923 done
1924 if test -f "$src/config_h.SH"; then
1925         if test ! -f config.h; then
1926         : oops, they left it out of MANIFEST, probably, so do it anyway.
1927         . "$src/config_h.SH"
1928         fi
1929 fi
1930 EOS
1931
1932 : extract files and exit if asked to do so
1933 case "$extractsh" in
1934 true)
1935         case "$realsilent" in
1936         true) ;;
1937         *) exec 1>&4;;
1938         esac
1939         case "$config_sh" in
1940         '') config_sh='config.sh';;
1941         esac
1942         echo " "
1943         echo "Fetching answers from $config_sh..."
1944         cd ..
1945         . $config_sh
1946         test "$override" && . ./optdef.sh
1947         echo " "
1948         . UU/extract
1949         rm -rf UU
1950         echo "Extraction done."
1951         exit 0
1952         ;;
1953 esac
1954
1955 : Eunice requires " " instead of "", can you believe it
1956 echo " "
1957 : Here we go...
1958 echo "Beginning of configuration questions for $package."
1959
1960 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1961
1962 : first determine how to suppress newline on echo command
1963 echo " "
1964 echo "Checking echo to see how to suppress newlines..."
1965 (echo "hi there\c" ; echo " ") >.echotmp
1966 if $contains c .echotmp >/dev/null 2>&1 ; then
1967         echo "...using -n."
1968         n='-n'
1969         c=''
1970 else
1971         cat <<'EOM'
1972 ...using \c
1973 EOM
1974         n=''
1975         c='\c'
1976 fi
1977 echo $n "The star should be here-->$c"
1978 echo '*'
1979 rm -f .echotmp
1980
1981 : Now test for existence of everything in MANIFEST
1982 echo " "
1983 if test -f "$rsrc/MANIFEST"; then
1984         echo "First let's make sure your kit is complete.  Checking..." >&4
1985         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1986                 (split -l 50 2>/dev/null || split -50)
1987         rm -f missing
1988         tmppwd=`pwd`
1989         for filelist in x??; do
1990                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1991                         >/dev/null 2>>"$tmppwd/missing")
1992         done
1993         if test -s missing; then
1994                 cat missing >&4
1995                 cat >&4 <<'EOM'
1996
1997 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1998
1999 You have the option of continuing the configuration process, despite the
2000 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2001 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2002 and contact the author (perlbug@perl.org).
2003
2004 EOM
2005                 echo $n "Continue? [n] $c" >&4
2006                 read ans
2007                 case "$ans" in
2008                 y*)
2009                         echo "Continuing..." >&4
2010                         rm -f missing
2011                         ;;
2012                 *)
2013                         echo "ABORTING..." >&4
2014                         kill $$
2015                         ;;
2016                 esac
2017         else
2018                 echo "Looks good..."
2019         fi
2020 else
2021         echo "There is no MANIFEST file.  I hope your kit is complete !"
2022 fi
2023 rm -f missing x??
2024
2025 : Find the appropriate value for a newline for tr
2026 echo " "
2027 if test -n "$DJGPP"; then
2028        trnl='\012'
2029 fi
2030 if test X"$trnl" = X; then
2031         case "`echo foo|tr '\n' x 2>/dev/null`" in
2032         foox) trnl='\n' ;;
2033         esac
2034 fi
2035 if test X"$trnl" = X; then
2036         case "`echo foo|tr '\012' x 2>/dev/null`" in
2037         foox) trnl='\012' ;;
2038         esac
2039 fi
2040 if test X"$trnl" = X; then
2041        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2042        fooxy) trnl='\n\r' ;;
2043        esac
2044 fi
2045 if test X"$trnl" = X; then
2046         cat <<EOM >&2
2047
2048 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2049
2050 EOM
2051         exit 1
2052 fi
2053
2054 : compute the number of columns on the terminal for proper question formatting
2055 case "$COLUMNS" in
2056 '') COLUMNS='80';;
2057 esac
2058
2059 : set up the echo used in my read
2060 myecho="case \"\$xxxm\" in
2061 '') echo $n \"\$rp $c\" >&4;;
2062 *) case \"\$rp\" in
2063         '') echo $n \"[\$xxxm] $c\";;
2064         *)
2065                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2066                         echo \"\$rp\" >&4
2067                         echo $n \"[\$xxxm] $c\" >&4
2068                 else
2069                         echo $n \"\$rp [\$xxxm] $c\" >&4
2070                 fi
2071                 ;;
2072         esac;;
2073 esac"
2074
2075 : now set up to do reads with possible shell escape and default assignment
2076 cat <<EOSC >myread
2077 $startsh
2078 xxxm=\$dflt
2079 $myecho
2080 ans='!'
2081 case "\$fastread" in
2082 yes) case "\$dflt" in
2083         '') ;;
2084         *) ans='';
2085                 case "\$silent-\$rp" in
2086                 true-) ;;
2087                 *) echo " " >&4;;
2088                 esac;;
2089         esac;;
2090 *) case "\$silent" in
2091         true) case "\$rp" in
2092                 '') ans='';;
2093                 esac;;
2094         esac;;
2095 esac
2096 while expr "X\$ans" : "X!" >/dev/null; do
2097         read answ
2098         set x \$xxxm
2099         shift
2100         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2101         case  "\$answ" in
2102         "!")
2103                 sh 1>&4
2104                 echo " "
2105                 $myecho
2106                 ;;
2107         !*)
2108                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2109                 shift
2110                 sh 1>&4 -c "\$*"
2111                 echo " "
2112                 $myecho
2113                 ;;
2114         "\$ans")
2115                 case "\$ans" in
2116                 \\&*)
2117                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2118                         shift
2119                         case "\$1" in
2120                         -d)
2121                                 fastread=yes
2122                                 echo "(OK, I'll run with -d after this question.)" >&4
2123                                 ;;
2124                         -*)
2125                                 echo "*** Sorry, \$1 not supported yet." >&4
2126                                 ;;
2127                         esac
2128                         $myecho
2129                         ans=!
2130                         ;;
2131                 esac;;
2132         *)
2133                 case "\$aok" in
2134                 y)
2135                         echo "*** Substitution done -- please confirm."
2136                         xxxm="\$ans"
2137                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2138                         xxxm="\$ans"
2139                         ans=!
2140                         ;;
2141                 *)
2142                         echo "*** Error -- try again."
2143                         ans=!
2144                         ;;
2145                 esac
2146                 $myecho
2147                 ;;
2148         esac
2149         case "\$ans\$xxxm\$nostick" in
2150         '')
2151                 ans=!
2152                 $myecho
2153                 ;;
2154         esac
2155 done
2156 case "\$ans" in
2157 '') ans="\$xxxm";;
2158 esac
2159 EOSC
2160
2161 : create .config dir to save info across Configure sessions
2162 test -d ../.config || mkdir ../.config
2163 cat >../.config/README <<EOF
2164 This directory created by Configure to save information that should
2165 persist across sessions for $package.
2166
2167 You may safely delete it if you wish.
2168 EOF
2169
2170 : See if we are using a devel version and want that
2171 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2172 case "$usedevel" in
2173 $define|true|[yY]*)
2174     usedevel="$define" ;;
2175 *) case "$xversion" in
2176    *[13579])
2177         cat >&4 <<EOH
2178 *** WHOA THERE!!! ***
2179
2180     This is an UNSTABLE DEVELOPMENT release.
2181     The version of this $package distribution is $xversion, that is, odd,
2182     (as opposed to even) and that signifies a development release.
2183     If you want a maintenance release, you want an even-numbered version.
2184
2185     Do ***NOT*** install this into production use.
2186     Data corruption and crashes are possible.
2187
2188     It is most seriously suggested that you do not continue any further
2189     unless you want to help in developing and debugging Perl.
2190
2191     If you *still* want to build perl, you can answer 'y' now,
2192     or pass -Dusedevel to Configure.
2193
2194 EOH
2195         rp='Do you really want to continue?'
2196         dflt='n'
2197         . ./myread
2198         case "$ans" in
2199         [yY]) echo >&4 "Okay, continuing."
2200               usedevel="$define" ;;
2201         *) echo >&4 "Okay, bye."
2202            exit 1
2203            ;;
2204         esac
2205         ;;
2206     esac
2207     usedevel="$undef"
2208     ;;
2209 esac
2210 case "$usedevel" in
2211 $define|true|[yY]*)
2212         case "$versiononly" in
2213         '') versiononly="$define" ;;
2214         esac
2215         case "$installusrbinperl" in
2216         '') installusrbinperl="$undef" ;;
2217         esac
2218         ;;
2219 esac
2220
2221 : general instructions
2222 needman=true
2223 firsttime=true
2224 user=`(logname) 2>/dev/null`
2225 case "$user" in
2226 '') user=`whoami 2>&1`;;
2227 esac
2228 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2229         firsttime=false
2230         echo " "
2231         rp='Would you like to see the instructions?'
2232         dflt=n
2233         . ./myread
2234         case "$ans" in
2235         [yY]*) ;;
2236         *) needman=false;;
2237         esac
2238 fi
2239 if $needman; then
2240         cat <<EOH
2241
2242 This installation shell script will examine your system and ask you questions
2243 to determine how the perl5 package should be installed. If you get
2244 stuck on a question, you may use a ! shell escape to start a subshell or
2245 execute a command.  Many of the questions will have default answers in square
2246 brackets; typing carriage return will give you the default.
2247
2248 On some of the questions which ask for file or directory names you are allowed
2249 to use the ~name construct to specify the login directory belonging to "name",
2250 even if you don't have a shell which knows about that.  Questions where this is
2251 allowed will be marked "(~name ok)".
2252
2253 EOH
2254         rp=''
2255         dflt='Type carriage return to continue'
2256         . ./myread
2257         cat <<'EOH'
2258
2259 The prompter used in this script allows you to use shell variables and
2260 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2261 in the default answer, as if the default line was a set of arguments given to a
2262 script shell.  This means you may also use $* to repeat the whole default line,
2263 so you do not have to re-type everything to add something to the default.
2264
2265 Every time there is a substitution, you will have to confirm.  If there is an
2266 error (e.g. an unmatched backtick), the default answer will remain unchanged
2267 and you will be prompted again.
2268
2269 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2270 the questions and use the computed defaults (or the previous answers if there
2271 was already a config.sh file). Type 'Configure -h' for a list of options.
2272 You may also start interactively and then answer '& -d' at any prompt to turn
2273 on the non-interactive behaviour for the remainder of the execution.
2274
2275 EOH
2276         . ./myread
2277         cat <<EOH
2278
2279 Much effort has been expended to ensure that this shell script will run on any
2280 Unix system.  If despite that it blows up on yours, your best bet is to edit
2281 Configure and run it again.  If you can't run Configure for some reason,
2282 you'll have to generate a config.sh file by hand.  Whatever problems you
2283 have, let me (perlbug@perl.org) know how I blew it.
2284
2285 This installation script affects things in two ways:
2286
2287 1) it may do direct variable substitutions on some of the files included
2288    in this kit.
2289 2) it builds a config.h file for inclusion in C programs.  You may edit
2290    any of these files as the need arises after running this script.
2291
2292 If you make a mistake on a question, there is no easy way to back up to it
2293 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2294 files.  Configure will offer to let you do this before it runs the SH files.
2295
2296 EOH
2297         dflt='Type carriage return to continue'
2298         . ./myread
2299         case "$firsttime" in
2300         true) echo $user >>../.config/instruct;;
2301         esac
2302 fi
2303
2304 : find out where common programs are
2305 echo " "
2306 echo "Locating common programs..." >&4
2307 cat <<EOSC >loc
2308 $startsh
2309 case \$# in
2310 0) exit 1;;
2311 esac
2312 thing=\$1
2313 shift
2314 dflt=\$1
2315 shift
2316 for dir in \$*; do
2317         case "\$thing" in
2318         .)
2319         if test -d \$dir/\$thing; then
2320                 echo \$dir
2321                 exit 0
2322         fi
2323         ;;
2324         *)
2325         for thisthing in \$dir/\$thing; do
2326                 : just loop through to pick last item
2327         done
2328         if test -f \$thisthing; then
2329                 echo \$thisthing
2330                 exit 0
2331         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2332                 echo \$thisthing
2333                 exit 0
2334         elif test -f \$dir/\$thing.exe; then
2335                 if test -n "$DJGPP"; then
2336                         echo \$dir/\$thing.exe
2337                 elif test "$eunicefix" != ":"; then
2338                         : on Eunice apparently
2339                         echo \$dir/\$thing
2340                 fi
2341                 exit 0
2342         fi
2343         ;;
2344         esac
2345 done
2346 echo \$dflt
2347 exit 1
2348 EOSC
2349 chmod +x loc
2350 $eunicefix loc
2351 loclist="
2352 awk
2353 cat
2354 chmod
2355 comm
2356 cp
2357 echo
2358 expr
2359 grep
2360 ls
2361 mkdir
2362 rm
2363 sed
2364 sort
2365 touch
2366 tr
2367 uniq
2368 "
2369 trylist="
2370 ar
2371 bison
2372 byacc
2373 cpp
2374 csh
2375 date
2376 egrep
2377 gmake
2378 gzip
2379 less
2380 ln
2381 make
2382 more
2383 nm
2384 nroff
2385 perl
2386 pg
2387 test
2388 uname
2389 zip
2390 "
2391 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2392 pth="$pth /lib /usr/lib"
2393 for file in $loclist; do
2394         eval xxx=\$$file
2395         case "$xxx" in
2396         /*|?:[\\/]*)
2397                 if test -f "$xxx"; then
2398                         : ok
2399                 else
2400                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2401                         xxx=`./loc $file $file $pth`
2402                 fi
2403                 ;;
2404         '') xxx=`./loc $file $file $pth`;;
2405         *) xxx=`./loc $xxx $xxx $pth`;;
2406         esac
2407         eval $file=$xxx$_exe
2408         eval _$file=$xxx
2409         case "$xxx" in
2410         /*)
2411                 echo $file is in $xxx.
2412                 ;;
2413         ?:[\\/]*)
2414                 echo $file is in $xxx.
2415                 ;;
2416         *)
2417                 echo "I don't know where '$file' is, and my life depends on it." >&4
2418                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2419                 exit 1
2420                 ;;
2421         esac
2422 done
2423 echo " "
2424 echo "Don't worry if any of the following aren't found..."
2425 say=offhand
2426 for file in $trylist; do
2427         eval xxx=\$$file
2428         case "$xxx" in
2429         /*|?:[\\/]*)
2430                 if test -f "$xxx"; then
2431                         : ok
2432                 else
2433                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2434                         xxx=`./loc $file $file $pth`
2435                 fi
2436                 ;;
2437         '') xxx=`./loc $file $file $pth`;;
2438         *) xxx=`./loc $xxx $xxx $pth`;;
2439         esac
2440         eval $file=$xxx$_exe
2441         eval _$file=$xxx
2442         case "$xxx" in
2443         /*)
2444                 echo $file is in $xxx.
2445                 ;;
2446         ?:[\\/]*)
2447                 echo $file is in $xxx.
2448                 ;;
2449         *)
2450                 echo "I don't see $file out there, $say."
2451                 say=either
2452                 ;;
2453         esac
2454 done
2455 case "$egrep" in
2456 egrep)
2457         echo "Substituting grep for egrep."
2458         egrep=$grep
2459         _egrep=$grep
2460         ;;
2461 esac
2462 case "$less" in
2463 '')     ;;
2464 *)      if $less -R </dev/null >/dev/null; then
2465                echo "Substituting less -R for less."
2466                less="$less -R"
2467                _less=$less
2468         fi
2469         ;;
2470 esac
2471 case "$ln" in
2472 ln)
2473         echo "Substituting cp for ln."
2474         ln=$cp
2475         _ln=$cp
2476         ;;
2477 esac
2478 case "$make" in
2479 make)
2480         case "$gmake" in
2481         gmake)
2482         echo "I can't find make or gmake, and my life depends on it." >&4
2483         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2484         exit 1
2485         ;;
2486         esac
2487         ;;
2488 esac
2489 case "$gmake" in
2490 gmake)  ;;
2491 *)      # We can't have osname yet.
2492         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2493                 # Assume that gmake, if found, is definitely GNU make
2494                 # and prefer it over the system make.
2495                 echo "Substituting gmake for make."
2496                 make=$gmake
2497                 _make=$gmake
2498         fi
2499         ;;
2500 esac
2501 case "$test" in
2502 test)
2503         echo "Hopefully test is built into your sh."
2504         ;;
2505 *)
2506         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2507                 echo "Using the test built into your sh."
2508                 test=test
2509                 _test=test
2510         fi
2511         ;;
2512 esac
2513 case "$echo" in
2514 echo)
2515         echo "Hopefully echo is built into your sh."
2516         ;;
2517 '') ;;
2518 *)
2519         echo " "
2520 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2521         $echo $n "hi there$c" >foo1
2522         echo $n "hi there$c" >foo2
2523         if cmp foo1 foo2 >/dev/null 2>&1; then
2524                 echo "They are compatible.  In fact, they may be identical."
2525         else
2526                 case "$n" in
2527                 '-n') n='' c='\c';;
2528                 *) n='-n' c='';;
2529                 esac
2530                 cat <<FOO
2531 They are not compatible!  You are probably running ksh on a non-USG system.
2532 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2533 have echo built in and we may have to run some Bourne shell scripts.  That
2534 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2535
2536 FOO
2537                 $echo $n "The star should be here-->$c"
2538                 $echo "*"
2539         fi
2540         $rm -f foo1 foo2
2541         ;;
2542 esac
2543
2544 # This question was auctioned at YAPC::Europe-2007 in Vienna
2545 # I never promised you could answer it. I only auctioned the question.
2546 cat <<FOO
2547 The following message is sponsored by
2548
2549   Dresden.pm<--The stars should be here.
2550
2551 Dear Perl user, system administrator or package
2552 maintainer, the Perl community sends greetings to
2553 you. Do you (emblematical) greet back [Y/n]? n
2554
2555 FOO
2556
2557 : Check what type of C compiler we use
2558 cat <<EOS >trygcc
2559 $startsh
2560 EOS
2561 cat <<'EOSC' >>trygcc
2562 case "$cc" in
2563 '') ;;
2564 *)  $rm -f try try.*
2565     $cat >try.c <<EOM
2566 int main(int argc, char *argv[]) {
2567   return 0;
2568 }
2569 EOM
2570     if $cc -o try $ccflags $ldflags try.c; then
2571        :
2572     else
2573         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2574         despair=yes
2575         trygcc=yes
2576         case "$cc" in
2577         *gcc*) trygcc=no ;;
2578         esac
2579         # Skip this test because it gives a false match on output like:
2580         #    ./trygcc: line 23: cc: command not found
2581         # case "`$cc -v -c try.c 2>&1`" in
2582         # *gcc*) trygcc=no ;;
2583         # esac
2584         if $test X"$trygcc" = Xyes; then
2585             if gcc -o try -c try.c; then
2586                 echo " "
2587                 echo "You seem to have a working gcc, though." >&4
2588                 # Switching compilers may undo the work of hints files.
2589                 # The most common problem is -D_REENTRANT for threads.
2590                 # This heuristic catches that case, but gets false positives
2591                 # if -Dusethreads was not actually specified.  Better to
2592                 # bail out here with a useful message than fail 
2593                 # mysteriously later. Should we perhaps just try to
2594                 # re-invoke Configure -Dcc=gcc config_args ?
2595                 if $test -f usethreads.cbu; then
2596                         $cat >&4 <<EOM 
2597
2598 *** However, any setting of the C compiler flags (e.g. for thread support)
2599 *** will be lost.  It may be necessary for you to restart Configure and
2600 *** add -Dcc=gcc to your Configure command line.
2601
2602 EOM
2603                         rp="Would you like to go ahead and try gcc anyway?"
2604                         dflt=n
2605                 else
2606                         rp="Would you like to use it?"
2607                         dflt=y
2608                 fi
2609                 if $test -f myread; then
2610                     . ./myread
2611                 else
2612                     if $test -f UU/myread; then
2613                         . ./UU/myread
2614                     else
2615                         echo "Cannot find myread, sorry.  Aborting." >&2
2616                         exit 1
2617                     fi
2618                 fi  
2619                 case "$ans" in
2620                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2621                 esac
2622             fi
2623         fi
2624     fi
2625     $rm -f try try.*
2626     ;;
2627 esac
2628 EOSC
2629
2630 cat <<EOS >checkcc
2631 $startsh
2632 EOS
2633 cat <<'EOSC' >>checkcc
2634 case "$cc" in        
2635 '') ;;
2636 *)  $rm -f try try.*              
2637     $cat >try.c <<EOM
2638 int main(int argc, char *argv[]) {
2639   return 0;
2640 }
2641 EOM
2642     if $cc -o try $ccflags $ldflags try.c; then
2643        :
2644     else
2645         if $test X"$despair" = Xyes; then
2646            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2647         fi
2648         $cat >&4 <<EOM         
2649 You need to find a working C compiler.
2650 Either (purchase and) install the C compiler supplied by your OS vendor,
2651 or for a free C compiler try http://gcc.gnu.org/
2652 I cannot continue any further, aborting.
2653 EOM
2654         exit 1
2655     fi
2656     $rm -f try try.*
2657     ;;
2658 esac
2659 EOSC
2660
2661 : determine whether symbolic links are supported
2662 echo " "
2663 $touch blurfl
2664 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2665         echo "Symbolic links are supported." >&4
2666         lns="$ln -s"
2667 else
2668         echo "Symbolic links are NOT supported." >&4
2669         lns="$ln"
2670 fi
2671 $rm -f blurfl sym
2672
2673 : determine whether symbolic links are supported
2674 echo " "
2675 case "$lns" in
2676 *"ln"*" -s")
2677         echo "Checking how to test for symbolic links..." >&4
2678         $lns blurfl sym
2679         if $test "X$issymlink" = X; then
2680                 case "$newsh" in
2681                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2682                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2683                 esac
2684                 if test $? = 0; then
2685                         issymlink="test -h"
2686                 else
2687                         echo "Your builtin 'test -h' may be broken." >&4
2688                         case "$test" in
2689                         /*)     ;;
2690                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2691                                 for p in $pth
2692                                 do
2693                                         if test -f "$p/$test"; then
2694                                                 test="$p/$test"
2695                                                 break
2696                                         fi
2697                                 done
2698                                 ;;
2699                         esac
2700                         case "$test" in
2701                         /*)
2702                                 echo "Trying external '$test -h'." >&4
2703                                 issymlink="$test -h"
2704                                 if $test ! -h sym >/dev/null 2>&1; then
2705                                         echo "External '$test -h' is broken, too." >&4
2706                                         issymlink=''
2707                                 fi
2708                                 ;;
2709                         *)      issymlink='' ;;
2710                         esac
2711                 fi              
2712         fi
2713         if $test "X$issymlink" = X; then
2714                 if $test -L sym 2>/dev/null; then
2715                         issymlink="$test -L"
2716                         echo "The builtin '$test -L' worked." >&4
2717                 fi
2718         fi
2719         if $test "X$issymlink" != X; then
2720                 echo "You can test for symbolic links with '$issymlink'." >&4
2721         else
2722                 echo "I do not know how you can test for symbolic links." >&4
2723         fi
2724         $rm -f blurfl sym
2725         ;;
2726 *)      echo "No symbolic links, so not testing for their testing..." >&4
2727         ;;
2728 esac
2729 echo " "
2730
2731 : Make symlinks util
2732 case "$mksymlinks" in
2733 $define|true|[yY]*)
2734         case "$src" in
2735         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2736                 exit 1
2737                 ;;
2738         *)      case "$lns:$issymlink" in
2739                 *"ln"*" -s:"*"test -"?)
2740                         echo "Creating the symbolic links..." >&4
2741                         echo "(First creating the subdirectories...)" >&4
2742                         cd ..
2743                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2744                                 read directory
2745                                 test -z "$directory" && break
2746                                 mkdir -p $directory
2747                         done
2748                         # Sanity check 1.
2749                         if test ! -d t/base; then
2750                                 echo "Failed to create the subdirectories.  Aborting." >&4
2751                                 exit 1
2752                         fi
2753                         echo "(Then creating the symlinks...)" >&4
2754                         awk '{print $1}' $src/MANIFEST | while true; do
2755                                 read filename
2756                                 test -z "$filename" && break
2757                                 if test -f $filename; then
2758                                         if $issymlink $filename; then
2759                                                 rm -f $filename
2760                                         fi
2761                                 fi
2762                                 if test -f $filename; then
2763                                         echo "$filename already exists, not symlinking."
2764                                 else
2765                                         ln -s $src/$filename $filename
2766                                 fi
2767                         done
2768                         # Sanity check 2.
2769                         if test ! -f t/base/lex.t; then
2770                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2771                                 exit 1
2772                         fi
2773                         cd UU
2774                         ;;
2775                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2776                         ;;
2777                 esac
2778                 ;;
2779         esac
2780         ;;
2781 esac
2782
2783 : Check for Cross-Compilation
2784 case "$usecrosscompile" in
2785 $define|true|[yY]*)
2786         $echo "Cross-compiling..."
2787         croak=''
2788         case "$cc" in
2789         *-*-gcc) # A cross-compiling gcc, probably.
2790             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2791             ar=$targetarch-ar
2792             # leave out ld, choosing it is more complex
2793             nm=$targetarch-nm
2794             ranlib=$targetarch-ranlib
2795             $echo 'extern int foo;' > try.c
2796             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2797             shift
2798             if $test $# -gt 0; then
2799                 incpth="$incpth $*"
2800                 incpth="`$echo $incpth|$sed 's/^ //'`"
2801                 echo "Guessing incpth '$incpth'." >&4
2802                 for i in $*; do
2803                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2804                     if $test -d $j; then
2805                         libpth="$libpth $j"
2806                     fi
2807                 done   
2808                 libpth="`$echo $libpth|$sed 's/^ //'`"
2809                 echo "Guessing libpth '$libpth'." >&4
2810             fi
2811             $rm -f try.c
2812             ;;
2813         esac
2814         case "$targetarch" in
2815         '') echo "Targetarch not defined." >&4; croak=y ;;
2816         *)  echo "Using targetarch $targetarch." >&4 ;;
2817         esac
2818         case "$incpth" in
2819         '') echo "Incpth not defined." >&4; croak=y ;;
2820         *)  echo "Using incpth '$incpth'." >&4 ;;
2821         esac
2822         case "$libpth" in
2823         '') echo "Libpth not defined." >&4; croak=y ;;
2824         *)  echo "Using libpth '$libpth'." >&4 ;;
2825         esac
2826         case "$usrinc" in
2827         '') for i in $incpth; do
2828                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2829                     usrinc=$i
2830                     echo "Guessing usrinc $usrinc." >&4
2831                     break
2832                 fi
2833             done
2834             case "$usrinc" in
2835             '') echo "Usrinc not defined." >&4; croak=y ;;
2836             esac
2837             ;;
2838         *)  echo "Using usrinc $usrinc." >&4 ;;
2839         esac
2840         case "$targethost" in
2841         '') echo "Targethost not defined." >&4; croak=y ;;
2842         *)  echo "Using targethost $targethost." >&4
2843         esac
2844         locincpth=' '
2845         loclibpth=' '
2846         case "$croak" in
2847         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2848         esac
2849         case "$src" in
2850         /*) run=$src/Cross/run
2851             targetmkdir=$src/Cross/mkdir
2852             to=$src/Cross/to
2853             from=$src/Cross/from
2854             ;;
2855         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2856             run=$pwd/Cross/run
2857             targetmkdir=$pwd/Cross/mkdir
2858             to=$pwd/Cross/to
2859             from=$pwd/Cross/from
2860             ;;
2861         esac
2862         case "$targetrun" in
2863         '') targetrun=ssh ;;
2864         esac
2865         case "$targetto" in
2866         '') targetto=scp ;;
2867         esac
2868         case "$targetfrom" in
2869         '') targetfrom=scp ;;
2870         esac
2871         run=$run-$targetrun
2872         to=$to-$targetto
2873         from=$from-$targetfrom
2874         case "$targetdir" in
2875         '')  targetdir=/tmp
2876              echo "Guessing targetdir $targetdir." >&4
2877              ;;
2878         esac
2879         case "$targetuser" in
2880         '')  targetuser=root
2881              echo "Guessing targetuser $targetuser." >&4
2882              ;;
2883         esac
2884         case "$targetfrom" in
2885         scp)    q=-q ;;
2886         *)      q='' ;;
2887         esac
2888         case "$targetrun" in
2889         ssh|rsh)
2890             cat >$run <<EOF
2891 #!/bin/sh
2892 case "\$1" in
2893 -cwd)
2894   shift
2895   cwd=\$1
2896   shift
2897   ;;
2898 esac
2899 case "\$cwd" in
2900 '') cwd=$targetdir ;;
2901 esac
2902 exe=\$1
2903 shift
2904 if $test ! -f \$exe.xok; then
2905   $to \$exe
2906   $touch \$exe.xok
2907 fi
2908 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2909 EOF
2910             ;;
2911         *)  echo "Unknown targetrun '$targetrun'" >&4
2912             exit 1
2913             ;;
2914         esac
2915         case "$targetmkdir" in
2916         */Cross/mkdir)
2917             cat >$targetmkdir <<EOF
2918 #!/bin/sh
2919 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2920 EOF
2921             $chmod a+rx $targetmkdir
2922             ;;
2923         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2924             exit 1
2925             ;;
2926         esac
2927         case "$targetto" in
2928         scp|rcp)
2929             cat >$to <<EOF
2930 #!/bin/sh
2931 for f in \$@
2932 do
2933   case "\$f" in
2934   /*)
2935     $targetmkdir \`dirname \$f\`
2936     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2937     ;;
2938   *)
2939     $targetmkdir $targetdir/\`dirname \$f\`
2940     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2941     ;;
2942   esac
2943 done
2944 exit 0
2945 EOF
2946             ;;
2947         cp) cat >$to <<EOF
2948 #!/bin/sh
2949 for f in \$@
2950 do
2951   case "\$f" in
2952   /*)
2953     $mkdir -p $targetdir/\`dirname \$f\`
2954     $cp \$f $targetdir/\$f || exit 1
2955     ;;
2956   *)
2957     $targetmkdir $targetdir/\`dirname \$f\`
2958     $cp \$f $targetdir/\$f || exit 1
2959     ;;
2960   esac
2961 done
2962 exit 0
2963 EOF
2964             ;;
2965         *)  echo "Unknown targetto '$targetto'" >&4
2966             exit 1
2967             ;;
2968         esac
2969         case "$targetfrom" in
2970         scp|rcp)
2971           cat >$from <<EOF
2972 #!/bin/sh
2973 for f in \$@
2974 do
2975   $rm -f \$f
2976   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2977 done
2978 exit 0
2979 EOF
2980             ;;
2981         cp) cat >$from <<EOF
2982 #!/bin/sh
2983 for f in \$@
2984 do
2985   $rm -f \$f
2986   cp $targetdir/\$f . || exit 1
2987 done
2988 exit 0
2989 EOF
2990             ;;
2991         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2992             exit 1
2993             ;;
2994         esac
2995         if $test ! -f $run; then
2996             echo "Target 'run' script '$run' not found." >&4
2997         else
2998             $chmod a+rx $run
2999         fi
3000         if $test ! -f $to; then
3001             echo "Target 'to' script '$to' not found." >&4
3002         else
3003             $chmod a+rx $to
3004         fi
3005         if $test ! -f $from; then
3006             echo "Target 'from' script '$from' not found." >&4
3007         else
3008             $chmod a+rx $from
3009         fi
3010         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3011             exit 1
3012         fi
3013         cat >&4 <<EOF
3014 Using '$run' for remote execution,
3015 and '$from' and '$to'
3016 for remote file transfer.
3017 EOF
3018         ;;
3019 *)      run=''
3020         to=:
3021         from=:
3022         usecrosscompile='undef'
3023         targetarch=''
3024         ;;
3025 esac
3026
3027 : see whether [:lower:] and [:upper:] are supported character classes
3028 echo " "
3029 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3030 ABYZ)
3031         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3032         up='[:upper:]'
3033         low='[:lower:]'
3034         ;;
3035 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3036         # (0xd9 and 0xe2), therefore that is a nice testing point.
3037         if test "X$up" = X -o "X$low" = X; then
3038             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3039             rs) up='[A-Z]'
3040                 low='[a-z]'
3041                 ;;
3042             esac
3043         fi
3044         if test "X$up" = X -o "X$low" = X; then
3045             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3046             rs) up='A-Z'
3047                 low='a-z'
3048                 ;;
3049             esac
3050         fi
3051         if test "X$up" = X -o "X$low" = X; then
3052             case "`echo RS | od -x 2>/dev/null`" in
3053             *D9E2*|*d9e2*)
3054                 echo "Hey, this might be EBCDIC." >&4
3055                 if test "X$up" = X -o "X$low" = X; then
3056                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3057                     rs) up='[A-IJ-RS-Z]'
3058                         low='[a-ij-rs-z]'
3059                         ;;
3060                     esac
3061                 fi
3062                 if test "X$up" = X -o "X$low" = X; then
3063                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3064                     rs) up='A-IJ-RS-Z'
3065                         low='a-ij-rs-z'
3066                         ;;
3067                     esac
3068                 fi
3069                 ;;
3070             esac
3071         fi
3072 esac
3073 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3074 rs)
3075     echo "Using $up and $low to convert case." >&4
3076     ;;
3077 *)
3078     echo "I don't know how to translate letters from upper to lower case." >&4
3079     echo "Your tr is not acting any way I know of." >&4
3080     exit 1
3081     ;;
3082 esac
3083 : set up the translation script tr, must be called with ./tr of course
3084 cat >tr <<EOSC
3085 $startsh
3086 case "\$1\$2" in
3087 '[A-Z][a-z]') exec $tr '$up' '$low';;
3088 '[a-z][A-Z]') exec $tr '$low' '$up';;
3089 esac
3090 exec $tr "\$@"
3091 EOSC
3092 chmod +x tr
3093 $eunicefix tr
3094
3095 : Try to determine whether config.sh was made on this system
3096 case "$config_sh" in
3097 '')
3098 myuname=`$uname -a 2>/dev/null`
3099 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3100 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3101 # because the A-Z/a-z are not consecutive.
3102 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3103         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3104 newmyuname="$myuname"
3105 dflt=n
3106 case "$knowitall" in
3107 '')
3108         if test -f ../config.sh; then
3109                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3110                         eval "`grep myuname= ../config.sh`"
3111                 fi
3112                 if test "X$myuname" = "X$newmyuname"; then
3113                         dflt=y
3114                 fi
3115         fi
3116         ;;
3117 *) dflt=y;;
3118 esac
3119
3120 : Get old answers from old config file if Configure was run on the
3121 : same system, otherwise use the hints.
3122 hint=default
3123 cd ..
3124 if test -f config.sh; then
3125         echo " "
3126         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3127         . UU/myread
3128         case "$ans" in
3129         n*|N*) echo "OK, I'll ignore it."
3130                 mv config.sh config.sh.old
3131                 myuname="$newmyuname"
3132                 ;;
3133         *)  echo "Fetching default answers from your old config.sh file..." >&4
3134                 tmp_n="$n"
3135                 tmp_c="$c"
3136                 tmp_sh="$sh"
3137                 . ./config.sh
3138                 cp config.sh UU
3139                 n="$tmp_n"
3140                 c="$tmp_c"
3141                 : Older versions did not always set $sh.  Catch re-use of such
3142                 : an old config.sh.
3143                 case "$sh" in
3144                 '') sh="$tmp_sh" ;;
3145                 esac
3146                 hint=previous
3147                 ;;
3148         esac
3149 fi
3150 . ./UU/checkcc
3151 if test ! -f config.sh; then
3152         $cat <<EOM
3153
3154 First time through, eh?  I have some defaults handy for some systems
3155 that need some extra help getting the Configure answers right:
3156
3157 EOM
3158         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3159         dflt=''
3160         : Half the following guesses are probably wrong... If you have better
3161         : tests or hints, please send them to perlbug@perl.org
3162         : The metaconfig authors would also appreciate a copy...
3163         $test -f /irix && osname=irix
3164         $test -f /xenix && osname=sco_xenix
3165         $test -f /dynix && osname=dynix
3166         $test -f /dnix && osname=dnix
3167         $test -f /lynx.os && osname=lynxos
3168         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3169         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3170         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3171         $test -f /bin/mips && /bin/mips && osname=mips
3172         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3173                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3174         $test -d /usr/apollo/bin && osname=apollo
3175         $test -f /etc/saf/_sactab && osname=svr4
3176         $test -d /usr/include/minix && osname=minix
3177         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3178         if $test -d /MachTen -o -d /MachTen_Folder; then
3179                 osname=machten
3180                 if $test -x /sbin/version; then
3181                         osvers=`/sbin/version | $awk '{print $2}' |
3182                         $sed -e 's/[A-Za-z]$//'`
3183                 elif $test -x /usr/etc/version; then
3184                         osvers=`/usr/etc/version | $awk '{print $2}' |
3185                         $sed -e 's/[A-Za-z]$//'`
3186                 else
3187                         osvers="$2.$3"
3188                 fi
3189         fi
3190
3191         $test -f /sys/posix.dll &&
3192                 $test -f /usr/bin/what &&
3193                 set X `/usr/bin/what /sys/posix.dll` &&
3194                 $test "$3" = UWIN &&
3195                 osname=uwin &&
3196                 osvers="$5"
3197
3198         if $test -f $uname; then
3199                 set X $myuname
3200                 shift
3201
3202                 case "$5" in
3203                 fps*) osname=fps ;;
3204                 mips*)
3205                         case "$4" in
3206                         umips) osname=umips ;;
3207                         *) osname=mips ;;
3208                         esac;;
3209                 [23]100) osname=mips ;;
3210                 next*) osname=next ;;
3211                 i386*)
3212                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3213                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3214                                 osname='sco'
3215                                 osvers=$tmp
3216                         elif $test -f /etc/kconfig; then
3217                                 osname=isc
3218                                 if test "$lns" = "$ln -s"; then
3219                                         osvers=4
3220                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3221                                         osvers=3
3222                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3223                                         osvers=2
3224                                 fi
3225                         fi
3226                         tmp=''
3227                         ;;
3228                 pc*)
3229                         if test -n "$DJGPP"; then
3230                                 osname=dos
3231                                 osvers=djgpp
3232                         fi
3233                         ;;
3234                 esac
3235
3236                 case "$1" in
3237                 aix) osname=aix
3238                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3239                         case "$tmp" in
3240                         # oslevel can fail with:
3241                         # oslevel: Unable to acquire lock.
3242                         *not\ found) osvers="$4"."$3" ;;
3243                         '<3240'|'<>3240') osvers=3.2.0 ;;
3244                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3245                         '=3250'|'>3250') osvers=3.2.5 ;;
3246                         *) osvers=$tmp;;
3247                         esac
3248                         ;;
3249                 bsd386) osname=bsd386
3250                         osvers=`$uname -r`
3251                         ;;
3252                 cygwin*) osname=cygwin
3253                         osvers="$3"
3254                         ;;
3255                 *dc.osx) osname=dcosx
3256                         osvers="$3"
3257                         ;;
3258                 dnix) osname=dnix
3259                         osvers="$3"
3260                         ;;
3261                 domainos) osname=apollo
3262                         osvers="$3"
3263                         ;;
3264                 dgux)   osname=dgux
3265                         osvers="$3"
3266                         ;;
3267                 dragonfly) osname=dragonfly
3268                         osvers="$3"
3269                         ;;
3270                 dynixptx*) osname=dynixptx
3271                         osvers=`echo "$4"|sed 's/^v//'`
3272                         ;;
3273                 freebsd) osname=freebsd
3274                         osvers="$3" ;;
3275                 genix)  osname=genix ;;
3276                 gnu)    osname=gnu
3277                         osvers="$3" ;;
3278                 hp*)    osname=hpux
3279                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3280                         ;;
3281                 irix*)  osname=irix
3282                         case "$3" in
3283                         4*) osvers=4 ;;
3284                         5*) osvers=5 ;;
3285                         *)      osvers="$3" ;;
3286                         esac
3287                         ;;
3288                 linux)  osname=linux
3289                         case "$3" in
3290                         *)      osvers="$3" ;;
3291                         esac
3292                         ;;
3293                 MiNT)   osname=mint
3294                         ;;
3295                 netbsd*) osname=netbsd
3296                         osvers="$3"
3297                         ;;
3298                 news-os) osvers="$3"
3299                         case "$3" in
3300                         4*) osname=newsos4 ;;
3301                         *) osname=newsos ;;
3302                         esac
3303                         ;;
3304                 next*) osname=next ;;
3305                 nonstop-ux) osname=nonstopux ;;
3306                 openbsd) osname=openbsd
3307                         osvers="$3"
3308                         ;;
3309                 os2)    osname=os2
3310                         osvers="$4"
3311                         ;;
3312                 POSIX-BC | posix-bc ) osname=posix-bc
3313                         osvers="$3"
3314                         ;;
3315                 powerux | power_ux | powermax_os | powermaxos | \
3316                 powerunix | power_unix) osname=powerux
3317                         osvers="$3"
3318                         ;;
3319                 qnx) osname=qnx
3320                         osvers="$4"
3321                         ;;
3322                 solaris) osname=solaris
3323                         case "$3" in
3324                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3325                         *)      osvers="$3" ;;
3326                         esac
3327                         ;;
3328                 sunos) osname=sunos
3329                         case "$3" in
3330                         5*) osname=solaris
3331                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3332                         *)      osvers="$3" ;;
3333                         esac
3334                         ;;
3335                 titanos) osname=titanos
3336                         case "$3" in
3337                         1*) osvers=1 ;;
3338                         2*) osvers=2 ;;
3339                         3*) osvers=3 ;;
3340                         4*) osvers=4 ;;
3341                         *)      osvers="$3" ;;
3342                         esac
3343                         ;;
3344                 ultrix) osname=ultrix
3345                         osvers="$3"
3346                         ;;
3347                 osf1|mls+)      case "$5" in
3348                                 alpha)
3349                                         osname=dec_osf
3350                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3351                                         case "$osvers" in
3352                                         [1-9].[0-9]*) ;;
3353                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3354                                         esac
3355                                         ;;
3356                         hp*)    osname=hp_osf1  ;;
3357                         mips)   osname=mips_osf1 ;;
3358                         esac
3359                         ;;
3360                 # UnixWare 7.1.2 is known as Open UNIX 8
3361                 openunix|unixware) osname=svr5
3362                         osvers="$4"
3363                         ;;
3364                 uts)    osname=uts
3365                         osvers="$3"
3366                         ;;
3367                 vos) osvers="$3"
3368                         ;;
3369                 $2) case "$osname" in
3370                         *isc*) ;;
3371                         *freebsd*) ;;
3372                         svr*)
3373                                 : svr4.x or possibly later
3374                                 case "svr$3" in
3375                                 ${osname}*)
3376                                         osname=svr$3
3377                                         osvers=$4
3378                                         ;;
3379                                 esac
3380                                 case "$osname" in
3381                                 svr4.0)
3382                                         : Check for ESIX
3383                                         if test -f /stand/boot ; then
3384                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3385                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3386                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3387                                                         if test -n "$isesix"; then
3388                                                                 osname=esix4
3389                                                         fi
3390                                                 fi
3391                                         fi
3392                                         ;;
3393                                 esac
3394                                 ;;
3395                         *)      if test -f /etc/systemid; then
3396                                         osname=sco
3397                                         set `echo $3 | $sed 's/\./ /g'` $4
3398                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3399                                                 osvers=$1.$2.$3
3400                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3401                                                 osvers=$1.$2
3402                                         elif $test -f $src/hints/sco_$1.sh; then
3403                                                 osvers=$1
3404                                         fi
3405                                 else
3406                                         case "$osname" in
3407                                         '') : Still unknown.  Probably a generic Sys V.
3408                                                 osname="sysv"
3409                                                 osvers="$3"
3410                                                 ;;
3411                                         esac
3412                                 fi
3413                                 ;;
3414                         esac
3415                         ;;
3416                 *)      case "$osname" in
3417                         '') : Still unknown.  Probably a generic BSD.
3418                                 osname="$1"
3419                                 osvers="$3"
3420                                 ;;
3421                         esac
3422                         ;;
3423                 esac
3424         else
3425                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3426                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3427                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3428                                 osname=news_os
3429                         fi
3430                         $rm -f UU/kernel.what
3431                 elif test -d c:/. -o -n "$is_os2" ; then
3432                         set X $myuname
3433                         osname=os2
3434                         osvers="$5"
3435                 fi
3436         fi
3437
3438         case "$targetarch" in
3439         '') ;;
3440         *)  hostarch=$osname
3441             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3442             osvers=''
3443             ;;
3444         esac
3445
3446         : Now look for a hint file osname_osvers, unless one has been
3447         : specified already.
3448         case "$hintfile" in
3449         ''|' ')
3450                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3451                 : Also try without trailing minor version numbers.
3452                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3453                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3454                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3455                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3456                 case "$file" in
3457                 '') dflt=none ;;
3458                 *)  case "$osvers" in
3459                         '') dflt=$file
3460                                 ;;
3461                         *)  if $test -f $src/hints/$file.sh ; then
3462                                         dflt=$file
3463                                 elif $test -f $src/hints/$xfile.sh ; then
3464                                         dflt=$xfile
3465                                 elif $test -f $src/hints/$xxfile.sh ; then
3466                                         dflt=$xxfile
3467                                 elif $test -f $src/hints/$xxxfile.sh ; then
3468                                         dflt=$xxxfile
3469                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3470                                         dflt=$xxxxfile
3471                                 elif $test -f "$src/hints/${osname}.sh" ; then
3472                                         dflt="${osname}"
3473                                 else
3474                                         dflt=none
3475                                 fi
3476                                 ;;
3477                         esac
3478                         ;;
3479                 esac
3480                 if $test -f Policy.sh ; then
3481                         case "$dflt" in
3482                         *Policy*) ;;
3483                         none) dflt="Policy" ;;
3484                         *) dflt="Policy $dflt" ;;
3485                         esac
3486                 fi
3487                 ;;
3488         *)
3489                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3490                 ;;
3491         esac
3492
3493         if $test -f Policy.sh ; then
3494                 $cat <<EOM
3495
3496 There's also a Policy hint file available, which should make the
3497 site-specific (policy) questions easier to answer.
3498 EOM
3499
3500         fi
3501
3502         $cat <<EOM
3503
3504 You may give one or more space-separated answers, or "none" if appropriate.
3505 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3506 previous run of Configure, you may specify it as well as or instead of
3507 OS-specific hints.  If hints are provided for your OS, you should use them:
3508 although Perl can probably be built without hints on many platforms, using
3509 hints often improve performance and may enable features that Configure can't
3510 set up on its own. If there are no hints that match your OS, specify "none";
3511 DO NOT give a wrong version or a wrong OS.
3512
3513 EOM
3514
3515         rp="Which of these apply, if any?"
3516         . UU/myread
3517         tans=$ans
3518         for file in $tans; do
3519                 if $test X$file = XPolicy -a -f Policy.sh; then
3520                         . Policy.sh
3521                         $cat Policy.sh >> UU/config.sh
3522                 elif $test -f $src/hints/$file.sh; then
3523                         . $src/hints/$file.sh
3524                         $cat $src/hints/$file.sh >> UU/config.sh
3525                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3526                         : nothing
3527                 else
3528                         : Give one chance to correct a possible typo.
3529                         echo "$file.sh does not exist"
3530                         dflt=$file
3531                         rp="hint to use instead?"
3532                         . UU/myread
3533                         for file in $ans; do
3534                                 if $test -f "$src/hints/$file.sh"; then
3535                                         . $src/hints/$file.sh
3536                                         $cat $src/hints/$file.sh >> UU/config.sh
3537                                 elif $test X$ans = X -o X$ans = Xnone ; then
3538                                         : nothing
3539                                 else
3540                                         echo "$file.sh does not exist -- ignored."
3541                                 fi
3542                         done
3543                 fi
3544         done
3545
3546         hint=recommended
3547         : Remember our hint file for later.
3548         if $test -f "$src/hints/$file.sh" ; then
3549                 hintfile="$file"
3550         else
3551                 hintfile=''
3552         fi
3553 fi
3554 cd UU
3555 ;;
3556 *)
3557         echo " "
3558         echo "Fetching default answers from $config_sh..." >&4
3559         tmp_n="$n"
3560         tmp_c="$c"
3561         cd ..
3562         cp $config_sh config.sh 2>/dev/null
3563         chmod +w config.sh
3564         . ./config.sh
3565         cd UU
3566         cp ../config.sh .
3567         n="$tmp_n"
3568         c="$tmp_c"
3569         hint=previous
3570         ;;
3571 esac
3572 test "$override" && . ./optdef.sh
3573
3574 : Restore computed paths
3575 for file in $loclist $trylist; do
3576         eval $file="\$_$file"
3577 done
3578
3579 cat << EOM
3580
3581 Configure uses the operating system name and version to set some defaults.
3582 The default value is probably right if the name rings a bell. Otherwise,
3583 since spelling matters for me, either accept the default or answer "none"
3584 to leave it blank.
3585
3586 EOM
3587 case "$osname" in
3588         ''|' ')
3589                 case "$hintfile" in
3590                 ''|' '|none) dflt=none ;;
3591                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3592                 esac
3593                 ;;
3594         *) dflt="$osname" ;;
3595 esac
3596 rp="Operating system name?"
3597 . ./myread
3598 case "$ans" in
3599 none)  osname='' ;;
3600 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3601 esac
3602 echo " "
3603 case "$osvers" in
3604         ''|' ')
3605                 case "$hintfile" in
3606                 ''|' '|none) dflt=none ;;
3607                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3608                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3609                         case "$dflt" in
3610                         ''|' ') dflt=none ;;
3611                         esac
3612                         ;;
3613                 esac
3614                 ;;
3615         *) dflt="$osvers" ;;
3616 esac
3617 rp="Operating system version?"
3618 . ./myread
3619 case "$ans" in
3620 none)  osvers='' ;;
3621 *) osvers="$ans" ;;
3622 esac
3623
3624
3625 . ./posthint.sh
3626
3627 : who configured the system
3628 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3629 case "$cf_by" in
3630 "")
3631         cf_by=`(logname) 2>/dev/null`
3632         case "$cf_by" in
3633         "")
3634                 cf_by=`(whoami) 2>/dev/null`
3635                 case "$cf_by" in
3636                 "") cf_by=unknown ;;
3637                 esac ;;
3638         esac ;;
3639 esac
3640
3641 : decide how portable to be.  Allow command line overrides.
3642 case "$d_portable" in
3643 "$undef") ;;
3644 *)      d_portable="$define" ;;
3645 esac
3646
3647 : set up shell script to do ~ expansion
3648 cat >filexp <<EOSS
3649 $startsh
3650 : expand filename
3651 case "\$1" in
3652  \~/*|\~)
3653         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3654         ;;
3655  \~*)
3656         if $test -f /bin/csh; then
3657                 /bin/csh -f -c "glob \$1"
3658                 failed=\$?
3659                 echo ""
3660                 exit \$failed
3661         else
3662                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3663                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3664                 if $test ! -d "\$dir"; then
3665                         me=\`basename \$0\`
3666                         echo "\$me: can't locate home directory for: \$name" >&2
3667                         exit 1
3668                 fi
3669                 case "\$1" in
3670                 */*)
3671                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3672                         ;;
3673                 *)
3674                         echo \$dir
3675                         ;;
3676                 esac
3677         fi
3678         ;;
3679 *)
3680         echo \$1
3681         ;;
3682 esac
3683 EOSS
3684 chmod +x filexp
3685 $eunicefix filexp
3686
3687 : now set up to get a file name
3688 cat <<EOS >getfile
3689 $startsh
3690 EOS
3691 cat <<'EOSC' >>getfile
3692 tilde=''
3693 fullpath=''
3694 already=''
3695 skip=''
3696 none_ok=''
3697 exp_file=''
3698 nopath_ok=''
3699 orig_rp="$rp"
3700 orig_dflt="$dflt"
3701 case "$gfpth" in
3702 '') gfpth='.' ;;
3703 esac
3704
3705 case "$fn" in
3706 *\(*)
3707         : getfile will accept an answer from the comma-separated list
3708         : enclosed in parentheses even if it does not meet other criteria.
3709         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3710         fn=`echo $fn | sed 's/(.*)//'`
3711         ;;
3712 esac
3713
3714 case "$fn" in
3715 *:*)
3716         loc_file=`expr $fn : '.*:\(.*\)'`
3717         fn=`expr $fn : '\(.*\):.*'`
3718         ;;
3719 esac
3720
3721 case "$fn" in
3722 *~*) tilde=true;;
3723 esac
3724 case "$fn" in
3725 */*) fullpath=true;;
3726 esac
3727 case "$fn" in
3728 *+*) skip=true;;
3729 esac
3730 case "$fn" in
3731 *n*) none_ok=true;;
3732 esac
3733 case "$fn" in
3734 *e*) exp_file=true;;
3735 esac
3736 case "$fn" in
3737 *p*) nopath_ok=true;;
3738 esac
3739
3740 case "$fn" in
3741 *f*) type='File';;
3742 *d*) type='Directory';;
3743 *l*) type='Locate';;
3744 esac
3745
3746 what="$type"
3747 case "$what" in
3748 Locate) what='File';;
3749 esac
3750
3751 case "$exp_file" in
3752 '')
3753         case "$d_portable" in
3754         "$define") ;;
3755         *) exp_file=true;;
3756         esac
3757         ;;
3758 esac
3759
3760 cd ..
3761 while test "$type"; do
3762         redo=''
3763         rp="$orig_rp"
3764         dflt="$orig_dflt"
3765         case "$tilde" in
3766         true) rp="$rp (~name ok)";;
3767         esac
3768         . UU/myread
3769         if test -f UU/getfile.ok && \
3770                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3771         then
3772                 value="$ans"
3773                 ansexp="$ans"
3774                 break
3775         fi
3776         case "$ans" in
3777         none)
3778                 value=''
3779                 ansexp=''
3780                 case "$none_ok" in
3781                 true) type='';;
3782                 esac
3783                 ;;
3784         *)
3785                 case "$tilde" in
3786                 '') value="$ans"
3787                         ansexp="$ans";;
3788                 *)
3789                         value=`UU/filexp $ans`
3790                         case $? in
3791                         0)
3792                                 if test "$ans" != "$value"; then
3793                                         echo "(That expands to $value on this system.)"
3794                                 fi
3795                                 ;;
3796                         *) value="$ans";;
3797                         esac
3798                         ansexp="$value"
3799                         case "$exp_file" in
3800                         '') value="$ans";;
3801                         esac
3802                         ;;
3803                 esac
3804                 case "$fullpath" in
3805                 true)
3806                         case "$ansexp" in
3807                         /*) value="$ansexp" ;;
3808                         [a-zA-Z]:/*) value="$ansexp" ;;
3809                         *)
3810                                 redo=true
3811                                 case "$already" in
3812                                 true)
3813                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3814                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3815                                         ;;
3816                                 *)
3817                                 echo "Please give a full path name, starting with slash." >&4
3818                                         case "$tilde" in
3819                                         true)
3820                                 echo "Note that using ~name is ok provided it expands well." >&4
3821                                                 already=true
3822                                                 ;;
3823                                         esac
3824                                 esac
3825                                 ;;
3826                         esac
3827                         ;;
3828                 esac
3829                 case "$redo" in
3830                 '')
3831                         case "$type" in
3832                         File)
3833                                 for fp in $gfpth; do
3834                                         if test "X$fp" = X.; then
3835                                             pf="$ansexp"
3836                                         else    
3837                                             pf="$fp/$ansexp"
3838                                         fi
3839                                         if test -f "$pf"; then
3840                                                 type=''
3841                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3842                                         then
3843                                                 echo "($value is not a plain file, but that's ok.)"
3844                                                 type=''
3845                                         fi
3846                                         if test X"$type" = X; then
3847                                             value="$pf"
3848                                             break
3849                                         fi
3850                                 done
3851                                 ;;
3852                         Directory)
3853                                 for fp in $gfpth; do
3854                                         if test "X$fp" = X.; then
3855                                             dir="$ans"
3856                                             direxp="$ansexp"
3857                                         else    
3858                                             dir="$fp/$ansexp"
3859                                             direxp="$fp/$ansexp"
3860                                         fi
3861                                         if test -d "$direxp"; then
3862                                                 type=''
3863                                                 value="$dir"
3864                                                 break
3865                                         fi
3866                                 done
3867                                 ;;
3868                         Locate)
3869                                 if test -d "$ansexp"; then
3870                                         echo "(Looking for $loc_file in directory $value.)"
3871                                         value="$value/$loc_file"
3872                                         ansexp="$ansexp/$loc_file"
3873                                 fi
3874                                 if test -f "$ansexp"; then
3875                                         type=''
3876                                 fi
3877                                 case "$nopath_ok" in
3878                                 true)   case "$value" in
3879                                         */*) ;;
3880                                         *)      echo "Assuming $value will be in people's path."
3881                                                 type=''
3882                                                 ;;
3883                                         esac
3884                                         ;;
3885                                 esac
3886                                 ;;
3887                         esac
3888
3889                         case "$skip" in
3890                         true) type='';
3891                         esac
3892
3893                         case "$type" in
3894                         '') ;;
3895                         *)
3896                                 if test "$fastread" = yes; then
3897                                         dflt=y
3898                                 else
3899                                         dflt=n
3900                                 fi
3901                                 rp="$what $value doesn't exist.  Use that name anyway?"
3902                                 . UU/myread
3903                                 dflt=''
3904                                 case "$ans" in
3905                                 y*) type='';;
3906                                 *) echo " ";;
3907                                 esac
3908                                 ;;
3909                         esac
3910                         ;;
3911                 esac
3912                 ;;
3913         esac
3914 done
3915 cd UU
3916 ans="$value"
3917 rp="$orig_rp"
3918 dflt="$orig_dflt"
3919 rm -f getfile.ok
3920 test "X$gfpthkeep" != Xy && gfpth=""
3921 EOSC
3922
3923 : determine root of directory hierarchy where package will be installed.
3924 case "$prefix" in
3925 '')
3926         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3927         ;;
3928 *?/)
3929         dflt=`echo "$prefix" | sed 's/.$//'`
3930         ;;
3931 *)
3932         dflt="$prefix"
3933         ;;
3934 esac
3935 $cat <<EOM
3936
3937 By default, $package will be installed in $dflt/bin, manual pages
3938 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3939 installation directories. Typically this is something like /usr/local.
3940 If you wish to have binaries under /usr/bin but other parts of the
3941 installation under /usr/local, that's ok: you will be prompted
3942 separately for each of the installation directories, the prefix being
3943 only used to set the defaults.
3944
3945 EOM
3946 fn=d~
3947 rp='Installation prefix to use?'
3948 . ./getfile
3949 oldprefix=''
3950 case "$prefix" in
3951 '') ;;
3952 *)
3953         case "$ans" in
3954         "$prefix") ;;
3955         *) oldprefix="$prefix";;
3956         esac
3957         ;;
3958 esac
3959 prefix="$ans"
3960 prefixexp="$ansexp"
3961
3962 : allow them to override the AFS root
3963 case "$afsroot" in
3964 '')     afsroot=/afs ;;
3965 *)      afsroot=$afsroot ;;
3966 esac
3967
3968 : is AFS running?
3969 echo " "
3970 case "$afs" in
3971 $define|true)   afs=true ;;
3972 $undef|false)   afs=false ;;
3973 *)      if $test -d $afsroot; then
3974                 afs=true
3975         else
3976                 afs=false
3977         fi
3978         ;;
3979 esac
3980 if $afs; then
3981         echo "AFS may be running... I'll be extra cautious then..." >&4
3982 else
3983         echo "AFS does not seem to be running..." >&4
3984 fi
3985
3986 : determine installation prefix for where package is to be installed.
3987 if $afs; then 
3988 $cat <<EOM
3989
3990 Since you are running AFS, I need to distinguish the directory in which
3991 files will reside from the directory in which they are installed (and from
3992 which they are presumably copied to the former directory by occult means).
3993
3994 EOM
3995         case "$installprefix" in
3996         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3997         *) dflt="$installprefix";;
3998         esac
3999 else
4000 $cat <<EOM
4001
4002 In some special cases, particularly when building $package for distribution,
4003 it is convenient to distinguish the directory in which files should be
4004 installed from the directory ($prefix) in which they will
4005 eventually reside.  For most users, these two directories are the same.
4006
4007 EOM
4008         case "$installprefix" in
4009         '') dflt=$prefix ;;
4010         *) dflt=$installprefix;;
4011         esac
4012 fi
4013 fn=d~
4014 rp='What installation prefix should I use for installing files?'
4015 . ./getfile
4016 installprefix="$ans"
4017 installprefixexp="$ansexp"
4018
4019 : Perform the prefixexp/installprefixexp correction if necessary
4020 cat <<EOS >installprefix
4021 $startsh
4022 EOS
4023 cat <<'EOSC' >>installprefix
4024 : Change installation prefix, if necessary.
4025 if $test X"$prefix" != X"$installprefix"; then
4026     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4027 else
4028     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4029 fi
4030 EOSC
4031 chmod +x installprefix
4032 $eunicefix installprefix
4033
4034 : Set variables such as privlib and privlibexp from the output of ./getfile
4035 : performing the prefixexp/installprefixexp correction if necessary.
4036 cat <<EOS >setprefixvar
4037 $startsh
4038 EOS
4039 cat <<'EOSC' >>setprefixvar
4040 eval "${prefixvar}=\"\$ans\""
4041 eval "${prefixvar}exp=\"\$ansexp\""
4042 . ./installprefix
4043 EOSC
4044 chmod +x setprefixvar
4045 $eunicefix setprefixvar
4046
4047 : set up the script used to warn in case of inconsistency
4048 cat <<EOS >whoa
4049 $startsh
4050 EOS
4051 cat <<'EOSC' >>whoa
4052 dflt=y
4053 case "$hint" in
4054     recommended)
4055         case "$hintfile" in
4056         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4057                 ;;
4058         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4059                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4060                 ;;
4061         esac
4062         ;;
4063     *)  echo " "
4064         echo "*** WHOA THERE!!! ***" >&4
4065         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4066         ;;
4067 esac
4068 rp="    Keep the $hint value?"
4069 . ./myread
4070 case "$ans" in
4071 y) td=$was; tu=$was;;
4072 esac
4073 EOSC
4074
4075 : function used to set '$1' to '$val'
4076 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4077 case "$val$was" in
4078 $define$undef) . ./whoa; eval "$var=\$td";;
4079 $undef$define) . ./whoa; eval "$var=\$tu";;
4080 *) eval "$var=$val";;
4081 esac'
4082
4083 : get the patchlevel
4084 echo " "
4085 echo "Getting the current patchlevel..." >&4
4086 if $test -r $rsrc/patchlevel.h;then
4087         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4088         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4089         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4090         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4091         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4092         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4093         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4094 else
4095         revision=0
4096         patchlevel=0
4097         subversion=0
4098         api_revision=0
4099         api_version=0
4100         api_subversion=0
4101         perl_patchlevel=0
4102         $echo "(You do not have patchlevel.h.  Eek.)"
4103 fi
4104 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4105 version_patchlevel_string="version $patchlevel subversion $subversion"
4106 case "$perl_patchlevel" in
4107 0|'') ;;
4108 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4109     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4110     ;;
4111 esac
4112
4113 $echo "(You have $package $version_patchlevel_string.)"
4114
4115 case "$osname" in
4116 dos|vms)
4117         : XXX Should be a Configure test for double-dots in filenames.
4118         version=`echo $revision $patchlevel $subversion | \
4119                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4120         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4121                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4122         ;;
4123 *)
4124         version=`echo $revision $patchlevel $subversion | \
4125                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4126         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4127                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4128         ;;
4129 esac
4130 : Special case the 5.005_xx maintenance series, which used 5.005
4131 : without any subversion label as a subdirectory in $sitelib
4132 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4133         api_versionstring='5.005'
4134 fi
4135
4136 : Do we want threads support and if so, what type
4137 case "$usethreads" in
4138 $define|true|[yY]*)     dflt='y';;
4139 *)     # Catch case where user specified ithreads or 5005threads but
4140        # forgot -Dusethreads (A.D. 4/2002)
4141        case "$useithreads$use5005threads" in
4142        *$define*)       dflt='y';;
4143        *)               dflt='n';;
4144        esac
4145        ;;
4146 esac
4147 cat <<EOM
4148
4149 Perl can be built to take advantage of threads on some systems.
4150 To do so, Configure can be run with -Dusethreads.
4151
4152 Note that Perl built with threading support runs slightly slower
4153 and uses more memory than plain Perl. The current implementation
4154 is believed to be stable, but it is fairly new, and so should be
4155 treated with caution.
4156
4157 If this doesn't make any sense to you, just accept the default '$dflt'.
4158 EOM
4159 rp='Build a threading Perl?'
4160 . ./myread
4161 case "$ans" in
4162 y|Y)    val="$define" ;;
4163 *)      val="$undef" ;;
4164 esac
4165 set usethreads
4166 eval $setvar
4167
4168 if $test $patchlevel -lt 9; then
4169     case "$usethreads" in
4170     $define)
4171         $cat <<EOM
4172
4173 Since release 5.6, Perl has had two different threading implementations,
4174 the newer interpreter-based version (ithreads) with one interpreter per
4175 thread, and the older 5.005 version (5005threads).
4176 The 5005threads version is effectively unmaintained and will probably be
4177 removed in Perl 5.10, so there should be no need to build a Perl using it
4178 unless needed for backwards compatibility with some existing 5.005threads
4179 code.
4180
4181 EOM
4182         : Default to ithreads unless overridden on command line or with
4183         : old config.sh
4184         dflt='y'
4185         case "$use5005threads" in
4186                 $define|true|[yY]*) dflt='n';;
4187         esac
4188         case "$useithreads" in
4189                 $undef|false|[nN]*) dflt='n';;
4190         esac
4191         rp='Use the newer interpreter-based ithreads?'
4192         . ./myread
4193         case "$ans" in
4194         y|Y)    val="$define" ;;
4195         *)      val="$undef" ;;
4196         esac
4197         set useithreads
4198         eval $setvar
4199         : Now set use5005threads to the opposite value.
4200         case "$useithreads" in
4201         $define) val="$undef" ;;
4202         *) val="$define" ;;
4203         esac
4204         set use5005threads
4205         eval $setvar
4206         ;;
4207     *)
4208         useithreads="$undef"
4209         use5005threads="$undef"
4210         ;;
4211     esac
4212
4213     case "$useithreads$use5005threads" in
4214     "$define$define")
4215         $cat >&4 <<EOM
4216
4217 You cannot have both the ithreads and the 5.005 threads enabled
4218 at the same time.  Disabling the 5.005 threads since they are
4219 much less stable than the ithreads.
4220
4221 EOM
4222         use5005threads="$undef"
4223         ;;
4224     esac
4225
4226 else
4227 : perl-5.9.x and later
4228
4229     if test X"$usethreads" = "X$define"; then
4230         case "$use5005threads" in
4231             $define|true|[yY]*)
4232                 $cat >&4 <<EOM
4233
4234 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4235
4236 EOM
4237             ;;
4238         esac
4239     fi
4240
4241     use5005threads="$undef"
4242     useithreads="$usethreads"
4243 fi
4244
4245 case "$d_oldpthreads" in
4246 '')     : Configure tests would be welcome here.  For now, assume undef.
4247         val="$undef" ;;
4248 *)      val="$d_oldpthreads" ;;
4249 esac
4250 set d_oldpthreads
4251 eval $setvar
4252
4253
4254 : Look for a hint-file generated 'call-back-unit'.  If the
4255 : user has specified that a threading perl is to be built,
4256 : we may need to set or change some other defaults.
4257 if $test -f usethreads.cbu; then
4258     echo "Your platform has some specific hints regarding threaded builds, using them..."
4259     . ./usethreads.cbu
4260 else
4261     case "$usethreads" in
4262         "$define"|true|[yY]*)
4263                 $cat <<EOM
4264 (Your platform does not have any specific hints for threaded builds.
4265  Assuming POSIX threads, then.)
4266 EOM
4267         ;;
4268     esac
4269 fi
4270
4271 : Check if multiplicity is required
4272 cat <<EOM
4273
4274 Perl can be built so that multiple Perl interpreters can coexist
4275 within the same Perl executable.
4276 EOM
4277
4278 case "$useithreads" in
4279 $define)
4280         cat <<EOM
4281 This multiple interpreter support is required for interpreter-based threads.
4282 EOM
4283         val="$define"
4284         ;;
4285 *)      case "$usemultiplicity" in
4286         $define|true|[yY]*)     dflt='y';;
4287         *) dflt='n';;
4288         esac
4289         echo " "
4290         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4291         rp='Build Perl for multiplicity?'
4292         . ./myread
4293         case "$ans" in
4294         y|Y)    val="$define" ;;
4295         *)      val="$undef" ;;
4296         esac
4297         ;;
4298 esac
4299 set usemultiplicity
4300 eval $setvar
4301
4302 : Check if morebits is requested
4303 case "$usemorebits" in
4304 "$define"|true|[yY]*)
4305         use64bitint="$define"
4306         uselongdouble="$define"
4307         usemorebits="$define"
4308         ;;
4309 *)      usemorebits="$undef"
4310         ;;
4311 esac
4312
4313 : Determine the C compiler to be used
4314 echo " "
4315 case "$cc" in
4316 '') dflt=cc;;
4317 *) dflt="$cc";;
4318 esac
4319 rp="Use which C compiler?"
4320 . ./myread
4321 cc="$ans"
4322
4323 : See whether they have no cc but they do have gcc
4324 . ./trygcc
4325 if $test -f cc.cbu; then
4326     . ./cc.cbu
4327 fi
4328 . ./checkcc
4329
4330 : make some quick guesses about what we are up against
4331 echo " "
4332 $echo $n "Hmm...  $c"
4333 echo exit 1 >bsd
4334 echo exit 1 >usg
4335 echo exit 1 >v7
4336 echo exit 1 >osf1
4337 echo exit 1 >eunice
4338 echo exit 1 >xenix
4339 echo exit 1 >venix
4340 echo exit 1 >os2
4341 d_bsd="$undef"
4342 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4343 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4344 then
4345         echo "Looks kind of like an OSF/1 system, but we'll see..."
4346         echo exit 0 >osf1
4347 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4348         xxx=`./loc addbib blurfl $pth`
4349         if $test -f $xxx; then
4350         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4351                 echo exit 0 >bsd
4352                 echo exit 0 >usg
4353         else
4354                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4355                         echo "Looks kind of like an extended USG system, but we'll see..."
4356                 else
4357                         echo "Looks kind of like a USG system, but we'll see..."
4358                 fi
4359                 echo exit 0 >usg
4360         fi
4361 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4362         echo "Looks kind of like a BSD system, but we'll see..."
4363         d_bsd="$define"
4364         echo exit 0 >bsd
4365 else
4366         echo "Looks kind of like a Version 7 system, but we'll see..."
4367         echo exit 0 >v7
4368 fi
4369 case "$eunicefix" in
4370 *unixtovms*)
4371         $cat <<'EOI'
4372 There is, however, a strange, musty smell in the air that reminds me of
4373 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4374 EOI
4375         echo exit 0 >eunice
4376         d_eunice="$define"
4377 : it so happens the Eunice I know will not run shell scripts in Unix format
4378         ;;
4379 *)
4380         echo " "
4381         echo "Congratulations.  You aren't running Eunice."
4382         d_eunice="$undef"
4383         ;;
4384 esac
4385 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4386 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4387 : semicolon as a patch separator
4388 case "$p_" in
4389 :) ;;
4390 *)
4391         $cat <<'EOI'
4392 I have the feeling something is not exactly right, however...don't tell me...
4393 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4394 (Or you may be running DOS with DJGPP.)
4395 EOI
4396         echo exit 0 >os2
4397         ;;
4398 esac
4399 if test -f /xenix; then
4400         echo "Actually, this looks more like a XENIX system..."
4401         echo exit 0 >xenix
4402         d_xenix="$define"
4403 else
4404         echo " "
4405         echo "It's not Xenix..."
4406         d_xenix="$undef"
4407 fi
4408 chmod +x xenix
4409 $eunicefix xenix
4410 if test -f /venix; then
4411         echo "Actually, this looks more like a VENIX system..."
4412         echo exit 0 >venix
4413 else
4414         echo " "
4415         if ./xenix; then
4416                 : null
4417         else
4418                 echo "Nor is it Venix..."
4419         fi
4420 fi
4421 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4422 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4423 $rm -f foo
4424
4425 : Check if we are using GNU gcc and what its version is
4426 echo " "
4427 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4428 $cat >try.c <<EOM
4429 #include <stdio.h>
4430 int main() {
4431 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4432 #ifdef __VERSION__
4433         printf("%s\n", __VERSION__);
4434 #else
4435         printf("%s\n", "1");
4436 #endif
4437 #endif
4438         return(0);
4439 }
4440 EOM
4441 if $cc -o try $ccflags $ldflags try.c; then
4442         gccversion=`$run ./try`
4443         case "$gccversion" in
4444         '') echo "You are not using GNU cc." ;;
4445         *)  echo "You are using GNU cc $gccversion."
4446             ccname=gcc
4447             ;;
4448         esac
4449 else
4450         echo " "
4451         echo "*** WHOA THERE!!! ***" >&4
4452         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4453         case "$knowitall" in
4454         '')
4455         echo "    You'd better start hunting for one and let me know about it." >&4
4456                 exit 1
4457                 ;;
4458         esac
4459 fi
4460 $rm -f try try.*
4461 case "$gccversion" in
4462 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4463 esac
4464 case "$gccversion" in
4465 '') gccosandvers='' ;;
4466 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4467    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4468    gccshortvers=''
4469    case "$gccosandvers" in
4470    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4471    $osname$osvers) ;; # looking good
4472    $osname*) cat <<EOM >&4
4473
4474 *** WHOA THERE!!! ***
4475
4476     Your gcc has not been compiled for the exact release of
4477     your operating system ($gccosandvers versus $osname$osvers).
4478
4479     In general it is a good idea to keep gcc synchronized with
4480     the operating system because otherwise serious problems
4481     may ensue when trying to compile software, like Perl.
4482
4483     I'm trying to be optimistic here, though, and will continue.
4484     If later during the configuration and build icky compilation
4485     problems appear (headerfile conflicts being the most common
4486     manifestation), I suggest reinstalling the gcc to match
4487     your operating system release.
4488
4489 EOM
4490       ;;
4491    *) gccosandvers='' ;; # failed to parse, better be silent
4492    esac
4493    ;;
4494 esac
4495 case "$ccname" in
4496 '') ccname="$cc" ;;
4497 esac
4498
4499 # gcc 3.* complain about adding -Idirectories that they already know about,
4500 # so we will take those off from locincpth.
4501 case "$gccversion" in
4502 3*)
4503     echo "main(){}">try.c
4504     for incdir in $locincpth; do
4505        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4506              grep '^c[cp]p*[01]: warning: changing search order '`
4507        if test "X$warn" != X; then
4508            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4509        fi
4510     done
4511     $rm -f try try.*
4512 esac
4513
4514 : What should the include directory be ?
4515 echo " "
4516 $echo $n "Hmm...  $c"
4517 dflt='/usr/include'
4518 incpath=''
4519 mips_type=''
4520 if $test -f /bin/mips && /bin/mips; then
4521         echo "Looks like a MIPS system..."
4522         $cat >usr.c <<'EOCP'
4523 #ifdef SYSTYPE_BSD43
4524 /bsd43
4525 #endif
4526 EOCP
4527         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4528                 dflt='/bsd43/usr/include'
4529                 incpath='/bsd43'
4530                 mips_type='BSD 4.3'
4531         else
4532                 mips_type='System V'
4533         fi
4534         $rm -f usr.c usr.out
4535         echo "and you're compiling with the $mips_type compiler and libraries."
4536         xxx_prompt=y
4537         echo "exit 0" >mips
4538 else
4539         echo "Doesn't look like a MIPS system."
4540         xxx_prompt=n
4541         echo "exit 1" >mips
4542 fi
4543 chmod +x mips
4544 $eunicefix mips
4545 case "$usrinc" in
4546 '') ;;
4547 *) dflt="$usrinc";;
4548 esac
4549 case "$xxx_prompt" in
4550 y)      fn=d/
4551         echo " "
4552         rp='Where are the include files you want to use?'
4553         . ./getfile
4554         usrinc="$ans"
4555         ;;
4556 *)      usrinc="$dflt"
4557         ;;
4558 esac
4559
4560 : see how we invoke the C preprocessor
4561 echo " "
4562 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4563 cat <<'EOT' >testcpp.c
4564 #define ABC abc
4565 #define XYZ xyz
4566 ABC.XYZ
4567 EOT
4568 cd ..
4569 if test ! -f cppstdin; then
4570         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4571                 # AIX cc -E doesn't show the absolute headerfile
4572                 # locations but we'll cheat by using the -M flag.
4573                 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
4574         else
4575                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4576         fi
4577 else
4578         echo "Keeping your $hint cppstdin wrapper."
4579 fi
4580 chmod 755 cppstdin
4581 wrapper=`pwd`/cppstdin
4582 ok='false'
4583 cd UU
4584
4585 if $test "X$cppstdin" != "X" && \
4586         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4587         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4588 then
4589         echo "You used to use $cppstdin $cppminus so we'll use that again."
4590         case "$cpprun" in
4591         '') echo "But let's see if we can live without a wrapper..." ;;
4592         *)
4593                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4594                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4595                 then
4596                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4597                         ok='true'
4598                 else
4599                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4600                 fi
4601                 ;;
4602         esac
4603 else
4604         case "$cppstdin" in
4605         '') ;;
4606         *)
4607                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4608                 ;;
4609         esac
4610 fi
4611
4612 if $ok; then
4613         : nothing
4614 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4615         $cc -E <testcpp.c >testcpp.out 2>&1; \
4616         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4617         echo "Yup, it does."
4618         x_cpp="$cc -E"
4619         x_minus='';
4620 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4621         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4622         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4623         echo "Yup, it does."
4624         x_cpp="$cc -E"
4625         x_minus='-';
4626 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4627         $cc -P <testcpp.c >testcpp.out 2>&1; \
4628         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4629         echo "Yipee, that works!"
4630         x_cpp="$cc -P"
4631         x_minus='';
4632 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4633         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4634         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4635         echo "At long last!"
4636         x_cpp="$cc -P"
4637         x_minus='-';
4638 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4639         $cpp <testcpp.c >testcpp.out 2>&1; \
4640         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4641         echo "It works!"
4642         x_cpp="$cpp"
4643         x_minus='';
4644 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4645         $cpp - <testcpp.c >testcpp.out 2>&1; \
4646         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4647         echo "Hooray, it works!  I was beginning to wonder."
4648         x_cpp="$cpp"
4649         x_minus='-';
4650 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4651         $wrapper <testcpp.c >testcpp.out 2>&1; \
4652         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4653         x_cpp="$wrapper"
4654         x_minus=''
4655         echo "Eureka!"
4656 else
4657         dflt=''
4658         rp="No dice.  I can't find a C preprocessor.  Name one:"
4659         . ./myread
4660         x_cpp="$ans"
4661         x_minus=''
4662         $x_cpp <testcpp.c >testcpp.out 2>&1
4663         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4664                 echo "OK, that will do." >&4
4665         else
4666 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4667                 exit 1
4668         fi
4669 fi
4670
4671 case "$ok" in
4672 false)
4673         cppstdin="$x_cpp"
4674         cppminus="$x_minus"
4675         cpprun="$x_cpp"
4676         cpplast="$x_minus"
4677         set X $x_cpp
4678         shift
4679         case "$1" in
4680         "$cpp")
4681                 echo "Perhaps can we force $cc -E using a wrapper..."
4682                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4683                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4684                 then
4685                         echo "Yup, we can."
4686                         cppstdin="$wrapper"
4687                         cppminus='';
4688                 else
4689                         echo "Nope, we'll have to live without it..."
4690                 fi
4691                 ;;
4692         esac
4693         case "$cpprun" in
4694         "$wrapper")
4695                 cpprun=''
4696                 cpplast=''
4697                 ;;
4698         esac
4699         ;;
4700 esac
4701
4702 case "$cppstdin" in
4703 "$wrapper"|'cppstdin') ;;
4704 *) $rm -f $wrapper;;
4705 esac
4706 $rm -f testcpp.c testcpp.out
4707
4708 : Set private lib path
4709 case "$plibpth" in
4710 '') if ./mips; then
4711                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4712         fi;;
4713 esac
4714 case "$libpth" in
4715 ' ') dlist='';;
4716 '') dlist="$loclibpth $plibpth $glibpth";;
4717 *) dlist="$libpth";;
4718 esac
4719
4720 : Now check and see which directories actually exist, avoiding duplicates
4721 libpth=''
4722 for xxx in $dlist
4723 do
4724     if $test -d $xxx; then
4725                 case " $libpth " in
4726                 *" $xxx "*) ;;
4727                 *) libpth="$libpth $xxx";;
4728                 esac
4729     fi
4730 done
4731 $cat <<'EOM'
4732
4733 Some systems have incompatible or broken versions of libraries.  Among
4734 the directories listed in the question below, please remove any you
4735 know not to be holding relevant libraries, and add any that are needed.
4736 Say "none" for none.
4737
4738 EOM
4739 case "$libpth" in
4740 '') dflt='none';;
4741 *)
4742         set X $libpth
4743         shift
4744         dflt=${1+"$@"}
4745         ;;
4746 esac
4747 rp="Directories to use for library searches?"
4748 . ./myread
4749 case "$ans" in
4750 none) libpth=' ';;
4751 *) libpth="$ans";;
4752 esac
4753
4754 : compute shared library extension
4755 case "$so" in
4756 '')
4757         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4758                 dflt='sl'
4759         else
4760                 dflt='so'
4761         fi
4762         ;;
4763 *) dflt="$so";;
4764 esac
4765 $cat <<EOM
4766
4767 On some systems, shared libraries may be available.  Answer 'none' if
4768 you want to suppress searching of shared libraries for the remainder
4769 of this configuration.
4770
4771 EOM
4772 rp='What is the file extension used for shared libraries?'
4773 . ./myread
4774 so="$ans"
4775
4776 : Define several unixisms.
4777 : Hints files or command line option can be used to override them.
4778 : The convoluted testing is in case hints files set either the old
4779 : or the new name.
4780 case "$_exe" in
4781 '')     case "$exe_ext" in
4782         '')     ;;
4783         *)      _exe="$exe_ext" ;;
4784         esac
4785         ;;
4786 esac
4787 case "$_a" in
4788 '')     case "$lib_ext" in
4789     '') _a='.a';;
4790         *)      _a="$lib_ext" ;;
4791         esac
4792         ;;
4793 esac
4794 case "$_o" in
4795 '') case "$obj_ext" in
4796         '')     _o='.o';;
4797         *)      _o="$obj_ext";;
4798         esac
4799         ;;
4800 esac
4801 case "$p_" in
4802 '') case "$path_sep" in
4803         '')     p_=':';;
4804         *)      p_="$path_sep";;
4805         esac
4806         ;;
4807 esac
4808 exe_ext=$_exe
4809 lib_ext=$_a
4810 obj_ext=$_o
4811 path_sep=$p_
4812
4813 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4814
4815 : Which makefile gets called first.  This is used by make depend.
4816 case "$firstmakefile" in
4817 '') firstmakefile='makefile';;
4818 esac
4819
4820 : Check is we will use socks
4821 case "$usesocks" in
4822 $define|true|[yY]*)     dflt='y';;
4823 *) dflt='n';;
4824 esac
4825 cat <<EOM
4826
4827 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4828 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4829 to use the PerlIO abstraction layer, this will be implicitly selected.
4830
4831 If this doesn't make any sense to you, just accept the default '$dflt'.
4832 EOM
4833 rp='Build Perl for SOCKS?'
4834 . ./myread
4835 case "$ans" in
4836 y|Y)    val="$define" ;;
4837 *)      val="$undef" ;;
4838 esac
4839 set usesocks
4840 eval $setvar
4841
4842 : Check for uselongdouble support
4843 case "$ccflags" in
4844 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4845 esac
4846
4847 case "$uselongdouble" in
4848 $define|true|[yY]*)     dflt='y';;
4849 *) dflt='n';;
4850 esac
4851 cat <<EOM
4852
4853 Perl can be built to take advantage of long doubles which
4854 (if available) may give more accuracy and range for floating point numbers.
4855
4856 If this doesn't make any sense to you, just accept the default '$dflt'.
4857 EOM
4858 rp='Try to use long doubles if available?'
4859 . ./myread
4860 case "$ans" in
4861 y|Y)    val="$define"   ;;
4862 *)      val="$undef"    ;;
4863 esac
4864 set uselongdouble
4865 eval $setvar
4866
4867 case "$uselongdouble" in
4868 true|[yY]*) uselongdouble="$define" ;;
4869 esac
4870
4871 : Look for a hint-file generated 'call-back-unit'.  If the
4872 : user has specified that long doubles should be used,
4873 : we may need to set or change some other defaults.
4874 if $test -f uselongdouble.cbu; then
4875     echo "Your platform has some specific hints regarding long doubles, using them..."
4876     . ./uselongdouble.cbu
4877 else
4878     case "$uselongdouble" in
4879         $define)
4880                 $cat <<EOM
4881 (Your platform does not have any specific hints for long doubles.)
4882 EOM
4883         ;;
4884     esac
4885 fi
4886
4887 : Looking for optional libraries
4888 echo " "
4889 echo "Checking for optional libraries..." >&4
4890 case "$libs" in
4891 ' '|'') dflt='';;
4892 *) dflt="$libs";;
4893 esac
4894 case "$libswanted" in
4895 '') libswanted='c_s';;
4896 esac
4897 case "$usesocks" in
4898 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4899 esac
4900 libsfound=''
4901 libsfiles=''
4902 libsdirs=''
4903 libspath=''
4904 for thisdir in $libpth $xlibpth; do
4905   test -d $thisdir && libspath="$libspath $thisdir"
4906 done
4907 for thislib in $libswanted; do
4908         for thisdir in $libspath; do
4909             xxx=''
4910             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4911                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4912                 $test -f "$xxx" && eval $libscheck
4913                 $test -f "$xxx" && libstyle=shared
4914             fi
4915             if test ! -f "$xxx"; then
4916                 xxx=$thisdir/lib$thislib.$so
4917                 $test -f "$xxx" && eval $libscheck
4918                 $test -f "$xxx" && libstyle=shared
4919             fi
4920             if test ! -f "$xxx"; then
4921                 xxx=$thisdir/lib$thislib$_a
4922                 $test -f "$xxx" && eval $libscheck
4923                 $test -f "$xxx" && libstyle=static
4924             fi
4925             if test ! -f "$xxx"; then
4926                 xxx=$thisdir/$thislib$_a
4927                 $test -f "$xxx" && eval $libscheck
4928                 $test -f "$xxx" && libstyle=static
4929             fi
4930             if test ! -f "$xxx"; then
4931                 xxx=$thisdir/lib${thislib}_s$_a
4932                 $test -f "$xxx" && eval $libscheck
4933                 $test -f "$xxx" && libstyle=static
4934                 $test -f "$xxx" && thislib=${thislib}_s
4935             fi
4936             if test ! -f "$xxx"; then
4937                 xxx=$thisdir/Slib$thislib$_a
4938                 $test -f "$xxx" && eval $libscheck
4939                 $test -f "$xxx" && libstyle=static
4940             fi
4941             if $test -f "$xxx"; then
4942                 case "$libstyle" in
4943                 shared) echo "Found -l$thislib (shared)." ;;
4944                 static) echo "Found -l$thislib." ;;
4945                 *)      echo "Found -l$thislib ($libstyle)." ;;
4946                 esac
4947                 case " $dflt " in
4948                 *"-l$thislib "*);;
4949                 *) dflt="$dflt -l$thislib"
4950                    libsfound="$libsfound $xxx"
4951                    yyy=`basename $xxx`
4952                    libsfiles="$libsfiles $yyy"
4953                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4954                    case " $libsdirs " in
4955                    *" $yyy "*) ;;
4956                    *) libsdirs="$libsdirs $yyy" ;;
4957                    esac
4958                    ;;
4959                 esac
4960                 break
4961             fi
4962         done
4963         if $test ! -f "$xxx"; then
4964             echo "No -l$thislib."
4965         fi
4966 done
4967 set X $dflt
4968 shift
4969 dflt="$*"
4970 case "$libs" in
4971 '') dflt="$dflt";;
4972 *) dflt="$libs";;
4973 esac
4974 case "$dflt" in
4975 ' '|'') dflt='none';;
4976 esac
4977
4978 $cat <<EOM
4979
4980 In order to compile $package on your machine, a number of libraries
4981 are usually needed.  Include any other special libraries here as well.
4982 Say "none" for none.  The default list is almost always right.
4983 EOM
4984
4985 echo " "
4986 rp="What libraries to use?"
4987 . ./myread
4988 case "$ans" in
4989 none) libs=' ';;
4990 *) libs="$ans";;
4991 esac
4992
4993 : determine optimization, if desired, or use for debug flag also
4994 case "$optimize" in
4995 ' '|$undef) dflt='none';;
4996 '') dflt='-O';;
4997 *) dflt="$optimize";;
4998 esac
4999 $cat <<EOH
5000
5001 By default, $package compiles with the -O flag to use the optimizer.
5002 Alternately, you might want to use the symbolic debugger, which uses
5003 the -g flag (on traditional Unix systems).  Either flag can be
5004 specified here.  To use neither flag, specify the word "none".
5005
5006 EOH
5007 rp="What optimizer/debugger flag should be used?"
5008 . ./myread
5009 optimize="$ans"
5010 case "$optimize" in
5011 'none') optimize=" ";;
5012 esac
5013
5014 : Check what DEBUGGING is required from the command line
5015 : -DEBUGGING      or -DDEBUGGING or
5016 : -DEBUGGING=both                       = -g + -DDEBUGGING
5017 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5018 : -DEBUGGING=none or -UDEBUGGING        =
5019 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5020 case "$EBUGGING" in
5021 '')     ;;
5022 *)      DEBUGGING=$EBUGGING ;;
5023 esac
5024
5025 case "$DEBUGGING" in
5026 -g|both|$define)
5027     case "$optimize" in
5028         *-g*) ;;
5029         *)    optimize="$optimize -g" ;;
5030     esac ;;
5031 none|$undef)
5032     case "$optimize" in
5033         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5034                 shift
5035                 optimize="$*"
5036                 ;;
5037     esac ;;
5038 esac
5039
5040 dflt=''
5041 case "$DEBUGGING" in
5042 both|$define) dflt='-DDEBUGGING'
5043 esac
5044
5045 : argument order is deliberate, as the flag will start with - which set could
5046 : think is an option
5047 checkccflag='check=$1; flag=$2; callback=$3;
5048 echo " ";
5049 echo "Checking if your compiler accepts $flag" 2>&1;
5050 echo "int main(void) { return 0; }" > gcctest.c;
5051 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5052     echo "Yes, it does." 2>&1;
5053     if $test -s gcctest.out ; then
5054         echo "But your platform does not like it:";
5055         cat gcctest.out;
5056     else
5057         case "$ccflags" in
5058         *$check*)
5059             echo "Leaving current flags $ccflags alone." 2>&1
5060             ;;
5061         *) dflt="$dflt $flag";
5062             eval $callback
5063             ;;
5064         esac
5065     fi
5066 else
5067     echo "Nope, it does not, but that is ok." 2>&1;
5068 fi
5069 '
5070
5071 : We will not override a previous value, but we might want to
5072 : augment a hint file
5073 case "$hint" in
5074 default|recommended)
5075         case "$gccversion" in
5076         1*) dflt="$dflt -fpcc-struct-return" ;;
5077         esac
5078         case "$optimize:$DEBUGGING" in
5079         *-g*:old) dflt="$dflt -DDEBUGGING";;
5080         esac
5081         case "$gccversion" in
5082         2*) if $test -d /etc/conf/kconfig.d &&
5083                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5084                 then
5085                         # Interactive Systems (ISC) POSIX mode.
5086                         dflt="$dflt -posix"
5087                 fi
5088                 ;;
5089         esac
5090         case "$gccversion" in
5091         1*) ;;
5092         2.[0-8]*) ;;
5093         ?*)     set strict-aliasing -fno-strict-aliasing
5094                 eval $checkccflag
5095                 ;;
5096         esac
5097         # For gcc, adding -pipe speeds up compilations for some, but apparently
5098         # some assemblers can't read from stdin.  (It also slows down compilations
5099         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5100         case "$gccversion" in
5101         ?*)     set pipe -pipe
5102                 eval $checkccflag
5103                 ;;
5104         esac
5105
5106         # on x86_64 (at least) we require an extra library (libssp) in the
5107         # link command line. This library is not named, so I infer that it is
5108         # an implementation detail that may change. Hence the safest approach
5109         # is to add the flag to the flags passed to the compiler at link time,
5110         # as that way the compiler can do the right implementation dependant
5111         # thing. (NWC)
5112         case "$gccversion" in
5113         ?*)     set stack-protector -fstack-protector
5114                 eval $checkccflag
5115                 ;;
5116         esac
5117         ;;
5118 esac
5119
5120 case "$mips_type" in
5121 *BSD*|'') inclwanted="$locincpth $usrinc";;
5122 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5123 esac
5124 for thisincl in $inclwanted; do
5125         if $test -d $thisincl; then
5126                 if $test x$thisincl != x$usrinc; then
5127                         case "$dflt" in
5128                         *" -I$thisincl "*);;
5129                         *) dflt="$dflt -I$thisincl ";;
5130                         esac
5131                 fi
5132         fi
5133 done
5134
5135 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5136         xxx=true;
5137 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5138         xxx=true;
5139 else
5140         xxx=false;
5141 fi;
5142 if $xxx; then
5143         case "$dflt" in
5144         *$2*);;
5145         *) dflt="$dflt -D$2";;
5146         esac;
5147 fi'
5148
5149 set signal.h LANGUAGE_C; eval $inctest
5150
5151 case "$usesocks" in
5152 $define)
5153         ccflags="$ccflags -DSOCKS"
5154         ;;
5155 esac
5156
5157 case "$hint" in
5158 default|recommended) dflt="$ccflags $dflt" ;;
5159 *) dflt="$ccflags";;
5160 esac
5161
5162 case "$dflt" in
5163 ''|' ') dflt=none;;
5164 esac
5165
5166 $cat <<EOH
5167
5168 Your C compiler may want other flags.  For this question you should include
5169 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5170 but you should NOT include libraries or ld flags like -lwhatever.  If you
5171 want $package to honor its debug switch, you should include -DDEBUGGING here.
5172 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5173
5174 To use no flags, specify the word "none".
5175
5176 EOH
5177 set X $dflt
5178 shift
5179 dflt=${1+"$@"}
5180 rp="Any additional cc flags?"
5181 . ./myread
5182 case "$ans" in
5183 none) ccflags='';;
5184 *) ccflags="$ans";;
5185 esac
5186
5187 : the following weeds options from ccflags that are of no interest to cpp
5188 case "$cppflags" in
5189 '') cppflags="$ccflags" ;;
5190 *)  cppflags="$cppflags $ccflags" ;;
5191 esac
5192 case "$gccversion" in
5193 1*) cppflags="$cppflags -D__GNUC__"
5194 esac
5195 case "$mips_type" in
5196 '');;
5197 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5198 esac
5199 case "$cppflags" in
5200 '');;
5201 *)
5202         echo " "
5203         echo "Let me guess what the preprocessor flags are..." >&4
5204         set X $cppflags
5205         shift
5206         cppflags=''
5207         $cat >cpp.c <<'EOM'
5208 #define BLURFL foo
5209
5210 BLURFL xx LFRULB
5211 EOM
5212         previous=''
5213         for flag in $*
5214         do
5215                 case "$flag" in
5216                 -*) ftry="$flag";;
5217                 *) ftry="$previous $flag";;
5218                 esac
5219                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5220                         >cpp1.out 2>/dev/null && \
5221                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5222                         >cpp2.out 2>/dev/null && \
5223                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5224                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5225                 then
5226                         cppflags="$cppflags $ftry"
5227                         previous=''
5228                 else
5229                         previous="$flag"
5230                 fi
5231         done
5232         set X $cppflags
5233         shift
5234         cppflags=${1+"$@"}
5235         case "$cppflags" in
5236         *-*)  echo "They appear to be: $cppflags";;
5237         esac
5238         $rm -f cpp.c cpp?.out
5239         ;;
5240 esac
5241
5242 : flags used in final linking phase
5243 case "$ldflags" in
5244 '') if ./venix; then
5245                 dflt='-i -z'
5246         else
5247                 dflt=''
5248         fi
5249         case "$ccflags" in
5250         *-posix*) dflt="$dflt -posix" ;;
5251         esac
5252         ;;
5253 *) dflt="$ldflags";;
5254 esac
5255 # See note above about -fstack-protector
5256 case "$ccflags" in
5257 *-fstack-protector*) 
5258         case "$dflt" in
5259         *-fstack-protector*) ;; # Don't add it again
5260         *) dflt="$dflt -fstack-protector" ;; 
5261         esac
5262         ;;
5263 esac
5264
5265 : Try to guess additional flags to pick up local libraries.
5266 for thislibdir in $libpth; do
5267         case " $loclibpth " in
5268         *" $thislibdir "*)
5269                 case "$dflt " in
5270                 *"-L$thislibdir "*) ;;
5271                 *)  dflt="$dflt -L$thislibdir" ;;
5272                 esac
5273                 ;;
5274         esac
5275 done
5276
5277 case "$dflt" in
5278 '') dflt='none' ;;
5279 esac
5280
5281 $cat <<EOH
5282
5283 Your C linker may need flags.  For this question you should
5284 include -L/whatever and any other flags used by the C linker, but you
5285 should NOT include libraries like -lwhatever.
5286
5287 Make sure you include the appropriate -L/path flags if your C linker
5288 does not normally search all of the directories you specified above,
5289 namely
5290         $libpth
5291 To use no flags, specify the word "none".
5292
5293 EOH
5294
5295 rp="Any additional ld flags (NOT including libraries)?"
5296 . ./myread
5297 case "$ans" in
5298 none) ldflags='';;
5299 *) ldflags="$ans";;
5300 esac
5301 rmlist="$rmlist pdp11"
5302
5303 : coherency check
5304 echo " "
5305 echo "Checking your choice of C compiler and flags for coherency..." >&4
5306 $cat > try.c <<'EOF'
5307 #include <stdio.h>
5308 int main() { printf("Ok\n"); return(0); }
5309 EOF
5310 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5311 shift
5312 $cat >try.msg <<'EOM'
5313 I've tried to compile and run the following simple program:
5314
5315 EOM
5316 $cat try.c >> try.msg
5317
5318 $cat >> try.msg <<EOM
5319
5320 I used the command:
5321
5322         $*
5323         $run ./try
5324
5325 and I got the following output:
5326
5327 EOM
5328 dflt=y
5329 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5330         if $sh -c "$run ./try " >>try.msg 2>&1; then
5331                 xxx=`$run ./try`
5332                 case "$xxx" in
5333                 "Ok") dflt=n ;;
5334                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5335                         case " $libs " in
5336                         *" -lsfio "*)
5337                                 cat >> try.msg <<'EOQS'
5338 If $libs contains -lsfio, and sfio is mis-configured, then it
5339 sometimes (apparently) runs and exits with a 0 status, but with no
5340 output!  It may have to do with sfio's use of _exit vs. exit.
5341
5342 EOQS
5343                                 rp="You have a big problem.  Shall I abort Configure"
5344                                 dflt=y
5345                                 ;;
5346                         esac
5347                         ;;
5348                 esac
5349         else
5350                 echo "The program compiled OK, but exited with status $?." >>try.msg
5351                 rp="You have a problem.  Shall I abort Configure"
5352                 dflt=y
5353         fi
5354 else
5355         echo "I can't compile the test program." >>try.msg
5356         rp="You have a BIG problem.  Shall I abort Configure"
5357         dflt=y
5358 fi
5359 case "$dflt" in
5360 y)
5361         $cat try.msg >&4
5362         case "$knowitall" in
5363         '')
5364                 echo "(The supplied flags or libraries might be incorrect.)"
5365                 ;;
5366         *) dflt=n;;
5367         esac
5368         echo " "
5369         . ./myread
5370         case "$ans" in
5371         n*|N*) ;;
5372         *)      echo "Ok.  Stopping Configure." >&4
5373                 exit 1
5374                 ;;
5375         esac
5376         ;;
5377 n) echo "OK, that should do.";;
5378 esac
5379 $rm_try gcctest gcctest.out
5380
5381 : define a shorthand compile call
5382 compile='
5383 mc_file=$1;
5384 shift;
5385 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5386 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5387 exit 1;
5388 fi;
5389 esac;
5390 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5391 : define a shorthand compile call for compilations that should be ok.
5392 compile_ok='
5393 mc_file=$1;
5394 shift;
5395 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5396
5397 : determine filename position in cpp output
5398 echo " "
5399 echo "Computing filename position in cpp output for #include directives..." >&4
5400 case "$osname" in
5401 vos) testaccess=-e ;;
5402 *)   testaccess=-r ;;
5403 esac
5404 echo '#include <stdio.h>' > foo.c
5405 $cat >fieldn <<EOF
5406 $startsh
5407 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5408 $grep '^[       ]*#.*stdio\.h' | \
5409 while read cline; do
5410         pos=1
5411         set \$cline
5412         while $test \$# -gt 0; do
5413                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5414                         echo "\$pos"
5415                         exit 0
5416                 fi
5417                 shift
5418                 pos=\`expr \$pos + 1\`
5419         done
5420 done
5421 EOF
5422 chmod +x fieldn
5423 fieldn=`./fieldn`
5424 $rm -f foo.c fieldn
5425 case $fieldn in
5426 '') pos='???';;
5427 1) pos=first;;
5428 2) pos=second;;
5429 3) pos=third;;
5430 *) pos="${fieldn}th";;
5431 esac
5432 echo "Your cpp writes the filename in the $pos field of the line."
5433
5434 case "$osname" in
5435 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5436 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5437 *)   cppfilter='' ;;
5438 esac
5439 : locate header file
5440 $cat >findhdr <<EOF
5441 $startsh
5442 wanted=\$1
5443 name=''
5444 for usrincdir in $usrinc
5445 do
5446         if test -f \$usrincdir/\$wanted; then
5447                 echo "\$usrincdir/\$wanted"
5448                 exit 0
5449         fi
5450 done
5451 awkprg='{ print \$$fieldn }'
5452 echo "#include <\$wanted>" > foo\$\$.c
5453 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5454 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5455 while read cline; do
5456         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5457         case "\$name" in
5458         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5459         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5460         *) exit 2;;
5461         esac;
5462 done;
5463 #
5464 # status = 0: grep returned 0 lines, case statement not executed
5465 # status = 1: headerfile found
5466 # status = 2: while loop executed, no headerfile found
5467 #
5468 status=\$?
5469 $rm -f foo\$\$.c;
5470 if test \$status -eq 1; then
5471         exit 0;
5472 fi
5473 exit 1
5474 EOF
5475 chmod +x findhdr
5476
5477 : define an alternate in-header-list? function
5478 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5479 cont=true; xxf="echo \"<\$1> found.\" >&4";
5480 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5481 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5482 esac;
5483 case $# in 4) instead=instead;; *) instead="at last";; esac;
5484 while $test "$cont"; do
5485         xxx=`./findhdr $1`
5486         var=$2; eval "was=\$$2";
5487         if $test "$xxx" && $test -r "$xxx";
5488         then eval $xxf;
5489         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5490                 cont="";
5491         else eval $xxnf;
5492         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5493         set $yyy; shift; shift; yyy=$@;
5494         case $# in 0) cont="";;
5495         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5496                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5497         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5498                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5499         esac;
5500 done;
5501 while $test "$yyy";
5502 do set $yyy; var=$2; eval "was=\$$2";
5503         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5504         set $yyy; shift; shift; yyy=$@;
5505 done'
5506
5507 : see if stdlib is available
5508 set stdlib.h i_stdlib
5509 eval $inhdr
5510
5511 : check for lengths of integral types
5512 echo " "
5513 case "$intsize" in
5514 '')
5515         echo "Checking to see how big your integers are..." >&4
5516         $cat >try.c <<EOCP
5517 #include <stdio.h>
5518 #$i_stdlib I_STDLIB
5519 #ifdef I_STDLIB
5520 #include <stdlib.h>
5521 #endif
5522 int main()
5523 {
5524         printf("intsize=%d;\n", (int)sizeof(int));
5525         printf("longsize=%d;\n", (int)sizeof(long));
5526         printf("shortsize=%d;\n", (int)sizeof(short));
5527         exit(0);
5528 }
5529 EOCP
5530         set try
5531         if eval $compile_ok && $run ./try > /dev/null; then
5532                 eval `$run ./try`
5533                 echo "Your integers are $intsize bytes long."
5534                 echo "Your long integers are $longsize bytes long."
5535                 echo "Your short integers are $shortsize bytes long."
5536         else
5537                 $cat >&4 <<EOM
5538 !
5539 Help! I can't compile and run the intsize test program: please enlighten me!
5540 (This is probably a misconfiguration in your system or libraries, and
5541 you really ought to fix it.  Still, I'll try anyway.)
5542 !
5543 EOM
5544                 dflt=4
5545                 rp="What is the size of an integer (in bytes)?"
5546                 . ./myread
5547                 intsize="$ans"
5548                 dflt=$intsize
5549                 rp="What is the size of a long integer (in bytes)?"
5550                 . ./myread
5551                 longsize="$ans"
5552                 dflt=2
5553                 rp="What is the size of a short integer (in bytes)?"
5554                 . ./myread
5555                 shortsize="$ans"
5556         fi
5557         ;;
5558 esac
5559 $rm_try
5560
5561 : check for long long
5562 echo " "
5563 echo "Checking to see if you have long long..." >&4
5564 echo 'int main() { long long x = 7; return 0; }' > try.c
5565 set try
5566 if eval $compile; then
5567         val="$define"
5568         echo "You have long long."
5569 else
5570         val="$undef"
5571         echo "You do not have long long."
5572 fi
5573 $rm_try
5574 set d_longlong
5575 eval $setvar
5576
5577 : check for length of long long
5578 case "${d_longlong}${longlongsize}" in
5579 $define)
5580         echo " "
5581         echo "Checking to see how big your long longs are..." >&4
5582         $cat >try.c <<'EOCP'
5583 #include <stdio.h>
5584 int main()
5585 {
5586     printf("%d\n", (int)sizeof(long long));
5587     return(0);
5588 }
5589 EOCP
5590         set try
5591         if eval $compile_ok; then
5592                 longlongsize=`$run ./try`
5593                 echo "Your long longs are $longlongsize bytes long."
5594         else
5595                 dflt='8'
5596                 echo " "
5597                 echo "(I can't seem to compile the test program.  Guessing...)"
5598                 rp="What is the size of a long long (in bytes)?"
5599                 . ./myread
5600                 longlongsize="$ans"
5601         fi
5602         if $test "X$longsize" = "X$longlongsize"; then
5603                 echo "(That isn't any different from an ordinary long.)"
5604         fi
5605         ;;
5606 esac
5607 $rm_try
5608
5609 : see if inttypes.h is available
5610 : we want a real compile instead of Inhdr because some systems
5611 : have an inttypes.h which includes non-existent headers
5612 echo " "
5613 $cat >try.c <<EOCP
5614 #include <inttypes.h>
5615 int main() {
5616         static int32_t foo32 = 0x12345678;
5617 }
5618 EOCP
5619 set try
5620 if eval $compile; then
5621         echo "<inttypes.h> found." >&4
5622         val="$define"
5623 else
5624         echo "<inttypes.h> NOT found." >&4
5625         val="$undef"
5626 fi
5627 $rm_try
5628 set i_inttypes
5629 eval $setvar
5630
5631 : check for int64_t
5632 echo " "
5633 echo "Checking to see if you have int64_t..." >&4
5634 $cat >try.c <<EOCP
5635 #include <sys/types.h>
5636 #$i_inttypes I_INTTYPES
5637 #ifdef I_INTTYPES
5638 #include <inttypes.h>
5639 #endif
5640 int main() { int64_t x = 7; }
5641 EOCP
5642 set try
5643 if eval $compile; then
5644         val="$define"
5645         echo "You have int64_t."
5646 else
5647         val="$undef"
5648         echo "You do not have int64_t."
5649 fi
5650 $rm_try
5651 set d_int64_t
5652 eval $setvar
5653
5654 : Check if 64bit ints have a quad type
5655 echo " "
5656 echo "Checking which 64-bit integer type we could use..." >&4
5657
5658 case "$intsize" in
5659 8) val=int
5660    set quadtype
5661    eval $setvar
5662    val='"unsigned int"'
5663    set uquadtype
5664    eval $setvar
5665    quadkind=1
5666    ;;
5667 *) case "$longsize" in
5668    8) val=long
5669       set quadtype
5670       eval $setvar
5671       val='"unsigned long"'
5672       set uquadtype
5673       eval $setvar
5674       quadkind=2
5675       ;;
5676    *) case "$d_longlong:$longlongsize" in
5677       define:8)
5678         val='"long long"'
5679         set quadtype
5680         eval $setvar
5681         val='"unsigned long long"'
5682         set uquadtype
5683         eval $setvar
5684         quadkind=3
5685         ;;
5686       *) case "$d_int64_t" in
5687          define)
5688            val=int64_t
5689            set quadtype
5690            eval $setvar
5691            val=uint64_t
5692            set uquadtype
5693            eval $setvar
5694            quadkind=4
5695            ;;
5696          esac
5697          ;;
5698       esac
5699       ;;
5700    esac
5701    ;;
5702 esac
5703
5704 case "$quadtype" in
5705 '')     echo "Alas, no 64-bit integer types in sight." >&4
5706         d_quad="$undef"
5707         ;;
5708 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5709         d_quad="$define"
5710         ;;
5711 esac
5712
5713 : Do we want 64bit support
5714 case "$uselonglong" in
5715 "$define"|true|[yY]*)
5716         cat <<EOM >&4
5717
5718 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5719 EOM
5720         use64bitint="$define"
5721         ;;
5722 esac
5723 case "$use64bits" in
5724 "$define"|true|[yY]*)
5725         cat <<EOM >&4
5726
5727 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5728 EOM
5729         use64bitint="$define"
5730         ;;
5731 esac
5732 case "$use64bitints" in
5733 "$define"|true|[yY]*)
5734         cat <<EOM >&4
5735
5736 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5737 EOM
5738         use64bitint="$define"
5739         ;;
5740 esac
5741 case "$use64bitsint" in
5742 "$define"|true|[yY]*)
5743         cat <<EOM >&4
5744
5745 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5746 EOM
5747         use64bitint="$define"
5748         ;;
5749 esac
5750 case "$uselonglongs" in
5751 "$define"|true|[yY]*)
5752         cat <<EOM >&4
5753
5754 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5755 EOM
5756         use64bitint="$define"
5757         ;;
5758 esac
5759 case "$use64bitsall" in
5760 "$define"|true|[yY]*)
5761         cat <<EOM >&4
5762
5763 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5764 EOM
5765         use64bitall="$define"
5766         ;;
5767 esac
5768
5769 case "$ccflags" in
5770 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5771 esac
5772 case "$use64bitall" in
5773 "$define"|true|[yY]*) use64bitint="$define" ;;
5774 esac
5775
5776 case "$longsize" in
5777 8) cat <<EOM
5778
5779 You have natively 64-bit long integers.
5780 EOM
5781    val="$define"
5782    ;;
5783 *) case "$use64bitint" in
5784    "$define"|true|[yY]*) dflt='y';;
5785    *) dflt='n';;
5786    esac
5787    case "$d_quad" in
5788    "$define") ;;
5789    *) dflt='n' ;;
5790    esac
5791    cat <<EOM
5792
5793 Perl can be built to take advantage of 64-bit integer types
5794 on some systems.  To do so, Configure can be run with -Duse64bitint.
5795 Choosing this option will most probably introduce binary incompatibilities.
5796
5797 If this doesn't make any sense to you, just accept the default '$dflt'.
5798 (The default has been chosen based on your configuration.)
5799 EOM
5800    rp='Try to use 64-bit integers, if available?'
5801    . ./myread
5802    case "$ans" in
5803    [yY]*) val="$define" ;;
5804    *)     val="$undef"  ;;
5805    esac
5806    ;;
5807 esac
5808 set use64bitint
5809 eval $setvar
5810
5811 case "$use64bitall" in
5812 "$define"|true|[yY]*) dflt='y' ;;
5813 *) case "$longsize" in
5814    8) dflt='y' ;;
5815    *) dflt='n' ;;
5816    esac
5817    ;;
5818 esac
5819 cat <<EOM
5820
5821 You may also choose to try maximal 64-bitness.  It means using as much
5822 64-bitness as possible on the platform.  This in turn means even more
5823 binary incompatibilities.  On the other hand, your platform may not
5824 have any more 64-bitness available than what you already have chosen.
5825
5826 If this doesn't make any sense to you, just accept the default '$dflt'.
5827 (The default has been chosen based on your configuration.)
5828 EOM
5829 rp='Try to use maximal 64-bit support, if available?'
5830 . ./myread
5831 case "$ans" in
5832 [yY]*) val="$define" ;;
5833 *)     val="$undef"  ;;
5834 esac
5835 set use64bitall
5836 eval $setvar
5837 case "$use64bitall" in
5838 "$define")
5839         case "$use64bitint" in
5840         "$undef")
5841                 cat <<EOM
5842
5843 Since you have chosen a maximally 64-bit build, I'm also turning on
5844 the use of 64-bit integers.
5845 EOM
5846                 use64bitint="$define" ;;
5847         esac
5848         ;;
5849 esac
5850
5851 : Look for a hint-file generated 'call-back-unit'.  If the
5852 : user has specified that a 64-bit perl is to be built,
5853 : we may need to set or change some other defaults.
5854 if $test -f use64bitint.cbu; then
5855         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5856         . ./use64bitint.cbu
5857 fi
5858 case "$use64bitint" in
5859 "$define"|true|[yY]*)
5860         case "$longsize" in
5861         4) case "$archname64" in
5862            '') archname64=64int ;;
5863            esac
5864            ;;
5865         esac
5866         ;;
5867 esac
5868
5869 : Look for a hint-file generated 'call-back-unit'.  If the
5870 : user has specified that a maximally 64-bit perl is to be built,
5871 : we may need to set or change some other defaults.
5872 if $test -f use64bitall.cbu; then
5873         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5874         . ./use64bitall.cbu
5875 fi
5876 case "$use64bitall" in
5877 "$define"|true|[yY]*)
5878         case "$longsize" in
5879         4) case "$archname64" in
5880            ''|64int) archname64=64all ;;
5881            esac
5882            ;;
5883         esac
5884         ;;
5885 esac
5886
5887 case "$d_quad:$use64bitint" in
5888 $undef:$define)
5889         cat >&4 <<EOF
5890
5891 *** You have chosen to use 64-bit integers,
5892 *** but none can be found.
5893 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5894 *** Cannot continue, aborting.
5895
5896 EOF
5897         exit 1
5898         ;;
5899 esac
5900
5901 : check for length of double
5902 echo " "
5903 case "$doublesize" in
5904 '')
5905         echo "Checking to see how big your double precision numbers are..." >&4
5906         $cat >try.c <<EOCP
5907 #include <stdio.h>
5908 #$i_stdlib I_STDLIB
5909 #ifdef I_STDLIB
5910 #include <stdlib.h>
5911 #endif
5912 int main()
5913 {
5914     printf("%d\n", (int)sizeof(double));
5915     exit(0);
5916 }
5917 EOCP
5918         set try
5919         if eval $compile_ok; then
5920                 doublesize=`$run ./try`
5921                 echo "Your double is $doublesize bytes long."
5922         else
5923                 dflt='8'
5924                 echo "(I can't seem to compile the test program.  Guessing...)"
5925                 rp="What is the size of a double precision number (in bytes)?"
5926                 . ./myread
5927                 doublesize="$ans"
5928         fi
5929         ;;
5930 esac
5931 $rm_try
5932
5933 : check for long doubles
5934 echo " "
5935 echo "Checking to see if you have long double..." >&4
5936 echo 'int main() { long double x = 7.0; }' > try.c
5937 set try
5938 if eval $compile; then
5939         val="$define"
5940         echo "You have long double."
5941 else
5942         val="$undef"
5943         echo "You do not have long double."
5944 fi
5945 $rm_try
5946 set d_longdbl
5947 eval $setvar
5948
5949 : check for length of long double
5950 case "${d_longdbl}${longdblsize}" in
5951 $define)
5952         echo " "
5953         echo "Checking to see how big your long doubles are..." >&4
5954         $cat >try.c <<'EOCP'
5955 #include <stdio.h>
5956 int main()
5957 {
5958         printf("%d\n", sizeof(long double));
5959 }
5960 EOCP
5961         set try
5962         set try
5963         if eval $compile; then
5964                 longdblsize=`$run ./try`
5965                 echo "Your long doubles are $longdblsize bytes long."
5966         else
5967                 dflt='8'
5968                 echo " "
5969                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5970                 rp="What is the size of a long double (in bytes)?"
5971                 . ./myread
5972                 longdblsize="$ans"
5973         fi
5974         if $test "X$doublesize" = "X$longdblsize"; then
5975                 echo "That isn't any different from an ordinary double."
5976                 echo "I'll keep your setting anyway, but you may see some"
5977                 echo "harmless compilation warnings."
5978         fi
5979         ;;
5980 esac
5981 $rm_try
5982
5983 : determine the architecture name
5984 echo " "
5985 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5986         tarch=`arch`"-$osname"
5987 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5988         if uname -m > tmparch 2>&1 ; then
5989                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5990                         -e 's/$/'"-$osname/" tmparch`
5991         else
5992                 tarch="$osname"
5993         fi
5994         $rm -f tmparch
5995 else
5996         tarch="$osname"
5997 fi
5998 case "$myarchname" in
5999 ''|"$tarch") ;;
6000 *)
6001         echo "(Your architecture name used to be $myarchname.)"
6002         archname=''
6003         ;;
6004 esac
6005 case "$targetarch" in
6006 '') ;;
6007 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6008 esac
6009 myarchname="$tarch"
6010 case "$archname" in
6011 '') dflt="$tarch";;
6012 *) dflt="$archname";;
6013 esac
6014 rp='What is your architecture name'
6015 . ./myread
6016 archname="$ans"
6017 case "$usethreads" in
6018 $define)
6019         echo "Threads selected." >&4
6020         case "$archname" in
6021         *-thread*) echo "...and architecture name already has -thread." >&4
6022                 ;;
6023         *)      archname="$archname-thread"
6024                 echo "...setting architecture name to $archname." >&4
6025                 ;;
6026         esac
6027         ;;
6028 esac
6029 case "$usemultiplicity" in
6030 $define)
6031         echo "Multiplicity selected." >&4
6032         case "$archname" in
6033         *-multi*) echo "...and architecture name already has -multi." >&4
6034                 ;;
6035         *)      archname="$archname-multi"
6036                 echo "...setting architecture name to $archname." >&4
6037                 ;;
6038         esac
6039         ;;
6040 esac
6041 case "$use64bitint$use64bitall" in
6042 *"$define"*)
6043         case "$archname64" in
6044         '')
6045                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6046                 ;;
6047         *)
6048                 case "$use64bitint" in
6049                 "$define") echo "64 bit integers selected." >&4 ;;
6050                 esac
6051                 case "$use64bitall" in
6052                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6053                 esac
6054                 case "$archname" in
6055                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6056                         ;;
6057                 *)      archname="$archname-$archname64"
6058                         echo "...setting architecture name to $archname." >&4
6059                         ;;
6060                 esac
6061                 ;;
6062         esac
6063 esac
6064 case "$uselongdouble" in
6065 $define)
6066         echo "Long doubles selected." >&4
6067         case "$longdblsize" in
6068         $doublesize)
6069                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6070                 ;;
6071         *)
6072                 case "$archname" in
6073                 *-ld*) echo "...and architecture name already has -ld." >&4
6074                         ;;
6075                 *)      archname="$archname-ld"
6076                         echo "...setting architecture name to $archname." >&4
6077                         ;;
6078                 esac
6079                 ;;
6080         esac
6081         ;;
6082 esac
6083 if $test -f archname.cbu; then
6084         echo "Your platform has some specific hints for architecture name, using them..."
6085         . ./archname.cbu
6086 fi
6087
6088 : set the prefixit variable, to compute a suitable default value
6089 prefixit='case "$3" in
6090 ""|none)
6091         case "$oldprefix" in
6092         "") eval "$1=\"\$$2\"";;
6093         *)
6094                 case "$3" in
6095                 "") eval "$1=";;
6096                 none)
6097                         eval "tp=\"\$$2\"";
6098                         case "$tp" in
6099                         ""|" ") eval "$1=\"\$$2\"";;
6100                         *) eval "$1=";;
6101                         esac;;
6102                 esac;;
6103         esac;;
6104 *)
6105         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6106         case "$tp" in
6107         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6108         /*-$oldprefix/*|\~*-$oldprefix/*)
6109                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6110         *) eval "$1=\"\$$2\"";;
6111         esac;;
6112 esac'
6113
6114 : determine installation style
6115 : For now, try to deduce it from prefix unless it is already set.
6116 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6117 case "$installstyle" in
6118 '')     case "$prefix" in
6119                 *perl*) dflt='lib';;
6120                 *) dflt='lib/perl5' ;;
6121         esac
6122         ;;
6123 *)      dflt="$installstyle" ;;
6124 esac
6125 : Probably not worth prompting for this since we prompt for all
6126 : the directories individually, and the prompt would be too long and
6127 : confusing anyway.
6128 installstyle=$dflt
6129
6130 : determine where public executables go
6131 echo " "
6132 set dflt bin bin
6133 eval $prefixit
6134 fn=d~
6135 rp='Pathname where the public executables will reside?'
6136 . ./getfile
6137 if $test "X$ansexp" != "X$binexp"; then
6138         installbin=''
6139 fi
6140 prefixvar=bin
6141 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6142 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6143 :     this via initialinstalllocation
6144 . ./setprefixvar
6145
6146 case "$userelocatableinc" in
6147 $define|true|[yY]*)     dflt='y' ;;
6148 *)                      dflt='n' ;;
6149 esac
6150 cat <<EOM
6151
6152 Would you like to build Perl so that the installation is relocatable, so that
6153 library paths in @INC are determined relative to the path of the perl binary?
6154 This is not advised for system Perl installs, or if you need to run setid
6155 scripts or scripts under taint mode.
6156
6157 If this doesn't make any sense to you, just accept the default '$dflt'.
6158 EOM
6159 rp='Use relocatable @INC?'
6160 . ./myread
6161 case "$ans" in
6162 y|Y)    val="$define" ;;
6163 *)      val="$undef"  ;;
6164 esac
6165 set userelocatableinc
6166 eval $setvar
6167
6168 initialinstalllocation="$binexp"
6169 : Default prefix is now "up one level from where the binaries are"
6170 case "$userelocatableinc" in
6171 $define|true|[yY]*)
6172     bin=".../"
6173     binexp=".../"
6174     prefix=".../.."
6175     prefixexp=".../.."
6176     installprefixexp=".../.."
6177     ;;
6178 esac
6179
6180 : determine where private library files go
6181 : Usual default is /usr/local/lib/perl5/$version.
6182 : Also allow things like /opt/perl/lib/$version, since
6183 : /opt/perl/lib/perl5... would be redundant.
6184 : The default "style" setting is made in installstyle.U
6185 case "$installstyle" in
6186 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6187 *)       set dflt privlib lib/$version ;;
6188 esac
6189 eval $prefixit
6190 $cat <<EOM
6191
6192 There are some auxiliary files for $package that need to be put into a
6193 private library directory that is accessible by everyone.
6194
6195 EOM
6196 fn=$binexp
6197 fn=d~+
6198 rp='Pathname where the private library files will reside?'
6199 . ./getfile
6200 prefixvar=privlib
6201 . ./setprefixvar
6202
6203 : set the prefixup variable, to restore leading tilda escape
6204 prefixup='case "$prefixexp" in
6205 "$prefix") ;;
6206 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6207 esac'
6208
6209 : determine where public architecture dependent libraries go
6210 set archlib archlib
6211 eval $prefixit
6212 : privlib default is /usr/local/lib/$package/$version
6213 : archlib default is /usr/local/lib/$package/$version/$archname
6214 : privlib may have an optional trailing /share.
6215 tdflt=`echo $privlib | $sed 's,/share$,,'`
6216 tdflt=$tdflt/$archname
6217 case "$archlib" in
6218 '')     dflt=$tdflt
6219         ;;
6220 *)      dflt="$archlib"
6221     ;;
6222 esac
6223 $cat <<EOM
6224
6225 $spackage contains architecture-dependent library files.  If you are
6226 sharing libraries in a heterogeneous environment, you might store
6227 these files in a separate location.  Otherwise, you can just include
6228 them with the rest of the public library files.
6229
6230 EOM
6231 fn=$binexp
6232 fn=d+~
6233 rp='Where do you want to put the public architecture-dependent libraries?'
6234 . ./getfile
6235 prefixvar=archlib
6236 . ./setprefixvar
6237 if $test X"$archlib" = X"$privlib"; then
6238         d_archlib="$undef"
6239 else
6240         d_archlib="$define"
6241 fi
6242
6243 : see if setuid scripts can be secure
6244 $cat <<EOM
6245
6246 Some kernels have a bug that prevents setuid #! scripts from being
6247 secure.  Some sites have disabled setuid #! scripts because of this.
6248
6249 First let's decide if your kernel supports secure setuid #! scripts.
6250 (If setuid #! scripts would be secure but have been disabled anyway,
6251 don't say that they are secure if asked.)
6252
6253 EOM
6254
6255 val="$undef"
6256 if $test -d /dev/fd; then
6257         echo "#!$ls" >reflect
6258         chmod +x,u+s reflect
6259         ./reflect >flect 2>&1
6260         if $contains "/dev/fd" flect >/dev/null; then
6261                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6262                 val="$define"
6263         else
6264                 $cat <<EOM
6265 If you are not sure if they are secure, I can check but I'll need a
6266 username and password different from the one you are using right now.
6267 If you don't have such a username or don't want me to test, simply
6268 enter 'none'.
6269
6270 EOM
6271                 rp='Other username to test security of setuid scripts with?'
6272                 dflt='none'
6273                 . ./myread
6274                 case "$ans" in
6275                 n|none)
6276                         case "$d_suidsafe" in
6277                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6278                                 dflt=n;;
6279                         "$undef")
6280                                 echo "Well, the $hint value is *not* secure." >&4
6281                                 dflt=n;;
6282                         *)      echo "Well, the $hint value *is* secure." >&4
6283                                 dflt=y;;
6284                         esac
6285                         ;;
6286                 *)
6287                         $rm -f reflect flect
6288                         echo "#!$ls" >reflect
6289                         chmod +x,u+s reflect
6290                         echo >flect
6291                         chmod a+w flect
6292                         echo '"su" will (probably) prompt you for '"$ans's password."
6293                         su $ans -c './reflect >flect'
6294                         if $contains "/dev/fd" flect >/dev/null; then
6295                                 echo "Okay, it looks like setuid scripts are secure." >&4
6296                                 dflt=y
6297                         else
6298                                 echo "I don't think setuid scripts are secure." >&4
6299                                 dflt=n
6300                         fi
6301                         ;;
6302                 esac
6303                 rp='Does your kernel have *secure* setuid scripts?'
6304                 . ./myread
6305                 case "$ans" in
6306                 [yY]*)  val="$define";;
6307                 *)      val="$undef";;
6308                 esac
6309         fi
6310 else
6311         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6312         echo "(That's for file descriptors, not floppy disks.)"
6313         val="$undef"
6314 fi
6315 set d_suidsafe
6316 eval $setvar
6317
6318 $rm -f reflect flect
6319
6320 : now see if they want to do setuid emulation
6321 if $test $patchlevel -lt 11; then
6322 echo " "
6323 val="$undef"
6324 case "$d_suidsafe" in
6325 "$define")
6326         val="$undef"
6327         echo "No need to emulate SUID scripts since they are secure here." >&4
6328         ;;
6329 *)
6330         $cat <<EOM
6331 Some systems have disabled setuid scripts, especially systems where
6332 setuid scripts cannot be secure.  On systems where setuid scripts have
6333 been disabled, the setuid/setgid bits on scripts are currently
6334 useless.  It is possible for $package to detect those bits and emulate
6335 setuid/setgid in a secure fashion.  This emulation will only work if
6336 setuid scripts have been disabled in your kernel.
6337
6338 EOM
6339         case "$d_dosuid" in
6340         "$define") dflt=y ;;
6341         *) dflt=n ;;
6342         esac
6343         rp="Do you want to do setuid/setgid emulation?"
6344         . ./myread
6345         case "$ans" in
6346         [yY]*)  val="$define";;
6347         *)      val="$undef";;
6348         esac
6349         ;;
6350 esac
6351 set d_dosuid
6352 eval $setvar
6353 else
6354     case "$d_dosuid" in
6355         "$define")
6356         cat >&4 <<EOH
6357
6358 SUID emulation has been removed for 5.12
6359 Please re-run Configure without -Dd_dosuid
6360
6361 EOH
6362         exit 1;
6363         ;;
6364     esac
6365     d_dosuid=undef
6366 fi
6367
6368 : Find perl5.005 or later.
6369 echo "Looking for a previously installed perl5.005 or later... "
6370 case "$perl5" in
6371 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6372                 : Check if this perl is recent and can load a simple module
6373                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6374                         perl5=$tdir/perl
6375                         break;
6376                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6377                         perl5=$tdir/perl5
6378                         break;
6379                 fi
6380         done
6381         ;;
6382 *)      perl5="$perl5"
6383         ;;
6384 esac
6385 case "$perl5" in
6386 '')     echo "None found.  That's ok.";;
6387 *)      echo "Using $perl5." ;;
6388 esac
6389
6390 : Set the siteprefix variables
6391 $cat <<EOM
6392
6393 After $package is installed, you may wish to install various
6394 add-on modules and utilities.  Typically, these add-ons will
6395 be installed under $prefix with the rest
6396 of this package.  However, you may wish to install such add-ons
6397 elsewhere under a different prefix.
6398
6399 If you do not wish to put everything under a single prefix, that's
6400 ok.  You will be prompted for the individual locations; this siteprefix
6401 is only used to suggest the defaults.
6402
6403 The default should be fine for most people.
6404
6405 EOM
6406 fn=d~+
6407 rp='Installation prefix to use for add-on modules and utilities?'
6408 : XXX Here might be another good place for an installstyle setting.
6409 case "$siteprefix" in
6410 '') dflt=$prefix ;;
6411 *)  dflt=$siteprefix ;;
6412 esac
6413 . ./getfile
6414 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6415 oldsiteprefix=''
6416 case "$siteprefix" in
6417 '') ;;
6418 *)      case "$ans" in
6419         "$prefix") ;;
6420         *) oldsiteprefix="$prefix";;
6421         esac
6422         ;;
6423 esac
6424 siteprefix="$ans"
6425 siteprefixexp="$ansexp"
6426
6427 : determine where site specific libraries go.
6428 : Usual default is /usr/local/lib/perl5/site_perl/$version
6429 : The default "style" setting is made in installstyle.U
6430 : XXX No longer works with Prefixit stuff.
6431 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6432 case "$sitelib" in
6433 '') case "$installstyle" in
6434         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6435         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6436         esac
6437         ;;
6438 *)      dflt="$sitelib"
6439         ;;
6440 esac
6441 $cat <<EOM
6442
6443 The installation process will create a directory for
6444 site-specific extensions and modules.  Most users find it convenient
6445 to place all site-specific files in this directory rather than in the
6446 main distribution directory.
6447
6448 EOM
6449 fn=d~+
6450 rp='Pathname for the site-specific library files?'
6451 . ./getfile
6452 prefixvar=sitelib
6453 . ./setprefixvar
6454 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6455
6456 : Determine list of previous versions to include in @INC
6457 $cat > getverlist <<EOPL
6458 #!$perl5 -w
6459 use File::Basename;
6460 \$api_versionstring = "$api_versionstring";
6461 \$version = "$version";
6462 \$stem = "$sitelib_stem";
6463 \$archname = "$archname";
6464 EOPL
6465         $cat >> getverlist <<'EOPL'
6466 # The list found is store twice for each entry: the original name, and
6467 # the binary broken down version as pack "sss", so sorting is easy and
6468 # unambiguous. This will work for all versions that have a maximum of
6469 # three digit groups, separate by '.'s or '_'s. Names are extended with
6470 # ".0.0" to ensure at least three elements for the pack.
6471 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6472
6473 # Can't have leading @ because metaconfig interprets it as a command!
6474 ;@inc_version_list=();
6475 # XXX Redo to do opendir/readdir?
6476 if (-d $stem) {
6477     chdir($stem);
6478     ;@candidates = map {
6479         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6480     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6481 }
6482 else {
6483     ;@candidates = ();
6484 }
6485
6486 ($pversion, $aversion, $vsn5005) = map {
6487     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6488 foreach $d (@candidates) {
6489     if ($d->[1] lt $pversion) {
6490         if ($d->[1] ge $aversion) {
6491             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6492         }
6493         elsif ($d->[1] ge $vsn5005) {
6494             unshift(@inc_version_list, grep { -d } $d->[0]);
6495         }
6496     }
6497     else {
6498         # Skip newer version.  I.e. don't look in
6499         # 5.7.0 if we're installing 5.6.1.
6500     }
6501 }
6502
6503 if (@inc_version_list) {
6504     print join(' ', @inc_version_list);
6505 }
6506 else {
6507     # Blank space to preserve value for next Configure run.
6508     print " ";
6509 }
6510 EOPL
6511 chmod +x getverlist
6512 case "$inc_version_list" in
6513 '')     if test -x "$perl5$exe_ext"; then
6514                 dflt=`$perl5 getverlist`
6515         else
6516                 dflt='none'
6517         fi
6518         ;;
6519 $undef) dflt='none' ;;
6520 *)  eval dflt=\"$inc_version_list\" ;;
6521 esac
6522 case "$dflt" in
6523 ''|' ') dflt=none ;;
6524 esac
6525 case "$dflt" in
6526 5.005) dflt=none ;;
6527 esac
6528 $cat <<EOM
6529
6530 In order to ease the process of upgrading, this version of perl
6531 can be configured to use modules built and installed with earlier
6532 versions of perl that were installed under $prefix.  Specify here
6533 the list of earlier versions that this version of perl should check.
6534 If Configure detected no earlier versions of perl installed under
6535 $prefix, then the list will be empty.  Answer 'none' to tell perl
6536 to not search earlier versions.
6537
6538 The default should almost always be sensible, so if you're not sure,
6539 just accept the default.
6540 EOM
6541
6542 rp='List of earlier versions to include in @INC?'
6543 . ./myread
6544 case "$ans" in
6545 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6546 *) inc_version_list="$ans" ;;
6547 esac
6548 case "$inc_version_list" in
6549 ''|' ')
6550         inc_version_list_init='0'
6551         d_inc_version_list="$undef"
6552         ;;
6553 *)      inc_version_list_init=`echo $inc_version_list |
6554                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6555         d_inc_version_list="$define"
6556         ;;
6557 esac
6558 $rm -f getverlist
6559
6560 : see if malloc/malloc.h has to be included
6561 set malloc/malloc.h i_mallocmalloc
6562 eval $inhdr
6563
6564 : see if this is a malloc.h system
6565 : we want a real compile instead of Inhdr because some systems have a
6566 : malloc.h that just gives a compile error saying to use stdlib.h instead
6567 echo " "
6568 $cat >try.c <<EOCP
6569 #include <stdlib.h>
6570 #include <malloc.h>
6571 #$i_mallocmalloc I_MALLOCMALLOC
6572 #ifdef I_MALLOCMALLOC
6573 # include <malloc/malloc.h>
6574 #endif
6575
6576 int main () { return 0; }
6577 EOCP
6578 set try
6579 if eval $compile; then
6580     echo "<malloc.h> found." >&4
6581     val="$define"
6582 else
6583     echo "<malloc.h> NOT found." >&4
6584     val="$undef"
6585 fi
6586 $rm_try
6587 set i_malloc
6588 eval $setvar
6589
6590 : check for void type
6591 echo " "
6592 echo "Checking to see how well your C compiler groks the void type..." >&4
6593 case "$voidflags" in
6594 '')
6595         $cat >try.c <<EOCP
6596 #$i_stdlib I_STDLIB
6597 #ifdef I_STDLIB
6598 #include <stdlib.h>
6599 #endif
6600 #if TRY & 1
6601 void sub() {
6602 #else
6603 sub() {
6604 #endif
6605         extern void moo();      /* function returning void */
6606         void (*goo)();          /* ptr to func returning void */
6607 #if TRY & 8
6608         void *hue;              /* generic ptr */
6609 #endif
6610 #if TRY & 2
6611         void (*foo[10])();
6612 #endif
6613
6614 #if TRY & 4
6615         if(goo == moo) {
6616                 exit(0);
6617         }
6618 #endif
6619         exit(0);
6620 }
6621 int main() { sub(); }
6622 EOCP
6623         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6624                 voidflags=$defvoidused
6625         echo "Good.  It appears to support void to the level $package wants.">&4
6626                 if $contains warning .out >/dev/null 2>&1; then
6627                         echo "However, you might get some warnings that look like this:"
6628                         $cat .out
6629                 fi
6630         else
6631 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6632                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6633                         echo "It supports 1..."
6634                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6635                                 echo "It also supports 2..."
6636                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6637                                         voidflags=7
6638                                         echo "And it supports 4 but not 8 definitely."
6639                                 else
6640                                         echo "It doesn't support 4..."
6641                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6642                                                 voidflags=11
6643                                                 echo "But it supports 8."
6644                                         else
6645                                                 voidflags=3
6646                                                 echo "Neither does it support 8."
6647                                         fi
6648                                 fi
6649                         else
6650                                 echo "It does not support 2..."
6651                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6652                                         voidflags=13
6653                                         echo "But it supports 4 and 8."
6654                                 else
6655                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6656                                                 voidflags=5
6657                                                 echo "And it supports 4 but has not heard about 8."
6658                                         else
6659                                                 echo "However it supports 8 but not 4."
6660                                         fi
6661                                 fi
6662                         fi
6663                 else
6664                         echo "There is no support at all for void."
6665                         voidflags=0
6666                 fi
6667         fi
6668 esac
6669 case "$voidflags" in
6670 "$defvoidused") ;;
6671 *)      $cat >&4 <<'EOM'
6672   Support flag bits are:
6673     1: basic void declarations.
6674     2: arrays of pointers to functions returning void.
6675     4: operations between pointers to and addresses of void functions.
6676     8: generic void pointers.
6677 EOM
6678         dflt="$voidflags";
6679         rp="Your void support flags add up to what?"
6680         . ./myread
6681         voidflags="$ans"
6682         ;;
6683 esac
6684 $rm_try
6685
6686 : check for length of pointer
6687 echo " "
6688 case "$ptrsize" in
6689 '')
6690         echo "Checking to see how big your pointers are..." >&4
6691         if test "$voidflags" -gt 7; then
6692                 echo '#define VOID_PTR char *' > try.c
6693         else
6694                 echo '#define VOID_PTR void *' > try.c
6695         fi
6696         $cat >>try.c <<EOCP
6697 #include <stdio.h>
6698 #$i_stdlib I_STDLIB
6699 #ifdef I_STDLIB
6700 #include <stdlib.h>
6701 #endif
6702 int main()
6703 {
6704     printf("%d\n", (int)sizeof(VOID_PTR));
6705     exit(0);
6706 }
6707 EOCP
6708         set try
6709         if eval $compile_ok; then
6710                 ptrsize=`$run ./try`
6711                 echo "Your pointers are $ptrsize bytes long."
6712         else
6713                 dflt='4'
6714                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6715                 rp="What is the size of a pointer (in bytes)?"
6716                 . ./myread
6717                 ptrsize="$ans"
6718         fi
6719         ;;
6720 esac
6721 $rm_try
6722 case "$use64bitall" in
6723 "$define"|true|[yY]*)
6724         case "$ptrsize" in
6725         4)      cat <<EOM >&4
6726
6727 *** You have chosen a maximally 64-bit build,
6728 *** but your pointers are only 4 bytes wide.
6729 *** Please rerun Configure without -Duse64bitall.
6730 EOM
6731                 case "$d_quad" in
6732                 define)
6733                         cat <<EOM >&4
6734 *** Since you have quads, you could possibly try with -Duse64bitint.
6735 EOM
6736                         ;;
6737                 esac
6738                 cat <<EOM >&4
6739 *** Cannot continue, aborting.
6740
6741 EOM
6742
6743                 exit 1
6744                 ;;
6745         esac
6746         ;;
6747 esac
6748
6749
6750 : determine whether to use malloc wrapping
6751 echo " "
6752 case "$usemallocwrap" in
6753 [yY]*|true|$define)     dflt='y' ;;
6754 [nN]*|false|$undef)     dflt='n' ;;
6755 *)      case "$usedevel" in
6756         [yY]*|true|$define)     dflt='y' ;;
6757         *) dflt='n' ;;
6758         esac
6759         ;;
6760 esac
6761 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6762 . ./myread
6763 usemallocwrap="$ans"
6764 case "$ans" in
6765 y*|true)
6766         usemallocwrap="$define" ;;
6767 *)
6768         usemallocwrap="$undef" ;;
6769 esac
6770
6771 : determine which malloc to compile in
6772 echo " "
6773 case "$usemymalloc" in
6774 [yY]*|true|$define)     dflt='y' ;;
6775 [nN]*|false|$undef)     dflt='n' ;;
6776 *)      case "$ptrsize" in
6777         4) dflt='y' ;;
6778         *) dflt='n' ;;
6779         esac
6780         if test "$useithreads" = "$define"; then dflt='n'; fi
6781         ;;
6782 esac
6783 rp="Do you wish to attempt to use the malloc that comes with $package?"
6784 . ./myread
6785 usemymalloc="$ans"
6786 case "$ans" in
6787 y*|true)
6788         usemymalloc='y'
6789         mallocsrc='malloc.c'
6790         mallocobj="malloc$_o"
6791         d_mymalloc="$define"
6792         case "$libs" in
6793         *-lmalloc*)
6794                 : Remove malloc from list of libraries to use
6795                 echo "Removing unneeded -lmalloc from library list" >&4
6796                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6797                 shift
6798                 libs="$*"
6799                 echo "libs = $libs" >&4
6800                 ;;
6801         esac
6802         ;;
6803 *)
6804         usemymalloc='n'
6805         mallocsrc=''
6806         mallocobj=''
6807         d_mymalloc="$undef"
6808         ;;
6809 esac
6810
6811 : compute the return types of malloc and free
6812 echo " "
6813 $cat >malloc.c <<END
6814 #$i_malloc I_MALLOC
6815 #$i_stdlib I_STDLIB
6816 #include <stdio.h>
6817 #include <sys/types.h>
6818 #ifdef I_MALLOC
6819 #include <malloc.h>
6820 #endif
6821 #ifdef I_STDLIB
6822 #include <stdlib.h>
6823 #endif
6824 #ifdef TRY_MALLOC
6825 void *malloc();
6826 #endif
6827 #ifdef TRY_FREE
6828 void free();
6829 #endif
6830 END
6831 case "$malloctype" in
6832 '')
6833         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6834                 malloctype='void *'
6835         else
6836                 malloctype='char *'
6837         fi
6838         ;;
6839 esac
6840 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6841
6842 case "$freetype" in
6843 '')
6844         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6845                 freetype='void'
6846         else
6847                 freetype='int'
6848         fi
6849         ;;
6850 esac
6851 echo "Your system uses $freetype free(), it would seem." >&4
6852 $rm -f malloc.[co]
6853 : determine where site specific architecture-dependent libraries go.
6854 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6855 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6856 : sitelib may have an optional trailing /share.
6857 case "$sitearch" in
6858 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6859         dflt="$dflt/$archname"
6860         ;;
6861 *)      dflt="$sitearch"
6862         ;;
6863 esac
6864 set sitearch sitearch none
6865 eval $prefixit
6866 $cat <<EOM
6867
6868 The installation process will also create a directory for
6869 architecture-dependent site-specific extensions and modules.
6870
6871 EOM
6872 fn=d~+
6873 rp='Pathname for the site-specific architecture-dependent library files?'
6874 . ./getfile
6875 prefixvar=sitearch
6876 . ./setprefixvar
6877 if $test X"$sitearch" = X"$sitelib"; then
6878         d_sitearch="$undef"
6879 else
6880         d_sitearch="$define"
6881 fi
6882
6883 : Set the vendorprefix variables
6884 $cat <<EOM
6885
6886 The installation process will also create a directory for
6887 vendor-supplied add-ons.  Vendors who supply perl with their system
6888 may find it convenient to place all vendor-supplied files in this
6889 directory rather than in the main distribution directory.  This will
6890 ease upgrades between binary-compatible maintenance versions of perl.
6891
6892 Of course you may also use these directories in whatever way you see
6893 fit.  For example, you might use them to access modules shared over a
6894 company-wide network.
6895
6896 The default answer should be fine for most people.
6897 This causes further questions about vendor add-ons to be skipped
6898 and no vendor-specific directories will be configured for perl.
6899
6900 EOM
6901 rp='Do you want to configure vendor-specific add-on directories?'
6902 case "$usevendorprefix" in
6903 define|true|[yY]*) dflt=y ;;
6904 *)      : User may have set vendorprefix directly on Configure command line.
6905         case "$vendorprefix" in
6906         ''|' ') dflt=n ;;
6907         *)      dflt=y ;;
6908         esac
6909         ;;
6910 esac
6911 . ./myread
6912 case "$ans" in
6913 [yY]*)  fn=d~+
6914         rp='Installation prefix to use for vendor-supplied add-ons?'
6915         case "$vendorprefix" in
6916         '') dflt='' ;;
6917         *)  dflt=$vendorprefix ;;
6918         esac
6919         . ./getfile
6920         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6921         oldvendorprefix=''
6922         case "$vendorprefix" in
6923         '') ;;
6924         *)      case "$ans" in
6925                 "$prefix") ;;
6926                 *) oldvendorprefix="$prefix";;
6927                 esac
6928                 ;;
6929         esac
6930         usevendorprefix="$define"
6931         vendorprefix="$ans"
6932         vendorprefixexp="$ansexp"
6933         ;;
6934 *)      usevendorprefix="$undef"
6935         vendorprefix=''
6936         vendorprefixexp=''
6937         ;;
6938 esac
6939
6940 : Set the vendorlib variables
6941 case "$vendorprefix" in
6942 '')     d_vendorlib="$undef"
6943         vendorlib=''
6944         vendorlibexp=''
6945         ;;
6946 *)      d_vendorlib="$define"
6947         : determine where vendor-supplied modules go.
6948         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6949         case "$vendorlib" in
6950         '')
6951                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6952                 case "$installstyle" in
6953                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6954                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6955                 esac
6956                 ;;
6957         *)      dflt="$vendorlib"
6958                 ;;
6959         esac
6960         fn=d~+
6961         rp='Pathname for the vendor-supplied library files?'
6962         . ./getfile
6963         vendorlib="$ans"
6964         vendorlibexp="$ansexp"
6965         ;;
6966 esac
6967 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6968 prefixvar=vendorlib
6969 . ./installprefix
6970
6971 : Set the vendorarch variables
6972 case "$vendorprefix" in
6973 '')     d_vendorarch="$undef"
6974         vendorarch=''
6975         vendorarchexp=''
6976         ;;
6977 *)      d_vendorarch="$define"
6978         : determine where vendor-supplied architecture-dependent libraries go.
6979         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6980         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6981         : vendorlib may have an optional trailing /share.
6982         case "$vendorarch" in
6983         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6984                 dflt="$dflt/$archname"
6985                 ;;
6986         *)      dflt="$vendorarch" ;;
6987         esac
6988         fn=d~+
6989         rp='Pathname for vendor-supplied architecture-dependent files?'
6990         . ./getfile
6991         vendorarch="$ans"
6992         vendorarchexp="$ansexp"
6993         ;;
6994 esac
6995 prefixvar=vendorarch
6996 . ./installprefix
6997 if $test X"$vendorarch" = X"$vendorlib"; then
6998         d_vendorarch="$undef"
6999 else
7000         d_vendorarch="$define"
7001 fi
7002
7003 : Final catch-all directories to search
7004 $cat <<EOM
7005
7006 Lastly, you can have perl look in other directories for extensions and
7007 modules in addition to those already specified.
7008 These directories will be searched after 
7009         $sitearch 
7010         $sitelib 
7011 EOM
7012 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7013 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7014 echo ' '
7015 case "$otherlibdirs" in
7016 ''|' ') dflt='none' ;;
7017 *)      dflt="$otherlibdirs" ;;
7018 esac
7019 $cat <<EOM
7020 Enter a colon-separated set of extra paths to include in perl's @INC
7021 search path, or enter 'none' for no extra paths.
7022
7023 EOM
7024
7025 rp='Colon-separated list of additional directories for perl to search?'
7026 . ./myread
7027 case "$ans" in
7028 ' '|''|none)    otherlibdirs=' ' ;;     
7029 *)      otherlibdirs="$ans" ;;
7030 esac
7031 case "$otherlibdirs" in
7032 ' ') val=$undef ;;
7033 *)      val=$define ;;
7034 esac
7035 set d_perl_otherlibdirs
7036 eval $setvar
7037
7038 : Cruising for prototypes
7039 echo " "
7040 echo "Checking out function prototypes..." >&4
7041 $cat >prototype.c <<EOCP
7042 #$i_stdlib I_STDLIB
7043 #ifdef I_STDLIB
7044 #include <stdlib.h>
7045 #endif
7046 int main(int argc, char *argv[]) {
7047         exit(0);}
7048 EOCP
7049 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7050         echo "Your C compiler appears to support function prototypes."
7051         val="$define"
7052 else
7053         echo "Your C compiler doesn't seem to understand function prototypes."
7054         val="$undef"
7055 fi
7056 set prototype
7057 eval $setvar
7058 $rm -f prototype*
7059
7060 : Check if ansi2knr is required
7061 case "$prototype" in
7062 "$define") ;;
7063 *)      ansi2knr='ansi2knr'
7064         echo " "
7065         cat <<EOM >&4
7066
7067 $me:  FATAL ERROR:
7068 This version of $package can only be compiled by a compiler that 
7069 understands function prototypes.  Unfortunately, your C compiler 
7070         $cc $ccflags
7071 doesn't seem to understand them.  Sorry about that.
7072
7073 If GNU cc is available for your system, perhaps you could try that instead.  
7074
7075 Eventually, we hope to support building Perl with pre-ANSI compilers.
7076 If you would like to help in that effort, please contact <perlbug@perl.org>.
7077
7078 Aborting Configure now.
7079 EOM
7080         exit 2
7081         ;;
7082 esac
7083
7084 : DTrace support
7085 dflt_dtrace='/usr/sbin/dtrace'
7086 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7087
7088 cat <<EOM
7089
7090 Perl can be built to support DTrace on platforms that support it.
7091 DTrace is a diagnosis and performance analysis tool from Sun.
7092
7093 If this doesn't make any sense to you, just accept the default '$dflt'.
7094 EOM
7095
7096 while $test 1 ; do
7097         case "$usedtrace" in
7098         $define|true|[yY]*)
7099                 dflt='y'
7100                 ;;
7101         ?*)
7102                 dflt='y'
7103                 dflt_dtrace=$usedtrace
7104                 ;;
7105         *)
7106                 dflt='n'
7107                 ;;
7108         esac
7109
7110         rp='Support DTrace if available?'
7111         . ./myread
7112         case "$ans" in
7113         y|Y)    val="$define" ;;
7114         *)      val="$undef" ;;
7115         esac
7116         set usedtrace
7117         eval $setvar
7118
7119         test "X$usedtrace" != "X$define" && break
7120
7121         echo " "
7122         rp='Where is the dtrace executable?'
7123         dflt=$dflt_dtrace
7124         . ./getfile
7125         val="$ans"
7126         set dtrace
7127         eval $setvar
7128
7129         if $test -f $dtrace
7130         then
7131                 if $dtrace -h -s ../perldtrace.d \
7132                         -o perldtrace.tmp >/dev/null 2>&1 \
7133                         && rm -f perldtrace.tmp
7134                 then
7135                         echo " "
7136                         echo "Good: your $dtrace knows about the -h flag."
7137                 else
7138                         cat >&2 <<EOM
7139
7140 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7141 ***
7142 *** Your installed dtrace doesn't support the -h switch to compile a D
7143 *** program into a C header. Can't continue.
7144
7145 EOM
7146                         exit 1
7147                 fi
7148                 break;
7149         fi
7150
7151         case "$fastread" in
7152         yes)
7153                 cat >&2 <<EOM
7154
7155 *** $me:  Fatal Error:  $dtrace not found.
7156 *** Can't continue.
7157
7158 EOM
7159                 exit 1
7160                 ;;
7161         *)
7162                 echo "*** $dtrace was not found."
7163                 echo " "
7164                 ;;
7165         esac
7166 done
7167
7168 : See if we want extra modules installed
7169 echo " "
7170 case "$extras" in
7171 '') dflt='n';;
7172 *) dflt='y';;
7173 esac
7174 cat <<EOM
7175 Perl can be built with extra modules or bundles of modules which
7176 will be fetched from the CPAN and installed alongside Perl.
7177
7178 Notice that you will need access to the CPAN; either via the Internet,
7179 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7180 be asked later to configure the CPAN.pm module which will in turn do
7181 the installation of the rest of the extra modules or bundles.)
7182
7183 Notice also that if the modules require any external software such as
7184 libraries and headers (the libz library and the zlib.h header for the
7185 Compress::Zlib module, for example) you MUST have any such software
7186 already installed, this configuration process will NOT install such
7187 things for you.
7188
7189 If this doesn't make any sense to you, just accept the default '$dflt'.
7190 EOM
7191 rp='Install any extra modules (y or n)?'
7192 . ./myread
7193 case "$ans" in
7194 y|Y)
7195         cat <<EOM
7196
7197 Please list any extra modules or bundles to be installed from CPAN,
7198 with spaces between the names.  The names can be in any format the
7199 'install' command of CPAN.pm will understand.  (Answer 'none',
7200 without the quotes, to install no extra modules or bundles.)
7201 EOM
7202         rp='Extras?'
7203         dflt="$extras"
7204         . ./myread
7205         extras="$ans"
7206 esac
7207 case "$extras" in
7208 ''|'none')
7209         val=''
7210         $rm -f ../extras.lst
7211         ;;
7212 *)      echo "(Saving the list of extras for later...)"
7213         echo "$extras" > ../extras.lst
7214         val="'$extras'"
7215         ;;
7216 esac
7217 set extras
7218 eval $setvar
7219 echo " "
7220
7221 : determine where html pages for programs go
7222 set html1dir html1dir none
7223 eval $prefixit
7224 $cat <<EOM
7225
7226 If you wish to install html files for programs in $spackage, indicate
7227 the appropriate directory here.  To skip installing html files,
7228 answer "none".
7229 EOM
7230 case "$html1dir" in
7231 ''|none|$undef|' ') dflt=none ;;
7232 *) dflt=$html1dir ;;
7233 esac
7234 fn=dn+~
7235 rp="Directory for the main $spackage html pages?"
7236 . ./getfile
7237 prefixvar=html1dir
7238 . ./setprefixvar
7239 : Use ' ' for none so value is preserved next time through Configure
7240 $test X"$html1dir" = "X" && html1dir=' '
7241
7242 : determine where html pages for libraries and modules go
7243 set html3dir html3dir none
7244 eval $prefixit
7245 $cat <<EOM
7246
7247 If you wish to install html files for modules associated with $spackage,
7248 indicate the appropriate directory here.  To skip installing html files,
7249 answer "none".
7250 EOM
7251 : There is no obvious default.  If they have specified html1dir, then
7252 : try to key off that, possibly changing .../html1 into .../html3.
7253 case "$html3dir" in
7254 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7255 *) dflt=$html3dir ;;
7256 esac
7257 fn=dn+~
7258 rp="Directory for the $spackage module html pages?"
7259 . ./getfile
7260 prefixvar=html3dir
7261 . ./setprefixvar
7262 : Use ' ' for none so value is preserved next time through Configure
7263 $test X"$html3dir" = "X" && html3dir=' '
7264
7265 : determine whether to install perl also as /usr/bin/perl
7266
7267 echo " "
7268 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7269         $cat <<EOM
7270 Many scripts expect perl to be installed as /usr/bin/perl.
7271
7272 If you want to, I can install the perl you are about to compile
7273 as /usr/bin/perl (in addition to $bin/perl).
7274 EOM
7275         if test -f /usr/bin/perl; then
7276             $cat <<EOM
7277
7278 However, please note that because you already have a /usr/bin/perl,
7279 overwriting that with a new Perl would very probably cause problems.
7280 Therefore I'm assuming you don't want to do that (unless you insist).
7281
7282 EOM
7283             case "$installusrbinperl" in
7284             "$define"|[yY]*)    dflt='y';;
7285             *)                  dflt='n';;
7286             esac
7287         else
7288             $cat <<EOM
7289
7290 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7291
7292 EOM
7293             case "$installusrbinperl" in
7294             "$undef"|[nN]*)     dflt='n';;
7295             *)                  dflt='y';;
7296             esac
7297         fi
7298         rp="Do you want to install perl as /usr/bin/perl?"
7299         . ./myread
7300         case "$ans" in
7301         [yY]*)  val="$define";;
7302         *)      val="$undef" ;;
7303         esac
7304 else
7305         val="$undef"
7306 fi
7307 set installusrbinperl
7308 eval $setvar
7309
7310 : Check if we are using the GNU C library
7311 echo " "
7312 echo "Checking for GNU C Library..." >&4
7313 cat >try.c <<'EOCP'
7314 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7315    alone are insufficient to distinguish different versions, such as
7316    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7317    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7318 */
7319 #include <stdio.h>
7320 int main(void)
7321 {
7322 #ifdef __GLIBC__
7323 #   ifdef __GLIBC_MINOR__
7324 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7325 #           include <gnu/libc-version.h>
7326             printf("%s\n",  gnu_get_libc_version());
7327 #       else
7328             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7329 #       endif
7330 #   else
7331         printf("%d\n",  __GLIBC__);
7332 #   endif
7333     return 0;
7334 #else
7335     return 1;
7336 #endif
7337 }
7338 EOCP
7339 set try
7340 if eval $compile_ok && $run ./try > glibc.ver; then
7341         val="$define"
7342         gnulibc_version=`$cat glibc.ver`
7343         echo "You are using the GNU C Library version $gnulibc_version"
7344 else
7345         val="$undef"
7346         gnulibc_version=''
7347         echo "You are not using the GNU C Library"
7348 fi
7349 $rm_try glibc.ver
7350 set d_gnulibc
7351 eval $setvar
7352
7353 : see if nm is to be used to determine whether a symbol is defined or not
7354 case "$usenm" in
7355 '')
7356         dflt=''
7357         case "$d_gnulibc" in
7358         "$define")
7359                 echo " "
7360                 echo "nm probably won't work on the GNU C Library." >&4
7361                 dflt=n
7362                 ;;
7363         esac
7364         case "$dflt" in
7365         '') 
7366                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7367                         echo " "
7368                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7369                         echo "'nm' won't be sufficient on this sytem." >&4
7370                         dflt=n
7371                 fi
7372                 ;;
7373         esac
7374         case "$dflt" in
7375         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7376                 if $test $dflt -gt 20; then
7377                         dflt=y
7378                 else
7379                         dflt=n
7380                 fi
7381                 ;;
7382         esac
7383         ;;
7384 *)
7385         case "$usenm" in
7386         true|$define) dflt=y;;
7387         *) dflt=n;;
7388         esac
7389         ;;
7390 esac
7391 $cat <<EOM
7392
7393 I can use $nm to extract the symbols from your C libraries. This
7394 is a time consuming task which may generate huge output on the disk (up
7395 to 3 megabytes) but that should make the symbols extraction faster. The
7396 alternative is to skip the 'nm' extraction part and to compile a small
7397 test program instead to determine whether each symbol is present. If
7398 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7399 this may be the best solution.
7400
7401 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7402
7403 EOM
7404 rp="Shall I use $nm to extract C symbols from the libraries?"
7405 . ./myread
7406 case "$ans" in
7407 [Nn]*) usenm=false;;
7408 *) usenm=true;;
7409 esac
7410
7411 runnm=$usenm
7412 case "$reuseval" in
7413 true) runnm=false;;
7414 esac
7415
7416 : nm options which may be necessary
7417 case "$nm_opt" in
7418 '') if $test -f /mach_boot; then
7419                 nm_opt=''       # Mach
7420         elif $test -d /usr/ccs/lib; then
7421                 nm_opt='-p'     # Solaris (and SunOS?)
7422         elif $test -f /dgux; then
7423                 nm_opt='-p'     # DG-UX
7424         elif $test -f /lib64/rld; then
7425                 nm_opt='-p'     # 64-bit Irix
7426         else
7427                 nm_opt=''
7428         fi;;
7429 esac
7430
7431 : nm options which may be necessary for shared libraries but illegal
7432 : for archive libraries.  Thank you, Linux.
7433 case "$nm_so_opt" in
7434 '')     case "$myuname" in
7435         *linux*|gnu*)
7436                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7437                         nm_so_opt='--dynamic'
7438                 fi
7439                 ;;
7440         esac
7441         ;;
7442 esac
7443
7444 : Figure out where the libc is located
7445 case "$runnm" in
7446 true)
7447 : get list of predefined functions in a handy place
7448 echo " "
7449 case "$libc" in
7450 '') libc=unknown
7451         case "$libs" in
7452         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7453         esac
7454         ;;
7455 esac
7456 case "$libs" in
7457 '') ;;
7458 *)  for thislib in $libs; do
7459         case "$thislib" in
7460         -lc|-lc_s)
7461                 : Handle C library specially below.
7462                 ;;
7463         -l*)
7464                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7465                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7466                         :
7467                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7468                         :
7469                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7470                         :
7471                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7472                         :
7473                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7474                         :
7475                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7476                         :
7477                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7478                         :
7479                 else
7480                         try=''
7481                 fi
7482                 libnames="$libnames $try"
7483                 ;;
7484         *) libnames="$libnames $thislib" ;;
7485         esac
7486         done
7487         ;;
7488 esac
7489 xxx=normal
7490 case "$libc" in
7491 unknown)
7492         set /lib/libc.$so
7493         for xxx in $libpth; do
7494                 $test -r $1 || set $xxx/libc.$so
7495                 : The messy sed command sorts on library version numbers.
7496                 $test -r $1 || \
7497                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7498                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7499                                 h
7500                                 s/[0-9][0-9]*/0000&/g
7501                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7502                                 G
7503                                 s/\n/ /' | \
7504                          $sort | $sed -e 's/^.* //'`
7505                 eval set \$$#
7506         done
7507         $test -r $1 || set /usr/ccs/lib/libc.$so
7508         $test -r $1 || set /lib/libsys_s$_a
7509         ;;
7510 *)
7511         set blurfl
7512         ;;
7513 esac
7514 if $test -r "$1"; then
7515         echo "Your (shared) C library seems to be in $1."
7516         libc="$1"
7517 elif $test -r /lib/libc && $test -r /lib/clib; then
7518         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7519         xxx=apollo
7520         libc='/lib/clib /lib/libc'
7521         if $test -r /lib/syslib; then
7522                 echo "(Your math library is in /lib/syslib.)"
7523                 libc="$libc /lib/syslib"
7524         fi
7525 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7526         echo "Your C library seems to be in $libc, as you said before."
7527 elif $test -r $incpath/usr/lib/libc$_a; then
7528         libc=$incpath/usr/lib/libc$_a;
7529         echo "Your C library seems to be in $libc.  That's fine."
7530 elif $test -r /lib/libc$_a; then
7531         libc=/lib/libc$_a;
7532         echo "Your C library seems to be in $libc.  You're normal."
7533 else
7534         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7535                 :
7536         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7537                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7538         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7539                 :
7540         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7541                 :
7542         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7543                 :
7544         else
7545                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7546         fi
7547         if $test -r "$tans"; then
7548                 echo "Your C library seems to be in $tans, of all places."
7549                 libc=$tans
7550         else
7551                 libc='blurfl'
7552         fi
7553 fi
7554 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7555         dflt="$libc"
7556         cat <<EOM
7557
7558 If the guess above is wrong (which it might be if you're using a strange
7559 compiler, or your machine supports multiple models), you can override it here.
7560
7561 EOM
7562 else
7563         dflt=''
7564         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7565         cat >&4 <<EOM
7566 I can't seem to find your C library.  I've looked in the following places:
7567
7568 EOM
7569         $sed 's/^/      /' libpath
7570         cat <<EOM
7571
7572 None of these seems to contain your C library. I need to get its name...
7573
7574 EOM
7575 fi
7576 fn=f
7577 rp='Where is your C library?'
7578 . ./getfile
7579 libc="$ans"
7580
7581 echo " "
7582 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7583 set X `cat libnames`
7584 shift
7585 xxx=files
7586 case $# in 1) xxx=file; esac
7587 echo "Extracting names from the following $xxx for later perusal:" >&4
7588 echo " "
7589 $sed 's/^/      /' libnames >&4
7590 echo " "
7591 $echo $n "This may take a while...$c" >&4
7592
7593 for file in $*; do
7594         case $file in
7595         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7596         *) $nm $nm_opt $file 2>/dev/null;;
7597         esac
7598 done >libc.tmp
7599
7600 $echo $n ".$c"
7601 $grep fprintf libc.tmp > libc.ptf
7602 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7603 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7604 xxx='[ADTSIWi]'
7605 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7606         eval $xscan;\
7607         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7608                 eval $xrun
7609 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7610         eval $xscan;\
7611         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7612                 eval $xrun
7613 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7614         eval $xscan;\
7615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7616                 eval $xrun
7617 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7618         eval $xscan;\
7619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7620                 eval $xrun
7621 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7622         eval $xscan;\
7623         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7624                 eval $xrun
7625 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7626         eval $xscan;\
7627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7628                 eval $xrun
7629 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7630                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7631         eval $xscan;\
7632         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7633                 eval $xrun
7634 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7635         eval $xscan;\
7636         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7637                 eval $xrun
7638 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7639         eval $xscan;\
7640         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7641                 eval $xrun
7642 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7643         eval $xscan;\
7644         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7645                 eval $xrun
7646 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7647         eval $xscan;\
7648         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7649                 eval $xrun
7650 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7651         eval $xscan;\
7652         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7653                 eval $xrun
7654 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7655         eval $xscan;\
7656         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7657                 eval $xrun
7658 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7659         eval $xscan;\
7660         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7661                 eval $xrun
7662 else
7663         $nm -p $* 2>/dev/null >libc.tmp
7664         $grep fprintf libc.tmp > libc.ptf
7665         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7666                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7667         then
7668                 nm_opt='-p'
7669                 eval $xrun
7670         else
7671                 echo " "
7672                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7673                 com=''
7674                 if $ar t $libc > libc.tmp && \
7675                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7676                 then
7677                         for thisname in $libnames $libc; do
7678                                 $ar t $thisname >>libc.tmp
7679                         done
7680                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7681                         echo "Ok." >&4
7682                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7683                         for thisname in $libnames $libc; do
7684                                 $ar tv $thisname >>libc.tmp
7685                                 emximp -o tmp.imp $thisname \
7686                                     2>/dev/null && \
7687                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7688                                     < tmp.imp >>libc.tmp
7689                                 $rm -f tmp.imp
7690                         done
7691                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7692                         echo "Ok." >&4
7693                 else
7694                         echo "$ar didn't seem to work right." >&4
7695                         echo "Maybe this is a Cray...trying bld instead..." >&4
7696                         if  bld t $libc | \
7697                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7698                                 $test -s libc.list
7699                         then
7700                                 for thisname in $libnames; do
7701                                         bld t $libnames | \
7702                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7703                                         $ar t $thisname >>libc.tmp
7704                                 done
7705                                 echo "Ok." >&4
7706                         else
7707                                 echo "That didn't work either.  Giving up." >&4
7708                                 exit 1
7709                         fi
7710                 fi
7711         fi
7712 fi
7713 nm_extract="$com"
7714 case "$PASE" in
7715 define)
7716     echo " "
7717     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7718     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7719     ;;
7720 *)  if $test -f /lib/syscalls.exp; then
7721         echo " "
7722         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7723         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7724                 /lib/syscalls.exp >>libc.list
7725     fi
7726     ;;
7727 esac
7728 ;;
7729 esac
7730 $rm -f libnames libpath
7731
7732 : see if dld is available
7733 set dld.h i_dld
7734 eval $inhdr
7735
7736 : Check if we are using C++
7737 echo " "
7738 echo "Checking for C++..." >&4
7739 $cat >try.c <<'EOCP'
7740 #include <stdio.h>
7741 int main(void)
7742 {
7743 #ifdef __cplusplus
7744     return 0;
7745 #else
7746     return 1;
7747 #endif
7748 }
7749 EOCP
7750 set try
7751 if eval $compile_ok && $run ./try; then
7752         val="$define"
7753         echo "You are using a C++ compiler."
7754 else
7755         val="$undef"
7756         echo "You are not using a C++ compiler."
7757 fi
7758 $rm_try cplusplus$$
7759 set d_cplusplus
7760 eval $setvar
7761
7762 : is a C symbol defined?
7763 csym='tlook=$1;
7764 case "$3" in
7765 -v) tf=libc.tmp; tdc="";;
7766 -a) tf=libc.tmp; tdc="[]";;
7767 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7768 esac;
7769 case "$d_cplusplus" in
7770     $define)    extern_C="extern \"C\"" ;;
7771     *)          extern_C="extern"       ;;
7772 esac;
7773 tx=yes;
7774 case "$reuseval-$4" in
7775 true-) ;;
7776 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7777 esac;
7778 case "$tx" in
7779 yes)
7780         tval=false;
7781         if $test "$runnm" = true; then
7782                 if $contains $tlook $tf >/dev/null 2>&1; then
7783                         tval=true;
7784                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7785                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7786                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7787                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7788                         $rm_try;
7789                 fi;
7790         else
7791                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7792                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7793                 $rm_try;
7794         fi;
7795         ;;
7796 *)
7797         case "$tval" in
7798         $define) tval=true;;
7799         *) tval=false;;
7800         esac;
7801         ;;
7802 esac;
7803 eval "$2=$tval"'
7804
7805 : define an is-in-libc? function
7806 inlibc='echo " "; td=$define; tu=$undef;
7807 sym=$1; var=$2; eval "was=\$$2";
7808 tx=yes;
7809 case "$reuseval$was" in
7810 true) ;;
7811 true*) tx=no;;
7812 esac;
7813 case "$tx" in
7814 yes)
7815         set $sym tres -f;
7816         eval $csym;
7817         case "$tres" in
7818         true)
7819                 echo "$sym() found." >&4;
7820                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7821         *)
7822                 echo "$sym() NOT found." >&4;
7823                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7824         esac;;
7825 *)
7826         case "$was" in
7827         $define) echo "$sym() found." >&4;;
7828         *) echo "$sym() NOT found." >&4;;
7829         esac;;
7830 esac'
7831
7832 : see if dlopen exists
7833 xxx_runnm="$runnm"
7834 xxx_ccflags="$ccflags"
7835 runnm=false
7836 : with g++ one needs -shared to get is-in-libc to work for dlopen
7837 case "$gccversion" in
7838 '')     ;;
7839 *)      case "$d_cplusplus" in
7840         "$define") ccflags="$ccflags -shared" ;;
7841         esac
7842         ;;
7843 esac
7844 set dlopen d_dlopen
7845 eval $inlibc
7846 runnm="$xxx_runnm"
7847 ccflags="$xxx_ccflags"
7848
7849 : see if this is a unistd.h system
7850 set unistd.h i_unistd
7851 eval $inhdr
7852
7853 : determine which dynamic loading, if any, to compile in
7854 echo " "
7855 dldir="ext/DynaLoader"
7856 case "$usedl" in
7857 $define|y|true)
7858         dflt='y'
7859         usedl="$define"
7860         ;;
7861 $undef|n|false)
7862         dflt='n'
7863         usedl="$undef"
7864         ;;
7865 *)
7866         dflt='n'
7867         case "$d_dlopen" in
7868             $define) dflt='y' ;;
7869         esac
7870         case "$i_dld" in
7871             $define) dflt='y' ;;
7872         esac
7873         : Does a dl_xxx.xs file exist for this operating system
7874         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7875         ;;
7876 esac
7877 rp="Do you wish to use dynamic loading?"
7878 . ./myread
7879 usedl="$ans"
7880 bin_ELF="$undef"
7881 case "$ans" in
7882 y*) usedl="$define"
7883         case "$dlsrc" in
7884         '')
7885                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7886                         dflt="$dldir/dl_${osname}.xs"
7887                 elif $test "$d_dlopen" = "$define" ; then
7888                         dflt="$dldir/dl_dlopen.xs"
7889                 elif $test "$i_dld" = "$define" ; then
7890                         dflt="$dldir/dl_dld.xs"
7891                 else
7892                         dflt=''
7893                 fi
7894                 ;;
7895         *)      dflt="$dldir/$dlsrc"
7896                 ;;
7897         esac
7898     echo "The following dynamic loading files are available:"
7899         : Can not go over to $dldir because getfile has path hard-coded in.
7900         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7901         rp="Source file to use for dynamic loading"
7902         fn="fne"
7903         gfpth="$src"
7904         . ./getfile
7905         usedl="$define"
7906         : emulate basename
7907         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7908
7909         $cat << EOM
7910
7911 Some systems may require passing special flags to $cc -c to
7912 compile modules that will be used to create a shared library.
7913 To use no flags, say "none".
7914
7915 EOM
7916     case "$cccdlflags" in
7917     '') case "$gccversion" in
7918                 '') case "$osname" in
7919                         hpux)   dflt='+z' ;;
7920                         next)   dflt='none' ;;
7921                         irix*)  dflt='-KPIC' ;;
7922                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7923                         sunos)  dflt='-pic' ;;
7924                         *)      dflt='none' ;;
7925                     esac
7926                         ;;
7927                 *)  case "$osname" in
7928                         darwin) dflt='none' ;;
7929                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7930                         *)      dflt='-fpic' ;;
7931                     esac ;;
7932             esac ;;
7933         ' ') dflt='none' ;;
7934     *)  dflt="$cccdlflags" ;;
7935     esac
7936     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7937     . ./myread
7938     case "$ans" in
7939     none) cccdlflags=' ' ;;
7940     *) cccdlflags="$ans" ;;
7941     esac
7942
7943     cat << EOM
7944
7945 Some systems use ld to create libraries that can be dynamically loaded,
7946 while other systems (such as those using ELF) use $cc.
7947
7948 EOM
7949
7950 : Determine if this is ELF
7951         $cat >try.c <<EOM
7952 /* Test for whether ELF binaries are produced */
7953 #include <fcntl.h>
7954 #$i_stdlib I_STDLIB
7955 #ifdef I_STDLIB
7956 #include <stdlib.h>
7957 #endif
7958 #$i_unistd I_UNISTD
7959 #ifdef I_UNISTD
7960 #include <unistd.h>
7961 #endif
7962 int main() {
7963         char b[4];
7964         int i = open("a.out",O_RDONLY);
7965         if(i == -1)
7966                 exit(1); /* fail */
7967         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7968                 exit(0); /* succeed (yes, it is ELF) */
7969         else
7970                 exit(1); /* fail */
7971 }
7972 EOM
7973         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7974                 bin_ELF="$define"
7975         fi
7976         $rm_try
7977
7978         case "$ld" in
7979         '')     if $test $bin_ELF = "$define"; then
7980                         cat <<EOM
7981 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7982 EOM
7983                         dflt="$cc"
7984                 else
7985                         echo "I'll use ld to build dynamic libraries."
7986                         dflt='ld'
7987                 fi
7988                 ;;
7989         *)      dflt="$ld"
7990                 ;;
7991         esac
7992
7993     rp="What command should be used to create dynamic libraries?"
7994     . ./myread
7995         ld="$ans"
7996
7997     cat << EOM
7998
7999 Some systems may require passing special flags to $ld to create a
8000 library that can be dynamically loaded.  If your ld flags include
8001 -L/other/path options to locate libraries outside your loader's normal
8002 search path, you may need to specify those -L options here as well.  To
8003 use no flags, say "none".
8004
8005 EOM
8006     case "$lddlflags" in
8007     '') case "$osname" in
8008                         beos) dflt='-nostart' ;;
8009                         haiku) dflt='-shared' ;;
8010                         hpux) dflt='-b';
8011                               case "$gccversion" in
8012                               '') dflt="$dflt +vnocompatwarnings" ;;
8013                               esac
8014                               ;;
8015                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8016                         next)  dflt='none' ;;
8017                         solaris) dflt='-G' ;;
8018                         sunos) dflt='-assert nodefinitions' ;;
8019                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8020                 *)     dflt='none' ;;
8021                         esac
8022                         ;;
8023     *) dflt="$lddlflags" ;;
8024     esac
8025
8026         : Try to guess additional flags to pick up local libraries.
8027         : Be careful not to append to a plain 'none'
8028         case "$dflt" in
8029         none) dflt='' ;;
8030         esac
8031         for thisflag in $ldflags; do
8032                 case "$thisflag" in
8033                 -L*|-R*|-Wl,-R*)
8034                         case " $dflt " in
8035                         *" $thisflag "*) ;;
8036                         *) dflt="$dflt $thisflag" ;;
8037                         esac
8038                         ;;
8039                 esac
8040         done
8041
8042         case "$dflt" in
8043         ''|' ') dflt='none' ;;
8044         esac
8045
8046         case "$ldflags" in
8047         *-fstack-protector*)
8048             case "$dflt" in
8049                         *-fstack-protector*) ;; # Don't add it again
8050                         *) dflt="$dflt -fstack-protector" ;; 
8051                 esac
8052                 ;;
8053         esac
8054
8055
8056     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8057     . ./myread
8058     case "$ans" in
8059     none) lddlflags=' ' ;;
8060     *) lddlflags="$ans" ;;
8061     esac
8062
8063         cat <<EOM
8064
8065 Some systems may require passing special flags to $cc to indicate that
8066 the resulting executable will use dynamic linking.  To use no flags,
8067 say "none".
8068
8069 EOM
8070     case "$ccdlflags" in
8071     '') case "$osname" in
8072             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8073             next|sunos) dflt='none' ;;
8074             *)          dflt='none' ;;
8075             esac ;;
8076     ' ')  dflt='none' ;;
8077     *)  dflt="$ccdlflags" ;;
8078     esac
8079     rp="Any special flags to pass to $cc to use dynamic linking?"
8080     . ./myread
8081     case "$ans" in
8082     none) ccdlflags=' ' ;;
8083     *) ccdlflags="$ans" ;;
8084     esac
8085     ;;
8086 *)  usedl="$undef"
8087         ld='ld'
8088     dlsrc='dl_none.xs'
8089     lddlflags=''
8090     ccdlflags=''
8091     ;;
8092 esac
8093
8094 ld_can_script="$undef"
8095 case "$bin_ELF$usedl" in
8096 $define$define)
8097     # Abuse try.h and a.out names for neat cleanup
8098     $cat >try.c <<EOM
8099 void foo() {}
8100 void bar() {}
8101 EOM
8102     $cat >try.h <<EOM
8103 LIBTEST_42 {
8104  global:
8105   foo;
8106  local: *;
8107  };
8108 EOM
8109     if $cc $cccdlflags $ccdlflags $ccflags \
8110            $ldflags $lddlflags -o a.out try.c \
8111            -Wl,--version-script=try.h >/dev/null 2>&1 \
8112        &&  $test -s a.out ; then
8113         echo "ld supports scripting" >&4
8114         ld_can_script="$define"
8115     else
8116         echo "ld does not support scripting" >&4
8117     fi
8118     $rm_try
8119     ;;
8120 esac
8121
8122 : Do we want a shared libperl?
8123 also=''
8124 case "$usedl" in
8125 $undef)
8126         # No dynamic loading being used, so don't bother even to prompt.
8127         useshrplib='false'
8128         ;;
8129 *)      case "$useshrplib" in
8130         '')     case "$osname" in
8131                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8132                         dflt=y
8133                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8134                         ;;
8135                 next*)
8136                         case "$osvers" in
8137                         4*)     dflt=y
8138                                 also='Building a shared libperl is needed for MAB support.'
8139                                 ;;
8140                         *)      dflt=n
8141                                 ;;
8142                         esac
8143                         ;;
8144                 *)      dflt=n
8145                         ;;
8146                 esac
8147                 ;;
8148         $define|true|[Yy]*)
8149                 dflt=y
8150                 ;;
8151         *)      dflt=n
8152                 ;;
8153         esac
8154         $cat << EOM
8155
8156 The perl executable is normally obtained by linking perlmain.c with
8157 libperl${_a}, any static extensions (usually just DynaLoader), and
8158 any other libraries needed on this system (such as -lm, etc.).  Since
8159 your system supports dynamic loading, it is probably possible to build
8160 a shared libperl.$so.  If you will have more than one executable linked
8161 to libperl.$so, this will significantly reduce the size of each
8162 executable, but it may have a noticeable effect on performance.  The
8163 default is probably sensible for your system.
8164 $also
8165
8166 EOM
8167         rp="Build a shared libperl.$so (y/n)"
8168         . ./myread
8169         case "$ans" in
8170         true|$define|[Yy]*)
8171                 useshrplib='true'  ;;
8172         *)      useshrplib='false' ;;
8173         esac
8174         ;;
8175 esac
8176
8177 case "$useshrplib" in
8178 true)
8179         case "$userelocatableinc" in
8180         true|define)
8181                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8182                 echo "See INSTALL for an explanation why that won't work." >&4
8183                 exit 4
8184                 ;;
8185         esac
8186         case "$libperl" in
8187         '')
8188                 # Figure out a good name for libperl.so.  Since it gets stored in
8189                 # a version-specific architecture-dependent library, the version
8190                 # number isn't really that important, except for making cc/ld happy.
8191                 #
8192                 # A name such as libperl.so.10.1
8193                 majmin="libperl.$so.$patchlevel.$subversion"
8194                 # A name such as libperl.so.100
8195                 majonly=`echo $patchlevel $subversion |
8196                         $awk '{printf "%d%02d", $1, $2}'`
8197                 majonly=libperl.$so.$majonly
8198                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8199                 # rely on figuring it out from the naming of libc.
8200                 case "${osname}${osvers}" in
8201                 next4*)
8202                         dflt=libperl.5.$so
8203                         # XXX How handle the --version stuff for MAB?
8204                         ;;
8205                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8206                         dflt=libperl.$so
8207                         ;;
8208                 cygwin*) # ld links now against the dll directly
8209                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8210                         majonly=`echo $patchlevel $subversion |
8211                                 $awk '{printf "%03d%03d", $1, $2}'`
8212                         majonly=cygperl5.$majonly.$so
8213                         dflt=$majmin
8214                         ;;
8215                 *)      # Try to guess based on whether libc has major.minor.
8216                         case "$libc" in
8217                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8218                         *libc.$so.[0-9]*) dflt=$majonly ;;
8219                         *)      dflt=libperl.$so ;;
8220                         esac
8221                         ;;
8222                 esac
8223                 ;;
8224         *)      dflt=$libperl
8225                 ;;
8226         esac
8227         cat << EOM
8228
8229 I need to select a good name for the shared libperl.  If your system uses
8230 library names with major and minor numbers, then you might want something
8231 like $majmin.  Alternatively, if your system uses a single version
8232 number for shared libraries, then you might want to use $majonly.
8233 Or, your system might be quite happy with a simple libperl.$so.
8234
8235 Since the shared libperl will get installed into a version-specific
8236 architecture-dependent directory, the version number of the shared perl
8237 library probably isn't important, so the default should be o.k.
8238
8239 EOM
8240         rp='What name do you want to give to the shared libperl?'
8241         . ./myread
8242         libperl=$ans
8243         echo "Ok, I'll use $libperl"
8244         ;;
8245 *)
8246         libperl="libperl${_a}"
8247         ;;
8248 esac
8249
8250 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8251 case "$shrpdir" in
8252 '') ;;
8253 *)      $cat >&4 <<EOM
8254 WARNING:  Use of the shrpdir variable for the installation location of
8255 the shared $libperl is not supported.  It was never documented and
8256 will not work in this version.  Let me (perlbug@perl.org)
8257 know of any problems this may cause.
8258
8259 EOM
8260         case "$shrpdir" in
8261         "$archlibexp/CORE")
8262                 $cat >&4 <<EOM
8263 But your current setting of $shrpdir is
8264 the default anyway, so it's harmless.
8265 EOM
8266                 ;;
8267         *)
8268                 $cat >&4 <<EOM
8269 Further, your current attempted setting of $shrpdir
8270 conflicts with the value of $archlibexp/CORE
8271 that installperl will use.
8272 EOM
8273                 ;;
8274         esac
8275         ;;
8276 esac
8277
8278 # How will the perl executable find the installed shared $libperl?
8279 # Add $xxx to ccdlflags.
8280 # If we can't figure out a command-line option, use $shrpenv to
8281 # set env LD_RUN_PATH.  The main perl makefile uses this.
8282 shrpdir=$archlibexp/CORE
8283 xxx=''
8284 tmp_shrpenv=''
8285 if "$useshrplib"; then
8286     case "$osname" in
8287         aix)
8288                 # We'll set it in Makefile.SH...
8289                 ;;
8290         solaris)
8291                 xxx="-R $shrpdir"
8292                 ;;
8293         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8294                 xxx="-Wl,-R$shrpdir"
8295                 ;;
8296         bsdos|linux|irix*|dec_osf|gnu*)
8297                 xxx="-Wl,-rpath,$shrpdir"
8298                 ;;
8299         next)
8300                 # next doesn't like the default...
8301                 ;;
8302         beos)
8303                 # beos doesn't like the default, either.
8304                 ;;
8305         haiku)
8306                 # Haiku doesn't like the default, either.
8307                 ;;
8308         hpux*)
8309                 # hpux doesn't like the default, either.
8310                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8311                 ;;
8312         cygwin)
8313                 # cygwin needs only ldlibpth
8314                 ;;
8315         *)
8316                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8317                 ;;
8318         esac
8319         case "$xxx" in
8320         '') ;;
8321         *)
8322                 # Only add $xxx if it isn't already in ccdlflags.
8323                 case " $ccdlflags " in
8324                 *" $xxx "*)     ;;
8325                 *)      ccdlflags="$ccdlflags $xxx"
8326                         cat <<EOM >&4
8327
8328 Adding $xxx to the flags
8329 passed to $ld so that the perl executable will find the
8330 installed shared $libperl.
8331
8332 EOM
8333                         ;;
8334                 esac
8335                 ;;
8336         esac
8337 fi
8338 # Fix ccdlflags in AIX for building external extensions.
8339 # (For building Perl itself bare -bE:perl.exp is needed,
8340 #  Makefile.SH takes care of this.)
8341 case "$osname" in
8342 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8343 esac
8344 # Respect a hint or command-line value.
8345 case "$shrpenv" in
8346 '') shrpenv="$tmp_shrpenv" ;;
8347 esac
8348 case "$ldlibpthname" in
8349 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8350 none)   ldlibpthname='' ;;
8351 esac
8352
8353 : determine where manual pages are on this system
8354 echo " "
8355 case "$sysman" in
8356 '') 
8357         syspath='/usr/share/man/man1 /usr/man/man1'
8358         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8359         syspath="$syspath /usr/man/u_man/man1"
8360         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8361         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8362         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8363         sysman=`./loc . /usr/man/man1 $syspath`
8364         ;;
8365 esac
8366 if $test -d "$sysman"; then
8367         echo "System manual is in $sysman." >&4
8368 else
8369         echo "Could not find manual pages in source form." >&4
8370 fi
8371
8372 : determine where manual pages go
8373 set man1dir man1dir none
8374 eval $prefixit
8375 $cat <<EOM
8376
8377 $spackage has manual pages available in source form.
8378 EOM
8379 case "$nroff" in
8380 nroff)
8381         echo "However, you don't have nroff, so they're probably useless to you."
8382         case "$man1dir" in
8383         '') man1dir="none";;
8384         esac;;
8385 esac
8386 echo "If you don't want the manual sources installed, answer 'none'."
8387 case "$man1dir" in
8388 ' ') dflt=none
8389         ;;
8390 '')
8391         lookpath="$prefixexp/share/man/man1"
8392         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8393         lookpath="$lookpath $prefixexp/man/p_man/man1"
8394         lookpath="$lookpath $prefixexp/man/u_man/man1"
8395         lookpath="$lookpath $prefixexp/man/man.1"
8396         case "$sysman" in
8397         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8398         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8399         esac
8400         set dflt
8401         eval $prefixup
8402         ;;
8403 *)  dflt="$man1dir"
8404         ;;
8405 esac
8406 echo " "
8407 fn=dn+~
8408 rp="Where do the main $spackage manual pages (source) go?"
8409 . ./getfile
8410 if $test "X$man1direxp" != "X$ansexp"; then
8411         installman1dir=''
8412 fi
8413 prefixvar=man1dir
8414 . ./setprefixvar
8415
8416 case "$man1dir" in
8417 '')     man1dir=' '
8418         installman1dir='';;
8419 esac
8420
8421 : What suffix to use on installed man pages
8422
8423 case "$man1dir" in
8424 ' ')
8425         man1ext='0'
8426         ;;
8427 *)
8428         rp="What suffix should be used for the main $spackage man pages?"
8429         case "$man1ext" in
8430         '')     case "$man1dir" in
8431                 *1)  dflt=1 ;;
8432                 *1p) dflt=1p ;;
8433                 *1pm) dflt=1pm ;;
8434                 *l) dflt=l;;
8435                 *n) dflt=n;;
8436                 *o) dflt=o;;
8437                 *p) dflt=p;;
8438                 *C) dflt=C;;
8439                 *L) dflt=L;;
8440                 *L1) dflt=L1;;
8441                 *) dflt=1;;
8442                 esac
8443                 ;;
8444         *)      dflt="$man1ext";;
8445         esac
8446         . ./myread
8447         man1ext="$ans"
8448         ;;
8449 esac
8450
8451 : see if we can have long filenames
8452 echo " "
8453 first=123456789abcdef
8454 $rm -f $first
8455 if (echo hi >$first) 2>/dev/null; then
8456         if $test -f 123456789abcde; then
8457                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8458                 val="$undef"
8459         else
8460                 echo 'You can have filenames longer than 14 characters.'>&4
8461                 val="$define"
8462         fi
8463 else
8464         $cat <<'EOM'
8465 You can't have filenames longer than 14 chars.
8466 You can't even think about them!
8467 EOM
8468         val="$undef"
8469 fi
8470 set d_flexfnam
8471 eval $setvar
8472 $rm -rf 123456789abcde*
8473
8474 : determine where library module manual pages go
8475 set man3dir man3dir none
8476 eval $prefixit
8477 $cat <<EOM
8478
8479 $spackage has manual pages for many of the library modules.
8480 EOM
8481
8482 case "$nroff" in
8483 nroff)
8484         $cat <<'EOM'
8485 However, you don't have nroff, so they're probably useless to you.
8486 EOM
8487         case "$man3dir" in
8488         '') man3dir="none";;
8489         esac;;
8490 esac
8491
8492 case "$d_flexfnam" in
8493 undef)
8494         $cat <<'EOM'
8495 However, your system can't handle the long file names like File::Basename.3.
8496 EOM
8497         case "$man3dir" in
8498         '') man3dir="none";;
8499         esac;;
8500 esac
8501
8502 echo "If you don't want the manual sources installed, answer 'none'."
8503 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8504 case "$man3dir" in
8505 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8506         if $test -d "$privlib/man/man3"; then
8507                 cat <<EOM >&4
8508
8509 WARNING:  Previous versions of perl installed man3 pages into
8510 $privlib/man/man3.  This version will suggest a
8511 new default of $dflt.
8512 EOM
8513                 tdflt=$dflt
8514                 dflt='n'
8515                 rp='Do you wish to preserve the old behavior?(y/n)'
8516                 . ./myread
8517                 case "$ans" in
8518                 y*) dflt="$privlib/man/man3" ;;
8519                 *)  dflt=$tdflt ;;
8520                 esac
8521     fi
8522         ;;
8523 *)      dflt="$man3dir" ;;
8524 esac
8525 case "$dflt" in
8526 ' ') dflt=none ;;
8527 esac
8528 echo " "
8529 fn=dn+~
8530 rp="Where do the $package library man pages (source) go?"
8531 . ./getfile
8532 prefixvar=man3dir
8533 . ./setprefixvar
8534
8535 case "$man3dir" in
8536 '')     man3dir=' '
8537         installman3dir='';;
8538 esac
8539
8540 : What suffix to use on installed man pages
8541 case "$man3dir" in
8542 ' ')
8543         man3ext='0'
8544         ;;
8545 *)
8546         rp="What suffix should be used for the $package library man pages?"
8547         case "$man3ext" in
8548         '')     case "$man3dir" in
8549                 *3)  dflt=3 ;;
8550                 *3p) dflt=3p ;;
8551                 *3pm) dflt=3pm ;;
8552                 *l) dflt=l;;
8553                 *n) dflt=n;;
8554                 *o) dflt=o;;
8555                 *p) dflt=p;;
8556                 *C) dflt=C;;
8557                 *L) dflt=L;;
8558                 *L3) dflt=L3;;
8559                 *) dflt=3;;
8560                 esac
8561                 ;;
8562         *)      dflt="$man3ext";;
8563         esac
8564         . ./myread
8565         man3ext="$ans"
8566         ;;
8567 esac
8568
8569 : see if we have to deal with yellow pages, now NIS.
8570 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8571         if $test -f /usr/etc/nibindd; then
8572                 echo " "
8573                 echo "I'm fairly confident you're on a NeXT."
8574                 echo " "
8575                 rp='Do you get the hosts file via NetInfo?'
8576                 dflt=y
8577                 case "$hostcat" in
8578                 nidump*) ;;
8579                 '') ;;
8580                 *) dflt=n;;
8581                 esac
8582                 . ./myread
8583                 case "$ans" in
8584                 y*) hostcat='nidump hosts .';;
8585                 *)      case "$hostcat" in
8586                         nidump*) hostcat='';;
8587                         esac
8588                         ;;
8589                 esac
8590         fi
8591         case "$hostcat" in
8592         nidump*) ;;
8593         *)
8594                 case "$hostcat" in
8595                 *ypcat*) dflt=y;;
8596                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8597                                 dflt=y
8598                         else
8599                                 dflt=n
8600                         fi;;
8601                 *) dflt=n;;
8602                 esac
8603                 echo " "
8604                 rp='Are you getting the hosts file via yellow pages?'
8605                 . ./myread
8606                 case "$ans" in
8607                 y*) hostcat='ypcat hosts';;
8608                 *) hostcat='cat /etc/hosts';;
8609                 esac
8610                 ;;
8611         esac
8612 fi
8613 case "$hostcat" in
8614 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8615 esac
8616 case "$groupcat" in
8617 '') test -f /etc/group && groupcat='cat /etc/group';;
8618 esac
8619 case "$passcat" in
8620 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8621 esac
8622
8623 : now get the host name
8624 echo " "
8625 echo "Figuring out host name..." >&4
8626 case "$myhostname" in
8627 '') cont=true
8628         echo 'Maybe "hostname" will work...'
8629         if tans=`sh -c hostname 2>&1` ; then
8630                 myhostname=$tans
8631                 phostname=hostname
8632                 cont=''
8633         fi
8634         ;;
8635 *) cont='';;
8636 esac
8637 if $test "$cont"; then
8638         if ./xenix; then
8639                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8640                 if tans=`cat /etc/systemid 2>&1` ; then
8641                         myhostname=$tans
8642                         phostname='cat /etc/systemid'
8643                         echo "Whadyaknow.  Xenix always was a bit strange..."
8644                         cont=''
8645                 fi
8646         elif $test -r /etc/systemid; then
8647                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8648         fi
8649 fi
8650 if $test "$cont"; then
8651         echo 'No, maybe "uuname -l" will work...'
8652         if tans=`sh -c 'uuname -l' 2>&1` ; then
8653                 myhostname=$tans
8654                 phostname='uuname -l'
8655         else
8656                 echo 'Strange.  Maybe "uname -n" will work...'
8657                 if tans=`sh -c 'uname -n' 2>&1` ; then
8658                         myhostname=$tans
8659                         phostname='uname -n'
8660                 else
8661                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8662                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8663                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8664                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8665                         else
8666                                 case "$myhostname" in
8667                                 '') echo "Does this machine have an identity crisis or something?"
8668                                         phostname='';;
8669                                 *)
8670                                         echo "Well, you said $myhostname before..."
8671                                         phostname='echo $myhostname';;
8672                                 esac
8673                         fi
8674                 fi
8675         fi
8676 fi
8677 case "$myhostname" in
8678 '') myhostname=noname ;;
8679 esac
8680 : you do not want to know about this
8681 set $myhostname
8682 myhostname=$1
8683
8684 : verify guess
8685 if $test "$myhostname" ; then
8686         dflt=y
8687         rp='Your host name appears to be "'$myhostname'".'" Right?"
8688         . ./myread
8689         case "$ans" in
8690         y*) ;;
8691         *) myhostname='';;
8692         esac
8693 fi
8694
8695 : bad guess or no guess
8696 while $test "X$myhostname" = X ; do
8697         dflt=''
8698         rp="Please type the (one word) name of your host:"
8699         . ./myread
8700         myhostname="$ans"
8701 done
8702
8703 : translate upper to lower if necessary
8704 case "$myhostname" in
8705 *[A-Z]*)
8706         echo "(Normalizing case in your host name)"
8707         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8708         ;;
8709 esac
8710
8711 case "$myhostname" in
8712 *.*)
8713         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8714         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8715         echo "(Trimming domain name from host name--host name is now $myhostname)"
8716         ;;
8717 *) case "$mydomain" in
8718         '')
8719                 {
8720                         test "X$hostcat" = "Xypcat hosts" &&
8721                         ypmatch "$myhostname" hosts 2>/dev/null |\
8722                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8723                         $test -s hosts
8724                 } || {
8725                         test "X$hostcat" != "X" &&
8726                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8727                                         /[       ]$myhostname[  . ]/p" > hosts
8728                 }
8729                 tmp_re="[       . ]"
8730                 if $test -f hosts; then
8731                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8732                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8733                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8734                                 hosts | $sort | $uniq | \
8735                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8736                         case `$echo X$dflt` in
8737                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8738                                 dflt=.
8739                                 ;;
8740                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8741                                 ;;
8742                         esac
8743                 else
8744                         echo "(I cannot locate a hosts database anywhere)"
8745                         dflt=.
8746                 fi
8747                 case "$dflt" in
8748                 .)
8749                         tans=`./loc resolv.conf X /etc /usr/etc`
8750                         if $test -f "$tans"; then
8751                                 echo "(Attempting domain name extraction from $tans)"
8752                                 dflt=.`$sed -n -e 's/   / /g' \
8753                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8754                                   -e 1q 2>/dev/null`
8755                                 case "$dflt" in
8756                                 .) dflt=.`$sed -n -e 's/        / /g' \
8757                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8758                                      -e 1q 2>/dev/null`
8759                                         ;;
8760                                 esac
8761                         fi
8762                         ;;
8763                 esac
8764                 case "$dflt" in
8765                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8766                         dflt=.`sh -c domainname 2>/dev/null`
8767                         case "$dflt" in
8768                         '') dflt='.';;
8769                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8770                         esac
8771                         ;;
8772                 esac
8773                 case "$dflt$osname" in
8774                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8775                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8776                         ;;
8777                 esac
8778                 case "$dflt" in
8779                 .) echo "(Lost all hope -- silly guess then)"
8780                         dflt='.nonet'
8781                         ;;
8782                 esac
8783                 $rm -f hosts
8784                 ;;
8785         *) dflt="$mydomain";;
8786         esac;;
8787 esac
8788 echo " "
8789 rp="What is your domain name?"
8790 . ./myread
8791 tans="$ans"
8792 case "$ans" in
8793 '') ;;
8794 .*) ;;
8795 *) tans=".$tans";;
8796 esac
8797 mydomain="$tans"
8798
8799 : translate upper to lower if necessary
8800 case "$mydomain" in
8801 *[A-Z]*)
8802         echo "(Normalizing case in your domain name)"
8803         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8804         ;;
8805 esac
8806
8807 : a little sanity check here
8808 case "$phostname" in
8809 '') ;;
8810 *)
8811         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8812         $myhostname$mydomain|$myhostname) ;;
8813         *)
8814                 case "$phostname" in
8815                 sed*)
8816                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8817                         ;;
8818                 *)
8819                         echo "(That doesn't agree with your $phostname command, by the way.)"
8820                         ;;
8821                 esac
8822         ;;
8823         esac
8824         ;;
8825 esac
8826
8827 : determine the e-mail address of the user who is running us
8828 $cat <<EOM
8829
8830 I need to get your e-mail address in Internet format if possible, i.e.
8831 something like user@host.domain. Please answer accurately since I have
8832 no easy means to double check it. The default value provided below
8833 is most probably close to reality but may not be valid from outside
8834 your organization...
8835
8836 EOM
8837 cont=x
8838 while test "$cont"; do
8839         case "$cf_email" in
8840         '') dflt="$cf_by@$myhostname$mydomain";;
8841         *) dflt="$cf_email";;
8842         esac
8843         rp='What is your e-mail address?'
8844         . ./myread
8845         cf_email="$ans"
8846         case "$cf_email" in
8847         *@*.*) cont='' ;;
8848         *)
8849                 rp='Address does not look like an Internet one.  Use it anyway?'
8850                 case "$fastread" in
8851                 yes) dflt=y ;;
8852                 *) dflt=n ;;
8853                 esac
8854                 . ./myread
8855                 case "$ans" in
8856                 y*) cont='' ;;
8857                 *) echo " " ;;
8858                 esac
8859                 ;;
8860         esac
8861 done
8862
8863 : Ask e-mail of administrator
8864 $cat <<EOM
8865
8866 If you or somebody else will be maintaining perl at your site, please
8867 fill in the correct e-mail address here so that they may be contacted
8868 if necessary. Currently, the "perlbug" program included with perl
8869 will send mail to this address in addition to perlbug@perl.org. You may
8870 enter "none" for no administrator.
8871
8872 EOM
8873 case "$perladmin" in
8874 '') dflt="$cf_email";;
8875 *) dflt="$perladmin";;
8876 esac
8877 rp='Perl administrator e-mail address'
8878 . ./myread
8879 perladmin="$ans"
8880
8881 : determine whether to only install version-specific parts.
8882 echo " "
8883 $cat <<EOM
8884 Do you want to install only the version-specific parts of the perl
8885 distribution?  Usually you do *not* want to do this.
8886 EOM
8887 case "$versiononly" in
8888 "$define"|[Yy]*|true) dflt='y' ;;
8889 *) dflt='n';
8890 esac
8891 rp="Do you want to install only the version-specific parts of perl?"
8892 . ./myread
8893 case "$ans" in
8894 [yY]*)  val="$define";;
8895 *)      val="$undef" ;;
8896 esac
8897 set versiononly
8898 eval $setvar
8899
8900 case "$versiononly" in
8901 "$define") inc_version_list=''
8902            inc_version_list_init=0
8903            ;;
8904 esac
8905
8906 : figure out how to guarantee perl startup
8907 : XXX Note that this currently takes advantage of the bug that binexp ignores
8908 :     the Configure -Dinstallprefix setting, which in turn means that under
8909 :     relocatable @INC, initialinstalllocation is what binexp started as.
8910 case "$startperl" in
8911 '')
8912         case "$sharpbang" in
8913         *!)
8914                 $cat <<EOH
8915
8916 I can use the #! construct to start perl on your system. This will
8917 make startup of perl scripts faster, but may cause problems if you
8918 want to share those scripts and perl is not in a standard place
8919 ($initialinstalllocation/perl) on all your platforms. The alternative
8920 is to force a shell by starting the script with a single ':' character.
8921
8922 EOH
8923                 case "$versiononly" in
8924                 "$define")      dflt="$initialinstalllocation/perl$version";;
8925                 *)              dflt="$initialinstalllocation/perl";;
8926                 esac
8927                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8928                 . ./myread
8929                 case "$ans" in
8930                 none)   startperl=": # use perl";;
8931                 *)      startperl="#!$ans"
8932                         if $test 30 -lt `echo "$ans" | wc -c`; then
8933                                 $cat >&4 <<EOM
8934
8935 WARNING:  Some systems limit the #! command to 32 characters.
8936 If you experience difficulty running Perl scripts with #!, try
8937 installing Perl in a directory with a shorter pathname.
8938
8939 EOM
8940                         fi ;;
8941                 esac
8942                 ;;
8943         *) startperl=": # use perl"
8944                 ;;
8945         esac
8946         ;;
8947 esac
8948 echo "I'll use $startperl to start perl scripts."
8949
8950 : figure best path for perl in scripts
8951 case "$perlpath" in
8952 '')
8953         case "$versiononly" in
8954         "$define")      perlpath="$initialinstalllocation/perl$version";;
8955         *)              perlpath="$initialinstalllocation/perl";;
8956         esac
8957         case "$startperl" in
8958         *!*) ;;
8959         *)
8960                 $cat <<EOH
8961
8962 I will use the "eval 'exec'" idiom to start Perl on your system.
8963 I can use the full path of your Perl binary for this purpose, but
8964 doing so may cause problems if you want to share those scripts and
8965 Perl is not always in a standard place ($initialinstalllocation/perl).
8966
8967 EOH
8968                 dflt="$initialinstalllocation/perl"
8969                 rp="What path shall I use in \"eval 'exec'\"?"
8970                 . ./myread
8971                 perlpath="$ans"
8972                 ;;
8973         esac
8974         ;;
8975 esac
8976 case "$startperl" in
8977 *!*)    ;;
8978 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8979 esac
8980
8981 : determine where public executable scripts go
8982 set scriptdir scriptdir
8983 eval $prefixit
8984 case "$scriptdir" in
8985 '')
8986         dflt="$bin"
8987         : guess some guesses
8988         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8989         $test -d /usr/share/bin     && dflt=/usr/share/bin
8990         $test -d /usr/local/script  && dflt=/usr/local/script
8991         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8992         $test -d $prefixexp/script  && dflt=$prefixexp/script
8993         set dflt
8994         eval $prefixup
8995         ;;
8996 *)  dflt="$scriptdir"
8997         ;;
8998 esac
8999 $cat <<EOM
9000
9001 Some installations have a separate directory just for executable scripts so
9002 that they can mount it across multiple architectures but keep the scripts in
9003 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9004 Or you might just lump your scripts in with all your other executables.
9005
9006 EOM
9007 fn=d~
9008 rp='Where do you keep publicly executable scripts?'
9009 . ./getfile
9010 if $test "X$ansexp" != "X$scriptdirexp"; then
9011         installscript=''
9012 fi
9013 installscriptdir=''
9014 prefixvar=scriptdir
9015 . ./setprefixvar
9016 : A little fix up for an irregularly named variable.
9017 installscript="$installscriptdir"
9018
9019 : determine where add-on public executables go
9020 case "$sitebin" in
9021 '')     dflt=$siteprefix/bin ;;
9022 *)      dflt=$sitebin ;;
9023 esac
9024 fn=d~
9025 rp='Pathname where the add-on public executables should be installed?'
9026 . ./getfile
9027 prefixvar=sitebin
9028 . ./setprefixvar
9029
9030 : determine where add-on html pages go
9031 : There is no standard location, so try to copy the previously-selected
9032 : directory structure for the core html pages.
9033 case "$sitehtml1dir" in
9034 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9035 *)     dflt=$sitehtml1dir ;;
9036 esac
9037 case "$dflt" in
9038 ''|' ') dflt=none ;;
9039 esac
9040 fn=dn+~
9041 rp='Pathname where the site-specific html pages should be installed?'
9042 . ./getfile
9043 prefixvar=sitehtml1dir
9044 . ./setprefixvar
9045
9046 : determine where add-on library html pages go
9047 : There is no standard location, so try to copy the previously-selected
9048 : directory structure for the core html pages.
9049 case "$sitehtml3dir" in
9050 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9051 *)     dflt=$sitehtml3dir ;;
9052 esac
9053 case "$dflt" in
9054 ''|' ') dflt=none ;;
9055 esac
9056 fn=dn+~
9057 rp='Pathname where the site-specific library html pages should be installed?'
9058 . ./getfile
9059 prefixvar=sitehtml3dir
9060 . ./setprefixvar
9061
9062 : determine where add-on manual pages go
9063 case "$siteman1dir" in
9064 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9065 *)      dflt=$siteman1dir ;;
9066 esac
9067 case "$dflt" in
9068 ''|' ') dflt=none ;;
9069 esac
9070 fn=dn+~
9071 rp='Pathname where the site-specific manual pages should be installed?'
9072 . ./getfile
9073 prefixvar=siteman1dir
9074 . ./setprefixvar
9075
9076 : determine where add-on library man pages go
9077 case "$siteman3dir" in
9078 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9079 *)      dflt=$siteman3dir ;;
9080 esac
9081 case "$dflt" in
9082 ''|' ') dflt=none ;;
9083 esac
9084 fn=dn+~
9085 rp='Pathname where the site-specific library manual pages should be installed?'
9086 . ./getfile
9087 prefixvar=siteman3dir
9088 . ./setprefixvar
9089
9090 : determine where add-on public executable scripts go
9091 case "$sitescript" in
9092 '')     dflt=$siteprefix/script
9093         $test -d $dflt || dflt=$sitebin ;;
9094 *)  dflt="$sitescript" ;;
9095 esac
9096 fn=d~+
9097 rp='Pathname where add-on public executable scripts should be installed?'
9098 . ./getfile
9099 prefixvar=sitescript
9100 . ./setprefixvar
9101
9102 : Check if faststdio is requested and available
9103 case "$usefaststdio" in
9104 $define|true|[yY]*|'')
9105         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9106         case "$xversion" in
9107         [68])   dflt='y' ;;
9108         *)      dflt='n' ;;
9109         esac
9110         ;;
9111 *) dflt='n';;
9112 esac
9113 cat <<EOM
9114
9115 Perl can be built to use 'fast stdio', which means using the stdio
9116 library but also directly manipulating the stdio buffers to enable
9117 faster I/O.  Using stdio is better for backward compatibility (especially
9118 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9119 interface has been preferred instead of stdio.
9120
9121 If this doesn't make any sense to you, just accept the default '$dflt'.
9122 EOM
9123 rp='Use the "fast stdio" if available?'
9124 . ./myread
9125 case "$ans" in
9126 y|Y)    val="$define" ;;
9127 *)      val="$undef" ;;
9128 esac
9129 set usefaststdio
9130 eval $setvar
9131
9132
9133 : define an is-a-typedef? function
9134 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9135 case "$inclist" in
9136 "") inclist="sys/types.h";;
9137 esac;
9138 eval "varval=\$$var";
9139 case "$varval" in
9140 "")
9141         $rm -f temp.c;
9142         for inc in $inclist; do
9143                 echo "#include <$inc>" >>temp.c;
9144         done;
9145         echo "#ifdef $type" >> temp.c;
9146         echo "printf(\"We have $type\");" >> temp.c;
9147         echo "#endif" >> temp.c;
9148         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9149         if $contains $type temp.E >/dev/null 2>&1; then
9150                 eval "$var=\$type";
9151         else
9152                 eval "$var=\$def";
9153         fi;
9154         $rm -f temp.?;;
9155 *) eval "$var=\$varval";;
9156 esac'
9157
9158 : define an is-a-typedef? function that prompts if the type is not available.
9159 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9160 case "$inclist" in
9161 "") inclist="sys/types.h";;
9162 esac;
9163 eval "varval=\$$var";
9164 case "$varval" in
9165 "")
9166         $rm -f temp.c;
9167         for inc in $inclist; do
9168                 echo "#include <$inc>" >>temp.c;
9169         done;
9170         echo "#ifdef $type" >> temp.c;
9171         echo "printf(\"We have $type\");" >> temp.c;
9172         echo "#endif" >> temp.c;
9173         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9174         echo " " ;
9175         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9176         if $contains $type temp.E >/dev/null 2>&1; then
9177                 echo "$type found." >&4;
9178                 eval "$var=\$type";
9179         else
9180                 echo "$type NOT found." >&4;
9181                 dflt="$def";
9182                 . ./myread ;
9183                 eval "$var=\$ans";
9184         fi;
9185         $rm -f temp.?;;
9186 *) eval "$var=\$varval";;
9187 esac'
9188
9189 : see what type lseek is declared as in the kernel
9190 rp="What is the type used for lseek's offset on this system?"
9191 set off_t lseektype long stdio.h sys/types.h
9192 eval $typedef_ask
9193
9194 echo " "
9195 echo "Checking to see how big your file offsets are..." >&4
9196 $cat >try.c <<EOCP
9197 #include <sys/types.h>
9198 #include <stdio.h>
9199 int main()
9200 {
9201     printf("%d\n", (int)sizeof($lseektype));
9202     return(0);
9203 }
9204 EOCP
9205 set try
9206 if eval $compile_ok; then
9207         lseeksize=`$run ./try`
9208         echo "Your file offsets are $lseeksize bytes long."
9209 else
9210         dflt=$longsize
9211         echo " "
9212         echo "(I can't seem to compile the test program.  Guessing...)"
9213         rp="What is the size of your file offsets (in bytes)?"
9214         . ./myread
9215         lseeksize="$ans"
9216 fi
9217 $rm_try
9218
9219 : see what type file positions are declared as in the library
9220 rp="What is the type for file position used by fsetpos()?"
9221 set fpos_t fpostype long stdio.h sys/types.h
9222 eval $typedef_ask
9223
9224 : Check size for Fpos_t
9225 echo " "
9226 case "$fpostype" in
9227 *_t) zzz="$fpostype"    ;;
9228 *)   zzz="fpos_t"       ;;
9229 esac
9230 echo "Checking the size of $zzz..." >&4
9231 cat > try.c <<EOCP
9232 #include <sys/types.h>
9233 #include <stdio.h>
9234 #$i_stdlib I_STDLIB
9235 #ifdef I_STDLIB
9236 #include <stdlib.h>
9237 #endif
9238 int main() {
9239     printf("%d\n", (int)sizeof($fpostype));
9240     exit(0);
9241 }
9242 EOCP
9243 set try
9244 if eval $compile_ok; then
9245         yyy=`$run ./try`
9246         case "$yyy" in
9247         '')     fpossize=4
9248                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9249                 ;;
9250         *)      fpossize=$yyy
9251                 echo "Your $zzz is $fpossize bytes long."
9252                 ;;
9253         esac
9254 else
9255         dflt="$longsize"
9256         echo " " >&4
9257         echo "(I can't compile the test program.  Guessing...)" >&4
9258         rp="What is the size of your file positions (in bytes)?"
9259         . ./myread
9260         fpossize="$ans"
9261 fi
9262
9263 : Check for large file support
9264 # Backward compatibility (uselfs is deprecated).
9265 case "$uselfs" in
9266 "$define"|true|[yY]*)
9267         cat <<EOM >&4
9268
9269 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9270 EOM
9271         uselargefiles="$define"
9272         ;;
9273 esac
9274
9275 case "$lseeksize:$fpossize" in
9276 8:8) cat <<EOM
9277
9278 You can have files larger than 2 gigabytes.
9279 EOM
9280    val="$define" ;;
9281 *)    case "$uselargefiles" in
9282    "$undef"|false|[nN]*) dflt='n' ;;
9283    *)   dflt='y' ;;
9284    esac
9285    cat <<EOM
9286
9287 Perl can be built to understand large files (files larger than 2 gigabytes)
9288 on some systems.  To do so, Configure can be run with -Duselargefiles.
9289
9290 If this doesn't make any sense to you, just accept the default '$dflt'.
9291 EOM
9292    rp='Try to understand large files, if available?'
9293    . ./myread
9294    case "$ans" in
9295    y|Y)         val="$define" ;;
9296    *)           val="$undef"  ;;
9297    esac
9298    ;;
9299 esac
9300 set uselargefiles
9301 eval $setvar
9302 : Look for a hint-file generated 'call-back-unit'.  If the
9303 : user has specified that a large files perl is to be built,
9304 : we may need to set or change some other defaults.
9305 if $test -f uselargefiles.cbu; then
9306         echo "Your platform has some specific hints regarding large file builds, using them..."
9307         . ./uselargefiles.cbu
9308 fi
9309 case "$uselargefiles" in
9310 "$define")
9311         if $test -f uselargefiles.cbu; then
9312                 echo " "
9313                 echo "Rechecking to see how big your file offsets are..." >&4
9314                 $cat >try.c <<EOCP
9315 #include <sys/types.h>
9316 #include <stdio.h>
9317 int main()
9318 {
9319     printf("%d\n", (int)sizeof($lseektype));
9320     return(0);
9321 }
9322 EOCP
9323                 set try
9324                 if eval $compile_ok; then
9325                         lseeksize=`$run ./try`
9326                         $echo "Your file offsets are now $lseeksize bytes long."
9327                 else
9328                         dflt="$lseeksize"
9329                         echo " "
9330                         echo "(I can't seem to compile the test program.  Guessing...)"
9331                         rp="What is the size of your file offsets (in bytes)?"
9332                         . ./myread
9333                         lseeksize="$ans"
9334                 fi
9335                 case "$fpostype" in
9336                 *_t) zzz="$fpostype"    ;;
9337                 *)   zzz="fpos_t"       ;;
9338                 esac
9339                 $echo $n "Rechecking the size of $zzz...$c" >&4
9340                 $cat > try.c <<EOCP
9341 #include <sys/types.h>
9342 #include <stdio.h>
9343 #$i_stdlib I_STDLIB
9344 #ifdef I_STDLIB
9345 #include <stdlib.h>
9346 #endif
9347 int main() {
9348     printf("%d\n", (int)sizeof($fpostype));
9349     return(0);
9350 }
9351 EOCP
9352                 set try
9353                 if eval $compile_ok; then
9354                         yyy=`$run ./try`
9355                         dflt="$lseeksize"
9356                         case "$yyy" in
9357                         '')     echo " "
9358                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9359                                 ;;
9360                         *)      fpossize=$yyy
9361                                 echo " $fpossize bytes." >&4
9362                                 ;;
9363                         esac
9364                 else
9365                         dflt="$fpossize"
9366                         echo " "
9367                         echo "(I can't compile the test program.  Guessing...)" >&4
9368                         rp="What is the size of your file positions (in bytes)?"
9369                         . ./myread
9370                         fpossize="$ans"
9371                 fi
9372                 $rm_try
9373         fi
9374         ;;
9375 esac
9376
9377 : Check if we want perlio
9378 useperlio="$define"
9379
9380 : Set the vendorbin variables
9381 case "$vendorprefix" in
9382 '')     d_vendorbin="$undef"
9383         vendorbin=''
9384         vendorbinexp=''
9385         ;;
9386 *)      d_vendorbin="$define"
9387         : determine where vendor-supplied executables go.
9388         case "$vendorbin" in
9389         '') dflt=$vendorprefix/bin ;;
9390         *)      dflt="$vendorbin" ;;
9391         esac
9392         fn=d~+
9393         rp='Pathname for the vendor-supplied executables directory?'
9394         . ./getfile
9395         vendorbin="$ans"
9396         vendorbinexp="$ansexp"
9397         ;;
9398 esac
9399 prefixvar=vendorbin
9400 . ./installprefix
9401
9402 : Set the vendorhtml1dir variables
9403 case "$vendorprefix" in
9404 '')     vendorhtml1dir=''
9405         vendorhtml1direxp=''
9406         ;;
9407 *)      : determine where vendor-supplied html pages go.
9408         : There is no standard location, so try to copy the previously-selected
9409         : directory structure for the core html pages.
9410         : XXX Better default suggestions would be welcome.
9411         case "$vendorhtml1dir" in
9412         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9413         *)      dflt=$vendorhtml1dir ;;
9414         esac
9415         case "$dflt" in
9416         ''|' ') dflt=none ;;
9417         esac
9418         fn=dn+~
9419         rp='Pathname for the vendor-supplied html pages?'
9420         . ./getfile
9421         vendorhtml1dir="$ans"
9422         vendorhtml1direxp="$ansexp"
9423         ;;
9424 esac
9425 : Use ' ' for none so value is preserved next time through Configure
9426 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9427 prefixvar=vendorhtml1dir
9428 . ./installprefix
9429
9430 : Set the vendorhtml3dir variables
9431 case "$vendorprefix" in
9432 '')     vendorhtml3dir=''
9433         vendorhtml3direxp=''
9434         ;;
9435 *)      : determine where vendor-supplied module html pages go.
9436         : There is no standard location, so try to copy the previously-selected
9437         : directory structure for the core html pages.
9438         : XXX Better default suggestions would be welcome.
9439         case "$vendorhtml3dir" in
9440         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9441         *)      dflt=$vendorhtml3dir ;;
9442         esac
9443         case "$dflt" in
9444         ''|' ') dflt=none ;;
9445         esac
9446         fn=dn+~
9447         rp='Pathname for the vendor-supplied html pages?'
9448         . ./getfile
9449         vendorhtml3dir="$ans"
9450         vendorhtml3direxp="$ansexp"
9451         ;;
9452 esac
9453 : Use ' ' for none so value is preserved next time through Configure
9454 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9455 prefixvar=vendorhtml3dir
9456 . ./installprefix
9457
9458 : Set the vendorman1dir variables
9459 case "$vendorprefix" in
9460 '')     vendorman1dir=''
9461         vendorman1direxp=''
9462         ;;
9463 *)      : determine where vendor-supplied manual pages go.
9464         case "$vendorman1dir" in
9465         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9466         *)      dflt=$vendorman1dir ;;
9467         esac
9468         case "$dflt" in
9469         ''|' ') dflt=none ;;
9470         esac
9471         fn=nd~+
9472         rp='Pathname for the vendor-supplied manual section 1 pages?'
9473         . ./getfile
9474         vendorman1dir="$ans"
9475         vendorman1direxp="$ansexp"
9476         ;;
9477 esac
9478 : Use ' ' for none so value is preserved next time through Configure
9479 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9480 prefixvar=vendorman1dir
9481 . ./installprefix
9482
9483 : Set the vendorman3dir variables
9484 case "$vendorprefix" in
9485 '')     vendorman3dir=''
9486         vendorman3direxp=''
9487         ;;
9488 *)      : determine where vendor-supplied module manual pages go.
9489         case "$vendorman3dir" in
9490         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9491         *)      dflt=$vendorman3dir ;;
9492         esac
9493         case "$dflt" in
9494         ''|' ') dflt=none ;;
9495         esac
9496         fn=nd~+
9497         rp='Pathname for the vendor-supplied manual section 3 pages?'
9498         . ./getfile
9499         vendorman3dir="$ans"
9500         vendorman3direxp="$ansexp"
9501         ;;
9502 esac
9503 : Use ' ' for none so value is preserved next time through Configure
9504 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9505 prefixvar=vendorman3dir
9506 . ./installprefix
9507
9508 : Set the vendorscript variables
9509 case "$vendorprefix" in
9510 '')     d_vendorscript="$undef"
9511         vendorscript=''
9512         vendorscriptexp=''
9513         ;;
9514 *)      d_vendorscript="$define"
9515         : determine where vendor-supplied scripts go.
9516         case "$vendorscript" in
9517         '')     dflt=$vendorprefix/script
9518                 $test -d $dflt || dflt=$vendorbin ;;
9519         *)  dflt="$vendorscript" ;;
9520         esac
9521         $cat <<EOM
9522
9523 The installation process will create a directory for
9524 vendor-supplied scripts.
9525
9526 EOM
9527         fn=d~+
9528         rp='Pathname for the vendor-supplied scripts directory?'
9529         . ./getfile
9530         vendorscript="$ans"
9531         vendorscriptexp="$ansexp"
9532         ;;
9533 esac
9534 prefixvar=vendorscript
9535 . ./installprefix
9536
9537 : script used to emit important warnings
9538 cat >warn <<EOS
9539 $startsh
9540 if test \$# -gt 0; then
9541         echo "\$@" >msg
9542 else
9543         cat >msg
9544 fi
9545 echo "*** WARNING:" >&4
9546 sed -e 's/^/*** /' <msg >&4
9547 echo "*** " >&4
9548 cat msg >>config.msg
9549 echo " " >>config.msg
9550 rm -f msg
9551 EOS
9552 chmod +x warn
9553 $eunicefix warn
9554
9555 : see which of string.h or strings.h is needed
9556 echo " "
9557 strings=`./findhdr string.h`
9558 if $test "$strings" && $test -r "$strings"; then
9559         echo "Using <string.h> instead of <strings.h>." >&4
9560         val="$define"
9561 else
9562         val="$undef"
9563         strings=`./findhdr strings.h`
9564         if $test "$strings" && $test -r "$strings"; then
9565                 echo "Using <strings.h> instead of <string.h>." >&4
9566         else
9567                 ./warn "No string header found -- You'll surely have problems."
9568         fi
9569 fi
9570 set i_string
9571 eval $setvar
9572 case "$i_string" in
9573 "$undef") strings=`./findhdr strings.h`;;
9574 *)        strings=`./findhdr string.h`;;
9575 esac
9576
9577 : see if qgcvt exists
9578 set qgcvt d_qgcvt
9579 eval $inlibc
9580
9581 : Check print/scan long double stuff
9582 echo " "
9583
9584 if $test X"$d_longdbl" = X"$define"; then
9585
9586 echo "Checking how to print long doubles..." >&4
9587
9588 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9589         $cat >try.c <<'EOCP'
9590 #include <sys/types.h>
9591 #include <stdio.h>
9592 int main() {
9593   double d = 123.456;
9594   printf("%.3f\n", d);
9595 }
9596 EOCP
9597         set try
9598         if eval $compile; then
9599                 yyy=`$run ./try`
9600                 case "$yyy" in
9601                 123.456)
9602                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9603                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9604                         echo "We will use %f."
9605                         ;;
9606                 esac
9607         fi
9608 fi
9609
9610 if $test X"$sPRIfldbl" = X; then
9611         $cat >try.c <<'EOCP'
9612 #include <sys/types.h>
9613 #include <stdio.h>
9614 int main() {
9615   long double d = 123.456;
9616   printf("%.3Lf\n", d);
9617 }
9618 EOCP
9619         set try
9620         if eval $compile; then
9621                 yyy=`$run ./try`
9622                 case "$yyy" in
9623                 123.456)
9624                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9625                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9626                         echo "We will use %Lf."
9627                         ;;
9628                 esac
9629         fi
9630 fi
9631
9632 if $test X"$sPRIfldbl" = X; then
9633         $cat >try.c <<'EOCP'
9634 #include <sys/types.h>
9635 #include <stdio.h>
9636 int main() {
9637   long double d = 123.456;
9638   printf("%.3llf\n", d);
9639 }
9640 EOCP
9641         set try
9642         if eval $compile; then
9643                 yyy=`$run ./try`
9644                 case "$yyy" in
9645                 123.456)
9646                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9647                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9648                         echo "We will use %llf."
9649                         ;;
9650                 esac
9651         fi
9652 fi
9653
9654 if $test X"$sPRIfldbl" = X; then
9655         $cat >try.c <<'EOCP'
9656 #include <sys/types.h>
9657 #include <stdio.h>
9658 int main() {
9659   long double d = 123.456;
9660   printf("%.3lf\n", d);
9661 }
9662 EOCP
9663         set try
9664         if eval $compile; then
9665                 yyy=`$run ./try`
9666                 case "$yyy" in
9667                 123.456)
9668                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9669                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9670                         echo "We will use %lf."
9671                         ;;
9672                 esac
9673         fi
9674 fi
9675
9676 if $test X"$sPRIfldbl" = X; then
9677         echo "Cannot figure out how to print long doubles." >&4
9678 else
9679         sSCNfldbl=$sPRIfldbl    # expect consistency
9680 fi
9681
9682 $rm_try
9683
9684 fi # d_longdbl
9685
9686 case "$sPRIfldbl" in
9687 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9688         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9689         d_SCNfldbl="$undef";
9690         ;;
9691 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9692         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9693         d_SCNfldbl="$define";
9694         ;;
9695 esac
9696
9697 : Check how to convert floats to strings.
9698
9699 if test "X$d_Gconvert" = X; then
9700
9701 echo " "
9702 echo "Checking for an efficient way to convert floats to strings."
9703 echo " " > try.c
9704 case "$uselongdouble" in
9705 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9706 esac
9707 case "$d_longdbl" in
9708 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9709 esac
9710 case "$d_PRIgldbl" in
9711 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9712 esac
9713 $cat >>try.c <<EOP
9714 #ifdef TRY_gconvert
9715 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9716 char *myname = "gconvert";
9717 #endif
9718 #ifdef TRY_gcvt
9719 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9720 char *myname = "gcvt";
9721 #endif
9722 #ifdef TRY_qgcvt
9723 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9724 char *myname = "qgcvt";
9725 #define DOUBLETYPE long double
9726 #endif
9727 #ifdef TRY_sprintf
9728 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9729 #ifdef HAS_PRIgldbl
9730 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9731 #else
9732 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9733 #endif
9734 #else
9735 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9736 #endif
9737 char *myname = "sprintf";
9738 #endif
9739
9740 #ifndef DOUBLETYPE
9741 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9742 #define DOUBLETYPE long double
9743 #else
9744 #define DOUBLETYPE double
9745 #endif
9746 #endif
9747
9748 #include <stdio.h>
9749
9750 #$i_stdlib I_STDLIB
9751 #ifdef I_STDLIB
9752 #include <stdlib.h>
9753 #endif
9754 #$i_string I_STRING
9755 #ifdef I_STRING
9756 #  include <string.h>
9757 #else
9758 #  include <strings.h>
9759 #endif
9760
9761 int checkit(char *expect, char *got)
9762 {
9763     if (strcmp(expect, got)) {
9764                 printf("%s oddity:  Expected %s, got %s\n",
9765                         myname, expect, got);
9766                 exit(1);
9767         }
9768 }
9769
9770 int main()
9771 {
9772         char buf[64];
9773         buf[63] = '\0';
9774
9775         /* This must be 1st test on (which?) platform */
9776         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9777         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9778         checkit("0.1", buf);
9779
9780         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9781         checkit("0.01", buf);
9782
9783         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9784         checkit("0.001", buf);
9785
9786         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9787         checkit("0.0001", buf);
9788
9789         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9790         if (strlen(buf) > 5)
9791             checkit("9e-005", buf); /* for Microsoft ?? */
9792         else
9793             checkit("9e-05", buf);
9794
9795         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9796         checkit("1", buf);
9797
9798         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9799         checkit("1.1", buf);
9800
9801         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9802         checkit("1.01", buf);
9803
9804         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9805         checkit("1.001", buf);
9806
9807         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9808         checkit("1.0001", buf);
9809
9810         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9811         checkit("1.00001", buf);
9812
9813         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9814         checkit("1.000001", buf);
9815
9816         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9817         checkit("0", buf);
9818
9819         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9820         checkit("-1", buf);
9821
9822         /* Some Linux gcvt's give 1.e+5 here. */
9823         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9824         checkit("100000", buf);
9825
9826         /* Some Linux gcvt's give -1.e+5 here. */
9827         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9828         checkit("-100000", buf);
9829
9830         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9831         checkit("123.456", buf);
9832
9833         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9834         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9835         /* 34 should be enough to scare even long double
9836          * places into using the e notation. */
9837         if (strlen(buf) > 5)
9838             checkit("1e+034", buf); /* for Microsoft */
9839         else
9840             checkit("1e+34", buf);
9841
9842         /* For Perl, if you add additional tests here, also add them to
9843          * t/base/num.t for benefit of platforms not using Configure or
9844          * overriding d_Gconvert */
9845
9846         exit(0);
9847 }
9848 EOP
9849 : first add preferred functions to our list
9850 xxx_list=""
9851 for xxx_convert in $gconvert_preference; do
9852     case $xxx_convert in
9853     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9854     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9855     esac
9856 done
9857 : then add any others
9858 for xxx_convert in gconvert gcvt sprintf; do
9859     case "$xxx_list" in
9860     *$xxx_convert*) ;;
9861     *) xxx_list="$xxx_list $xxx_convert" ;;
9862     esac
9863 done
9864
9865 case "$d_longdbl$uselongdouble" in
9866 "$define$define")
9867     : again, add preferred functions to our list first
9868     xxx_ld_list=""
9869     for xxx_convert in $gconvert_ld_preference; do
9870         case $xxx_convert in
9871         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9872         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9873         esac
9874     done
9875     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9876     for xxx_convert in qgcvt sprintf $xxx_list; do
9877         case "$xxx_ld_list" in
9878         $xxx_convert*|*" $xxx_convert"*) ;;
9879         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9880         esac
9881     done
9882     : if sprintf cannot do long doubles, move it to the end
9883     if test "$d_PRIgldbl" != "$define"; then
9884         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9885     fi
9886     : if no qgcvt, remove it
9887     if test "$d_qgcvt" != "$define"; then
9888         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9889     fi
9890     : use the ld_list
9891     xxx_list="$xxx_ld_list"
9892     ;;
9893 esac
9894
9895 for xxx_convert in $xxx_list; do
9896         echo "Trying $xxx_convert..."
9897         $rm -f try try$_o core
9898         set try -DTRY_$xxx_convert
9899         if eval $compile; then
9900                 echo "$xxx_convert() found." >&4
9901                 if $run ./try; then
9902                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9903                         break;
9904                 else
9905                         echo "...But $xxx_convert didn't work as I expected."
9906                         xxx_convert=''
9907                 fi
9908         else
9909                 echo "$xxx_convert NOT found." >&4
9910         fi
9911 done
9912
9913 if test X$xxx_convert = X; then
9914     echo "*** WHOA THERE!!! ***" >&4
9915     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9916     xxx_convert=sprintf
9917 fi
9918
9919 case "$xxx_convert" in
9920 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9921 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9922 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9923 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9924    "$define$define$define")
9925       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9926    "$define$define$undef")
9927       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9928    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9929    esac
9930    ;;
9931 esac
9932
9933 fi
9934 $rm_try
9935
9936 : see if _fwalk exists
9937 set fwalk d__fwalk
9938 eval $inlibc
9939
9940 : Initialize h_fcntl
9941 h_fcntl=false
9942
9943 : Initialize h_sysfile
9944 h_sysfile=false
9945
9946 : access call always available on UNIX
9947 set access d_access
9948 eval $inlibc
9949
9950 : locate the flags for 'access()'
9951 case "$d_access" in
9952 "$define")
9953         echo " "
9954         $cat >access.c <<EOCP
9955 #include <sys/types.h>
9956 #ifdef I_FCNTL
9957 #include <fcntl.h>
9958 #endif
9959 #ifdef I_SYS_FILE
9960 #include <sys/file.h>
9961 #endif
9962 #ifdef I_UNISTD
9963 #include <unistd.h>
9964 #endif
9965 #$i_stdlib I_STDLIB
9966 #ifdef I_STDLIB
9967 #include <stdlib.h>
9968 #endif
9969 int main() {
9970         exit(R_OK);
9971 }
9972 EOCP
9973         : check sys/file.h first, no particular reason here
9974         if $test `./findhdr sys/file.h` && \
9975                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9976                 h_sysfile=true;
9977                 echo "<sys/file.h> defines the *_OK access constants." >&4
9978         elif $test `./findhdr fcntl.h` && \
9979                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9980                 h_fcntl=true;
9981                 echo "<fcntl.h> defines the *_OK access constants." >&4
9982         elif $test `./findhdr unistd.h` && \
9983                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9984                 echo "<unistd.h> defines the *_OK access constants." >&4
9985         else
9986                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9987         fi
9988         ;;
9989 esac
9990 $rm -f access*
9991
9992 : see if accessx exists
9993 set accessx d_accessx
9994 eval $inlibc
9995
9996 : see if aintl exists
9997 set aintl d_aintl
9998 eval $inlibc
9999
10000 : see if alarm exists
10001 set alarm d_alarm
10002 eval $inlibc
10003
10004 : see if 64bit time functions exists
10005
10006 set ctime64 d_ctime64
10007 eval $inlibc
10008
10009 set localtime64 d_localtime64
10010 eval $inlibc
10011
10012 set gmtime64 d_gmtime64
10013 eval $inlibc
10014
10015 set mktime64 d_mktime64
10016 eval $inlibc
10017
10018 set difftime64 d_difftime64
10019 eval $inlibc
10020
10021 set asctime64 d_asctime64
10022 eval $inlibc
10023
10024 : see if POSIX threads are available
10025 set pthread.h i_pthread
10026 eval $inhdr
10027
10028 : define a function to check prototypes
10029 $cat > protochk <<EOSH
10030 $startsh
10031 cc="$cc"
10032 optimize="$optimize"
10033 ccflags="$ccflags"
10034 prototype="$prototype"
10035 define="$define"
10036 rm_try="$rm_try"
10037 usethreads=$usethreads
10038 i_pthread=$i_pthread
10039 pthread_h_first=$pthread_h_first
10040 EOSH
10041
10042 $cat >> protochk <<'EOSH'
10043
10044 $rm_try
10045 foo="$1"
10046 shift
10047 while test $# -ge 2; do
10048         case "$1" in
10049                 $define) echo "#include <$2>" >> try.c ;;
10050                 literal) echo "$2" >> try.c ;;
10051         esac
10052     # Extra magic for the benefit of systems that need pthread.h
10053     # to be included early to correctly detect threadsafe functions.
10054     # Such functions must guarantee themselves, though, that the usethreads
10055     # and i_pthread have been defined, before calling protochk.
10056     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10057         echo "#include <pthread.h>" >> try.c
10058         pthread_h_done=yes
10059     fi
10060     shift 2
10061 done
10062 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10063 cat >> try.c <<'EOCP'
10064 #ifdef CAN_PROTOTYPE
10065 #define _(args) args
10066 #else
10067 #define _(args) ()
10068 #endif
10069 EOCP
10070 echo "$foo" >> try.c
10071 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10072 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10073 status=$?
10074 $rm_try
10075 exit $status
10076 EOSH
10077 chmod +x protochk
10078 $eunicefix protochk
10079
10080 : Define hasproto macro for Configure internal use
10081 hasproto='varname=$1; func=$2; shift; shift;
10082 while $test $# -ge 2; do
10083         case "$1" in
10084         $define) echo "#include <$2>";;
10085         esac ;
10086     shift 2;
10087 done > try.c;
10088 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10089 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10090         echo "$func() prototype found.";
10091         val="$define";
10092 else
10093         echo "$func() prototype NOT found.";
10094         val="$undef";
10095 fi;
10096 set $varname;
10097 eval $setvar;
10098 $rm_try tryout.c'
10099
10100 : see if sys/types.h has to be included
10101 set sys/types.h i_systypes
10102 eval $inhdr
10103
10104 : see if sys/select.h has to be included
10105 set sys/select.h i_sysselct
10106 eval $inhdr
10107
10108 : Define hasfield macro for Configure internal use
10109 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10110 while $test $# -ge 2; do
10111         case "$1" in
10112         $define) echo "#include <$2>";;
10113         esac ;
10114     shift 2;
10115 done > try.c;
10116 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10117 set try;
10118 if eval $compile; then
10119         val="$define";
10120 else
10121         val="$undef";
10122 fi;
10123 set $varname;
10124 eval $setvar;
10125 $rm_try'
10126
10127 : see if we should include time.h, sys/time.h, or both
10128 echo " "
10129 if test "X$timeincl" = X; then
10130         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10131         $echo $n "I'm now running the test program...$c"
10132         $cat >try.c <<EOCP
10133 #include <sys/types.h>
10134 #ifdef I_TIME
10135 #include <time.h>
10136 #endif
10137 #ifdef I_SYSTIME
10138 #ifdef SYSTIMEKERNEL
10139 #define KERNEL
10140 #endif
10141 #include <sys/time.h>
10142 #endif
10143 #ifdef I_SYSSELECT
10144 #include <sys/select.h>
10145 #endif
10146 #$i_stdlib I_STDLIB
10147 #ifdef I_STDLIB
10148 #include <stdlib.h>
10149 #endif
10150 int main()
10151 {
10152         struct tm foo;
10153 #ifdef S_TIMEVAL
10154         struct timeval bar;
10155 #endif
10156 #ifdef S_TIMEZONE
10157         struct timezone tzp;
10158 #endif
10159         if (foo.tm_sec == foo.tm_sec)
10160                 exit(0);
10161 #ifdef S_TIMEVAL
10162         if (bar.tv_sec == bar.tv_sec)
10163                 exit(0);
10164 #endif
10165         exit(1);
10166 }
10167 EOCP
10168         flags=''
10169         for s_timezone in '-DS_TIMEZONE' ''; do
10170         sysselect=''
10171         for s_timeval in '-DS_TIMEVAL' ''; do
10172         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10173         for i_time in '' '-DI_TIME'; do
10174         for i_systime in '-DI_SYSTIME' ''; do
10175                 case "$flags" in
10176                 '') $echo $n ".$c"
10177                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10178                         if eval $compile; then
10179                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10180                                 shift
10181                                 flags="$*"
10182                                 echo " "
10183                                 $echo $n "Succeeded with $flags$c"
10184                         fi
10185                         ;;
10186                 esac
10187         done
10188         done
10189         done
10190         done
10191         done
10192         timeincl=''
10193         echo " "
10194         case "$flags" in
10195         *SYSTIMEKERNEL*) i_systimek="$define"
10196                 timeincl=`./findhdr sys/time.h`
10197                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10198         *) i_systimek="$undef";;
10199         esac
10200         case "$flags" in
10201         *I_TIME*) i_time="$define"
10202                 timeincl=`./findhdr time.h`" $timeincl"
10203                 echo "We'll include <time.h>." >&4;;
10204         *) i_time="$undef";;
10205         esac
10206         case "$flags" in
10207         *I_SYSTIME*) i_systime="$define"
10208                 timeincl=`./findhdr sys/time.h`" $timeincl"
10209                 echo "We'll include <sys/time.h>." >&4;;
10210         *) i_systime="$undef";;
10211         esac
10212         $rm_try
10213 fi
10214 : see if struct tm knows about tm_zone
10215 case "$i_systime$i_time" in
10216 *$define*)
10217         echo " "
10218         echo "Checking to see if your struct tm has tm_zone field..." >&4
10219         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10220         eval $hasfield
10221         ;;
10222 *)      val="$undef"
10223         set d_tm_tm_zone
10224         eval $setvar
10225         ;;
10226 esac
10227 case "$d_tm_tm_zone" in
10228 "$define")      echo "Yes, it does."   ;;
10229 *)              echo "No, it doesn't." ;;
10230 esac
10231 : see if struct tm knows about tm_gmtoff
10232 case "$i_systime$i_time" in
10233 *$define*)
10234         echo " "
10235         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10236         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10237         eval $hasfield
10238         ;;
10239 *)      val="$undef"
10240         set d_tm_tm_gmtoff
10241         eval $setvar
10242         ;;
10243 esac
10244 case "$d_tm_tm_gmtoff" in
10245 "$define")      echo "Yes, it does."   ;;
10246 *)              echo "No, it doesn't." ;;
10247 esac
10248
10249 : see if asctime_r exists
10250 set asctime_r d_asctime_r
10251 eval $inlibc
10252 case "$d_asctime_r" in
10253 "$define")
10254         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10255         case "$d_asctime_r_proto:$usethreads" in
10256         ":define")      d_asctime_r_proto=define
10257                 set d_asctime_r_proto asctime_r $hdrs
10258                 eval $hasproto ;;
10259         *)      ;;
10260         esac
10261         case "$d_asctime_r_proto" in
10262         define)
10263         case "$asctime_r_proto" in
10264         ''|0) try='char* asctime_r(const struct tm*, char*);'
10265         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10266         esac
10267         case "$asctime_r_proto" in
10268         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10269         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10270         esac
10271         case "$asctime_r_proto" in
10272         ''|0) try='int asctime_r(const struct tm*, char*);'
10273         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10274         esac
10275         case "$asctime_r_proto" in
10276         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10277         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10278         esac
10279         case "$asctime_r_proto" in
10280         ''|0)   d_asctime_r=undef
10281                 asctime_r_proto=0
10282                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10283         * )     case "$asctime_r_proto" in
10284                 REENTRANT_PROTO*) ;;
10285                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10286                 esac
10287                 echo "Prototype: $try" ;;
10288         esac
10289         ;;
10290         *)      case "$usethreads" in
10291                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10292                 esac
10293                 d_asctime_r=undef
10294                 asctime_r_proto=0
10295                 ;;
10296         esac
10297         ;;
10298 *)      asctime_r_proto=0
10299         ;;
10300 esac
10301
10302 : see if atolf exists
10303 set atolf d_atolf
10304 eval $inlibc
10305
10306 : see if atoll exists
10307 set atoll d_atoll
10308 eval $inlibc
10309
10310 : Look for GCC-style attribute format
10311 case "$d_attribute_format" in
10312 '')
10313 echo " "
10314 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10315 $cat >attrib.c <<'EOCP'
10316 #include <stdio.h>
10317 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10318 EOCP
10319 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10320         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10321                 echo "Your C compiler doesn't support __attribute__((format))."
10322                 val="$undef"
10323         else
10324                 echo "Your C compiler supports __attribute__((format))."
10325                 val="$define"
10326         fi
10327 else
10328         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10329         val="$undef"
10330 fi
10331 ;;
10332 *) val="$d_attribute_format" ;;
10333 esac
10334 set d_attribute_format
10335 eval $setvar
10336 $rm -f attrib*
10337
10338 : Look for GCC-style attribute format with null format allowed
10339 case "$d_printf_format_null" in
10340 '') case "$d_attribute_format" in
10341     $define)
10342         echo " "
10343         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10344 $cat >attrib.c <<EOCP
10345 #include <stdio.h>
10346 #$i_stdlib I_STDLIB
10347 #ifdef I_STDLIB
10348 #include <stdlib.h>
10349 #endif
10350 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10351 int null_printf (char* pat,...) { return (int)pat; }
10352 int main () { exit(null_printf(NULL)); }
10353 EOCP
10354         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10355             : run the executable in case it produces a run-time warning
10356             if $run ./attrib >>attrib.out 2>&1; then
10357                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10358                     echo "Your C compiler doesn't allow __printf__ format to be null."
10359                     val="$undef"
10360                 else
10361                     echo "Your C compiler allows __printf__ format to be null."
10362                     val="$define"
10363                 fi
10364             else
10365             echo "Your C compiler executable failed with __printf__ format null."
10366             val="$undef"
10367         fi
10368     else
10369         echo "Your C compiler fails with __printf__ format null."
10370         val="$undef"
10371     fi
10372     ;;
10373     *)  val="$undef" ;;
10374     esac
10375 ;;
10376 *)  val="$d_printf_format_null" ;;
10377 esac
10378 set d_printf_format_null
10379 eval $setvar
10380 $rm -f attrib*
10381
10382 : Look for GCC-style attribute malloc
10383 case "$d_attribute_malloc" in
10384 '')
10385 echo " "
10386 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10387 $cat >attrib.c <<'EOCP'
10388 #include <stdio.h>
10389 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10390 EOCP
10391 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10392         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10393                 echo "Your C compiler doesn't support __attribute__((malloc))."
10394                 val="$undef"
10395         else
10396                 echo "Your C compiler supports __attribute__((malloc))."
10397                 val="$define"
10398         fi
10399 else
10400         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10401         val="$undef"
10402 fi
10403 ;;
10404 *) val="$d_attribute_malloc" ;;
10405 esac
10406 set d_attribute_malloc
10407 eval $setvar
10408 $rm -f attrib*
10409
10410 : Look for GCC-style attribute nonnull
10411 case "$d_attribute_nonnull" in
10412 '')
10413 echo " "
10414 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10415 $cat >attrib.c <<'EOCP'
10416 #include <stdio.h>
10417 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10418 EOCP
10419 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10420         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10421                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10422                 val="$undef"
10423         else
10424                 echo "Your C compiler supports __attribute__((nonnull))."
10425                 val="$define"
10426         fi
10427 else
10428         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10429         val="$undef"
10430 fi
10431 ;;
10432 *) val="$d_attribute_nonnull" ;;
10433 esac
10434 set d_attribute_nonnull
10435 eval $setvar
10436 $rm -f attrib*
10437
10438 : Look for GCC-style attribute noreturn
10439 case "$d_attribute_noreturn" in
10440 '')
10441 echo " "
10442 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10443 $cat >attrib.c <<'EOCP'
10444 #include <stdio.h>
10445 void fall_over_dead( void ) __attribute__((noreturn));
10446 EOCP
10447 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10448         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10449                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10450                 val="$undef"
10451         else
10452                 echo "Your C compiler supports __attribute__((noreturn))."
10453                 val="$define"
10454         fi
10455 else
10456         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10457         val="$undef"
10458 fi
10459 ;;
10460 *) val="$d_attribute_noreturn" ;;
10461 esac
10462 set d_attribute_noreturn
10463 eval $setvar
10464 $rm -f attrib*
10465
10466 : Look for GCC-style attribute pure
10467 case "$d_attribute_pure" in
10468 '')
10469 echo " "
10470 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10471 $cat >attrib.c <<'EOCP'
10472 #include <stdio.h>
10473 int square( int n ) __attribute__((pure));
10474 EOCP
10475 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10476         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10477                 echo "Your C compiler doesn't support __attribute__((pure))."
10478                 val="$undef"
10479         else
10480                 echo "Your C compiler supports __attribute__((pure))."
10481                 val="$define"
10482         fi
10483 else
10484         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10485         val="$undef"
10486 fi
10487 ;;
10488 *) val="$d_attribute_pure" ;;
10489 esac
10490 set d_attribute_pure
10491 eval $setvar
10492 $rm -f attrib*
10493
10494 : Look for GCC-style attribute unused
10495 case "$d_attribute_unused" in
10496 '')
10497 echo " "
10498 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10499 $cat >attrib.c <<'EOCP'
10500 #include <stdio.h>
10501 int do_something( int dummy __attribute__((unused)), int n );
10502 EOCP
10503 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10504         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10505                 echo "Your C compiler doesn't support __attribute__((unused))."
10506                 val="$undef"
10507         else
10508                 echo "Your C compiler supports __attribute__((unused))."
10509                 val="$define"
10510         fi
10511 else
10512         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10513         val="$undef"
10514 fi
10515 ;;
10516 *) val="$d_attribute_unused" ;;
10517 esac
10518 set d_attribute_unused
10519 eval $setvar
10520 $rm -f attrib*
10521
10522 : Look for GCC-style attribute deprecated
10523 case "$d_attribute_deprecated" in
10524 '')
10525 echo " "
10526 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10527 $cat >attrib.c <<'EOCP'
10528 #include <stdio.h>
10529 int I_am_deprecated(void) __attribute__((deprecated));
10530 EOCP
10531 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10532         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10533                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10534                 val="$undef"
10535         else
10536                 echo "Your C compiler supports __attribute__((deprecated))."
10537                 val="$define"
10538         fi
10539 else
10540         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10541         val="$undef"
10542 fi
10543 ;;
10544 *) val="$d_attribute_deprecated" ;;
10545 esac
10546 set d_attribute_deprecated
10547 eval $setvar
10548 $rm -f attrib*
10549
10550 : Look for GCC-style attribute warn_unused_result
10551 case "$d_attribute_warn_unused_result" in
10552 '')
10553 echo " "
10554 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10555 $cat >attrib.c <<'EOCP'
10556 #include <stdio.h>
10557 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10558 EOCP
10559 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10560         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10561                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10562                 val="$undef"
10563         else
10564                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10565                 val="$define"
10566         fi
10567 else
10568         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10569         val="$undef"
10570 fi
10571 ;;
10572 *) val="$d_attribute_warn_unused_result" ;;
10573 esac
10574 set d_attribute_warn_unused_result
10575 eval $setvar
10576 $rm -f attrib*
10577
10578 : see if bcmp exists
10579 set bcmp d_bcmp
10580 eval $inlibc
10581
10582 : see if bcopy exists
10583 set bcopy d_bcopy
10584 eval $inlibc
10585
10586 : see if getpgrp exists
10587 set getpgrp d_getpgrp
10588 eval $inlibc
10589
10590 case "$d_getpgrp" in
10591 "$define")
10592         echo " "
10593         echo "Checking to see which flavor of getpgrp is in use..."
10594         $cat >try.c <<EOP
10595 #$i_unistd I_UNISTD
10596 #include <sys/types.h>
10597 #ifdef I_UNISTD
10598 #  include <unistd.h>
10599 #endif
10600 #$i_stdlib I_STDLIB
10601 #ifdef I_STDLIB
10602 #include <stdlib.h>
10603 #endif
10604 int main()
10605 {
10606         if (getuid() == 0) {
10607                 printf("(I see you are running Configure as super-user...)\n");
10608                 setuid(1);
10609         }
10610 #ifdef TRY_BSD_PGRP
10611         if (getpgrp(1) == 0)
10612                 exit(0);
10613 #else
10614         if (getpgrp() > 0)
10615                 exit(0);
10616 #endif
10617         exit(1);
10618 }
10619 EOP
10620         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10621                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10622                 val="$define"
10623         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10624                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10625                 val="$undef"
10626         else
10627                 echo "I can't seem to compile and run the test program."
10628                 if ./usg; then
10629                         xxx="a USG one, i.e. you use getpgrp()."
10630                 else
10631                         # SVR4 systems can appear rather BSD-ish.
10632                         case "$i_unistd" in
10633                         $undef)
10634                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10635                                 val="$define"
10636                                 ;;
10637                         $define)
10638                                 xxx="probably a USG one, i.e. you use getpgrp()."
10639                                 val="$undef"
10640                                 ;;
10641                         esac
10642                 fi
10643                 echo "Assuming your getpgrp is $xxx" >&4
10644         fi
10645         ;;
10646 *) val="$undef";;
10647 esac
10648 set d_bsdgetpgrp
10649 eval $setvar
10650 $rm_try
10651
10652 : see if setpgrp exists
10653 set setpgrp d_setpgrp
10654 eval $inlibc
10655
10656 case "$d_setpgrp" in
10657 "$define")
10658         echo " "
10659         echo "Checking to see which flavor of setpgrp is in use..."
10660         $cat >try.c <<EOP
10661 #$i_unistd I_UNISTD
10662 #include <sys/types.h>
10663 #ifdef I_UNISTD
10664 #  include <unistd.h>
10665 #endif
10666 #$i_stdlib I_STDLIB
10667 #ifdef I_STDLIB
10668 #include <stdlib.h>
10669 #endif
10670 int main()
10671 {
10672         if (getuid() == 0) {
10673                 printf("(I see you are running Configure as super-user...)\n");
10674                 setuid(1);
10675         }
10676 #ifdef TRY_BSD_PGRP
10677         if (-1 == setpgrp(1, 1))
10678                 exit(0);
10679 #else
10680         if (setpgrp() != -1)
10681                 exit(0);
10682 #endif
10683         exit(1);
10684 }
10685 EOP
10686         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10687                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10688                 val="$define"
10689         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10690                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10691                 val="$undef"
10692         else
10693                 echo "(I can't seem to compile and run the test program.)"
10694                 if ./usg; then
10695                         xxx="a USG one, i.e. you use setpgrp()."
10696                 else
10697                         # SVR4 systems can appear rather BSD-ish.
10698                         case "$i_unistd" in
10699                         $undef)
10700                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10701                                 val="$define"
10702                                 ;;
10703                         $define)
10704                                 xxx="probably a USG one, i.e. you use setpgrp()."
10705                                 val="$undef"
10706                                 ;;
10707                         esac
10708                 fi
10709                 echo "Assuming your setpgrp is $xxx" >&4
10710         fi
10711         ;;
10712 *) val="$undef";;
10713 esac
10714 set d_bsdsetpgrp
10715 eval $setvar
10716 $rm_try
10717
10718 : Look for GCC-style __builtin_choose_expr
10719 case "$d_builtin_choose_expr" in
10720 '')
10721     echo " "
10722     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10723     $cat >try.c <<'EOCP'
10724 #include <assert.h>
10725 #include <stdlib.h>
10726 #include <stdio.h>
10727
10728 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10729
10730 int main(void) {
10731     assert( SYRINX(1) == 2112 );
10732     assert( SYRINX(1) != 5150 );
10733     assert( SYRINX(0) == 5150 );
10734     assert( SYRINX(0) != 2112 );
10735     puts( "All good!" );
10736     exit(0);
10737 }
10738
10739 EOCP
10740     set try
10741     if eval $compile && $run ./try; then
10742         echo "Your C compiler supports __builtin_choose_expr."
10743         val="$define"
10744     else
10745         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10746         val="$undef"
10747     fi
10748 ;;
10749 *) val="$d_builtin_choose_expr" ;;
10750 esac
10751
10752 set d_builtin_choose_expr
10753 eval $setvar
10754 $rm_try
10755
10756 : Look for GCC-style __builtin_expect
10757 case "$d_builtin_expect" in
10758 '')
10759     echo " "
10760     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10761     $cat >try.c <<'EOCP'
10762 int main(void) {
10763     int n = 50;
10764     if ( __builtin_expect(n, 0) ) n = 1;
10765     /* Remember shell exit code truth is 0, C truth is non-zero */
10766     return !(n == 1);
10767 }
10768 EOCP
10769     set try
10770     if eval $compile && $run ./try; then
10771         echo "Your C compiler supports __builtin_expect."
10772         val="$define"
10773     else
10774         echo "Your C compiler doesn't seem to understand __builtin_expect."
10775         val="$undef"
10776     fi
10777     ;;
10778 *) val="$d_builtin_expect" ;;
10779 esac
10780
10781 set d_builtin_expect
10782 eval $setvar
10783 $rm_try
10784
10785 : see if bzero exists
10786 set bzero d_bzero
10787 eval $inlibc
10788
10789 : see if stdarg is available
10790 echo " "
10791 if $test `./findhdr stdarg.h`; then
10792         echo "<stdarg.h> found." >&4
10793         valstd="$define"
10794 else
10795         echo "<stdarg.h> NOT found." >&4
10796         valstd="$undef"
10797 fi
10798
10799 : see if varags is available
10800 echo " "
10801 if $test `./findhdr varargs.h`; then
10802         echo "<varargs.h> found." >&4
10803 else
10804         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10805 fi
10806
10807 : set up the varargs testing programs
10808 $cat > varargs.c <<EOP
10809 #ifdef I_STDARG
10810 #include <stdarg.h>
10811 #endif
10812 #ifdef I_VARARGS
10813 #include <varargs.h>
10814 #endif
10815
10816 #ifdef I_STDARG
10817 int f(char *p, ...)
10818 #else
10819 int f(va_alist)
10820 va_dcl
10821 #endif
10822 {
10823         va_list ap;
10824 #ifndef I_STDARG
10825         char *p;
10826 #endif
10827 #ifdef I_STDARG
10828         va_start(ap,p);
10829 #else
10830         va_start(ap);
10831         p = va_arg(ap, char *);
10832 #endif
10833         va_end(ap);
10834         return 0;
10835 }
10836 EOP
10837 $cat > varargs <<EOP
10838 $startsh
10839 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10840         echo "true"
10841 else
10842         echo "false"
10843 fi
10844 $rm -f varargs$_o
10845 EOP
10846 chmod +x varargs
10847
10848 : now check which varargs header should be included
10849 echo " "
10850 i_varhdr=''
10851 case "$valstd" in
10852 "$define")
10853         if `./varargs I_STDARG`; then
10854                 val='stdarg.h'
10855         elif `./varargs I_VARARGS`; then
10856                 val='varargs.h'
10857         fi
10858         ;;
10859 *)
10860         if `./varargs I_VARARGS`; then
10861                 val='varargs.h'
10862         fi
10863         ;;
10864 esac
10865 case "$val" in
10866 '')
10867 echo "I could not find the definition for va_dcl... You have problems..." >&4
10868         val="$undef"; set i_stdarg; eval $setvar
10869         val="$undef"; set i_varargs; eval $setvar
10870         ;;
10871 *)
10872         set i_varhdr
10873         eval $setvar
10874         case "$i_varhdr" in
10875         stdarg.h)
10876                 val="$define"; set i_stdarg; eval $setvar
10877                 val="$undef"; set i_varargs; eval $setvar
10878                 ;;
10879         varargs.h)
10880                 val="$undef"; set i_stdarg; eval $setvar
10881                 val="$define"; set i_varargs; eval $setvar
10882                 ;;
10883         esac
10884         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10885 esac
10886 $rm -f varargs*
10887
10888 : see if the Compiler supports C99 variadic macros
10889 case "$i_stdarg$i_stdlib" in
10890     "$define$define")
10891     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10892     $cat >try.c <<EOCP
10893 #include <stdio.h>
10894 #include <stdarg.h>
10895
10896 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10897
10898 int main() {
10899   char buf[20];
10900   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10901   puts(buf);
10902   return 0;
10903 }
10904 EOCP
10905     set try
10906     if eval $compile && $run ./try 2>&1 >/dev/null; then
10907         case "`$run ./try`" in
10908             "123 456 789")
10909             echo "You have C99 variadic macros." >&4
10910             d_c99_variadic_macros="$define"
10911             ;;
10912             *)
10913             echo "You don't have functional C99 variadic macros." >&4
10914             d_c99_variadic_macros="$undef"
10915             ;;
10916         esac
10917     else
10918         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10919         d_c99_variadic_macros="$undef"
10920     fi
10921     $rm_try
10922     ;;
10923     *)
10924     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10925     d_c99_variadic_macros="$undef"
10926     ;;
10927 esac
10928
10929 : see if signal is declared as pointer to function returning int or void
10930 echo " "
10931 xxx=`./findhdr signal.h`
10932 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10933 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10934         echo "You have int (*signal())() instead of void." >&4
10935         val="$undef"
10936 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10937         echo "You have void (*signal())()." >&4
10938         val="$define"
10939 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10940         echo "You have int (*signal())() instead of void." >&4
10941         val="$undef"
10942 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10943         echo "You have void (*signal())()." >&4
10944         val="$define"
10945 else
10946         case "$d_voidsig" in
10947         '')
10948         echo "I can't determine whether signal handler returns void or int..." >&4
10949                 dflt=void
10950                 rp="What type does your signal handler return?"
10951                 . ./myread
10952                 case "$ans" in
10953                 v*) val="$define";;
10954                 *) val="$undef";;
10955                 esac;;
10956         "$define")
10957                 echo "As you already told me, signal handler returns void." >&4
10958                 val="$define"
10959                 ;;
10960         *)      echo "As you already told me, signal handler returns int." >&4
10961                 val="$undef"
10962                 ;;
10963         esac
10964 fi
10965 set d_voidsig
10966 eval $setvar
10967 case "$d_voidsig" in
10968 "$define") signal_t="void";;
10969 *) signal_t="int";;
10970 esac
10971 $rm -f $$.tmp
10972
10973 : check for ability to cast large floats to 32-bit ints.
10974 echo " "
10975 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10976 if $test "$intsize" -ge 4; then
10977         xxx=int
10978 else
10979         xxx=long
10980 fi
10981 $cat >try.c <<EOCP
10982 #include <stdio.h>
10983 #$i_stdlib I_STDLIB
10984 #ifdef I_STDLIB
10985 #include <stdlib.h>
10986 #endif
10987 #include <sys/types.h>
10988 #include <signal.h>
10989 $signal_t blech(int s) { exit(3); }
10990 int main()
10991 {
10992         $xxx i32;
10993         double f, g;
10994         int result = 0;
10995         char str[16];
10996         signal(SIGFPE, blech);
10997
10998         /* Don't let compiler optimize the test away.  Store the number
10999            in a writable string for gcc to pass to sscanf under HP-UX.
11000         */
11001         sprintf(str, "2147483647");
11002         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11003         g = 10 * f;
11004         i32  = ($xxx) g;
11005
11006         /* x86 processors will probably give 0x8000 0000, which is a
11007            sign change.  We don't want that.  We want to mimic SPARC
11008            behavior here, which is to preserve the sign and give
11009            back 0x7fff ffff.
11010         */
11011         if (i32 != ($xxx) f)
11012                 result |= 1;
11013         exit(result);
11014 }
11015 EOCP
11016 set try
11017 if eval $compile_ok; then
11018         $run ./try
11019         yyy=$?
11020 else
11021         echo "(I can't seem to compile the test program--assuming it can't)"
11022         yyy=1
11023 fi
11024 case "$yyy" in
11025 0)      val="$define"
11026         echo "Yup, it can."
11027         ;;
11028 *)      val="$undef"
11029         echo "Nope, it can't."
11030         ;;
11031 esac
11032 set d_casti32
11033 eval $setvar
11034 $rm_try
11035
11036 : check for ability to cast negative floats to unsigned
11037 echo " "
11038 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11039 $cat >try.c <<EOCP
11040 #include <stdio.h>
11041 #$i_stdlib I_STDLIB
11042 #ifdef I_STDLIB
11043 #include <stdlib.h>
11044 #endif
11045 #include <sys/types.h>
11046 #include <signal.h>
11047 $signal_t blech(int s) { exit(7); }
11048 $signal_t blech_in_list(int s) { exit(4); }
11049 unsigned long dummy_long(unsigned long p) { return p; }
11050 unsigned int dummy_int(unsigned int p) { return p; }
11051 unsigned short dummy_short(unsigned short p) { return p; }
11052 int main()
11053 {
11054         double f;
11055         unsigned long along;
11056         unsigned int aint;
11057         unsigned short ashort;
11058         int result = 0;
11059         char str[16];
11060
11061         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11062            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11063            optimized the whole file away
11064         */
11065         /* Store the number in a writable string for gcc to pass to
11066            sscanf under HP-UX.
11067         */
11068         sprintf(str, "-123");
11069         sscanf(str, "%lf", &f);  /* f = -123.; */
11070
11071         signal(SIGFPE, blech);
11072         along = (unsigned long)f;
11073         aint = (unsigned int)f;
11074         ashort = (unsigned short)f;
11075         if (along != (unsigned long)-123)
11076                 result |= 1;
11077         if (aint != (unsigned int)-123)
11078                 result |= 1;
11079         if (ashort != (unsigned short)-123)
11080                 result |= 1;
11081         sprintf(str, "1073741824.");
11082         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11083         f = f + f;
11084         along = 0;
11085         along = (unsigned long)f;
11086         if (along != 0x80000000)
11087                 result |= 2;
11088         f -= 1.;
11089         along = 0;
11090         along = (unsigned long)f;
11091         if (along != 0x7fffffff)
11092                 result |= 1;
11093         f += 2.;
11094         along = 0;
11095         along = (unsigned long)f;
11096         if (along != 0x80000001)
11097                 result |= 2;
11098         if (result)
11099                 exit(result);
11100         signal(SIGFPE, blech_in_list);
11101         sprintf(str, "123.");
11102         sscanf(str, "%lf", &f);  /* f = 123.; */
11103         along = dummy_long((unsigned long)f);
11104         aint = dummy_int((unsigned int)f);
11105         ashort = dummy_short((unsigned short)f);
11106         if (along != (unsigned long)123)
11107                 result |= 4;
11108         if (aint != (unsigned int)123)
11109                 result |= 4;
11110         if (ashort != (unsigned short)123)
11111                 result |= 4;
11112         exit(result);
11113
11114 }
11115 EOCP
11116 set try
11117 if eval $compile_ok; then
11118         $run ./try
11119         castflags=$?
11120 else
11121         echo "(I can't seem to compile the test program--assuming it can't)"
11122         castflags=7
11123 fi
11124 case "$castflags" in
11125 0)      val="$define"
11126         echo "Yup, it can."
11127         ;;
11128 *)      val="$undef"
11129         echo "Nope, it can't."
11130         ;;
11131 esac
11132 set d_castneg
11133 eval $setvar
11134 $rm_try
11135
11136 : see if vprintf exists
11137 echo " "
11138 if set vprintf val -f d_vprintf; eval $csym; $val; then
11139         echo 'vprintf() found.' >&4
11140         val="$define"
11141         $cat >try.c <<EOF
11142 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11143 #$i_varargs I_VARARGS
11144
11145 #$i_stdlib I_STDLIB
11146 #$i_unistd I_UNISTD
11147
11148 #ifdef I_STDARG
11149 #  include <stdarg.h>
11150 #else /* I_VARARGS */
11151 #  include <varargs.h>
11152 #endif
11153
11154 #ifdef I_UNISTD
11155 #  include <unistd.h>
11156 #endif
11157
11158 #ifdef I_STDLIB
11159 #  include <stdlib.h>
11160 #endif
11161
11162 #include <stdio.h> /* vsprintf prototype */
11163
11164 #ifdef I_STDARG
11165 void xxx(int n, ...)
11166 {
11167     va_list args;
11168     char buf[10];
11169     va_start(args, n);
11170     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11171 }
11172 int main() { xxx(1, "foo"); }
11173
11174 #else /* I_VARARGS */
11175
11176 xxx(va_alist)
11177 va_dcl
11178 {
11179     va_list args;
11180     char buf[10];
11181     va_start(args);
11182     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11183 }
11184 int main() { xxx("foo"); }
11185
11186 #endif
11187
11188 EOF
11189         set try
11190         if eval $compile_ok; then
11191                 if $run ./try; then
11192                         echo "Your vsprintf() returns (int)." >&4
11193                         val2="$undef"
11194                 else
11195                         echo "Your vsprintf() returns (char*)." >&4
11196                         val2="$define"
11197                 fi
11198         else
11199                 echo 'I am unable to compile the vsprintf() test program.' >&4
11200                 # We shouldn't get here.  If we do, assume the standard signature,
11201                 # not the old BSD one.
11202                 echo 'Guessing that vsprintf() returns (int).' >&4
11203                 val2="$undef"
11204         fi
11205 else
11206         echo 'vprintf() NOT found.' >&4
11207         val="$undef"
11208         val2="$undef"
11209 fi
11210 $rm_try
11211 set d_vprintf
11212 eval $setvar
11213 val=$val2
11214 set d_charvspr
11215 eval $setvar
11216
11217 : see if chown exists
11218 set chown d_chown
11219 eval $inlibc
11220
11221 : see if chroot exists
11222 set chroot d_chroot
11223 eval $inlibc
11224
11225 : see if chsize exists
11226 set chsize d_chsize
11227 eval $inlibc
11228
11229 : see if class exists
11230 set class d_class
11231 eval $inlibc
11232
11233 : see if clearenv exists
11234 set clearenv d_clearenv
11235 eval $inlibc
11236
11237 : Define hasstruct macro for Configure internal use
11238 hasstruct='varname=$1; struct=$2; shift; shift;
11239 while $test $# -ge 2; do
11240         case "$1" in
11241         $define) echo "#include <$2>";;
11242         esac ;
11243     shift 2;
11244 done > try.c;
11245 echo "int main () { struct $struct foo; }" >> try.c;
11246 set try;
11247 if eval $compile; then
11248         val="$define";
11249 else
11250         val="$undef";
11251 fi;
11252 set $varname;
11253 eval $setvar;
11254 $rm_try'
11255
11256 : see whether socket exists
11257 socketlib=''
11258 sockethdr=''
11259 echo " "
11260 $echo $n "Hmm... $c" >&4
11261 if set socket val -f d_socket; eval $csym; $val; then
11262         echo "Looks like you have Berkeley networking support." >&4
11263         d_socket="$define"
11264         if set setsockopt val -f; eval $csym; $val; then
11265                 d_oldsock="$undef"
11266         else
11267                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11268                 d_oldsock="$define"
11269         fi
11270 else
11271         if $contains socklib libc.list >/dev/null 2>&1; then
11272                 echo "Looks like you have Berkeley networking support." >&4
11273                 d_socket="$define"
11274                 : we will have to assume that it supports the 4.2 BSD interface
11275                 d_oldsock="$undef"
11276         else
11277                 echo "You don't have Berkeley networking in libc$_a..." >&4
11278                 if test "X$d_socket" = "X$define"; then
11279                    echo "...but you seem to believe that you have sockets." >&4
11280                 else
11281                         for net in net socket
11282                         do
11283                                 if test -f /usr/lib/lib$net$_a; then
11284                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11285                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11286                                         if $contains socket libc.list >/dev/null 2>&1; then
11287                                                 d_socket="$define"
11288                                                 socketlib="-l$net"
11289                                                 case "$net" in
11290                                                 net)
11291                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11292                                                         sockethdr="-I/usr/netinclude"
11293                                                         ;;
11294                                                 esac
11295                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11296                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11297                                                         d_oldsock="$undef"
11298                                                 else
11299                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11300                                                         d_oldsock="$define"
11301                                                 fi
11302                                                 break
11303                                         fi
11304                                 fi
11305                         done
11306                         if test "X$d_socket" != "X$define"; then
11307                            echo "or anywhere else I see." >&4
11308                            d_socket="$undef"
11309                            d_oldsock="$undef"
11310                         fi
11311                 fi
11312         fi
11313 fi
11314
11315 : see if socketpair exists
11316 set socketpair d_sockpair
11317 eval $inlibc
11318
11319
11320 echo " "
11321 echo "Checking the availability sa_len in the sock struct ..." >&4
11322 $cat >try.c <<EOF
11323 #include <sys/types.h>
11324 #include <sys/socket.h>
11325 int main() {
11326 struct sockaddr sa;
11327 return (sa.sa_len);
11328 }
11329 EOF
11330 val="$undef"
11331 set try; if eval $compile; then
11332         val="$define"
11333 fi
11334 set d_sockaddr_sa_len; eval $setvar
11335 $rm_try
11336
11337 echo " "
11338 echo "Checking the availability struct sockaddr_in6 ..." >&4
11339 $cat >try.c <<EOF
11340 #include <sys/types.h>
11341 #include <sys/socket.h>
11342 #include <netinet/in.h>
11343 int main() {
11344 struct sockaddr_in6 sin6;
11345 return (sin6.sin6_family);
11346 }
11347 EOF
11348 val="$undef"
11349 set try; if eval $compile; then
11350         val="$define"
11351 fi
11352 set d_sockaddr_in6; eval $setvar
11353 $rm_try
11354
11355 echo " "
11356 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11357 $cat >try.c <<EOF
11358 #include <sys/types.h>
11359 #include <sys/socket.h>
11360 #include <netinet/in.h>
11361 int main() {
11362 struct sockaddr_in6 sin6;
11363 return (sin6.sin6_scope_id);
11364 }
11365 EOF
11366 val="$undef"
11367 set try; if eval $compile; then
11368         val="$define"
11369 fi
11370 set d_sin6_scope_id; eval $setvar
11371 $rm_try
11372
11373 echo " "
11374 echo "Checking the availability struct ipv6_mreq ..." >&4
11375 $cat >try.c <<EOF
11376 #include <sys/types.h>
11377 #include <sys/socket.h>
11378 #include <netinet/in.h>
11379 int main() {
11380 struct ipv6_mreq mreq;
11381 return (mreq.ipv6mr_interface);
11382 }
11383 EOF
11384 val="$undef"
11385 set try; if eval $compile; then
11386         val="$define"
11387 fi
11388 set d_ipv6_mreq; eval $setvar
11389 $rm_try
11390
11391 echo " "
11392 echo "Checking the availability of certain socket constants..." >&4
11393 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11394         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11395         $cat >try.c <<EOF
11396 #include <sys/types.h>
11397 #include <sys/socket.h>
11398 int main() {
11399     int i = $ENUM;
11400 }
11401 EOF
11402         val="$undef"
11403         set try; if eval $compile; then
11404                 val="$define"
11405         fi
11406         set d_${enum}; eval $setvar
11407         $rm_try
11408 done
11409
11410 : see if this is a sys/uio.h system
11411 set sys/uio.h i_sysuio
11412 eval $inhdr
11413
11414 : Check for cmsghdr support
11415 echo " "
11416 echo "Checking to see if your system supports struct cmsghdr..." >&4
11417 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11418 eval $hasstruct
11419 case "$d_cmsghdr_s" in
11420 "$define")      echo "Yes, it does."   ;;
11421 *)              echo "No, it doesn't." ;;
11422 esac
11423
11424
11425 : check for const keyword
11426 echo " "
11427 echo 'Checking to see if your C compiler knows about "const"...' >&4
11428 $cat >const.c <<'EOCP'
11429 typedef struct spug { int drokk; } spug;
11430 int main()
11431 {
11432         const char *foo;
11433         const spug y = { 0 };
11434 }
11435 EOCP
11436 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11437         val="$define"
11438         echo "Yup, it does."
11439 else
11440         val="$undef"
11441         echo "Nope, it doesn't."
11442 fi
11443 set d_const
11444 eval $setvar
11445
11446 : see if copysignl exists
11447 set copysignl d_copysignl
11448 eval $inlibc
11449
11450 : see if crypt exists
11451 echo " "
11452 set crypt d_crypt
11453 eval $inlibc
11454 case "$d_crypt" in
11455 $define) cryptlib='' ;;
11456 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11457                 echo 'crypt() found.' >&4
11458                 val="$define"
11459                 cryptlib=''
11460         else
11461                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11462                 if $test -z "$cryptlib"; then
11463                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11464                 else
11465                         cryptlib=-lcrypt
11466                 fi
11467                 if $test -z "$cryptlib"; then
11468                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11469                 else
11470                         cryptlib=-lcrypt
11471                 fi
11472                 if $test -z "$cryptlib"; then
11473                         cryptlib=`./loc libcrypt$_a "" $libpth`
11474                 else
11475                         cryptlib=-lcrypt
11476                 fi
11477                 if $test -z "$cryptlib"; then
11478                         echo 'crypt() NOT found.' >&4
11479                         val="$undef"
11480                 else
11481                         val="$define"
11482                 fi
11483         fi
11484         set d_crypt
11485         eval $setvar
11486         ;;
11487 esac
11488
11489 : see if this is a crypt.h system
11490 set crypt.h i_crypt
11491 eval $inhdr
11492
11493 : see if crypt_r exists
11494 set crypt_r d_crypt_r
11495 eval $inlibc
11496 case "$d_crypt_r" in
11497 "$define")
11498         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11499         case "$d_crypt_r_proto:$usethreads" in
11500         ":define")      d_crypt_r_proto=define
11501                 set d_crypt_r_proto crypt_r $hdrs
11502                 eval $hasproto ;;
11503         *)      ;;
11504         esac
11505         case "$d_crypt_r_proto" in
11506         define)
11507         case "$crypt_r_proto" in
11508         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11509         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11510         esac
11511         case "$crypt_r_proto" in
11512         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11513         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11514         esac
11515         case "$crypt_r_proto" in
11516         ''|0)   d_crypt_r=undef
11517                 crypt_r_proto=0
11518                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11519         * )     case "$crypt_r_proto" in
11520                 REENTRANT_PROTO*) ;;
11521                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11522                 esac
11523                 echo "Prototype: $try" ;;
11524         esac
11525         ;;
11526         *)      case "$usethreads" in
11527                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11528                 esac
11529                 d_crypt_r=undef
11530                 crypt_r_proto=0
11531                 ;;
11532         esac
11533         ;;
11534 *)      crypt_r_proto=0
11535         ;;
11536 esac
11537
11538 : get csh whereabouts
11539 case "$csh" in
11540 'csh') val="$undef" ;;
11541 *) val="$define" ;;
11542 esac
11543 set d_csh
11544 eval $setvar
11545 : Respect a hint or command line value for full_csh.
11546 case "$full_csh" in
11547 '') full_csh=$csh ;;
11548 esac
11549
11550 : see if ctermid exists
11551 set ctermid d_ctermid
11552 eval $inlibc
11553
11554 : see if ctermid_r exists
11555 set ctermid_r d_ctermid_r
11556 eval $inlibc
11557 case "$d_ctermid_r" in
11558 "$define")
11559         hdrs="$i_systypes sys/types.h define stdio.h "
11560         case "$d_ctermid_r_proto:$usethreads" in
11561         ":define")      d_ctermid_r_proto=define
11562                 set d_ctermid_r_proto ctermid_r $hdrs
11563                 eval $hasproto ;;
11564         *)      ;;
11565         esac
11566         case "$d_ctermid_r_proto" in
11567         define)
11568         case "$ctermid_r_proto" in
11569         ''|0) try='char* ctermid_r(char*);'
11570         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11571         esac
11572         case "$ctermid_r_proto" in
11573         ''|0)   d_ctermid_r=undef
11574                 ctermid_r_proto=0
11575                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11576         * )     case "$ctermid_r_proto" in
11577                 REENTRANT_PROTO*) ;;
11578                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11579                 esac
11580                 echo "Prototype: $try" ;;
11581         esac
11582         ;;
11583         *)      case "$usethreads" in
11584                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11585                 esac
11586                 d_ctermid_r=undef
11587                 ctermid_r_proto=0
11588                 ;;
11589         esac
11590         ;;
11591 *)      ctermid_r_proto=0
11592         ;;
11593 esac
11594
11595 : see if ctime_r exists
11596 set ctime_r d_ctime_r
11597 eval $inlibc
11598 case "$d_ctime_r" in
11599 "$define")
11600         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11601         case "$d_ctime_r_proto:$usethreads" in
11602         ":define")      d_ctime_r_proto=define
11603                 set d_ctime_r_proto ctime_r $hdrs
11604                 eval $hasproto ;;
11605         *)      ;;
11606         esac
11607         case "$d_ctime_r_proto" in
11608         define)
11609         case "$ctime_r_proto" in
11610         ''|0) try='char* ctime_r(const time_t*, char*);'
11611         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11612         esac
11613         case "$ctime_r_proto" in
11614         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11615         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11616         esac
11617         case "$ctime_r_proto" in
11618         ''|0) try='int ctime_r(const time_t*, char*);'
11619         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11620         esac
11621         case "$ctime_r_proto" in
11622         ''|0) try='int ctime_r(const time_t*, char*, int);'
11623         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11624         esac
11625         case "$ctime_r_proto" in
11626         ''|0)   d_ctime_r=undef
11627                 ctime_r_proto=0
11628                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11629         * )     case "$ctime_r_proto" in
11630                 REENTRANT_PROTO*) ;;
11631                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11632                 esac
11633                 echo "Prototype: $try" ;;
11634         esac
11635         ;;
11636         *)      case "$usethreads" in
11637                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11638                 esac
11639                 d_ctime_r=undef
11640                 ctime_r_proto=0
11641                 ;;
11642         esac
11643         ;;
11644 *)      ctime_r_proto=0
11645         ;;
11646 esac
11647
11648 : see if cuserid exists
11649 set cuserid d_cuserid
11650 eval $inlibc
11651
11652 : see if this is a limits.h system
11653 set limits.h i_limits
11654 eval $inhdr
11655
11656 : see if this is a float.h system
11657 set float.h i_float
11658 eval $inhdr
11659
11660 : See if number of significant digits in a double precision number is known
11661 echo " "
11662 $cat >dbl_dig.c <<EOM
11663 #$i_limits I_LIMITS
11664 #$i_float I_FLOAT
11665 #ifdef I_LIMITS
11666 #include <limits.h>
11667 #endif
11668 #ifdef I_FLOAT
11669 #include <float.h>
11670 #endif
11671 #ifdef DBL_DIG
11672 printf("Contains DBL_DIG");
11673 #endif
11674 EOM
11675 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11676 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11677         echo "DBL_DIG found." >&4
11678         val="$define"
11679 else
11680         echo "DBL_DIG NOT found." >&4
11681         val="$undef"
11682 fi
11683 $rm -f dbl_dig.?
11684 set d_dbl_dig
11685 eval $setvar
11686
11687 : see if dbm.h is available
11688 : see if dbmclose exists
11689 set dbmclose d_dbmclose
11690 eval $inlibc
11691
11692 case "$d_dbmclose" in
11693 $define)
11694         set dbm.h i_dbm
11695         eval $inhdr
11696         case "$i_dbm" in
11697         $define)
11698                 val="$undef"
11699                 set i_rpcsvcdbm
11700                 eval $setvar
11701                 ;;
11702         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11703                 eval $inhdr
11704                 ;;
11705         esac
11706         ;;
11707 *)      echo "We won't be including <dbm.h>"
11708         val="$undef"
11709         set i_dbm
11710         eval $setvar
11711         val="$undef"
11712         set i_rpcsvcdbm
11713         eval $setvar
11714         ;;
11715 esac
11716
11717 : see if prototype for dbminit is available
11718 echo " "
11719 set d_dbminitproto dbminit $i_dbm dbm.h
11720 eval $hasproto
11721
11722 : see if difftime exists
11723 set difftime d_difftime
11724 eval $inlibc
11725
11726 : see if this is a dirent system
11727 echo " "
11728 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11729         val="$define"
11730         echo "<dirent.h> found." >&4
11731 else
11732         val="$undef"
11733         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11734                 echo "<sys/dir.h> found." >&4
11735                 echo " "
11736         else
11737                 xinc=`./findhdr sys/ndir.h`
11738         fi
11739         echo "<dirent.h> NOT found." >&4
11740 fi
11741 set i_dirent
11742 eval $setvar
11743
11744 : Look for type of directory structure.
11745 echo " "
11746 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11747
11748 case "$direntrytype" in
11749 ''|' ')
11750         case "$i_dirent" in
11751         $define) guess1='struct dirent' ;;
11752         *) guess1='struct direct'  ;;
11753         esac
11754         ;;
11755 *)      guess1="$direntrytype"
11756         ;;
11757 esac
11758
11759 case "$guess1" in
11760 'struct dirent') guess2='struct direct' ;;
11761 *) guess2='struct dirent' ;;
11762 esac
11763
11764 if $contains "$guess1" try.c >/dev/null 2>&1; then
11765         direntrytype="$guess1"
11766         echo "Your directory entries are $direntrytype." >&4
11767 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11768         direntrytype="$guess2"
11769         echo "Your directory entries seem to be $direntrytype." >&4
11770 else
11771         echo "I don't recognize your system's directory entries." >&4
11772         rp="What type is used for directory entries on this system?"
11773         dflt="$guess1"
11774         . ./myread
11775         direntrytype="$ans"
11776 fi
11777 $rm_try
11778
11779 : see if the directory entry stores field length
11780 echo " "
11781 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11782 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11783         echo "Good, your directory entry keeps length information in d_namlen." >&4
11784         val="$define"
11785 else
11786         echo "Your directory entry does not know about the d_namlen field." >&4
11787         val="$undef"
11788 fi
11789 set d_dirnamlen
11790 eval $setvar
11791 $rm_try
11792
11793 : Look for DIR.dd_fd
11794 case "$i_dirent" in
11795 "$define")
11796     echo "Checking to see if DIR has a dd_fd member variable" >&4
11797     $cat >try.c <<EOCP
11798 #$i_stdlib I_STDLIB
11799 #ifdef I_STDLIB
11800 #include <stdlib.h>
11801 #endif
11802 #include <dirent.h>
11803
11804 int main() {
11805     DIR dir;
11806     dir.dd_fd = 1;
11807     return 0;
11808 }
11809 EOCP
11810     val=$undef
11811     set try
11812     if eval $compile; then
11813         echo "Yes, it does."
11814         val="$define"
11815     else
11816         echo "No, it does not."
11817         val="$undef"
11818     fi
11819     ;;
11820 *)
11821     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11822     val="$undef"
11823     ;;
11824 esac
11825 set d_dir_dd_fd
11826 eval $setvar
11827 $rm_try
11828
11829 : see if this is an sysdir system
11830 set sys/dir.h i_sysdir
11831 eval $inhdr
11832
11833 : see if this is an sysndir system
11834 set sys/ndir.h i_sysndir
11835 eval $inhdr
11836
11837 : Look for dirfd
11838 echo " "
11839 $cat >dirfd.c <<EOM
11840 #include <stdio.h>
11841 #$i_stdlib I_STDLIB
11842 #ifdef I_STDLIB
11843 #include <stdlib.h>
11844 #endif
11845 #$i_dirent I_DIRENT             /**/
11846 #$i_sysdir I_SYS_DIR            /**/
11847 #$i_sysndir I_SYS_NDIR          /**/
11848 #$i_systypes I_SYS_TYPES        /**/
11849 #if defined(I_SYS_TYPES)
11850 #include <sys/types.h>
11851 #endif
11852 #if defined(I_DIRENT)
11853 #include <dirent.h>
11854 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11855 #include <sys/dir.h>
11856 #endif
11857 #else
11858 #ifdef I_SYS_NDIR
11859 #include <sys/ndir.h>
11860 #else
11861 #ifdef I_SYS_DIR
11862 #ifdef hp9000s500
11863 #include <ndir.h>       /* may be wrong in the future */
11864 #else
11865 #include <sys/dir.h>
11866 #endif
11867 #endif
11868 #endif
11869 #endif 
11870 int main() {
11871         DIR *dirp = opendir(".");
11872         if (dirfd(dirp) >= 0)
11873                 exit(0);
11874         else
11875                 exit(1);
11876 }
11877 EOM
11878 val=$undef
11879 set dirfd
11880 if eval $compile; then
11881         val="$define"
11882 fi
11883 case "$val" in
11884 $define)        echo "dirfd() found." >&4       ;;
11885 *)              echo "dirfd() NOT found." >&4   ;;
11886 esac
11887 set d_dirfd
11888 eval $setvar
11889 $rm -f dirfd*
11890
11891 : see if dlerror exists
11892 xxx_runnm="$runnm"
11893 runnm=false
11894 set dlerror d_dlerror
11895 eval $inlibc
11896 runnm="$xxx_runnm"
11897
11898 : see if dlfcn is available
11899 set dlfcn.h i_dlfcn
11900 eval $inhdr
11901
11902 : Check what extension to use for shared libs
11903 case "$usedl" in
11904 $define|y|true)
11905         $cat << EOM
11906
11907 On a few systems, the dynamically loaded modules that perl generates and uses
11908 will need a different extension than shared libs. The default will probably
11909 be appropriate.
11910
11911 EOM
11912         case "$dlext" in
11913         '')     dflt="$so" ;;
11914         *)      dflt="$dlext" ;;
11915         esac
11916         rp='What is the extension of dynamically loaded modules'
11917         . ./myread
11918         dlext="$ans"
11919         ;;
11920 *)
11921         dlext="none"
11922         ;;
11923 esac
11924
11925 : Check if dlsym need a leading underscore
11926 echo " "
11927 val="$undef"
11928
11929 case "$dlsrc" in
11930 dl_dlopen.xs)
11931         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11932         $cat >dyna.c <<'EOM'
11933 fred () { }
11934 EOM
11935
11936 $cat >fred.c<<EOM
11937
11938 #include <stdio.h>
11939 #$i_stdlib I_STDLIB
11940 #ifdef I_STDLIB
11941 #include <stdlib.h>
11942 #endif
11943 #$i_dlfcn I_DLFCN
11944 #ifdef I_DLFCN
11945 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11946 #else
11947 #include <sys/types.h>
11948 #include <nlist.h>
11949 #include <link.h>
11950 #endif
11951
11952 extern int fred() ;
11953
11954 int main()
11955 {
11956     void * handle ;
11957     void * symbol ;
11958 #ifndef RTLD_LAZY
11959     int mode = 1 ;
11960 #else
11961     int mode = RTLD_LAZY ;
11962 #endif
11963     handle = dlopen("./dyna.$dlext", mode) ;
11964     if (handle == NULL) {
11965         printf ("1\n") ;
11966         fflush (stdout) ;
11967         exit(0);
11968     }
11969     symbol = dlsym(handle, "fred") ;
11970     if (symbol == NULL) {
11971         /* try putting a leading underscore */
11972         symbol = dlsym(handle, "_fred") ;
11973         if (symbol == NULL) {
11974             printf ("2\n") ;
11975             fflush (stdout) ;
11976             exit(0);
11977         }
11978         printf ("3\n") ;
11979     }
11980     else
11981         printf ("4\n") ;
11982     fflush (stdout) ;
11983     exit(0);
11984 }
11985 EOM
11986         : Call the object file tmp-dyna.o in case dlext=o.
11987         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11988                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11989                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11990                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11991                 xxx=`$run ./fred`
11992                 case $xxx in
11993                 1)      echo "Test program failed using dlopen." >&4
11994                         echo "Perhaps you should not use dynamic loading." >&4;;
11995                 2)      echo "Test program failed using dlsym." >&4
11996                         echo "Perhaps you should not use dynamic loading." >&4;;
11997                 3)      echo "dlsym needs a leading underscore" >&4
11998                         val="$define" ;;
11999                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12000                 esac
12001         else
12002                 echo "I can't compile and run the test program." >&4
12003                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12004         fi
12005         ;;
12006 esac
12007
12008 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12009
12010 set d_dlsymun
12011 eval $setvar
12012
12013 : see if drand48_r exists
12014 set drand48_r d_drand48_r
12015 eval $inlibc
12016 case "$d_drand48_r" in
12017 "$define")
12018         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12019         case "$d_drand48_r_proto:$usethreads" in
12020         ":define")      d_drand48_r_proto=define
12021                 set d_drand48_r_proto drand48_r $hdrs
12022                 eval $hasproto ;;
12023         *)      ;;
12024         esac
12025         case "$d_drand48_r_proto" in
12026         define)
12027         case "$drand48_r_proto" in
12028         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12029         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12030         esac
12031         case "$drand48_r_proto" in
12032         ''|0)   d_drand48_r=undef
12033                 drand48_r_proto=0
12034                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12035         * )     case "$drand48_r_proto" in
12036                 REENTRANT_PROTO*) ;;
12037                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12038                 esac
12039                 echo "Prototype: $try" ;;
12040         esac
12041         ;;
12042         *)      case "$usethreads" in
12043                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12044                 esac
12045                 d_drand48_r=undef
12046                 drand48_r_proto=0
12047                 ;;
12048         esac
12049         ;;
12050 *)      drand48_r_proto=0
12051         ;;
12052 esac
12053
12054 : see if prototype for drand48 is available
12055 echo " "
12056 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12057 eval $hasproto
12058
12059 : see if dup2 exists
12060 set dup2 d_dup2
12061 eval $inlibc
12062
12063 : see if eaccess exists
12064 set eaccess d_eaccess
12065 eval $inlibc
12066
12067 : see if endgrent exists
12068 set endgrent d_endgrent
12069 eval $inlibc
12070
12071 : see if this is an grp system
12072 set grp.h i_grp
12073 eval $inhdr
12074
12075 case "$i_grp" in
12076 $define)
12077         xxx=`./findhdr grp.h`
12078         $cppstdin $cppflags $cppminus < $xxx >$$.h
12079
12080         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12081                 val="$define"
12082         else
12083                 val="$undef"
12084         fi
12085         set d_grpasswd
12086         eval $setvar
12087
12088         $rm -f $$.h
12089         ;;
12090 *)
12091         val="$undef";
12092         set d_grpasswd; eval $setvar
12093         ;;
12094 esac
12095
12096 : see if endgrent_r exists
12097 set endgrent_r d_endgrent_r
12098 eval $inlibc
12099 case "$d_endgrent_r" in
12100 "$define")
12101         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12102         case "$d_endgrent_r_proto:$usethreads" in
12103         ":define")      d_endgrent_r_proto=define
12104                 set d_endgrent_r_proto endgrent_r $hdrs
12105                 eval $hasproto ;;
12106         *)      ;;
12107         esac
12108         case "$d_endgrent_r_proto" in
12109         define)
12110         case "$endgrent_r_proto" in
12111         ''|0) try='int endgrent_r(FILE**);'
12112         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12113         esac
12114         case "$endgrent_r_proto" in
12115         ''|0) try='void endgrent_r(FILE**);'
12116         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12117         esac
12118         case "$endgrent_r_proto" in
12119         ''|0)   d_endgrent_r=undef
12120                 endgrent_r_proto=0
12121                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12122         * )     case "$endgrent_r_proto" in
12123                 REENTRANT_PROTO*) ;;
12124                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12125                 esac
12126                 echo "Prototype: $try" ;;
12127         esac
12128         ;;
12129         *)      case "$usethreads" in
12130                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12131                 esac
12132                 d_endgrent_r=undef
12133                 endgrent_r_proto=0
12134                 ;;
12135         esac
12136         ;;
12137 *)      endgrent_r_proto=0
12138         ;;
12139 esac
12140
12141 : see if endhostent exists
12142 set endhostent d_endhent
12143 eval $inlibc
12144
12145 : see if this is a netdb.h system
12146 set netdb.h i_netdb
12147 eval $inhdr
12148
12149 : see if endhostent_r exists
12150 set endhostent_r d_endhostent_r
12151 eval $inlibc
12152 case "$d_endhostent_r" in
12153 "$define")
12154         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12155         case "$d_endhostent_r_proto:$usethreads" in
12156         ":define")      d_endhostent_r_proto=define
12157                 set d_endhostent_r_proto endhostent_r $hdrs
12158                 eval $hasproto ;;
12159         *)      ;;
12160         esac
12161         case "$d_endhostent_r_proto" in
12162         define)
12163         case "$endhostent_r_proto" in
12164         ''|0) try='int endhostent_r(struct hostent_data*);'
12165         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12166         esac
12167         case "$endhostent_r_proto" in
12168         ''|0) try='void endhostent_r(struct hostent_data*);'
12169         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12170         esac
12171         case "$endhostent_r_proto" in
12172         ''|0)   d_endhostent_r=undef
12173                 endhostent_r_proto=0
12174                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12175         * )     case "$endhostent_r_proto" in
12176                 REENTRANT_PROTO*) ;;
12177                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12178                 esac
12179                 echo "Prototype: $try" ;;
12180         esac
12181         ;;
12182         *)      case "$usethreads" in
12183                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12184                 esac
12185                 d_endhostent_r=undef
12186                 endhostent_r_proto=0
12187                 ;;
12188         esac
12189         ;;
12190 *)      endhostent_r_proto=0
12191         ;;
12192 esac
12193
12194 : see if endnetent exists
12195 set endnetent d_endnent
12196 eval $inlibc
12197
12198 : see if endnetent_r exists
12199 set endnetent_r d_endnetent_r
12200 eval $inlibc
12201 case "$d_endnetent_r" in
12202 "$define")
12203         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12204         case "$d_endnetent_r_proto:$usethreads" in
12205         ":define")      d_endnetent_r_proto=define
12206                 set d_endnetent_r_proto endnetent_r $hdrs
12207                 eval $hasproto ;;
12208         *)      ;;
12209         esac
12210         case "$d_endnetent_r_proto" in
12211         define)
12212         case "$endnetent_r_proto" in
12213         ''|0) try='int endnetent_r(struct netent_data*);'
12214         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12215         esac
12216         case "$endnetent_r_proto" in
12217         ''|0) try='void endnetent_r(struct netent_data*);'
12218         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12219         esac
12220         case "$endnetent_r_proto" in
12221         ''|0)   d_endnetent_r=undef
12222                 endnetent_r_proto=0
12223                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12224         * )     case "$endnetent_r_proto" in
12225                 REENTRANT_PROTO*) ;;
12226                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12227                 esac
12228                 echo "Prototype: $try" ;;
12229         esac
12230         ;;
12231         *)      case "$usethreads" in
12232                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12233                 esac
12234                 d_endnetent_r=undef
12235                 endnetent_r_proto=0
12236                 ;;
12237         esac
12238         ;;
12239 *)      endnetent_r_proto=0
12240         ;;
12241 esac
12242
12243 : see if endprotoent exists
12244 set endprotoent d_endpent
12245 eval $inlibc
12246
12247 : see if endprotoent_r exists
12248 set endprotoent_r d_endprotoent_r
12249 eval $inlibc
12250 case "$d_endprotoent_r" in
12251 "$define")
12252         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12253         case "$d_endprotoent_r_proto:$usethreads" in
12254         ":define")      d_endprotoent_r_proto=define
12255                 set d_endprotoent_r_proto endprotoent_r $hdrs
12256                 eval $hasproto ;;
12257         *)      ;;
12258         esac
12259         case "$d_endprotoent_r_proto" in
12260         define)
12261         case "$endprotoent_r_proto" in
12262         ''|0) try='int endprotoent_r(struct protoent_data*);'
12263         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12264         esac
12265         case "$endprotoent_r_proto" in
12266         ''|0) try='void endprotoent_r(struct protoent_data*);'
12267         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12268         esac
12269         case "$endprotoent_r_proto" in
12270         ''|0)   d_endprotoent_r=undef
12271                 endprotoent_r_proto=0
12272                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12273         * )     case "$endprotoent_r_proto" in
12274                 REENTRANT_PROTO*) ;;
12275                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12276                 esac
12277                 echo "Prototype: $try" ;;
12278         esac
12279         ;;
12280         *)      case "$usethreads" in
12281                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12282                 esac
12283                 d_endprotoent_r=undef
12284                 endprotoent_r_proto=0
12285                 ;;
12286         esac
12287         ;;
12288 *)      endprotoent_r_proto=0
12289         ;;
12290 esac
12291
12292 : see if endpwent exists
12293 set endpwent d_endpwent
12294 eval $inlibc
12295
12296 : see if this is a pwd.h system
12297 set pwd.h i_pwd
12298 eval $inhdr
12299
12300 case "$i_pwd" in
12301 $define)
12302         xxx=`./findhdr pwd.h`
12303         $cppstdin $cppflags $cppminus < $xxx >$$.h
12304
12305         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12306                 val="$define"
12307         else
12308                 val="$undef"
12309         fi
12310         set d_pwquota
12311         eval $setvar
12312
12313         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12314                 val="$define"
12315         else
12316                 val="$undef"
12317         fi
12318         set d_pwage
12319         eval $setvar
12320
12321         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12322                 val="$define"
12323         else
12324                 val="$undef"
12325         fi
12326         set d_pwchange
12327         eval $setvar
12328
12329         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12330                 val="$define"
12331         else
12332                 val="$undef"
12333         fi
12334         set d_pwclass
12335         eval $setvar
12336
12337         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12338                 val="$define"
12339         else
12340                 val="$undef"
12341         fi
12342         set d_pwexpire
12343         eval $setvar
12344
12345         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12346                 val="$define"
12347         else
12348                 val="$undef"
12349         fi
12350         set d_pwcomment
12351         eval $setvar
12352
12353         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12354                 val="$define"
12355         else
12356                 val="$undef"
12357         fi
12358         set d_pwgecos
12359         eval $setvar
12360
12361         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12362                 val="$define"
12363         else
12364                 val="$undef"
12365         fi
12366         set d_pwpasswd
12367         eval $setvar
12368
12369         $rm -f $$.h
12370         ;;
12371 *)
12372         val="$undef"; 
12373         set d_pwquota; eval $setvar
12374         set d_pwage; eval $setvar
12375         set d_pwchange; eval $setvar
12376         set d_pwclass; eval $setvar
12377         set d_pwexpire; eval $setvar
12378         set d_pwcomment; eval $setvar
12379         set d_pwgecos; eval $setvar
12380         set d_pwpasswd; eval $setvar
12381         ;;
12382 esac
12383
12384 : see if endpwent_r exists
12385 set endpwent_r d_endpwent_r
12386 eval $inlibc
12387 case "$d_endpwent_r" in
12388 "$define")
12389         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12390         case "$d_endpwent_r_proto:$usethreads" in
12391         ":define")      d_endpwent_r_proto=define
12392                 set d_endpwent_r_proto endpwent_r $hdrs
12393                 eval $hasproto ;;
12394         *)      ;;
12395         esac
12396         case "$d_endpwent_r_proto" in
12397         define)
12398         case "$endpwent_r_proto" in
12399         ''|0) try='int endpwent_r(FILE**);'
12400         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12401         esac
12402         case "$endpwent_r_proto" in
12403         ''|0) try='void endpwent_r(FILE**);'
12404         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12405         esac
12406         case "$endpwent_r_proto" in
12407         ''|0)   d_endpwent_r=undef
12408                 endpwent_r_proto=0
12409                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12410         * )     case "$endpwent_r_proto" in
12411                 REENTRANT_PROTO*) ;;
12412                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12413                 esac
12414                 echo "Prototype: $try" ;;
12415         esac
12416         ;;
12417         *)      case "$usethreads" in
12418                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12419                 esac
12420                 d_endpwent_r=undef
12421                 endpwent_r_proto=0
12422                 ;;
12423         esac
12424         ;;
12425 *)      endpwent_r_proto=0
12426         ;;
12427 esac
12428
12429 : see if endservent exists
12430 set endservent d_endsent
12431 eval $inlibc
12432
12433 : see if endservent_r exists
12434 set endservent_r d_endservent_r
12435 eval $inlibc
12436 case "$d_endservent_r" in
12437 "$define")
12438         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12439         case "$d_endservent_r_proto:$usethreads" in
12440         ":define")      d_endservent_r_proto=define
12441                 set d_endservent_r_proto endservent_r $hdrs
12442                 eval $hasproto ;;
12443         *)      ;;
12444         esac
12445         case "$d_endservent_r_proto" in
12446         define)
12447         case "$endservent_r_proto" in
12448         ''|0) try='int endservent_r(struct servent_data*);'
12449         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12450         esac
12451         case "$endservent_r_proto" in
12452         ''|0) try='void endservent_r(struct servent_data*);'
12453         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12454         esac
12455         case "$endservent_r_proto" in
12456         ''|0)   d_endservent_r=undef
12457                 endservent_r_proto=0
12458                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12459         * )     case "$endservent_r_proto" in
12460                 REENTRANT_PROTO*) ;;
12461                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12462                 esac
12463                 echo "Prototype: $try" ;;
12464         esac
12465         ;;
12466         *)      case "$usethreads" in
12467                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12468                 esac
12469                 d_endservent_r=undef
12470                 endservent_r_proto=0
12471                 ;;
12472         esac
12473         ;;
12474 *)      endservent_r_proto=0
12475         ;;
12476 esac
12477
12478 : Locate the flags for 'open()'
12479 echo " "
12480 $cat >try.c <<EOCP
12481 #include <sys/types.h>
12482 #ifdef I_FCNTL
12483 #include <fcntl.h>
12484 #endif
12485 #ifdef I_SYS_FILE
12486 #include <sys/file.h>
12487 #endif
12488 #$i_stdlib I_STDLIB
12489 #ifdef I_STDLIB
12490 #include <stdlib.h>
12491 #endif
12492 int main() {
12493         if(O_RDONLY);
12494 #ifdef O_TRUNC
12495         exit(0);
12496 #else
12497         exit(1);
12498 #endif
12499 }
12500 EOCP
12501 : check sys/file.h first to get FREAD on Sun
12502 if $test `./findhdr sys/file.h` && \
12503                 set try -DI_SYS_FILE && eval $compile; then
12504         h_sysfile=true;
12505         echo "<sys/file.h> defines the O_* constants..." >&4
12506         if $run ./try; then
12507                 echo "and you have the 3 argument form of open()." >&4
12508                 val="$define"
12509         else
12510                 echo "but not the 3 argument form of open().  Oh, well." >&4
12511                 val="$undef"
12512         fi
12513 elif $test `./findhdr fcntl.h` && \
12514                 set try -DI_FCNTL && eval $compile; then
12515         h_fcntl=true;
12516         echo "<fcntl.h> defines the O_* constants..." >&4
12517         if $run ./try; then
12518                 echo "and you have the 3 argument form of open()." >&4
12519                 val="$define"
12520         else
12521                 echo "but not the 3 argument form of open().  Oh, well." >&4
12522                 val="$undef"
12523         fi
12524 else
12525         val="$undef"
12526         echo "I can't find the O_* constant definitions!  You got problems." >&4
12527 fi
12528 set d_open3
12529 eval $setvar
12530 $rm_try
12531
12532 : see if this is a sys/file.h system
12533 val=''
12534 set sys/file.h val
12535 eval $inhdr
12536
12537 : do we need to include sys/file.h ?
12538 case "$val" in
12539 "$define")
12540         echo " "
12541         if $h_sysfile; then
12542                 val="$define"
12543                 echo "We'll be including <sys/file.h>." >&4
12544         else
12545                 val="$undef"
12546                 echo "We won't be including <sys/file.h>." >&4
12547         fi
12548         ;;
12549 *)
12550         h_sysfile=false
12551         ;;
12552 esac
12553 set i_sysfile
12554 eval $setvar
12555
12556 : see if fcntl.h is there
12557 val=''
12558 set fcntl.h val
12559 eval $inhdr
12560
12561 : see if we can include fcntl.h
12562 case "$val" in
12563 "$define")
12564         echo " "
12565         if $h_fcntl; then
12566                 val="$define"
12567                 echo "We'll be including <fcntl.h>." >&4
12568         else
12569                 val="$undef"
12570                 if $h_sysfile; then
12571         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12572                 else
12573                         echo "We won't be including <fcntl.h>." >&4
12574                 fi
12575         fi
12576         ;;
12577 *)
12578         h_fcntl=false
12579         val="$undef"
12580         ;;
12581 esac
12582 set i_fcntl
12583 eval $setvar
12584
12585 : see if fork exists
12586 set fork d_fork
12587 eval $inlibc
12588
12589 : see if pipe exists
12590 set pipe d_pipe
12591 eval $inlibc
12592
12593 : check for non-blocking I/O stuff
12594 case "$h_sysfile" in
12595 true) echo "#include <sys/file.h>" > head.c;;
12596 *)
12597        case "$h_fcntl" in
12598        true) echo "#include <fcntl.h>" > head.c;;
12599        *) echo "#include <sys/fcntl.h>" > head.c;;
12600        esac
12601        ;;
12602 esac
12603 echo " "
12604 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12605 case "$o_nonblock" in
12606 '')
12607         $cat head.c > try.c
12608         $cat >>try.c <<EOCP
12609 #include <stdio.h>
12610 #$i_stdlib I_STDLIB
12611 #ifdef I_STDLIB
12612 #include <stdlib.h>
12613 #endif
12614 #$i_fcntl I_FCNTL
12615 #ifdef I_FCNTL
12616 #include <fcntl.h>
12617 #endif
12618 int main() {
12619 #ifdef O_NONBLOCK
12620         printf("O_NONBLOCK\n");
12621         exit(0);
12622 #endif
12623 #ifdef O_NDELAY
12624         printf("O_NDELAY\n");
12625         exit(0);
12626 #endif
12627 #ifdef FNDELAY
12628         printf("FNDELAY\n");
12629         exit(0);
12630 #endif
12631         exit(0);
12632 }
12633 EOCP
12634         set try
12635         if eval $compile_ok; then
12636                 o_nonblock=`$run ./try`
12637                 case "$o_nonblock" in
12638                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12639                 *) echo "Seems like we can use $o_nonblock.";;
12640                 esac
12641         else
12642                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12643         fi
12644         ;;
12645 *) echo "Using $hint value $o_nonblock.";;
12646 esac
12647 $rm_try
12648
12649 echo " "
12650 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12651 case "$eagain" in
12652 '')
12653         case "$d_fork:$d_pipe" in
12654         define:define)
12655         $cat head.c > try.c
12656         $cat >>try.c <<EOCP
12657 #include <errno.h>
12658 #include <sys/types.h>
12659 #include <signal.h>
12660 #include <stdio.h>
12661 #$i_stdlib I_STDLIB
12662 #ifdef I_STDLIB
12663 #include <stdlib.h>
12664 #endif
12665 #$i_fcntl I_FCNTL
12666 #ifdef I_FCNTL
12667 #include <fcntl.h>
12668 #endif
12669 #define MY_O_NONBLOCK $o_nonblock
12670 #ifndef errno  /* XXX need better Configure test */
12671 extern int errno;
12672 #endif
12673 #$i_unistd I_UNISTD
12674 #ifdef I_UNISTD
12675 #include <unistd.h>
12676 #endif
12677 #$i_string I_STRING
12678 #ifdef I_STRING
12679 #include <string.h>
12680 #else
12681 #include <strings.h>
12682 #endif
12683 $signal_t blech(int x) { exit(3); }
12684 EOCP
12685         $cat >> try.c <<'EOCP'
12686 int main()
12687 {
12688         int pd[2];
12689         int pu[2];
12690         char buf[1];
12691         char string[100];
12692
12693         pipe(pd);       /* Down: child -> parent */
12694         pipe(pu);       /* Up: parent -> child */
12695         if (0 != fork()) {
12696                 int ret;
12697                 close(pd[1]);   /* Parent reads from pd[0] */
12698                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12699 #ifdef F_SETFL
12700                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12701                         exit(1);
12702 #else
12703                 exit(4);
12704 #endif
12705                 signal(SIGALRM, blech);
12706                 alarm(5);
12707                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12708                         exit(2);
12709                 sprintf(string, "%d\n", ret);
12710                 write(2, string, strlen(string));
12711                 alarm(0);
12712 #ifdef EAGAIN
12713                 if (errno == EAGAIN) {
12714                         printf("EAGAIN\n");
12715                         goto ok;
12716                 }
12717 #endif
12718 #ifdef EWOULDBLOCK
12719                 if (errno == EWOULDBLOCK)
12720                         printf("EWOULDBLOCK\n");
12721 #endif
12722         ok:
12723                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12724                 sleep(2);                               /* Give it time to close our pipe */
12725                 alarm(5);
12726                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12727                 alarm(0);
12728                 sprintf(string, "%d\n", ret);
12729                 write(4, string, strlen(string));
12730                 exit(0);
12731         }
12732
12733         close(pd[0]);                   /* We write to pd[1] */
12734         close(pu[1]);                   /* We read from pu[0] */
12735         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12736         close(pd[1]);                   /* Pipe pd is now fully closed! */
12737         exit(0);                                /* Bye bye, thank you for playing! */
12738 }
12739 EOCP
12740         set try
12741         if eval $compile_ok; then
12742                 echo "$startsh" >mtry
12743                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12744                 chmod +x mtry
12745                 ./mtry >/dev/null 2>&1
12746                 case $? in
12747                 0) eagain=`$cat try.out`;;
12748                 1) echo "Could not perform non-blocking setting!";;
12749                 2) echo "I did a successful read() for something that was not there!";;
12750                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12751                 4) echo "Could not find F_SETFL!";;
12752                 *) echo "Something terribly wrong happened during testing.";;
12753                 esac
12754                 rd_nodata=`$cat try.ret`
12755                 echo "A read() system call with no data present returns $rd_nodata."
12756                 case "$rd_nodata" in
12757                 0|-1) ;;
12758                 *)
12759                         echo "(That's peculiar, fixing that to be -1.)"
12760                         rd_nodata=-1
12761                         ;;
12762                 esac
12763                 case "$eagain" in
12764                 '')
12765                         echo "Forcing errno EAGAIN on read() with no data available."
12766                         eagain=EAGAIN
12767                         ;;
12768                 *)
12769                         echo "Your read() sets errno to $eagain when no data is available."
12770                         ;;
12771                 esac
12772                 status=`$cat try.err`
12773                 case "$status" in
12774                 0) echo "And it correctly returns 0 to signal EOF.";;
12775                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12776                 *) echo "However, your read() returns '$status' on EOF??";;
12777                 esac
12778                 val="$define"
12779                 if test "$status" = "$rd_nodata"; then
12780                         echo "WARNING: you can't distinguish between EOF and no data!"
12781                         val="$undef"
12782                 fi
12783         else
12784                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12785                 eagain=EAGAIN
12786         fi
12787         ;;
12788         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12789                 eagain=EAGAIN
12790                 val="$define"
12791                 ;;
12792         esac
12793         set d_eofnblk
12794         eval $setvar
12795         ;;
12796 *)
12797         echo "Using $hint value $eagain."
12798         echo "Your read() returns $rd_nodata when no data is present."
12799         case "$d_eofnblk" in
12800         "$define") echo "And you can see EOF because read() returns 0.";;
12801         "$undef") echo "But you can't see EOF status from read() returned value.";;
12802         *)
12803                 echo "(Assuming you can't see EOF status from read anyway.)"
12804                 d_eofnblk=$undef
12805                 ;;
12806         esac
12807         ;;
12808 esac
12809 $rm_try head.c mtry
12810
12811 : see if _ptr and _cnt from stdio act std
12812 echo " "
12813
12814 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12815         echo "(Looks like you have stdio.h from BSD.)"
12816         case "$stdio_ptr" in
12817         '') stdio_ptr='((fp)->_p)'
12818                 ptr_lval=$define
12819                 ;;
12820         *)      ptr_lval=$d_stdio_ptr_lval;;
12821         esac
12822         case "$stdio_cnt" in
12823         '') stdio_cnt='((fp)->_r)'
12824                 cnt_lval=$define
12825                 ;;
12826         *)      cnt_lval=$d_stdio_cnt_lval;;
12827         esac
12828         case "$stdio_base" in
12829         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12830         esac
12831         case "$stdio_bufsiz" in
12832         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12833         esac
12834 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12835         echo "(Looks like you have stdio.h from Linux.)"
12836         case "$stdio_ptr" in
12837         '') stdio_ptr='((fp)->_IO_read_ptr)'
12838                 ptr_lval=$define
12839                 ;;
12840         *)      ptr_lval=$d_stdio_ptr_lval;;
12841         esac
12842         case "$stdio_cnt" in
12843         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12844                 cnt_lval=$undef
12845                 ;;
12846         *)      cnt_lval=$d_stdio_cnt_lval;;
12847         esac
12848         case "$stdio_base" in
12849         '') stdio_base='((fp)->_IO_read_base)';;
12850         esac
12851         case "$stdio_bufsiz" in
12852         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12853         esac
12854 else
12855         case "$stdio_ptr" in
12856         '') stdio_ptr='((fp)->_ptr)'
12857                 ptr_lval=$define
12858                 ;;
12859         *)      ptr_lval=$d_stdio_ptr_lval;;
12860         esac
12861         case "$stdio_cnt" in
12862         '') stdio_cnt='((fp)->_cnt)'
12863                 cnt_lval=$define
12864                 ;;
12865         *)      cnt_lval=$d_stdio_cnt_lval;;
12866         esac
12867         case "$stdio_base" in
12868         '') stdio_base='((fp)->_base)';;
12869         esac
12870         case "$stdio_bufsiz" in
12871         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12872         esac
12873 fi
12874
12875 : test whether _ptr and _cnt really work
12876 echo "Checking how std your stdio is..." >&4
12877 $cat >try.c <<EOP
12878 #include <stdio.h>
12879 #$i_stdlib I_STDLIB
12880 #ifdef I_STDLIB
12881 #include <stdlib.h>
12882 #endif
12883 #define FILE_ptr(fp)    $stdio_ptr
12884 #define FILE_cnt(fp)    $stdio_cnt
12885 int main() {
12886         FILE *fp = fopen("try.c", "r");
12887         char c = getc(fp);
12888         if (
12889                 18 <= FILE_cnt(fp) &&
12890                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12891         )
12892                 exit(0);
12893         exit(1);
12894 }
12895 EOP
12896 val="$undef"
12897 set try
12898 if eval $compile && $to try.c; then
12899         if $run ./try; then
12900                 echo "Your stdio acts pretty std."
12901                 val="$define"
12902         else
12903                 echo "Your stdio isn't very std."
12904         fi
12905 else
12906         echo "Your stdio doesn't appear very std."
12907 fi
12908 $rm_try
12909
12910 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12911 # direct buffer manipulation no longer works.  The Configure tests
12912 # should be changed to correctly detect this, but until then,
12913 # the following check should at least let perl compile and run.
12914 # (This quick fix should be updated before 5.8.1.)
12915 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12916 # A. Dougherty, June 3, 2002.
12917 case "$d_gnulibc" in
12918 $define)
12919         case "$gnulibc_version" in
12920         2.[01]*)  ;;
12921         2.2) ;;
12922         2.2.[0-9]) ;;
12923         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12924                 val="$undef"
12925                 ;;
12926         esac
12927         ;;
12928 esac
12929 set d_stdstdio
12930 eval $setvar
12931
12932 : Can _ptr be used as an lvalue?
12933 case "$d_stdstdio$ptr_lval" in
12934 $define$define) val=$define ;;
12935 *) val=$undef ;;
12936 esac
12937 set d_stdio_ptr_lval
12938 eval $setvar
12939
12940 : Can _cnt be used as an lvalue?
12941 case "$d_stdstdio$cnt_lval" in
12942 $define$define) val=$define ;;
12943 *) val=$undef ;;
12944 esac
12945 set d_stdio_cnt_lval
12946 eval $setvar
12947
12948
12949 : test whether setting _ptr sets _cnt as a side effect
12950 d_stdio_ptr_lval_sets_cnt="$undef"
12951 d_stdio_ptr_lval_nochange_cnt="$undef"
12952 case "$d_stdio_ptr_lval$d_stdstdio" in
12953 $define$define)
12954         echo "Checking to see what happens if we set the stdio ptr..." >&4
12955 $cat >try.c <<EOP
12956 #include <stdio.h>
12957 /* Can we scream? */
12958 /* Eat dust sed :-) */
12959 /* In the buffer space, no one can hear you scream. */
12960 #$i_stdlib I_STDLIB
12961 #ifdef I_STDLIB
12962 #include <stdlib.h>
12963 #endif
12964 #define FILE_ptr(fp)    $stdio_ptr
12965 #define FILE_cnt(fp)    $stdio_cnt
12966 #include <sys/types.h>
12967 int main() {
12968         FILE *fp = fopen("try.c", "r");
12969         int c;
12970         char *ptr;
12971         size_t cnt;
12972         if (!fp) {
12973             puts("Fail even to read");
12974             exit(1);
12975         }
12976         c = getc(fp); /* Read away the first # */
12977         if (c == EOF) {
12978             puts("Fail even to read");
12979             exit(1);
12980         }
12981         if (!(
12982                 18 <= FILE_cnt(fp) &&
12983                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12984         )) {
12985                 puts("Fail even to read");
12986                 exit (1);
12987         }
12988         ptr = (char*) FILE_ptr(fp);
12989         cnt = (size_t)FILE_cnt(fp);
12990
12991         FILE_ptr(fp) += 42;
12992
12993         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12994                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12995                 exit (1);
12996         }
12997         if (FILE_cnt(fp) <= 20) {
12998                 printf ("Fail (<20 chars to test)");
12999                 exit (1);
13000         }
13001         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13002                 puts("Fail compare");
13003                 exit (1);
13004         }
13005         if (cnt == FILE_cnt(fp)) {
13006                 puts("Pass_unchanged");
13007                 exit (0);
13008         }
13009         if (FILE_cnt(fp) == (cnt - 42)) {
13010                 puts("Pass_changed");
13011                 exit (0);
13012         }
13013         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13014         return 1;
13015
13016 }
13017 EOP
13018         set try
13019         if eval $compile && $to try.c; then
13020                 case `$run ./try` in
13021                 Pass_changed)
13022                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13023                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13024                 Pass_unchanged)
13025                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13026                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13027                 Fail*)
13028                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13029                 *)
13030                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13031         esac
13032         else
13033                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13034         fi
13035         $rm_try
13036         ;;
13037 esac
13038
13039 : see if _base is also standard
13040 val="$undef"
13041 case "$d_stdstdio" in
13042 $define)
13043         $cat >try.c <<EOP
13044 #include <stdio.h>
13045 #$i_stdlib I_STDLIB
13046 #ifdef I_STDLIB
13047 #include <stdlib.h>
13048 #endif
13049 #define FILE_base(fp)   $stdio_base
13050 #define FILE_bufsiz(fp) $stdio_bufsiz
13051 int main() {
13052         FILE *fp = fopen("try.c", "r");
13053         char c = getc(fp);
13054         if (
13055                 19 <= FILE_bufsiz(fp) &&
13056                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13057         )
13058                 exit(0);
13059         exit(1);
13060 }
13061 EOP
13062         set try
13063         if eval $compile && $to try.c; then
13064                 if $run ./try; then
13065                         echo "And its _base field acts std."
13066                         val="$define"
13067                 else
13068                         echo "But its _base field isn't std."
13069                 fi
13070         else
13071                 echo "However, it seems to be lacking the _base field."
13072         fi
13073         $rm_try
13074         ;;
13075 esac
13076 set d_stdiobase
13077 eval $setvar
13078
13079 : see if fast_stdio exists
13080 val="$undef"
13081 case "$d_stdstdio:$d_stdio_ptr_lval" in
13082 "$define:$define")
13083         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13084         *$define*)
13085                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13086                 val="$define"
13087                 ;;
13088         esac
13089         ;;
13090 esac
13091 set d_faststdio
13092 eval $setvar
13093
13094
13095
13096 : see if fchdir exists
13097 set fchdir d_fchdir
13098 eval $inlibc
13099
13100 : see if fchmod exists
13101 set fchmod d_fchmod
13102 eval $inlibc
13103
13104 : see if fchown exists
13105 set fchown d_fchown
13106 eval $inlibc
13107
13108 : see if this is an fcntl system
13109 set fcntl d_fcntl
13110 eval $inlibc
13111
13112 : See if fcntl-based locking works.
13113 echo " "
13114 $cat >try.c <<EOCP
13115 #$i_stdlib I_STDLIB
13116 #ifdef I_STDLIB
13117 #include <stdlib.h>
13118 #endif
13119 #include <unistd.h>
13120 #include <fcntl.h>
13121 #include <signal.h>
13122 $signal_t blech(int x) { exit(3); }
13123 int main() {
13124 #if defined(F_SETLK) && defined(F_SETLKW)
13125      struct flock flock;
13126      int retval, fd;
13127      fd = open("try.c", O_RDONLY);
13128      flock.l_type = F_RDLCK;
13129      flock.l_whence = SEEK_SET;
13130      flock.l_start = flock.l_len = 0;
13131      signal(SIGALRM, blech);
13132      alarm(10);
13133      retval = fcntl(fd, F_SETLK, &flock);
13134      close(fd);
13135      (retval < 0 ? exit(2) : exit(0));
13136 #else
13137      exit(2);
13138 #endif
13139 }
13140 EOCP
13141 echo "Checking if fcntl-based file locking works... "
13142 case "$d_fcntl" in
13143 "$define")
13144         set try
13145         if eval $compile_ok; then
13146                 if $run ./try; then
13147                         echo "Yes, it seems to work."
13148                         val="$define"
13149                 else
13150                         echo "Nope, it didn't work."
13151                         val="$undef"
13152                         case "$?" in
13153                         3) $cat >&4 <<EOM
13154 ***
13155 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13156 *** This is (almost) impossible.
13157 *** If your NFS lock daemons are not feeling well, something like
13158 *** this may happen, please investigate.  Cannot continue, aborting.
13159 ***
13160 EOM
13161                                 exit 1
13162                                 ;;
13163                         esac
13164                 fi
13165         else
13166                 echo "I'm unable to compile the test program, so I'll assume not."
13167                 val="$undef"
13168         fi
13169         ;;
13170 *) val="$undef";
13171         echo "Nope, since you don't even have fcntl()."
13172         ;;
13173 esac
13174 set d_fcntl_can_lock
13175 eval $setvar
13176 $rm_try
13177
13178 : check for fd_set items
13179 $cat <<EOM
13180
13181 Checking to see how well your C compiler handles fd_set and friends ...
13182 EOM
13183 $cat >try.c <<EOCP
13184 #$i_stdlib I_STDLIB
13185 #ifdef I_STDLIB
13186 #include <stdlib.h>
13187 #endif
13188 #$i_systime I_SYS_TIME
13189 #$i_sysselct I_SYS_SELECT
13190 #$d_socket HAS_SOCKET
13191 #include <sys/types.h>
13192 #ifdef HAS_SOCKET
13193 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13194 #endif
13195 #ifdef I_SYS_TIME
13196 #include <sys/time.h>
13197 #endif
13198 #ifdef I_SYS_SELECT
13199 #include <sys/select.h>
13200 #endif
13201 int main() {
13202         fd_set fds;
13203
13204 #ifdef TRYBITS
13205         if(fds.fds_bits);
13206 #endif
13207
13208 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13209         exit(0);
13210 #else
13211         exit(1);
13212 #endif
13213 }
13214 EOCP
13215 set try -DTRYBITS
13216 if eval $compile; then
13217         d_fds_bits="$define"
13218         d_fd_set="$define"
13219         echo "Well, your system knows about the normal fd_set typedef..." >&4
13220         if $run ./try; then
13221                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13222                 d_fd_macros="$define"
13223         else
13224                 $cat >&4 <<'EOM'
13225 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13226 EOM
13227                 d_fd_macros="$undef"
13228         fi
13229 else
13230         $cat <<'EOM'
13231 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13232 EOM
13233         set try
13234         if eval $compile; then
13235                 d_fds_bits="$undef"
13236                 d_fd_set="$define"
13237                 echo "Well, your system has some sort of fd_set available..." >&4
13238                 if $run ./try; then
13239                         echo "and you have the normal fd_set macros." >&4
13240                         d_fd_macros="$define"
13241                 else
13242                         $cat <<'EOM'
13243 but not the normal fd_set macros!  Gross!  More work for me...
13244 EOM
13245                         d_fd_macros="$undef"
13246                 fi
13247         else
13248         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13249                 d_fd_set="$undef"
13250                 d_fds_bits="$undef"
13251                 d_fd_macros="$undef"
13252         fi
13253 fi
13254 $rm_try
13255
13256 : see if fgetpos exists
13257 set fgetpos d_fgetpos
13258 eval $inlibc
13259
13260 : see if finite exists
13261 set finite d_finite
13262 eval $inlibc
13263
13264 : see if finitel exists
13265 set finitel d_finitel
13266 eval $inlibc
13267
13268 : see if flock exists
13269 set flock d_flock
13270 eval $inlibc
13271
13272 : see if prototype for flock is available
13273 echo " "
13274 set d_flockproto flock $i_sysfile sys/file.h
13275 eval $hasproto
13276
13277 : see if fp_class exists
13278 set fp_class d_fp_class
13279 eval $inlibc
13280
13281 : see if pathconf exists
13282 set pathconf d_pathconf
13283 eval $inlibc
13284
13285 : see if fpathconf exists
13286 set fpathconf d_fpathconf
13287 eval $inlibc
13288
13289 : see if fpclass exists
13290 set fpclass d_fpclass
13291 eval $inlibc
13292
13293 : see if fpclassify exists
13294 set fpclassify d_fpclassify
13295 eval $inlibc
13296
13297 : see if fpclassl exists
13298 set fpclassl d_fpclassl
13299 eval $inlibc
13300
13301 : check for fpos64_t
13302 echo " "
13303 echo "Checking to see if you have fpos64_t..." >&4
13304 $cat >try.c <<EOCP
13305 #include <stdio.h>
13306 int main() { fpos64_t x = 7; }
13307 EOCP
13308 set try
13309 if eval $compile; then
13310         val="$define"
13311         echo "You have fpos64_t."
13312 else
13313         val="$undef"
13314         echo "You do not have fpos64_t."
13315         case "$fpossize" in
13316         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13317         esac
13318 fi
13319 $rm_try
13320 set d_fpos64_t
13321 eval $setvar
13322
13323 : see if frexpl exists
13324 set frexpl d_frexpl
13325 eval $inlibc
13326
13327 : see if this is a sys/param system
13328 set sys/param.h i_sysparam
13329 eval $inhdr
13330
13331 : see if this is a sys/mount.h system
13332 set sys/mount.h i_sysmount
13333 eval $inhdr
13334
13335 : Check for fs_data_s
13336 echo " "
13337 echo "Checking to see if your system supports struct fs_data..." >&4
13338 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13339 eval $hasstruct
13340 case "$d_fs_data_s" in
13341 "$define")      echo "Yes, it does."   ;;
13342 *)              echo "No, it doesn't." ;;
13343 esac
13344
13345 : see if fseeko exists
13346 set fseeko d_fseeko
13347 eval $inlibc
13348 case "$longsize" in
13349 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13350 esac
13351
13352 : see if fsetpos exists
13353 set fsetpos d_fsetpos
13354 eval $inlibc
13355
13356 : see if fstatfs exists
13357 set fstatfs d_fstatfs
13358 eval $inlibc
13359
13360 : see if statvfs exists
13361 set statvfs d_statvfs
13362 eval $inlibc
13363
13364 : see if fstatvfs exists
13365 set fstatvfs d_fstatvfs
13366 eval $inlibc
13367
13368
13369 : see if fsync exists
13370 set fsync d_fsync
13371 eval $inlibc
13372
13373 : see if ftello exists
13374 set ftello d_ftello
13375 eval $inlibc
13376 case "$longsize" in
13377 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13378 esac
13379
13380 : check for a working futimes
13381 d_futimes="$undef"
13382 echo " "
13383 echo "Checking if you have a working futimes()" >&4
13384 $cat >try.c <<EOCP
13385 #include <stdio.h>
13386 #include <sys/time.h>
13387 #include <errno.h>
13388 #include <fcntl.h>
13389
13390 int main ()
13391 {
13392     int fd, rv;
13393     fd = open ("try.c", O_RDWR);
13394     if (-1 == fd) exit (1);
13395     rv = futimes (fd, NULL);
13396     exit (rv == -1 ? errno : 0);
13397 }
13398 EOCP
13399 set try
13400 if eval $compile; then
13401     `$run ./try`
13402     rc=$?
13403     case "$rc" in
13404         0)  echo "Yes, you have" >&4
13405             d_futimes="$define"
13406             ;;
13407         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13408             ;;
13409     esac
13410 else
13411     echo "No, it does not (probably harmless)" >&4
13412 fi
13413 $rm_try
13414
13415 : see if ndbm.h is available
13416 set ndbm.h i_ndbm
13417 eval $inhdr
13418 : Compatibility location for RedHat 7.1
13419 set gdbm/ndbm.h i_gdbmndbm
13420 eval $inhdr
13421 : Compatibility location for Debian 4.0
13422 set gdbm-ndbm.h i_gdbm_ndbm
13423 eval $inhdr
13424
13425 val="$undef"
13426 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13427         : see if dbm_open exists
13428         set dbm_open d_dbm_open
13429         eval $inlibc
13430         case "$d_dbm_open" in
13431         $undef)
13432                 i_ndbm="$undef"
13433                 i_gdbmndbm="$undef"
13434                 i_gdbm_ndbm="$undef"
13435                 echo "We won't be including <ndbm.h>"
13436                 val="$undef"
13437                 ;;
13438         *) val="$define"
13439            ;;
13440         esac
13441 fi
13442 set d_ndbm
13443 eval $setvar
13444
13445 ndbm_hdr_protochk='name=$1; hdr=$2;
13446 eval "ihdr=\$""i_$name";
13447 val="$undef";
13448 if $test "$ihdr" = "$define"; then
13449         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13450         case "$d_cplusplus" in
13451         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13452         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13453         esac;
13454         case "$val" in
13455         $define) $echo "Your <$hdr> seems to have prototypes";;
13456         *) $echo "Your <$hdr> does not seem to have prototypes";;
13457         esac;
13458 fi;
13459 set "d_${name}_h_uses_prototypes";
13460 eval $setvar'
13461
13462 set ndbm ndbm.h
13463 eval $ndbm_hdr_protochk
13464 set gdbmndbm gdbm/ndbm.h
13465 eval $ndbm_hdr_protochk
13466 set gdbm_ndbm gdbm-ndbm.h
13467 eval $ndbm_hdr_protochk
13468
13469 : see if getaddrinfo exists
13470 set getaddrinfo d_getaddrinfo
13471 eval $inlibc
13472
13473 : see if getcwd exists
13474 set getcwd d_getcwd
13475 eval $inlibc
13476
13477 : see if getespwnam exists
13478 set getespwnam d_getespwnam
13479 eval $inlibc
13480
13481 : see if getfsstat exists
13482 set getfsstat d_getfsstat
13483 eval $inlibc
13484
13485 : see if getgrent exists
13486 set getgrent d_getgrent
13487 eval $inlibc
13488
13489 : see if getgrent_r exists
13490 set getgrent_r d_getgrent_r
13491 eval $inlibc
13492 case "$d_getgrent_r" in
13493 "$define")
13494         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13495         case "$d_getgrent_r_proto:$usethreads" in
13496         ":define")      d_getgrent_r_proto=define
13497                 set d_getgrent_r_proto getgrent_r $hdrs
13498                 eval $hasproto ;;
13499         *)      ;;
13500         esac
13501         case "$d_getgrent_r_proto" in
13502         define)
13503         case "$getgrent_r_proto" in
13504         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13505         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13506         esac
13507         case "$getgrent_r_proto" in
13508         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13509         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13510         esac
13511         case "$getgrent_r_proto" in
13512         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13513         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13514         esac
13515         case "$getgrent_r_proto" in
13516         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13517         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13518         esac
13519         case "$getgrent_r_proto" in
13520         ''|0) try='int getgrent_r(struct group*, char*, int);'
13521         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13522         esac
13523         case "$getgrent_r_proto" in
13524         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13525         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13526         esac
13527         case "$getgrent_r_proto" in
13528         ''|0)   d_getgrent_r=undef
13529                 getgrent_r_proto=0
13530                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13531         * )     case "$getgrent_r_proto" in
13532                 REENTRANT_PROTO*) ;;
13533                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13534                 esac
13535                 echo "Prototype: $try" ;;
13536         esac
13537         ;;
13538         *)      case "$usethreads" in
13539                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13540                 esac
13541                 d_getgrent_r=undef
13542                 getgrent_r_proto=0
13543                 ;;
13544         esac
13545         ;;
13546 *)      getgrent_r_proto=0
13547         ;;
13548 esac
13549
13550 : see if getgrgid_r exists
13551 set getgrgid_r d_getgrgid_r
13552 eval $inlibc
13553 case "$d_getgrgid_r" in
13554 "$define")
13555         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13556         case "$d_getgrgid_r_proto:$usethreads" in
13557         ":define")      d_getgrgid_r_proto=define
13558                 set d_getgrgid_r_proto getgrgid_r $hdrs
13559                 eval $hasproto ;;
13560         *)      ;;
13561         esac
13562         case "$d_getgrgid_r_proto" in
13563         define)
13564         case "$getgrgid_r_proto" in
13565         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13566         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13567         esac
13568         case "$getgrgid_r_proto" in
13569         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13570         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13571         esac
13572         case "$getgrgid_r_proto" in
13573         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13574         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13575         esac
13576         case "$getgrgid_r_proto" in
13577         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13578         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13579         esac
13580         case "$getgrgid_r_proto" in
13581         ''|0)   d_getgrgid_r=undef
13582                 getgrgid_r_proto=0
13583                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13584         * )     case "$getgrgid_r_proto" in
13585                 REENTRANT_PROTO*) ;;
13586                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13587                 esac
13588                 echo "Prototype: $try" ;;
13589         esac
13590         ;;
13591         *)      case "$usethreads" in
13592                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13593                 esac
13594                 d_getgrgid_r=undef
13595                 getgrgid_r_proto=0
13596                 ;;
13597         esac
13598         ;;
13599 *)      getgrgid_r_proto=0
13600         ;;
13601 esac
13602
13603 : see if getgrnam_r exists
13604 set getgrnam_r d_getgrnam_r
13605 eval $inlibc
13606 case "$d_getgrnam_r" in
13607 "$define")
13608         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13609         case "$d_getgrnam_r_proto:$usethreads" in
13610         ":define")      d_getgrnam_r_proto=define
13611                 set d_getgrnam_r_proto getgrnam_r $hdrs
13612                 eval $hasproto ;;
13613         *)      ;;
13614         esac
13615         case "$d_getgrnam_r_proto" in
13616         define)
13617         case "$getgrnam_r_proto" in
13618         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13619         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13620         esac
13621         case "$getgrnam_r_proto" in
13622         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13623         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13624         esac
13625         case "$getgrnam_r_proto" in
13626         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13627         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13628         esac
13629         case "$getgrnam_r_proto" in
13630         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13631         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13632         esac
13633         case "$getgrnam_r_proto" in
13634         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13635         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13636         esac
13637         case "$getgrnam_r_proto" in
13638         ''|0)   d_getgrnam_r=undef
13639                 getgrnam_r_proto=0
13640                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13641         * )     case "$getgrnam_r_proto" in
13642                 REENTRANT_PROTO*) ;;
13643                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13644                 esac
13645                 echo "Prototype: $try" ;;
13646         esac
13647         ;;
13648         *)      case "$usethreads" in
13649                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13650                 esac
13651                 d_getgrnam_r=undef
13652                 getgrnam_r_proto=0
13653                 ;;
13654         esac
13655         ;;
13656 *)      getgrnam_r_proto=0
13657         ;;
13658 esac
13659
13660 : see if gethostbyaddr exists
13661 set gethostbyaddr d_gethbyaddr
13662 eval $inlibc
13663
13664 : see if gethostbyname exists
13665 set gethostbyname d_gethbyname
13666 eval $inlibc
13667
13668 : see if gethostent exists
13669 set gethostent d_gethent
13670 eval $inlibc
13671
13672 : see how we will look up host name
13673 echo " "
13674 call=''
13675 if set gethostname val -f d_gethname; eval $csym; $val; then
13676         echo 'gethostname() found.' >&4
13677         d_gethname="$define"
13678         call=gethostname
13679 fi
13680 if set uname val -f d_uname; eval $csym; $val; then
13681         if ./xenix; then
13682                 $cat <<'EOM'
13683 uname() was found, but you're running xenix, and older versions of xenix
13684 have a broken uname(). If you don't really know whether your xenix is old
13685 enough to have a broken system call, use the default answer.
13686
13687 EOM
13688                 dflt=y
13689                 case "$d_uname" in
13690                 "$define") dflt=n;;
13691                 esac
13692                 rp='Is your uname() broken?'
13693                 . ./myread
13694                 case "$ans" in
13695                 n*) d_uname="$define"; call=uname;;
13696                 esac
13697         else
13698                 echo 'uname() found.' >&4
13699                 d_uname="$define"
13700                 case "$call" in
13701                 '') call=uname ;;
13702                 esac
13703         fi
13704 fi
13705 case "$d_gethname" in
13706 '') d_gethname="$undef";;
13707 esac
13708 case "$d_uname" in
13709 '') d_uname="$undef";;
13710 esac
13711 case "$d_uname$d_gethname" in
13712 *define*)
13713         dflt=n
13714         cat <<EOM
13715
13716 Every now and then someone has a $call() that lies about the hostname
13717 but can't be fixed for political or economic reasons.  If you wish, I can
13718 pretend $call() isn't there and maybe compute hostname at run-time
13719 thanks to the '$phostname' command.
13720
13721 EOM
13722         rp="Shall I ignore $call() from now on?"
13723         . ./myread
13724         case "$ans" in
13725         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13726         esac;;
13727 esac
13728 case "$phostname" in
13729 '') aphostname='';;
13730 *) case "$aphostname" in
13731         /*) ;;
13732         *) set X $phostname
13733                 shift
13734                 file=$1
13735                 shift
13736                 file=`./loc $file $file $pth`
13737                 aphostname=`echo $file $*`
13738                 ;;
13739         esac
13740         ;;
13741 esac
13742 case "$d_uname$d_gethname" in
13743 *define*) ;;
13744 *)
13745         case "$phostname" in
13746         '')
13747                 echo "There will be no way for $package to get your hostname." >&4;;
13748         *)
13749         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13750                 ;;
13751         esac;;
13752 esac
13753 case "$d_phostname" in
13754 '') d_phostname="$undef";;
13755 esac
13756
13757 : see if gethostbyaddr_r exists
13758 set gethostbyaddr_r d_gethostbyaddr_r
13759 eval $inlibc
13760 case "$d_gethostbyaddr_r" in
13761 "$define")
13762         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13763         case "$d_gethostbyaddr_r_proto:$usethreads" in
13764         ":define")      d_gethostbyaddr_r_proto=define
13765                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13766                 eval $hasproto ;;
13767         *)      ;;
13768         esac
13769         case "$d_gethostbyaddr_r_proto" in
13770         define)
13771         case "$gethostbyaddr_r_proto" in
13772         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13773         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13774         esac
13775         case "$gethostbyaddr_r_proto" in
13776         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13777         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13778         esac
13779         case "$gethostbyaddr_r_proto" in
13780         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13781         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13782         esac
13783         case "$gethostbyaddr_r_proto" in
13784         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13785         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13786         esac
13787         case "$gethostbyaddr_r_proto" in
13788         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13789         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13790         esac
13791         case "$gethostbyaddr_r_proto" in
13792         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13793         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13794         esac
13795         case "$gethostbyaddr_r_proto" in
13796         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13797         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13798         esac
13799         case "$gethostbyaddr_r_proto" in
13800         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13801         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13802         esac
13803         case "$gethostbyaddr_r_proto" in
13804         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13805         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13806         esac
13807         case "$gethostbyaddr_r_proto" in
13808         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13809         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13810         esac
13811         case "$gethostbyaddr_r_proto" in
13812         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13813         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13814         esac
13815         case "$gethostbyaddr_r_proto" in
13816         ''|0)   d_gethostbyaddr_r=undef
13817                 gethostbyaddr_r_proto=0
13818                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13819         * )     case "$gethostbyaddr_r_proto" in
13820                 REENTRANT_PROTO*) ;;
13821                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13822                 esac
13823                 echo "Prototype: $try" ;;
13824         esac
13825         ;;
13826         *)      case "$usethreads" in
13827                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13828                 esac
13829                 d_gethostbyaddr_r=undef
13830                 gethostbyaddr_r_proto=0
13831                 ;;
13832         esac
13833         ;;
13834 *)      gethostbyaddr_r_proto=0
13835         ;;
13836 esac
13837
13838 : see if gethostbyname_r exists
13839 set gethostbyname_r d_gethostbyname_r
13840 eval $inlibc
13841 case "$d_gethostbyname_r" in
13842 "$define")
13843         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13844         case "$d_gethostbyname_r_proto:$usethreads" in
13845         ":define")      d_gethostbyname_r_proto=define
13846                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13847                 eval $hasproto ;;
13848         *)      ;;
13849         esac
13850         case "$d_gethostbyname_r_proto" in
13851         define)
13852         case "$gethostbyname_r_proto" in
13853         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13854         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13855         esac
13856         case "$gethostbyname_r_proto" in
13857         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13858         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13859         esac
13860         case "$gethostbyname_r_proto" in
13861         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13862         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13863         esac
13864         case "$gethostbyname_r_proto" in
13865         ''|0)   d_gethostbyname_r=undef
13866                 gethostbyname_r_proto=0
13867                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13868         * )     case "$gethostbyname_r_proto" in
13869                 REENTRANT_PROTO*) ;;
13870                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13871                 esac
13872                 echo "Prototype: $try" ;;
13873         esac
13874         ;;
13875         *)      case "$usethreads" in
13876                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13877                 esac
13878                 d_gethostbyname_r=undef
13879                 gethostbyname_r_proto=0
13880                 ;;
13881         esac
13882         ;;
13883 *)      gethostbyname_r_proto=0
13884         ;;
13885 esac
13886
13887 : see if gethostent_r exists
13888 set gethostent_r d_gethostent_r
13889 eval $inlibc
13890 case "$d_gethostent_r" in
13891 "$define")
13892         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13893         case "$d_gethostent_r_proto:$usethreads" in
13894         ":define")      d_gethostent_r_proto=define
13895                 set d_gethostent_r_proto gethostent_r $hdrs
13896                 eval $hasproto ;;
13897         *)      ;;
13898         esac
13899         case "$d_gethostent_r_proto" in
13900         define)
13901         case "$gethostent_r_proto" in
13902         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13903         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13904         esac
13905         case "$gethostent_r_proto" in
13906         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13907         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13908         esac
13909         case "$gethostent_r_proto" in
13910         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13911         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13912         esac
13913         case "$gethostent_r_proto" in
13914         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13915         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13916         esac
13917         case "$gethostent_r_proto" in
13918         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13919         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13920         esac
13921         case "$gethostent_r_proto" in
13922         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13923         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13924         esac
13925         case "$gethostent_r_proto" in
13926         ''|0)   d_gethostent_r=undef
13927                 gethostent_r_proto=0
13928                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13929         * )     case "$gethostent_r_proto" in
13930                 REENTRANT_PROTO*) ;;
13931                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13932                 esac
13933                 echo "Prototype: $try" ;;
13934         esac
13935         ;;
13936         *)      case "$usethreads" in
13937                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13938                 esac
13939                 d_gethostent_r=undef
13940                 gethostent_r_proto=0
13941                 ;;
13942         esac
13943         ;;
13944 *)      gethostent_r_proto=0
13945         ;;
13946 esac
13947
13948 : see if prototypes for various gethostxxx netdb.h functions are available
13949 echo " "
13950 set d_gethostprotos gethostent $i_netdb netdb.h
13951 eval $hasproto
13952
13953 : see if getitimer exists
13954 set getitimer d_getitimer
13955 eval $inlibc
13956
13957 : see if getlogin exists
13958 set getlogin d_getlogin
13959 eval $inlibc
13960
13961 : see if getlogin_r exists
13962 set getlogin_r d_getlogin_r
13963 eval $inlibc
13964 case "$d_getlogin_r" in
13965 "$define")
13966         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13967         case "$d_getlogin_r_proto:$usethreads" in
13968         ":define")      d_getlogin_r_proto=define
13969                 set d_getlogin_r_proto getlogin_r $hdrs
13970                 eval $hasproto ;;
13971         *)      ;;
13972         esac
13973         case "$d_getlogin_r_proto" in
13974         define)
13975         case "$getlogin_r_proto" in
13976         ''|0) try='int getlogin_r(char*, size_t);'
13977         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13978         esac
13979         case "$getlogin_r_proto" in
13980         ''|0) try='int getlogin_r(char*, int);'
13981         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13982         esac
13983         case "$getlogin_r_proto" in
13984         ''|0) try='char* getlogin_r(char*, size_t);'
13985         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13986         esac
13987         case "$getlogin_r_proto" in
13988         ''|0) try='char* getlogin_r(char*, int);'
13989         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13990         esac
13991         case "$getlogin_r_proto" in
13992         ''|0)   d_getlogin_r=undef
13993                 getlogin_r_proto=0
13994                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13995         * )     case "$getlogin_r_proto" in
13996                 REENTRANT_PROTO*) ;;
13997                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13998                 esac
13999                 echo "Prototype: $try" ;;
14000         esac
14001         ;;
14002         *)      case "$usethreads" in
14003                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14004                 esac
14005                 d_getlogin_r=undef
14006                 getlogin_r_proto=0
14007                 ;;
14008         esac
14009         ;;
14010 *)      getlogin_r_proto=0
14011         ;;
14012 esac
14013
14014 : see if getmnt exists
14015 set getmnt d_getmnt
14016 eval $inlibc
14017
14018 : see if getmntent exists
14019 set getmntent d_getmntent
14020 eval $inlibc
14021
14022 : see if getnameinfo exists
14023 set getnameinfo d_getnameinfo
14024 eval $inlibc
14025
14026 : see if getnetbyaddr exists
14027 set getnetbyaddr d_getnbyaddr
14028 eval $inlibc
14029
14030 : see if getnetbyname exists
14031 set getnetbyname d_getnbyname
14032 eval $inlibc
14033
14034 : see if getnetent exists
14035 set getnetent d_getnent
14036 eval $inlibc
14037
14038 : see if getnetbyaddr_r exists
14039 set getnetbyaddr_r d_getnetbyaddr_r
14040 eval $inlibc
14041 case "$d_getnetbyaddr_r" in
14042 "$define")
14043         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14044         case "$d_getnetbyaddr_r_proto:$usethreads" in
14045         ":define")      d_getnetbyaddr_r_proto=define
14046                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14047                 eval $hasproto ;;
14048         *)      ;;
14049         esac
14050         case "$d_getnetbyaddr_r_proto" in
14051         define)
14052         case "$getnetbyaddr_r_proto" in
14053         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14054         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14055         esac
14056         case "$getnetbyaddr_r_proto" in
14057         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14058         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14059         esac
14060         case "$getnetbyaddr_r_proto" in
14061         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14062         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14063         esac
14064         case "$getnetbyaddr_r_proto" in
14065         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14066         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14067         esac
14068         case "$getnetbyaddr_r_proto" in
14069         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14070         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14071         esac
14072         case "$getnetbyaddr_r_proto" in
14073         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14074         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14075         esac
14076         case "$getnetbyaddr_r_proto" in
14077         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14078         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14079         esac
14080         case "$getnetbyaddr_r_proto" in
14081         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14082         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14083         esac
14084         case "$getnetbyaddr_r_proto" in
14085         ''|0)   d_getnetbyaddr_r=undef
14086                 getnetbyaddr_r_proto=0
14087                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14088         * )     case "$getnetbyaddr_r_proto" in
14089                 REENTRANT_PROTO*) ;;
14090                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14091                 esac
14092                 echo "Prototype: $try" ;;
14093         esac
14094         ;;
14095         *)      case "$usethreads" in
14096                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14097                 esac
14098                 d_getnetbyaddr_r=undef
14099                 getnetbyaddr_r_proto=0
14100                 ;;
14101         esac
14102         ;;
14103 *)      getnetbyaddr_r_proto=0
14104         ;;
14105 esac
14106
14107 : see if getnetbyname_r exists
14108 set getnetbyname_r d_getnetbyname_r
14109 eval $inlibc
14110 case "$d_getnetbyname_r" in
14111 "$define")
14112         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14113         case "$d_getnetbyname_r_proto:$usethreads" in
14114         ":define")      d_getnetbyname_r_proto=define
14115                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14116                 eval $hasproto ;;
14117         *)      ;;
14118         esac
14119         case "$d_getnetbyname_r_proto" in
14120         define)
14121         case "$getnetbyname_r_proto" in
14122         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14123         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14124         esac
14125         case "$getnetbyname_r_proto" in
14126         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14127         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14128         esac
14129         case "$getnetbyname_r_proto" in
14130         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14131         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14132         esac
14133         case "$getnetbyname_r_proto" in
14134         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14135         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14136         esac
14137         case "$getnetbyname_r_proto" in
14138         ''|0)   d_getnetbyname_r=undef
14139                 getnetbyname_r_proto=0
14140                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14141         * )     case "$getnetbyname_r_proto" in
14142                 REENTRANT_PROTO*) ;;
14143                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14144                 esac
14145                 echo "Prototype: $try" ;;
14146         esac
14147         ;;
14148         *)      case "$usethreads" in
14149                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14150                 esac
14151                 d_getnetbyname_r=undef
14152                 getnetbyname_r_proto=0
14153                 ;;
14154         esac
14155         ;;
14156 *)      getnetbyname_r_proto=0
14157         ;;
14158 esac
14159
14160 : see if getnetent_r exists
14161 set getnetent_r d_getnetent_r
14162 eval $inlibc
14163 case "$d_getnetent_r" in
14164 "$define")
14165         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14166         case "$d_getnetent_r_proto:$usethreads" in
14167         ":define")      d_getnetent_r_proto=define
14168                 set d_getnetent_r_proto getnetent_r $hdrs
14169                 eval $hasproto ;;
14170         *)      ;;
14171         esac
14172         case "$d_getnetent_r_proto" in
14173         define)
14174         case "$getnetent_r_proto" in
14175         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14176         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14177         esac
14178         case "$getnetent_r_proto" in
14179         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14180         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14181         esac
14182         case "$getnetent_r_proto" in
14183         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14184         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14185         esac
14186         case "$getnetent_r_proto" in
14187         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14188         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14189         esac
14190         case "$getnetent_r_proto" in
14191         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14192         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14193         esac
14194         case "$getnetent_r_proto" in
14195         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14196         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14197         esac
14198         case "$getnetent_r_proto" in
14199         ''|0)   d_getnetent_r=undef
14200                 getnetent_r_proto=0
14201                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14202         * )     case "$getnetent_r_proto" in
14203                 REENTRANT_PROTO*) ;;
14204                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14205                 esac
14206                 echo "Prototype: $try" ;;
14207         esac
14208         ;;
14209         *)      case "$usethreads" in
14210                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14211                 esac
14212                 d_getnetent_r=undef
14213                 getnetent_r_proto=0
14214                 ;;
14215         esac
14216         ;;
14217 *)      getnetent_r_proto=0
14218         ;;
14219 esac
14220
14221 : see if prototypes for various getnetxxx netdb.h functions are available
14222 echo " "
14223 set d_getnetprotos getnetent $i_netdb netdb.h
14224 eval $hasproto
14225
14226 : see if getpagesize exists
14227 set getpagesize d_getpagsz
14228 eval $inlibc
14229
14230 : Optional checks for getprotobyname and getprotobynumber
14231
14232 : see if getprotobyname exists
14233 set getprotobyname d_getpbyname
14234 eval $inlibc
14235
14236 : see if getprotobynumber exists
14237 set getprotobynumber d_getpbynumber
14238 eval $inlibc
14239
14240 : see if getprotoent exists
14241 set getprotoent d_getpent
14242 eval $inlibc
14243
14244 : see if getpgid exists
14245 set getpgid d_getpgid
14246 eval $inlibc
14247
14248 : see if getpgrp2 exists
14249 set getpgrp2 d_getpgrp2
14250 eval $inlibc
14251
14252 : see if getppid exists
14253 set getppid d_getppid
14254 eval $inlibc
14255
14256 : see if getpriority exists
14257 set getpriority d_getprior
14258 eval $inlibc
14259
14260 : see if getprotobyname_r exists
14261 set getprotobyname_r d_getprotobyname_r
14262 eval $inlibc
14263 case "$d_getprotobyname_r" in
14264 "$define")
14265         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14266         case "$d_getprotobyname_r_proto:$usethreads" in
14267         ":define")      d_getprotobyname_r_proto=define
14268                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14269                 eval $hasproto ;;
14270         *)      ;;
14271         esac
14272         case "$d_getprotobyname_r_proto" in
14273         define)
14274         case "$getprotobyname_r_proto" in
14275         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14276         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14277         esac
14278         case "$getprotobyname_r_proto" in
14279         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14280         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14281         esac
14282         case "$getprotobyname_r_proto" in
14283         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14284         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14285         esac
14286         case "$getprotobyname_r_proto" in
14287         ''|0)   d_getprotobyname_r=undef
14288                 getprotobyname_r_proto=0
14289                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14290         * )     case "$getprotobyname_r_proto" in
14291                 REENTRANT_PROTO*) ;;
14292                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14293                 esac
14294                 echo "Prototype: $try" ;;
14295         esac
14296         ;;
14297         *)      case "$usethreads" in
14298                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14299                 esac
14300                 d_getprotobyname_r=undef
14301                 getprotobyname_r_proto=0
14302                 ;;
14303         esac
14304         ;;
14305 *)      getprotobyname_r_proto=0
14306         ;;
14307 esac
14308
14309 : see if getprotobynumber_r exists
14310 set getprotobynumber_r d_getprotobynumber_r
14311 eval $inlibc
14312 case "$d_getprotobynumber_r" in
14313 "$define")
14314         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14315         case "$d_getprotobynumber_r_proto:$usethreads" in
14316         ":define")      d_getprotobynumber_r_proto=define
14317                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14318                 eval $hasproto ;;
14319         *)      ;;
14320         esac
14321         case "$d_getprotobynumber_r_proto" in
14322         define)
14323         case "$getprotobynumber_r_proto" in
14324         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14325         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14326         esac
14327         case "$getprotobynumber_r_proto" in
14328         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14329         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14330         esac
14331         case "$getprotobynumber_r_proto" in
14332         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14333         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14334         esac
14335         case "$getprotobynumber_r_proto" in
14336         ''|0)   d_getprotobynumber_r=undef
14337                 getprotobynumber_r_proto=0
14338                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14339         * )     case "$getprotobynumber_r_proto" in
14340                 REENTRANT_PROTO*) ;;
14341                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14342                 esac
14343                 echo "Prototype: $try" ;;
14344         esac
14345         ;;
14346         *)      case "$usethreads" in
14347                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14348                 esac
14349                 d_getprotobynumber_r=undef
14350                 getprotobynumber_r_proto=0
14351                 ;;
14352         esac
14353         ;;
14354 *)      getprotobynumber_r_proto=0
14355         ;;
14356 esac
14357
14358 : see if getprotoent_r exists
14359 set getprotoent_r d_getprotoent_r
14360 eval $inlibc
14361 case "$d_getprotoent_r" in
14362 "$define")
14363         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14364         case "$d_getprotoent_r_proto:$usethreads" in
14365         ":define")      d_getprotoent_r_proto=define
14366                 set d_getprotoent_r_proto getprotoent_r $hdrs
14367                 eval $hasproto ;;
14368         *)      ;;
14369         esac
14370         case "$d_getprotoent_r_proto" in
14371         define)
14372         case "$getprotoent_r_proto" in
14373         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14374         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14375         esac
14376         case "$getprotoent_r_proto" in
14377         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14378         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14379         esac
14380         case "$getprotoent_r_proto" in
14381         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14382         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14383         esac
14384         case "$getprotoent_r_proto" in
14385         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14386         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14387         esac
14388         case "$getprotoent_r_proto" in
14389         ''|0)   d_getprotoent_r=undef
14390                 getprotoent_r_proto=0
14391                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14392         * )     case "$getprotoent_r_proto" in
14393                 REENTRANT_PROTO*) ;;
14394                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14395                 esac
14396                 echo "Prototype: $try" ;;
14397         esac
14398         ;;
14399         *)      case "$usethreads" in
14400                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14401                 esac
14402                 d_getprotoent_r=undef
14403                 getprotoent_r_proto=0
14404                 ;;
14405         esac
14406         ;;
14407 *)      getprotoent_r_proto=0
14408         ;;
14409 esac
14410
14411 : see if prototypes for various getprotoxxx netdb.h functions are available
14412 echo " "
14413 set d_getprotoprotos getprotoent $i_netdb netdb.h
14414 eval $hasproto
14415
14416 : see if getprpwnam exists
14417 set getprpwnam d_getprpwnam
14418 eval $inlibc
14419
14420 : see if getpwent exists
14421 set getpwent d_getpwent
14422 eval $inlibc
14423
14424 : see if getpwent_r exists
14425 set getpwent_r d_getpwent_r
14426 eval $inlibc
14427 case "$d_getpwent_r" in
14428 "$define")
14429         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14430         case "$d_getpwent_r_proto:$usethreads" in
14431         ":define")      d_getpwent_r_proto=define
14432                 set d_getpwent_r_proto getpwent_r $hdrs
14433                 eval $hasproto ;;
14434         *)      ;;
14435         esac
14436         case "$d_getpwent_r_proto" in
14437         define)
14438         case "$getpwent_r_proto" in
14439         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14440         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14441         esac
14442         case "$getpwent_r_proto" in
14443         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14444         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14445         esac
14446         case "$getpwent_r_proto" in
14447         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14448         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14449         esac
14450         case "$getpwent_r_proto" in
14451         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14452         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14453         esac
14454         case "$getpwent_r_proto" in
14455         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14456         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14457         esac
14458         case "$getpwent_r_proto" in
14459         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14460         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14461         esac
14462         case "$getpwent_r_proto" in
14463         ''|0)   d_getpwent_r=undef
14464                 getpwent_r_proto=0
14465                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14466         * )     case "$getpwent_r_proto" in
14467                 REENTRANT_PROTO*) ;;
14468                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14469                 esac
14470                 echo "Prototype: $try" ;;
14471         esac
14472         ;;
14473         *)      case "$usethreads" in
14474                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14475                 esac
14476                 d_getpwent_r=undef
14477                 getpwent_r_proto=0
14478                 ;;
14479         esac
14480         ;;
14481 *)      getpwent_r_proto=0
14482         ;;
14483 esac
14484
14485 : see if getpwnam_r exists
14486 set getpwnam_r d_getpwnam_r
14487 eval $inlibc
14488 case "$d_getpwnam_r" in
14489 "$define")
14490         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14491         case "$d_getpwnam_r_proto:$usethreads" in
14492         ":define")      d_getpwnam_r_proto=define
14493                 set d_getpwnam_r_proto getpwnam_r $hdrs
14494                 eval $hasproto ;;
14495         *)      ;;
14496         esac
14497         case "$d_getpwnam_r_proto" in
14498         define)
14499         case "$getpwnam_r_proto" in
14500         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14501         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14502         esac
14503         case "$getpwnam_r_proto" in
14504         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14505         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14506         esac
14507         case "$getpwnam_r_proto" in
14508         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14509         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14510         esac
14511         case "$getpwnam_r_proto" in
14512         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14513         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14514         esac
14515         case "$getpwnam_r_proto" in
14516         ''|0)   d_getpwnam_r=undef
14517                 getpwnam_r_proto=0
14518                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14519         * )     case "$getpwnam_r_proto" in
14520                 REENTRANT_PROTO*) ;;
14521                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14522                 esac
14523                 echo "Prototype: $try" ;;
14524         esac
14525         ;;
14526         *)      case "$usethreads" in
14527                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14528                 esac
14529                 d_getpwnam_r=undef
14530                 getpwnam_r_proto=0
14531                 ;;
14532         esac
14533         ;;
14534 *)      getpwnam_r_proto=0
14535         ;;
14536 esac
14537
14538 : see if getpwuid_r exists
14539 set getpwuid_r d_getpwuid_r
14540 eval $inlibc
14541 case "$d_getpwuid_r" in
14542 "$define")
14543         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14544         case "$d_getpwuid_r_proto:$usethreads" in
14545         ":define")      d_getpwuid_r_proto=define
14546                 set d_getpwuid_r_proto getpwuid_r $hdrs
14547                 eval $hasproto ;;
14548         *)      ;;
14549         esac
14550         case "$d_getpwuid_r_proto" in
14551         define)
14552         case "$getpwuid_r_proto" in
14553         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14554         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14555         esac
14556         case "$getpwuid_r_proto" in
14557         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14558         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14559         esac
14560         case "$getpwuid_r_proto" in
14561         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14562         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14563         esac
14564         case "$getpwuid_r_proto" in
14565         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14566         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14567         esac
14568         case "$getpwuid_r_proto" in
14569         ''|0)   d_getpwuid_r=undef
14570                 getpwuid_r_proto=0
14571                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14572         * )     case "$getpwuid_r_proto" in
14573                 REENTRANT_PROTO*) ;;
14574                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14575                 esac
14576                 echo "Prototype: $try" ;;
14577         esac
14578         ;;
14579         *)      case "$usethreads" in
14580                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14581                 esac
14582                 d_getpwuid_r=undef
14583                 getpwuid_r_proto=0
14584                 ;;
14585         esac
14586         ;;
14587 *)      getpwuid_r_proto=0
14588         ;;
14589 esac
14590
14591 : Optional checks for getsbyname and getsbyport
14592
14593 : see if getservbyname exists
14594 set getservbyname d_getsbyname
14595 eval $inlibc
14596
14597 : see if getservbyport exists
14598 set getservbyport d_getsbyport
14599 eval $inlibc
14600
14601 : see if getservent exists
14602 set getservent d_getsent
14603 eval $inlibc
14604
14605 : see if getservbyname_r exists
14606 set getservbyname_r d_getservbyname_r
14607 eval $inlibc
14608 case "$d_getservbyname_r" in
14609 "$define")
14610         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14611         case "$d_getservbyname_r_proto:$usethreads" in
14612         ":define")      d_getservbyname_r_proto=define
14613                 set d_getservbyname_r_proto getservbyname_r $hdrs
14614                 eval $hasproto ;;
14615         *)      ;;
14616         esac
14617         case "$d_getservbyname_r_proto" in
14618         define)
14619         case "$getservbyname_r_proto" in
14620         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14621         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14622         esac
14623         case "$getservbyname_r_proto" in
14624         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14625         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14626         esac
14627         case "$getservbyname_r_proto" in
14628         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14629         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14630         esac
14631         case "$getservbyname_r_proto" in
14632         ''|0)   d_getservbyname_r=undef
14633                 getservbyname_r_proto=0
14634                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14635         * )     case "$getservbyname_r_proto" in
14636                 REENTRANT_PROTO*) ;;
14637                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14638                 esac
14639                 echo "Prototype: $try" ;;
14640         esac
14641         ;;
14642         *)      case "$usethreads" in
14643                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14644                 esac
14645                 d_getservbyname_r=undef
14646                 getservbyname_r_proto=0
14647                 ;;
14648         esac
14649         ;;
14650 *)      getservbyname_r_proto=0
14651         ;;
14652 esac
14653
14654 : see if getservbyport_r exists
14655 set getservbyport_r d_getservbyport_r
14656 eval $inlibc
14657 case "$d_getservbyport_r" in
14658 "$define")
14659         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14660         case "$d_getservbyport_r_proto:$usethreads" in
14661         ":define")      d_getservbyport_r_proto=define
14662                 set d_getservbyport_r_proto getservbyport_r $hdrs
14663                 eval $hasproto ;;
14664         *)      ;;
14665         esac
14666         case "$d_getservbyport_r_proto" in
14667         define)
14668         case "$getservbyport_r_proto" in
14669         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14670         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14671         esac
14672         case "$getservbyport_r_proto" in
14673         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14674         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14675         esac
14676         case "$getservbyport_r_proto" in
14677         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14678         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14679         esac
14680         case "$getservbyport_r_proto" in
14681         ''|0)   d_getservbyport_r=undef
14682                 getservbyport_r_proto=0
14683                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14684         * )     case "$getservbyport_r_proto" in
14685                 REENTRANT_PROTO*) ;;
14686                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14687                 esac
14688                 echo "Prototype: $try" ;;
14689         esac
14690         ;;
14691         *)      case "$usethreads" in
14692                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14693                 esac
14694                 d_getservbyport_r=undef
14695                 getservbyport_r_proto=0
14696                 ;;
14697         esac
14698         ;;
14699 *)      getservbyport_r_proto=0
14700         ;;
14701 esac
14702
14703 : see if getservent_r exists
14704 set getservent_r d_getservent_r
14705 eval $inlibc
14706 case "$d_getservent_r" in
14707 "$define")
14708         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14709         case "$d_getservent_r_proto:$usethreads" in
14710         ":define")      d_getservent_r_proto=define
14711                 set d_getservent_r_proto getservent_r $hdrs
14712                 eval $hasproto ;;
14713         *)      ;;
14714         esac
14715         case "$d_getservent_r_proto" in
14716         define)
14717         case "$getservent_r_proto" in
14718         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14719         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14720         esac
14721         case "$getservent_r_proto" in
14722         ''|0) try='int getservent_r(struct servent*, char*, int);'
14723         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14724         esac
14725         case "$getservent_r_proto" in
14726         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14727         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14728         esac
14729         case "$getservent_r_proto" in
14730         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14731         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14732         esac
14733         case "$getservent_r_proto" in
14734         ''|0)   d_getservent_r=undef
14735                 getservent_r_proto=0
14736                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14737         * )     case "$getservent_r_proto" in
14738                 REENTRANT_PROTO*) ;;
14739                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14740                 esac
14741                 echo "Prototype: $try" ;;
14742         esac
14743         ;;
14744         *)      case "$usethreads" in
14745                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14746                 esac
14747                 d_getservent_r=undef
14748                 getservent_r_proto=0
14749                 ;;
14750         esac
14751         ;;
14752 *)      getservent_r_proto=0
14753         ;;
14754 esac
14755
14756 : see if prototypes for various getservxxx netdb.h functions are available
14757 echo " "
14758 set d_getservprotos getservent $i_netdb netdb.h
14759 eval $hasproto
14760
14761 : see if getspnam exists
14762 set getspnam d_getspnam
14763 eval $inlibc
14764
14765 : see if this is a shadow.h system
14766 set shadow.h i_shadow
14767 eval $inhdr
14768
14769 : see if getspnam_r exists
14770 set getspnam_r d_getspnam_r
14771 eval $inlibc
14772 case "$d_getspnam_r" in
14773 "$define")
14774         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14775         case "$d_getspnam_r_proto:$usethreads" in
14776         ":define")      d_getspnam_r_proto=define
14777                 set d_getspnam_r_proto getspnam_r $hdrs
14778                 eval $hasproto ;;
14779         *)      ;;
14780         esac
14781         case "$d_getspnam_r_proto" in
14782         define)
14783         case "$getspnam_r_proto" in
14784         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14785         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14786         esac
14787         case "$getspnam_r_proto" in
14788         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14789         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14790         esac
14791         case "$getspnam_r_proto" in
14792         ''|0)   d_getspnam_r=undef
14793                 getspnam_r_proto=0
14794                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14795         * )     case "$getspnam_r_proto" in
14796                 REENTRANT_PROTO*) ;;
14797                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14798                 esac
14799                 echo "Prototype: $try" ;;
14800         esac
14801         ;;
14802         *)      case "$usethreads" in
14803                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14804                 esac
14805                 d_getspnam_r=undef
14806                 getspnam_r_proto=0
14807                 ;;
14808         esac
14809         ;;
14810 *)      getspnam_r_proto=0
14811         ;;
14812 esac
14813
14814 : see if gettimeofday or ftime exists
14815 set gettimeofday d_gettimeod
14816 eval $inlibc
14817 case "$d_gettimeod" in
14818 "$undef")
14819         set ftime d_ftime 
14820         eval $inlibc
14821         ;;
14822 *)
14823         val="$undef"; set d_ftime; eval $setvar
14824         ;;
14825 esac
14826 case "$d_gettimeod$d_ftime" in
14827 "$undef$undef")
14828         echo " "
14829         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14830         ;;
14831 esac
14832
14833 : see if gmtime_r exists
14834 set gmtime_r d_gmtime_r
14835 eval $inlibc
14836 case "$d_gmtime_r" in
14837 "$define")
14838         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14839         case "$d_gmtime_r_proto:$usethreads" in
14840         ":define")      d_gmtime_r_proto=define
14841                 set d_gmtime_r_proto gmtime_r $hdrs
14842                 eval $hasproto ;;
14843         *)      ;;
14844         esac
14845         case "$d_gmtime_r_proto" in
14846         define)
14847         case "$gmtime_r_proto" in
14848         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14849         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14850         esac
14851         case "$gmtime_r_proto" in
14852         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14853         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14854         esac
14855         case "$gmtime_r_proto" in
14856         ''|0)   d_gmtime_r=undef
14857                 gmtime_r_proto=0
14858                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14859         * )     case "$gmtime_r_proto" in
14860                 REENTRANT_PROTO*) ;;
14861                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14862                 esac
14863                 echo "Prototype: $try" ;;
14864         esac
14865         ;;
14866         *)      case "$usethreads" in
14867                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14868                 esac
14869                 d_gmtime_r=undef
14870                 gmtime_r_proto=0
14871                 ;;
14872         esac
14873         ;;
14874 *)      gmtime_r_proto=0
14875         ;;
14876 esac
14877
14878 : see if hasmntopt exists
14879 set hasmntopt d_hasmntopt
14880 eval $inlibc
14881
14882 : see if this is a netinet/in.h or sys/in.h system
14883 set netinet/in.h i_niin sys/in.h i_sysin
14884 eval $inhdr
14885
14886 : see if arpa/inet.h has to be included
14887 set arpa/inet.h i_arpainet
14888 eval $inhdr
14889
14890 : see if htonl --and friends-- exists
14891 val=''
14892 set htonl val
14893 eval $inlibc
14894
14895 : Maybe they are macros.
14896 case "$val" in
14897 $undef)
14898         $cat >htonl.c <<EOM
14899 #include <stdio.h>
14900 #include <sys/types.h>
14901 #$i_niin I_NETINET_IN
14902 #$i_sysin I_SYS_IN
14903 #$i_arpainet I_ARPA_INET
14904 #ifdef I_NETINET_IN
14905 #include <netinet/in.h>
14906 #endif
14907 #ifdef I_SYS_IN
14908 #include <sys/in.h>
14909 #endif
14910 #ifdef I_ARPA_INET
14911 #include <arpa/inet.h>
14912 #endif
14913 #ifdef htonl
14914 printf("Defined as a macro.");
14915 #endif
14916 EOM
14917         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14918         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14919                 val="$define"
14920                 echo "But it seems to be defined as a macro." >&4
14921         fi
14922         $rm -f htonl.?
14923         ;;
14924 esac
14925 set d_htonl
14926 eval $setvar
14927
14928 : see if ilogbl exists
14929 set ilogbl d_ilogbl
14930 eval $inlibc
14931
14932 : index or strchr
14933 echo " "
14934 if set index val -f; eval $csym; $val; then
14935         if set strchr val -f d_strchr; eval $csym; $val; then
14936                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14937                         val="$define"
14938                         vali="$undef"
14939                         echo "strchr() found." >&4
14940                 else
14941                         val="$undef"
14942                         vali="$define"
14943                         echo "index() found." >&4
14944                 fi
14945         else
14946                 val="$undef"
14947                 vali="$define"
14948                 echo "index() found." >&4
14949         fi
14950 else
14951         if set strchr val -f d_strchr; eval $csym; $val; then
14952                 val="$define"
14953                 vali="$undef"
14954                 echo "strchr() found." >&4
14955         else
14956                 echo "No index() or strchr() found!" >&4
14957                 val="$undef"
14958                 vali="$undef"
14959         fi
14960 fi
14961 set d_strchr; eval $setvar
14962 val="$vali"
14963 set d_index; eval $setvar
14964
14965 : check whether inet_aton exists
14966 set inet_aton d_inetaton
14967 eval $inlibc
14968
14969 : see if inet_ntop exists
14970 set inet_ntop d_inetntop
14971 eval $inlibc
14972
14973 : see if inet_pton exists
14974 set inet_pton d_inetpton
14975 eval $inlibc
14976
14977 : Look for isascii
14978 echo " "
14979 $cat >isascii.c <<EOCP
14980 #include <stdio.h>
14981 #include <ctype.h>
14982 #$i_stdlib I_STDLIB
14983 #ifdef I_STDLIB
14984 #include <stdlib.h>
14985 #endif
14986 int main() {
14987         int c = 'A';
14988         if (isascii(c))
14989                 exit(0);
14990         else
14991                 exit(1);
14992 }
14993 EOCP
14994 set isascii
14995 if eval $compile; then
14996         echo "isascii() found." >&4
14997         val="$define"
14998 else
14999         echo "isascii() NOT found." >&4
15000         val="$undef"
15001 fi
15002 set d_isascii
15003 eval $setvar
15004 $rm -f isascii*
15005
15006 : Look for isblank
15007 echo " "
15008 $cat >isblank.c <<'EOCP'
15009 #include <stdio.h>
15010 #include <ctype.h>
15011 int main() {
15012         int c = ' ';
15013         if (isblank(c))
15014                 exit(0);
15015         else
15016                 exit(1);
15017 }
15018 EOCP
15019 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15020         echo "isblank() found." >&4
15021         val="$define"
15022 else
15023         echo "isblank() NOT found." >&4
15024         val="$undef"
15025 fi
15026 set d_isblank
15027 eval $setvar
15028 $rm -f isblank*
15029
15030 : see if isfinite exists
15031 set isfinite d_isfinite
15032 eval $inlibc
15033
15034 : see if isinf exists
15035 set isinf d_isinf
15036 eval $inlibc
15037
15038 : see if isnan exists
15039 set isnan d_isnan
15040 eval $inlibc
15041
15042 : see if isnanl exists
15043 set isnanl d_isnanl
15044 eval $inlibc
15045
15046 : see if killpg exists
15047 set killpg d_killpg
15048 eval $inlibc
15049
15050 : see if lchown exists
15051 echo " "
15052 $cat > try.c <<'EOCP'
15053 /* System header to define __stub macros and hopefully few prototypes,
15054     which can conflict with char lchown(); below.  */
15055 #include <assert.h>
15056 /* Override any gcc2 internal prototype to avoid an error.  */
15057 /* We use char because int might match the return type of a gcc2
15058    builtin and then its argument prototype would still apply.  */
15059 char lchown();
15060 int main() {
15061     /*  The GNU C library defines this for functions which it implements
15062         to always fail with ENOSYS.  Some functions are actually named
15063         something starting with __ and the normal name is an alias.  */
15064 #if defined (__stub_lchown) || defined (__stub___lchown)
15065 choke me
15066 #else
15067 lchown();
15068 #endif
15069 ; return 0; }
15070 EOCP
15071 set try
15072 if eval $compile; then
15073     $echo "lchown() found." >&4
15074     val="$define"
15075 else
15076     $echo "lchown() NOT found." >&4
15077     val="$undef"
15078 fi
15079 set d_lchown
15080 eval $setvar
15081
15082 : See if number of significant digits in a double precision number is known
15083 echo " "
15084 $cat >ldbl_dig.c <<EOM
15085 #$i_limits I_LIMITS
15086 #$i_float I_FLOAT
15087 #ifdef I_LIMITS
15088 #include <limits.h>
15089 #endif
15090 #ifdef I_FLOAT
15091 #include <float.h>
15092 #endif
15093 #ifdef LDBL_DIG
15094 printf("Contains LDBL_DIG");
15095 #endif
15096 EOM
15097 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15098 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15099         echo "LDBL_DIG found." >&4
15100         val="$define"
15101 else
15102         echo "LDBL_DIG NOT found." >&4
15103         val="$undef"
15104 fi
15105 $rm -f ldbl_dig.?
15106 set d_ldbl_dig
15107 eval $setvar
15108
15109 : see if this is a math.h system
15110 set math.h i_math
15111 eval $inhdr
15112
15113 : check to see if math.h defines _LIB_VERSION
15114 d_libm_lib_version="$undef"
15115 case $i_math in
15116     $define)
15117         echo " "
15118         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15119         $cat >try.c <<EOCP
15120 #include <unistd.h>
15121 #include <math.h>
15122 int main (int argc, char *argv[])
15123 {
15124     printf ("%d\n", _LIB_VERSION);
15125     return (0);
15126     } /* main */
15127 EOCP
15128         set try
15129         if eval $compile; then
15130             foo=`$run ./try`
15131             echo "Yes, it does ($foo)" >&4
15132             d_libm_lib_version="$define"
15133         else
15134             echo "No, it does not (probably harmless)" >&4
15135             fi
15136         $rm_try
15137         ;;
15138
15139     esac
15140
15141 : see if link exists
15142 set link d_link
15143 eval $inlibc
15144
15145 : see if localtime_r exists
15146 set localtime_r d_localtime_r
15147 eval $inlibc
15148 case "$d_localtime_r" in
15149 "$define")
15150         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15151         case "$d_localtime_r_proto:$usethreads" in
15152         ":define")      d_localtime_r_proto=define
15153                 set d_localtime_r_proto localtime_r $hdrs
15154                 eval $hasproto ;;
15155         *)      ;;
15156         esac
15157         case "$d_localtime_r_proto" in
15158         define)
15159         case "$localtime_r_proto" in
15160         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15161         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15162         esac
15163         case "$localtime_r_proto" in
15164         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15165         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15166         esac
15167         case "$localtime_r_proto" in
15168         ''|0)   d_localtime_r=undef
15169                 localtime_r_proto=0
15170                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15171         * )     case "$localtime_r_proto" in
15172                 REENTRANT_PROTO*) ;;
15173                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15174                 esac
15175                 echo "Prototype: $try" ;;
15176         esac
15177         ;;
15178         *)      case "$usethreads" in
15179                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15180                 esac
15181                 d_localtime_r=undef
15182                 localtime_r_proto=0
15183                 ;;
15184         esac
15185         ;;
15186 *)      localtime_r_proto=0
15187         ;;
15188 esac
15189
15190 : see if localtime_r calls tzset
15191 case "$localtime_r_proto" in
15192 REENTRANT_PROTO*)
15193         $cat >try.c <<EOCP
15194 /*  Does our libc's localtime_r call tzset ?
15195  *  return 0 if so, 1 otherwise.
15196  */
15197 #$i_systypes    I_SYS_TYPES
15198 #$i_unistd      I_UNISTD
15199 #$i_time        I_TIME
15200 #$i_stdlib      I_STDLIB
15201 #$i_string      I_STRING
15202 #$i_malloc      I_MALLOC
15203 #ifdef I_SYS_TYPES
15204 #  include <sys/types.h>
15205 #endif
15206 #ifdef I_UNISTD
15207 #  include <unistd.h>
15208 #endif
15209 #ifdef I_TIME
15210 #  include <time.h>
15211 #endif
15212 #ifdef I_STDLIB
15213 #include <stdlib.h>
15214 #endif
15215 #ifdef I_STRING
15216 #  include <string.h>
15217 #else
15218 #  include <strings.h>
15219 #endif
15220 #ifdef I_MALLOC
15221 #  include <malloc.h>
15222 #endif
15223 int main()
15224 {
15225     time_t t = time(0L);
15226     char w_tz[]="TZ" "=GMT+5",
15227          e_tz[]="TZ" "=GMT-5",
15228         *tz_e = (char*)malloc(16),
15229         *tz_w = (char*)malloc(16);
15230     struct tm tm_e, tm_w;
15231     memset(&tm_e,'\0',sizeof(struct tm));
15232     memset(&tm_w,'\0',sizeof(struct tm));
15233     strcpy(tz_e,e_tz);
15234     strcpy(tz_w,w_tz);
15235
15236     putenv(tz_e);
15237     localtime_r(&t, &tm_e);
15238
15239     putenv(tz_w);
15240     localtime_r(&t, &tm_w);
15241
15242     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15243         return 1;
15244     return 0;
15245 }
15246 EOCP
15247         set try
15248         if eval $compile; then
15249             if $run ./try; then
15250                 d_localtime_r_needs_tzset=undef;
15251             else
15252                 d_localtime_r_needs_tzset=define;
15253             fi;
15254         else
15255             d_localtime_r_needs_tzset=undef;
15256         fi;
15257      ;;
15258   *)
15259      d_localtime_r_needs_tzset=undef;
15260      ;;
15261 esac
15262 $rm_try
15263
15264 : see if localeconv exists
15265 set localeconv d_locconv
15266 eval $inlibc
15267
15268 : see if lockf exists
15269 set lockf d_lockf
15270 eval $inlibc
15271
15272 : see if prototype for lseek is available
15273 echo " "
15274 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15275 eval $hasproto
15276
15277 : see if lstat exists
15278 set lstat d_lstat
15279 eval $inlibc
15280
15281 : see if madvise exists
15282 set madvise d_madvise
15283 eval $inlibc
15284
15285 : see if malloc_size exists
15286 set malloc_size d_malloc_size
15287 eval $inlibc
15288
15289 : see if malloc_size_good exists
15290 set malloc_good_size d_malloc_good_size
15291 eval $inlibc
15292
15293 : see if mblen exists
15294 set mblen d_mblen
15295 eval $inlibc
15296
15297 : see if mbstowcs exists
15298 set mbstowcs d_mbstowcs
15299 eval $inlibc
15300
15301 : see if mbtowc exists
15302 set mbtowc d_mbtowc
15303 eval $inlibc
15304
15305 : see if memchr exists
15306 set memchr d_memchr
15307 eval $inlibc
15308
15309 : see if memcmp exists
15310 set memcmp d_memcmp
15311 eval $inlibc
15312
15313 : see if memcpy exists
15314 set memcpy d_memcpy
15315 eval $inlibc
15316
15317 : see if memmove exists
15318 set memmove d_memmove
15319 eval $inlibc
15320
15321 : see if memset exists
15322 set memset d_memset
15323 eval $inlibc
15324
15325 : see if mkdir exists
15326 set mkdir d_mkdir
15327 eval $inlibc
15328
15329 : see if mkdtemp exists
15330 set mkdtemp d_mkdtemp
15331 eval $inlibc
15332
15333 : see if mkfifo exists
15334 set mkfifo d_mkfifo
15335 eval $inlibc
15336
15337 : see if mkstemp exists
15338 set mkstemp d_mkstemp
15339 eval $inlibc
15340
15341 : see if mkstemps exists
15342 set mkstemps d_mkstemps
15343 eval $inlibc
15344
15345 : see if mktime exists
15346 set mktime d_mktime
15347 eval $inlibc
15348
15349 : see if this is a sys/mman.h system
15350 set sys/mman.h i_sysmman
15351 eval $inhdr
15352
15353 : see if mmap exists
15354 set mmap d_mmap
15355 eval $inlibc
15356 : see what shmat returns
15357 : default to something harmless
15358 mmaptype='void *'
15359 case "$i_sysmman$d_mmap" in
15360 "$define$define")
15361         $cat >mmap.c <<'END'
15362 #include <sys/mman.h>
15363 void *mmap();
15364 END
15365         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15366                 mmaptype='void *'
15367         else
15368                 mmaptype='caddr_t'
15369         fi
15370         echo "and it returns ($mmaptype)." >&4
15371         ;;
15372 esac
15373
15374
15375
15376 : see if sqrtl exists
15377 set sqrtl d_sqrtl
15378 eval $inlibc
15379
15380 : see if scalbnl exists
15381 set scalbnl d_scalbnl
15382 eval $inlibc
15383
15384 : see if modfl exists
15385 set modfl d_modfl
15386 eval $inlibc
15387
15388 : see if prototype for modfl is available
15389 echo " "
15390 set d_modflproto modfl $i_math math.h
15391 eval $hasproto
15392
15393 d_modfl_pow32_bug="$undef"
15394
15395 case "$d_longdbl$d_modfl" in
15396 $define$define)
15397         $cat <<EOM
15398 Checking to see whether your modfl() is okay for large values...
15399 EOM
15400 $cat >try.c <<EOCP
15401 #include <math.h>
15402 #include <stdio.h>
15403 EOCP
15404 if $test "X$d_modflproto" != "X$define"; then
15405         $cat >>try.c <<EOCP
15406 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15407 long double modfl (long double, long double *);
15408 EOCP
15409 fi
15410 $cat >>try.c <<EOCP
15411 int main() {
15412     long double nv = 4294967303.15;
15413     long double v, w;
15414     v = modfl(nv, &w);
15415 #ifdef __GLIBC__
15416     printf("glibc");
15417 #endif
15418     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15419     return 0;
15420 }
15421 EOCP
15422         case "$osname:$gccversion" in
15423         aix:)   saveccflags="$ccflags"
15424                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15425         esac
15426         set try
15427         if eval $compile; then
15428                 foo=`$run ./try`
15429                 case "$foo" in
15430                 *" 4294967303.150000 1.150000 4294967302.000000")
15431                         echo >&4 "Your modfl() is broken for large values."
15432                         d_modfl_pow32_bug="$define"
15433                         case "$foo" in
15434                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15435                         ;;
15436                         esac
15437                         ;;
15438                 *" 4294967303.150000 0.150000 4294967303.000000")
15439                         echo >&4 "Your modfl() seems okay for large values."
15440                         ;;
15441                 *)      echo >&4 "I don't understand your modfl() at all."
15442                         d_modfl="$undef"
15443                         ;;
15444                 esac
15445                 $rm_try
15446         else
15447                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15448                 d_modfl="$undef"
15449         fi
15450         case "$osname:$gccversion" in
15451         aix:)   ccflags="$saveccflags" ;; # restore
15452         esac
15453         ;;
15454 esac
15455
15456 if $test "$uselongdouble" = "$define"; then
15457     message=""
15458     if $test "$d_sqrtl" != "$define"; then
15459         message="$message sqrtl"
15460     fi
15461     if $test "$d_modfl" != "$define"; then
15462         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15463             echo "You have both aintl and copysignl, so I can emulate modfl."
15464         else
15465             message="$message modfl"
15466         fi
15467     fi
15468     if $test "$d_frexpl" != "$define"; then
15469         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15470             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15471         else
15472             message="$message frexpl"
15473         fi
15474     fi
15475
15476     if $test "$message" != ""; then
15477         $cat <<EOM >&4
15478
15479 *** You requested the use of long doubles but you do not seem to have
15480 *** the following mathematical functions needed for long double support:
15481 ***    $message
15482 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15483 *** Cannot continue, aborting.
15484
15485 EOM
15486
15487         exit 1
15488     fi
15489 fi
15490
15491 : see if mprotect exists
15492 set mprotect d_mprotect
15493 eval $inlibc
15494
15495 : see if msgctl exists
15496 set msgctl d_msgctl
15497 eval $inlibc
15498
15499 : see if msgget exists
15500 set msgget d_msgget
15501 eval $inlibc
15502
15503 : see if msgsnd exists
15504 set msgsnd d_msgsnd
15505 eval $inlibc
15506
15507 : see if msgrcv exists
15508 set msgrcv d_msgrcv
15509 eval $inlibc
15510
15511 : see how much of the 'msg*(2)' library is present.
15512 h_msg=true
15513 echo " "
15514 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15515 *"$undef"*) h_msg=false;;
15516 esac
15517 case "$osname" in
15518 freebsd)
15519     case "`ipcs 2>&1`" in
15520     "SVID messages"*"not configured"*)
15521         echo "Your $osname does not have the msg*(2) configured." >&4
15522         h_msg=false
15523         val="$undef"
15524         set msgctl d_msgctl
15525         eval $setvar
15526         set msgget d_msgget
15527         eval $setvar
15528         set msgsnd d_msgsnd
15529         eval $setvar
15530         set msgrcv d_msgrcv
15531         eval $setvar
15532         ;;
15533     esac
15534     ;;
15535 esac
15536 : we could also check for sys/ipc.h ...
15537 if $h_msg && $test `./findhdr sys/msg.h`; then
15538         echo "You have the full msg*(2) library." >&4
15539         val="$define"
15540 else
15541         echo "You don't have the full msg*(2) library." >&4
15542         val="$undef"
15543 fi
15544 set d_msg
15545 eval $setvar
15546
15547 : Check for msghdr_s
15548 echo " "
15549 echo "Checking to see if your system supports struct msghdr..." >&4
15550 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15551 eval $hasstruct
15552 case "$d_msghdr_s" in
15553 "$define")      echo "Yes, it does."   ;;
15554 *)              echo "No, it doesn't." ;;
15555 esac
15556
15557
15558 : see if msync exists
15559 set msync d_msync
15560 eval $inlibc
15561
15562 : see if munmap exists
15563 set munmap d_munmap
15564 eval $inlibc
15565
15566 : see if nice exists
15567 set nice d_nice
15568 eval $inlibc
15569
15570 : see if this is a langinfo.h system
15571 set langinfo.h i_langinfo
15572 eval $inhdr
15573
15574 : see if nl_langinfo exists
15575 set nl_langinfo d_nl_langinfo
15576 eval $inlibc
15577
15578 : check for volatile keyword
15579 echo " "
15580 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15581 $cat >try.c <<'EOCP'
15582 int main()
15583 {
15584         typedef struct _goo_struct goo_struct;
15585         goo_struct * volatile goo = ((goo_struct *)0);
15586         struct _goo_struct {
15587                 long long_int;
15588                 int reg_int;
15589                 char char_var;
15590         };
15591         typedef unsigned short foo_t;
15592         char *volatile foo;
15593         volatile int bar;
15594         volatile foo_t blech;
15595         foo = foo;
15596 }
15597 EOCP
15598 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15599         val="$define"
15600         echo "Yup, it does."
15601 else
15602         val="$undef"
15603         echo "Nope, it doesn't."
15604 fi
15605 set d_volatile
15606 eval $setvar
15607 $rm_try
15608
15609 : Check basic sizes
15610 echo " "
15611 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15612
15613 case "$use64bitint:$d_quad:$quadtype" in
15614 define:define:?*)
15615         ivtype="$quadtype"
15616         uvtype="$uquadtype"
15617         ivsize=8
15618         uvsize=8
15619         ;;
15620 *)      ivtype="long"
15621         uvtype="unsigned long"
15622         ivsize=$longsize
15623         uvsize=$longsize
15624         ;;
15625 esac
15626
15627 case "$uselongdouble:$d_longdbl" in
15628 define:define)
15629         nvtype="long double"
15630         nvsize=$longdblsize
15631         ;;
15632 *)      nvtype=double
15633         nvsize=$doublesize
15634         ;;
15635 esac
15636
15637 $echo "(IV will be "$ivtype", $ivsize bytes)"
15638 $echo "(UV will be "$uvtype", $uvsize bytes)"
15639 $echo "(NV will be "$nvtype", $nvsize bytes)"
15640
15641 $cat >try.c <<EOCP
15642 #$i_inttypes I_INTTYPES
15643 #ifdef I_INTTYPES
15644 #include <inttypes.h>
15645 #endif
15646 #include <stdio.h>
15647 int main() {
15648 #ifdef INT8
15649    int8_t i =  INT8_MAX;
15650   uint8_t u = UINT8_MAX;
15651   printf("int8_t\n");
15652 #endif
15653 #ifdef INT16
15654    int16_t i =  INT16_MAX;
15655   uint16_t i = UINT16_MAX;
15656   printf("int16_t\n");
15657 #endif
15658 #ifdef INT32
15659    int32_t i =  INT32_MAX;
15660   uint32_t u = UINT32_MAX;
15661   printf("int32_t\n");
15662 #endif
15663 }
15664 EOCP
15665
15666 i8type="signed char"
15667 u8type="unsigned char"
15668 i8size=1
15669 u8size=1
15670
15671 case "$i16type" in
15672 '')     case "$shortsize" in
15673         2)      i16type=short
15674                 u16type="unsigned short"
15675                 i16size=$shortsize
15676                 u16size=$shortsize
15677                 ;;
15678         esac
15679         ;;
15680 esac
15681 case "$i16type" in
15682 '')     set try -DINT16
15683         if eval $compile; then
15684                 case "`$run ./try`" in
15685                 int16_t)
15686                         i16type=int16_t
15687                         u16type=uint16_t
15688                         i16size=2
15689                         u16size=2
15690                         ;;
15691                 esac
15692         fi
15693         ;;
15694 esac
15695 case "$i16type" in
15696 '')     if $test $shortsize -ge 2; then
15697                 i16type=short
15698                 u16type="unsigned short"
15699                 i16size=$shortsize
15700                 u16size=$shortsize
15701         fi
15702         ;;
15703 esac
15704
15705 case "$i32type" in
15706 '')     case "$longsize" in
15707         4)      i32type=long
15708                 u32type="unsigned long"
15709                 i32size=$longsize
15710                 u32size=$longsize
15711                 ;;
15712         *)      case "$intsize" in
15713                 4)      i32type=int
15714                         u32type="unsigned int"
15715                         i32size=$intsize
15716                         u32size=$intsize
15717                         ;;
15718                 esac
15719                 ;;
15720         esac
15721         ;;
15722 esac
15723 case "$i32type" in
15724 '')     set try -DINT32
15725         if eval $compile; then
15726                 case "`$run ./try`" in
15727                 int32_t)
15728                         i32type=int32_t
15729                         u32type=uint32_t
15730                         i32size=4
15731                         u32size=4
15732                         ;;
15733                 esac
15734         fi
15735         ;;
15736 esac
15737 case "$i32type" in
15738 '')     if $test $intsize -ge 4; then
15739                 i32type=int
15740                 u32type="unsigned int"
15741                 i32size=$intsize
15742                 u32size=$intsize
15743         fi
15744         ;;
15745 esac
15746
15747 case "$i64type" in
15748 '')     case "$d_quad:$quadtype" in
15749         define:?*)
15750                 i64type="$quadtype"
15751                 u64type="$uquadtype"
15752                 i64size=8
15753                 u64size=8
15754                 ;;
15755         esac
15756         ;;
15757 esac
15758
15759 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15760 : volatile so that the compiler has to store it out to memory.
15761 if test X"$d_volatile" = X"$define"; then
15762         volatile=volatile
15763 fi
15764 $cat <<EOP >try.c
15765 #include <stdio.h>
15766 #$i_stdlib I_STDLIB
15767 #ifdef I_STDLIB
15768 #include <stdlib.h>
15769 #endif
15770 #include <sys/types.h>
15771 #include <signal.h>
15772 #ifdef SIGFPE
15773 $volatile int bletched = 0;
15774 $signal_t blech(int s) { bletched = 1; }
15775 #endif
15776 int main() {
15777     $uvtype u = 0;
15778     $nvtype d;
15779     int     n = 8 * $uvsize;
15780     int     i;
15781 #ifdef SIGFPE
15782     signal(SIGFPE, blech);
15783 #endif
15784
15785     for (i = 0; i < n; i++) {
15786       u = u << 1 | ($uvtype)1;
15787       d = ($nvtype)u;
15788       if (($uvtype)d != u)
15789         break;
15790       if (d <= 0)
15791         break;
15792       d = ($nvtype)(u - 1);
15793       if (($uvtype)d != (u - 1))
15794         break;
15795 #ifdef SIGFPE
15796       if (bletched)
15797         break;
15798 #endif
15799     }
15800     printf("%d\n", ((i == n) ? -n : i));
15801     exit(0);
15802 }
15803 EOP
15804 set try
15805
15806 d_nv_preserves_uv="$undef"
15807 if eval $compile; then
15808         nv_preserves_uv_bits="`$run ./try`"
15809 fi
15810 case "$nv_preserves_uv_bits" in
15811 \-[1-9]*)
15812         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15813         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15814         d_nv_preserves_uv="$define"
15815         ;;
15816 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15817         d_nv_preserves_uv="$undef" ;;
15818 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15819         nv_preserves_uv_bits="0" ;;
15820 esac
15821 $rm_try
15822
15823 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15824 : volatile so that the compiler has to store it out to memory.
15825 if test X"$d_volatile" = X"$define"; then
15826         volatile=volatile
15827 fi
15828 $cat <<EOP >try.c
15829 #include <stdio.h>
15830
15831 typedef $nvtype NV;
15832
15833 int
15834 main() {
15835   NV value = 2;
15836   int count = 1;
15837
15838   while(count < 256) {
15839     $volatile NV up = value + 1.0;
15840     $volatile NV negated = -value;
15841     $volatile NV down = negated - 1.0;
15842     $volatile NV got_up = up - value;
15843     int up_good = got_up == 1.0;
15844     int got_down = down - negated;
15845     int down_good = got_down == -1.0;
15846
15847     if (down_good != up_good) {
15848       fprintf(stderr,
15849               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15850               up_good, (double) got_up, down_good, (double) got_down,
15851               count, (double) value);
15852       return 1;
15853     }
15854     if (!up_good) {
15855       while (1) {
15856         if (count > 8) {
15857           count -= 8;
15858           fputs("256.0", stdout);
15859         } else {
15860           count--;
15861           fputs("2.0", stdout);
15862         }
15863         if (!count) {
15864           puts("");
15865           return 0;
15866         }
15867         fputs("*", stdout);
15868       }
15869     }
15870     value *= 2;
15871     ++count;
15872   }
15873   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15874           count, (double) value);
15875   return 1;
15876 }
15877 EOP
15878 set try
15879
15880 nv_overflows_integers_at='0'
15881 if eval $compile; then
15882     xxx="`$run ./try`"
15883     case "$?" in
15884         0)
15885             case "$xxx" in
15886                 2*)  cat >&4 <<EOM
15887 The largest integer your NVs can preserve is equal to $xxx
15888 EOM
15889                     nv_overflows_integers_at="$xxx"
15890                     ;;
15891                 *)  cat >&4 <<EOM
15892 Cannot determine the largest integer value your NVs can hold, unexpected output
15893 '$xxx'
15894 EOM
15895                     ;;
15896             esac
15897             ;;
15898         *)  cat >&4 <<EOM
15899 Cannot determine the largest integer value your NVs can hold
15900 EOM
15901             ;;
15902     esac
15903 fi
15904 $rm_try
15905
15906 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15907 : volatile so that the compiler has to store it out to memory.
15908 if test X"$d_volatile" = X"$define"; then
15909         volatile=volatile
15910 fi
15911 $cat <<EOP >try.c
15912 #include <stdio.h>
15913 #$i_stdlib I_STDLIB
15914 #ifdef I_STDLIB
15915 #include <stdlib.h>
15916 #endif
15917 #$i_string I_STRING
15918 #ifdef I_STRING
15919 #  include <string.h>
15920 #else
15921 #  include <strings.h>
15922 #endif
15923 #include <sys/types.h>
15924 #include <signal.h>
15925 #ifdef SIGFPE
15926 $volatile int bletched = 0;
15927 $signal_t blech(int s) { bletched = 1; }
15928 #endif
15929
15930 int checkit($nvtype d, char *where) {
15931     unsigned char *p = (char *)&d;
15932     unsigned char *end = p + sizeof(d);
15933     int fail = 0;
15934
15935     while (p < end)
15936         fail += *p++;
15937
15938     if (!fail)
15939         return 0;
15940
15941     p = (char *)&d;
15942     printf("No - %s: 0x", where);
15943     while (p < end)
15944         printf ("%02X", *p++);
15945     printf("\n");
15946     return 1;
15947 }
15948
15949 int main(int argc, char **argv) {
15950     $nvtype d = 0.0;
15951     int fail = 0;
15952     fail += checkit(d, "0.0");
15953
15954     /* The compiler shouldn't be assuming that bletched is 0  */
15955     d = bletched;
15956
15957     fail += checkit(d, "bleched");
15958
15959 #ifdef SIGFPE
15960     signal(SIGFPE, blech);
15961 #endif
15962
15963     /* Paranoia - the compiler should have no way of knowing that ANSI says
15964        that argv[argc] will always be NULL.  Actually, if it did assume this it
15965        would be buggy, as this is C and main() can be called from elsewhere in
15966        the program.  */
15967     d = argv[argc] ? 1 : 0;
15968
15969     if (d) {
15970         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15971     }
15972
15973     fail += checkit(d, "ternary");
15974
15975     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15976
15977     if (d != 0.0) {
15978         printf("No - memset doesn't give 0.0\n");
15979         /* This might just blow up:  */
15980         printf("(gives %g)\n", d);
15981         return 1;
15982     }
15983
15984 #ifdef SIGFPE
15985     if (bletched) {
15986         printf("No - something bleched\n");
15987         return 1;
15988     }
15989 #endif
15990     if (fail) {
15991       printf("No - %d fail(s)\n", fail);
15992       return 1;
15993     }
15994     printf("Yes\n");
15995     return 0;
15996 }
15997 EOP
15998 set try
15999
16000 d_nv_zero_is_allbits_zero="$undef"
16001 if eval $compile; then
16002     xxx="`$run ./try`"
16003     case "$?" in
16004         0)
16005             case "$xxx" in
16006                 Yes)  cat >&4 <<EOM
16007 0.0 is represented as all bits zero in memory
16008 EOM
16009                     d_nv_zero_is_allbits_zero="$define"
16010                     ;;
16011                 *)  cat >&4 <<EOM
16012 0.0 is not represented as all bits zero in memory
16013 EOM
16014                     d_nv_zero_is_allbits_zero="$undef"
16015                     ;;
16016             esac
16017             ;;
16018         *)  cat >&4 <<EOM
16019 0.0 is not represented as all bits zero in memory
16020 EOM
16021             d_nv_zero_is_allbits_zero="$undef"
16022             ;;
16023     esac
16024 fi
16025 $rm_try
16026
16027 : check for off64_t
16028 echo " "
16029 echo "Checking to see if you have off64_t..." >&4
16030 $cat >try.c <<EOCP
16031 #include <sys/types.h>
16032 #include <unistd.h>
16033 int main() { off64_t x = 7; }
16034 EOCP
16035 set try
16036 if eval $compile; then
16037         val="$define"
16038         echo "You have off64_t."
16039 else
16040         val="$undef"
16041         echo "You do not have off64_t."
16042         case "$lseeksize" in
16043         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16044         esac
16045 fi
16046 $rm_try
16047 set d_off64_t
16048 eval $setvar
16049
16050 : how to create joinable pthreads
16051 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16052         echo " "
16053         echo "Checking what constant to use for creating joinable pthreads..." >&4
16054         $cat >try.c <<'EOCP'
16055 #include <pthread.h>
16056 int main() {
16057     int detachstate = JOINABLE;
16058 }
16059 EOCP
16060         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16061         if eval $compile; then
16062                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16063                 val="$undef" # Yes, undef.
16064                 set d_old_pthread_create_joinable
16065                 eval $setvar
16066                 val=""
16067                 set old_pthread_create_joinable
16068                 eval $setvar
16069         else
16070                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16071                 if eval $compile; then
16072                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16073                         val="$define"
16074                         set d_old_pthread_create_joinable
16075                         eval $setvar
16076                         val=PTHREAD_CREATE_UNDETACHED
16077                         set old_pthread_create_joinable
16078                         eval $setvar
16079                 else
16080                         set try -DJOINABLE=__UNDETACHED
16081                         if eval $compile; then
16082                                 echo "You seem to use __UNDETACHED." >&4
16083                                 val="$define"
16084                                 set d_old_pthread_create_joinable
16085                                 eval $setvar
16086                                 val=__UNDETACHED
16087                                 set old_pthread_create_joinable
16088                                 eval $setvar
16089                         else
16090                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16091                                 val="$define"
16092                                 set d_old_pthread_create_joinable
16093                                 eval $setvar
16094                                 val=0
16095                                 set old_pthread_create_joinable
16096                                 eval $setvar
16097                         fi
16098                 fi
16099         fi
16100         $rm_try
16101 else
16102     d_old_pthread_create_joinable="$undef"
16103     old_pthread_create_joinable=""
16104 fi
16105
16106 : see if pause exists
16107 set pause d_pause
16108 eval $inlibc
16109
16110 : see if poll exists
16111 set poll d_poll
16112 eval $inlibc
16113
16114 : see if prctl exists
16115 set prctl d_prctl
16116 eval $inlibc
16117
16118 : see if prctl supports PR_SET_NAME
16119 d_prctl_set_name=$undef
16120 case $d_prctl in
16121     $define)
16122         $cat >try.c <<EOM
16123 #include <sys/prctl.h>
16124
16125 int main (int argc, char *argv[])
16126 {
16127     return (prctl (PR_SET_NAME, "Test"));
16128     } /* main */
16129 EOM
16130         set try
16131         if eval $compile_ok && $run ./try; then
16132             echo "Your prctl (PR_SET_NAME, ...) works"
16133             d_prctl_set_name=$define
16134             fi
16135         $rm_try
16136         ;;
16137     esac
16138
16139 : see if readlink exists
16140 set readlink d_readlink
16141 eval $inlibc
16142
16143 : Check if exe is symlink to abs path of executing program
16144 echo " "
16145 procselfexe=''
16146 val="$undef"
16147 case "$d_readlink" in
16148     "$define")
16149         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16150         : more tidy to avoid an extra level of symlink
16151         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16152         while test $# -gt 0; do
16153             type=$1; try=$2
16154             shift; shift
16155             if $issymlink $try; then
16156                 $ls -l $try > reflect
16157                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16158                     echo "You have $type-like $try."
16159                     procselfexe='"'$try'"'
16160                     val="$define"
16161                     : This will break out of the loop
16162                     set X; shift
16163                 fi
16164             fi
16165         done
16166         ;;
16167 esac
16168 $rm -f reflect
16169 set d_procselfexe
16170 eval $setvar
16171
16172 : backward compatibility for d_hvfork
16173 if test X$d_hvfork != X; then
16174         d_vfork="$d_hvfork"
16175         d_hvfork=''
16176 fi
16177 : see if there is a vfork
16178 val=''
16179 set vfork val
16180 eval $inlibc
16181
16182 d_pseudofork=$undef
16183
16184 : Ok, but do we want to use it. vfork is reportedly unreliable in
16185 : perl on Solaris 2.x, and probably elsewhere.
16186 case "$val" in
16187 $define)
16188         echo " "
16189         case "$usevfork" in
16190         false) dflt='n';;
16191         *) dflt='y';;
16192         esac
16193         cat <<'EOM'
16194
16195 Perl can only use a vfork() that doesn't suffer from strict
16196 restrictions on calling functions or modifying global data in
16197 the child.  For example, glibc-2.1 contains such a vfork()
16198 that is unsuitable.  If your system provides a proper fork()
16199 call, chances are that you do NOT want perl to use vfork().
16200
16201 EOM
16202         rp="Do you still want to use vfork()?"
16203         . ./myread
16204         case "$ans" in
16205         y|Y) ;;
16206         *)
16207                 echo "Ok, we won't use vfork()."
16208                 val="$undef"
16209                 ;;
16210         esac
16211         ;;
16212 esac
16213 set d_vfork
16214 eval $setvar
16215 case "$d_vfork" in
16216 $define) usevfork='true';;
16217 *) usevfork='false';;
16218 esac
16219
16220 : see whether the pthread_atfork exists
16221 $cat >try.c <<EOP
16222 #include <pthread.h>
16223 #include <stdio.h>
16224 int main() {
16225 #ifdef  PTHREAD_ATFORK
16226         pthread_atfork(NULL,NULL,NULL);
16227 #endif
16228 }
16229 EOP
16230
16231 : see if pthread_atfork exists
16232 set try -DPTHREAD_ATFORK
16233 if eval $compile; then
16234     val="$define"
16235 else
16236     val="$undef"
16237 fi
16238 case "$usethreads" in
16239 $define)
16240         case "$val" in
16241         $define) echo 'pthread_atfork found.' >&4        ;;
16242         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16243         esac
16244 esac
16245 set d_pthread_atfork
16246 eval $setvar
16247
16248 : see if pthread_attr_setscope exists
16249 set pthread_attr_setscope d_pthread_attr_setscope
16250 eval $inlibc
16251
16252 : see whether the various POSIXish _yields exist
16253 $cat >try.c <<EOP
16254 #include <pthread.h>
16255 #include <stdio.h>
16256 int main() {
16257 #ifdef SCHED_YIELD
16258         sched_yield();
16259 #else
16260 #ifdef PTHREAD_YIELD
16261         pthread_yield();
16262 #else
16263 #ifdef PTHREAD_YIELD_NULL
16264         pthread_yield(NULL);
16265 #endif
16266 #endif
16267 #endif
16268 }
16269 EOP
16270 : see if sched_yield exists
16271 set try -DSCHED_YIELD
16272 if eval $compile; then
16273     val="$define"
16274     sched_yield='sched_yield()'
16275 else
16276     val="$undef"
16277 fi
16278 case "$usethreads" in
16279 $define)
16280         case "$val" in
16281         $define) echo 'sched_yield() found.' >&4        ;;
16282         *)       echo 'sched_yield() NOT found.' >&4    ;;
16283         esac
16284 esac
16285 set d_sched_yield
16286 eval $setvar
16287
16288 : see if pthread_yield exists
16289 set try -DPTHREAD_YIELD
16290 if eval $compile; then
16291     val="$define"
16292     case "$sched_yield" in
16293     '') sched_yield='pthread_yield()' ;;
16294     esac
16295 else
16296     set try -DPTHREAD_YIELD_NULL
16297     if eval $compile; then
16298         val="$define"
16299         case "$sched_yield" in
16300         '') sched_yield='pthread_yield(NULL)' ;;
16301         esac
16302     else
16303         val="$undef"
16304     fi
16305 fi
16306 case "$usethreads" in
16307 $define)
16308         case "$val" in
16309         $define) echo 'pthread_yield() found.' >&4      ;;
16310         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16311         esac
16312         ;;
16313 esac
16314 set d_pthread_yield
16315 eval $setvar
16316 case "$sched_yield" in
16317 '') sched_yield=undef ;;
16318 esac
16319 $rm_try
16320
16321 : see if random_r exists
16322 set random_r d_random_r
16323 eval $inlibc
16324 case "$d_random_r" in
16325 "$define")
16326         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16327         case "$d_random_r_proto:$usethreads" in
16328         ":define")      d_random_r_proto=define
16329                 set d_random_r_proto random_r $hdrs
16330                 eval $hasproto ;;
16331         *)      ;;
16332         esac
16333         case "$d_random_r_proto" in
16334         define)
16335         case "$random_r_proto" in
16336         ''|0) try='int random_r(int*, struct random_data*);'
16337         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16338         esac
16339         case "$random_r_proto" in
16340         ''|0) try='int random_r(long*, struct random_data*);'
16341         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16342         esac
16343         case "$random_r_proto" in
16344         ''|0) try='int random_r(struct random_data*, int32_t*);'
16345         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16346         esac
16347         case "$random_r_proto" in
16348         ''|0)   d_random_r=undef
16349                 random_r_proto=0
16350                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16351         * )     case "$random_r_proto" in
16352                 REENTRANT_PROTO*) ;;
16353                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16354                 esac
16355                 echo "Prototype: $try" ;;
16356         esac
16357         ;;
16358         *)      case "$usethreads" in
16359                 define) echo "random_r has no prototype, not using it." >&4 ;;
16360                 esac
16361                 d_random_r=undef
16362                 random_r_proto=0
16363                 ;;
16364         esac
16365         ;;
16366 *)      random_r_proto=0
16367         ;;
16368 esac
16369
16370 : see if readdir and friends exist
16371 set readdir d_readdir
16372 eval $inlibc
16373 set seekdir d_seekdir
16374 eval $inlibc
16375 set telldir d_telldir
16376 eval $inlibc
16377 set rewinddir d_rewinddir
16378 eval $inlibc
16379
16380 : see if readdir64_r exists
16381 set readdir64_r d_readdir64_r
16382 eval $inlibc
16383 case "$d_readdir64_r" in
16384 "$define")
16385         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16386         case "$d_readdir64_r_proto:$usethreads" in
16387         ":define")      d_readdir64_r_proto=define
16388                 set d_readdir64_r_proto readdir64_r $hdrs
16389                 eval $hasproto ;;
16390         *)      ;;
16391         esac
16392         case "$d_readdir64_r_proto" in
16393         define)
16394         case "$readdir64_r_proto" in
16395         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16396         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16397         esac
16398         case "$readdir64_r_proto" in
16399         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16400         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16401         esac
16402         case "$readdir64_r_proto" in
16403         ''|0)   d_readdir64_r=undef
16404                 readdir64_r_proto=0
16405                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16406         * )     case "$readdir64_r_proto" in
16407                 REENTRANT_PROTO*) ;;
16408                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16409                 esac
16410                 echo "Prototype: $try" ;;
16411         esac
16412         ;;
16413         *)      case "$usethreads" in
16414                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16415                 esac
16416                 d_readdir64_r=undef
16417                 readdir64_r_proto=0
16418                 ;;
16419         esac
16420         ;;
16421 *)      readdir64_r_proto=0
16422         ;;
16423 esac
16424
16425 : see if readdir_r exists
16426 set readdir_r d_readdir_r
16427 eval $inlibc
16428 case "$d_readdir_r" in
16429 "$define")
16430         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16431         case "$d_readdir_r_proto:$usethreads" in
16432         ":define")      d_readdir_r_proto=define
16433                 set d_readdir_r_proto readdir_r $hdrs
16434                 eval $hasproto ;;
16435         *)      ;;
16436         esac
16437         case "$d_readdir_r_proto" in
16438         define)
16439         case "$readdir_r_proto" in
16440         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16441         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16442         esac
16443         case "$readdir_r_proto" in
16444         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16445         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16446         esac
16447         case "$readdir_r_proto" in
16448         ''|0)   d_readdir_r=undef
16449                 readdir_r_proto=0
16450                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16451         * )     case "$readdir_r_proto" in
16452                 REENTRANT_PROTO*) ;;
16453                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16454                 esac
16455                 echo "Prototype: $try" ;;
16456         esac
16457         ;;
16458         *)      case "$usethreads" in
16459                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16460                 esac
16461                 d_readdir_r=undef
16462                 readdir_r_proto=0
16463                 ;;
16464         esac
16465         ;;
16466 *)      readdir_r_proto=0
16467         ;;
16468 esac
16469
16470 : see if readv exists
16471 set readv d_readv
16472 eval $inlibc
16473
16474 : see if recvmsg exists
16475 set recvmsg d_recvmsg
16476 eval $inlibc
16477
16478 : see if rename exists
16479 set rename d_rename
16480 eval $inlibc
16481
16482 : see if rmdir exists
16483 set rmdir d_rmdir
16484 eval $inlibc
16485
16486 : see if memory.h is available.
16487 val=''
16488 set memory.h val
16489 eval $inhdr
16490
16491 : See if it conflicts with string.h
16492 case "$val" in
16493 $define)
16494         case "$strings" in
16495         '') ;;
16496         *)
16497                 $cppstdin $cppflags $cppminus < $strings > mem.h
16498                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16499                         echo " "
16500                         echo "We won't be including <memory.h>."
16501                         val="$undef"
16502                 fi
16503                 $rm -f mem.h
16504                 ;;
16505         esac
16506 esac
16507 set i_memory
16508 eval $setvar
16509
16510 : can bcopy handle overlapping blocks?
16511 echo " "
16512 val="$undef"
16513 case "$d_memmove" in
16514 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16515 *)      case "$d_bcopy" in
16516         "$define")
16517                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16518                 $cat >try.c <<EOCP
16519 #$i_memory I_MEMORY
16520 #$i_stdlib I_STDLIB
16521 #$i_string I_STRING
16522 #$i_unistd I_UNISTD
16523 EOCP
16524         $cat >>try.c <<'EOCP'
16525 #include <stdio.h>
16526 #ifdef I_MEMORY
16527 #  include <memory.h>
16528 #endif
16529 #ifdef I_STDLIB
16530 #  include <stdlib.h>
16531 #endif
16532 #ifdef I_STRING
16533 #  include <string.h>
16534 #else
16535 #  include <strings.h>
16536 #endif
16537 #ifdef I_UNISTD
16538 #  include <unistd.h>  /* Needed for NetBSD */
16539 #endif
16540 int main()
16541 {
16542 char buf[128], abc[128];
16543 char *b;
16544 int len;
16545 int off;
16546 int align;
16547
16548 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16549    try to store the string in read-only memory. */
16550 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16551
16552 for (align = 7; align >= 0; align--) {
16553         for (len = 36; len; len--) {
16554                 b = buf+align;
16555                 bcopy(abc, b, len);
16556                 for (off = 1; off <= len; off++) {
16557                         bcopy(b, b+off, len);
16558                         bcopy(b+off, b, len);
16559                         if (bcmp(b, abc, len))
16560                                 exit(1);
16561                 }
16562         }
16563 }
16564 exit(0);
16565 }
16566 EOCP
16567                 set try
16568                 if eval $compile_ok; then
16569                         if $run ./try 2>/dev/null; then
16570                                 echo "Yes, it can."
16571                                 val="$define"
16572                         else
16573                                 echo "It can't, sorry."
16574                         fi
16575                 else
16576                         echo "(I can't compile the test program, so we'll assume not...)"
16577                 fi
16578                 ;;
16579         esac
16580         $rm_try
16581         ;;
16582 esac
16583 set d_safebcpy
16584 eval $setvar
16585
16586 : can memcpy handle overlapping blocks?
16587 echo " "
16588 val="$undef"
16589 case "$d_memmove" in
16590 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16591 *)      case "$d_memcpy" in
16592         "$define")
16593                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16594                 $cat >try.c <<EOCP
16595 #$i_memory I_MEMORY
16596 #$i_stdlib I_STDLIB
16597 #$i_string I_STRING
16598 #$i_unistd I_UNISTD
16599 EOCP
16600         $cat >>try.c <<'EOCP'
16601 #include <stdio.h>
16602 #ifdef I_MEMORY
16603 #  include <memory.h>
16604 #endif
16605 #ifdef I_STDLIB
16606 #  include <stdlib.h>
16607 #endif
16608 #ifdef I_STRING
16609 #  include <string.h>
16610 #else
16611 #  include <strings.h>
16612 #endif
16613 #ifdef I_UNISTD
16614 #  include <unistd.h>  /* Needed for NetBSD */
16615 #endif
16616 int main()
16617 {
16618 char buf[128], abc[128];
16619 char *b;
16620 int len;
16621 int off;
16622 int align;
16623
16624 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16625    try to store the string in read-only memory. */
16626 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16627
16628 for (align = 7; align >= 0; align--) {
16629         for (len = 36; len; len--) {
16630                 b = buf+align;
16631                 memcpy(b, abc, len);
16632                 for (off = 1; off <= len; off++) {
16633                         memcpy(b+off, b, len);
16634                         memcpy(b, b+off, len);
16635                         if (memcmp(b, abc, len))
16636                                 exit(1);
16637                 }
16638         }
16639 }
16640 exit(0);
16641 }
16642 EOCP
16643                 set try
16644                 if eval $compile_ok; then
16645                         if $run ./try 2>/dev/null; then
16646                                 echo "Yes, it can."
16647                                 val="$define"
16648                         else
16649                                 echo "It can't, sorry."
16650                         fi
16651                 else
16652                         echo "(I can't compile the test program, so we'll assume not...)"
16653                 fi
16654                 ;;
16655         esac
16656         $rm_try
16657         ;;
16658 esac
16659 set d_safemcpy
16660 eval $setvar
16661
16662 : can memcmp be trusted to compare relative magnitude?
16663 val="$undef"
16664 case "$d_memcmp" in
16665 "$define")
16666         echo " "
16667         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16668         $cat >try.c <<EOCP
16669 #$i_memory I_MEMORY
16670 #$i_stdlib I_STDLIB
16671 #$i_string I_STRING
16672 #$i_unistd I_UNISTD
16673 EOCP
16674         $cat >>try.c <<'EOCP'
16675 #include <stdio.h>
16676 #ifdef I_MEMORY
16677 #  include <memory.h>
16678 #endif
16679 #ifdef I_STDLIB
16680 #  include <stdlib.h>
16681 #endif
16682 #ifdef I_STRING
16683 #  include <string.h>
16684 #else
16685 #  include <strings.h>
16686 #endif
16687 #ifdef I_UNISTD
16688 #  include <unistd.h>  /* Needed for NetBSD */
16689 #endif
16690 int main()
16691 {
16692 char a = -1;
16693 char b = 0;
16694 if ((a < b) && memcmp(&a, &b, 1) < 0)
16695         exit(1);
16696 exit(0);
16697 }
16698 EOCP
16699         set try
16700         if eval $compile_ok; then
16701                 if $run ./try 2>/dev/null; then
16702                         echo "Yes, it can."
16703                         val="$define"
16704                 else
16705                         echo "No, it can't (it uses signed chars)."
16706                 fi
16707         else
16708                 echo "(I can't compile the test program, so we'll assume not...)"
16709         fi
16710         ;;
16711 esac
16712 $rm_try
16713 set d_sanemcmp
16714 eval $setvar
16715
16716 : see if prototype for sbrk is available
16717 echo " "
16718 set d_sbrkproto sbrk $i_unistd unistd.h
16719 eval $hasproto
16720
16721 : see if select exists
16722 set select d_select
16723 eval $inlibc
16724
16725 : see if semctl exists
16726 set semctl d_semctl
16727 eval $inlibc
16728
16729 : see if semget exists
16730 set semget d_semget
16731 eval $inlibc
16732
16733 : see if semop exists
16734 set semop d_semop
16735 eval $inlibc
16736
16737 : see how much of the 'sem*(2)' library is present.
16738 h_sem=true
16739 echo " "
16740 case "$d_semctl$d_semget$d_semop" in
16741 *"$undef"*) h_sem=false;;
16742 esac
16743 case "$osname" in
16744 freebsd)
16745     case "`ipcs 2>&1`" in
16746     "SVID messages"*"not configured"*)
16747         echo "Your $osname does not have the sem*(2) configured." >&4
16748         h_sem=false
16749         val="$undef"
16750         set semctl d_semctl
16751         eval $setvar
16752         set semget d_semget
16753         eval $setvar
16754         set semop d_semop
16755         eval $setvar
16756         ;;
16757     esac
16758     ;;
16759 esac
16760 : we could also check for sys/ipc.h ...
16761 if $h_sem && $test `./findhdr sys/sem.h`; then
16762         echo "You have the full sem*(2) library." >&4
16763         val="$define"
16764 else
16765         echo "You don't have the full sem*(2) library." >&4
16766         val="$undef"
16767 fi
16768 set d_sem
16769 eval $setvar
16770
16771 : see whether sys/sem.h defines union semun
16772 echo " "
16773 $cat > try.c <<'END'
16774 #include <sys/types.h>
16775 #include <sys/ipc.h>
16776 #include <sys/sem.h>
16777 int main () { union semun semun; semun.buf = 0; }
16778 END
16779 set try
16780 if eval $compile; then
16781     echo "You have union semun in <sys/sem.h>." >&4
16782     val="$define"
16783 else
16784     echo "You do not have union semun in <sys/sem.h>." >&4
16785     val="$undef"
16786 fi
16787 $rm_try
16788 set d_union_semun
16789 eval $setvar
16790
16791 : see how to do semctl IPC_STAT
16792 case "$d_sem" in
16793 $define)
16794     echo " "
16795     $cat > tryh.h <<END
16796 #ifndef S_IRUSR
16797 #   ifdef S_IREAD
16798 #       define S_IRUSR S_IREAD
16799 #       define S_IWUSR S_IWRITE
16800 #       define S_IXUSR S_IEXEC
16801 #   else
16802 #       define S_IRUSR 0400
16803 #       define S_IWUSR 0200
16804 #       define S_IXUSR 0100
16805 #   endif
16806 #   define S_IRGRP (S_IRUSR>>3)
16807 #   define S_IWGRP (S_IWUSR>>3)
16808 #   define S_IXGRP (S_IXUSR>>3)
16809 #   define S_IROTH (S_IRUSR>>6)
16810 #   define S_IWOTH (S_IWUSR>>6)
16811 #   define S_IXOTH (S_IXUSR>>6)
16812 #endif
16813 #ifndef S_IRWXU
16814 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16815 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16816 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16817 #endif
16818 END
16819     : see whether semctl IPC_STAT can use union semun
16820     case "$d_semctl_semun" in
16821     '')
16822       val="$undef"
16823       $cat > try.c <<END
16824 #include <sys/types.h>
16825 #include <sys/ipc.h>
16826 #include <sys/sem.h>
16827 #include <sys/stat.h>
16828 #include <stdio.h>
16829 #include <errno.h>
16830 #include "tryh.h"
16831 #ifndef errno
16832 extern int errno;
16833 #endif
16834 #$d_union_semun HAS_UNION_SEMUN
16835 int main() {
16836     union semun
16837 #ifndef HAS_UNION_SEMUN
16838     {
16839         int val;
16840         struct semid_ds *buf;
16841         unsigned short *array;
16842     }
16843 #endif
16844     arg;
16845     int sem, st;
16846
16847 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16848     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16849     if (sem > -1) {
16850         struct semid_ds argbuf;
16851         arg.buf = &argbuf;
16852 #       ifdef IPC_STAT
16853         st = semctl(sem, 0, IPC_STAT, arg);
16854         if (st == 0)
16855             printf("semun\n");
16856         else
16857 #       endif /* IPC_STAT */
16858             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16859 #       ifdef IPC_RMID
16860         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16861 #       endif /* IPC_RMID */
16862             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16863     } else
16864 #endif /* IPC_PRIVATE && ... */
16865         printf("semget failed: errno = %d\n", errno);
16866   return 0;
16867 }
16868 END
16869       set try
16870       if eval $compile; then
16871           xxx=`$run ./try`
16872           case "$xxx" in
16873           semun) val="$define" ;;
16874           esac
16875       fi
16876       $rm_try
16877       set d_semctl_semun
16878       eval $setvar
16879       ;;
16880     esac
16881     case "$d_semctl_semun" in
16882     $define)
16883         echo "You can use union semun for semctl IPC_STAT." >&4
16884         also='also'
16885         ;;
16886     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16887         also=''
16888         ;;
16889     esac
16890
16891     : see whether semctl IPC_STAT can use struct semid_ds pointer
16892     case "$d_semctl_semid_ds" in
16893     '')
16894       val="$undef"
16895       $cat > try.c <<'END'
16896 #include <sys/types.h>
16897 #include <sys/ipc.h>
16898 #include <sys/sem.h>
16899 #include <sys/stat.h>
16900 #include "tryh.h"
16901 #include <stdio.h>
16902 #include <errno.h>
16903 #ifndef errno
16904 extern int errno;
16905 #endif
16906 int main() {
16907     struct semid_ds arg;
16908     int sem, st;
16909
16910 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16911     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16912     if (sem > -1) {
16913 #       ifdef IPC_STAT
16914         st = semctl(sem, 0, IPC_STAT, &arg);
16915         if (st == 0)
16916             printf("semid_ds\n");
16917         else
16918 #       endif /* IPC_STAT */
16919             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16920 #       ifdef IPC_RMID
16921         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16922 #       endif /* IPC_RMID */
16923             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16924     } else
16925 #endif /* IPC_PRIVATE && ... */
16926         printf("semget failed: errno = %d\n", errno);
16927
16928     return 0;
16929 }
16930 END
16931       set try
16932       if eval $compile; then
16933           xxx=`$run ./try`
16934           case "$xxx" in
16935           semid_ds) val="$define" ;;
16936           esac
16937       fi
16938       $rm_try
16939       set d_semctl_semid_ds
16940       eval $setvar
16941       ;;
16942     esac
16943     case "$d_semctl_semid_ds" in
16944     $define)
16945         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16946         ;;
16947     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16948         ;;
16949     esac
16950     ;;
16951 *)  val="$undef"
16952
16953     # We do not have the full sem*(2) library, so assume we can not
16954     # use either.
16955
16956     set d_semctl_semun
16957     eval $setvar
16958
16959     set d_semctl_semid_ds
16960     eval $setvar
16961     ;;
16962 esac
16963 $rm_try tryh.h
16964
16965 : see if sendmsg exists
16966 set sendmsg d_sendmsg
16967 eval $inlibc
16968
16969 : see if setegid exists
16970 set setegid d_setegid
16971 eval $inlibc
16972
16973 : see if seteuid exists
16974 set seteuid d_seteuid
16975 eval $inlibc
16976
16977 : see if setgrent exists
16978 set setgrent d_setgrent
16979 eval $inlibc
16980
16981 : see if setgrent_r exists
16982 set setgrent_r d_setgrent_r
16983 eval $inlibc
16984 case "$d_setgrent_r" in
16985 "$define")
16986         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16987         case "$d_setgrent_r_proto:$usethreads" in
16988         ":define")      d_setgrent_r_proto=define
16989                 set d_setgrent_r_proto setgrent_r $hdrs
16990                 eval $hasproto ;;
16991         *)      ;;
16992         esac
16993         case "$d_setgrent_r_proto" in
16994         define)
16995         case "$setgrent_r_proto" in
16996         ''|0) try='int setgrent_r(FILE**);'
16997         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16998         esac
16999         case "$setgrent_r_proto" in
17000         ''|0) try='void setgrent_r(FILE**);'
17001         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17002         esac
17003         case "$setgrent_r_proto" in
17004         ''|0)   d_setgrent_r=undef
17005                 setgrent_r_proto=0
17006                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17007         * )     case "$setgrent_r_proto" in
17008                 REENTRANT_PROTO*) ;;
17009                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17010                 esac
17011                 echo "Prototype: $try" ;;
17012         esac
17013         ;;
17014         *)      case "$usethreads" in
17015                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17016                 esac
17017                 d_setgrent_r=undef
17018                 setgrent_r_proto=0
17019                 ;;
17020         esac
17021         ;;
17022 *)      setgrent_r_proto=0
17023         ;;
17024 esac
17025
17026 : see if sethostent exists
17027 set sethostent d_sethent
17028 eval $inlibc
17029
17030 : see if sethostent_r exists
17031 set sethostent_r d_sethostent_r
17032 eval $inlibc
17033 case "$d_sethostent_r" in
17034 "$define")
17035         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17036         case "$d_sethostent_r_proto:$usethreads" in
17037         ":define")      d_sethostent_r_proto=define
17038                 set d_sethostent_r_proto sethostent_r $hdrs
17039                 eval $hasproto ;;
17040         *)      ;;
17041         esac
17042         case "$d_sethostent_r_proto" in
17043         define)
17044         case "$sethostent_r_proto" in
17045         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17046         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17047         esac
17048         case "$sethostent_r_proto" in
17049         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17050         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17051         esac
17052         case "$sethostent_r_proto" in
17053         ''|0)   d_sethostent_r=undef
17054                 sethostent_r_proto=0
17055                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17056         * )     case "$sethostent_r_proto" in
17057                 REENTRANT_PROTO*) ;;
17058                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17059                 esac
17060                 echo "Prototype: $try" ;;
17061         esac
17062         ;;
17063         *)      case "$usethreads" in
17064                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17065                 esac
17066                 d_sethostent_r=undef
17067                 sethostent_r_proto=0
17068                 ;;
17069         esac
17070         ;;
17071 *)      sethostent_r_proto=0
17072         ;;
17073 esac
17074
17075 : see if setitimer exists
17076 set setitimer d_setitimer
17077 eval $inlibc
17078
17079 : see if setlinebuf exists
17080 set setlinebuf d_setlinebuf
17081 eval $inlibc
17082
17083 : see if setlocale exists
17084 set setlocale d_setlocale
17085 eval $inlibc
17086
17087 : see if locale.h is available
17088 set locale.h i_locale
17089 eval $inhdr
17090
17091 : see if setlocale_r exists
17092 set setlocale_r d_setlocale_r
17093 eval $inlibc
17094 case "$d_setlocale_r" in
17095 "$define")
17096         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17097         case "$d_setlocale_r_proto:$usethreads" in
17098         ":define")      d_setlocale_r_proto=define
17099                 set d_setlocale_r_proto setlocale_r $hdrs
17100                 eval $hasproto ;;
17101         *)      ;;
17102         esac
17103         case "$d_setlocale_r_proto" in
17104         define)
17105         case "$setlocale_r_proto" in
17106         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17107         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17108         esac
17109         case "$setlocale_r_proto" in
17110         ''|0)   d_setlocale_r=undef
17111                 setlocale_r_proto=0
17112                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17113         * )     case "$setlocale_r_proto" in
17114                 REENTRANT_PROTO*) ;;
17115                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17116                 esac
17117                 echo "Prototype: $try" ;;
17118         esac
17119         ;;
17120         *)      case "$usethreads" in
17121                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17122                 esac
17123                 d_setlocale_r=undef
17124                 setlocale_r_proto=0
17125                 ;;
17126         esac
17127         ;;
17128 *)      setlocale_r_proto=0
17129         ;;
17130 esac
17131
17132 : see if setnetent exists
17133 set setnetent d_setnent
17134 eval $inlibc
17135
17136 : see if setnetent_r exists
17137 set setnetent_r d_setnetent_r
17138 eval $inlibc
17139 case "$d_setnetent_r" in
17140 "$define")
17141         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17142         case "$d_setnetent_r_proto:$usethreads" in
17143         ":define")      d_setnetent_r_proto=define
17144                 set d_setnetent_r_proto setnetent_r $hdrs
17145                 eval $hasproto ;;
17146         *)      ;;
17147         esac
17148         case "$d_setnetent_r_proto" in
17149         define)
17150         case "$setnetent_r_proto" in
17151         ''|0) try='int setnetent_r(int, struct netent_data*);'
17152         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17153         esac
17154         case "$setnetent_r_proto" in
17155         ''|0) try='void setnetent_r(int, struct netent_data*);'
17156         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17157         esac
17158         case "$setnetent_r_proto" in
17159         ''|0)   d_setnetent_r=undef
17160                 setnetent_r_proto=0
17161                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17162         * )     case "$setnetent_r_proto" in
17163                 REENTRANT_PROTO*) ;;
17164                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17165                 esac
17166                 echo "Prototype: $try" ;;
17167         esac
17168         ;;
17169         *)      case "$usethreads" in
17170                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17171                 esac
17172                 d_setnetent_r=undef
17173                 setnetent_r_proto=0
17174                 ;;
17175         esac
17176         ;;
17177 *)      setnetent_r_proto=0
17178         ;;
17179 esac
17180
17181 : see if setprotoent exists
17182 set setprotoent d_setpent
17183 eval $inlibc
17184
17185 : see if setpgid exists
17186 set setpgid d_setpgid
17187 eval $inlibc
17188
17189 : see if setpgrp2 exists
17190 set setpgrp2 d_setpgrp2
17191 eval $inlibc
17192
17193 : see if setpriority exists
17194 set setpriority d_setprior
17195 eval $inlibc
17196
17197 : see if setproctitle exists
17198 set setproctitle d_setproctitle
17199 eval $inlibc
17200
17201 : see if setprotoent_r exists
17202 set setprotoent_r d_setprotoent_r
17203 eval $inlibc
17204 case "$d_setprotoent_r" in
17205 "$define")
17206         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17207         case "$d_setprotoent_r_proto:$usethreads" in
17208         ":define")      d_setprotoent_r_proto=define
17209                 set d_setprotoent_r_proto setprotoent_r $hdrs
17210                 eval $hasproto ;;
17211         *)      ;;
17212         esac
17213         case "$d_setprotoent_r_proto" in
17214         define)
17215         case "$setprotoent_r_proto" in
17216         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17217         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17218         esac
17219         case "$setprotoent_r_proto" in
17220         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17221         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17222         esac
17223         case "$setprotoent_r_proto" in
17224         ''|0)   d_setprotoent_r=undef
17225                 setprotoent_r_proto=0
17226                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17227         * )     case "$setprotoent_r_proto" in
17228                 REENTRANT_PROTO*) ;;
17229                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17230                 esac
17231                 echo "Prototype: $try" ;;
17232         esac
17233         ;;
17234         *)      case "$usethreads" in
17235                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17236                 esac
17237                 d_setprotoent_r=undef
17238                 setprotoent_r_proto=0
17239                 ;;
17240         esac
17241         ;;
17242 *)      setprotoent_r_proto=0
17243         ;;
17244 esac
17245
17246 : see if setpwent exists
17247 set setpwent d_setpwent
17248 eval $inlibc
17249
17250 : see if setpwent_r exists
17251 set setpwent_r d_setpwent_r
17252 eval $inlibc
17253 case "$d_setpwent_r" in
17254 "$define")
17255         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17256         case "$d_setpwent_r_proto:$usethreads" in
17257         ":define")      d_setpwent_r_proto=define
17258                 set d_setpwent_r_proto setpwent_r $hdrs
17259                 eval $hasproto ;;
17260         *)      ;;
17261         esac
17262         case "$d_setpwent_r_proto" in
17263         define)
17264         case "$setpwent_r_proto" in
17265         ''|0) try='int setpwent_r(FILE**);'
17266         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17267         esac
17268         case "$setpwent_r_proto" in
17269         ''|0) try='void setpwent_r(FILE**);'
17270         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17271         esac
17272         case "$setpwent_r_proto" in
17273         ''|0)   d_setpwent_r=undef
17274                 setpwent_r_proto=0
17275                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17276         * )     case "$setpwent_r_proto" in
17277                 REENTRANT_PROTO*) ;;
17278                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17279                 esac
17280                 echo "Prototype: $try" ;;
17281         esac
17282         ;;
17283         *)      case "$usethreads" in
17284                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17285                 esac
17286                 d_setpwent_r=undef
17287                 setpwent_r_proto=0
17288                 ;;
17289         esac
17290         ;;
17291 *)      setpwent_r_proto=0
17292         ;;
17293 esac
17294
17295 : see if setregid exists
17296 set setregid d_setregid
17297 eval $inlibc
17298 set setresgid d_setresgid
17299 eval $inlibc
17300
17301 : see if setreuid exists
17302 set setreuid d_setreuid
17303 eval $inlibc
17304 set setresuid d_setresuid
17305 eval $inlibc
17306
17307 : see if setrgid exists
17308 set setrgid d_setrgid
17309 eval $inlibc
17310
17311 : see if setruid exists
17312 set setruid d_setruid
17313 eval $inlibc
17314
17315 : see if setservent exists
17316 set setservent d_setsent
17317 eval $inlibc
17318
17319 : see if setservent_r exists
17320 set setservent_r d_setservent_r
17321 eval $inlibc
17322 case "$d_setservent_r" in
17323 "$define")
17324         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17325         case "$d_setservent_r_proto:$usethreads" in
17326         ":define")      d_setservent_r_proto=define
17327                 set d_setservent_r_proto setservent_r $hdrs
17328                 eval $hasproto ;;
17329         *)      ;;
17330         esac
17331         case "$d_setservent_r_proto" in
17332         define)
17333         case "$setservent_r_proto" in
17334         ''|0) try='int setservent_r(int, struct servent_data*);'
17335         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17336         esac
17337         case "$setservent_r_proto" in
17338         ''|0) try='void setservent_r(int, struct servent_data*);'
17339         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17340         esac
17341         case "$setservent_r_proto" in
17342         ''|0)   d_setservent_r=undef
17343                 setservent_r_proto=0
17344                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17345         * )     case "$setservent_r_proto" in
17346                 REENTRANT_PROTO*) ;;
17347                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17348                 esac
17349                 echo "Prototype: $try" ;;
17350         esac
17351         ;;
17352         *)      case "$usethreads" in
17353                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17354                 esac
17355                 d_setservent_r=undef
17356                 setservent_r_proto=0
17357                 ;;
17358         esac
17359         ;;
17360 *)      setservent_r_proto=0
17361         ;;
17362 esac
17363
17364 : see if setsid exists
17365 set setsid d_setsid
17366 eval $inlibc
17367
17368 : see if setvbuf exists
17369 set setvbuf d_setvbuf
17370 eval $inlibc
17371
17372 : see if sfio.h is available
17373 set sfio.h i_sfio
17374 eval $inhdr
17375
17376 : see if sfio library is available
17377 case "$i_sfio" in
17378 $define)
17379         val=''
17380         set sfreserve val
17381         eval $inlibc
17382         ;;
17383 *)
17384         val="$undef"
17385         ;;
17386 esac
17387 : Ok, but do we want to use it.
17388 case "$val" in
17389 $define)
17390         case "$usesfio" in
17391         true|$define|[yY]*) dflt='y';;
17392         *) dflt='n';;
17393         esac
17394         echo "$package can use the sfio library, but it is experimental."
17395         rp="You seem to have sfio available, do you want to try using it?"
17396         . ./myread
17397         case "$ans" in
17398         y|Y)    echo "Ok, turning on sfio then."
17399                 val="$define"
17400                 ;;
17401         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17402                 val="$undef"
17403                 ;;
17404         esac
17405         ;;
17406 *)      case "$usesfio" in
17407         true|$define|[yY]*)
17408                 echo "Sorry, cannot find sfio on this machine." >&4
17409                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17410                 val="$undef"
17411                 ;;
17412         esac
17413         ;;
17414 esac
17415 set d_sfio
17416 eval $setvar
17417 case "$d_sfio" in
17418 $define) usesfio='true';;
17419 *) usesfio='false';;
17420 esac
17421 case "$d_sfio" in
17422 $define) ;;
17423 *)      : Remove sfio from list of libraries to use
17424         case "$libs" in
17425         *-lsfio*)
17426                 echo "Removing unneeded -lsfio from library list" >&4
17427                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17428                 shift
17429                 libs="$*"
17430                 echo "libs = $libs" >&4
17431                 ;;
17432         esac
17433 ;;
17434 esac
17435
17436
17437 : see if shmctl exists
17438 set shmctl d_shmctl
17439 eval $inlibc
17440
17441 : see if shmget exists
17442 set shmget d_shmget
17443 eval $inlibc
17444
17445 : see if shmat exists
17446 set shmat d_shmat
17447 eval $inlibc
17448 : see what shmat returns
17449 case "$d_shmat" in
17450 "$define")
17451         $cat >shmat.c <<'END'
17452 #include <sys/shm.h>
17453 void *shmat();
17454 END
17455         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17456                 shmattype='void *'
17457         else
17458                 shmattype='char *'
17459         fi
17460         echo "and it returns ($shmattype)." >&4
17461         : see if a prototype for shmat is available
17462         xxx=`./findhdr sys/shm.h`
17463         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17464         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17465                 val="$define"
17466         else
17467                 val="$undef"
17468         fi
17469         $rm -f shmat.[co]
17470         ;;
17471 *)
17472         val="$undef"
17473         ;;
17474 esac
17475 set d_shmatprototype
17476 eval $setvar
17477
17478 : see if shmdt exists
17479 set shmdt d_shmdt
17480 eval $inlibc
17481
17482 : see how much of the 'shm*(2)' library is present.
17483 h_shm=true
17484 echo " "
17485 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17486 *"$undef"*) h_shm=false;;
17487 esac
17488 case "$osname" in
17489 freebsd)
17490     case "`ipcs 2>&1`" in
17491     "SVID shared memory"*"not configured"*)
17492         echo "Your $osname does not have the shm*(2) configured." >&4
17493         h_shm=false
17494         val="$undef"
17495         set shmctl d_shmctl
17496         evat $setvar
17497         set shmget d_shmget
17498         evat $setvar
17499         set shmat d_shmat
17500         evat $setvar
17501         set shmdt d_shmdt
17502         evat $setvar
17503         ;;
17504     esac
17505     ;;
17506 esac
17507 : we could also check for sys/ipc.h ...
17508 if $h_shm && $test `./findhdr sys/shm.h`; then
17509         echo "You have the full shm*(2) library." >&4
17510         val="$define"
17511 else
17512         echo "You don't have the full shm*(2) library." >&4
17513         val="$undef"
17514 fi
17515 set d_shm
17516 eval $setvar
17517
17518 : see if we have sigaction
17519 echo " "
17520 if set sigaction val -f d_sigaction; eval $csym; $val; then
17521         echo 'sigaction() found.' >&4
17522         $cat > try.c <<EOP
17523 #include <stdio.h>
17524 #include <sys/types.h>
17525 #include <signal.h>
17526 #$i_stdlib I_STDLIB
17527 #ifdef I_STDLIB
17528 #include <stdlib.h>
17529 #endif
17530 int main()
17531 {
17532     struct sigaction act, oact;
17533     act.sa_flags = 0;
17534     oact.sa_handler = 0;
17535     /* so that act and oact are used */
17536     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17537 }
17538 EOP
17539         set try
17540         if eval $compile_ok; then
17541                 val="$define"
17542         else
17543                 echo "But you don't seem to have a useable struct sigaction." >&4
17544                 val="$undef"
17545         fi
17546 else
17547         echo 'sigaction NOT found.' >&4
17548         val="$undef"
17549 fi
17550 set d_sigaction; eval $setvar
17551 $rm_try
17552
17553 : see if this is a sunmath.h system
17554 set sunmath.h i_sunmath
17555 eval $inhdr
17556
17557 : see if signbit exists
17558 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17559 $cat >try.c <<EOCP
17560 #$i_math I_MATH
17561 #$i_sunmath I_SUNMATH
17562 #ifdef I_MATH
17563 #  include <math.h>
17564 #endif
17565 #ifdef I_SUNMATH  /* Solaris special math library */
17566 #  include <sunmath.h>
17567 #endif
17568 #define NV $nvtype
17569 int main(int argc, char **argv)
17570 {
17571     NV x = 0.0;
17572     NV y = -0.0;
17573     if ((signbit(x) == 0) && (signbit(y) != 0))
17574         return 0;
17575     else
17576         return 1;
17577 }
17578 EOCP
17579 val="$undef"
17580 set try
17581 if eval $compile; then
17582     if $run ./try; then
17583         $echo "Yes." >&4
17584         val="$define"
17585     else
17586         $echo "Signbit seems to be available, but doesn't work as I expected."
17587         $echo "I won't use it." >&4
17588         val="$undef"
17589     fi
17590 else
17591     $echo "Nope." >&4
17592     dflt="$undef"
17593 fi
17594 set d_signbit
17595 eval $setvar
17596 $rm_try
17597
17598 : see if sigprocmask exists
17599 set sigprocmask d_sigprocmask
17600 eval $inlibc
17601
17602 : see if sigsetjmp exists
17603 echo " "
17604 case "$d_sigsetjmp" in
17605 '')
17606         $cat >try.c <<EOP
17607 #include <setjmp.h>
17608 #$i_stdlib I_STDLIB
17609 #ifdef I_STDLIB
17610 #include <stdlib.h>
17611 #endif
17612 sigjmp_buf env;
17613 int set = 1;
17614 int main()
17615 {
17616         if (sigsetjmp(env,1))
17617                 exit(set);
17618         set = 0;
17619         siglongjmp(env, 1);
17620         exit(1);
17621 }
17622 EOP
17623         set try
17624         if eval $compile; then
17625                 if $run ./try >/dev/null 2>&1; then
17626                         echo "POSIX sigsetjmp found." >&4
17627                         val="$define"
17628                 else
17629                         $cat >&4 <<EOM
17630 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17631 I'll ignore them.
17632 EOM
17633                         val="$undef"
17634                 fi
17635         else
17636                 echo "sigsetjmp not found." >&4
17637                 val="$undef"
17638         fi
17639         ;;
17640 *) val="$d_sigsetjmp"
17641         case "$d_sigsetjmp" in
17642         $define) echo "POSIX sigsetjmp found." >&4;;
17643         $undef) echo "sigsetjmp not found." >&4;;
17644         esac
17645         ;;
17646 esac
17647 set d_sigsetjmp
17648 eval $setvar
17649 $rm_try
17650
17651 : see if snprintf exists
17652 set snprintf d_snprintf
17653 eval $inlibc
17654
17655 : see if vsnprintf exists
17656 set vsnprintf d_vsnprintf
17657 eval $inlibc
17658
17659 case "$d_snprintf-$d_vsnprintf" in
17660 "$define-$define")
17661     $cat <<EOM
17662 Checking whether your snprintf() and vsnprintf() work okay...
17663 EOM
17664     $cat >try.c <<'EOCP'
17665 /* v?snprintf testing logic courtesy of Russ Allbery.
17666  * According to C99:
17667  * - if the buffer is too short it still must be \0-terminated
17668  * - if the buffer is too short the potentially required length
17669  *   must be returned and not -1
17670  * - if the buffer is NULL the potentially required length
17671  *   must be returned and not -1 or core dump
17672  */
17673 #include <stdio.h>
17674 #include <stdarg.h>
17675
17676 char buf[2];
17677
17678 int test (char *format, ...)
17679 {
17680     va_list args;
17681     int count;
17682
17683     va_start (args, format);
17684     count = vsnprintf (buf, sizeof buf, format, args);
17685     va_end (args);
17686     return count;
17687 }
17688
17689 int main ()
17690 {
17691     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17692              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17693 }
17694 EOCP
17695     set try
17696     if eval $compile; then
17697         `$run ./try`
17698         case "$?" in
17699         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17700         *) cat <<EOM >&4
17701 Your snprintf() and snprintf() don't seem to be working okay.
17702 EOM
17703            d_snprintf="$undef"
17704            d_vsnprintf="$undef"
17705            ;;
17706         esac
17707     else
17708         echo "(I can't seem to compile the test program--assuming they don't)"
17709         d_snprintf="$undef"
17710         d_vsnprintf="$undef"
17711     fi
17712     $rm_try
17713     ;;
17714 esac
17715
17716 : see if sockatmark exists
17717 set sockatmark d_sockatmark
17718 eval $inlibc
17719
17720 : see if prototype for sockatmark is available
17721 echo " "
17722 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17723 eval $hasproto
17724
17725 : see if socks5_init exists
17726 set socks5_init d_socks5_init
17727 eval $inlibc
17728
17729 : see if sprintf returns the length of the string in the buffer as per ANSI
17730 $echo "Checking whether sprintf returns the length of the string..." >&4
17731 $cat <<EOP >try.c
17732 #include <stdio.h>
17733 #$i_stdlib I_STDLIB
17734 #ifdef I_STDLIB
17735 #include <stdlib.h>
17736 #endif
17737 #$i_string I_STRING
17738 #ifdef I_STRING
17739 #  include <string.h>
17740 #else
17741 #  include <strings.h>
17742 #endif
17743 #$i_math I_MATH
17744 #ifdef I_MATH
17745 #include <math.h>
17746 #endif
17747
17748 char buffer[256];
17749
17750 int check (size_t expect, int test) {
17751   size_t got = strlen(buffer);
17752   if (expect == got)
17753     return 0;
17754
17755   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17756        test, buffer);
17757   exit (test);
17758 }
17759
17760 int main(int argc, char **argv) {
17761   int test = 0;
17762
17763   check(sprintf(buffer, ""), ++test);
17764   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17765   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17766
17767   return 0;
17768 }
17769 EOP
17770 set try
17771
17772 if eval $compile; then
17773     xxx="`$run ./try`"
17774     case "$?" in
17775         0) cat >&4 <<EOM
17776 sprintf returns the length of the string (as ANSI says it should)
17777 EOM
17778         d_sprintf_returns_strlen="$define"
17779         ;;
17780         *) cat >&4 <<EOM
17781 sprintf does not return the length of the string (how old is this system?)
17782 EOM
17783         d_sprintf_returns_strlen="$undef"
17784         ;;
17785     esac
17786 else
17787     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17788     d_sprintf_returns_strlen="$undef"
17789 fi
17790 $rm_try
17791
17792 : see if srand48_r exists
17793 set srand48_r d_srand48_r
17794 eval $inlibc
17795 case "$d_srand48_r" in
17796 "$define")
17797         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17798         case "$d_srand48_r_proto:$usethreads" in
17799         ":define")      d_srand48_r_proto=define
17800                 set d_srand48_r_proto srand48_r $hdrs
17801                 eval $hasproto ;;
17802         *)      ;;
17803         esac
17804         case "$d_srand48_r_proto" in
17805         define)
17806         case "$srand48_r_proto" in
17807         ''|0) try='int srand48_r(long, struct drand48_data*);'
17808         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17809         esac
17810         case "$srand48_r_proto" in
17811         ''|0)   d_srand48_r=undef
17812                 srand48_r_proto=0
17813                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17814         * )     case "$srand48_r_proto" in
17815                 REENTRANT_PROTO*) ;;
17816                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17817                 esac
17818                 echo "Prototype: $try" ;;
17819         esac
17820         ;;
17821         *)      case "$usethreads" in
17822                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17823                 esac
17824                 d_srand48_r=undef
17825                 srand48_r_proto=0
17826                 ;;
17827         esac
17828         ;;
17829 *)      srand48_r_proto=0
17830         ;;
17831 esac
17832
17833 : see if srandom_r exists
17834 set srandom_r d_srandom_r
17835 eval $inlibc
17836 case "$d_srandom_r" in
17837 "$define")
17838         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17839         case "$d_srandom_r_proto:$usethreads" in
17840         ":define")      d_srandom_r_proto=define
17841                 set d_srandom_r_proto srandom_r $hdrs
17842                 eval $hasproto ;;
17843         *)      ;;
17844         esac
17845         case "$d_srandom_r_proto" in
17846         define)
17847         case "$srandom_r_proto" in
17848         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17849         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17850         esac
17851         case "$srandom_r_proto" in
17852         ''|0)   d_srandom_r=undef
17853                 srandom_r_proto=0
17854                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17855         * )     case "$srandom_r_proto" in
17856                 REENTRANT_PROTO*) ;;
17857                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17858                 esac
17859                 echo "Prototype: $try" ;;
17860         esac
17861         ;;
17862         *)      case "$usethreads" in
17863                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17864                 esac
17865                 d_srandom_r=undef
17866                 srandom_r_proto=0
17867                 ;;
17868         esac
17869         ;;
17870 *)      srandom_r_proto=0
17871         ;;
17872 esac
17873
17874 : see if prototype for setresgid is available
17875 echo " "
17876 set d_sresgproto setresgid $i_unistd unistd.h
17877 eval $hasproto
17878
17879 : see if prototype for setresuid is available
17880 echo " "
17881 set d_sresuproto setresuid $i_unistd unistd.h
17882 eval $hasproto
17883
17884 : see if sys/stat.h is available
17885 set sys/stat.h i_sysstat
17886 eval $inhdr
17887
17888 : see if stat knows about block sizes
17889 echo " "
17890 echo "Checking to see if your struct stat has st_blocks field..." >&4
17891 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17892 eval $hasfield
17893
17894 : see if this is a sys/vfs.h system
17895 set sys/vfs.h i_sysvfs
17896 eval $inhdr
17897
17898 : see if this is a sys/statfs.h system
17899 set sys/statfs.h i_sysstatfs
17900 eval $inhdr
17901
17902 : Check for statfs_s
17903 echo " "
17904 echo "Checking to see if your system supports struct statfs..." >&4
17905 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
17906 eval $hasstruct
17907 case "$d_statfs_s" in
17908 "$define")      echo "Yes, it does."   ;;
17909 *)              echo "No, it doesn't." ;;
17910 esac
17911
17912
17913 : see if struct statfs knows about f_flags
17914 case "$d_statfs_s" in
17915 define)
17916         echo " "
17917         echo "Checking to see if your struct statfs has f_flags field..." >&4
17918         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
17919         eval $hasfield
17920         ;;
17921 *)      val="$undef"
17922         set d_statfs_f_flags
17923         eval $setvar
17924         ;;
17925 esac
17926 case "$d_statfs_f_flags" in
17927 "$define")      echo "Yes, it does."   ;;
17928 *)              echo "No, it doesn't." ;;
17929 esac
17930
17931 : see what flavor, if any, of static inline is supported
17932 echo " "
17933 echo "Checking to see if your system supports static inline..."
17934 $cat > try.c <<'EOCP'
17935 #include <stdlib.h>
17936 extern int f_via_a(int x);
17937 extern int f_via_b(int x);
17938 int main(int argc, char **argv)
17939 {
17940     int y;
17941
17942     y = f_via_a(0);
17943 #ifdef USE_B
17944     y = f_via_b(0);
17945 #endif
17946     if (y == 42) {
17947         return EXIT_SUCCESS;
17948     }
17949     else {
17950         return EXIT_FAILURE;
17951     }
17952 }
17953 EOCP
17954 $cat > a.c <<'EOCP'
17955 static INLINE int f(int x) {
17956     int y;
17957     y = x + 42;
17958     return y;
17959 }
17960
17961 int f_via_a(int x)
17962 {
17963     return f(x);
17964 }
17965 EOCP
17966 $cat > b.c <<'EOCP'
17967 extern int f(int x);
17968
17969 int f_via_b(int x)
17970 {
17971     return f(x);
17972 }
17973 EOCP
17974
17975 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17976 case "$perl_static_inline" in
17977 '')     # Check the various possibilities, and break out on success.
17978         # For gcc, prefer __inline__, which will still permit 
17979         # cflags.SH to add in -ansi.
17980         case "$gccversion" in
17981                 '') xxx="inline __inline__ __inline _inline";;
17982                 *)  xxx="__inline__ inline __inline _inline";;
17983         esac
17984         for inline in $xxx; do
17985                 set try -DINLINE=$inline a.c
17986                 if eval $compile && $run ./try; then
17987                         # Now make sure there is no external linkage of static
17988                         # functions
17989                         set try -DINLINE=$inline -DUSE_B a.c b.c
17990                         if eval $compile && $run ./try; then
17991                                 $echo "Your compiler supports static $inline, " >&4
17992                                 $echo "but it also creates an external definition," >&4
17993                                 $echo "so I won't use it." >&4
17994                                 val=$undef
17995                         else
17996                                 $echo "Your compiler supports static $inline." >&4
17997                                 val=$define
17998                                 perl_static_inline="static $inline";
17999                                 break;
18000                         fi
18001                 else
18002                         $echo "Your compiler does NOT support static $inline." >&4
18003                         val="$undef"
18004                 fi
18005         done
18006         ;;
18007 *inline*) # Some variant of inline exists.
18008         echo "Keeping your $hint value of $perl_static_inline."
18009         val=$define
18010         ;;
18011 static)  # No inline capabilities
18012         echo "Keeping your $hint value of $perl_static_inline."
18013         val=$undef
18014         ;;
18015 *)  # Unrecognized previous value -- blindly trust the supplied
18016         # value and hope it makes sense.  Use old value for
18017         # d_static_inline, if there is one.
18018         echo "Keeping your $hint value of $perl_static_inline."
18019         case "$d_static_inline" in
18020                 '') val=$define ;;
18021                 *)  val=$d_static_inline ;;
18022         esac
18023         ;;
18024 esac
18025 # Fallback to plain 'static' if nothing worked.
18026 case "$perl_static_inline" in
18027 '')
18028         perl_static_inline="static"
18029         val=$undef
18030         ;;
18031 esac
18032 set d_static_inline
18033 eval $setvar
18034 $rm -f a.[co] b.[co]
18035 $rm_try
18036
18037 : Check stream access
18038 $cat >&4 <<EOM
18039 Checking how to access stdio streams by file descriptor number...
18040 EOM
18041 case "$stdio_stream_array" in
18042 '')     $cat >try.c <<EOCP
18043 #include <stdio.h>
18044 int main() {
18045   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18046     printf("yes\n");
18047 }
18048 EOCP
18049         for s in _iob __iob __sF
18050         do
18051                 set try -DSTDIO_STREAM_ARRAY=$s
18052                 if eval $compile; then
18053                         case "`$run ./try`" in
18054                         yes)    stdio_stream_array=$s; break ;;
18055                         esac
18056                 fi
18057         done
18058         $rm_try
18059 esac
18060 case "$stdio_stream_array" in
18061 '')     $cat >&4 <<EOM
18062 I can't figure out how to access stdio streams by file descriptor number.
18063 EOM
18064         d_stdio_stream_array="$undef"
18065         ;;
18066 *)      $cat >&4 <<EOM
18067 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18068 EOM
18069         d_stdio_stream_array="$define"
18070         ;;
18071 esac
18072
18073 : see if strcoll exists
18074 set strcoll d_strcoll
18075 eval $inlibc
18076
18077 : check for structure copying
18078 echo " "
18079 echo "Checking to see if your C compiler can copy structs..." >&4
18080 $cat >try.c <<'EOCP'
18081 int main()
18082 {
18083         struct blurfl {
18084                 int dyick;
18085         } foo, bar;
18086
18087         foo = bar;
18088 }
18089 EOCP
18090 if $cc -c try.c >/dev/null 2>&1 ; then
18091         val="$define"
18092         echo "Yup, it can."
18093 else
18094         val="$undef"
18095         echo "Nope, it can't."
18096 fi
18097 set d_strctcpy
18098 eval $setvar
18099 $rm_try
18100
18101 : see if strerror and/or sys_errlist[] exist
18102 echo " "
18103 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18104     if set strerror val -f d_strerror; eval $csym; $val; then
18105                 echo 'strerror() found.' >&4
18106                 d_strerror="$define"
18107                 d_strerrm='strerror(e)'
18108                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18109                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18110                         d_syserrlst="$define"
18111                 else
18112                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18113                         d_syserrlst="$undef"
18114                 fi
18115     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18116                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18117                 echo 'strerror() found in string header.' >&4
18118                 d_strerror="$define"
18119                 d_strerrm='strerror(e)'
18120                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18121                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18122                                 d_syserrlst="$define"
18123                 else
18124                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18125                         d_syserrlst="$undef"
18126                 fi
18127     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18128                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18129                 d_strerror="$undef"
18130                 d_syserrlst="$define"
18131                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18132     else
18133                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18134                 d_strerror="$undef"
18135                 d_syserrlst="$undef"
18136                 d_strerrm='"unknown"'
18137     fi
18138 fi
18139
18140 : see if strerror_r exists
18141 set strerror_r d_strerror_r
18142 eval $inlibc
18143 case "$d_strerror_r" in
18144 "$define")
18145         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18146         case "$d_strerror_r_proto:$usethreads" in
18147         ":define")      d_strerror_r_proto=define
18148                 set d_strerror_r_proto strerror_r $hdrs
18149                 eval $hasproto ;;
18150         *)      ;;
18151         esac
18152         case "$d_strerror_r_proto" in
18153         define)
18154         case "$strerror_r_proto" in
18155         ''|0) try='int strerror_r(int, char*, size_t);'
18156         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18157         esac
18158         case "$strerror_r_proto" in
18159         ''|0) try='int strerror_r(int, char*, int);'
18160         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18161         esac
18162         case "$strerror_r_proto" in
18163         ''|0) try='char* strerror_r(int, char*, size_t);'
18164         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18165         esac
18166         case "$strerror_r_proto" in
18167         ''|0)   d_strerror_r=undef
18168                 strerror_r_proto=0
18169                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18170         * )     case "$strerror_r_proto" in
18171                 REENTRANT_PROTO*) ;;
18172                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18173                 esac
18174                 echo "Prototype: $try" ;;
18175         esac
18176         ;;
18177         *)      case "$usethreads" in
18178                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18179                 esac
18180                 d_strerror_r=undef
18181                 strerror_r_proto=0
18182                 ;;
18183         esac
18184         ;;
18185 *)      strerror_r_proto=0
18186         ;;
18187 esac
18188
18189 : see if strftime exists
18190 set strftime d_strftime
18191 eval $inlibc
18192
18193 : see if strlcat exists
18194 set strlcat d_strlcat
18195 eval $inlibc
18196
18197 : see if strlcpy exists
18198 set strlcpy d_strlcpy
18199 eval $inlibc
18200
18201 : see if strtod exists
18202 set strtod d_strtod
18203 eval $inlibc
18204
18205 : see if strtol exists
18206 set strtol d_strtol
18207 eval $inlibc
18208
18209 : see if strtold exists
18210 set strtold d_strtold
18211 eval $inlibc
18212
18213 : see if strtoll exists
18214 set strtoll d_strtoll
18215 eval $inlibc
18216
18217 case "$d_longlong-$d_strtoll" in
18218 "$define-$define")
18219         $cat <<EOM
18220 Checking whether your strtoll() works okay...
18221 EOM
18222         $cat >try.c <<'EOCP'
18223 #include <errno.h>
18224 #ifdef __hpux
18225 #define strtoll __strtoll
18226 #endif
18227 #ifdef __EMX__
18228 #define strtoll _strtoll
18229 #endif
18230 #include <stdio.h>
18231 extern long long int strtoll(char *s, char **, int);
18232 static int bad = 0;
18233 int check(char *s, long long ell, int een) {
18234         long long gll;
18235         errno = 0;
18236         gll = strtoll(s, 0, 10);
18237         if (!((gll == ell) && (errno == een)))
18238                 bad++;
18239 }
18240 int main() {
18241         check(" 1",                                      1LL, 0);
18242         check(" 0",                                      0LL, 0);
18243         check("-1",                                     -1LL, 0);
18244         check("-9223372036854775808", -9223372036854775808LL, 0);
18245         check("-9223372036854775808", -9223372036854775808LL, 0);
18246         check(" 9223372036854775807",  9223372036854775807LL, 0);
18247         check("-9223372036854775808", -9223372036854775808LL, 0);
18248         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18249         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18250         if (!bad)
18251                 printf("ok\n");
18252 }
18253 EOCP
18254         set try
18255         if eval $compile; then
18256                 yyy=`$run ./try`
18257                 case "$yyy" in
18258                 ok) echo "Your strtoll() seems to be working okay." ;;
18259                 *) cat <<EOM >&4
18260 Your strtoll() doesn't seem to be working okay.
18261 EOM
18262                    d_strtoll="$undef"
18263                    ;;
18264                 esac
18265         else
18266                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18267                 d_strtoll="$undef"
18268         fi
18269         ;;
18270 esac
18271
18272 : see if strtoq exists
18273 set strtoq d_strtoq
18274 eval $inlibc
18275
18276 : see if strtoul exists
18277 set strtoul d_strtoul
18278 eval $inlibc
18279
18280 case "$d_strtoul" in
18281 "$define")
18282         $cat <<EOM
18283 Checking whether your strtoul() works okay...
18284 EOM
18285         $cat >try.c <<'EOCP'
18286 #include <errno.h>
18287 #include <stdio.h>
18288 extern unsigned long int strtoul(char *s, char **, int);
18289 static int bad = 0;
18290 void check(char *s, unsigned long eul, int een) {
18291         unsigned long gul;
18292         errno = 0;
18293         gul = strtoul(s, 0, 10);
18294         if (!((gul == eul) && (errno == een)))
18295                 bad++;
18296 }
18297 int main() {
18298         check(" 1", 1L, 0);
18299         check(" 0", 0L, 0);
18300 EOCP
18301         case "$longsize" in
18302         8)
18303             $cat >>try.c <<'EOCP'
18304         check("18446744073709551615", 18446744073709551615UL, 0);
18305         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18306 #if 0 /* strtoul() for /^-/ strings is undefined. */
18307         check("-1", 18446744073709551615UL, 0);
18308         check("-18446744073709551614", 2, 0);
18309         check("-18446744073709551615", 1, 0);
18310         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18311         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18312 #endif
18313 EOCP
18314                 ;;
18315         4)
18316                     $cat >>try.c <<'EOCP'
18317         check("4294967295", 4294967295UL, 0);
18318         check("4294967296", 4294967295UL, ERANGE);
18319 #if 0 /* strtoul() for /^-/ strings is undefined. */
18320         check("-1", 4294967295UL, 0);
18321         check("-4294967294", 2, 0);
18322         check("-4294967295", 1, 0);
18323         check("-4294967296", 4294967295UL, ERANGE);
18324         check("-4294967297", 4294967295UL, ERANGE);
18325 #endif
18326 EOCP
18327                 ;;
18328         *)
18329 : Should we write these tests to be more portable by sprintf-ing
18330 : ~0 and then manipulating that char string as input for strtol?
18331                 ;;
18332         esac
18333         $cat >>try.c <<'EOCP'
18334         if (!bad)
18335                 printf("ok\n");
18336         return 0;
18337 }
18338 EOCP
18339         set try
18340         if eval $compile; then
18341                 case "`$run ./try`" in
18342                 ok) echo "Your strtoul() seems to be working okay." ;;
18343                 *) cat <<EOM >&4
18344 Your strtoul() doesn't seem to be working okay.
18345 EOM
18346                    d_strtoul="$undef"
18347                    ;;
18348                 esac
18349         else
18350                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18351                 d_strtoul="$undef"
18352         fi
18353         ;;
18354 esac
18355
18356 : see if strtoull exists
18357 set strtoull d_strtoull
18358 eval $inlibc
18359
18360 case "$d_longlong-$d_strtoull" in
18361 "$define-$define")
18362         $cat <<EOM
18363 Checking whether your strtoull() works okay...
18364 EOM
18365         $cat >try.c <<'EOCP'
18366 #include <errno.h>
18367 #ifdef __hpux
18368 #define strtoull __strtoull
18369 #endif
18370 #include <stdio.h>
18371 extern unsigned long long int strtoull(char *s, char **, int);
18372 static int bad = 0;
18373 int check(char *s, long long eull, int een) {
18374         long long gull;
18375         errno = 0;
18376         gull = strtoull(s, 0, 10);
18377         if (!((gull == eull) && (errno == een)))
18378                 bad++;
18379 }
18380 int main() {
18381         check(" 1",                                        1LL, 0);
18382         check(" 0",                                        0LL, 0);
18383         check("18446744073709551615",  18446744073709551615ULL, 0);
18384         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18385 #if 0 /* strtoull() for /^-/ strings is undefined. */
18386         check("-1",                    18446744073709551615ULL, 0);
18387         check("-18446744073709551614",                     2LL, 0);
18388         check("-18446744073709551615",                     1LL, 0);
18389         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18390         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18391 #endif
18392         if (!bad)
18393                 printf("ok\n");
18394 }
18395 EOCP
18396         set try
18397         if eval $compile; then
18398                 case "`$run ./try`" in
18399                 ok) echo "Your strtoull() seems to be working okay." ;;
18400                 *) cat <<EOM >&4
18401 Your strtoull() doesn't seem to be working okay.
18402 EOM
18403                    d_strtoull="$undef"
18404                    ;;
18405                 esac
18406         else
18407                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18408                 d_strtoull="$undef"
18409         fi
18410         ;;
18411 esac
18412
18413 : see if strtouq exists
18414 set strtouq d_strtouq
18415 eval $inlibc
18416
18417 case "$d_strtouq" in
18418 "$define")
18419         $cat <<EOM
18420 Checking whether your strtouq() works okay...
18421 EOM
18422         $cat >try.c <<'EOCP'
18423 #include <errno.h>
18424 #include <stdio.h>
18425 extern unsigned long long int strtouq(char *s, char **, int);
18426 static int bad = 0;
18427 void check(char *s, unsigned long long eull, int een) {
18428         unsigned long long gull;
18429         errno = 0;
18430         gull = strtouq(s, 0, 10);
18431         if (!((gull == eull) && (errno == een)))
18432                 bad++;
18433 }
18434 int main() {
18435         check(" 1",                                        1LL, 0);
18436         check(" 0",                                        0LL, 0);
18437         check("18446744073709551615",  18446744073709551615ULL, 0);
18438         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18439 #if 0 /* strtouq() for /^-/ strings is undefined. */
18440         check("-1",                    18446744073709551615ULL, 0);
18441         check("-18446744073709551614",                     2LL, 0);
18442         check("-18446744073709551615",                     1LL, 0);
18443         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18444         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18445 #endif
18446         if (!bad)
18447                 printf("ok\n");
18448         return 0;
18449 }
18450 EOCP
18451         set try
18452         if eval $compile; then
18453                 case "`$run ./try`" in
18454                 ok) echo "Your strtouq() seems to be working okay." ;;
18455                 *) cat <<EOM >&4
18456 Your strtouq() doesn't seem to be working okay.
18457 EOM
18458                    d_strtouq="$undef"
18459                    ;;
18460                 esac
18461         else
18462                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18463                 d_strtouq="$undef"
18464         fi
18465         ;;
18466 esac
18467
18468 : see if strxfrm exists
18469 set strxfrm d_strxfrm
18470 eval $inlibc
18471
18472 : see if symlink exists
18473 set symlink d_symlink
18474 eval $inlibc
18475
18476 : see if syscall exists
18477 set syscall d_syscall
18478 eval $inlibc
18479
18480 : see if prototype for syscall is available
18481 echo " "
18482 set d_syscallproto syscall $i_unistd unistd.h
18483 eval $hasproto
18484
18485 : see if sysconf exists
18486 set sysconf d_sysconf
18487 eval $inlibc
18488
18489 : see if system exists
18490 set system d_system
18491 eval $inlibc
18492
18493 : see if tcgetpgrp exists
18494 set tcgetpgrp d_tcgetpgrp
18495 eval $inlibc
18496
18497 : see if tcsetpgrp exists
18498 set tcsetpgrp d_tcsetpgrp
18499 eval $inlibc
18500
18501 : see if prototype for telldir is available
18502 echo " "
18503 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18504 eval $hasproto
18505
18506 : see if time exists
18507 echo " "
18508 if test "X$d_time" = X -o X"$timetype" = X; then
18509     if set time val -f d_time; eval $csym; $val; then
18510                 echo 'time() found.' >&4
18511                 val="$define"
18512                 rp="What is the type returned by time() on this system?"
18513                 set time_t timetype long stdio.h sys/types.h
18514                 eval $typedef_ask
18515     else
18516                 echo 'time() not found, hope that will do.' >&4
18517                 val="$undef"
18518                 timetype='int';
18519     fi
18520     set d_time
18521     eval $setvar
18522 fi
18523
18524 : see if timegm exists
18525 set timegm d_timegm
18526 eval $inlibc
18527
18528 : see if this is a sys/times.h system
18529 set sys/times.h i_systimes
18530 eval $inhdr
18531
18532 : see if times exists
18533 echo " "
18534 if set times val -f d_times; eval $csym; $val; then
18535         echo 'times() found.' >&4
18536         d_times="$define"
18537         inc=''
18538         case "$i_systimes" in
18539         "$define") inc='sys/times.h';;
18540         esac
18541         rp="What is the type returned by times() on this system?"
18542         set clock_t clocktype long stdio.h sys/types.h $inc
18543         eval $typedef_ask
18544 else
18545         echo 'times() NOT found, hope that will do.' >&4
18546         d_times="$undef"
18547         clocktype='int'
18548 fi
18549
18550 : see if tmpnam_r exists
18551 set tmpnam_r d_tmpnam_r
18552 eval $inlibc
18553 case "$d_tmpnam_r" in
18554 "$define")
18555         hdrs="$i_systypes sys/types.h define stdio.h "
18556         case "$d_tmpnam_r_proto:$usethreads" in
18557         ":define")      d_tmpnam_r_proto=define
18558                 set d_tmpnam_r_proto tmpnam_r $hdrs
18559                 eval $hasproto ;;
18560         *)      ;;
18561         esac
18562         case "$d_tmpnam_r_proto" in
18563         define)
18564         case "$tmpnam_r_proto" in
18565         ''|0) try='char* tmpnam_r(char*);'
18566         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18567         esac
18568         case "$tmpnam_r_proto" in
18569         ''|0)   d_tmpnam_r=undef
18570                 tmpnam_r_proto=0
18571                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18572         * )     case "$tmpnam_r_proto" in
18573                 REENTRANT_PROTO*) ;;
18574                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18575                 esac
18576                 echo "Prototype: $try" ;;
18577         esac
18578         ;;
18579         *)      case "$usethreads" in
18580                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18581                 esac
18582                 d_tmpnam_r=undef
18583                 tmpnam_r_proto=0
18584                 ;;
18585         esac
18586         ;;
18587 *)      tmpnam_r_proto=0
18588         ;;
18589 esac
18590
18591 : see if truncate exists
18592 set truncate d_truncate
18593 eval $inlibc
18594
18595 : see if ttyname_r exists
18596 set ttyname_r d_ttyname_r
18597 eval $inlibc
18598 case "$d_ttyname_r" in
18599 "$define")
18600         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18601         case "$d_ttyname_r_proto:$usethreads" in
18602         ":define")      d_ttyname_r_proto=define
18603                 set d_ttyname_r_proto ttyname_r $hdrs
18604                 eval $hasproto ;;
18605         *)      ;;
18606         esac
18607         case "$d_ttyname_r_proto" in
18608         define)
18609         case "$ttyname_r_proto" in
18610         ''|0) try='int ttyname_r(int, char*, size_t);'
18611         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18612         esac
18613         case "$ttyname_r_proto" in
18614         ''|0) try='int ttyname_r(int, char*, int);'
18615         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18616         esac
18617         case "$ttyname_r_proto" in
18618         ''|0) try='char* ttyname_r(int, char*, int);'
18619         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18620         esac
18621         case "$ttyname_r_proto" in
18622         ''|0)   d_ttyname_r=undef
18623                 ttyname_r_proto=0
18624                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18625         * )     case "$ttyname_r_proto" in
18626                 REENTRANT_PROTO*) ;;
18627                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18628                 esac
18629                 echo "Prototype: $try" ;;
18630         esac
18631         ;;
18632         *)      case "$usethreads" in
18633                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18634                 esac
18635                 d_ttyname_r=undef
18636                 ttyname_r_proto=0
18637                 ;;
18638         esac
18639         ;;
18640 *)      ttyname_r_proto=0
18641         ;;
18642 esac
18643
18644 : see if tzname[] exists
18645 echo " "
18646 if set tzname val -a d_tzname; eval $csym; $val; then
18647         val="$define"
18648         echo 'tzname[] found.' >&4
18649 else
18650         val="$undef"
18651         echo 'tzname[] NOT found.' >&4
18652 fi
18653 set d_tzname
18654 eval $setvar
18655
18656 : Check if is a multiplatform env
18657 case "$osname" in
18658 next|rhapsody|darwin) multiarch="$define" ;;
18659 esac
18660 case "$multiarch" in
18661 ''|[nN]*) multiarch="$undef" ;;
18662 esac
18663
18664 : check for ordering of bytes in a UV
18665 echo " "
18666 case "$usecrosscompile$multiarch" in
18667 *$define*)
18668         $cat <<EOM
18669 You seem to be either cross-compiling or doing a multiarchitecture build,
18670 skipping the byteorder check.
18671
18672 EOM
18673         byteorder='ffff'
18674         ;;
18675 *)
18676         case "$byteorder" in
18677         '')
18678                 $cat <<'EOM'
18679 In the following, larger digits indicate more significance.  A big-endian
18680 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18681 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18682 machines may have weird orders like 3412.  A Cray will report 87654321,
18683 an Alpha will report 12345678. If the test program works the default is
18684 probably right.
18685 I'm now running the test program...
18686 EOM
18687                 $cat >try.c <<EOCP
18688 #include <stdio.h>
18689 #$i_stdlib I_STDLIB
18690 #ifdef I_STDLIB
18691 #include <stdlib.h>
18692 #endif
18693 #include <sys/types.h>
18694 typedef $uvtype UV;
18695 int main()
18696 {
18697         int i;
18698         union {
18699                 UV l;
18700                 char c[$uvsize];
18701         } u;
18702
18703         if ($uvsize > 4)
18704                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18705         else
18706                 u.l = (UV)0x04030201;
18707         for (i = 0; i < $uvsize; i++)
18708                 printf("%c", u.c[i]+'0');
18709         printf("\n");
18710         exit(0);
18711 }
18712 EOCP
18713                 xxx_prompt=y
18714                 set try
18715                 if eval $compile && $run ./try > /dev/null; then
18716                         dflt=`$run ./try`
18717                         case "$dflt" in
18718                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18719                                 echo "(The test program ran ok.)"
18720                                 echo "byteorder=$dflt"
18721                                 xxx_prompt=n
18722                         ;;
18723                         ????|????????) echo "(The test program ran ok.)" ;;
18724                         *) echo "(The test program didn't run right for some reason.)" ;;
18725                         esac
18726                 else
18727                         dflt='4321'
18728                         cat <<'EOM'
18729 (I can't seem to compile the test program.  Guessing big-endian...)
18730 EOM
18731                 fi
18732                 case "$xxx_prompt" in
18733                 y)
18734                         rp="What is the order of bytes in $uvtype?"
18735                         . ./myread
18736                         byteorder="$ans"
18737                         ;;
18738                 *)      byteorder=$dflt
18739                         ;;
18740                 esac
18741                 ;;
18742         esac
18743         $rm_try
18744         ;;
18745 esac
18746
18747 : Checking 32bit alignedness
18748 $cat <<EOM
18749
18750 Checking to see whether you can access character data unalignedly...
18751 EOM
18752 case "$d_u32align" in
18753 '')   $cat >try.c <<EOCP
18754 #include <stdio.h>
18755 #$i_stdlib I_STDLIB
18756 #ifdef I_STDLIB
18757 #include <stdlib.h>
18758 #endif
18759 #define U32 $u32type
18760 #define BYTEORDER 0x$byteorder
18761 #define U8 $u8type
18762 #include <signal.h>
18763 #ifdef SIGBUS
18764 $signal_t bletch(int s) { exit(4); }
18765 #endif
18766 int main() {
18767 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18768     volatile U8 buf[8];
18769     volatile U32 *up;
18770     int i;
18771
18772     if (sizeof(U32) != 4) {
18773         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18774         exit(1);
18775     }
18776
18777     fflush(stdout);
18778
18779 #ifdef SIGBUS
18780     signal(SIGBUS, bletch);
18781 #endif
18782
18783     buf[0] = 0;
18784     buf[1] = 0;
18785     buf[2] = 0;
18786     buf[3] = 1;
18787     buf[4] = 0;
18788     buf[5] = 0;
18789     buf[6] = 0;
18790     buf[7] = 1;
18791
18792     for (i = 0; i < 4; i++) {
18793         up = (U32*)(buf + i);
18794         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18795                (*up == 1 << (8*(3-i)))  /* little-endian */
18796               )
18797            )
18798         {
18799             printf("read failed (%x)\n", *up);
18800             exit(2);
18801         }
18802     }
18803
18804     /* write test */
18805     for (i = 0; i < 4; i++) {
18806         up = (U32*)(buf + i);
18807         *up = 0xBeef;
18808         if (*up != 0xBeef) {
18809             printf("write failed (%x)\n", *up);
18810             exit(3);
18811         }
18812     }
18813
18814     exit(0);
18815 #else
18816     printf("1\n");
18817     exit(1);
18818 #endif
18819     return 0;
18820 }
18821 EOCP
18822 set try
18823 if eval $compile_ok; then
18824         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18825         $run ./try 2>&1 >/dev/null
18826         case "$?" in
18827         0)      cat >&4 <<EOM
18828 You can access character data pretty unalignedly.
18829 EOM
18830                 d_u32align="$undef"
18831                 ;;
18832         *)      cat >&4 <<EOM
18833 It seems that you must access character data in an aligned manner.
18834 EOM
18835                 d_u32align="$define"
18836                 ;;
18837         esac
18838 else
18839         rp='Can you access character data at unaligned addresses?'
18840         dflt='n'
18841         . ./myread
18842         case "$ans" in
18843         [yY]*)  d_u32align="$undef"  ;;
18844         *)      d_u32align="$define" ;;
18845         esac
18846 fi
18847 $rm_try
18848 ;;
18849 esac
18850
18851 : see if ualarm exists
18852 set ualarm d_ualarm
18853 eval $inlibc
18854
18855 : see if umask exists
18856 set umask d_umask
18857 eval $inlibc
18858
18859 : see if unordered exists
18860 set unordered d_unordered
18861 eval $inlibc
18862
18863 : see if unsetenv exists
18864 set unsetenv d_unsetenv
18865 eval $inlibc
18866
18867 : see if usleep exists
18868 set usleep d_usleep
18869 eval $inlibc
18870
18871 : see if prototype for usleep is available
18872 echo " "
18873 set d_usleepproto usleep $i_unistd unistd.h
18874 eval $hasproto
18875
18876 : see if ustat exists
18877 set ustat d_ustat
18878 eval $inlibc
18879
18880 : see if closedir exists
18881 set closedir d_closedir
18882 eval $inlibc
18883
18884 case "$d_closedir" in
18885 "$define")
18886         echo " "
18887         echo "Checking whether closedir() returns a status..." >&4
18888         cat > try.c <<EOM
18889 #$i_dirent I_DIRENT             /**/
18890 #$i_sysdir I_SYS_DIR            /**/
18891 #$i_sysndir I_SYS_NDIR          /**/
18892 #$i_systypes I_SYS_TYPES        /**/
18893
18894 #if defined(I_SYS_TYPES)
18895 #include <sys/types.h>
18896 #endif
18897 #if defined(I_DIRENT)
18898 #include <dirent.h>
18899 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18900 #include <sys/dir.h>
18901 #endif
18902 #else
18903 #ifdef I_SYS_NDIR
18904 #include <sys/ndir.h>
18905 #else
18906 #ifdef I_SYS_DIR
18907 #ifdef hp9000s500
18908 #include <ndir.h>       /* may be wrong in the future */
18909 #else
18910 #include <sys/dir.h>
18911 #endif
18912 #endif
18913 #endif
18914 #endif
18915 int main() { return closedir(opendir(".")); }
18916 EOM
18917         set try
18918         if eval $compile_ok; then
18919                 if $run ./try > /dev/null 2>&1 ; then
18920                         echo "Yes, it does."
18921                         val="$undef"
18922                 else
18923                         echo "No, it doesn't."
18924                         val="$define"
18925                 fi
18926         else
18927                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18928                 val="$define"
18929         fi
18930         ;;
18931 *)
18932         val="$undef";
18933         ;;
18934 esac
18935 set d_void_closedir
18936 eval $setvar
18937 $rm_try
18938
18939 : see if there is a wait4
18940 set wait4 d_wait4
18941 eval $inlibc
18942
18943 : see if waitpid exists
18944 set waitpid d_waitpid
18945 eval $inlibc
18946
18947 : see if wcstombs exists
18948 set wcstombs d_wcstombs
18949 eval $inlibc
18950
18951 : see if wctomb exists
18952 set wctomb d_wctomb
18953 eval $inlibc
18954
18955 : see if writev exists
18956 set writev d_writev
18957 eval $inlibc
18958
18959 : preserve RCS keywords in files with variable substitution, grrr
18960 Date='$Date'
18961 Id='$Id'
18962 Log='$Log'
18963 RCSfile='$RCSfile'
18964 Revision='$Revision'
18965
18966 : check for alignment requirements
18967 echo " "
18968 case "$usecrosscompile$multiarch" in
18969 *$define*)
18970         $cat <<EOM
18971 You seem to be either cross-compiling or doing a multiarchitecture build,
18972 skipping the memory alignment check.
18973
18974 EOM
18975         case "$alignbytes" in
18976         '') alignbytes=8 ;;
18977         esac
18978         ;;
18979 *)
18980         case "$alignbytes" in
18981         '') echo "Checking alignment constraints..." >&4
18982                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18983                         $cat >try.c <<'EOCP'
18984 typedef long double NV;
18985 EOCP
18986                 else
18987                         $cat >try.c <<'EOCP'
18988 typedef double NV;
18989 EOCP
18990                 fi
18991                 $cat >>try.c <<'EOCP'
18992 #include <stdio.h>
18993 struct foobar {
18994         char foo;
18995         NV bar;
18996 } try_algn;
18997 int main()
18998 {
18999     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19000     return(0);
19001 }
19002 EOCP
19003                 set try
19004                 if eval $compile_ok; then
19005                         dflt=`$run ./try`
19006                 else
19007                         dflt='8'
19008                         echo "(I can't seem to compile the test program...)"
19009                 fi
19010                 ;;
19011         *) dflt="$alignbytes"
19012                 ;;
19013         esac
19014         rp="Doubles must be aligned on a how-many-byte boundary?"
19015         . ./myread
19016         alignbytes="$ans"
19017         $rm_try
19018         ;;
19019 esac
19020
19021
19022 : set the base revision
19023 baserev=5.0
19024
19025 : length of character in bytes. Is always 1, otherwise it isnt C
19026 : This used to be a test using sizeof
19027 charsize=1
19028
19029 : Check for the number of bits in a character
19030 case "$charbits" in
19031 '')     echo "Checking how long a character is (in bits)..." >&4
19032         $cat >try.c <<EOCP
19033 #include <stdio.h>
19034 int main ()
19035 {
19036     int n;
19037     unsigned char c;
19038     for (c = 1, n = 0; c; c <<= 1, n++) ;
19039     printf ("%d\n", n);
19040     return (0);
19041     }
19042 EOCP
19043         set try
19044         if eval $compile_ok; then
19045                 dflt=`$run ./try`
19046         else
19047                 dflt='8'
19048                 echo "(I can't seem to compile the test program.  Guessing...)"
19049         fi
19050         ;;
19051 *)
19052         dflt="$charbits"
19053         ;;
19054 esac
19055 rp="What is the length of a character (in bits)?"
19056 . ./myread
19057 charbits="$ans"
19058 $rm_try
19059 case "$charbits" in
19060 8)      ;;
19061 *)      cat >&4 << EOM
19062 Your system has an unsigned character size of $charbits bits, which
19063 is rather unusual (normally it is 8 bits).  Perl likely will not work
19064 correctly on your system, with subtle bugs in various places.
19065 EOM
19066         rp='Do you really want to continue?'
19067         dflt='n'
19068         . ./myread
19069         case "$ans" in
19070                 [yY])   echo >&4 "Okay, continuing."    ;;
19071                 *)      exit 1                          ;;
19072         esac
19073 esac
19074
19075 : how do we concatenate cpp tokens here?
19076 echo " "
19077 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19078 $cat >cpp_stuff.c <<'EOCP'
19079 #define RCAT(a,b)a/**/b
19080 #define ACAT(a,b)a ## b
19081 RCAT(Rei,ser)
19082 ACAT(Cir,cus)
19083 EOCP
19084 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19085 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19086         echo "Oh!  Smells like ANSI's been here." >&4
19087         echo "We can catify or stringify, separately or together!"
19088         cpp_stuff=42
19089 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19090         echo "Ah, yes!  The good old days!" >&4
19091         echo "However, in the good old days we don't know how to stringify and"
19092         echo "catify at the same time."
19093         cpp_stuff=1
19094 else
19095         $cat >&4 <<EOM
19096 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19097 You're going to have to edit the values of CAT[2-5] in config.h...
19098 EOM
19099         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19100 fi
19101 $rm -f cpp_stuff.*
19102
19103 : see if this is a db.h system
19104 set db.h i_db
19105 eval $inhdr
19106
19107 case "$i_db" in
19108 $define)
19109         : Check db version.
19110         echo " "
19111         echo "Checking Berkeley DB version ..." >&4
19112         $cat >try.c <<EOCP
19113 #$d_const HASCONST
19114 #ifndef HASCONST
19115 #define const
19116 #endif
19117 #include <sys/types.h>
19118 #include <stdio.h>
19119 #$i_stdlib I_STDLIB
19120 #ifdef I_STDLIB
19121 #include <stdlib.h>
19122 #endif
19123 #include <db.h>
19124 int main(int argc, char *argv[])
19125 {
19126 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19127     int Major, Minor, Patch ;
19128     unsigned long Version ;
19129     (void)db_version(&Major, &Minor, &Patch) ;
19130     if (argc == 2) {
19131         printf("%d %d %d %d %d %d\n",
19132                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19133                Major, Minor, Patch);
19134         exit(0);
19135     }
19136     printf("You have Berkeley DB Version 2 or greater.\n");
19137
19138     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19139                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19140     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19141                 Major, Minor, Patch) ;
19142
19143     /* check that db.h & libdb are compatible */
19144     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19145         printf("db.h and libdb are incompatible.\n") ;
19146         exit(3);
19147     }
19148
19149     printf("db.h and libdb are compatible.\n") ;
19150
19151     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19152                 + DB_VERSION_PATCH ;
19153
19154     /* needs to be >= 2.3.4 */
19155     if (Version < 2003004) {
19156     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19157         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19158         exit(2);
19159     }
19160
19161     exit(0);
19162 #else
19163 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19164     if (argc == 2) {
19165         printf("1 0 0\n");
19166         exit(0);
19167     }
19168     printf("You have Berkeley DB Version 1.\n");
19169     exit(0);    /* DB version < 2: the coast is clear. */
19170 #else
19171     exit(1);    /* <db.h> not Berkeley DB? */
19172 #endif
19173 #endif
19174 }
19175 EOCP
19176         set try
19177         if eval $compile_ok && $run ./try; then
19178                 echo 'Looks OK.' >&4
19179                 set `$run ./try 1`
19180                 db_version_major=$1
19181                 db_version_minor=$2
19182                 db_version_patch=$3
19183         else
19184                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19185                 i_db=$undef
19186                 case " $libs " in
19187                 *"-ldb "*)
19188                         : Remove db from list of libraries to use
19189                         echo "Removing unusable -ldb from library list" >&4
19190                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19191                         shift
19192                         libs="$*"
19193                         echo "libs = $libs" >&4
19194                         ;;
19195                 esac
19196         fi
19197         $rm_try
19198         ;;
19199 esac
19200
19201 case "$i_db" in
19202 define)
19203         : Check the return type needed for hash
19204         echo " "
19205         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19206         $cat >try.c <<EOCP
19207 #$d_const HASCONST
19208 #ifndef HASCONST
19209 #define const
19210 #endif
19211 #include <sys/types.h>
19212 #include <db.h>
19213
19214 #ifndef DB_VERSION_MAJOR
19215 u_int32_t hash_cb (ptr, size)
19216 const void *ptr;
19217 size_t size;
19218 {
19219 }
19220 HASHINFO info;
19221 int main()
19222 {
19223         info.hash = hash_cb;
19224 }
19225 #endif
19226 EOCP
19227         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19228                 if $contains warning try.out >>/dev/null 2>&1 ; then
19229                         db_hashtype='int'
19230                 else
19231                         db_hashtype='u_int32_t'
19232                 fi
19233         else
19234                 : XXX Maybe we should just give up here.
19235                 db_hashtype=u_int32_t
19236                 $cat try.out >&4
19237                 echo "Help:  I can't seem to compile the db test program." >&4
19238                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19239         fi
19240         $rm_try
19241         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19242         ;;
19243 *)      db_hashtype=u_int32_t
19244         ;;
19245 esac
19246 case "$i_db" in
19247 define)
19248         : Check the return type needed for prefix
19249         echo " "
19250         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19251         cat >try.c <<EOCP
19252 #$d_const HASCONST
19253 #ifndef HASCONST
19254 #define const
19255 #endif
19256 #include <sys/types.h>
19257 #include <db.h>
19258
19259 #ifndef DB_VERSION_MAJOR
19260 size_t prefix_cb (key1, key2)
19261 const DBT *key1;
19262 const DBT *key2;
19263 {
19264 }
19265 BTREEINFO info;
19266 int main()
19267 {
19268         info.prefix = prefix_cb;
19269 }
19270 #endif
19271 EOCP
19272         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19273                 if $contains warning try.out >>/dev/null 2>&1 ; then
19274                         db_prefixtype='int'
19275                 else
19276                         db_prefixtype='size_t'
19277                 fi
19278         else
19279                 db_prefixtype='size_t'
19280                 : XXX Maybe we should just give up here.
19281                 $cat try.out >&4
19282                 echo "Help:  I can't seem to compile the db test program." >&4
19283                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19284         fi
19285         $rm_try
19286         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19287         ;;
19288 *)      db_prefixtype='size_t'
19289         ;;
19290 esac
19291
19292 : How can we generate normalized random numbers ?
19293 echo " "
19294 echo "Looking for a random number function..." >&4
19295 case "$randfunc" in
19296 '')
19297         if set drand48 val -f; eval $csym; $val; then
19298                 dflt="drand48"
19299                 echo "Good, found drand48()." >&4
19300         elif set random val -f; eval $csym; $val; then
19301                 dflt="random"
19302                 echo "OK, found random()." >&4
19303         else
19304                 dflt="rand"
19305                 echo "Yick, looks like I have to use rand()." >&4
19306         fi
19307         echo " "
19308         ;;
19309 *)
19310         dflt="$randfunc"
19311         ;;
19312 esac
19313 cont=true
19314
19315 case "$ccflags" in
19316 *-Dmy_rand=*|*-Dmy_srand=*)
19317         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19318         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19319         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19320         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19321         ;;
19322 esac
19323
19324 while $test "$cont"; do
19325         rp="Use which function to generate random numbers?"
19326         . ./myread
19327         if $test "$ans" = "$dflt"; then
19328                 : null
19329         else
19330                 randbits=''
19331         fi
19332         randfunc="$ans"
19333         if set $ans val -f; eval $csym; $val; then
19334                 cont=''
19335         else
19336                 dflt=y
19337                 rp="I cannot find function $ans. Use that name anyway?"
19338                 . ./myread
19339                 dflt=rand
19340                 case "$ans" in
19341                         [yY]*) cont='';;
19342                 esac
19343         fi
19344         case "$cont" in
19345         '')
19346                 case "$randfunc" in
19347                 drand48)
19348                         drand01="drand48()"
19349                         seedfunc="srand48"
19350                         randbits=48
19351                         randseedtype=long
19352                         ;;
19353                 rand|random)
19354                         case "$randbits" in
19355                         '')
19356 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19357                                 $cat >try.c <<EOCP
19358 #$i_unistd I_UNISTD
19359 #$i_stdlib I_STDLIB
19360 #include <stdio.h>
19361 #ifdef I_UNISTD
19362 #  include <unistd.h>
19363 #endif
19364 #ifdef I_STDLIB
19365 #  include <stdlib.h>
19366 #endif
19367 int main()
19368 {
19369         register int i;
19370         register unsigned long tmp;
19371         register unsigned long max = 0L;
19372
19373         for (i = 1000; i; i--) {
19374                 tmp = (unsigned long) $randfunc();
19375                 if (tmp > max) max = tmp;
19376         }
19377         for (i = 0; max; i++)
19378                 max /= 2;
19379         printf("%d\n",i);
19380 }
19381 EOCP
19382                                 set try
19383                                 if eval $compile_ok; then
19384                                         dflt=`try`
19385                                 else
19386                                         dflt='?'
19387                                         echo "(I can't seem to compile the test program...)"
19388                                 fi
19389                                 ;;
19390                         *)
19391                                 dflt="$randbits"
19392                                 ;;
19393                         esac
19394                         rp="How many bits does your $randfunc() function produce?"
19395                         . ./myread
19396                         randbits="$ans"
19397                         $rm_try
19398                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19399                         seedfunc="s$randfunc"
19400                         randseedtype=unsigned
19401                         ;;
19402                 *)
19403                         dflt="31"
19404                         rp="How many bits does your $randfunc() function produce?"
19405                         . ./myread
19406                         randbits="$ans"
19407                         seedfunc="s$randfunc"
19408                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19409                         if set $seedfunc val -f; eval $csym; $val; then
19410                                 echo "(Using $seedfunc() to seed random generator)"
19411                         else
19412                                 echo "(Warning: no $seedfunc() to seed random generator)"
19413                                 seedfunc=rand
19414                         fi
19415                         randseedtype=unsigned
19416                         ;;
19417                 esac
19418                 ;;
19419         esac
19420 done
19421
19422 : Determine if this is an EBCDIC system
19423 echo " "
19424 echo "Determining whether or not we are on an EBCDIC system..." >&4
19425 $cat >try.c <<'EOM'
19426 int main()
19427 {
19428   if ('M'==0xd4) return 0;
19429   return 1;
19430 }
19431 EOM
19432
19433 val=$undef
19434 set try
19435 if eval $compile_ok; then
19436         if $run ./try; then
19437                 echo "You seem to speak EBCDIC." >&4
19438                 val="$define"
19439         else
19440                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19441         fi
19442 else
19443         echo "I'm unable to compile the test program." >&4
19444         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19445 fi
19446 $rm_try
19447 set ebcdic
19448 eval $setvar
19449
19450 : Check how to flush
19451 echo " "
19452 $cat >&4 <<EOM
19453 Checking how to flush all pending stdio output...
19454 EOM
19455 # I only know how to find the first 32 possibly open files on SunOS.
19456 # See also hints/sunos_4_1.sh and util.c  --AD
19457 case "$osname" in
19458 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19459 esac
19460 $cat >>try.c <<EOCP
19461 #include <stdio.h>
19462 #$i_stdlib I_STDLIB
19463 #ifdef I_STDLIB
19464 #include <stdlib.h>
19465 #endif
19466 #$i_unistd I_UNISTD
19467 #ifdef I_UNISTD
19468 # include <unistd.h>
19469 #endif
19470 #$d_sysconf HAS_SYSCONF
19471 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19472 #ifdef HAS_STDIO_STREAM_ARRAY
19473 # define STDIO_STREAM_ARRAY $stdio_stream_array
19474 #endif
19475 int main() {
19476   FILE* p;
19477   unlink("try.out");
19478   p = fopen("try.out", "w");
19479 #ifdef TRY_FPUTC
19480   fputc('x', p);
19481 #else
19482 # ifdef TRY_FPRINTF
19483   fprintf(p, "x");
19484 # endif
19485 #endif
19486 #ifdef TRY_FFLUSH_NULL
19487   fflush(NULL);
19488 #endif
19489 #ifdef TRY_FFLUSH_ALL
19490   {
19491     long open_max = -1;
19492 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19493     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19494 # else
19495 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19496     open_max = sysconf(_SC_OPEN_MAX);
19497 #  else
19498 #   ifdef FOPEN_MAX
19499     open_max = FOPEN_MAX;
19500 #   else
19501 #    ifdef OPEN_MAX
19502     open_max = OPEN_MAX;
19503 #    else
19504 #     ifdef _NFILE
19505     open_max = _NFILE;
19506 #     endif
19507 #    endif
19508 #   endif
19509 #  endif
19510 # endif
19511 # ifdef HAS_STDIO_STREAM_ARRAY
19512     if (open_max > 0) {
19513       long i;
19514       for (i = 0; i < open_max; i++)
19515             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19516                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19517                 STDIO_STREAM_ARRAY[i]._flag)
19518                 fflush(&STDIO_STREAM_ARRAY[i]);
19519     }
19520   }
19521 # endif
19522 #endif
19523   _exit(42);
19524 }
19525 EOCP
19526 : first we have to find out how _not_ to flush
19527 $to try.c
19528 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19529     output=''
19530     set try -DTRY_FPUTC
19531     if eval $compile; then
19532             $run ./try 2>/dev/null
19533             code="$?"
19534             $from try.out
19535             if $test ! -s try.out -a "X$code" = X42; then
19536                 output=-DTRY_FPUTC
19537             fi
19538     fi
19539     case "$output" in
19540     '')
19541             set try -DTRY_FPRINTF
19542             if eval $compile; then
19543                     $run ./try 2>/dev/null
19544                     code="$?"
19545                     $from try.out
19546                     if $test ! -s try.out -a "X$code" = X42; then
19547                         output=-DTRY_FPRINTF
19548                     fi
19549             fi
19550         ;;
19551     esac
19552 fi
19553 : check for fflush NULL behaviour
19554 case "$fflushNULL" in
19555 '')     set try -DTRY_FFLUSH_NULL $output
19556         if eval $compile; then
19557                 $run ./try 2>/dev/null
19558                 code="$?"
19559                 $from try.out
19560                 if $test -s try.out -a "X$code" = X42; then
19561                         fflushNULL="`$cat try.out`"
19562                 else
19563                         if $test "X$code" != X42; then
19564                                 $cat >&4 <<EOM
19565 (If this test failed, don't worry, we'll try another method shortly.)
19566 EOM
19567                         fi
19568                 fi
19569         fi
19570         $rm -f core try.core core.try.*
19571         case "$fflushNULL" in
19572         x)      $cat >&4 <<EOM
19573 Your fflush(NULL) works okay for output streams.
19574 Let's see if it clobbers input pipes...
19575 EOM
19576 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19577 # bug that improperly flushes the input end of pipes.  So we avoid the
19578 # autoflush on fork/system/exec support for now. :-(
19579 $cat >tryp.c <<EOCP
19580 #include <stdio.h>
19581 int
19582 main(int argc, char **argv)
19583 {
19584     char buf[1024];
19585     int i;
19586     char *bp = buf;
19587     while (1) {
19588         while ((i = getc(stdin)) != -1
19589                && (*bp++ = i) != '\n'
19590                && bp < &buf[1024])
19591         /* DO NOTHING */ ;
19592         *bp = '\0';
19593         fprintf(stdout, "%s", buf);
19594         fflush(NULL);
19595         if (i == -1)
19596             return 0;
19597         bp = buf;
19598     }
19599 }
19600 EOCP
19601                 fflushNULL="$define"
19602                 set tryp
19603                 if eval $compile; then
19604                     $rm -f tryp.out
19605                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19606                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19607                        $cat >&4 <<EOM
19608 fflush(NULL) seems to behave okay with input streams.
19609 EOM
19610                         fflushNULL="$define"
19611                     else
19612                         $cat >&4 <<EOM
19613 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19614 EOM
19615                         fflushNULL="$undef"
19616                     fi
19617                 fi
19618                 $rm -f core tryp.c tryp.core core.tryp.*
19619                 ;;
19620         '')     $cat >&4 <<EOM
19621 Your fflush(NULL) isn't working (contrary to ANSI C).
19622 EOM
19623                 fflushNULL="$undef"
19624                 ;;
19625         *)      $cat >&4 <<EOM
19626 Cannot figure out whether your fflush(NULL) works or not.
19627 I'm assuming it doesn't (contrary to ANSI C).
19628 EOM
19629                 fflushNULL="$undef"
19630                 ;;
19631         esac
19632         ;;
19633 $define|true|[yY]*)
19634         fflushNULL="$define"
19635         ;;
19636 *)
19637         fflushNULL="$undef"
19638         ;;
19639 esac
19640 : check explicit looping only if NULL did not work, and if the pipe
19641 : bug does not show up on an explicit flush too
19642 case "$fflushNULL" in
19643 "$undef")
19644         $cat >tryp.c <<EOCP
19645 #include <stdio.h>
19646 int
19647 main(int argc, char **argv)
19648 {
19649     char buf[1024];
19650     int i;
19651     char *bp = buf;
19652     while (1) {
19653         while ((i = getc(stdin)) != -1
19654                && (*bp++ = i) != '\n'
19655                && bp < &buf[1024])
19656         /* DO NOTHING */ ;
19657         *bp = '\0';
19658         fprintf(stdout, "%s", buf);
19659         fflush(stdin);
19660         if (i == -1)
19661             return 0;
19662         bp = buf;
19663     }
19664 }
19665 EOCP
19666         set tryp
19667         if eval $compile; then
19668             $rm -f tryp.out
19669             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19670             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19671                $cat >&4 <<EOM
19672 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19673 EOM
19674                 : now check for fflushall behaviour
19675                 case "$fflushall" in
19676                 '')     set try -DTRY_FFLUSH_ALL $output
19677                         if eval $compile; then
19678                                 $cat >&4 <<EOM
19679 (Now testing the other method--but note that this also may fail.)
19680 EOM
19681                                 $run ./try 2>/dev/null
19682                                 code=$?
19683                                 $from try.out
19684                                 if $test -s try.out -a "X$code" = X42; then
19685                                         fflushall="`$cat try.out`"
19686                                 fi
19687                         fi
19688                         $rm_try
19689                         case "$fflushall" in
19690                         x)      $cat >&4 <<EOM
19691 Whew. Flushing explicitly all the stdio streams works.
19692 EOM
19693                                 fflushall="$define"
19694                                 ;;
19695                         '')     $cat >&4 <<EOM
19696 Sigh. Flushing explicitly all the stdio streams doesn't work.
19697 EOM
19698                                 fflushall="$undef"
19699                                 ;;
19700                         *)      $cat >&4 <<EOM
19701 Cannot figure out whether flushing stdio streams explicitly works or not.
19702 I'm assuming it doesn't.
19703 EOM
19704                                 fflushall="$undef"
19705                                 ;;
19706                         esac
19707                         ;;
19708                 "$define"|true|[yY]*)
19709                         fflushall="$define"
19710                         ;;
19711                 *)
19712                         fflushall="$undef"
19713                         ;;
19714                 esac
19715             else
19716                 $cat >&4 <<EOM
19717 All is futile.  Even fflush(stdin) clobbers input pipes!
19718 EOM
19719                 fflushall="$undef"
19720             fi
19721         else
19722             fflushall="$undef"
19723         fi
19724         $rm -f core tryp.c tryp.core core.tryp.*
19725         ;;
19726 *)      fflushall="$undef"
19727         ;;
19728 esac
19729
19730 case "$fflushNULL$fflushall" in
19731 undefundef)
19732         $cat <<EOM
19733 OK, I give up.  I cannot figure out how to flush pending stdio output.
19734 We won't be flushing handles at all before fork/exec/popen.
19735 EOM
19736         ;;
19737 esac
19738 $rm_try tryp
19739
19740 : Store the full pathname to the ar program for use in the C program
19741 : Respect a hint or command line value for full_ar.
19742 case "$full_ar" in
19743 '') full_ar=$ar ;;
19744 esac
19745
19746 : Store the full pathname to the sed program for use in the C program
19747 full_sed=$sed
19748
19749 : see what type gids are declared as in the kernel
19750 echo " "
19751 echo "Looking for the type for group ids returned by getgid()."
19752 set gid_t gidtype xxx stdio.h sys/types.h
19753 eval $typedef
19754 case "$gidtype" in
19755 xxx)
19756         xxx=`./findhdr sys/user.h`
19757         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19758         case $1 in
19759         unsigned) dflt="$1 $2" ;;
19760         *) dflt="$1" ;;
19761         esac
19762         ;;
19763 *) dflt="$gidtype";;
19764 esac
19765 case "$gidtype" in
19766 gid_t) echo "gid_t found." ;;
19767 *)      rp="What is the type for group ids returned by getgid()?"
19768         . ./myread
19769         gidtype="$ans"
19770         ;;
19771 esac
19772
19773 : Check the size of GID
19774 echo " "
19775 case "$gidtype" in
19776 *_t) zzz="$gidtype"     ;;
19777 *)   zzz="gid"          ;;
19778 esac
19779 echo "Checking the size of $zzz..." >&4
19780 cat > try.c <<EOCP
19781 #include <sys/types.h>
19782 #include <stdio.h>
19783 #$i_stdlib I_STDLIB
19784 #ifdef I_STDLIB
19785 #include <stdlib.h>
19786 #endif
19787 int main() {
19788     printf("%d\n", (int)sizeof($gidtype));
19789     exit(0);
19790 }
19791 EOCP
19792 set try
19793 if eval $compile_ok; then
19794         yyy=`$run ./try`
19795         case "$yyy" in
19796         '')     gidsize=4
19797                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19798                 ;;
19799         *)      gidsize=$yyy
19800                 echo "Your $zzz is $gidsize bytes long."
19801                 ;;
19802         esac
19803 else
19804         gidsize=4
19805         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19806 fi
19807
19808
19809 : Check if GID is signed
19810 echo " "
19811 case "$gidtype" in
19812 *_t) zzz="$gidtype"     ;;
19813 *)   zzz="gid"          ;;
19814 esac
19815 echo "Checking the sign of $zzz..." >&4
19816 cat > try.c <<EOCP
19817 #include <sys/types.h>
19818 #include <stdio.h>
19819 int main() {
19820         $gidtype foo = -1;
19821         if (foo < 0)
19822                 printf("-1\n");
19823         else
19824                 printf("1\n");
19825 }
19826 EOCP
19827 set try
19828 if eval $compile; then
19829         yyy=`$run ./try`
19830         case "$yyy" in
19831         '')     gidsign=1
19832                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19833                 ;;
19834         *)      gidsign=$yyy
19835                 case "$gidsign" in
19836                  1) echo "Your $zzz is unsigned." ;;
19837                 -1) echo "Your $zzz is signed."   ;;
19838                 esac
19839                 ;;
19840         esac
19841 else
19842         gidsign=1
19843         echo "(I can't compile the test program--guessing unsigned.)" >&4
19844 fi
19845
19846
19847 : Check 64bit sizes
19848 echo " "
19849
19850 if $test X"$quadtype" != X; then
19851
19852 echo "Checking how to print 64-bit integers..." >&4
19853
19854 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19855         $cat >try.c <<'EOCP'
19856 #include <sys/types.h>
19857 #include <stdio.h>
19858 int main() {
19859   int q = 12345678901;
19860   printf("%ld\n", q);
19861 }
19862 EOCP
19863         set try
19864         if eval $compile; then
19865                 yyy=`$run ./try`
19866                 case "$yyy" in
19867                 12345678901)
19868                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19869                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19870                         echo "We will use %d."
19871                         ;;
19872                 esac
19873         fi
19874 fi
19875
19876 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19877         $cat >try.c <<'EOCP'
19878 #include <sys/types.h>
19879 #include <stdio.h>
19880 int main() {
19881   long q = 12345678901;
19882   printf("%ld\n", q);
19883 }
19884 EOCP
19885         set try
19886         if eval $compile; then
19887                 yyy=`$run ./try`
19888                 case "$yyy" in
19889                 12345678901)
19890                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19891                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19892                         echo "We will use %ld."
19893                         ;;
19894                 esac
19895         fi
19896 fi
19897
19898 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19899         $cat >try.c <<'EOCP'
19900 #include <sys/types.h>
19901 #include <inttypes.h>
19902 #include <stdio.h>
19903 int main() {
19904   int64_t q = 12345678901;
19905   printf("%" PRId64 "\n", q);
19906 }
19907 EOCP
19908         set try
19909         if eval $compile; then
19910                 yyy=`$run ./try`
19911                 case "$yyy" in
19912                 12345678901)
19913                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19914                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19915                         echo "We will use the C9X style."
19916                         ;;
19917                 esac
19918         fi
19919 fi
19920
19921 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19922         $cat >try.c <<EOCP
19923 #include <sys/types.h>
19924 #include <stdio.h>
19925 int main() {
19926   $quadtype q = 12345678901;
19927   printf("%Ld\n", q);
19928 }
19929 EOCP
19930         set try
19931         if eval $compile; then
19932                 yyy=`$run ./try`
19933                 case "$yyy" in
19934                 12345678901)
19935                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19936                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19937                         echo "We will use %Ld."
19938                         ;;
19939                 esac
19940         fi
19941 fi
19942
19943 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19944         $cat >try.c <<'EOCP'
19945 #include <sys/types.h>
19946 #include <stdio.h>
19947 int main() {
19948   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19949   printf("%lld\n", q);
19950 }
19951 EOCP
19952         set try
19953         if eval $compile; then
19954                 yyy=`$run ./try`
19955                 case "$yyy" in
19956                 12345678901)
19957                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19958                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19959                         echo "We will use the %lld style."
19960                         ;;
19961                 esac
19962         fi
19963 fi
19964
19965 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19966         $cat >try.c <<EOCP
19967 #include <sys/types.h>
19968 #include <stdio.h>
19969 int main() {
19970   $quadtype q = 12345678901;
19971   printf("%qd\n", q);
19972 }
19973 EOCP
19974         set try
19975         if eval $compile; then
19976                 yyy=`$run ./try`
19977                 case "$yyy" in
19978                 12345678901)
19979                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19980                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19981                         echo "We will use %qd."
19982                         ;;
19983                 esac
19984         fi
19985 fi
19986
19987 if $test X"$sPRId64" = X; then
19988         echo "Cannot figure out how to print 64-bit integers." >&4
19989 fi
19990 $rm_try
19991
19992 fi
19993
19994 case "$sPRId64" in
19995 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19996         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19997         ;;
19998 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19999         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20000         ;;
20001 esac
20002
20003 : Check format strings for internal types
20004 echo " "
20005 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20006
20007 if $test X"$ivsize" = X8; then
20008         ivdformat="$sPRId64"
20009         uvuformat="$sPRIu64"
20010         uvoformat="$sPRIo64"
20011         uvxformat="$sPRIx64"
20012         uvXUformat="$sPRIXU64"
20013 else
20014         if $test X"$ivsize" = X"$longsize"; then
20015                 ivdformat='"ld"'
20016                 uvuformat='"lu"'
20017                 uvoformat='"lo"'
20018                 uvxformat='"lx"'
20019                 uvXUformat='"lX"'
20020         else
20021                 if $test X"$ivsize" = X"$intsize"; then
20022                         ivdformat='"d"'
20023                         uvuformat='"u"'
20024                         uvoformat='"o"'
20025                         uvxformat='"x"'
20026                         uvXUformat='"X"'
20027                 else
20028                         : far out
20029                         if $test X"$ivsize" = X"$shortsize"; then
20030                                 ivdformat='"hd"'
20031                                 uvuformat='"hu"'
20032                                 uvoformat='"ho"'
20033                                 uvxformat='"hx"'
20034                                 uvXUformat='"hX"'
20035                         fi
20036                 fi
20037         fi
20038 fi
20039
20040 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20041         nveformat="$sPRIeldbl"
20042         nvfformat="$sPRIfldbl"
20043         nvgformat="$sPRIgldbl"
20044         nvEUformat="$sPRIEUldbl"
20045         nvFUformat="$sPRIFUldbl"
20046         nvGUformat="$sPRIGUldbl"
20047 else
20048         nveformat='"e"'
20049         nvfformat='"f"'
20050         nvgformat='"g"'
20051         nvEUformat='"E"'
20052         nvFUformat='"F"'
20053         nvGUformat='"G"'
20054 fi
20055
20056 case "$ivdformat" in
20057 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20058     exit 1
20059     ;;
20060 esac
20061
20062 : Check format string for GID
20063
20064 echo " "
20065 $echo "Checking the format string to be used for gids..." >&4
20066
20067 case "$gidsign" in
20068 -1)     if $test X"$gidsize" = X"$ivsize"; then
20069                 gidformat="$ivdformat"
20070         else
20071                 if $test X"$gidsize" = X"$longsize"; then
20072                         gidformat='"ld"'
20073                 else
20074                         if $test X"$gidsize" = X"$intsize"; then
20075                                 gidformat='"d"'
20076                         else
20077                                 if $test X"$gidsize" = X"$shortsize"; then
20078                                         gidformat='"hd"'
20079                                 fi
20080                         fi
20081                 fi
20082         fi
20083         ;;
20084 *)      if $test X"$gidsize" = X"$uvsize"; then
20085                 gidformat="$uvuformat"
20086         else
20087                 if $test X"$gidsize" = X"$longsize"; then
20088                         gidformat='"lu"'
20089                 else
20090                         if $test X"$gidsize" = X"$intsize"; then
20091                                 gidformat='"u"'
20092                         else
20093                                 if $test X"$gidsize" = X"$shortsize"; then
20094                                         gidformat='"hu"'
20095                                 fi
20096                         fi
20097                 fi
20098         fi
20099         ;;
20100 esac
20101
20102 : see if getgroups exists
20103 set getgroups d_getgrps
20104 eval $inlibc
20105
20106 : see if setgroups exists
20107 set setgroups d_setgrps
20108 eval $inlibc
20109
20110 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20111 echo " "
20112 case "$d_getgrps$d_setgrps" in
20113 *define*)
20114         case "$groupstype" in
20115         '') dflt="$gidtype" ;;
20116         *)  dflt="$groupstype" ;;
20117         esac
20118         $cat <<EOM
20119 What type of pointer is the second argument to getgroups() and setgroups()?
20120 Usually this is the same as group ids, $gidtype, but not always.
20121
20122 EOM
20123         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20124         . ./myread
20125         groupstype="$ans"
20126         ;;
20127 *)  groupstype="$gidtype";;
20128 esac
20129
20130 : MAD = Misc Attribute Definition
20131
20132 if $test $patchlevel -lt 9; then
20133 : MAD is not available in 5.8.x or earlier.
20134     ans=n;
20135 else
20136     case "$mad" in
20137     $define|true|[yY]*) dflt='y' ;;
20138     *)                  dflt='n' ;;
20139     esac
20140     cat <<EOM
20141
20142 Would you like to build with Misc Attribute Decoration? This is development
20143 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20144 overhead on the interpreter.
20145
20146 If this doesn't make any sense to you, just accept the default '$dflt'.
20147 EOM
20148     rp='Build Perl with MAD?'
20149     . ./myread
20150 fi
20151 case "$ans" in
20152 y|Y)    val="$define"
20153         madlyh='madly.h madly.act madly.tab'
20154         madlysrc='madly.c'
20155         madlyobj="madly$_o" ;;
20156 *)      val="$undef"
20157         madlyh=''
20158         madlysrc=''
20159         madlyobj='' ;;
20160 esac
20161 set mad
20162 eval $setvar
20163
20164 : check whether make sets MAKE
20165 echo " "
20166 echo "Checking if your $make program sets \$(MAKE)..." >&4
20167 case "$make_set_make" in
20168 '')
20169         $sed 's/^X //' > testmake.mak << 'EOF'
20170 Xall:
20171 X       @echo 'maketemp="$(MAKE)"'
20172 EOF
20173         case "`$make -f testmake.mak 2>/dev/null`" in
20174         *maketemp=*) make_set_make='#' ;;
20175         *)      make_set_make="MAKE=$make" ;;
20176         esac
20177         $rm -f testmake.mak
20178         ;;
20179 esac
20180 case "$make_set_make" in
20181 '#') echo "Yup, it does.";;
20182 *) echo "Nope, it doesn't.";;
20183 esac
20184
20185 : see what type is used for mode_t
20186 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20187 set mode_t modetype int stdio.h sys/types.h
20188 eval $typedef_ask
20189
20190 : see if we need va_copy
20191 echo " "
20192 case "$i_stdarg" in
20193 "$define")
20194         $cat >try.c <<EOCP
20195 #include <stdarg.h>
20196 #include <stdio.h>
20197 #$i_stdlib I_STDLIB
20198 #ifdef I_STDLIB
20199 #include <stdlib.h>
20200 #endif
20201 #include <signal.h>
20202
20203 int
20204 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20205 {
20206   return vfprintf(f, fmt, *valp);
20207 }
20208
20209 int
20210 myvfprintf(FILE *f, const  char *fmt, va_list val)
20211 {
20212   return ivfprintf(f, fmt, &val);
20213 }
20214
20215 int
20216 myprintf(char *fmt, ...)
20217 {
20218   va_list val;
20219   va_start(val, fmt);
20220   return myvfprintf(stdout, fmt, val);
20221 }
20222
20223 int
20224 main(int ac, char **av)
20225 {
20226   signal(SIGSEGV, exit);
20227
20228   myprintf("%s%cs all right, then\n", "that", '\'');
20229   exit(0);
20230 }
20231 EOCP
20232         set try
20233         if eval $compile && $run ./try 2>&1 >/dev/null; then
20234                 case "`$run ./try`" in
20235                 "that's all right, then")
20236                         okay=yes
20237                         ;;
20238                 esac
20239         fi
20240         case "$okay" in
20241         yes)    echo "It seems that you don't need va_copy()." >&4
20242                 need_va_copy="$undef"
20243                 ;;
20244         *)      echo "It seems that va_copy() or similar will be needed." >&4
20245                 need_va_copy="$define"
20246                 ;;
20247         esac
20248         $rm_try
20249         ;;
20250 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20251         ;;
20252 esac
20253
20254 : see what type is used for size_t
20255 rp="What is the type used for the length parameter for string functions?"
20256 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20257 eval $typedef_ask
20258
20259 : check for type of arguments to gethostbyaddr. 
20260 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20261         case "$d_gethbyaddr" in
20262         $define)
20263                 $cat <<EOM
20264
20265 Checking to see what type of arguments are accepted by gethostbyaddr().
20266 EOM
20267                 hdrs="$define sys/types.h
20268                         $d_socket sys/socket.h 
20269                         $i_niin netinet/in.h 
20270                         $i_netdb netdb.h
20271                         $i_unistd unistd.h"
20272                 : The first arg can 'char *' or 'void *'
20273                 : The second arg is some of integral type
20274                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20275                         for yyy in size_t long int; do
20276                                 case "$netdb_host_type" in
20277                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20278                                         if ./protochk "$try" $hdrs; then
20279                                                 echo "Your system accepts $xxx for the first arg."
20280                                                 echo "...and $yyy for the second arg."
20281                                                 netdb_host_type="$xxx"
20282                                                 netdb_hlen_type="$yyy"
20283                                         fi
20284                                         ;;
20285                                 esac
20286                         done
20287                 done
20288                 : In case none of those worked, prompt the user.
20289                 case "$netdb_host_type" in
20290                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20291                         dflt='char *'
20292                         . ./myread
20293                         netdb_host_type=$ans
20294                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20295                         dflt="$sizetype"
20296                         . ./myread
20297                         netdb_hlen_type=$ans
20298                         ;;
20299                 esac
20300                 ;;
20301         *)      : no gethostbyaddr, so pick harmless defaults
20302                 netdb_host_type='char *'
20303                 netdb_hlen_type="$sizetype"
20304                 ;;
20305         esac
20306         # Remove the "const" if needed. -- but then we'll have a 
20307         # prototype clash!
20308         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20309 fi
20310
20311 : check for type of argument to gethostbyname. 
20312 if test "X$netdb_name_type" = X ; then
20313         case "$d_gethbyname" in
20314         $define)
20315                 $cat <<EOM
20316
20317 Checking to see what type of argument is accepted by gethostbyname().
20318 EOM
20319                 hdrs="$define sys/types.h
20320                         $d_socket sys/socket.h 
20321                         $i_niin netinet/in.h 
20322                         $i_netdb netdb.h
20323                         $i_unistd unistd.h"
20324                 for xxx in "const char *" "char *"; do
20325                         case "$netdb_name_type" in
20326                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20327                                 if ./protochk "$try" $hdrs; then
20328                                         echo "Your system accepts $xxx."
20329                                         netdb_name_type="$xxx"
20330                                 fi
20331                                 ;;
20332                         esac
20333                 done
20334                 : In case none of those worked, prompt the user.
20335                 case "$netdb_name_type" in
20336                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20337                         dflt='char *'
20338                         . ./myread
20339                         netdb_name_type=$ans
20340                         ;;
20341                 esac
20342                 ;;
20343         *)      : no gethostbyname, so pick harmless default
20344                 netdb_name_type='char *'
20345                 ;;
20346         esac
20347 fi
20348
20349 : check for type of 1st argument to getnetbyaddr. 
20350 if test "X$netdb_net_type" = X ; then
20351         case "$d_getnbyaddr" in
20352         $define)
20353                 $cat <<EOM
20354
20355 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20356 EOM
20357                 hdrs="$define sys/types.h
20358                         $d_socket sys/socket.h 
20359                         $i_niin netinet/in.h 
20360                         $i_netdb netdb.h
20361                         $i_unistd unistd.h"
20362                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20363                         case "$netdb_net_type" in
20364                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20365                                 if ./protochk "$try" $hdrs; then
20366                                         echo "Your system accepts $xxx."
20367                                         netdb_net_type="$xxx"
20368                                 fi
20369                                 ;;
20370                         esac
20371                 done
20372                 : In case none of those worked, prompt the user.
20373                 case "$netdb_net_type" in
20374                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20375                         dflt='long'
20376                         . ./myread
20377                         netdb_net_type=$ans
20378                         ;;
20379                 esac
20380                 ;;
20381         *)      : no getnetbyaddr, so pick harmless default
20382                 netdb_net_type='long'
20383                 ;;
20384         esac
20385 fi
20386 : locate the preferred pager for this system
20387 fn=f/
20388 case "$pager" in
20389 '')
20390         dflt=''
20391         case "$pg" in
20392         /*) dflt=$pg;;
20393         [a-zA-Z]:/*) dflt=$pg;;
20394         esac
20395         case "$more" in
20396         /*) dflt=$more;;
20397         [a-zA-Z]:/*) dflt=$more;;
20398         esac
20399         case "$less" in
20400         /*) dflt=$less;;
20401         [a-zA-Z]:/*) dflt=$less;;
20402         esac
20403         case "$dflt" in
20404         '') dflt=/usr/ucb/more;;
20405         esac
20406         ;;
20407 *)      dflt="$pager"
20408         fn="f/($pager)"
20409         ;;
20410 esac
20411 echo " "
20412 rp='What pager is used on your system?'
20413 . ./getfile
20414 pager="$ans"
20415
20416 : see what type pids are declared as in the kernel
20417 rp="What is the type of process ids on this system?"
20418 set pid_t pidtype int stdio.h sys/types.h
20419 eval $typedef_ask
20420
20421 : see if ar generates random libraries by itself
20422 echo " "
20423 echo "Checking how to generate random libraries on your machine..." >&4
20424 echo 'int bar1() { return bar2(); }' > bar1.c
20425 echo 'int bar2() { return 2; }' > bar2.c
20426 $cat > foo.c <<EOP
20427 #$i_stdlib I_STDLIB
20428 #ifdef I_STDLIB
20429 #include <stdlib.h>
20430 #endif
20431 int main() { printf("%d\n", bar1()); exit(0); }
20432 EOP
20433 $cc $ccflags -c bar1.c >/dev/null 2>&1
20434 $cc $ccflags -c bar2.c >/dev/null 2>&1
20435 $cc $ccflags -c foo.c >/dev/null 2>&1
20436 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20437 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20438         $run ./foobar >/dev/null 2>&1; then
20439         echo "$ar appears to generate random libraries itself."
20440         orderlib=false
20441         if [ "X$ranlib" = "X" ]; then
20442             ranlib=":"
20443         fi
20444 elif $ar s bar$_a >/dev/null 2>&1 &&
20445         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20446         $run ./foobar >/dev/null 2>&1; then
20447                 echo "a table of contents needs to be added with '$ar s'."
20448                 orderlib=false
20449                 ranlib="$ar s"
20450 elif $ar ts bar$_a >/dev/null 2>&1 &&
20451         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20452         $run ./foobar >/dev/null 2>&1; then
20453                 echo "a table of contents needs to be added with '$ar ts'."
20454                 orderlib=false
20455                 ranlib="$ar ts"
20456 else
20457         case "$ranlib" in
20458         :) ranlib='';;
20459         '')
20460                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20461                 $test -f $ranlib || ranlib=''
20462                 ;;
20463         esac
20464         if $test -n "$ranlib"; then
20465                 echo "your system has '$ranlib'; we'll use that."
20466                 orderlib=false
20467         else
20468                 echo "your system doesn't seem to support random libraries"
20469                 echo "so we'll use lorder and tsort to order the libraries."
20470                 orderlib=true
20471                 ranlib=":"
20472         fi
20473 fi
20474 $rm -f foo* bar*
20475
20476 : see if this is a values.h system
20477 set values.h i_values
20478 eval $inhdr
20479
20480 : Check the max offset that gmtime and localtime accept
20481 echo "Checking max offsets that gmtime () accepts"
20482
20483 case $i_values in
20484     define) yyy="#include <values.h>" ;;
20485     *)      yyy="" ;;
20486     esac
20487
20488 case "$sGMTIME_min/$sGMTIME_max" in
20489     0/0|/)
20490         $cat >try.c <<EOCP
20491 #include <sys/types.h>
20492 #include <stdio.h>
20493 #include <time.h>
20494 $yyy
20495
20496 int i;
20497 struct tm *tmp;
20498 time_t pt;
20499
20500 void gm_check (time_t t, int min_year, int max_year)
20501 {
20502     tmp = gmtime (&t);
20503     if ( tmp == NULL ||
20504         /* Check tm_year overflow */
20505          tmp->tm_year < min_year || tmp->tm_year > max_year)
20506         tmp = NULL;
20507     else
20508         pt = t;
20509     } /* gm_check */
20510
20511 int check_max ()
20512 {
20513     tmp = NULL;
20514     pt  = 0;
20515 #ifdef MAXLONG
20516     gm_check (MAXLONG, 69, 0x7fffffff);
20517 #endif
20518     if (tmp == NULL || tmp->tm_year < 0) {
20519         for (i = 63; i >= 0; i--) {
20520             time_t x = pt | ((time_t)1 << i);
20521             if (x < 0 || x < pt) continue;
20522             gm_check (x, 69, 0x7fffffff);
20523             }
20524         }
20525     printf ("sGMTIME_max=%ld\n", pt);
20526     return (0);
20527     } /* check_max */
20528
20529 int check_min ()
20530 {
20531     tmp = NULL;
20532     pt  = 0;
20533 #ifdef MINLONG
20534     gm_check (MINLONG, -1900, 70);
20535 #endif
20536     if (tmp == NULL) {
20537         for (i = 36; i >= 0; i--) {
20538             time_t x = pt - ((time_t)1 << i);
20539             if (x > 0) continue;
20540             gm_check (x, -1900, 70);
20541             }
20542         }
20543     printf ("sGMTIME_min=%ld\n", pt);
20544     return (0);
20545     } /* check_min */
20546
20547 int main (int argc, char *argv[])
20548 {
20549     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20550     check_max ();
20551     check_min ();
20552     return (0);
20553     } /* main */
20554 EOCP
20555         set try
20556         if eval $compile; then
20557             eval `$run ./try`
20558         else
20559             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20560             fi
20561         $rm_try
20562         ;;
20563     esac
20564
20565 echo "Checking max offsets that localtime () accepts"
20566
20567 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20568     0/0|/)
20569         $cat >try.c <<EOCP
20570 #include <sys/types.h>
20571 #include <stdio.h>
20572 #include <time.h>
20573 $yyy
20574
20575 int i;
20576 struct tm *tmp;
20577 time_t pt;
20578
20579 void local_check (time_t t, int min_year, int max_year)
20580 {
20581     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20582         tmp = NULL;
20583     else
20584         tmp = localtime (&t);
20585     if ( tmp == NULL ||
20586         /* Check tm_year overflow */
20587          tmp->tm_year < min_year || tmp->tm_year > max_year)
20588         tmp = NULL;
20589     else
20590         pt = t;
20591     } /* local_check */
20592
20593 int check_max ()
20594 {
20595     tmp = NULL;
20596     pt  = 0;
20597 #ifdef MAXLONG
20598     local_check (MAXLONG, 69, 0x7fffffff);
20599 #endif
20600     if (tmp == NULL || tmp->tm_year < 0) {
20601         for (i = 63; i >= 0; i--) {
20602             time_t x = pt | ((time_t)1 << i);
20603             if (x < 0 || x < pt) continue;
20604             local_check (x, 69, 0x7fffffff);
20605             }
20606         }
20607     printf ("sLOCALTIME_max=%ld\n", pt);
20608     return (0);
20609    } /* check_max */
20610
20611 int check_min ()
20612 {
20613     tmp = NULL;
20614     pt  = 0;
20615 #ifdef MINLONG
20616     local_check (MINLONG, -1900, 70);
20617 #endif
20618     if (tmp == NULL) {
20619         for (i = 36; i >= 0; i--) {
20620             time_t x = pt - ((time_t)1 << i);
20621             if (x > 0) continue;
20622             local_check (x, -1900, 70);
20623             }
20624         }
20625     printf ("sLOCALTIME_min=%ld\n", pt);
20626     return (0);
20627     } /* check_min */
20628
20629 int main (int argc, char *argv[])
20630 {
20631     check_max ();
20632     check_min ();
20633     return (0);
20634     } /* main */
20635 EOCP
20636         set try
20637         if eval $compile; then
20638             eval `$run ./try`
20639         else
20640             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20641             fi
20642         $rm_try
20643         ;;
20644     esac
20645
20646 : check for type of arguments to select.
20647 case "$selecttype" in
20648 '') case "$d_select" in
20649         $define)
20650                 echo " "
20651                 $cat <<EOM
20652 Checking to see what type of arguments are accepted by select().
20653 EOM
20654                 hdrs="$define sys/types.h
20655                         $i_systime sys/time.h
20656                         $i_sysselct sys/select.h
20657                         $d_socket sys/socket.h"
20658                 : The first arg can be int, unsigned, or size_t
20659                 : The last arg may or may not be 'const'
20660                 val=''
20661                 : void pointer has been seen but using that
20662                 : breaks the selectminbits test
20663                 for xxx in 'fd_set *' 'int *'; do
20664                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20665                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20666                                         case "$val" in
20667                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20668                                                 if ./protochk "$try" $hdrs; then
20669                                                         echo "Your system accepts $xxx."
20670                                                         val="$xxx"
20671                                                 fi
20672                                                 ;;
20673                                         esac
20674                                 done
20675                         done
20676                 done
20677                 case "$val" in
20678                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20679                         case "$d_fd_set" in
20680                                 $define) dflt="fd_set *" ;;
20681                                 *)              dflt="int *" ;;
20682                         esac
20683                         . ./myread
20684                         val=$ans
20685                         ;;
20686                 esac
20687                 selecttype="$val"
20688                 ;;
20689         *)      : no select, so pick a harmless default
20690                 selecttype='int *'
20691                 ;;
20692         esac
20693         ;;
20694 esac
20695
20696 : check for the select 'width'
20697 case "$selectminbits" in
20698 '') safebits=`expr $ptrsize \* 8`
20699     case "$d_select" in
20700         $define)
20701                 $cat <<EOM
20702
20703 Checking to see on how many bits at a time your select() operates...
20704 EOM
20705                 $cat >try.c <<EOCP
20706 #include <sys/types.h>
20707 #$i_time I_TIME
20708 #$i_systime I_SYS_TIME
20709 #$i_systimek I_SYS_TIME_KERNEL
20710 #ifdef I_TIME
20711 #   include <time.h>
20712 #endif
20713 #ifdef I_SYS_TIME
20714 #   ifdef I_SYS_TIME_KERNEL
20715 #       define KERNEL
20716 #   endif
20717 #   include <sys/time.h>
20718 #   ifdef I_SYS_TIME_KERNEL
20719 #       undef KERNEL
20720 #   endif
20721 #endif
20722 #$i_sysselct I_SYS_SELECT
20723 #ifdef I_SYS_SELECT
20724 #include <sys/select.h>
20725 #endif
20726 #$d_socket HAS_SOCKET
20727 #ifdef HAS_SOCKET
20728 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20729 #endif
20730 #include <stdio.h>
20731 #$i_stdlib I_STDLIB
20732 #ifdef I_STDLIB
20733 #include <stdlib.h>
20734 #endif
20735 $selecttype b;
20736 #define S sizeof(*(b))
20737 #define MINBITS 64
20738 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20739 #define NBITS  (NBYTES * 8)
20740 int main() {
20741     char *s = (char *)malloc(NBYTES);
20742     struct timeval t;
20743     int i;
20744     FILE* fp;
20745     int fd;
20746
20747     if (!s)
20748         exit(1);
20749     fclose(stdin);
20750     fp = fopen("try.c", "r");
20751     if (fp == 0)
20752       exit(2);
20753     fd = fileno(fp);
20754     if (fd < 0)
20755       exit(3);
20756     b = ($selecttype)s;
20757     for (i = 0; i < NBITS; i++)
20758         FD_SET(i, b);
20759     t.tv_sec  = 0;
20760     t.tv_usec = 0;
20761     select(fd + 1, b, 0, 0, &t);
20762     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20763     free(s);
20764     printf("%d\n", i + 1);
20765     return 0;
20766 }
20767 EOCP
20768                 set try
20769                 if eval $compile_ok; then
20770                         selectminbits=`$run ./try`
20771                         case "$selectminbits" in
20772                         '')     cat >&4 <<EOM
20773 Cannot figure out on how many bits at a time your select() operates.
20774 I'll play safe and guess it is $safebits bits.
20775 EOM
20776                                 selectminbits=$safebits
20777                                 bits="$safebits bits"
20778                                 ;;
20779                         1)      bits="1 bit" ;;
20780                         *)      bits="$selectminbits bits" ;;
20781                         esac
20782                         echo "Your select() operates on $bits at a time." >&4
20783                 else
20784                         rp='What is the minimum number of bits your select() operates on?'
20785                         case "$byteorder" in
20786                         12345678)       dflt=64 ;;
20787                         1234)           dflt=32 ;;
20788                         *)              dflt=1  ;;
20789                         esac
20790                         . ./myread
20791                         val=$ans
20792                         selectminbits="$val"
20793                 fi
20794                 $rm_try
20795                 ;;
20796         *)      : no select, so pick a harmless default
20797                 selectminbits=$safebits
20798                 ;;
20799         esac
20800         ;;
20801 esac
20802
20803 : Trace out the files included by signal.h, then look for SIGxxx names.
20804 if [ "X$fieldn" = X ]; then
20805         : Just make some guesses.  We check them later.
20806         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20807 else
20808         xxx=`echo '#include <signal.h>' |
20809         $cppstdin $cppminus $cppflags 2>/dev/null |
20810         $grep '^[       ]*#.*include' |
20811         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20812                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20813 fi
20814 xxxfiles=''
20815 for xx in $xxx /dev/null ; do
20816         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20817 done
20818 case "$xxxfiles" in
20819 '')     xxxfiles=`./findhdr signal.h` ;;
20820 esac
20821 xxx=`awk '
20822 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20823         print substr($2, 4, 20)
20824 }
20825 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20826         print substr($3, 4, 20)
20827 }' $xxxfiles`
20828 : Append some common names just in case the awk scan failed.
20829 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20830 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20831 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20832 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20833 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20834
20835 : generate a few handy files for later
20836 $cat > signal.c <<EOCP
20837 #include <sys/types.h>
20838 #include <signal.h>
20839 #$i_stdlib I_STDLIB
20840 #ifdef I_STDLIB
20841 #include <stdlib.h>
20842 #endif
20843 #include <stdio.h>
20844 int main() {
20845
20846 /* Strange style to avoid deeply-nested #if/#else/#endif */
20847 #ifndef NSIG
20848 #  ifdef _NSIG
20849 #    define NSIG (_NSIG)
20850 #  endif
20851 #endif
20852
20853 #ifndef NSIG
20854 #  ifdef SIGMAX
20855 #    define NSIG (SIGMAX+1)
20856 #  endif
20857 #endif
20858
20859 #ifndef NSIG
20860 #  ifdef SIG_MAX
20861 #    define NSIG (SIG_MAX+1)
20862 #  endif
20863 #endif
20864
20865 #ifndef NSIG
20866 #  ifdef _SIG_MAX
20867 #    define NSIG (_SIG_MAX+1)
20868 #  endif
20869 #endif
20870
20871 #ifndef NSIG
20872 #  ifdef MAXSIG
20873 #    define NSIG (MAXSIG+1)
20874 #  endif
20875 #endif
20876
20877 #ifndef NSIG
20878 #  ifdef MAX_SIG
20879 #    define NSIG (MAX_SIG+1)
20880 #  endif
20881 #endif
20882
20883 #ifndef NSIG
20884 #  ifdef SIGARRAYSIZE
20885 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20886 #  endif
20887 #endif
20888
20889 #ifndef NSIG
20890 #  ifdef _sys_nsig
20891 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20892 #  endif
20893 #endif
20894
20895 /* Default to some arbitrary number that's big enough to get most
20896    of the common signals.
20897 */
20898 #ifndef NSIG
20899 #    define NSIG 50
20900 #endif
20901
20902 printf("NSIG %d\n", NSIG);
20903
20904 #ifndef JUST_NSIG
20905
20906 EOCP
20907
20908 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20909 {
20910         printf "#ifdef SIG"; printf $1; printf "\n"
20911         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20912         printf $1; printf ");\n"
20913         printf "#endif\n"
20914 }
20915 END {
20916         printf "#endif /* JUST_NSIG */\n";
20917         printf "exit(0);\n}\n";
20918 }
20919 ' >>signal.c
20920 $cat >signal.awk <<'EOP'
20921 BEGIN { ndups = 0 }
20922 $1 ~ /^NSIG$/ { nsig = $2 }
20923 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20924     if ($2 > maxsig) { maxsig = $2 }
20925     if (sig_name[$2]) {
20926         dup_name[ndups] = $1
20927         dup_num[ndups] = $2
20928         ndups++
20929     }
20930     else {
20931         sig_name[$2] = $1
20932         sig_num[$2] = $2
20933     }
20934 }
20935 END {
20936     if (nsig == 0) {
20937         nsig = maxsig + 1
20938     }
20939     printf("NSIG %d\n", nsig);
20940     for (n = 1; n < nsig; n++) {
20941         if (sig_name[n]) {
20942             printf("%s %d\n", sig_name[n], sig_num[n])
20943         }
20944         else {
20945             printf("NUM%d %d\n", n, n)
20946         }
20947     }
20948     for (n = 0; n < ndups; n++) {
20949         printf("%s %d\n", dup_name[n], dup_num[n])
20950     }
20951 }
20952 EOP
20953 $cat >signal_cmd <<EOS
20954 $startsh
20955 if $test -s signal.lst; then
20956     echo "Using your existing signal.lst file"
20957         exit 0
20958 fi
20959 xxx="$xxx"
20960 EOS
20961 $cat >>signal_cmd <<'EOS'
20962
20963 set signal
20964 if eval $compile_ok; then
20965         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20966                 $uniq | $awk -f signal.awk >signal.lst
20967 else
20968         echo "(I can't seem be able to compile the whole test program)" >&4
20969         echo "(I'll try it in little pieces.)" >&4
20970         set signal -DJUST_NSIG
20971         if eval $compile_ok; then
20972                 $run ./signal$_exe > signal.nsg
20973                 $cat signal.nsg
20974         else
20975                 echo "I can't seem to figure out how many signals you have." >&4
20976                 echo "Guessing 50." >&4
20977                 echo 'NSIG 50' > signal.nsg
20978         fi
20979         : Now look at all the signal names, one at a time.
20980         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20981                 $cat > signal.c <<EOCP
20982 #include <sys/types.h>
20983 #include <signal.h>
20984 #include <stdio.h>
20985 int main() {
20986 printf("$xx %d\n", SIG${xx});
20987 return 0;
20988 }
20989 EOCP
20990                 set signal
20991                 if eval $compile; then
20992                         echo "SIG${xx} found."
20993                         $run ./signal$_exe  >> signal.ls1
20994                 else
20995                         echo "SIG${xx} NOT found."
20996                 fi
20997         done
20998         if $test -s signal.ls1; then
20999                 $cat signal.nsg signal.ls1 |
21000                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21001         fi
21002
21003 fi
21004 if $test -s signal.lst; then
21005         :
21006 else
21007         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21008         echo 'kill -l' >signal
21009         set X `csh -f <signal`
21010         $rm -f signal
21011         shift
21012         case $# in
21013         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21014         esac
21015         echo $@ | $tr ' ' $trnl | \
21016             $awk '{ printf "%s %d\n", $1, ++s; }
21017                   END { printf "NSIG %d\n", ++s }' >signal.lst
21018 fi
21019 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21020 EOS
21021 chmod a+x signal_cmd
21022 $eunicefix signal_cmd
21023
21024 : generate list of signal names
21025 echo " "
21026 case "$sig_name_init" in
21027 '') doinit=yes ;;
21028 *)  case "$sig_num_init" in
21029     ''|*,*) doinit=yes ;;
21030     esac ;;
21031 esac
21032 case "$doinit" in
21033 yes)
21034         echo "Generating a list of signal names and numbers..." >&4
21035         . ./signal_cmd
21036         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21037         sig_name=`$awk 'BEGIN { printf "ZERO " }
21038                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21039         sig_num=`$awk  'BEGIN { printf "0 " }
21040                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21041         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21042                              !/^NSIG/   { printf "\"%s\", ", $1 }
21043                              END        { printf "0\n" }' signal.lst`
21044         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21045                              !/^NSIG/   { printf "%d, ", $2}
21046                              END        { printf "0\n"}' signal.lst`
21047         ;;
21048 esac
21049 echo "The following $sig_count signals are available:"
21050 echo " "
21051 echo $sig_name | $awk \
21052 'BEGIN { linelen = 0 }
21053 {
21054         for (i = 1; i <= NF; i++) {
21055                 name = "SIG" $i " "
21056                 linelen = linelen + length(name)
21057                 if (linelen > 70) {
21058                         printf "\n"
21059                         linelen = length(name)
21060                 }
21061                 printf "%s", name
21062         }
21063         printf "\n"
21064 }'
21065 sig_size=`echo $sig_name | awk '{print NF}'`
21066 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21067
21068 : Check size of size
21069 echo " "
21070 case "$sizetype" in
21071 *_t) zzz="$sizetype"    ;;
21072 *)   zzz="filesize"     ;;
21073 esac
21074 echo "Checking the size of $zzz..." >&4
21075 cat > try.c <<EOCP
21076 #include <sys/types.h>
21077 #include <stdio.h>
21078 #$i_stdlib I_STDLIB
21079 #ifdef I_STDLIB
21080 #include <stdlib.h>
21081 #endif
21082 int main() {
21083     printf("%d\n", (int)sizeof($sizetype));
21084     exit(0);
21085 }
21086 EOCP
21087 set try
21088 if eval $compile_ok; then
21089         yyy=`$run ./try`
21090         case "$yyy" in
21091         '')     sizesize=4
21092                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21093                 ;;
21094         *)      sizesize=$yyy
21095                 echo "Your $zzz size is $sizesize bytes."
21096                 ;;
21097         esac
21098 else
21099         sizesize=4
21100         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21101 fi
21102
21103
21104 : check for socklen_t
21105 echo " "
21106 echo "Checking to see if you have socklen_t..." >&4
21107 $cat >try.c <<EOCP
21108 #include <sys/types.h>
21109 #$d_socket HAS_SOCKET
21110 #ifdef HAS_SOCKET
21111 #include <sys/socket.h>
21112 #endif
21113 int main() { socklen_t x = 16; }
21114 EOCP
21115 set try
21116 if eval $compile; then
21117         val="$define"
21118         echo "You have socklen_t."
21119 else
21120         val="$undef"
21121         echo "You do not have socklen_t."
21122         case "$sizetype" in
21123         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21124         esac
21125 fi
21126 $rm_try
21127 set d_socklen_t
21128 eval $setvar
21129
21130 : see if this is a socks.h system
21131 set socks.h i_socks
21132 eval $inhdr
21133
21134 : check for type of the size argument to socket calls
21135 case "$d_socket" in
21136 "$define")
21137         $cat <<EOM
21138
21139 Checking to see what type is the last argument of accept().
21140 EOM
21141         yyy=''
21142         case "$d_socklen_t" in
21143         "$define") yyy="$yyy socklen_t"
21144         esac
21145         yyy="$yyy $sizetype int long unsigned"
21146         for xxx in $yyy; do
21147                 case "$socksizetype" in
21148                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21149                         case "$usesocks" in
21150                         "$define")
21151                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21152                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21153                                         socksizetype="$xxx"
21154                                 fi
21155                                 ;;
21156                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21157                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21158                                         socksizetype="$xxx"
21159                                 fi
21160                                 ;;
21161                         esac
21162                         ;;
21163                 esac
21164         done
21165 : In case none of those worked, prompt the user.
21166         case "$socksizetype" in
21167         '')     rp='What is the type for socket address structure sizes?'
21168                 dflt='int'
21169                 . ./myread
21170                 socksizetype=$ans
21171                 ;;
21172         esac
21173         ;;
21174 *)      : no sockets, so pick relatively harmless default
21175         socksizetype='int'
21176         ;;
21177 esac
21178
21179 : see what type is used for signed size_t
21180 set ssize_t ssizetype int stdio.h sys/types.h
21181 eval $typedef
21182 dflt="$ssizetype"
21183 $cat > try.c <<EOM
21184 #include <stdio.h>
21185 #$i_stdlib I_STDLIB
21186 #ifdef I_STDLIB
21187 #include <stdlib.h>
21188 #endif
21189 #include <sys/types.h>
21190 #define Size_t $sizetype
21191 #define SSize_t $dflt
21192 int main()
21193 {
21194         if (sizeof(Size_t) == sizeof(SSize_t))
21195                 printf("$dflt\n");
21196         else if (sizeof(Size_t) == sizeof(int))
21197                 printf("int\n");
21198         else
21199                 printf("long\n");
21200         exit(0);
21201 }
21202 EOM
21203 echo " "
21204 set try
21205 if eval $compile_ok && $run ./try > /dev/null; then
21206         ssizetype=`$run ./try`
21207         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21208 else
21209         $cat >&4 <<EOM
21210 Help! I can't compile and run the ssize_t test program: please enlighten me!
21211 (This is probably a misconfiguration in your system or libraries, and
21212 you really ought to fix it.  Still, I'll try anyway.)
21213
21214 I need a type that is the same size as $sizetype, but is guaranteed to
21215 be signed.  Common values are ssize_t, int and long.
21216
21217 EOM
21218         rp="What signed type is the same size as $sizetype?"
21219         . ./myread
21220         ssizetype="$ans"
21221 fi
21222 $rm_try
21223
21224 : Check the size of st_ino
21225 $echo " "
21226 $echo "Checking the size of st_ino..." >&4
21227 $cat > try.c <<EOCP
21228 #include <sys/stat.h>
21229 #include <stdio.h>
21230 #$i_stdlib I_STDLIB
21231 #ifdef I_STDLIB
21232 #include <stdlib.h>
21233 #endif
21234 int main() {
21235     struct stat st;
21236     printf("%d\n", (int)sizeof(st.st_ino));
21237     exit(0);
21238 }
21239 EOCP
21240 set try
21241 if eval $compile_ok; then
21242         val=`$run ./try`
21243         case "$val" in
21244         '')     st_ino_size=4
21245                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21246                 ;;
21247         *)      st_ino_size=$val
21248                 $echo "Your st_ino is $st_ino_size bytes long."
21249                 ;;
21250         esac
21251 else
21252         st_ino_size=4
21253         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21254 fi
21255 $rm_try
21256
21257 : Check if st_ino is signed
21258 $echo " "
21259 $echo "Checking the sign of st_ino..." >&4
21260 $cat > try.c <<EOCP
21261 #include <sys/stat.h>
21262 #include <stdio.h>
21263 int main() {
21264         struct stat foo;
21265         foo.st_ino = -1;
21266         if (foo.st_ino < 0)
21267                 printf("-1\n");
21268         else
21269                 printf("1\n");
21270 }
21271 EOCP
21272 set try
21273 if eval $compile; then
21274         val=`$run ./try`
21275         case "$val" in
21276         '')     st_ino_sign=1
21277                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21278                 ;;
21279         *)      st_ino_sign=$val
21280                 case "$st_ino_sign" in
21281                  1) $echo "Your st_ino is unsigned." ;;
21282                 -1) $echo "Your st_ino is signed."   ;;
21283                 esac
21284                 ;;
21285         esac
21286 else
21287         st_ino_sign=1
21288         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21289 fi
21290 $rm_try
21291
21292 : see what type of char stdio uses.
21293 echo " "
21294 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21295 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21296         echo "Your stdio uses unsigned chars." >&4
21297         stdchar="unsigned char"
21298 else
21299         echo "Your stdio uses signed chars." >&4
21300         stdchar="char"
21301 fi
21302 $rm -f stdioh
21303
21304 : see what type uids are declared as in the kernel
21305 echo " "
21306 echo "Looking for the type for user ids returned by getuid()."
21307 set uid_t uidtype xxx stdio.h sys/types.h
21308 eval $typedef
21309 case "$uidtype" in
21310 xxx)
21311         xxx=`./findhdr sys/user.h`
21312         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21313         case $1 in
21314         unsigned) dflt="$1 $2" ;;
21315         *) dflt="$1" ;;
21316         esac
21317         ;;
21318 *) dflt="$uidtype";;
21319 esac
21320 case "$uidtype" in
21321 uid_t)  echo "uid_t found." ;;
21322 *)      rp="What is the type for user ids returned by getuid()?"
21323         . ./myread
21324         uidtype="$ans"
21325         ;;
21326 esac
21327
21328 : Check size of UID
21329 echo " "
21330 case "$uidtype" in
21331 *_t) zzz="$uidtype"     ;;
21332 *)   zzz="uid"          ;;
21333 esac
21334 echo "Checking the size of $zzz..." >&4
21335 cat > try.c <<EOCP
21336 #include <sys/types.h>
21337 #include <stdio.h>
21338 #$i_stdlib I_STDLIB
21339 #ifdef I_STDLIB
21340 #include <stdlib.h>
21341 #endif
21342 int main() {
21343     printf("%d\n", (int)sizeof($uidtype));
21344     exit(0);
21345 }
21346 EOCP
21347 set try
21348 if eval $compile_ok; then
21349         yyy=`$run ./try`
21350         case "$yyy" in
21351         '')     uidsize=4
21352                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21353                 ;;
21354         *)      uidsize=$yyy
21355                 echo "Your $zzz is $uidsize bytes long."
21356                 ;;
21357         esac
21358 else
21359         uidsize=4
21360         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21361 fi
21362
21363 : Check if UID is signed
21364 echo " "
21365 case "$uidtype" in
21366 *_t) zzz="$uidtype"     ;;
21367 *)   zzz="uid"          ;;
21368 esac
21369 echo "Checking the sign of $zzz..." >&4
21370 cat > try.c <<EOCP
21371 #include <sys/types.h>
21372 #include <stdio.h>
21373 int main() {
21374         $uidtype foo = -1;
21375         if (foo < 0)
21376                 printf("-1\n");
21377         else
21378                 printf("1\n");
21379 }
21380 EOCP
21381 set try
21382 if eval $compile; then
21383         yyy=`$run ./try`
21384         case "$yyy" in
21385         '')     uidsign=1
21386                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21387                 ;;
21388         *)      uidsign=$yyy
21389                 case "$uidsign" in
21390                  1) echo "Your $zzz is unsigned." ;;
21391                 -1) echo "Your $zzz is signed."   ;;
21392                 esac
21393                 ;;
21394         esac
21395 else
21396         uidsign=1
21397         echo "(I can't compile the test program--guessing unsigned.)" >&4
21398 fi
21399
21400
21401 : Check format string for UID
21402 echo " "
21403 $echo "Checking the format string to be used for uids..." >&4
21404
21405 case "$uidsign" in
21406 -1)     if $test X"$uidsize" = X"$ivsize"; then
21407                 uidformat="$ivdformat"
21408         else
21409                 if $test X"$uidsize" = X"$longsize"; then
21410                         uidformat='"ld"'
21411                 else
21412                         if $test X"$uidsize" = X"$intsize"; then
21413                                 uidformat='"d"'
21414                         else
21415                                 if $test X"$uidsize" = X"$shortsize"; then
21416                                         uidformat='"hd"'
21417                                 fi
21418                         fi
21419                 fi
21420         fi
21421         ;;
21422 *)      if $test X"$uidsize" = X"$uvsize"; then
21423                 uidformat="$uvuformat"
21424         else
21425                 if $test X"$uidsize" = X"$longsize"; then
21426                         uidformat='"lu"'
21427                 else
21428                         if $test X"$uidsize" = X"$intsize"; then
21429                                 uidformat='"u"'
21430                         else
21431                                 if $test X"$uidsize" = X"$shortsize"; then
21432                                         uidformat='"hu"'
21433                                 fi
21434                         fi
21435                 fi
21436         fi
21437         ;;
21438 esac
21439
21440 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21441 echo " "
21442 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21443 $cat >try.c <<'EOM'
21444 /* Intentionally a long probe as I'd like to sanity check that the exact
21445    approach is going to work, as thinking it will work, but only having it
21446    part working at runtime is worse than not having it.  */
21447
21448 #include <sys/types.h>
21449 #include <sys/sysctl.h>
21450 #include <sys/param.h>
21451 #include <stdio.h>
21452 #include <string.h>
21453 #include <stdlib.h>
21454 #include <unistd.h>
21455
21456 int
21457 main(int argc, char **argv) {
21458     char *buffer;
21459     char *argv_leaf = strrchr(argv[0], '/');
21460     char *buffer_leaf;
21461     size_t size = 0;
21462     int mib[4];
21463
21464     mib[0] = CTL_KERN;
21465     mib[1] = KERN_PROC;
21466     mib[2] = KERN_PROC_PATHNAME;
21467     mib[3] = -1;
21468
21469     if (!argv_leaf) {
21470         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21471         return 1;
21472     }
21473
21474     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21475         perror("sysctl");
21476         return 2;
21477     }
21478
21479     if (size < strlen(argv_leaf) + 1) {
21480         fprintf(stderr, "size %lu is too short for a path\n",
21481                 (unsigned long) size);
21482         return 3;
21483     }
21484
21485     if (size > MAXPATHLEN * MAXPATHLEN) {
21486         fprintf(stderr, "size %lu is too long for a path\n",
21487                 (unsigned long) size);
21488         return 4;
21489     }
21490
21491     buffer = malloc(size);
21492     if (!buffer) {
21493         perror("malloc");
21494         return 5;
21495     }
21496
21497     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21498         perror("sysctl");
21499         return 6;
21500     }
21501
21502     if (strlen(buffer) + 1 != size) {
21503         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21504                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21505         return 7;
21506     }
21507
21508
21509     if (*buffer != '/') {
21510         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21511         return 8;
21512     }
21513
21514     if (strstr(buffer, "/./")) {
21515         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21516         return 9;
21517     }
21518
21519     if (strstr(buffer, "/../")) {
21520         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21521         return 10;
21522     }
21523
21524     buffer_leaf = strrchr(buffer, '/');
21525     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21526         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21527         return 11;
21528     }
21529
21530     free(buffer);
21531
21532     return 0;
21533 }
21534 EOM
21535
21536 val=$undef
21537 set try
21538 if eval $compile; then
21539         if $run ./try; then
21540                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21541                 val="$define"
21542         else
21543                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21544                 val="$undef"
21545         fi
21546 else
21547         echo "I'm unable to compile the test program." >&4
21548         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21549         val="$undef"
21550 fi
21551 $rm_try
21552 set usekernprocpathname
21553 eval $setvar
21554
21555 : Determine if we can use _NSGetExecutablePath to find executing program
21556 echo " "
21557 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21558 $cat >try.c <<'EOM'
21559 /* Intentionally a long probe as I'd like to sanity check that the exact
21560    approach is going to work, as thinking it will work, but only having it
21561    part working at runtime is worse than not having it.  */
21562 #include <mach-o/dyld.h>
21563 #include <stdio.h>
21564 #include <stdlib.h>
21565 #include <sys/param.h>
21566 #include <string.h>
21567
21568 int
21569 main(int argc, char **argv) {
21570     char buf[1];
21571     uint32_t size = sizeof(buf);
21572     int result;
21573     char *buffer;
21574     char *tidied;
21575     char *argv_leaf = strrchr(argv[0], '/');
21576     char *tidied_leaf;
21577
21578     if (!argv_leaf) {
21579         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21580         return 1;
21581     }
21582
21583     _NSGetExecutablePath(buf, &size);
21584     if (size > MAXPATHLEN * MAXPATHLEN) {
21585         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21586                 (unsigned int) size);
21587         return 2;
21588     }
21589
21590     buffer = malloc(size);
21591     if (!buffer) {
21592         perror("malloc");
21593         return 3;
21594     }
21595
21596     result = _NSGetExecutablePath(buffer, &size);
21597     if (result != 0) {
21598         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21599                 result, (unsigned int) size);
21600         return 4;
21601     }
21602
21603     tidied = realpath(buffer, NULL);
21604     if (!tidied) {
21605         perror("realpath");
21606         return 5;
21607     }
21608
21609     free(buffer);
21610
21611     if (*tidied != '/') {
21612         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21613         return 6;
21614     }
21615
21616     if (strstr(tidied, "/./")) {
21617         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21618         return 7;
21619     }
21620
21621     if (strstr(tidied, "/../")) {
21622         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21623         return 8;
21624     }
21625
21626     tidied_leaf = strrchr(tidied, '/');
21627     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21628         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21629         return 9;
21630     }
21631
21632     free(tidied);
21633
21634     return 0;
21635 }
21636 EOM
21637
21638 val=$undef
21639 set try
21640 if eval $compile; then
21641         if $run ./try; then
21642                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21643                 val="$define"
21644         else
21645                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21646         fi
21647 else
21648         echo "I'm unable to compile the test program." >&4
21649         echo "I'll assume no _NSGetExecutablePath here." >&4
21650 fi
21651 $rm_try
21652 set usensgetexecutablepath
21653 eval $setvar
21654
21655 : Check if site customization support was requested
21656 case "$usesitecustomize" in
21657     $define|true|[Yy]*)
21658         usesitecustomize="$define"
21659         ;;
21660     *)
21661         usesitecustomize="$undef"
21662         ;;
21663     esac
21664
21665 : see if prototypes support variable argument declarations
21666 echo " "
21667 case "$prototype$i_stdarg" in
21668 $define$define)
21669         echo "It appears we'll be able to prototype varargs functions." >&4
21670         val="$define"
21671         ;;
21672 *)
21673         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21674         val="$undef"
21675         ;;
21676 esac
21677 set vaproto
21678 eval $setvar
21679
21680 : determine compiler compiler
21681 case "$yacc" in
21682 '')
21683         dflt=yacc;;
21684 *)
21685         dflt="$yacc";;
21686 esac
21687 echo " "
21688 comp='yacc'
21689 if $test -f "$byacc$_exe"; then
21690         dflt="$byacc"
21691         comp="byacc or $comp"
21692 fi
21693 if $test -f "$bison$_exe"; then
21694         comp="$comp or bison -y"
21695 fi
21696 rp="Which compiler compiler ($comp) shall I use?"
21697 . ./myread
21698 yacc="$ans"
21699 case "$yacc" in
21700 *bis*)
21701         case "$yacc" in
21702         *-y*) ;;
21703         *)
21704                 yacc="$yacc -y"
21705                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21706                 ;;
21707         esac
21708         ;;
21709 esac
21710
21711 : see if this is a assert.h system
21712 set assert.h i_assert
21713 eval $inhdr
21714
21715 : see if this is a fp.h system
21716 set fp.h i_fp
21717 eval $inhdr
21718
21719 : see if this is a fp_class.h system
21720 set fp_class.h i_fp_class
21721 eval $inhdr
21722
21723 : see if gdbm.h is available
21724 set gdbm.h t_gdbm
21725 eval $inhdr
21726 case "$t_gdbm" in
21727 $define)
21728         : see if gdbm_open exists
21729         set gdbm_open d_gdbm_open
21730         eval $inlibc
21731         case "$d_gdbm_open" in
21732         $undef)
21733                 t_gdbm="$undef"
21734                 echo "We won't be including <gdbm.h>"
21735                 ;;
21736         esac
21737         ;;
21738 esac
21739 val="$t_gdbm"
21740 set i_gdbm
21741 eval $setvar
21742
21743 : see if this is a ieeefp.h system
21744 case "$i_ieeefp" in
21745 '' ) set ieeefp.h i_ieeefp
21746      eval $inhdr
21747      ;;
21748 esac
21749
21750 : see if this is a libutil.h system
21751 set libutil.h i_libutil
21752 eval $inhdr
21753
21754 : see if mach cthreads are available
21755 if test "X$usethreads" = "X$define"; then
21756         set mach/cthreads.h i_machcthr
21757         eval $inhdr
21758 else
21759         i_machcthr="$undef"
21760 fi
21761
21762 : see if this is a mntent.h system
21763 set mntent.h i_mntent
21764 eval $inhdr
21765
21766 : see if net/errno.h is available
21767 val=''
21768 set net/errno.h val
21769 eval $inhdr
21770
21771 : Unfortunately, it causes problems on some systems.  Arrgh.
21772 case "$val" in
21773 $define)
21774         cat > try.c <<'EOM'
21775 #include <stdio.h>
21776 #include <errno.h>
21777 #include <net/errno.h>
21778 int func()
21779 {
21780         return ENOTSOCK;
21781 }
21782 EOM
21783         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21784                 echo "We'll be including <net/errno.h>." >&4
21785         else
21786                 echo "We won't be including <net/errno.h>." >&4
21787                 val="$undef"
21788         fi
21789         $rm_try
21790         ;;
21791 esac
21792 set i_neterrno
21793 eval $setvar
21794
21795 : see if netinet/tcp.h is available
21796 set netinet/tcp.h i_netinettcp
21797 eval $inhdr
21798
21799 : see if this is a poll.h system
21800 set poll.h i_poll
21801 eval $inhdr
21802
21803 : see if this is a prot.h system
21804 set prot.h i_prot
21805 eval $inhdr
21806
21807 : Preprocessor symbols
21808 echo " "
21809 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21810 $cat <<'EOSH' > Cppsym.know
21811 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21812 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21813 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21814 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21815 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21816 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21817 bull c cadmus clipper CMU COFF COMPILER_VERSION
21818 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21819 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21820 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21821 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21822 GLIBC GLIBC_MINOR
21823 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21824 H3050R H3050RX hbullx20 hcx host_mips
21825 hp200 hp300 hp700 HP700 hp800 hp9000
21826 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21827 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21828 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21829 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21830 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21831 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21832 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21833 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21834 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21835 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21836 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21837 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21838 MATH_HAS_NO_SIDE_EFFECTS
21839 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21840 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21841 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21842 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21843 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21844 NetBSD news1500 news1700 news1800 news1900 news3700
21845 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21846 ns32016 ns32332 ns32k nsc32000
21847 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21848 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21849 pc532 pdp11 PGC PIC plexus PORTAR posix
21850 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21851 POSIX_C_SOURCE POSIX_SOURCE POWER
21852 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21853 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21854 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21855 sony sony_news sonyrisc sparc sparclite spectrum
21856 stardent stdc STDC_EXT stratos sun sun3 sun386
21857 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21858 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21859 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21860 sysV68 sysV88 Tek4132 Tek4300 titan
21861 TM3200 TM5400 TM5600
21862 tower tower32 tower32_200 tower32_600 tower32_700
21863 tower32_800 tower32_850 tss
21864 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21865 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21866 unix UNIX95 UNIX99 unixpc unos
21867 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21868 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21869 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21870 USGr4 USGr4_2
21871 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21872 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21873 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21874 z8000
21875 EOSH
21876 # Maybe put other stuff here too.
21877 cat <<EOSH >>Cppsym.know
21878 $osname
21879 EOSH
21880 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21881 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21882 $cat Cppsym.know > Cppsym.c
21883 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21884 $rm -f Cppsym.a Cppsym.b Cppsym.c
21885 cat <<EOSH > Cppsym
21886 $startsh
21887 if $test \$# -gt 0; then
21888     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21889     if $test -s Cppsym.got; then
21890         $rm -f Cppsym.got
21891         exit 0
21892     fi
21893     $rm -f Cppsym.got
21894     exit 1
21895 else
21896     $tr " " "$trnl" | ./Cppsym.try
21897     exit 0
21898 fi
21899 EOSH
21900 chmod +x Cppsym
21901 $eunicefix Cppsym
21902 cat <<EOSH > Cppsym.try
21903 $startsh
21904 cat <<'EOCP' > try.c
21905 #include <stdio.h>
21906 #if cpp_stuff == 1
21907 #define STRINGIFY(a)    "a"
21908 #endif
21909 #if cpp_stuff == 42
21910 #define StGiFy(a)  #a
21911 #define STRINGIFY(a)    StGiFy(a)
21912 #endif
21913 #if $cpp_stuff != 1 && $cpp_stuff != 42
21914 #   include "Bletch: How does this C preprocessor stringify macros?"
21915 #endif
21916 int main() {
21917 EOCP
21918 $awk \\
21919 EOSH
21920 cat <<'EOSH' >> Cppsym.try
21921 'length($1) > 0 {
21922     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21923     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21924     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21925     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21926 }'       >> try.c
21927 echo 'return 0;}' >> try.c
21928 EOSH
21929 cat <<EOSH >> Cppsym.try
21930 ccflags="$ccflags"
21931 case "$osname-$gccversion" in
21932 irix-) ccflags="\$ccflags -woff 1178" ;;
21933 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21934 esac
21935 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21936 EOSH
21937 chmod +x Cppsym.try
21938 $eunicefix Cppsym.try
21939 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
21940 : Add in any linux cpp "predefined macros":
21941 case "$osname::$gccversion" in
21942   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21943     tHdrH=_tmpHdr
21944     rm -f $tHdrH'.h' $tHdrH
21945     touch $tHdrH'.h'
21946     # Filter out macro arguments, such as Linux's __INT8_C(c)
21947     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21948        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21949        if [ -s $tHdrH'_cppsym.real' ]; then
21950           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21951        fi
21952     fi
21953     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21954   ;;
21955 esac
21956 : now check the C compiler for additional symbols
21957 postprocess_cc_v=''
21958 case "$osname" in
21959 aix) postprocess_cc_v="|$tr , ' '" ;;
21960 esac
21961 $cat >ccsym <<EOS
21962 $startsh
21963 $cat >tmp.c <<EOF
21964 extern int foo;
21965 EOF
21966 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21967 do
21968         case "\$i" in
21969         -D*) echo "\$i" | $sed 's/^-D//';;
21970         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21971         esac
21972 done
21973 $rm_try
21974 EOS
21975 postprocess_cc_v=''
21976 chmod +x ccsym
21977 $eunicefix ccsym
21978 ./ccsym > ccsym1.raw
21979 if $test -s ccsym1.raw; then
21980        $sort ccsym1.raw | $uniq >ccsym.raw
21981 else
21982        mv ccsym1.raw ccsym.raw
21983 fi
21984
21985 $awk '/\=/ { print $0; next }
21986         { print $0"=1" }' ccsym.raw >ccsym.list
21987 $comm -13 Cppsym.true ccsym.list >ccsym.own
21988 $comm -12 Cppsym.true ccsym.list >ccsym.com
21989 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21990 also=''
21991 if $test -z ccsym.raw; then
21992         echo "Your C compiler doesn't seem to define any symbols!" >&4
21993         echo " "
21994         echo "However, your C preprocessor defines the following symbols:"
21995         $cat Cppsym.true
21996         ccsymbols=''
21997         cppsymbols=`$cat Cppsym.true`
21998         cppsymbols=`echo $cppsymbols`
21999         cppccsymbols="$cppsymbols"
22000 else
22001         if $test -s ccsym.com; then
22002                 echo "Your C compiler and pre-processor define these symbols:"
22003                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22004                 also='also '
22005                 symbols='ones'
22006                 cppccsymbols=`$cat ccsym.com`
22007                 cppccsymbols=`echo $cppccsymbols`
22008                 $test "$silent" || sleep 1
22009         fi
22010         if $test -s ccsym.cpp; then
22011                 $test "$also" && echo " "
22012                 echo "Your C pre-processor ${also}defines the following symbols:"
22013                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22014                 also='further '
22015                 cppsymbols=`$cat ccsym.cpp`
22016                 cppsymbols=`echo $cppsymbols`
22017                 $test "$silent" || sleep 1
22018         fi
22019         if $test -s ccsym.own; then
22020                 $test "$also" && echo " "
22021                 echo "Your C compiler ${also}defines the following cpp symbols:"
22022                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22023                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22024                 ccsymbols=`$cat ccsym.own`
22025                 ccsymbols=`echo $ccsymbols`
22026                 $test "$silent" || sleep 1
22027         fi
22028 fi
22029
22030 : see if this is a termio system
22031 val="$undef"
22032 val2="$undef"
22033 val3="$undef"
22034 if $test `./findhdr termios.h`; then
22035         set tcsetattr i_termios
22036         eval $inlibc
22037         val3="$i_termios"
22038 fi
22039 echo " "
22040 case "$val3" in
22041 "$define") echo "You have POSIX termios.h... good!" >&4;;
22042 *) if ./Cppsym pyr; then
22043                 case "`/bin/universe`" in
22044                 ucb) if $test `./findhdr sgtty.h`; then
22045                                 val2="$define"
22046                                 echo "<sgtty.h> found." >&4
22047                         else
22048                                 echo "System is pyramid with BSD universe."
22049                                 ./warn "<sgtty.h> not found--you could have problems."
22050                         fi;;
22051                 *) if $test `./findhdr termio.h`; then
22052                                 val="$define"
22053                                 echo "<termio.h> found." >&4
22054                         else
22055                                 echo "System is pyramid with USG universe."
22056                                 ./warn "<termio.h> not found--you could have problems."
22057                         fi;;
22058                 esac
22059         elif ./usg; then
22060                 if $test `./findhdr termio.h`; then
22061                         echo "<termio.h> found." >&4
22062                         val="$define"
22063                 elif $test `./findhdr sgtty.h`; then
22064                         echo "<sgtty.h> found." >&4
22065                         val2="$define"
22066                 else
22067                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22068                 fi
22069         else
22070                 if $test `./findhdr sgtty.h`; then
22071                         echo "<sgtty.h> found." >&4
22072                         val2="$define"
22073                 elif $test `./findhdr termio.h`; then
22074                         echo "<termio.h> found." >&4
22075                         val="$define"
22076                 else
22077                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22078                 fi
22079         fi;;
22080 esac
22081 set i_termio; eval $setvar
22082 val=$val2; set i_sgtty; eval $setvar
22083 val=$val3; set i_termios; eval $setvar
22084
22085 : see if stdbool is available
22086 : we want a real compile instead of Inhdr because some Solaris systems
22087 : have stdbool.h, but it can only be used if the compiler indicates it
22088 : is sufficiently c99-compliant.
22089 echo " "
22090 $cat >try.c <<EOCP
22091 #include <stdio.h>
22092 #include <stdbool.h>
22093 int func(bool x)
22094 {
22095     return x ? 1 : 0;
22096 }
22097 int main(int argc, char **argv)
22098 {
22099     return func(0);
22100 }
22101 EOCP
22102 set try
22103 if eval $compile; then
22104         echo "<stdbool.h> found." >&4
22105         val="$define"
22106 else
22107         echo "<stdbool.h> NOT found." >&4
22108         val="$undef"
22109 fi
22110 $rm_try
22111 set i_stdbool
22112 eval $setvar
22113
22114 : see if stddef is available
22115 set stddef.h i_stddef
22116 eval $inhdr
22117
22118 : see if sys/access.h is available
22119 set sys/access.h i_sysaccess
22120 eval $inhdr
22121
22122 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22123 set sys/filio.h i_sysfilio
22124 eval $inhdr
22125 echo " "
22126 if $test `./findhdr sys/ioctl.h`; then
22127         val="$define"
22128         echo '<sys/ioctl.h> found.' >&4
22129 else
22130         val="$undef"
22131         if $test $i_sysfilio = "$define"; then
22132             echo '<sys/ioctl.h> NOT found.' >&4
22133         else
22134                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22135                 $test $i_termio = "$define" && xxx="termio.h"
22136                 $test $i_termios = "$define" && xxx="termios.h"
22137 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22138         fi
22139 fi
22140 set i_sysioctl
22141 eval $setvar
22142
22143 : see if socket ioctl defs are in sys/sockio.h
22144 echo " "
22145 xxx=`./findhdr sys/sockio.h`
22146 if $test "$xxx"; then
22147         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22148                 val="$define"
22149                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22150         else
22151                 val="$undef"
22152                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22153         fi
22154 else
22155         val="$undef"
22156         $cat <<EOM
22157 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22158 EOM
22159 fi
22160 set i_syssockio
22161 eval $setvar
22162
22163 : see if this is a syslog.h system
22164 set syslog.h i_syslog
22165 eval $inhdr
22166
22167 : see if this is a sys/mode.h system
22168 set sys/mode.h i_sysmode
22169 eval $inhdr
22170
22171 : see if there is a sys/poll.h file
22172 set sys/poll.h i_syspoll
22173 eval $inhdr
22174
22175 : see if sys/resource.h has to be included
22176 set sys/resource.h i_sysresrc
22177 eval $inhdr
22178
22179 : see if sys/security.h is available
22180 set sys/security.h i_syssecrt
22181 eval $inhdr
22182
22183 : see if this is a sys/statvfs.h system
22184 set sys/statvfs.h i_sysstatvfs
22185 eval $inhdr
22186
22187 : see if this is a sys/un.h system
22188 set sys/un.h i_sysun
22189 eval $inhdr
22190
22191 : see if this is a sys/utsname.h system
22192 set sys/utsname.h i_sysutsname
22193 eval $inhdr
22194
22195 : see if this is a syswait system
22196 set sys/wait.h i_syswait
22197 eval $inhdr
22198
22199 : see if this is a ustat.h system
22200 set ustat.h i_ustat
22201 eval $inhdr
22202
22203 : see if this is an utime system
22204 set utime.h i_utime
22205 eval $inhdr
22206
22207 : see if this is a vfork system
22208 case "$d_vfork" in
22209 "$define")
22210         set vfork.h i_vfork
22211         eval $inhdr
22212         ;;
22213 *)
22214         i_vfork="$undef"
22215         ;;
22216 esac
22217
22218 : Check extensions
22219 echo " "
22220 echo "Looking for extensions..." >&4
22221 : If we are using the old config.sh, known_extensions may contain
22222 : old or inaccurate or duplicate values.
22223 known_extensions=''
22224 nonxs_extensions=''
22225 : We do not use find because it might not be available.
22226 : We do not just use MANIFEST because the user may have dropped
22227 : some additional extensions into the source tree and expect them
22228 : to be built.
22229
22230 : Function to recursively find available extensions, ignoring DynaLoader
22231 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22232 : In 5.10.1 and later, extensions are stored in directories
22233 : like File-Glob instead of the older File/Glob/.
22234 find_extensions='
22235     for xxx in *; do
22236         case "$xxx" in
22237             DynaLoader|dynaload) ;;
22238             *)
22239             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22240             leaf=`echo $xxx | $sed -e s/.*-//`;
22241             if $test -d File; then
22242                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22243                     known_extensions="$known_extensions $1$this_ext";
22244                 elif $test -f $xxx/Makefile.PL; then
22245                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22246                 else
22247                     if $test -d $xxx -a $# -lt 10; then
22248                         set $1$xxx/ $*;
22249                         cd "$xxx";
22250                         eval $find_extensions;
22251                         cd ..;
22252                         shift;
22253                     fi;
22254                 fi;
22255             else
22256                 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22257                 if $contains " $this_ext " $$.tmp; then
22258                     echo >&4;
22259                     echo "Duplicate directories detected for extension $xxx" >&4;
22260                     echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22261                     case "$knowitall" in
22262                     "") dflt=y;;
22263                     *) dflt=n;;
22264                     esac;
22265                     . ../UU/myread;
22266                     case "$ans" in
22267                     n*|N*) ;;
22268                     *) echo >&4;
22269                        echo "Ok.  Stopping Configure." >&4;
22270                        echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22271                         exit 1;;
22272                     esac;
22273                     echo "Ok.  You will need to correct config.sh before running make." >&4;
22274                 fi;
22275                 $ls -1 $xxx > $$.tmp;
22276                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22277                     known_extensions="$known_extensions $this_ext";
22278                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22279                     known_extensions="$known_extensions $this_ext";
22280                 elif $test -d $xxx; then
22281                     nonxs_extensions="$nonxs_extensions $this_ext";
22282                 fi;
22283                 $rm -f $$.tmp;
22284             fi
22285             ;;
22286         esac;
22287     done'
22288 tdir=`pwd`
22289 cd "$rsrc/cpan"
22290 set X
22291 shift
22292 eval $find_extensions
22293 cd "$rsrc/dist"
22294 set X
22295 shift
22296 eval $find_extensions
22297 cd "$rsrc/ext"
22298 set X
22299 shift
22300 eval $find_extensions
22301 if $test -d File-Glob; then
22302     : All ext/ flattened
22303 else
22304     # Special case:  Add in modules that nest beyond the first level.
22305     # Currently threads/shared and Hash/Util/FieldHash, since they are
22306     # not picked up by the recursive find above (and adding in general
22307     # recursive finding breaks SDBM_File/sdbm).
22308     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22309     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22310 fi
22311 set X $known_extensions
22312 shift
22313 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22314 set X $nonxs_extensions
22315 shift
22316 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22317 cd "$tdir"
22318
22319 : Now see which are supported on this system.
22320 avail_ext=''
22321 for xxx in $known_extensions ; do
22322         case "$xxx" in
22323         DB_File|db_file)
22324                 case "$i_db" in
22325                 $define) avail_ext="$avail_ext $xxx" ;;
22326                 esac
22327                 ;;
22328         GDBM_File|gdbm_fil)
22329                 case "$i_gdbm" in
22330                 $define) avail_ext="$avail_ext $xxx" ;;
22331                 esac
22332                 ;;
22333         I18N/Langinfo|i18n_lan)
22334                 case "$i_langinfo$d_nl_langinfo" in
22335                 $define$define) avail_ext="$avail_ext $xxx" ;;
22336                 esac
22337                 ;;
22338         IPC/SysV|ipc/sysv)
22339                 : XXX Do we need a useipcsysv variable here
22340                 case "${d_msg}${d_sem}${d_shm}" in
22341                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22342                 esac
22343                 ;;
22344         NDBM_File|ndbm_fil)
22345                 case "$d_ndbm" in
22346                 $define)
22347                     case "$osname-$use64bitint" in
22348                     hpux-define)
22349                         case "$libs" in
22350                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22351                         esac
22352                         ;;
22353                     *) avail_ext="$avail_ext $xxx" ;;
22354                     esac
22355                     ;;
22356                 esac
22357                 ;;
22358         ODBM_File|odbm_fil)
22359                 case "${i_dbm}${i_rpcsvcdbm}" in
22360                 *"${define}"*)
22361                     case "$d_cplusplus" in
22362                     define) ;; # delete as a function name will not work
22363                     *)  case "$osname-$use64bitint" in
22364                         hpux-define)
22365                             case "$libs" in
22366                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22367                             esac
22368                             ;;
22369                         *) avail_ext="$avail_ext $xxx" ;;
22370                         esac
22371                         ;;
22372                     esac
22373                     ;;
22374                 esac
22375                 ;;
22376         Opcode|opcode)
22377                 case "$useopcode" in
22378                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22379                 esac
22380                 ;;
22381         POSIX|posix)
22382                 case "$useposix" in
22383                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22384                 esac
22385                 ;;
22386         Socket|socket)
22387                 case "$d_socket" in
22388                 true|$define|y)
22389                     case "$osname" in
22390                     beos) ;; # not unless BONE
22391                     *) avail_ext="$avail_ext $xxx" ;;
22392                     esac
22393                     ;;
22394                 esac
22395                 ;;
22396         Sys/Syslog|sys/syslog)
22397                 : XXX syslog requires socket
22398                 case "$d_socket" in
22399                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22400                 esac
22401                 ;;
22402         Thread|thread)
22403                 case "$usethreads" in
22404                 true|$define|y)
22405                         case "$use5005threads" in
22406                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22407                         esac
22408                 esac
22409                 ;;
22410         threads|threads/shared)
22411                 # threads and threads::shared are special cases.
22412                 # To stop people from asking "Perl 5.8.0 was supposed
22413                 # to have this new fancy threads implementation but my
22414                 # perl doesn't have it" and from people trying to
22415                 # (re)install the threads module using CPAN.pm and
22416                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22417                 # the threads.pm and threads/shared.pm will always be
22418                 # there, croaking informatively ("you need to rebuild
22419                 # all of Perl with threads, sorry") when threads haven't
22420                 # been compiled in.
22421                 # --jhi
22422                 avail_ext="$avail_ext $xxx"
22423                 ;;
22424         VMS*)
22425                 ;;
22426         Win32*)
22427                 case "$osname" in
22428                 cygwin) avail_ext="$avail_ext $xxx" ;;
22429                 esac
22430                 ;;
22431         XS/APItest|xs/apitest)
22432                 # This is just for testing.  Skip it unless we have dynamic loading.
22433
22434                 case "$usedl" in
22435                 $define) avail_ext="$avail_ext $xxx" ;;
22436                 esac
22437                 ;;
22438         XS/Typemap|xs/typemap)
22439                 # This is just for testing.  Skip it unless we have dynamic loading.
22440                 case "$usedl" in
22441                 $define) avail_ext="$avail_ext $xxx" ;;
22442                 esac
22443                 ;;
22444         *)      avail_ext="$avail_ext $xxx"
22445                 ;;
22446         esac
22447 done
22448
22449 set X $avail_ext
22450 shift
22451 avail_ext="$*"
22452
22453 case "$onlyextensions" in
22454 '') ;;
22455 *)  keepextensions=''
22456     echo "You have requested that only certain extensions be included..." >&4
22457     for i in $onlyextensions; do
22458         case " $avail_ext " in
22459         *" $i "*)
22460             echo "Keeping extension $i."
22461             keepextensions="$keepextensions $i"
22462             ;;
22463         *) echo "Ignoring extension $i." ;;
22464         esac
22465     done
22466     avail_ext="$keepextensions"
22467     ;;
22468 esac
22469
22470 case "$noextensions" in
22471 '') ;;
22472 *)  keepextensions=''
22473     echo "You have requested that certain extensions be ignored..." >&4
22474     for i in $avail_ext; do
22475         case " $noextensions " in
22476         *" $i "*) echo "Ignoring extension $i." ;;
22477         *) echo "Keeping extension $i.";
22478            keepextensions="$keepextensions $i"
22479            ;;
22480         esac
22481     done
22482     avail_ext="$keepextensions"
22483     ;;
22484 esac
22485
22486 : Now see which nonxs extensions are supported on this system.
22487 : For now assume all are.
22488 nonxs_ext=''
22489 for xxx in $nonxs_extensions ; do
22490         case "$xxx" in
22491         *)      nonxs_ext="$nonxs_ext $xxx"
22492                 ;;
22493         esac
22494 done
22495
22496 set X $nonxs_ext
22497 shift
22498 nonxs_ext="$*"
22499
22500 case $usedl in
22501 $define)
22502         $cat <<EOM
22503 A number of extensions are supplied with $package.  You may choose to
22504 compile these extensions for dynamic loading (the default), compile
22505 them into the $package executable (static loading), or not include
22506 them at all.  Answer "none" to include no extensions.
22507 Note that DynaLoader is always built and need not be mentioned here.
22508
22509 EOM
22510         case "$dynamic_ext" in
22511         '')
22512                 : Exclude those listed in static_ext
22513                 dflt=''
22514                 for xxx in $avail_ext; do
22515                         case " $static_ext " in
22516                         *" $xxx "*) ;;
22517                         *) dflt="$dflt $xxx" ;;
22518                         esac
22519                 done
22520                 set X $dflt
22521                 shift
22522                 dflt="$*"
22523                 ;;
22524         *)      dflt="$dynamic_ext"
22525                 # Perhaps we are reusing an old out-of-date config.sh.
22526                 case "$hint" in
22527                 previous)
22528                         if test X"$dynamic_ext" != X"$avail_ext"; then
22529                                 $cat <<EOM
22530 NOTICE:  Your previous config.sh list may be incorrect.
22531 The extensions now available to you are
22532         ${avail_ext}
22533 but the default list from your previous config.sh is
22534         ${dynamic_ext}
22535
22536 EOM
22537                         fi
22538                         ;;
22539                 esac
22540                 ;;
22541         esac
22542         case "$dflt" in
22543         '')     dflt=none;;
22544         esac
22545         rp="What extensions do you wish to load dynamically?"
22546         . ./myread
22547         case "$ans" in
22548         none) dynamic_ext=' ' ;;
22549         *) dynamic_ext="$ans" ;;
22550         esac
22551
22552         case "$static_ext" in
22553         '')
22554                 : Exclude those already listed in dynamic linking
22555                 dflt=''
22556                 for xxx in $avail_ext; do
22557                         case " $dynamic_ext " in
22558                         *" $xxx "*) ;;
22559                         *) dflt="$dflt $xxx" ;;
22560                         esac
22561                 done
22562                 set X $dflt
22563                 shift
22564                 dflt="$*"
22565                 ;;
22566         *)  dflt="$static_ext"
22567                 ;;
22568         esac
22569
22570         case "$dflt" in
22571         '')     dflt=none;;
22572         esac
22573         rp="What extensions do you wish to load statically?"
22574         . ./myread
22575         case "$ans" in
22576         none) static_ext=' ' ;;
22577         *) static_ext="$ans" ;;
22578         esac
22579         ;;
22580 *)
22581         $cat <<EOM
22582 A number of extensions are supplied with $package.  Answer "none"
22583 to include no extensions.
22584 Note that DynaLoader is always built and need not be mentioned here.
22585
22586 EOM
22587         case "$static_ext" in
22588         '') dflt="$avail_ext" ;;
22589         *)      dflt="$static_ext"
22590                 # Perhaps we are reusing an old out-of-date config.sh.
22591                 case "$hint" in
22592                 previous)
22593                         if test X"$static_ext" != X"$avail_ext"; then
22594                                 $cat <<EOM
22595 NOTICE:  Your previous config.sh list may be incorrect.
22596 The extensions now available to you are
22597         ${avail_ext}
22598 but the default list from your previous config.sh is
22599         ${static_ext}
22600
22601 EOM
22602                         fi
22603                         ;;
22604                 esac
22605                 ;;
22606         esac
22607         : Exclude those that are not xs extensions
22608         case "$dflt" in
22609         '')     dflt=none;;
22610         esac
22611         rp="What extensions do you wish to include?"
22612         . ./myread
22613         case "$ans" in
22614         none) static_ext=' ' ;;
22615         *) static_ext="$ans" ;;
22616         esac
22617         ;;
22618 esac
22619 #
22620 # Encode is a special case.  If we are building Encode as a static
22621 # extension, we need to explicitly list its subextensions as well.
22622 # For other nested extensions, this is handled automatically by
22623 # the appropriate Makefile.PL.
22624 case " $static_ext " in
22625         *" Encode "*) # Add the subextensions of Encode
22626         cd "$rsrc/cpan"
22627         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22628                 static_ext="$static_ext Encode/$xxx"
22629         done
22630         cd "$tdir"
22631         ;;
22632 esac
22633
22634 set X $dynamic_ext $static_ext $nonxs_ext
22635 shift
22636 extensions="$*"
22637
22638 # Sanity check:  We require an extension suitable for use with
22639 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22640 # should show up as failures in the test suite, but it's helpful to
22641 # catch them now.) The 'extensions' list is normally sorted
22642 # alphabetically, so we need to accept either
22643 #    DB_File ... Fcntl ... IO  ....
22644 # or something like
22645 #    Fcntl ... NDBM_File ... IO  ....
22646 case " $extensions"  in
22647 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22648 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22649 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22650 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22651    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22652    ;;
22653 esac
22654
22655 : Remove libraries needed only for extensions
22656 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22657 : The exception is SunOS 4.x, which needs them.
22658 case "${osname}X${osvers}" in
22659 sunos*X4*)
22660     perllibs="$libs"
22661     ;;
22662 *) case "$usedl" in
22663     $define|true|[yY]*)
22664             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22665             shift
22666             perllibs="$*"
22667             ;;
22668     *)  perllibs="$libs"
22669             ;;
22670     esac
22671     ;;
22672 esac
22673
22674 : Remove build directory name from cppstdin so it can be used from
22675 : either the present location or the final installed location.
22676 echo " "
22677 : Get out of the UU directory to get correct path name.
22678 cd ..
22679 case "$cppstdin" in
22680 `pwd`/cppstdin)
22681         echo "Stripping down cppstdin path name"
22682         cppstdin=cppstdin
22683         ;;
22684 esac
22685 cd UU
22686
22687 : end of configuration questions
22688 echo " "
22689 echo "End of configuration questions."
22690 echo " "
22691
22692 : back to where it started
22693 if test -d ../UU; then
22694         cd ..
22695 fi
22696
22697 : configuration may be unconditionally patched via a 'config.arch' file
22698 if $test -f config.arch; then
22699         echo "I see a config.arch file, loading it." >&4
22700         . ./config.arch
22701 fi
22702
22703 : configuration may be patched via a 'config.over' file
22704 if $test -f config.over; then
22705         echo " "
22706         dflt=y
22707         rp='I see a config.over file.  Do you wish to load it?'
22708         . UU/myread
22709         case "$ans" in
22710         n*) echo "OK, I'll ignore it.";;
22711         *)      . ./config.over
22712                 echo "Configuration override changes have been loaded."
22713                 ;;
22714         esac
22715 fi
22716
22717 : in case they want portability, strip down executable paths
22718 case "$d_portable" in
22719 "$define")
22720         echo " "
22721         echo "Stripping down executable paths..." >&4
22722         for file in $loclist $trylist; do
22723                 eval temp=\$$file
22724                 eval $file=`basename $temp`
22725         done
22726         ;;
22727 esac
22728
22729 : create config.sh file
22730 echo " "
22731 echo "Creating config.sh..." >&4
22732 $spitshell <<EOT >config.sh
22733 $startsh
22734 #
22735 # This file was produced by running the Configure script. It holds all the
22736 # definitions figured out by Configure. Should you modify one of these values,
22737 # do not forget to propagate your changes by running "Configure -der". You may
22738 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22739 #
22740
22741 # Package name      : $package
22742 # Source directory  : $src
22743 # Configuration time: $cf_time
22744 # Configured by     : $cf_by
22745 # Target system     : $myuname
22746
22747 EOT
22748 : Add in command line options if available
22749 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22750
22751 $spitshell <<EOT >>config.sh
22752
22753 Author='$Author'
22754 Date='$Date'
22755 Header='$Header'
22756 Id='$Id'
22757 Locker='$Locker'
22758 Log='$Log'
22759 RCSfile='$RCSfile'
22760 Revision='$Revision'
22761 Source='$Source'
22762 State='$State'
22763 _a='$_a'
22764 _exe='$_exe'
22765 _o='$_o'
22766 afs='$afs'
22767 afsroot='$afsroot'
22768 alignbytes='$alignbytes'
22769 ansi2knr='$ansi2knr'
22770 aphostname='$aphostname'
22771 api_revision='$api_revision'
22772 api_subversion='$api_subversion'
22773 api_version='$api_version'
22774 api_versionstring='$api_versionstring'
22775 ar='$ar'
22776 archlib='$archlib'
22777 archlibexp='$archlibexp'
22778 archname64='$archname64'
22779 archname='$archname'
22780 archobjs='$archobjs'
22781 asctime_r_proto='$asctime_r_proto'
22782 awk='$awk'
22783 baserev='$baserev'
22784 bash='$bash'
22785 bin='$bin'
22786 bin_ELF='$bin_ELF'
22787 binexp='$binexp'
22788 bison='$bison'
22789 byacc='$byacc'
22790 byteorder='$byteorder'
22791 c='$c'
22792 castflags='$castflags'
22793 cat='$cat'
22794 cc='$cc'
22795 cccdlflags='$cccdlflags'
22796 ccdlflags='$ccdlflags'
22797 ccflags='$ccflags'
22798 ccflags_uselargefiles='$ccflags_uselargefiles'
22799 ccname='$ccname'
22800 ccsymbols='$ccsymbols'
22801 ccversion='$ccversion'
22802 cf_by='$cf_by'
22803 cf_email='$cf_email'
22804 cf_time='$cf_time'
22805 charbits='$charbits'
22806 charsize='$charsize'
22807 chgrp='$chgrp'
22808 chmod='$chmod'
22809 chown='$chown'
22810 clocktype='$clocktype'
22811 comm='$comm'
22812 compress='$compress'
22813 contains='$contains'
22814 cp='$cp'
22815 cpio='$cpio'
22816 cpp='$cpp'
22817 cpp_stuff='$cpp_stuff'
22818 cppccsymbols='$cppccsymbols'
22819 cppflags='$cppflags'
22820 cpplast='$cpplast'
22821 cppminus='$cppminus'
22822 cpprun='$cpprun'
22823 cppstdin='$cppstdin'
22824 cppsymbols='$cppsymbols'
22825 crypt_r_proto='$crypt_r_proto'
22826 cryptlib='$cryptlib'
22827 csh='$csh'
22828 ctermid_r_proto='$ctermid_r_proto'
22829 ctime_r_proto='$ctime_r_proto'
22830 d_Gconvert='$d_Gconvert'
22831 d_PRIEUldbl='$d_PRIEUldbl'
22832 d_PRIFUldbl='$d_PRIFUldbl'
22833 d_PRIGUldbl='$d_PRIGUldbl'
22834 d_PRIXU64='$d_PRIXU64'
22835 d_PRId64='$d_PRId64'
22836 d_PRIeldbl='$d_PRIeldbl'
22837 d_PRIfldbl='$d_PRIfldbl'
22838 d_PRIgldbl='$d_PRIgldbl'
22839 d_PRIi64='$d_PRIi64'
22840 d_PRIo64='$d_PRIo64'
22841 d_PRIu64='$d_PRIu64'
22842 d_PRIx64='$d_PRIx64'
22843 d_SCNfldbl='$d_SCNfldbl'
22844 d__fwalk='$d__fwalk'
22845 d_access='$d_access'
22846 d_accessx='$d_accessx'
22847 d_aintl='$d_aintl'
22848 d_alarm='$d_alarm'
22849 d_archlib='$d_archlib'
22850 d_asctime64='$d_asctime64'
22851 d_asctime_r='$d_asctime_r'
22852 d_atolf='$d_atolf'
22853 d_atoll='$d_atoll'
22854 d_attribute_deprecated='$d_attribute_deprecated'
22855 d_attribute_format='$d_attribute_format'
22856 d_attribute_malloc='$d_attribute_malloc'
22857 d_attribute_nonnull='$d_attribute_nonnull'
22858 d_attribute_noreturn='$d_attribute_noreturn'
22859 d_attribute_pure='$d_attribute_pure'
22860 d_attribute_unused='$d_attribute_unused'
22861 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22862 d_bcmp='$d_bcmp'
22863 d_bcopy='$d_bcopy'
22864 d_bsd='$d_bsd'
22865 d_bsdgetpgrp='$d_bsdgetpgrp'
22866 d_bsdsetpgrp='$d_bsdsetpgrp'
22867 d_builtin_choose_expr='$d_builtin_choose_expr'
22868 d_builtin_expect='$d_builtin_expect'
22869 d_bzero='$d_bzero'
22870 d_c99_variadic_macros='$d_c99_variadic_macros'
22871 d_casti32='$d_casti32'
22872 d_castneg='$d_castneg'
22873 d_charvspr='$d_charvspr'
22874 d_chown='$d_chown'
22875 d_chroot='$d_chroot'
22876 d_chsize='$d_chsize'
22877 d_class='$d_class'
22878 d_clearenv='$d_clearenv'
22879 d_closedir='$d_closedir'
22880 d_cmsghdr_s='$d_cmsghdr_s'
22881 d_const='$d_const'
22882 d_copysignl='$d_copysignl'
22883 d_cplusplus='$d_cplusplus'
22884 d_crypt='$d_crypt'
22885 d_crypt_r='$d_crypt_r'
22886 d_csh='$d_csh'
22887 d_ctermid='$d_ctermid'
22888 d_ctermid_r='$d_ctermid_r'
22889 d_ctime64='$d_ctime64'
22890 d_ctime_r='$d_ctime_r'
22891 d_cuserid='$d_cuserid'
22892 d_dbl_dig='$d_dbl_dig'
22893 d_dbminitproto='$d_dbminitproto'
22894 d_difftime64='$d_difftime64'
22895 d_difftime='$d_difftime'
22896 d_dir_dd_fd='$d_dir_dd_fd'
22897 d_dirfd='$d_dirfd'
22898 d_dirnamlen='$d_dirnamlen'
22899 d_dlerror='$d_dlerror'
22900 d_dlopen='$d_dlopen'
22901 d_dlsymun='$d_dlsymun'
22902 d_dosuid='$d_dosuid'
22903 d_drand48_r='$d_drand48_r'
22904 d_drand48proto='$d_drand48proto'
22905 d_dup2='$d_dup2'
22906 d_eaccess='$d_eaccess'
22907 d_endgrent='$d_endgrent'
22908 d_endgrent_r='$d_endgrent_r'
22909 d_endhent='$d_endhent'
22910 d_endhostent_r='$d_endhostent_r'
22911 d_endnent='$d_endnent'
22912 d_endnetent_r='$d_endnetent_r'
22913 d_endpent='$d_endpent'
22914 d_endprotoent_r='$d_endprotoent_r'
22915 d_endpwent='$d_endpwent'
22916 d_endpwent_r='$d_endpwent_r'
22917 d_endsent='$d_endsent'
22918 d_endservent_r='$d_endservent_r'
22919 d_eofnblk='$d_eofnblk'
22920 d_eunice='$d_eunice'
22921 d_faststdio='$d_faststdio'
22922 d_fchdir='$d_fchdir'
22923 d_fchmod='$d_fchmod'
22924 d_fchown='$d_fchown'
22925 d_fcntl='$d_fcntl'
22926 d_fcntl_can_lock='$d_fcntl_can_lock'
22927 d_fd_macros='$d_fd_macros'
22928 d_fd_set='$d_fd_set'
22929 d_fds_bits='$d_fds_bits'
22930 d_fgetpos='$d_fgetpos'
22931 d_finite='$d_finite'
22932 d_finitel='$d_finitel'
22933 d_flexfnam='$d_flexfnam'
22934 d_flock='$d_flock'
22935 d_flockproto='$d_flockproto'
22936 d_fork='$d_fork'
22937 d_fp_class='$d_fp_class'
22938 d_fpathconf='$d_fpathconf'
22939 d_fpclass='$d_fpclass'
22940 d_fpclassify='$d_fpclassify'
22941 d_fpclassl='$d_fpclassl'
22942 d_fpos64_t='$d_fpos64_t'
22943 d_frexpl='$d_frexpl'
22944 d_fs_data_s='$d_fs_data_s'
22945 d_fseeko='$d_fseeko'
22946 d_fsetpos='$d_fsetpos'
22947 d_fstatfs='$d_fstatfs'
22948 d_fstatvfs='$d_fstatvfs'
22949 d_fsync='$d_fsync'
22950 d_ftello='$d_ftello'
22951 d_ftime='$d_ftime'
22952 d_futimes='$d_futimes'
22953 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22954 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22955 d_getaddrinfo='$d_getaddrinfo'
22956 d_getcwd='$d_getcwd'
22957 d_getespwnam='$d_getespwnam'
22958 d_getfsstat='$d_getfsstat'
22959 d_getgrent='$d_getgrent'
22960 d_getgrent_r='$d_getgrent_r'
22961 d_getgrgid_r='$d_getgrgid_r'
22962 d_getgrnam_r='$d_getgrnam_r'
22963 d_getgrps='$d_getgrps'
22964 d_gethbyaddr='$d_gethbyaddr'
22965 d_gethbyname='$d_gethbyname'
22966 d_gethent='$d_gethent'
22967 d_gethname='$d_gethname'
22968 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22969 d_gethostbyname_r='$d_gethostbyname_r'
22970 d_gethostent_r='$d_gethostent_r'
22971 d_gethostprotos='$d_gethostprotos'
22972 d_getitimer='$d_getitimer'
22973 d_getlogin='$d_getlogin'
22974 d_getlogin_r='$d_getlogin_r'
22975 d_getmnt='$d_getmnt'
22976 d_getmntent='$d_getmntent'
22977 d_getnameinfo='$d_getnameinfo'
22978 d_getnbyaddr='$d_getnbyaddr'
22979 d_getnbyname='$d_getnbyname'
22980 d_getnent='$d_getnent'
22981 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22982 d_getnetbyname_r='$d_getnetbyname_r'
22983 d_getnetent_r='$d_getnetent_r'
22984 d_getnetprotos='$d_getnetprotos'
22985 d_getpagsz='$d_getpagsz'
22986 d_getpbyname='$d_getpbyname'
22987 d_getpbynumber='$d_getpbynumber'
22988 d_getpent='$d_getpent'
22989 d_getpgid='$d_getpgid'
22990 d_getpgrp2='$d_getpgrp2'
22991 d_getpgrp='$d_getpgrp'
22992 d_getppid='$d_getppid'
22993 d_getprior='$d_getprior'
22994 d_getprotobyname_r='$d_getprotobyname_r'
22995 d_getprotobynumber_r='$d_getprotobynumber_r'
22996 d_getprotoent_r='$d_getprotoent_r'
22997 d_getprotoprotos='$d_getprotoprotos'
22998 d_getprpwnam='$d_getprpwnam'
22999 d_getpwent='$d_getpwent'
23000 d_getpwent_r='$d_getpwent_r'
23001 d_getpwnam_r='$d_getpwnam_r'
23002 d_getpwuid_r='$d_getpwuid_r'
23003 d_getsbyname='$d_getsbyname'
23004 d_getsbyport='$d_getsbyport'
23005 d_getsent='$d_getsent'
23006 d_getservbyname_r='$d_getservbyname_r'
23007 d_getservbyport_r='$d_getservbyport_r'
23008 d_getservent_r='$d_getservent_r'
23009 d_getservprotos='$d_getservprotos'
23010 d_getspnam='$d_getspnam'
23011 d_getspnam_r='$d_getspnam_r'
23012 d_gettimeod='$d_gettimeod'
23013 d_gmtime64='$d_gmtime64'
23014 d_gmtime_r='$d_gmtime_r'
23015 d_gnulibc='$d_gnulibc'
23016 d_grpasswd='$d_grpasswd'
23017 d_hasmntopt='$d_hasmntopt'
23018 d_htonl='$d_htonl'
23019 d_ilogbl='$d_ilogbl'
23020 d_inc_version_list='$d_inc_version_list'
23021 d_index='$d_index'
23022 d_inetaton='$d_inetaton'
23023 d_inetntop='$d_inetntop'
23024 d_inetpton='$d_inetpton'
23025 d_int64_t='$d_int64_t'
23026 d_ipv6_mreq='$d_ipv6_mreq'
23027 d_isascii='$d_isascii'
23028 d_isblank='$d_isblank'
23029 d_isfinite='$d_isfinite'
23030 d_isinf='$d_isinf'
23031 d_isnan='$d_isnan'
23032 d_isnanl='$d_isnanl'
23033 d_killpg='$d_killpg'
23034 d_lchown='$d_lchown'
23035 d_ldbl_dig='$d_ldbl_dig'
23036 d_libm_lib_version='$d_libm_lib_version'
23037 d_link='$d_link'
23038 d_localtime64='$d_localtime64'
23039 d_localtime_r='$d_localtime_r'
23040 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23041 d_locconv='$d_locconv'
23042 d_lockf='$d_lockf'
23043 d_longdbl='$d_longdbl'
23044 d_longlong='$d_longlong'
23045 d_lseekproto='$d_lseekproto'
23046 d_lstat='$d_lstat'
23047 d_madvise='$d_madvise'
23048 d_malloc_good_size='$d_malloc_good_size'
23049 d_malloc_size='$d_malloc_size'
23050 d_mblen='$d_mblen'
23051 d_mbstowcs='$d_mbstowcs'
23052 d_mbtowc='$d_mbtowc'
23053 d_memchr='$d_memchr'
23054 d_memcmp='$d_memcmp'
23055 d_memcpy='$d_memcpy'
23056 d_memmove='$d_memmove'
23057 d_memset='$d_memset'
23058 d_mkdir='$d_mkdir'
23059 d_mkdtemp='$d_mkdtemp'
23060 d_mkfifo='$d_mkfifo'
23061 d_mkstemp='$d_mkstemp'
23062 d_mkstemps='$d_mkstemps'
23063 d_mktime64='$d_mktime64'
23064 d_mktime='$d_mktime'
23065 d_mmap='$d_mmap'
23066 d_modfl='$d_modfl'
23067 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23068 d_modflproto='$d_modflproto'
23069 d_mprotect='$d_mprotect'
23070 d_msg='$d_msg'
23071 d_msg_ctrunc='$d_msg_ctrunc'
23072 d_msg_dontroute='$d_msg_dontroute'
23073 d_msg_oob='$d_msg_oob'
23074 d_msg_peek='$d_msg_peek'
23075 d_msg_proxy='$d_msg_proxy'
23076 d_msgctl='$d_msgctl'
23077 d_msgget='$d_msgget'
23078 d_msghdr_s='$d_msghdr_s'
23079 d_msgrcv='$d_msgrcv'
23080 d_msgsnd='$d_msgsnd'
23081 d_msync='$d_msync'
23082 d_munmap='$d_munmap'
23083 d_mymalloc='$d_mymalloc'
23084 d_ndbm='$d_ndbm'
23085 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23086 d_nice='$d_nice'
23087 d_nl_langinfo='$d_nl_langinfo'
23088 d_nv_preserves_uv='$d_nv_preserves_uv'
23089 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23090 d_off64_t='$d_off64_t'
23091 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23092 d_oldpthreads='$d_oldpthreads'
23093 d_oldsock='$d_oldsock'
23094 d_open3='$d_open3'
23095 d_pathconf='$d_pathconf'
23096 d_pause='$d_pause'
23097 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23098 d_phostname='$d_phostname'
23099 d_pipe='$d_pipe'
23100 d_poll='$d_poll'
23101 d_portable='$d_portable'
23102 d_prctl='$d_prctl'
23103 d_prctl_set_name='$d_prctl_set_name'
23104 d_printf_format_null='$d_printf_format_null'
23105 d_procselfexe='$d_procselfexe'
23106 d_pseudofork='$d_pseudofork'
23107 d_pthread_atfork='$d_pthread_atfork'
23108 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23109 d_pthread_yield='$d_pthread_yield'
23110 d_pwage='$d_pwage'
23111 d_pwchange='$d_pwchange'
23112 d_pwclass='$d_pwclass'
23113 d_pwcomment='$d_pwcomment'
23114 d_pwexpire='$d_pwexpire'
23115 d_pwgecos='$d_pwgecos'
23116 d_pwpasswd='$d_pwpasswd'
23117 d_pwquota='$d_pwquota'
23118 d_qgcvt='$d_qgcvt'
23119 d_quad='$d_quad'
23120 d_random_r='$d_random_r'
23121 d_readdir64_r='$d_readdir64_r'
23122 d_readdir='$d_readdir'
23123 d_readdir_r='$d_readdir_r'
23124 d_readlink='$d_readlink'
23125 d_readv='$d_readv'
23126 d_recvmsg='$d_recvmsg'
23127 d_rename='$d_rename'
23128 d_rewinddir='$d_rewinddir'
23129 d_rmdir='$d_rmdir'
23130 d_safebcpy='$d_safebcpy'
23131 d_safemcpy='$d_safemcpy'
23132 d_sanemcmp='$d_sanemcmp'
23133 d_sbrkproto='$d_sbrkproto'
23134 d_scalbnl='$d_scalbnl'
23135 d_sched_yield='$d_sched_yield'
23136 d_scm_rights='$d_scm_rights'
23137 d_seekdir='$d_seekdir'
23138 d_select='$d_select'
23139 d_sem='$d_sem'
23140 d_semctl='$d_semctl'
23141 d_semctl_semid_ds='$d_semctl_semid_ds'
23142 d_semctl_semun='$d_semctl_semun'
23143 d_semget='$d_semget'
23144 d_semop='$d_semop'
23145 d_sendmsg='$d_sendmsg'
23146 d_setegid='$d_setegid'
23147 d_seteuid='$d_seteuid'
23148 d_setgrent='$d_setgrent'
23149 d_setgrent_r='$d_setgrent_r'
23150 d_setgrps='$d_setgrps'
23151 d_sethent='$d_sethent'
23152 d_sethostent_r='$d_sethostent_r'
23153 d_setitimer='$d_setitimer'
23154 d_setlinebuf='$d_setlinebuf'
23155 d_setlocale='$d_setlocale'
23156 d_setlocale_r='$d_setlocale_r'
23157 d_setnent='$d_setnent'
23158 d_setnetent_r='$d_setnetent_r'
23159 d_setpent='$d_setpent'
23160 d_setpgid='$d_setpgid'
23161 d_setpgrp2='$d_setpgrp2'
23162 d_setpgrp='$d_setpgrp'
23163 d_setprior='$d_setprior'
23164 d_setproctitle='$d_setproctitle'
23165 d_setprotoent_r='$d_setprotoent_r'
23166 d_setpwent='$d_setpwent'
23167 d_setpwent_r='$d_setpwent_r'
23168 d_setregid='$d_setregid'
23169 d_setresgid='$d_setresgid'
23170 d_setresuid='$d_setresuid'
23171 d_setreuid='$d_setreuid'
23172 d_setrgid='$d_setrgid'
23173 d_setruid='$d_setruid'
23174 d_setsent='$d_setsent'
23175 d_setservent_r='$d_setservent_r'
23176 d_setsid='$d_setsid'
23177 d_setvbuf='$d_setvbuf'
23178 d_sfio='$d_sfio'
23179 d_shm='$d_shm'
23180 d_shmat='$d_shmat'
23181 d_shmatprototype='$d_shmatprototype'
23182 d_shmctl='$d_shmctl'
23183 d_shmdt='$d_shmdt'
23184 d_shmget='$d_shmget'
23185 d_sigaction='$d_sigaction'
23186 d_signbit='$d_signbit'
23187 d_sigprocmask='$d_sigprocmask'
23188 d_sigsetjmp='$d_sigsetjmp'
23189 d_sin6_scope_id='$d_sin6_scope_id'
23190 d_sitearch='$d_sitearch'
23191 d_snprintf='$d_snprintf'
23192 d_sockaddr_in6='$d_sockaddr_in6'
23193 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23194 d_sockatmark='$d_sockatmark'
23195 d_sockatmarkproto='$d_sockatmarkproto'
23196 d_socket='$d_socket'
23197 d_socklen_t='$d_socklen_t'
23198 d_sockpair='$d_sockpair'
23199 d_socks5_init='$d_socks5_init'
23200 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23201 d_sqrtl='$d_sqrtl'
23202 d_srand48_r='$d_srand48_r'
23203 d_srandom_r='$d_srandom_r'
23204 d_sresgproto='$d_sresgproto'
23205 d_sresuproto='$d_sresuproto'
23206 d_statblks='$d_statblks'
23207 d_statfs_f_flags='$d_statfs_f_flags'
23208 d_statfs_s='$d_statfs_s'
23209 d_static_inline='$d_static_inline'
23210 d_statvfs='$d_statvfs'
23211 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23212 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23213 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23214 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23215 d_stdio_stream_array='$d_stdio_stream_array'
23216 d_stdiobase='$d_stdiobase'
23217 d_stdstdio='$d_stdstdio'
23218 d_strchr='$d_strchr'
23219 d_strcoll='$d_strcoll'
23220 d_strctcpy='$d_strctcpy'
23221 d_strerrm='$d_strerrm'
23222 d_strerror='$d_strerror'
23223 d_strerror_r='$d_strerror_r'
23224 d_strftime='$d_strftime'
23225 d_strlcat='$d_strlcat'
23226 d_strlcpy='$d_strlcpy'
23227 d_strtod='$d_strtod'
23228 d_strtol='$d_strtol'
23229 d_strtold='$d_strtold'
23230 d_strtoll='$d_strtoll'
23231 d_strtoq='$d_strtoq'
23232 d_strtoul='$d_strtoul'
23233 d_strtoull='$d_strtoull'
23234 d_strtouq='$d_strtouq'
23235 d_strxfrm='$d_strxfrm'
23236 d_suidsafe='$d_suidsafe'
23237 d_symlink='$d_symlink'
23238 d_syscall='$d_syscall'
23239 d_syscallproto='$d_syscallproto'
23240 d_sysconf='$d_sysconf'
23241 d_sysernlst='$d_sysernlst'
23242 d_syserrlst='$d_syserrlst'
23243 d_system='$d_system'
23244 d_tcgetpgrp='$d_tcgetpgrp'
23245 d_tcsetpgrp='$d_tcsetpgrp'
23246 d_telldir='$d_telldir'
23247 d_telldirproto='$d_telldirproto'
23248 d_time='$d_time'
23249 d_timegm='$d_timegm'
23250 d_times='$d_times'
23251 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23252 d_tm_tm_zone='$d_tm_tm_zone'
23253 d_tmpnam_r='$d_tmpnam_r'
23254 d_truncate='$d_truncate'
23255 d_ttyname_r='$d_ttyname_r'
23256 d_tzname='$d_tzname'
23257 d_u32align='$d_u32align'
23258 d_ualarm='$d_ualarm'
23259 d_umask='$d_umask'
23260 d_uname='$d_uname'
23261 d_union_semun='$d_union_semun'
23262 d_unordered='$d_unordered'
23263 d_unsetenv='$d_unsetenv'
23264 d_usleep='$d_usleep'
23265 d_usleepproto='$d_usleepproto'
23266 d_ustat='$d_ustat'
23267 d_vendorarch='$d_vendorarch'
23268 d_vendorbin='$d_vendorbin'
23269 d_vendorlib='$d_vendorlib'
23270 d_vendorscript='$d_vendorscript'
23271 d_vfork='$d_vfork'
23272 d_void_closedir='$d_void_closedir'
23273 d_voidsig='$d_voidsig'
23274 d_voidtty='$d_voidtty'
23275 d_volatile='$d_volatile'
23276 d_vprintf='$d_vprintf'
23277 d_vsnprintf='$d_vsnprintf'
23278 d_wait4='$d_wait4'
23279 d_waitpid='$d_waitpid'
23280 d_wcstombs='$d_wcstombs'
23281 d_wctomb='$d_wctomb'
23282 d_writev='$d_writev'
23283 d_xenix='$d_xenix'
23284 date='$date'
23285 db_hashtype='$db_hashtype'
23286 db_prefixtype='$db_prefixtype'
23287 db_version_major='$db_version_major'
23288 db_version_minor='$db_version_minor'
23289 db_version_patch='$db_version_patch'
23290 defvoidused='$defvoidused'
23291 direntrytype='$direntrytype'
23292 dlext='$dlext'
23293 dlsrc='$dlsrc'
23294 doublesize='$doublesize'
23295 drand01='$drand01'
23296 drand48_r_proto='$drand48_r_proto'
23297 dtrace='$dtrace'
23298 dynamic_ext='$dynamic_ext'
23299 eagain='$eagain'
23300 ebcdic='$ebcdic'
23301 echo='$echo'
23302 egrep='$egrep'
23303 emacs='$emacs'
23304 endgrent_r_proto='$endgrent_r_proto'
23305 endhostent_r_proto='$endhostent_r_proto'
23306 endnetent_r_proto='$endnetent_r_proto'
23307 endprotoent_r_proto='$endprotoent_r_proto'
23308 endpwent_r_proto='$endpwent_r_proto'
23309 endservent_r_proto='$endservent_r_proto'
23310 eunicefix='$eunicefix'
23311 exe_ext='$exe_ext'
23312 expr='$expr'
23313 extensions='$extensions'
23314 extern_C='$extern_C'
23315 extras='$extras'
23316 fflushNULL='$fflushNULL'
23317 fflushall='$fflushall'
23318 find='$find'
23319 firstmakefile='$firstmakefile'
23320 flex='$flex'
23321 fpossize='$fpossize'
23322 fpostype='$fpostype'
23323 freetype='$freetype'
23324 from='$from'
23325 full_ar='$full_ar'
23326 full_csh='$full_csh'
23327 full_sed='$full_sed'
23328 gccansipedantic='$gccansipedantic'
23329 gccosandvers='$gccosandvers'
23330 gccversion='$gccversion'
23331 getgrent_r_proto='$getgrent_r_proto'
23332 getgrgid_r_proto='$getgrgid_r_proto'
23333 getgrnam_r_proto='$getgrnam_r_proto'
23334 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23335 gethostbyname_r_proto='$gethostbyname_r_proto'
23336 gethostent_r_proto='$gethostent_r_proto'
23337 getlogin_r_proto='$getlogin_r_proto'
23338 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23339 getnetbyname_r_proto='$getnetbyname_r_proto'
23340 getnetent_r_proto='$getnetent_r_proto'
23341 getprotobyname_r_proto='$getprotobyname_r_proto'
23342 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23343 getprotoent_r_proto='$getprotoent_r_proto'
23344 getpwent_r_proto='$getpwent_r_proto'
23345 getpwnam_r_proto='$getpwnam_r_proto'
23346 getpwuid_r_proto='$getpwuid_r_proto'
23347 getservbyname_r_proto='$getservbyname_r_proto'
23348 getservbyport_r_proto='$getservbyport_r_proto'
23349 getservent_r_proto='$getservent_r_proto'
23350 getspnam_r_proto='$getspnam_r_proto'
23351 gidformat='$gidformat'
23352 gidsign='$gidsign'
23353 gidsize='$gidsize'
23354 gidtype='$gidtype'
23355 glibpth='$glibpth'
23356 gmake='$gmake'
23357 gmtime_r_proto='$gmtime_r_proto'
23358 gnulibc_version='$gnulibc_version'
23359 grep='$grep'
23360 groupcat='$groupcat'
23361 groupstype='$groupstype'
23362 gzip='$gzip'
23363 h_fcntl='$h_fcntl'
23364 h_sysfile='$h_sysfile'
23365 hint='$hint'
23366 hostcat='$hostcat'
23367 html1dir='$html1dir'
23368 html1direxp='$html1direxp'
23369 html3dir='$html3dir'
23370 html3direxp='$html3direxp'
23371 i16size='$i16size'
23372 i16type='$i16type'
23373 i32size='$i32size'
23374 i32type='$i32type'
23375 i64size='$i64size'
23376 i64type='$i64type'
23377 i8size='$i8size'
23378 i8type='$i8type'
23379 i_arpainet='$i_arpainet'
23380 i_assert='$i_assert'
23381 i_bsdioctl='$i_bsdioctl'
23382 i_crypt='$i_crypt'
23383 i_db='$i_db'
23384 i_dbm='$i_dbm'
23385 i_dirent='$i_dirent'
23386 i_dld='$i_dld'
23387 i_dlfcn='$i_dlfcn'
23388 i_fcntl='$i_fcntl'
23389 i_float='$i_float'
23390 i_fp='$i_fp'
23391 i_fp_class='$i_fp_class'
23392 i_gdbm='$i_gdbm'
23393 i_gdbm_ndbm='$i_gdbm_ndbm'
23394 i_gdbmndbm='$i_gdbmndbm'
23395 i_grp='$i_grp'
23396 i_ieeefp='$i_ieeefp'
23397 i_inttypes='$i_inttypes'
23398 i_langinfo='$i_langinfo'
23399 i_libutil='$i_libutil'
23400 i_limits='$i_limits'
23401 i_locale='$i_locale'
23402 i_machcthr='$i_machcthr'
23403 i_malloc='$i_malloc'
23404 i_mallocmalloc='$i_mallocmalloc'
23405 i_math='$i_math'
23406 i_memory='$i_memory'
23407 i_mntent='$i_mntent'
23408 i_ndbm='$i_ndbm'
23409 i_netdb='$i_netdb'
23410 i_neterrno='$i_neterrno'
23411 i_netinettcp='$i_netinettcp'
23412 i_niin='$i_niin'
23413 i_poll='$i_poll'
23414 i_prot='$i_prot'
23415 i_pthread='$i_pthread'
23416 i_pwd='$i_pwd'
23417 i_rpcsvcdbm='$i_rpcsvcdbm'
23418 i_sfio='$i_sfio'
23419 i_sgtty='$i_sgtty'
23420 i_shadow='$i_shadow'
23421 i_socks='$i_socks'
23422 i_stdarg='$i_stdarg'
23423 i_stdbool='$i_stdbool'
23424 i_stddef='$i_stddef'
23425 i_stdlib='$i_stdlib'
23426 i_string='$i_string'
23427 i_sunmath='$i_sunmath'
23428 i_sysaccess='$i_sysaccess'
23429 i_sysdir='$i_sysdir'
23430 i_sysfile='$i_sysfile'
23431 i_sysfilio='$i_sysfilio'
23432 i_sysin='$i_sysin'
23433 i_sysioctl='$i_sysioctl'
23434 i_syslog='$i_syslog'
23435 i_sysmman='$i_sysmman'
23436 i_sysmode='$i_sysmode'
23437 i_sysmount='$i_sysmount'
23438 i_sysndir='$i_sysndir'
23439 i_sysparam='$i_sysparam'
23440 i_syspoll='$i_syspoll'
23441 i_sysresrc='$i_sysresrc'
23442 i_syssecrt='$i_syssecrt'
23443 i_sysselct='$i_sysselct'
23444 i_syssockio='$i_syssockio'
23445 i_sysstat='$i_sysstat'
23446 i_sysstatfs='$i_sysstatfs'
23447 i_sysstatvfs='$i_sysstatvfs'
23448 i_systime='$i_systime'
23449 i_systimek='$i_systimek'
23450 i_systimes='$i_systimes'
23451 i_systypes='$i_systypes'
23452 i_sysuio='$i_sysuio'
23453 i_sysun='$i_sysun'
23454 i_sysutsname='$i_sysutsname'
23455 i_sysvfs='$i_sysvfs'
23456 i_syswait='$i_syswait'
23457 i_termio='$i_termio'
23458 i_termios='$i_termios'
23459 i_time='$i_time'
23460 i_unistd='$i_unistd'
23461 i_ustat='$i_ustat'
23462 i_utime='$i_utime'
23463 i_values='$i_values'
23464 i_varargs='$i_varargs'
23465 i_varhdr='$i_varhdr'
23466 i_vfork='$i_vfork'
23467 ignore_versioned_solibs='$ignore_versioned_solibs'
23468 inc_version_list='$inc_version_list'
23469 inc_version_list_init='$inc_version_list_init'
23470 incpath='$incpath'
23471 inews='$inews'
23472 initialinstalllocation='$initialinstalllocation'
23473 installarchlib='$installarchlib'
23474 installbin='$installbin'
23475 installhtml1dir='$installhtml1dir'
23476 installhtml3dir='$installhtml3dir'
23477 installman1dir='$installman1dir'
23478 installman3dir='$installman3dir'
23479 installprefix='$installprefix'
23480 installprefixexp='$installprefixexp'
23481 installprivlib='$installprivlib'
23482 installscript='$installscript'
23483 installsitearch='$installsitearch'
23484 installsitebin='$installsitebin'
23485 installsitehtml1dir='$installsitehtml1dir'
23486 installsitehtml3dir='$installsitehtml3dir'
23487 installsitelib='$installsitelib'
23488 installsiteman1dir='$installsiteman1dir'
23489 installsiteman3dir='$installsiteman3dir'
23490 installsitescript='$installsitescript'
23491 installstyle='$installstyle'
23492 installusrbinperl='$installusrbinperl'
23493 installvendorarch='$installvendorarch'
23494 installvendorbin='$installvendorbin'
23495 installvendorhtml1dir='$installvendorhtml1dir'
23496 installvendorhtml3dir='$installvendorhtml3dir'
23497 installvendorlib='$installvendorlib'
23498 installvendorman1dir='$installvendorman1dir'
23499 installvendorman3dir='$installvendorman3dir'
23500 installvendorscript='$installvendorscript'
23501 intsize='$intsize'
23502 issymlink='$issymlink'
23503 ivdformat='$ivdformat'
23504 ivsize='$ivsize'
23505 ivtype='$ivtype'
23506 known_extensions='$known_extensions'
23507 ksh='$ksh'
23508 ld='$ld'
23509 ld_can_script='$ld_can_script'
23510 lddlflags='$lddlflags'
23511 ldflags='$ldflags'
23512 ldflags_uselargefiles='$ldflags_uselargefiles'
23513 ldlibpthname='$ldlibpthname'
23514 less='$less'
23515 lib_ext='$lib_ext'
23516 libc='$libc'
23517 libperl='$libperl'
23518 libpth='$libpth'
23519 libs='$libs'
23520 libsdirs='$libsdirs'
23521 libsfiles='$libsfiles'
23522 libsfound='$libsfound'
23523 libspath='$libspath'
23524 libswanted='$libswanted'
23525 libswanted_uselargefiles='$libswanted_uselargefiles'
23526 line='$line'
23527 lint='$lint'
23528 lkflags='$lkflags'
23529 ln='$ln'
23530 lns='$lns'
23531 localtime_r_proto='$localtime_r_proto'
23532 locincpth='$locincpth'
23533 loclibpth='$loclibpth'
23534 longdblsize='$longdblsize'
23535 longlongsize='$longlongsize'
23536 longsize='$longsize'
23537 lp='$lp'
23538 lpr='$lpr'
23539 ls='$ls'
23540 lseeksize='$lseeksize'
23541 lseektype='$lseektype'
23542 mad='$mad'
23543 madlyh='$madlyh'
23544 madlyobj='$madlyobj'
23545 madlysrc='$madlysrc'
23546 mail='$mail'
23547 mailx='$mailx'
23548 make='$make'
23549 make_set_make='$make_set_make'
23550 mallocobj='$mallocobj'
23551 mallocsrc='$mallocsrc'
23552 malloctype='$malloctype'
23553 man1dir='$man1dir'
23554 man1direxp='$man1direxp'
23555 man1ext='$man1ext'
23556 man3dir='$man3dir'
23557 man3direxp='$man3direxp'
23558 man3ext='$man3ext'
23559 mips_type='$mips_type'
23560 mistrustnm='$mistrustnm'
23561 mkdir='$mkdir'
23562 mmaptype='$mmaptype'
23563 modetype='$modetype'
23564 more='$more'
23565 multiarch='$multiarch'
23566 mv='$mv'
23567 myarchname='$myarchname'
23568 mydomain='$mydomain'
23569 myhostname='$myhostname'
23570 myuname='$myuname'
23571 n='$n'
23572 need_va_copy='$need_va_copy'
23573 netdb_hlen_type='$netdb_hlen_type'
23574 netdb_host_type='$netdb_host_type'
23575 netdb_name_type='$netdb_name_type'
23576 netdb_net_type='$netdb_net_type'
23577 nm='$nm'
23578 nm_opt='$nm_opt'
23579 nm_so_opt='$nm_so_opt'
23580 nonxs_ext='$nonxs_ext'
23581 nroff='$nroff'
23582 nvEUformat='$nvEUformat'
23583 nvFUformat='$nvFUformat'
23584 nvGUformat='$nvGUformat'
23585 nv_overflows_integers_at='$nv_overflows_integers_at'
23586 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23587 nveformat='$nveformat'
23588 nvfformat='$nvfformat'
23589 nvgformat='$nvgformat'
23590 nvsize='$nvsize'
23591 nvtype='$nvtype'
23592 o_nonblock='$o_nonblock'
23593 obj_ext='$obj_ext'
23594 old_pthread_create_joinable='$old_pthread_create_joinable'
23595 optimize='$optimize'
23596 orderlib='$orderlib'
23597 osname='$osname'
23598 osvers='$osvers'
23599 otherlibdirs='$otherlibdirs'
23600 package='$package'
23601 pager='$pager'
23602 passcat='$passcat'
23603 patchlevel='$patchlevel'
23604 path_sep='$path_sep'
23605 perl5='$perl5'
23606 perl='$perl'
23607 perl_patchlevel='$perl_patchlevel'
23608 perl_static_inline='$perl_static_inline'
23609 perladmin='$perladmin'
23610 perllibs='$perllibs'
23611 perlpath='$perlpath'
23612 pg='$pg'
23613 phostname='$phostname'
23614 pidtype='$pidtype'
23615 plibpth='$plibpth'
23616 pmake='$pmake'
23617 pr='$pr'
23618 prefix='$prefix'
23619 prefixexp='$prefixexp'
23620 privlib='$privlib'
23621 privlibexp='$privlibexp'
23622 procselfexe='$procselfexe'
23623 prototype='$prototype'
23624 ptrsize='$ptrsize'
23625 quadkind='$quadkind'
23626 quadtype='$quadtype'
23627 randbits='$randbits'
23628 randfunc='$randfunc'
23629 random_r_proto='$random_r_proto'
23630 randseedtype='$randseedtype'
23631 ranlib='$ranlib'
23632 rd_nodata='$rd_nodata'
23633 readdir64_r_proto='$readdir64_r_proto'
23634 readdir_r_proto='$readdir_r_proto'
23635 revision='$revision'
23636 rm='$rm'
23637 rm_try='$rm_try'
23638 rmail='$rmail'
23639 run='$run'
23640 runnm='$runnm'
23641 sGMTIME_max='$sGMTIME_max'
23642 sGMTIME_min='$sGMTIME_min'
23643 sLOCALTIME_max='$sLOCALTIME_max'
23644 sLOCALTIME_min='$sLOCALTIME_min'
23645 sPRIEUldbl='$sPRIEUldbl'
23646 sPRIFUldbl='$sPRIFUldbl'
23647 sPRIGUldbl='$sPRIGUldbl'
23648 sPRIXU64='$sPRIXU64'
23649 sPRId64='$sPRId64'
23650 sPRIeldbl='$sPRIeldbl'
23651 sPRIfldbl='$sPRIfldbl'
23652 sPRIgldbl='$sPRIgldbl'
23653 sPRIi64='$sPRIi64'
23654 sPRIo64='$sPRIo64'
23655 sPRIu64='$sPRIu64'
23656 sPRIx64='$sPRIx64'
23657 sSCNfldbl='$sSCNfldbl'
23658 sched_yield='$sched_yield'
23659 scriptdir='$scriptdir'
23660 scriptdirexp='$scriptdirexp'
23661 sed='$sed'
23662 seedfunc='$seedfunc'
23663 selectminbits='$selectminbits'
23664 selecttype='$selecttype'
23665 sendmail='$sendmail'
23666 setgrent_r_proto='$setgrent_r_proto'
23667 sethostent_r_proto='$sethostent_r_proto'
23668 setlocale_r_proto='$setlocale_r_proto'
23669 setnetent_r_proto='$setnetent_r_proto'
23670 setprotoent_r_proto='$setprotoent_r_proto'
23671 setpwent_r_proto='$setpwent_r_proto'
23672 setservent_r_proto='$setservent_r_proto'
23673 sh='$sh'
23674 shar='$shar'
23675 sharpbang='$sharpbang'
23676 shmattype='$shmattype'
23677 shortsize='$shortsize'
23678 shrpenv='$shrpenv'
23679 shsharp='$shsharp'
23680 sig_count='$sig_count'
23681 sig_name='$sig_name'
23682 sig_name_init='$sig_name_init'
23683 sig_num='$sig_num'
23684 sig_num_init='$sig_num_init'
23685 sig_size='$sig_size'
23686 signal_t='$signal_t'
23687 sitearch='$sitearch'
23688 sitearchexp='$sitearchexp'
23689 sitebin='$sitebin'
23690 sitebinexp='$sitebinexp'
23691 sitehtml1dir='$sitehtml1dir'
23692 sitehtml1direxp='$sitehtml1direxp'
23693 sitehtml3dir='$sitehtml3dir'
23694 sitehtml3direxp='$sitehtml3direxp'
23695 sitelib='$sitelib'
23696 sitelib_stem='$sitelib_stem'
23697 sitelibexp='$sitelibexp'
23698 siteman1dir='$siteman1dir'
23699 siteman1direxp='$siteman1direxp'
23700 siteman3dir='$siteman3dir'
23701 siteman3direxp='$siteman3direxp'
23702 siteprefix='$siteprefix'
23703 siteprefixexp='$siteprefixexp'
23704 sitescript='$sitescript'
23705 sitescriptexp='$sitescriptexp'
23706 sizesize='$sizesize'
23707 sizetype='$sizetype'
23708 sleep='$sleep'
23709 smail='$smail'
23710 so='$so'
23711 sockethdr='$sockethdr'
23712 socketlib='$socketlib'
23713 socksizetype='$socksizetype'
23714 sort='$sort'
23715 spackage='$spackage'
23716 spitshell='$spitshell'
23717 srand48_r_proto='$srand48_r_proto'
23718 srandom_r_proto='$srandom_r_proto'
23719 src='$src'
23720 ssizetype='$ssizetype'
23721 st_ino_sign='$st_ino_sign'
23722 st_ino_size='$st_ino_size'
23723 startperl='$startperl'
23724 startsh='$startsh'
23725 static_ext='$static_ext'
23726 stdchar='$stdchar'
23727 stdio_base='$stdio_base'
23728 stdio_bufsiz='$stdio_bufsiz'
23729 stdio_cnt='$stdio_cnt'
23730 stdio_filbuf='$stdio_filbuf'
23731 stdio_ptr='$stdio_ptr'
23732 stdio_stream_array='$stdio_stream_array'
23733 strerror_r_proto='$strerror_r_proto'
23734 strings='$strings'
23735 submit='$submit'
23736 subversion='$subversion'
23737 sysman='$sysman'
23738 tail='$tail'
23739 tar='$tar'
23740 targetarch='$targetarch'
23741 tbl='$tbl'
23742 tee='$tee'
23743 test='$test'
23744 timeincl='$timeincl'
23745 timetype='$timetype'
23746 tmpnam_r_proto='$tmpnam_r_proto'
23747 to='$to'
23748 touch='$touch'
23749 tr='$tr'
23750 trnl='$trnl'
23751 troff='$troff'
23752 ttyname_r_proto='$ttyname_r_proto'
23753 u16size='$u16size'
23754 u16type='$u16type'
23755 u32size='$u32size'
23756 u32type='$u32type'
23757 u64size='$u64size'
23758 u64type='$u64type'
23759 u8size='$u8size'
23760 u8type='$u8type'
23761 uidformat='$uidformat'
23762 uidsign='$uidsign'
23763 uidsize='$uidsize'
23764 uidtype='$uidtype'
23765 uname='$uname'
23766 uniq='$uniq'
23767 uquadtype='$uquadtype'
23768 use5005threads='$use5005threads'
23769 use64bitall='$use64bitall'
23770 use64bitint='$use64bitint'
23771 usecrosscompile='$usecrosscompile'
23772 usedevel='$usedevel'
23773 usedl='$usedl'
23774 usedtrace='$usedtrace'
23775 usefaststdio='$usefaststdio'
23776 useithreads='$useithreads'
23777 usekernprocpathname='$usekernprocpathname'
23778 uselargefiles='$uselargefiles'
23779 uselongdouble='$uselongdouble'
23780 usemallocwrap='$usemallocwrap'
23781 usemorebits='$usemorebits'
23782 usemultiplicity='$usemultiplicity'
23783 usemymalloc='$usemymalloc'
23784 usenm='$usenm'
23785 usensgetexecutablepath='$usensgetexecutablepath'
23786 useopcode='$useopcode'
23787 useperlio='$useperlio'
23788 useposix='$useposix'
23789 usereentrant='$usereentrant'
23790 userelocatableinc='$userelocatableinc'
23791 usesfio='$usesfio'
23792 useshrplib='$useshrplib'
23793 usesitecustomize='$usesitecustomize'
23794 usesocks='$usesocks'
23795 usethreads='$usethreads'
23796 usevendorprefix='$usevendorprefix'
23797 usevfork='$usevfork'
23798 usrinc='$usrinc'
23799 uuname='$uuname'
23800 uvXUformat='$uvXUformat'
23801 uvoformat='$uvoformat'
23802 uvsize='$uvsize'
23803 uvtype='$uvtype'
23804 uvuformat='$uvuformat'
23805 uvxformat='$uvxformat'
23806 vaproto='$vaproto'
23807 vendorarch='$vendorarch'
23808 vendorarchexp='$vendorarchexp'
23809 vendorbin='$vendorbin'
23810 vendorbinexp='$vendorbinexp'
23811 vendorhtml1dir='$vendorhtml1dir'
23812 vendorhtml1direxp='$vendorhtml1direxp'
23813 vendorhtml3dir='$vendorhtml3dir'
23814 vendorhtml3direxp='$vendorhtml3direxp'
23815 vendorlib='$vendorlib'
23816 vendorlib_stem='$vendorlib_stem'
23817 vendorlibexp='$vendorlibexp'
23818 vendorman1dir='$vendorman1dir'
23819 vendorman1direxp='$vendorman1direxp'
23820 vendorman3dir='$vendorman3dir'
23821 vendorman3direxp='$vendorman3direxp'
23822 vendorprefix='$vendorprefix'
23823 vendorprefixexp='$vendorprefixexp'
23824 vendorscript='$vendorscript'
23825 vendorscriptexp='$vendorscriptexp'
23826 version='$version'
23827 version_patchlevel_string='$version_patchlevel_string'
23828 versiononly='$versiononly'
23829 vi='$vi'
23830 voidflags='$voidflags'
23831 xlibpth='$xlibpth'
23832 yacc='$yacc'
23833 yaccflags='$yaccflags'
23834 zcat='$zcat'
23835 zip='$zip'
23836 EOT
23837
23838 : add special variables
23839 $test -f $src/patchlevel.h && \
23840 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23841 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23842 echo "PERL_CONFIG_SH=true" >>config.sh
23843
23844 : propagate old symbols
23845 if $test -f UU/config.sh; then
23846         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23847         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23848                 config.sh config.sh UU/oldconfig.sh |\
23849                 $sort | $uniq -u >UU/oldsyms
23850         set X `$cat UU/oldsyms`
23851         shift
23852         case $# in
23853         0) ;;
23854         *)
23855                 $cat <<EOM
23856 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23857 EOM
23858                 echo ": Variables propagated from previous config.sh file." >>config.sh
23859                 for sym in `$cat UU/oldsyms`; do
23860                         echo "    Propagating $hint variable "'$'"$sym..."
23861                         eval 'tmp="$'"${sym}"'"'
23862                         echo "$tmp" | \
23863                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23864                 done
23865                 ;;
23866         esac
23867 fi
23868
23869 : Finish up by extracting the .SH files
23870 case "$alldone" in
23871 exit)
23872         $rm -rf UU
23873         echo "Extraction done."
23874         exit 0
23875         ;;
23876 cont)
23877         ;;
23878 '')
23879         dflt=''
23880         nostick=true
23881         $cat <<EOM
23882
23883 If you'd like to make any changes to the config.sh file before I begin
23884 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23885
23886 EOM
23887         rp="Press return or use a shell escape to edit config.sh:"
23888         . UU/myread
23889         nostick=''
23890         case "$ans" in
23891         '') ;;
23892         *) : in case they cannot read
23893                 sh 1>&4 -c "$ans";;
23894         esac
23895         ;;
23896 esac
23897
23898 : if this fails, just run all the .SH files by hand
23899 . ./config.sh
23900
23901 echo " "
23902 exec 1>&4
23903 pwd=`pwd`
23904 . ./UU/extract
23905 cd "$pwd"
23906
23907 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23908         dflt=y
23909         case "$silent" in
23910         true) ;;
23911         *)
23912                 $cat <<EOM
23913
23914 Now you need to generate make dependencies by running "$make depend".
23915 You might prefer to run it in background: "$make depend > makedepend.out &"
23916 It can take a while, so you might not want to run it right now.
23917
23918 EOM
23919                 ;;
23920         esac
23921         rp="Run $make depend now?"
23922         . UU/myread
23923         case "$ans" in
23924         y*)
23925                 $make depend && echo "Now you must run '$make'."
23926                 ;;
23927         *)
23928                 echo "You must run '$make depend' then '$make'."
23929                 ;;
23930         esac
23931 elif test -f [Mm]akefile; then
23932         echo " "
23933         echo "Now you must run a $make."
23934 else
23935         echo "Configure done."
23936 fi
23937
23938 if $test -f Policy.sh; then
23939     $cat <<EOM
23940
23941 If you compile $package on a different machine or from a different object
23942 directory, copy the Policy.sh file from this object directory to the
23943 new one before you run Configure -- this will help you with most of
23944 the policy defaults.
23945
23946 EOM
23947 fi
23948 if $test -f config.msg; then
23949     echo "Hmm.  I also noted the following information while running:"
23950     echo " "
23951     $cat config.msg >&4
23952     $rm -f config.msg
23953 fi
23954 $rm -f kit*isdone ark*isdone
23955 $rm -rf UU
23956
23957 : End of Configure
23958