This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
vutil.c, vxs.inc: Avoid warnings from -Wmissing-prototypes -Wundef -Wunused-label
[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.code.sf.net/p/dist/code/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated on Wed Jan 22 12:03:46 CET 2014 [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|*msys) ;;
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 targetdir=''
212 targetenv=''
213 targethost=''
214 targetmkdir=''
215 targetport=''
216 to=''
217 usecrosscompile=''
218 hostperl=''
219 hostgenerate=''
220 hostosname=''
221 targetsh=''
222 extern_C=''
223 mistrustnm=''
224 usedevel=''
225 perllibs=''
226 dynamic_ext=''
227 extensions=''
228 known_extensions=''
229 nonxs_ext=''
230 static_ext=''
231 useopcode=''
232 useposix=''
233 extras=''
234 d_bsd=''
235 d_eunice=''
236 d_xenix=''
237 eunicefix=''
238 ar=''
239 awk=''
240 bash=''
241 bison=''
242 byacc=''
243 cat=''
244 chgrp=''
245 chmod=''
246 chown=''
247 comm=''
248 compress=''
249 cp=''
250 cpio=''
251 cpp=''
252 csh=''
253 date=''
254 echo=''
255 egrep=''
256 emacs=''
257 expr=''
258 find=''
259 flex=''
260 gmake=''
261 grep=''
262 gzip=''
263 inews=''
264 ksh=''
265 less=''
266 line=''
267 lint=''
268 ln=''
269 lp=''
270 lpr=''
271 ls=''
272 mail=''
273 mailx=''
274 make=''
275 mkdir=''
276 more=''
277 mv=''
278 nm=''
279 nroff=''
280 perl=''
281 pg=''
282 pmake=''
283 pr=''
284 rm=''
285 rmail=''
286 sed=''
287 sendmail=''
288 shar=''
289 sleep=''
290 smail=''
291 sort=''
292 submit=''
293 tail=''
294 tar=''
295 tbl=''
296 tee=''
297 test=''
298 touch=''
299 tr=''
300 troff=''
301 uname=''
302 uniq=''
303 uuname=''
304 vi=''
305 zcat=''
306 zip=''
307 full_ar=''
308 full_sed=''
309 libswanted=''
310 hint=''
311 myuname=''
312 osname=''
313 osvers=''
314 Author=''
315 Date=''
316 Header=''
317 Id=''
318 Locker=''
319 Log=''
320 RCSfile=''
321 Revision=''
322 Source=''
323 State=''
324 sysroot=''
325 _a=''
326 _exe=''
327 _o=''
328 archobjs=''
329 exe_ext=''
330 firstmakefile=''
331 lib_ext=''
332 obj_ext=''
333 path_sep=''
334 rm_try=''
335 afs=''
336 afsroot=''
337 alignbytes=''
338 ansi2knr=''
339 archlib=''
340 archlibexp=''
341 d_archlib=''
342 installarchlib=''
343 archname=''
344 myarchname=''
345 useversionedarchname=''
346 d_atolf=''
347 d_atoll=''
348 baserev=''
349 bin=''
350 binexp=''
351 initialinstalllocation=''
352 installbin=''
353 userelocatableinc=''
354 byteorder=''
355 cc=''
356 ccflags=''
357 cppflags=''
358 ldflags=''
359 lkflags=''
360 locincpth=''
361 optimize=''
362 cf_email=''
363 cf_by=''
364 cf_time=''
365 charbits=''
366 charsize=''
367 contains=''
368 cpp_stuff=''
369 cpplast=''
370 cppminus=''
371 cpprun=''
372 cppstdin=''
373 d__fwalk=''
374 d_access=''
375 d_accessx=''
376 d_aintl=''
377 d_alarm=''
378 asctime_r_proto=''
379 d_asctime_r=''
380 d_attribute_deprecated=''
381 d_attribute_format=''
382 d_attribute_malloc=''
383 d_attribute_nonnull=''
384 d_attribute_noreturn=''
385 d_attribute_pure=''
386 d_attribute_unused=''
387 d_attribute_warn_unused_result=''
388 d_printf_format_null=''
389 d_bcmp=''
390 d_bcopy=''
391 d_builtin_choose_expr=''
392 d_builtin_expect=''
393 d_bzero=''
394 d_c99_variadic_macros=''
395 d_casti32=''
396 castflags=''
397 d_castneg=''
398 d_chown=''
399 d_chroot=''
400 d_chsize=''
401 d_class=''
402 d_clearenv=''
403 d_closedir=''
404 d_void_closedir=''
405 d_cmsghdr_s=''
406 d_const=''
407 d_copysignl=''
408 d_cplusplus=''
409 cryptlib=''
410 d_crypt=''
411 crypt_r_proto=''
412 d_crypt_r=''
413 d_csh=''
414 full_csh=''
415 d_ctermid=''
416 ctermid_r_proto=''
417 d_ctermid_r=''
418 ctime_r_proto=''
419 d_ctime_r=''
420 d_cuserid=''
421 d_dbl_dig=''
422 d_dbminitproto=''
423 d_difftime=''
424 d_dir_dd_fd=''
425 d_dirfd=''
426 d_dlerror=''
427 d_dlopen=''
428 d_dlsymun=''
429 d_dosuid=''
430 d_suidsafe=''
431 d_drand48_r=''
432 drand48_r_proto=''
433 d_drand48proto=''
434 d_dup2=''
435 d_eaccess=''
436 d_endgrent=''
437 d_endgrent_r=''
438 endgrent_r_proto=''
439 d_endhent=''
440 d_endhostent_r=''
441 endhostent_r_proto=''
442 d_endnent=''
443 d_endnetent_r=''
444 endnetent_r_proto=''
445 d_endpent=''
446 d_endprotoent_r=''
447 endprotoent_r_proto=''
448 d_endpwent=''
449 d_endpwent_r=''
450 endpwent_r_proto=''
451 d_endsent=''
452 d_endservent_r=''
453 endservent_r_proto=''
454 d_faststdio=''
455 d_fchdir=''
456 d_fchmod=''
457 d_fchown=''
458 d_fcntl=''
459 d_fcntl_can_lock=''
460 d_fd_macros=''
461 d_fd_set=''
462 d_fds_bits=''
463 d_fgetpos=''
464 d_finite=''
465 d_finitel=''
466 d_flexfnam=''
467 d_flock=''
468 d_flockproto=''
469 d_fork=''
470 d_fp_class=''
471 d_fpclass=''
472 d_fpclassify=''
473 d_fpclassl=''
474 d_fpos64_t=''
475 d_frexpl=''
476 d_fs_data_s=''
477 d_fseeko=''
478 d_fsetpos=''
479 d_fstatfs=''
480 d_fsync=''
481 d_ftello=''
482 d_ftime=''
483 d_gettimeod=''
484 d_futimes=''
485 d_Gconvert=''
486 d_getaddrinfo=''
487 d_getcwd=''
488 d_getespwnam=''
489 d_getfsstat=''
490 d_getgrent=''
491 d_getgrent_r=''
492 getgrent_r_proto=''
493 d_getgrgid_r=''
494 getgrgid_r_proto=''
495 d_getgrnam_r=''
496 getgrnam_r_proto=''
497 d_getgrps=''
498 d_gethbyaddr=''
499 d_gethbyname=''
500 d_gethent=''
501 aphostname=''
502 d_gethname=''
503 d_phostname=''
504 d_uname=''
505 d_gethostbyaddr_r=''
506 gethostbyaddr_r_proto=''
507 d_gethostbyname_r=''
508 gethostbyname_r_proto=''
509 d_gethostent_r=''
510 gethostent_r_proto=''
511 d_gethostprotos=''
512 d_getitimer=''
513 d_getlogin=''
514 d_getlogin_r=''
515 getlogin_r_proto=''
516 d_getmnt=''
517 d_getmntent=''
518 d_getnameinfo=''
519 d_getnbyaddr=''
520 d_getnbyname=''
521 d_getnent=''
522 d_getnetbyaddr_r=''
523 getnetbyaddr_r_proto=''
524 d_getnetbyname_r=''
525 getnetbyname_r_proto=''
526 d_getnetent_r=''
527 getnetent_r_proto=''
528 d_getnetprotos=''
529 d_getpagsz=''
530 d_getpent=''
531 d_getpgid=''
532 d_getpgrp2=''
533 d_bsdgetpgrp=''
534 d_getpgrp=''
535 d_getppid=''
536 d_getprior=''
537 d_getpbyname=''
538 d_getpbynumber=''
539 d_getprotobyname_r=''
540 getprotobyname_r_proto=''
541 d_getprotobynumber_r=''
542 getprotobynumber_r_proto=''
543 d_getprotoent_r=''
544 getprotoent_r_proto=''
545 d_getprotoprotos=''
546 d_getprpwnam=''
547 d_getpwent=''
548 d_getpwent_r=''
549 getpwent_r_proto=''
550 d_getpwnam_r=''
551 getpwnam_r_proto=''
552 d_getpwuid_r=''
553 getpwuid_r_proto=''
554 d_getsent=''
555 d_getservbyname_r=''
556 getservbyname_r_proto=''
557 d_getservbyport_r=''
558 getservbyport_r_proto=''
559 d_getservent_r=''
560 getservent_r_proto=''
561 d_getservprotos=''
562 d_getspnam=''
563 d_getspnam_r=''
564 getspnam_r_proto=''
565 d_getsbyname=''
566 d_getsbyport=''
567 d_gmtime_r=''
568 gmtime_r_proto=''
569 d_gnulibc=''
570 gnulibc_version=''
571 d_hasmntopt=''
572 d_htonl=''
573 d_ilogbl=''
574 d_inetaton=''
575 d_inetntop=''
576 d_inetpton=''
577 d_int64_t=''
578 d_isascii=''
579 d_isblank=''
580 d_isfinite=''
581 d_isinf=''
582 d_isnan=''
583 d_isnanl=''
584 d_killpg=''
585 d_lchown=''
586 d_ldbl_dig=''
587 d_libm_lib_version=''
588 d_link=''
589 d_localtime_r=''
590 d_localtime_r_needs_tzset=''
591 localtime_r_proto=''
592 d_locconv=''
593 d_lockf=''
594 d_longdbl=''
595 longdblsize=''
596 d_longlong=''
597 longlongsize=''
598 d_lseekproto=''
599 d_lstat=''
600 d_madvise=''
601 d_malloc_good_size=''
602 d_malloc_size=''
603 d_mblen=''
604 d_mbstowcs=''
605 d_mbtowc=''
606 d_memchr=''
607 d_memcmp=''
608 d_memcpy=''
609 d_memmove=''
610 d_memset=''
611 d_mkdir=''
612 d_mkdtemp=''
613 d_mkfifo=''
614 d_mkstemp=''
615 d_mkstemps=''
616 d_mktime=''
617 d_mmap=''
618 mmaptype=''
619 d_modfl=''
620 d_modfl_pow32_bug=''
621 d_modflproto=''
622 d_mprotect=''
623 d_msg=''
624 d_msgctl=''
625 d_msgget=''
626 d_msghdr_s=''
627 d_msgrcv=''
628 d_msgsnd=''
629 d_msync=''
630 d_munmap=''
631 d_nice=''
632 d_nl_langinfo=''
633 d_off64_t=''
634 d_open3=''
635 d_fpathconf=''
636 d_pathconf=''
637 d_pause=''
638 d_pipe=''
639 d_poll=''
640 d_portable=''
641 d_prctl=''
642 d_prctl_set_name=''
643 d_procselfexe=''
644 procselfexe=''
645 d_old_pthread_create_joinable=''
646 old_pthread_create_joinable=''
647 d_pthread_atfork=''
648 d_pthread_attr_setscope=''
649 d_pthread_yield=''
650 d_sched_yield=''
651 sched_yield=''
652 d_qgcvt=''
653 d_random_r=''
654 random_r_proto=''
655 d_readdir64_r=''
656 readdir64_r_proto=''
657 d_readdir=''
658 d_rewinddir=''
659 d_seekdir=''
660 d_telldir=''
661 d_readdir_r=''
662 readdir_r_proto=''
663 d_readlink=''
664 d_readv=''
665 d_recvmsg=''
666 d_rename=''
667 d_rmdir=''
668 d_safebcpy=''
669 d_safemcpy=''
670 d_sanemcmp=''
671 d_sbrkproto=''
672 d_scalbnl=''
673 d_select=''
674 d_sem=''
675 d_semctl=''
676 d_semget=''
677 d_semop=''
678 d_sendmsg=''
679 d_setegid=''
680 d_seteuid=''
681 d_setgrent=''
682 d_setgrent_r=''
683 setgrent_r_proto=''
684 d_setgrps=''
685 d_sethent=''
686 d_sethostent_r=''
687 sethostent_r_proto=''
688 d_setitimer=''
689 d_setlinebuf=''
690 d_setlocale=''
691 d_setlocale_r=''
692 setlocale_r_proto=''
693 d_setnent=''
694 d_setnetent_r=''
695 setnetent_r_proto=''
696 d_setpent=''
697 d_setpgid=''
698 d_setpgrp2=''
699 d_bsdsetpgrp=''
700 d_setpgrp=''
701 d_setprior=''
702 d_setproctitle=''
703 d_setprotoent_r=''
704 setprotoent_r_proto=''
705 d_setpwent=''
706 d_setpwent_r=''
707 setpwent_r_proto=''
708 d_setregid=''
709 d_setresgid=''
710 d_setresuid=''
711 d_setreuid=''
712 d_setrgid=''
713 d_setruid=''
714 d_setsent=''
715 d_setservent_r=''
716 setservent_r_proto=''
717 d_setsid=''
718 d_setvbuf=''
719 d_shm=''
720 d_shmat=''
721 d_shmatprototype=''
722 shmattype=''
723 d_shmctl=''
724 d_shmdt=''
725 d_shmget=''
726 d_sigaction=''
727 d_signbit=''
728 d_sigprocmask=''
729 d_sigsetjmp=''
730 usesitecustomize=''
731 d_snprintf=''
732 d_vsnprintf=''
733 d_sockatmark=''
734 d_sockatmarkproto=''
735 d_ip_mreq=''
736 d_ip_mreq_source=''
737 d_ipv6_mreq=''
738 d_ipv6_mreq_source=''
739 d_msg_ctrunc=''
740 d_msg_dontroute=''
741 d_msg_oob=''
742 d_msg_peek=''
743 d_msg_proxy=''
744 d_oldsock=''
745 d_scm_rights=''
746 d_sin6_scope_id=''
747 d_sockaddr_in6=''
748 d_sockaddr_sa_len=''
749 d_socket=''
750 d_sockpair=''
751 sockethdr=''
752 socketlib=''
753 d_socklen_t=''
754 d_socks5_init=''
755 d_sprintf_returns_strlen=''
756 d_sqrtl=''
757 d_srand48_r=''
758 srand48_r_proto=''
759 d_srandom_r=''
760 srandom_r_proto=''
761 d_sresgproto=''
762 d_sresuproto=''
763 d_statblks=''
764 d_statfs_f_flags=''
765 d_statfs_s=''
766 d_static_inline=''
767 perl_static_inline=''
768 d_fstatvfs=''
769 d_statvfs=''
770 d_stdio_cnt_lval=''
771 d_stdio_ptr_lval=''
772 d_stdio_ptr_lval_nochange_cnt=''
773 d_stdio_ptr_lval_sets_cnt=''
774 d_stdiobase=''
775 d_stdstdio=''
776 stdio_base=''
777 stdio_bufsiz=''
778 stdio_cnt=''
779 stdio_filbuf=''
780 stdio_ptr=''
781 d_index=''
782 d_strchr=''
783 d_strcoll=''
784 d_strctcpy=''
785 d_strerrm=''
786 d_strerror=''
787 d_sysernlst=''
788 d_syserrlst=''
789 d_strerror_r=''
790 strerror_r_proto=''
791 d_strftime=''
792 d_strlcat=''
793 d_strlcpy=''
794 d_strtod=''
795 d_strtol=''
796 d_strtold=''
797 d_strtoll=''
798 d_strtoq=''
799 d_strtoul=''
800 d_strtoull=''
801 d_strtouq=''
802 d_strxfrm=''
803 d_symlink=''
804 d_syscall=''
805 d_syscallproto=''
806 d_sysconf=''
807 d_system=''
808 d_tcgetpgrp=''
809 d_tcsetpgrp=''
810 d_telldirproto=''
811 d_time=''
812 timetype=''
813 d_asctime64=''
814 d_ctime64=''
815 d_difftime64=''
816 d_gmtime64=''
817 d_localtime64=''
818 d_mktime64=''
819 d_timegm=''
820 clocktype=''
821 d_times=''
822 d_tmpnam_r=''
823 tmpnam_r_proto=''
824 d_truncate=''
825 d_ttyname_r=''
826 ttyname_r_proto=''
827 d_tzname=''
828 d_u32align=''
829 d_ualarm=''
830 d_umask=''
831 d_semctl_semid_ds=''
832 d_semctl_semun=''
833 d_union_semun=''
834 d_unordered=''
835 d_unsetenv=''
836 d_usleep=''
837 d_usleepproto=''
838 d_ustat=''
839 d_pseudofork=''
840 d_vfork=''
841 usevfork=''
842 d_voidsig=''
843 signal_t=''
844 d_volatile=''
845 d_charvspr=''
846 d_vprintf=''
847 d_wait4=''
848 d_waitpid=''
849 d_wcstombs=''
850 d_wctomb=''
851 d_writev=''
852 dlext=''
853 bin_ELF=''
854 cccdlflags=''
855 ccdlflags=''
856 dlsrc=''
857 ld=''
858 ld_can_script=''
859 lddlflags=''
860 usedl=''
861 doublesize=''
862 bootstrap_charset=''
863 ebcdic=''
864 fflushNULL=''
865 fflushall=''
866 fpossize=''
867 fpostype=''
868 gccansipedantic=''
869 gccosandvers=''
870 gccversion=''
871 gidformat=''
872 gidsign=''
873 gidsize=''
874 gidtype=''
875 groupstype=''
876 h_fcntl=''
877 h_sysfile=''
878 html1dir=''
879 html1direxp=''
880 installhtml1dir=''
881 html3dir=''
882 html3direxp=''
883 installhtml3dir=''
884 i_arpainet=''
885 i_assert=''
886 i_crypt=''
887 db_hashtype=''
888 db_prefixtype=''
889 db_version_major=''
890 db_version_minor=''
891 db_version_patch=''
892 i_db=''
893 i_dbm=''
894 i_rpcsvcdbm=''
895 d_dirnamlen=''
896 direntrytype=''
897 i_dirent=''
898 i_dlfcn=''
899 i_fcntl=''
900 i_float=''
901 i_fp=''
902 i_fp_class=''
903 i_gdbm=''
904 d_grpasswd=''
905 i_grp=''
906 i_ieeefp=''
907 i_inttypes=''
908 i_langinfo=''
909 i_libutil=''
910 i_limits=''
911 i_locale=''
912 i_machcthr=''
913 i_malloc=''
914 i_mallocmalloc=''
915 i_math=''
916 i_memory=''
917 i_mntent=''
918 d_gdbm_ndbm_h_uses_prototypes=''
919 d_gdbmndbm_h_uses_prototypes=''
920 d_ndbm=''
921 d_ndbm_h_uses_prototypes=''
922 i_gdbm_ndbm=''
923 i_gdbmndbm=''
924 i_ndbm=''
925 i_netdb=''
926 i_neterrno=''
927 i_netinettcp=''
928 i_niin=''
929 i_sysin=''
930 i_poll=''
931 i_prot=''
932 i_pthread=''
933 d_pwage=''
934 d_pwchange=''
935 d_pwclass=''
936 d_pwcomment=''
937 d_pwexpire=''
938 d_pwgecos=''
939 d_pwpasswd=''
940 d_pwquota=''
941 i_pwd=''
942 i_shadow=''
943 i_socks=''
944 i_stdbool=''
945 i_stddef=''
946 i_stdlib=''
947 i_string=''
948 strings=''
949 i_sunmath=''
950 i_sysaccess=''
951 i_sysdir=''
952 i_sysfile=''
953 d_voidtty=''
954 i_bsdioctl=''
955 i_sysfilio=''
956 i_sysioctl=''
957 i_syssockio=''
958 i_syslog=''
959 i_sysmman=''
960 i_sysmode=''
961 i_sysmount=''
962 i_sysndir=''
963 i_sysparam=''
964 i_syspoll=''
965 i_sysresrc=''
966 i_syssecrt=''
967 i_sysselct=''
968 i_sysstat=''
969 i_sysstatfs=''
970 i_sysstatvfs=''
971 i_systimes=''
972 i_systypes=''
973 i_sysuio=''
974 i_sysun=''
975 i_sysutsname=''
976 i_sysvfs=''
977 i_syswait=''
978 i_sgtty=''
979 i_termio=''
980 i_termios=''
981 d_tm_tm_gmtoff=''
982 d_tm_tm_zone=''
983 i_systime=''
984 i_systimek=''
985 i_time=''
986 timeincl=''
987 i_unistd=''
988 i_ustat=''
989 i_utime=''
990 i_values=''
991 i_stdarg=''
992 i_varargs=''
993 i_varhdr=''
994 i_vfork=''
995 d_inc_version_list=''
996 inc_version_list=''
997 inc_version_list_init=''
998 installprefix=''
999 installprefixexp=''
1000 installstyle=''
1001 installusrbinperl=''
1002 intsize=''
1003 longsize=''
1004 shortsize=''
1005 issymlink=''
1006 libc=''
1007 ldlibpthname=''
1008 libperl=''
1009 shrpenv=''
1010 useshrplib=''
1011 glibpth=''
1012 incpth=''
1013 libpth=''
1014 loclibpth=''
1015 plibpth=''
1016 xlibpth=''
1017 ignore_versioned_solibs=''
1018 libs=''
1019 libsdirs=''
1020 libsfiles=''
1021 libsfound=''
1022 libspath=''
1023 lns=''
1024 d_PRIEUldbl=''
1025 d_PRIFUldbl=''
1026 d_PRIGUldbl=''
1027 d_PRIeldbl=''
1028 d_PRIfldbl=''
1029 d_PRIgldbl=''
1030 d_SCNfldbl=''
1031 sPRIEUldbl=''
1032 sPRIFUldbl=''
1033 sPRIGUldbl=''
1034 sPRIeldbl=''
1035 sPRIfldbl=''
1036 sPRIgldbl=''
1037 sSCNfldbl=''
1038 lseeksize=''
1039 lseektype=''
1040 mad=''
1041 madlyh=''
1042 madlyobj=''
1043 madlysrc=''
1044 make_set_make=''
1045 d_mymalloc=''
1046 freetype=''
1047 mallocobj=''
1048 mallocsrc=''
1049 malloctype=''
1050 usemallocwrap=''
1051 usemymalloc=''
1052 installman1dir=''
1053 man1dir=''
1054 man1direxp=''
1055 man1ext=''
1056 installman3dir=''
1057 man3dir=''
1058 man3direxp=''
1059 man3ext=''
1060 modetype=''
1061 multiarch=''
1062 mydomain=''
1063 myhostname=''
1064 phostname=''
1065 c=''
1066 n=''
1067 d_eofnblk=''
1068 eagain=''
1069 o_nonblock=''
1070 rd_nodata=''
1071 need_va_copy=''
1072 netdb_hlen_type=''
1073 netdb_host_type=''
1074 netdb_name_type=''
1075 netdb_net_type=''
1076 groupcat=''
1077 hostcat=''
1078 passcat=''
1079 orderlib=''
1080 ranlib=''
1081 d_perl_otherlibdirs=''
1082 otherlibdirs=''
1083 package=''
1084 spackage=''
1085 pager=''
1086 api_revision=''
1087 api_subversion=''
1088 api_version=''
1089 api_versionstring=''
1090 patchlevel=''
1091 perl_patchlevel=''
1092 revision=''
1093 subversion=''
1094 version=''
1095 version_patchlevel_string=''
1096 perl5=''
1097 perladmin=''
1098 perlpath=''
1099 d_nv_preserves_uv=''
1100 d_nv_zero_is_allbits_zero=''
1101 i16size=''
1102 i16type=''
1103 i32size=''
1104 i32type=''
1105 i64size=''
1106 i64type=''
1107 i8size=''
1108 i8type=''
1109 ivsize=''
1110 ivtype=''
1111 nv_overflows_integers_at=''
1112 nv_preserves_uv_bits=''
1113 nvsize=''
1114 nvtype=''
1115 u16size=''
1116 u16type=''
1117 u32size=''
1118 u32type=''
1119 u64size=''
1120 u64type=''
1121 u8size=''
1122 u8type=''
1123 uvsize=''
1124 uvtype=''
1125 ivdformat=''
1126 nvEUformat=''
1127 nvFUformat=''
1128 nvGUformat=''
1129 nveformat=''
1130 nvfformat=''
1131 nvgformat=''
1132 uvXUformat=''
1133 uvoformat=''
1134 uvuformat=''
1135 uvxformat=''
1136 pidtype=''
1137 prefix=''
1138 prefixexp=''
1139 installprivlib=''
1140 privlib=''
1141 privlibexp=''
1142 prototype=''
1143 ptrsize=''
1144 d_PRIXU64=''
1145 d_PRId64=''
1146 d_PRIi64=''
1147 d_PRIo64=''
1148 d_PRIu64=''
1149 d_PRIx64=''
1150 sPRIXU64=''
1151 sPRId64=''
1152 sPRIi64=''
1153 sPRIo64=''
1154 sPRIu64=''
1155 sPRIx64=''
1156 d_quad=''
1157 quadkind=''
1158 quadtype=''
1159 uquadtype=''
1160 drand01=''
1161 randbits=''
1162 randfunc=''
1163 randseedtype=''
1164 seedfunc=''
1165 installscript=''
1166 scriptdir=''
1167 scriptdirexp=''
1168 selectminbits=''
1169 selecttype=''
1170 sh=''
1171 sig_count=''
1172 sig_name=''
1173 sig_name_init=''
1174 sig_num=''
1175 sig_num_init=''
1176 sig_size=''
1177 d_sitearch=''
1178 installsitearch=''
1179 sitearch=''
1180 sitearchexp=''
1181 installsitebin=''
1182 sitebin=''
1183 sitebinexp=''
1184 installsitehtml1dir=''
1185 sitehtml1dir=''
1186 sitehtml1direxp=''
1187 installsitehtml3dir=''
1188 sitehtml3dir=''
1189 sitehtml3direxp=''
1190 installsitelib=''
1191 sitelib=''
1192 sitelib_stem=''
1193 sitelibexp=''
1194 installsiteman1dir=''
1195 siteman1dir=''
1196 siteman1direxp=''
1197 installsiteman3dir=''
1198 siteman3dir=''
1199 siteman3direxp=''
1200 siteprefix=''
1201 siteprefixexp=''
1202 installsitescript=''
1203 sitescript=''
1204 sitescriptexp=''
1205 sizesize=''
1206 sizetype=''
1207 d_libname_unique=''
1208 so=''
1209 socksizetype=''
1210 sharpbang=''
1211 shsharp=''
1212 spitshell=''
1213 src=''
1214 ssizetype=''
1215 st_ino_sign=''
1216 st_ino_size=''
1217 startperl=''
1218 startsh=''
1219 stdchar=''
1220 d_stdio_stream_array=''
1221 stdio_stream_array=''
1222 sysman=''
1223 sGMTIME_max=''
1224 sGMTIME_min=''
1225 sLOCALTIME_max=''
1226 sLOCALTIME_min=''
1227 trnl=''
1228 uidformat=''
1229 uidsign=''
1230 uidsize=''
1231 uidtype=''
1232 archname64=''
1233 use64bitall=''
1234 use64bitint=''
1235 dtrace=''
1236 usedtrace=''
1237 usefaststdio=''
1238 usekernprocpathname=''
1239 ccflags_uselargefiles=''
1240 ldflags_uselargefiles=''
1241 libswanted_uselargefiles=''
1242 uselargefiles=''
1243 uselongdouble=''
1244 usemorebits=''
1245 usemultiplicity=''
1246 nm_opt=''
1247 nm_so_opt=''
1248 runnm=''
1249 usenm=''
1250 usensgetexecutablepath=''
1251 useperlio=''
1252 usesocks=''
1253 d_oldpthreads=''
1254 use5005threads=''
1255 useithreads=''
1256 usereentrant=''
1257 usethreads=''
1258 incpath=''
1259 mips_type=''
1260 usrinc=''
1261 vaproto=''
1262 d_vendorarch=''
1263 installvendorarch=''
1264 vendorarch=''
1265 vendorarchexp=''
1266 d_vendorbin=''
1267 installvendorbin=''
1268 vendorbin=''
1269 vendorbinexp=''
1270 installvendorhtml1dir=''
1271 vendorhtml1dir=''
1272 vendorhtml1direxp=''
1273 installvendorhtml3dir=''
1274 vendorhtml3dir=''
1275 vendorhtml3direxp=''
1276 d_vendorlib=''
1277 installvendorlib=''
1278 vendorlib=''
1279 vendorlib_stem=''
1280 vendorlibexp=''
1281 installvendorman1dir=''
1282 vendorman1dir=''
1283 vendorman1direxp=''
1284 installvendorman3dir=''
1285 vendorman3dir=''
1286 vendorman3direxp=''
1287 usevendorprefix=''
1288 vendorprefix=''
1289 vendorprefixexp=''
1290 d_vendorscript=''
1291 installvendorscript=''
1292 vendorscript=''
1293 vendorscriptexp=''
1294 versiononly=''
1295 yacc=''
1296 yaccflags=''
1297 CONFIG=''
1298
1299 : Detect odd OSs
1300 define='define'
1301 undef='undef'
1302 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1303 rmlist=''
1304
1305 : We must find out about Eunice early
1306 eunicefix=':'
1307 if test -f /etc/unixtovms; then
1308         eunicefix=/etc/unixtovms
1309 fi
1310 if test -f /etc/unixtovms.exe; then
1311         eunicefix=/etc/unixtovms.exe
1312 fi
1313
1314 : Set executable suffix now -- needed before hints available
1315 if test -f "/libs/version.library"; then
1316 : Amiga OS
1317     _exe=""
1318 elif test -f "/system/gnu_library/bin/ar.pm"; then
1319 : Stratus VOS
1320     _exe=".pm"
1321 elif test -n "$DJGPP"; then
1322 : DOS DJGPP
1323     _exe=".exe"
1324 elif test -f /kern/cookiejar; then
1325 : MiNT
1326     _exe=""
1327 elif test -d c:/. -o -n "$is_os2" ; then
1328 : OS/2 or cygwin
1329     _exe=".exe"
1330 fi
1331
1332 groupstype=''
1333 i_whoami=''
1334 : Trailing extension.  Override this in a hint file, if needed.
1335 : Extra object files, if any, needed on this platform.
1336 archobjs=''
1337 archname=''
1338 : Possible local include directories to search.
1339 : Set locincpth to "" in a hint file to defeat local include searches.
1340 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1341 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1342 :
1343 : no include file wanted by default
1344 inclwanted=''
1345
1346 : Enable -DEBUGGING and -DDEBUGGING from the command line
1347 EBUGGING=''
1348 DEBUGGING=''
1349
1350 libnames=''
1351 : change the next line if compiling for Xenix/286 on Xenix/386
1352 xlibpth='/usr/lib/386 /lib/386'
1353 : Possible local library directories to search.
1354 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1355 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1356
1357 : general looking path for locating libraries
1358 glibpth="/lib /usr/lib $xlibpth"
1359 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1360 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1361 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1362 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1363
1364 : Private path used by Configure to find libraries.  Its value
1365 : is prepended to libpth. This variable takes care of special
1366 : machines, like the mips.  Usually, it should be empty.
1367 plibpth=''
1368
1369 : default library list
1370 libswanted=''
1371 : some systems want to use only the non-versioned libso:s
1372 ignore_versioned_solibs=''
1373 : set usethreads on the Configure command line to enable threads.
1374 usereentrant='undef'
1375 ccname=''
1376 ccversion=''
1377 perllibs=''
1378 : set useposix=false in your hint file to disable the POSIX extension.
1379 useposix=true
1380 : set useopcode=false in your hint file to disable the Opcode extension.
1381 useopcode=true
1382 archname64=''
1383 ccflags_uselargefiles=''
1384 ldflags_uselargefiles=''
1385 libswanted_uselargefiles=''
1386 : set usemultiplicity on the Configure command line to enable multiplicity.
1387 : set usesocks on the Configure command line to enable socks.
1388 : List of libraries we want.
1389 : If anyone needs extra -lxxx, put those in a hint file.
1390 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1391 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1392 : We probably want to search /usr/shlib before most other libraries.
1393 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1394 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1395 glibpth="/usr/shlib $glibpth"
1396 : Do not use vfork unless overridden by a hint file.
1397 usevfork=false
1398
1399 : Find the basic shell for Bourne shell scripts
1400 case "$sh" in
1401 '')
1402         case "$SYSTYPE" in
1403         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1404         *) xxx='/bin/sh';;
1405         esac
1406         if test -f "$xxx"; then
1407                 sh="$xxx"
1408         else
1409                 : Build up a list and do a single loop so we can 'break' out.
1410                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1411                 for xxx in sh bash ksh pdksh ash; do
1412                         for p in $pth; do
1413                                 try="$try ${p}/${xxx}"
1414                         done
1415                 done
1416                 for xxx in $try; do
1417                         if test -f "$xxx"; then
1418                                 sh="$xxx";
1419                                 break
1420                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1421                                 sh="$xxx";
1422                                 break
1423                         elif test -f "$xxx.exe"; then
1424                                 sh="$xxx";
1425                                 break
1426                         fi
1427                 done
1428         fi
1429         ;;
1430 esac
1431
1432 case "$sh" in
1433 '')     cat >&2 <<EOM
1434 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1435
1436 Usually it's in /bin/sh.  How did you even get this far?
1437 Please contact me (Perl Maintainers) at perlbug@perl.org and
1438 we'll try to straighten this all out.
1439 EOM
1440         exit 1
1441         ;;
1442 esac
1443
1444 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1445 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1446 targetsh=$sh
1447
1448 : see if sh knows # comments
1449 if `$sh -c '#' >/dev/null 2>&1`; then
1450         shsharp=true
1451         spitshell=cat
1452         xcat=/bin/cat
1453         test -f $xcat$_exe || xcat=/usr/bin/cat
1454         if test ! -f $xcat$_exe; then
1455                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1456                         if test -f $p/cat$_exe; then
1457                                 xcat=$p/cat
1458                                 break
1459                         fi
1460                 done
1461                 if test ! -f $xcat$_exe; then
1462                         echo "Can't find cat anywhere!"
1463                         exit 1
1464                 fi
1465         fi
1466         echo "#!$xcat" >sharp
1467         $eunicefix sharp
1468         chmod +x sharp
1469         ./sharp > today 2>/dev/null
1470         if test -s today; then
1471                 sharpbang='#!'
1472         else
1473                 echo "#! $xcat" > sharp
1474                 $eunicefix sharp
1475                 chmod +x sharp
1476                 ./sharp > today 2>/dev/null
1477                 if test -s today; then
1478                         sharpbang='#! '
1479                 else
1480                         sharpbang=': use '
1481                 fi
1482         fi
1483 else
1484         echo " "
1485         echo "Your $sh doesn't grok # comments--I will strip them later on."
1486         shsharp=false
1487         cd ..
1488         echo "exec grep -v '^[  ]*#'" >spitshell
1489         chmod +x spitshell
1490         $eunicefix spitshell
1491         spitshell=`pwd`/spitshell
1492         cd UU
1493         echo "I presume that if # doesn't work, #! won't work either!"
1494         sharpbang=': use '
1495 fi
1496 rm -f sharp today
1497
1498 : figure out how to guarantee sh startup
1499 case "$startsh" in
1500 '') startsh=${sharpbang}${sh} ;;
1501 *)
1502 esac
1503 cat >sharp <<EOSS
1504 $startsh
1505 set abc
1506 test "$?abc" != 1
1507 EOSS
1508
1509 chmod +x sharp
1510 $eunicefix sharp
1511 if ./sharp; then
1512         : echo "Yup, it does."
1513 else
1514         echo "Hmm... '$startsh' does not guarantee sh startup..."
1515         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1516 fi
1517 rm -f sharp
1518
1519 : Save command line options in file UU/cmdline.opt for later use in
1520 : generating config.sh.
1521 cat > cmdline.opt <<EOSH
1522 : Configure command line arguments.
1523 config_arg0='$0'
1524 config_args='$*'
1525 config_argc=$#
1526 EOSH
1527 argn=1
1528 args_exp=''
1529 args_sep=''
1530 for arg in "$@"; do
1531         cat >>cmdline.opt <<EOSH
1532 config_arg$argn='$arg'
1533 EOSH
1534         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1535 $arg
1536 EOC
1537         arg_exp=`cat cmdl.opt`
1538         args_exp="$args_exp$args_sep'$arg_exp'"
1539         argn=`expr $argn + 1`
1540         args_sep=' '
1541 done
1542 rm -f cmdl.opt
1543
1544 : produce awk script to parse command line options
1545 cat >options.awk <<'EOF'
1546 BEGIN {
1547         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1548
1549         len = length(optstr);
1550         for (i = 1; i <= len; i++) {
1551                 c = substr(optstr, i, 1);
1552                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1553                 if (a == ":") {
1554                         arg[c] = 1;
1555                         i++;
1556                 }
1557                 opt[c] = 1;
1558         }
1559 }
1560 {
1561         expect = 0;
1562         str = $0;
1563         if (substr(str, 1, 1) != "-") {
1564                 printf("'%s'\n", str);
1565                 next;
1566         }
1567         len = length($0);
1568         for (i = 2; i <= len; i++) {
1569                 c = substr(str, i, 1);
1570                 if (!opt[c]) {
1571                         printf("-%s\n", substr(str, i));
1572                         next;
1573                 }
1574                 printf("-%s\n", c);
1575                 if (arg[c]) {
1576                         if (i < len)
1577                                 printf("'%s'\n", substr(str, i + 1));
1578                         else
1579                                 expect = 1;
1580                         next;
1581                 }
1582         }
1583 }
1584 END {
1585         if (expect)
1586                 print "?";
1587 }
1588 EOF
1589
1590 : process the command line options
1591 set X `for arg in "$@"; do echo "X$arg"; done |
1592         sed -e s/X// | awk -f options.awk`
1593 eval "set $*"
1594 shift
1595 rm -f options.awk
1596
1597 : set up default values
1598 fastread=''
1599 reuseval=false
1600 config_sh=''
1601 alldone=''
1602 error=''
1603 silent=''
1604 extractsh=''
1605 override=''
1606 knowitall=''
1607 rm -f optdef.sh posthint.sh
1608 cat >optdef.sh <<EOS
1609 $startsh
1610 EOS
1611
1612
1613 : option parsing
1614 while test $# -gt 0; do
1615         case "$1" in
1616         -d) shift; fastread=yes;;
1617         -e) shift; alldone=cont;;
1618         -f)
1619                 shift
1620                 cd ..
1621                 if test -r "$1"; then
1622                         config_sh="$1"
1623                 else
1624                         echo "$me: cannot read config file $1." >&2
1625                         error=true
1626                 fi
1627                 cd UU
1628                 shift;;
1629         --help|\
1630         -h) shift; error=true;;
1631         -r) shift; reuseval=true;;
1632         -s) shift; silent=true; realsilent=true;;
1633         -E) shift; alldone=exit;;
1634         -K) shift; knowitall=true;;
1635         -O) shift; override=true;;
1636         -S) shift; silent=true; extractsh=true;;
1637         -D)
1638                 shift
1639                 case "$1" in
1640                 *=)
1641                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1642                         echo "$me: ignoring -D $1" >&2
1643                         ;;
1644                 *=*) echo "$1" | \
1645                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1646                 *) echo "$1='define'" >> optdef.sh;;
1647                 esac
1648                 shift
1649                 ;;
1650         -U)
1651                 shift
1652                 case "$1" in
1653                 *=) echo "$1" >> optdef.sh;;
1654                 *=*)
1655                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1656                         echo "$me: ignoring -U $1" >&2
1657                         ;;
1658                 *) echo "$1='undef'" >> optdef.sh;;
1659                 esac
1660                 shift
1661                 ;;
1662         -A)
1663             shift
1664             xxx=''
1665             yyy="$1"
1666             zzz=''
1667             uuu=undef
1668             case "$yyy" in
1669             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1670                  case "$zzz" in
1671                  *:*) zzz='' ;;
1672                  *)   xxx=append
1673                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1674                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1675                  esac
1676                  ;;
1677             esac
1678             case "$xxx" in
1679             '')  case "$yyy" in
1680                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1681                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1682                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1683                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1684                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1685                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1686                  esac
1687                  ;;
1688             esac
1689             case "$xxx" in
1690             append)
1691                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1692             clear)
1693                 echo "$yyy=''"                  >> posthint.sh ;;
1694             define)
1695                 case "$zzz" in
1696                 '') zzz=define ;;
1697                 esac
1698                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1699             eval)
1700                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1701             prepend)
1702                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1703             undef)
1704                 case "$zzz" in
1705                 '') zzz="$uuu" ;;
1706                 esac
1707                 echo "$yyy=$zzz"                >> posthint.sh ;;
1708             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1709             esac
1710             shift
1711             ;;
1712         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1713             exit 0;;
1714         --) break;;
1715         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1716         *) break;;
1717         esac
1718 done
1719
1720 case "$error" in
1721 true)
1722         cat >&2 <<EOM
1723 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1724                  [-U symbol] [-U symbol=] [-A command:symbol...]
1725   -d : use defaults for all answers.
1726   -e : go on without questioning past the production of config.sh.
1727   -f : specify an alternate default configuration file.
1728   -h : print this help message and exit (with an error status).
1729   -r : reuse C symbols value if possible (skips costly nm extraction).
1730   -s : silent mode, only echoes questions and essential information.
1731   -D : define symbol to have some value:
1732          -D symbol         symbol gets the value 'define'
1733          -D symbol=value   symbol gets the value 'value'
1734        common used examples (see INSTALL for more info):
1735          -Duse64bitint            use 64bit integers
1736          -Duse64bitall            use 64bit integers and pointers
1737          -Dusethreads             use thread support
1738          -Dinc_version_list=none  do not include older perl trees in @INC
1739          -DEBUGGING=none          DEBUGGING options
1740          -Dcc=gcc                 choose your compiler
1741          -Dprefix=/opt/perl5      choose your destination
1742   -E : stop at the end of questions, after having produced config.sh.
1743   -K : do not use unless you know what you are doing.
1744   -O : let -D and -U override definitions from loaded configuration file.
1745   -S : perform variable substitutions on all .SH files (can mix with -f)
1746   -U : undefine symbol:
1747          -U symbol    symbol gets the value 'undef'
1748          -U symbol=   symbol gets completely empty
1749        e.g.:  -Uversiononly
1750   -A : manipulate symbol after the platform specific hints have been applied:
1751          -A append:symbol=value   append value to symbol
1752          -A symbol=value          like append:, but with a separating space
1753          -A define:symbol=value   define symbol to have value
1754          -A clear:symbol          define symbol to be ''
1755          -A define:symbol         define symbol to be 'define'
1756          -A eval:symbol=value     define symbol to be eval of value
1757          -A prepend:symbol=value  prepend value to symbol
1758          -A undef:symbol          define symbol to be 'undef'
1759          -A undef:symbol=         define symbol to be ''
1760        e.g.:  -A prepend:libswanted='cl pthread '
1761               -A ccflags=-DSOME_MACRO
1762   -V : print version number and exit (with a zero status).
1763 EOM
1764         exit 1
1765         ;;
1766 esac
1767
1768 : Sanity checks
1769 case "$fastread$alldone" in
1770 yescont|yesexit) ;;
1771 *)
1772         case "$extractsh" in
1773         true) ;;
1774         *)
1775                 if test ! -t 0; then
1776                         echo "Say 'sh Configure', not 'sh <Configure'"
1777                         exit 1
1778                 fi
1779                 ;;
1780         esac
1781         ;;
1782 esac
1783
1784 exec 4>&1
1785 case "$silent" in
1786 true) exec 1>/dev/null;;
1787 esac
1788
1789 : run the defines and the undefines, if any, but leave the file out there...
1790 touch optdef.sh
1791 . ./optdef.sh
1792 : create the posthint manipulation script and leave the file out there...
1793 touch posthint.sh
1794
1795 : set package name
1796 package='perl5'
1797 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1798 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1799 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1800 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1801 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1802 esac
1803
1804 : Some greps do not return status, grrr.
1805 echo "grimblepritz" >grimble
1806 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1807         contains=contains
1808 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1809         contains=grep
1810 else
1811         contains=contains
1812 fi
1813 rm -f grimble
1814 : the following should work in any shell
1815 case "$contains" in
1816 contains*)
1817         echo " "
1818         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1819         cat >contains <<'EOSS'
1820 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1821 EOSS
1822 chmod +x contains
1823 esac
1824
1825 : Find the path to the source tree
1826 case "$src" in
1827 '') case "$0" in
1828     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1829          case "$src" in
1830          /*)    ;;
1831          .)     ;;
1832          *)     src=`cd ../$src && pwd` ;;
1833          esac
1834          ;;
1835     *)   src='.';;
1836     esac;;
1837 esac
1838 case "$src" in
1839 '')     src=/
1840         rsrc=/
1841         ;;
1842 /*)     rsrc="$src";;
1843 *)      rsrc="../$src";;
1844 esac
1845 if test -f $rsrc/Configure && \
1846         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1847 then
1848    : found it, so we are ok.
1849 else
1850         rsrc=''
1851         for src in . .. ../.. ../../.. ../../../..; do
1852                 if test -f ../$src/Configure && \
1853                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1854                 then
1855                         rsrc=../$src
1856                         break
1857                 fi
1858         done
1859 fi
1860 case "$rsrc" in
1861 '')
1862         cat <<EOM >&4
1863
1864 Sorry, I can't seem to locate the source dir for $package.  Please start
1865 Configure with an explicit path -- i.e. /some/path/Configure.
1866
1867 EOM
1868         exit 1
1869         ;;
1870 ../.)   rsrc='..';;
1871 *)
1872         echo " "
1873         echo "Sources for $package found in \"$src\"." >&4
1874         ;;
1875 esac
1876
1877 : script used to extract .SH files with variable substitutions
1878 cat >extract <<'EOS'
1879 PERL_CONFIG_SH=true
1880 echo "Doing variable substitutions on .SH files..."
1881 if test -f MANIFEST; then
1882         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1883 else
1884         echo "(Looking for .SH files under the source directory.)"
1885         set x `(cd "$src"; find . -name "*.SH" -print)`
1886 fi
1887 shift
1888 case $# in
1889 0) set x `(cd "$src"; echo *.SH)`; shift;;
1890 esac
1891 if test ! -f "$src/$1"; then
1892         shift
1893 fi
1894 mkdir_p='
1895 name=$1;
1896 create="";
1897 while test $name; do
1898         if test ! -d "$name"; then
1899                 create="$name $create";
1900                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1901                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1902         else
1903                 name="";
1904         fi;
1905 done;
1906 for file in $create; do
1907         mkdir $file;
1908 done
1909 '
1910 for file in $*; do
1911         case "$src" in
1912         ".")
1913                 case "$file" in
1914                 */*)
1915                         dir=`expr X$file : 'X\(.*\)/'`
1916                         file=`expr X$file : 'X.*/\(.*\)'`
1917                         (cd "$dir" && . ./$file)
1918                         ;;
1919                 *)
1920                         . ./$file
1921                         ;;
1922                 esac
1923                 ;;
1924         *)
1925                 case "$file" in
1926                 */*)
1927                         dir=`expr X$file : 'X\(.*\)/'`
1928                         file=`expr X$file : 'X.*/\(.*\)'`
1929                         (set x $dir; shift; eval $mkdir_p)
1930                         sh <"$src/$dir/$file"
1931                         ;;
1932                 *)
1933                         sh <"$src/$file"
1934                         ;;
1935                 esac
1936                 ;;
1937         esac
1938 done
1939 if test -f "$src/config_h.SH"; then
1940         if test ! -f config.h; then
1941         : oops, they left it out of MANIFEST, probably, so do it anyway.
1942         . "$src/config_h.SH"
1943         fi
1944 fi
1945 EOS
1946
1947 : extract files and exit if asked to do so
1948 case "$extractsh" in
1949 true)
1950         case "$realsilent" in
1951         true) ;;
1952         *) exec 1>&4;;
1953         esac
1954         case "$config_sh" in
1955         '') config_sh='config.sh';;
1956         esac
1957         echo " "
1958         echo "Fetching answers from $config_sh..."
1959         cd ..
1960         . $config_sh
1961         test "$override" && . ./optdef.sh
1962         echo " "
1963         . UU/extract
1964         rm -rf UU
1965         echo "Extraction done."
1966         exit 0
1967         ;;
1968 esac
1969
1970 : Eunice requires " " instead of "", can you believe it
1971 echo " "
1972 : Here we go...
1973 echo "Beginning of configuration questions for $package."
1974
1975 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1976
1977 : first determine how to suppress newline on echo command
1978 echo " "
1979 echo "Checking echo to see how to suppress newlines..."
1980 (echo "hi there\c" ; echo " ") >.echotmp
1981 if $contains c .echotmp >/dev/null 2>&1 ; then
1982         echo "...using -n."
1983         n='-n'
1984         c=''
1985 else
1986         cat <<'EOM'
1987 ...using \c
1988 EOM
1989         n=''
1990         c='\c'
1991 fi
1992 echo $n "The star should be here-->$c"
1993 echo '*'
1994 rm -f .echotmp
1995
1996 : Now test for existence of everything in MANIFEST
1997 echo " "
1998 if test -f "$rsrc/MANIFEST"; then
1999         echo "First let's make sure your kit is complete.  Checking..." >&4
2000         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2001                 (split -l 50 2>/dev/null || split -50)
2002         rm -f missing
2003         tmppwd=`pwd`
2004         for filelist in x??; do
2005                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2006                         >/dev/null 2>>"$tmppwd/missing")
2007         done
2008         if test -s missing; then
2009                 cat missing >&4
2010                 cat >&4 <<'EOM'
2011
2012 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2013
2014 You have the option of continuing the configuration process, despite the
2015 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2016 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2017 and contact the author (perlbug@perl.org).
2018
2019 EOM
2020                 echo $n "Continue? [n] $c" >&4
2021                 read ans
2022                 case "$ans" in
2023                 y*)
2024                         echo "Continuing..." >&4
2025                         rm -f missing
2026                         ;;
2027                 *)
2028                         echo "ABORTING..." >&4
2029                         kill $$
2030                         ;;
2031                 esac
2032         else
2033                 echo "Looks good..."
2034         fi
2035 else
2036         echo "There is no MANIFEST file.  I hope your kit is complete !"
2037 fi
2038 rm -f missing x??
2039
2040 : Find the appropriate value for a newline for tr
2041 echo " "
2042 if test -n "$DJGPP"; then
2043        trnl='\012'
2044 fi
2045 if test X"$trnl" = X; then
2046         case "`echo foo|tr '\n' x 2>/dev/null`" in
2047         foox) trnl='\n' ;;
2048         esac
2049 fi
2050 if test X"$trnl" = X; then
2051         case "`echo foo|tr '\012' x 2>/dev/null`" in
2052         foox) trnl='\012' ;;
2053         esac
2054 fi
2055 if test X"$trnl" = X; then
2056        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2057        fooxy) trnl='\n\r' ;;
2058        esac
2059 fi
2060 if test X"$trnl" = X; then
2061         cat <<EOM >&2
2062
2063 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2064
2065 EOM
2066         exit 1
2067 fi
2068
2069 : compute the number of columns on the terminal for proper question formatting
2070 case "$COLUMNS" in
2071 '') COLUMNS='80';;
2072 esac
2073
2074 : set up the echo used in my read
2075 myecho="case \"\$xxxm\" in
2076 '') echo $n \"\$rp $c\" >&4;;
2077 *) case \"\$rp\" in
2078         '') echo $n \"[\$xxxm] $c\";;
2079         *)
2080                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2081                         echo \"\$rp\" >&4
2082                         echo $n \"[\$xxxm] $c\" >&4
2083                 else
2084                         echo $n \"\$rp [\$xxxm] $c\" >&4
2085                 fi
2086                 ;;
2087         esac;;
2088 esac"
2089
2090 : now set up to do reads with possible shell escape and default assignment
2091 cat <<EOSC >myread
2092 $startsh
2093 xxxm=\$dflt
2094 $myecho
2095 ans='!'
2096 case "\$fastread" in
2097 yes) case "\$dflt" in
2098         '') ;;
2099         *) ans='';
2100                 case "\$silent-\$rp" in
2101                 true-) ;;
2102                 *) echo " " >&4;;
2103                 esac;;
2104         esac;;
2105 *) case "\$silent" in
2106         true) case "\$rp" in
2107                 '') ans='';;
2108                 esac;;
2109         esac;;
2110 esac
2111 while expr "X\$ans" : "X!" >/dev/null; do
2112         read answ
2113         set x \$xxxm
2114         shift
2115         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2116         case  "\$answ" in
2117         "!")
2118                 sh 1>&4
2119                 echo " "
2120                 $myecho
2121                 ;;
2122         !*)
2123                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2124                 shift
2125                 sh 1>&4 -c "\$*"
2126                 echo " "
2127                 $myecho
2128                 ;;
2129         "\$ans")
2130                 case "\$ans" in
2131                 \\&*)
2132                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2133                         shift
2134                         case "\$1" in
2135                         -d)
2136                                 fastread=yes
2137                                 echo "(OK, I'll run with -d after this question.)" >&4
2138                                 ;;
2139                         -*)
2140                                 echo "*** Sorry, \$1 not supported yet." >&4
2141                                 ;;
2142                         esac
2143                         $myecho
2144                         ans=!
2145                         ;;
2146                 esac;;
2147         *)
2148                 case "\$aok" in
2149                 y)
2150                         echo "*** Substitution done -- please confirm."
2151                         xxxm="\$ans"
2152                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2153                         xxxm="\$ans"
2154                         ans=!
2155                         ;;
2156                 *)
2157                         echo "*** Error -- try again."
2158                         ans=!
2159                         ;;
2160                 esac
2161                 $myecho
2162                 ;;
2163         esac
2164         case "\$ans\$xxxm\$nostick" in
2165         '')
2166                 ans=!
2167                 $myecho
2168                 ;;
2169         esac
2170 done
2171 case "\$ans" in
2172 '') ans="\$xxxm";;
2173 esac
2174 EOSC
2175
2176 : create .config dir to save info across Configure sessions
2177 test -d ../.config || mkdir ../.config
2178 cat >../.config/README <<EOF
2179 This directory created by Configure to save information that should
2180 persist across sessions for $package.
2181
2182 You may safely delete it if you wish.
2183 EOF
2184
2185 : See if we are using a devel version and want that
2186 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2187 case "$usedevel" in
2188 $define|true|[yY]*)
2189     usedevel="$define" ;;
2190 *) case "$xversion" in
2191    *[13579])
2192         cat >&4 <<EOH
2193 *** WHOA THERE!!! ***
2194
2195     This is an UNSTABLE DEVELOPMENT release.
2196     The version of this $package distribution is $xversion, that is, odd,
2197     (as opposed to even) and that signifies a development release.
2198     If you want a maintenance release, you want an even-numbered version.
2199
2200     Do ***NOT*** install this into production use.
2201     Data corruption and crashes are possible.
2202
2203     It is most seriously suggested that you do not continue any further
2204     unless you want to help in developing and debugging Perl.
2205
2206     If you *still* want to build perl, you can answer 'y' now,
2207     or pass -Dusedevel to Configure.
2208
2209 EOH
2210         rp='Do you really want to continue?'
2211         dflt='n'
2212         . ./myread
2213         case "$ans" in
2214         [yY]) echo >&4 "Okay, continuing."
2215               usedevel="$define" ;;
2216         *) echo >&4 "Okay, bye."
2217            exit 1
2218            ;;
2219         esac
2220         ;;
2221     esac
2222     usedevel="$undef"
2223     ;;
2224 esac
2225 case "$usedevel" in
2226 $define|true|[yY]*)
2227         case "$versiononly" in
2228         '') versiononly="$define" ;;
2229         esac
2230         case "$installusrbinperl" in
2231         '') installusrbinperl="$undef" ;;
2232         esac
2233         ;;
2234 esac
2235
2236 : general instructions
2237 needman=true
2238 firsttime=true
2239 user=`(logname) 2>/dev/null`
2240 case "$user" in
2241 '') user=`whoami 2>&1`;;
2242 esac
2243 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2244         firsttime=false
2245         echo " "
2246         rp='Would you like to see the instructions?'
2247         dflt=n
2248         . ./myread
2249         case "$ans" in
2250         [yY]*) ;;
2251         *) needman=false;;
2252         esac
2253 fi
2254 if $needman; then
2255         cat <<EOH
2256
2257 This installation shell script will examine your system and ask you questions
2258 to determine how the perl5 package should be installed. If you get
2259 stuck on a question, you may use a ! shell escape to start a subshell or
2260 execute a command.  Many of the questions will have default answers in square
2261 brackets; typing carriage return will give you the default.
2262
2263 On some of the questions which ask for file or directory names you are allowed
2264 to use the ~name construct to specify the login directory belonging to "name",
2265 even if you don't have a shell which knows about that.  Questions where this is
2266 allowed will be marked "(~name ok)".
2267
2268 EOH
2269         rp=''
2270         dflt='Type carriage return to continue'
2271         . ./myread
2272         cat <<'EOH'
2273
2274 The prompter used in this script allows you to use shell variables and
2275 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2276 in the default answer, as if the default line was a set of arguments given to a
2277 script shell.  This means you may also use $* to repeat the whole default line,
2278 so you do not have to re-type everything to add something to the default.
2279
2280 Every time there is a substitution, you will have to confirm.  If there is an
2281 error (e.g. an unmatched backtick), the default answer will remain unchanged
2282 and you will be prompted again.
2283
2284 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2285 the questions and use the computed defaults (or the previous answers if there
2286 was already a config.sh file). Type 'Configure -h' for a list of options.
2287 You may also start interactively and then answer '& -d' at any prompt to turn
2288 on the non-interactive behaviour for the remainder of the execution.
2289
2290 EOH
2291         . ./myread
2292         cat <<EOH
2293
2294 Much effort has been expended to ensure that this shell script will run on any
2295 Unix system.  If despite that it blows up on yours, your best bet is to edit
2296 Configure and run it again.  If you can't run Configure for some reason,
2297 you'll have to generate a config.sh file by hand.  Whatever problems you
2298 have, let me (perlbug@perl.org) know how I blew it.
2299
2300 This installation script affects things in two ways:
2301
2302 1) it may do direct variable substitutions on some of the files included
2303    in this kit.
2304 2) it builds a config.h file for inclusion in C programs.  You may edit
2305    any of these files as the need arises after running this script.
2306
2307 If you make a mistake on a question, there is no easy way to back up to it
2308 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2309 files.  Configure will offer to let you do this before it runs the SH files.
2310
2311 EOH
2312         dflt='Type carriage return to continue'
2313         . ./myread
2314         case "$firsttime" in
2315         true) echo $user >>../.config/instruct;;
2316         esac
2317 fi
2318
2319 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2320 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2321 if test "X$sysroot" = X; then
2322     sysroot=""
2323 else
2324     case "$cc" in
2325         *gcc*|*g++*)
2326             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2327             # _sysroot is used in places where we need --sysroot=foo
2328             # but using the rest of the flags could cause issues.
2329             _sysroot="--sysroot=$sysroot";
2330             case "$ccflags" in
2331                 *sysroot*) ;;
2332                 'undef'|*)
2333                 ccflags="$ccflags $_sysroot"
2334             esac
2335             case "$ldflags" in
2336                 *sysroot*) ;;
2337                 'undef'|*)
2338                 ldflags="$ldflags $_sysroot"
2339             esac
2340             case "$cppflags" in
2341                 *sysroot*) ;;
2342                 'undef'|*)
2343                 cppflags="$cppflags $_sysroot"
2344             esac
2345             # lddlflags updated below in lddlflags section;
2346             # same with cccdlflags
2347             ;;
2348     esac
2349
2350     # Adjust some defaults to also use $sysroot
2351     for var in xlibpth loclibpth locincpth glibpth; do
2352         eval xxx=\$$var
2353         eval $var=''
2354         for path in $xxx; do
2355             eval $var=\"\$$var $sysroot$path\"
2356         done
2357     done
2358
2359 fi
2360
2361 : find out where common programs are
2362 echo " "
2363 echo "Locating common programs..." >&4
2364 cat <<EOSC >loc
2365 $startsh
2366 case \$# in
2367 0) exit 1;;
2368 esac
2369 thing=\$1
2370 shift
2371 dflt=\$1
2372 shift
2373 for dir in \$*; do
2374         case "\$thing" in
2375         .)
2376         if test -d \$dir/\$thing; then
2377                 echo \$dir
2378                 exit 0
2379         fi
2380         ;;
2381         *)
2382         for thisthing in \$dir/\$thing; do
2383                 : just loop through to pick last item
2384         done
2385         if test -f \$thisthing; then
2386                 echo \$thisthing
2387                 exit 0
2388         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2389                 echo \$thisthing
2390                 exit 0
2391         elif test -f \$dir/\$thing.exe; then
2392                 if test -n "$DJGPP"; then
2393                         echo \$dir/\$thing.exe
2394                 elif test "$eunicefix" != ":"; then
2395                         : on Eunice apparently
2396                         echo \$dir/\$thing
2397                 fi
2398                 exit 0
2399         fi
2400         ;;
2401         esac
2402 done
2403 echo \$dflt
2404 exit 1
2405 EOSC
2406 chmod +x loc
2407 $eunicefix loc
2408 loclist="
2409 awk
2410 cat
2411 chmod
2412 comm
2413 cp
2414 echo
2415 expr
2416 grep
2417 ls
2418 mkdir
2419 rm
2420 sed
2421 sort
2422 touch
2423 tr
2424 uniq
2425 "
2426 trylist="
2427 ar
2428 bison
2429 byacc
2430 cpp
2431 csh
2432 date
2433 egrep
2434 gmake
2435 gzip
2436 less
2437 ln
2438 make
2439 more
2440 nm
2441 nroff
2442 perl
2443 pg
2444 test
2445 uname
2446 zip
2447 "
2448 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2449 pth="$pth $sysroot/lib $sysroot/usr/lib"
2450 for file in $loclist; do
2451         eval xxx=\$$file
2452         case "$xxx" in
2453         /*|?:[\\/]*)
2454                 if test -f "$xxx"; then
2455                         : ok
2456                 else
2457                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2458                         xxx=`./loc $file $file $pth`
2459                 fi
2460                 ;;
2461         '') xxx=`./loc $file $file $pth`;;
2462         *) xxx=`./loc $xxx $xxx $pth`;;
2463         esac
2464         eval $file=$xxx$_exe
2465         eval _$file=$xxx
2466         case "$xxx" in
2467         /*)
2468                 echo $file is in $xxx.
2469                 ;;
2470         ?:[\\/]*)
2471                 echo $file is in $xxx.
2472                 ;;
2473         *)
2474                 echo "I don't know where '$file' is, and my life depends on it." >&4
2475                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2476                 exit 1
2477                 ;;
2478         esac
2479 done
2480 echo " "
2481 echo "Don't worry if any of the following aren't found..."
2482 say=offhand
2483 for file in $trylist; do
2484         eval xxx=\$$file
2485         case "$xxx" in
2486         /*|?:[\\/]*)
2487                 if test -f "$xxx"; then
2488                         : ok
2489                 else
2490                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2491                         xxx=`./loc $file $file $pth`
2492                 fi
2493                 ;;
2494         '') xxx=`./loc $file $file $pth`;;
2495         *) xxx=`./loc $xxx $xxx $pth`;;
2496         esac
2497         eval $file=$xxx$_exe
2498         eval _$file=$xxx
2499         case "$xxx" in
2500         /*)
2501                 echo $file is in $xxx.
2502                 ;;
2503         ?:[\\/]*)
2504                 echo $file is in $xxx.
2505                 ;;
2506         *)
2507                 echo "I don't see $file out there, $say."
2508                 say=either
2509                 ;;
2510         esac
2511 done
2512 case "$egrep" in
2513 egrep)
2514         echo "Substituting grep for egrep."
2515         egrep=$grep
2516         _egrep=$grep
2517         ;;
2518 esac
2519 case "$less" in
2520 '')     ;;
2521 *)      if $less -R </dev/null >/dev/null; then
2522                echo "Substituting less -R for less."
2523                less="$less -R"
2524                _less=$less
2525         fi
2526         ;;
2527 esac
2528 case "$ln" in
2529 ln)
2530         echo "Substituting cp for ln."
2531         ln=$cp
2532         _ln=$cp
2533         ;;
2534 esac
2535 case "$make" in
2536 make)
2537         case "$gmake" in
2538         gmake)
2539         echo "I can't find make or gmake, and my life depends on it." >&4
2540         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2541         exit 1
2542         ;;
2543         esac
2544         ;;
2545 esac
2546 case "$gmake" in
2547 gmake)  ;;
2548 *)      # We can't have osname yet.
2549         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2550                 # Assume that gmake, if found, is definitely GNU make
2551                 # and prefer it over the system make.
2552                 echo "Substituting gmake for make."
2553                 make=$gmake
2554                 _make=$gmake
2555         fi
2556         ;;
2557 esac
2558 case "$test" in
2559 test)
2560         echo "Hopefully test is built into your sh."
2561         ;;
2562 *)
2563         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2564                 echo "Using the test built into your sh."
2565                 test=test
2566                 _test=test
2567         fi
2568         ;;
2569 esac
2570 case "$echo" in
2571 echo)
2572         echo "Hopefully echo is built into your sh."
2573         ;;
2574 '') ;;
2575 *)
2576         echo " "
2577 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2578         $echo $n "hi there$c" >foo1
2579         echo $n "hi there$c" >foo2
2580         if cmp foo1 foo2 >/dev/null 2>&1; then
2581                 echo "They are compatible.  In fact, they may be identical."
2582         else
2583                 case "$n" in
2584                 '-n') n='' c='\c';;
2585                 *) n='-n' c='';;
2586                 esac
2587                 cat <<FOO
2588 They are not compatible!  You are probably running ksh on a non-USG system.
2589 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2590 have echo built in and we may have to run some Bourne shell scripts.  That
2591 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2592
2593 FOO
2594                 $echo $n "The star should be here-->$c"
2595                 $echo "*"
2596         fi
2597         $rm -f foo1 foo2
2598         ;;
2599 esac
2600
2601 # This question was auctioned at YAPC::Europe-2007 in Vienna
2602 # I never promised you could answer it. I only auctioned the question.
2603 cat <<FOO
2604 The following message is sponsored by
2605
2606   Dresden.pm<--The stars should be here.
2607
2608 Dear Perl user, system administrator or package
2609 maintainer, the Perl community sends greetings to
2610 you. Do you (emblematical) greet back [Y/n]? n
2611
2612 FOO
2613
2614 : Check what type of C compiler we use
2615 cat <<EOS >trygcc
2616 $startsh
2617 EOS
2618 cat <<'EOSC' >>trygcc
2619 case "$cc" in
2620 '') ;;
2621 *)  $rm -f try try.*
2622     $cat >try.c <<EOM
2623 int main(int argc, char *argv[]) {
2624   return 0;
2625 }
2626 EOM
2627     if $cc -o try $ccflags $ldflags try.c; then
2628        :
2629     else
2630         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2631         despair=yes
2632         trygcc=yes
2633         case "$cc" in
2634         *gcc*) trygcc=no ;;
2635         esac
2636         # Skip this test because it gives a false match on output like:
2637         #    ./trygcc: line 23: cc: command not found
2638         # case "`$cc -v -c try.c 2>&1`" in
2639         # *gcc*) trygcc=no ;;
2640         # esac
2641         if $test X"$trygcc" = Xyes; then
2642             if gcc -o try -c try.c; then
2643                 echo " "
2644                 echo "You seem to have a working gcc, though." >&4
2645                 # Switching compilers may undo the work of hints files.
2646                 # The most common problem is -D_REENTRANT for threads.
2647                 # This heuristic catches that case, but gets false positives
2648                 # if -Dusethreads was not actually specified.  Better to
2649                 # bail out here with a useful message than fail 
2650                 # mysteriously later. Should we perhaps just try to
2651                 # re-invoke Configure -Dcc=gcc config_args ?
2652                 if $test -f usethreads.cbu; then
2653                         $cat >&4 <<EOM 
2654
2655 *** However, any setting of the C compiler flags (e.g. for thread support)
2656 *** will be lost.  It may be necessary for you to restart Configure and
2657 *** add -Dcc=gcc to your Configure command line.
2658
2659 EOM
2660                         rp="Would you like to go ahead and try gcc anyway?"
2661                         dflt=n
2662                 else
2663                         rp="Would you like to use it?"
2664                         dflt=y
2665                 fi
2666                 if $test -f myread; then
2667                     . ./myread
2668                 else
2669                     if $test -f UU/myread; then
2670                         . ./UU/myread
2671                     else
2672                         echo "Cannot find myread, sorry.  Aborting." >&2
2673                         exit 1
2674                     fi
2675                 fi  
2676                 case "$ans" in
2677                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2678                 esac
2679             fi
2680         fi
2681     fi
2682     $rm -f try try.*
2683     ;;
2684 esac
2685 EOSC
2686
2687 cat <<EOS >checkcc
2688 $startsh
2689 EOS
2690 cat <<'EOSC' >>checkcc
2691 case "$cc" in        
2692 '') ;;
2693 *)  $rm -f try try.*              
2694     $cat >try.c <<EOM
2695 int main(int argc, char *argv[]) {
2696   return 0;
2697 }
2698 EOM
2699     if $cc -o try $ccflags $ldflags try.c; then
2700        :
2701     else
2702         if $test X"$despair" = Xyes; then
2703            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2704         fi
2705         $cat >&4 <<EOM         
2706 You need to find a working C compiler.
2707 Either (purchase and) install the C compiler supplied by your OS vendor,
2708 or for a free C compiler try http://gcc.gnu.org/
2709 I cannot continue any further, aborting.
2710 EOM
2711         exit 1
2712     fi
2713     $rm -f try try.*
2714     ;;
2715 esac
2716 EOSC
2717
2718 : determine whether symbolic links are supported
2719 echo " "
2720 $touch blurfl
2721 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2722         echo "Symbolic links are supported." >&4
2723         lns="$ln -s"
2724 else
2725         echo "Symbolic links are NOT supported." >&4
2726         lns="$ln"
2727 fi
2728 $rm -f blurfl sym
2729
2730 : determine whether symbolic links are supported
2731 echo " "
2732 case "$lns" in
2733 *"ln"*" -s")
2734         echo "Checking how to test for symbolic links..." >&4
2735         $lns blurfl sym
2736         if $test "X$issymlink" = X; then
2737                 case "$newsh" in
2738                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2739                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2740                 esac
2741                 if test $? = 0; then
2742                         issymlink="test -h"
2743                 else
2744                         echo "Your builtin 'test -h' may be broken." >&4
2745                         case "$test" in
2746                         /*)     ;;
2747                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2748                                 for p in $pth
2749                                 do
2750                                         if test -f "$p/$test"; then
2751                                                 test="$p/$test"
2752                                                 break
2753                                         fi
2754                                 done
2755                                 ;;
2756                         esac
2757                         case "$test" in
2758                         /*)
2759                                 echo "Trying external '$test -h'." >&4
2760                                 issymlink="$test -h"
2761                                 if $test ! -h sym >/dev/null 2>&1; then
2762                                         echo "External '$test -h' is broken, too." >&4
2763                                         issymlink=''
2764                                 fi
2765                                 ;;
2766                         *)      issymlink='' ;;
2767                         esac
2768                 fi
2769         fi
2770         if $test "X$issymlink" = X; then
2771                 if $test -L sym 2>/dev/null; then
2772                         issymlink="$test -L"
2773                         echo "The builtin '$test -L' worked." >&4
2774                 fi
2775         fi
2776         if $test "X$issymlink" != X; then
2777                 echo "You can test for symbolic links with '$issymlink'." >&4
2778         else
2779                 echo "I do not know how you can test for symbolic links." >&4
2780         fi
2781         $rm -f blurfl sym
2782         ;;
2783 *)      echo "No symbolic links, so not testing for their testing..." >&4
2784         ;;
2785 esac
2786 echo " "
2787
2788 : Make symlinks util
2789 case "$mksymlinks" in
2790 $define|true|[yY]*)
2791         case "$src" in
2792         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2793                 exit 1
2794                 ;;
2795         *)      case "$lns:$issymlink" in
2796                 *"ln"*" -s:"*"test -"?)
2797                         echo "Creating the symbolic links..." >&4
2798                         echo "(First creating the subdirectories...)" >&4
2799                         cd ..
2800                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2801                                 read directory
2802                                 test -z "$directory" && break
2803                                 mkdir -p $directory
2804                         done
2805                         # Sanity check 1.
2806                         if test ! -d t/base; then
2807                                 echo "Failed to create the subdirectories.  Aborting." >&4
2808                                 exit 1
2809                         fi
2810                         echo "(Then creating the symlinks...)" >&4
2811                         awk '{print $1}' $src/MANIFEST | while true; do
2812                                 read filename
2813                                 test -z "$filename" && break
2814                                 if test -f $filename; then
2815                                         if $issymlink $filename; then
2816                                                 rm -f $filename
2817                                         fi
2818                                 fi
2819                                 if test -f $filename; then
2820                                         echo "$filename already exists, not symlinking."
2821                                 else
2822                                         ln -s $src/$filename $filename
2823                                 fi
2824                         done
2825                         # Sanity check 2.
2826                         if test ! -f t/base/lex.t; then
2827                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2828                                 exit 1
2829                         fi
2830                         cd UU
2831                         ;;
2832                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2833                         ;;
2834                 esac
2835                 ;;
2836         esac
2837         ;;
2838 esac
2839
2840 : Check for Cross-Compilation
2841 if $test "X$targethost" = "X"; then
2842     targethost=""
2843 fi
2844 case "$usecrosscompile" in
2845 $define|true|[yY]*)
2846         $echo "Cross-compiling..."
2847         croak=''
2848         case "$cc" in
2849         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2850             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2851             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2852             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2853             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2854             # leave out ld, choosing it is more complex
2855             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2856             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2857             # We are in a weird spot. Just before us, some values
2858             # were 'saved', to be restored after the hints are
2859             # run.  This means that the changes we made to ar,
2860             # nm and ranlib will get reverted.
2861             # To avoid that, we hijack the saving mechanism and
2862             # have it save our new values.
2863             for file in ar nm ranlib; do
2864                 eval xxx=\$$file
2865                 eval $file=$xxx$_exe
2866                 eval _$file=$xxx
2867             done
2868         ;;
2869         esac
2870         case "$targetarch" in
2871         '') echo "Targetarch not defined." >&4; croak=y ;;
2872         *)  echo "Using targetarch $targetarch." >&4 ;;
2873         esac
2874         case "$targethost" in
2875         '') echo "Targethost not defined." >&4; croak=y ;;
2876         *)  echo "Using targethost $targethost." >&4
2877         esac
2878         locincpth=' '
2879         loclibpth=' '
2880         case "$croak" in
2881         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2882         esac
2883     : compile a host miniperl and generate_uudmap, unless we got passed them
2884     if $test "X$hostperl" = X; then
2885       echo "Building host miniperl and generate_uudmap binaries" >&4
2886       before_host=`pwd`
2887       cd ..
2888       cd $src
2889       src=`pwd`
2890       test -d $src/host || mkdir $src/host
2891       cd $src/host && rm -rf ./*
2892       $src/Configure -des -Dusedevel -Dmksymlinks
2893       $make miniperl
2894       case "$hostgenerate" in
2895       '') $make generate_uudmap
2896           hostgenerate=$src/host/generate_uudmap      
2897           ;;
2898        "$undef") hostgenerate=''
2899           ;;
2900       esac
2901       hostperl=$src/host/miniperl
2902       cd $before_host
2903     fi
2904     hostosname=`$hostperl -le 'print $^O'`
2905     ;;
2906 *)
2907     usecrosscompile="$undef"
2908     ;;
2909 esac
2910
2911 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2912 case "$targethost" in
2913     '') echo "Checking for cross-compile" >&4
2914     case "$usecrosscompile$multiarch" in
2915        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2916          if [ -f Makefile ]; then
2917            echo " "
2918            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2919          else
2920            echo "Configure done."
2921          fi
2922        exit 0
2923        ;;
2924      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2925         run=''
2926         to=:
2927         from=:
2928         ;;
2929     esac
2930     ;;
2931     *) echo "Using targethost $targethost." >&4
2932         case "$src" in
2933         /*) run=$src/Cross/run
2934             targetmkdir=$src/Cross/mkdir
2935             to=$src/Cross/to
2936             from=$src/Cross/from
2937             ;;
2938         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2939             run=$pwd/Cross/run
2940             targetmkdir=$pwd/Cross/mkdir
2941             to=$pwd/Cross/to
2942             from=$pwd/Cross/from
2943             ;;
2944         esac
2945         case "$targetrun" in
2946         '') targetrun=ssh ;;
2947         esac
2948         case "$targetto" in
2949         '') targetto=scp ;;
2950         esac
2951         case "$targetfrom" in
2952         '') targetfrom=scp ;;
2953         esac
2954         run=$run-$targetrun
2955         to=$to-$targetto
2956         from=$from-$targetfrom
2957         case "$targetdir" in
2958         '')  targetdir=/tmp
2959              echo "Guessing targetdir $targetdir." >&4
2960              ;;
2961         esac
2962         case "$targetuser" in
2963         '')  targetuser=root
2964              echo "Guessing targetuser $targetuser." >&4
2965              ;;
2966         esac
2967         case "$targetport" in
2968         '')  targetport=22
2969              echo "Guessing targetport $targetport." >&4
2970              ;;
2971         esac
2972         case "$targetfrom" in
2973         scp)    q=-q ;;
2974         *)      q='' ;;
2975         esac
2976         case "$targetrun" in
2977         ssh|rsh)
2978             cat >$run <<EOF
2979 #!/bin/sh
2980 env=''
2981 case "\$1" in
2982 -cwd)
2983   shift
2984   cwd=\$1
2985   shift
2986   ;;
2987 esac
2988 case "\$1" in
2989 -env)
2990   shift
2991   env=\$1
2992   shift
2993   ;;
2994 esac
2995 case "\$cwd" in
2996 '') cwd=$targetdir ;;
2997 esac
2998 exe=\$1
2999 shift
3000 $to \$exe
3001 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3002 EOF
3003             ;;
3004         adb)
3005             $touch $run
3006             ;;
3007         *)  echo "Unknown targetrun '$targetrun'" >&4
3008             exit 1
3009             ;;
3010         esac
3011         case "$targetmkdir" in
3012         */Cross/mkdir)
3013             cat >$targetmkdir <<EOF
3014 #!/bin/sh
3015 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3016 EOF
3017             $chmod a+rx $targetmkdir
3018             ;;
3019         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3020             exit 1
3021             ;;
3022         esac
3023         case "$targetto" in
3024         scp|rcp)
3025             cat >$to <<EOF
3026 #!/bin/sh
3027 for f in \$@
3028 do
3029   case "\$f" in
3030   /*)
3031     $targetmkdir \`dirname \$f\`
3032     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f            || exit 1
3033     ;;
3034   *)
3035     $targetmkdir $targetdir/\`dirname \$f\`
3036     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f  2>/dev/null || exit 1
3037     ;;
3038   esac
3039 done
3040 exit 0
3041 EOF
3042             ;;
3043         cp) cat >$to <<EOF
3044 #!/bin/sh
3045 for f in \$@
3046 do
3047   case "\$f" in
3048   /*)
3049     $mkdir -p $targetdir/\`dirname \$f\`
3050     $cp \$f $targetdir/\$f || exit 1
3051     ;;
3052   *)
3053     $targetmkdir $targetdir/\`dirname \$f\`
3054     $cp \$f $targetdir/\$f || exit 1
3055     ;;
3056   esac
3057 done
3058 exit 0
3059 EOF
3060             ;;
3061         *)  echo "Unknown targetto '$targetto'" >&4
3062             exit 1
3063             ;;
3064         esac
3065         case "$targetfrom" in
3066         scp|rcp)
3067           cat >$from <<EOF
3068 #!/bin/sh
3069 for f in \$@
3070 do
3071   $rm -f \$f
3072   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3073 done
3074 exit 0
3075 EOF
3076             ;;
3077         cp) cat >$from <<EOF
3078 #!/bin/sh
3079 for f in \$@
3080 do
3081   $rm -f \$f
3082   cp $targetdir/\$f . || exit 1
3083 done
3084 exit 0
3085 EOF
3086             ;;
3087         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3088             exit 1
3089             ;;
3090         esac
3091         if $test ! -f $run; then
3092             echo "Target 'run' script '$run' not found." >&4
3093         else
3094             $chmod a+rx $run
3095         fi
3096         if $test ! -f $to; then
3097             echo "Target 'to' script '$to' not found." >&4
3098         else
3099             $chmod a+rx $to
3100         fi
3101         if $test ! -f $from; then
3102             echo "Target 'from' script '$from' not found." >&4
3103         else
3104             $chmod a+rx $from
3105         fi
3106         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3107             exit 1
3108         fi
3109         cat >&4 <<EOF
3110 Using '$run' for remote execution,
3111 and '$from' and '$to'
3112 for remote file transfer.
3113 EOF
3114         ;;
3115 *)      run=''
3116         to=:
3117         from=:
3118         usecrosscompile="$undef"
3119         targetarch=''
3120         ;;
3121 esac
3122
3123 : see whether [:lower:] and [:upper:] are supported character classes
3124 echo " "
3125 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3126 ABYZ)
3127         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3128         up='[:upper:]'
3129         low='[:lower:]'
3130         ;;
3131 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3132         # (0xd9 and 0xe2), therefore that is a nice testing point.
3133         if test "X$up" = X -o "X$low" = X; then
3134             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3135             rs) up='[A-Z]'
3136                 low='[a-z]'
3137                 ;;
3138             esac
3139         fi
3140         if test "X$up" = X -o "X$low" = X; then
3141             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3142             rs) up='A-Z'
3143                 low='a-z'
3144                 ;;
3145             esac
3146         fi
3147         if test "X$up" = X -o "X$low" = X; then
3148             case "`echo RS | od -x 2>/dev/null`" in
3149             *D9E2*|*d9e2*)
3150                 echo "Hey, this might be EBCDIC." >&4
3151                 if test "X$up" = X -o "X$low" = X; then
3152                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3153                     rs) up='[A-IJ-RS-Z]'
3154                         low='[a-ij-rs-z]'
3155                         ;;
3156                     esac
3157                 fi
3158                 if test "X$up" = X -o "X$low" = X; then
3159                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3160                     rs) up='A-IJ-RS-Z'
3161                         low='a-ij-rs-z'
3162                         ;;
3163                     esac
3164                 fi
3165                 ;;
3166             esac
3167         fi
3168 esac
3169 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3170 rs)
3171     echo "Using $up and $low to convert case." >&4
3172     ;;
3173 *)
3174     echo "I don't know how to translate letters from upper to lower case." >&4
3175     echo "Your tr is not acting any way I know of." >&4
3176     exit 1
3177     ;;
3178 esac
3179 : set up the translation script tr, must be called with ./tr of course
3180 cat >tr <<EOSC
3181 $startsh
3182 case "\$1\$2" in
3183 '[A-Z][a-z]') exec $tr '$up' '$low';;
3184 '[a-z][A-Z]') exec $tr '$low' '$up';;
3185 esac
3186 exec $tr "\$@"
3187 EOSC
3188 chmod +x tr
3189 $eunicefix tr
3190
3191 : Try to determine whether config.sh was made on this system
3192 case "$config_sh" in
3193 '')
3194 myuname=`$uname -a 2>/dev/null`
3195 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3196 # Downcase everything to avoid ambiguity.
3197 # Remove slashes and single quotes so we can use parts of this in
3198 # directory and file names.
3199 # Remove newlines so myuname is sane to use elsewhere.
3200 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3201 # because the A-Z/a-z are not consecutive.
3202 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3203         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3204 newmyuname="$myuname"
3205 dflt=n
3206 case "$knowitall" in
3207 '')
3208         if test -f ../config.sh; then
3209                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3210                         eval "`grep myuname= ../config.sh`"
3211                 fi
3212                 if test "X$myuname" = "X$newmyuname"; then
3213                         dflt=y
3214                 fi
3215         fi
3216         ;;
3217 *) dflt=y;;
3218 esac
3219
3220 : Get old answers from old config file if Configure was run on the
3221 : same system, otherwise use the hints.
3222 hint=default
3223 cd ..
3224 if test -f config.sh; then
3225         echo " "
3226         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3227         . UU/myread
3228         case "$ans" in
3229         n*|N*) echo "OK, I'll ignore it."
3230                 mv config.sh config.sh.old
3231                 myuname="$newmyuname"
3232                 ;;
3233         *)  echo "Fetching default answers from your old config.sh file..." >&4
3234                 tmp_n="$n"
3235                 tmp_c="$c"
3236                 tmp_sh="$sh"
3237                 . ./config.sh
3238                 cp config.sh UU
3239                 n="$tmp_n"
3240                 c="$tmp_c"
3241                 : Older versions did not always set $sh.  Catch re-use of such
3242                 : an old config.sh.
3243                 case "$sh" in
3244                 '') sh="$tmp_sh" ;;
3245                 esac
3246                 hint=previous
3247                 ;;
3248         esac
3249 fi
3250 . ./UU/checkcc
3251 if test ! -f config.sh; then
3252         $cat <<EOM
3253
3254 First time through, eh?  I have some defaults handy for some systems
3255 that need some extra help getting the Configure answers right:
3256
3257 EOM
3258         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3259         dflt=''
3260         : Half the following guesses are probably wrong... If you have better
3261         : tests or hints, please send them to perlbug@perl.org
3262         : The metaconfig authors would also appreciate a copy...
3263         $test -f /irix && osname=irix
3264         $test -f /xenix && osname=sco_xenix
3265         $test -f /dynix && osname=dynix
3266         $test -f /dnix && osname=dnix
3267         $test -f /lynx.os && osname=lynxos
3268         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3269         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3270         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3271         $test -f /bin/mips && /bin/mips && osname=mips
3272         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3273                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3274         $test -d /usr/apollo/bin && osname=apollo
3275         $test -f /etc/saf/_sactab && osname=svr4
3276         $test -d /usr/include/minix && osname=minix
3277         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3278         if $test -d /MachTen -o -d /MachTen_Folder; then
3279                 osname=machten
3280                 if $test -x /sbin/version; then
3281                         osvers=`/sbin/version | $awk '{print $2}' |
3282                         $sed -e 's/[A-Za-z]$//'`
3283                 elif $test -x /usr/etc/version; then
3284                         osvers=`/usr/etc/version | $awk '{print $2}' |
3285                         $sed -e 's/[A-Za-z]$//'`
3286                 else
3287                         osvers="$2.$3"
3288                 fi
3289         fi
3290
3291         $test -f /sys/posix.dll &&
3292                 $test -f /usr/bin/what &&
3293                 set X `/usr/bin/what /sys/posix.dll` &&
3294                 $test "$3" = UWIN &&
3295                 osname=uwin &&
3296                 osvers="$5"
3297
3298         if $test -f $uname; then
3299                 set X $myuname
3300                 shift
3301
3302                 case "$5" in
3303                 fps*) osname=fps ;;
3304                 mips*)
3305                         case "$4" in
3306                         umips) osname=umips ;;
3307                         *) osname=mips ;;
3308                         esac;;
3309                 [23]100) osname=mips ;;
3310                 next*) osname=next ;;
3311                 i386*)
3312                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3313                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3314                                 osname='sco'
3315                                 osvers=$tmp
3316                         elif $test -f /etc/kconfig; then
3317                                 osname=isc
3318                                 if test "$lns" = "$ln -s"; then
3319                                         osvers=4
3320                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3321                                         osvers=3
3322                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3323                                         osvers=2
3324                                 fi
3325                         fi
3326                         tmp=''
3327                         ;;
3328                 pc*)
3329                         if test -n "$DJGPP"; then
3330                                 osname=dos
3331                                 osvers=djgpp
3332                         fi
3333                         ;;
3334                 esac
3335
3336                 case "$1" in
3337                 aix) osname=aix
3338                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3339                         case "$tmp" in
3340                         # oslevel can fail with:
3341                         # oslevel: Unable to acquire lock.
3342                         *not\ found) osvers="$4"."$3" ;;
3343                         '<3240'|'<>3240') osvers=3.2.0 ;;
3344                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3345                         '=3250'|'>3250') osvers=3.2.5 ;;
3346                         *) osvers=$tmp;;
3347                         esac
3348                         ;;
3349                 bitrig) osname=bitrig
3350                         osvers="$3"
3351                         ;;
3352                 bsd386) osname=bsd386
3353                         osvers=`$uname -r`
3354                         ;;
3355                 cygwin*) osname=cygwin
3356                         osvers="$3"
3357                         ;;
3358                 *dc.osx) osname=dcosx
3359                         osvers="$3"
3360                         ;;
3361                 dnix) osname=dnix
3362                         osvers="$3"
3363                         ;;
3364                 domainos) osname=apollo
3365                         osvers="$3"
3366                         ;;
3367                 dgux)   osname=dgux
3368                         osvers="$3"
3369                         ;;
3370                 dragonfly) osname=dragonfly
3371                         osvers="$3"
3372                         ;;
3373                 dynixptx*) osname=dynixptx
3374                         osvers=`echo "$4"|sed 's/^v//'`
3375                         ;;
3376                 freebsd) osname=freebsd
3377                         osvers="$3" ;;
3378                 genix)  osname=genix ;;
3379                 gnu)    osname=gnu
3380                         osvers="$3" ;;
3381                 hp*)    osname=hpux
3382                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3383                         ;;
3384                 irix*)  osname=irix
3385                         case "$3" in
3386                         4*) osvers=4 ;;
3387                         5*) osvers=5 ;;
3388                         *)      osvers="$3" ;;
3389                         esac
3390                         ;;
3391                 linux)  osname=linux
3392                         case "$3" in
3393                         *)      osvers="$3" ;;
3394                         esac
3395                         $test -f /system/lib/libandroid.so && osname=linux-android
3396                         ;;
3397                 MiNT)   osname=mint
3398                         ;;
3399                 netbsd*) osname=netbsd
3400                         osvers="$3"
3401                         ;;
3402                 news-os) osvers="$3"
3403                         case "$3" in
3404                         4*) osname=newsos4 ;;
3405                         *) osname=newsos ;;
3406                         esac
3407                         ;;
3408                 next*) osname=next ;;
3409                 nonstop-ux) osname=nonstopux ;;
3410                 openbsd) osname=openbsd
3411                         osvers="$3"
3412                         ;;
3413                 os2)    osname=os2
3414                         osvers="$4"
3415                         ;;
3416                 POSIX-BC | posix-bc ) osname=posix-bc
3417                         osvers="$3"
3418                         ;;
3419                 powerux | power_ux | powermax_os | powermaxos | \
3420                 powerunix | power_unix) osname=powerux
3421                         osvers="$3"
3422                         ;;
3423                 qnx) osname=qnx
3424                         osvers="$4"
3425                         ;;
3426                 solaris) osname=solaris
3427                         case "$3" in
3428                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3429                         *)      osvers="$3" ;;
3430                         esac
3431                         ;;
3432                 sunos) osname=sunos
3433                         case "$3" in
3434                         5*) osname=solaris
3435                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3436                         *)      osvers="$3" ;;
3437                         esac
3438                         ;;
3439                 titanos) osname=titanos
3440                         case "$3" in
3441                         1*) osvers=1 ;;
3442                         2*) osvers=2 ;;
3443                         3*) osvers=3 ;;
3444                         4*) osvers=4 ;;
3445                         *)      osvers="$3" ;;
3446                         esac
3447                         ;;
3448                 ultrix) osname=ultrix
3449                         osvers="$3"
3450                         ;;
3451                 osf1|mls+)      case "$5" in
3452                                 alpha)
3453                                         osname=dec_osf
3454                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3455                                         case "$osvers" in
3456                                         [1-9].[0-9]*) ;;
3457                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3458                                         esac
3459                                         ;;
3460                         hp*)    osname=hp_osf1  ;;
3461                         mips)   osname=mips_osf1 ;;
3462                         esac
3463                         ;;
3464                 # UnixWare 7.1.2 is known as Open UNIX 8
3465                 openunix|unixware) osname=svr5
3466                         osvers="$4"
3467                         ;;
3468                 uts)    osname=uts
3469                         osvers="$3"
3470                         ;;
3471                 vos) osvers="$3"
3472                         ;;
3473                 $2) case "$osname" in
3474                         *isc*) ;;
3475                         *freebsd*) ;;
3476                         svr*)
3477                                 : svr4.x or possibly later
3478                                 case "svr$3" in
3479                                 ${osname}*)
3480                                         osname=svr$3
3481                                         osvers=$4
3482                                         ;;
3483                                 esac
3484                                 case "$osname" in
3485                                 svr4.0)
3486                                         : Check for ESIX
3487                                         if test -f /stand/boot ; then
3488                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3489                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3490                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3491                                                         if test -n "$isesix"; then
3492                                                                 osname=esix4
3493                                                         fi
3494                                                 fi
3495                                         fi
3496                                         ;;
3497                                 esac
3498                                 ;;
3499                         *)      if test -f /etc/systemid; then
3500                                         osname=sco
3501                                         set `echo $3 | $sed 's/\./ /g'` $4
3502                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3503                                                 osvers=$1.$2.$3
3504                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3505                                                 osvers=$1.$2
3506                                         elif $test -f $src/hints/sco_$1.sh; then
3507                                                 osvers=$1
3508                                         fi
3509                                 else
3510                                         case "$osname" in
3511                                         '') : Still unknown.  Probably a generic Sys V.
3512                                                 osname="sysv"
3513                                                 osvers="$3"
3514                                                 ;;
3515                                         esac
3516                                 fi
3517                                 ;;
3518                         esac
3519                         ;;
3520                 *)      case "$osname" in
3521                         '') : Still unknown.  Probably a generic BSD.
3522                                 osname="$1"
3523                                 osvers="$3"
3524                                 ;;
3525                         esac
3526                         ;;
3527                 esac
3528         else
3529                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3530                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3531                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3532                                 osname=news_os
3533                         fi
3534                         $rm -f UU/kernel.what
3535                 elif test -d c:/. -o -n "$is_os2" ; then
3536                         set X $myuname
3537                         osname=os2
3538                         osvers="$5"
3539                 fi
3540         fi
3541
3542         case "$targetarch" in
3543         '') ;;
3544         *)  hostarch=$osname
3545             case "$targetarch" in
3546                 nto*|*-nto-*)
3547                     # Will load qnx.sh, which should change osname to nto
3548                     osname=qnx
3549                     osvers=''
3550                     ;;
3551                 *linux-android*)
3552                     # Catch arm-linux-androideabi, mipsel-linux-android,
3553                     # and i686-linux-android
3554                     osname=linux-android
3555                     osvers=''
3556                     ;;
3557                 *linux*)
3558                     # Something like arm-linux-gnueabihf is really just
3559                     # plain linux.
3560                     osname=linux
3561                     osvers=''
3562                     ;;
3563                 *solaris*|*sunos*)
3564                     osname=solaris
3565                     # XXX perhaps we should just assume
3566                     # osvers to be 2, or maybe take the value
3567                     # from targetarch. Using $run before the
3568                     # hints are run is somewhat icky.
3569                     set X `$run $uname -a 2>/dev/null`
3570                     shift
3571                     case "$3" in
3572                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3573                         *)  osvers="$3" ;;
3574                     esac
3575                     ;;
3576                 *)
3577                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3578                     osvers=''
3579                 ;;
3580             esac
3581             ;;
3582         esac
3583
3584         : Now look for a hint file osname_osvers, unless one has been
3585         : specified already.
3586         case "$hintfile" in
3587         ''|' ')
3588                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3589                 : Also try without trailing minor version numbers.
3590                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3591                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3592                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3593                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3594                 case "$file" in
3595                 '') dflt=none ;;
3596                 *)  case "$osvers" in
3597                         '') dflt=$file
3598                                 ;;
3599                         *)  if $test -f $src/hints/$file.sh ; then
3600                                         dflt=$file
3601                                 elif $test -f $src/hints/$xfile.sh ; then
3602                                         dflt=$xfile
3603                                 elif $test -f $src/hints/$xxfile.sh ; then
3604                                         dflt=$xxfile
3605                                 elif $test -f $src/hints/$xxxfile.sh ; then
3606                                         dflt=$xxxfile
3607                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3608                                         dflt=$xxxxfile
3609                                 elif $test -f "$src/hints/${osname}.sh" ; then
3610                                         dflt="${osname}"
3611                                 else
3612                                         dflt=none
3613                                 fi
3614                                 ;;
3615                         esac
3616                         ;;
3617                 esac
3618                 if $test -f Policy.sh ; then
3619                         case "$dflt" in
3620                         *Policy*) ;;
3621                         none) dflt="Policy" ;;
3622                         *) dflt="Policy $dflt" ;;
3623                         esac
3624                 fi
3625                 ;;
3626         *)
3627                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3628                 ;;
3629         esac
3630
3631         if $test -f Policy.sh ; then
3632                 $cat <<EOM
3633
3634 There's also a Policy hint file available, which should make the
3635 site-specific (policy) questions easier to answer.
3636 EOM
3637
3638         fi
3639
3640         $cat <<EOM
3641
3642 You may give one or more space-separated answers, or "none" if appropriate.
3643 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3644 previous run of Configure, you may specify it as well as or instead of
3645 OS-specific hints.  If hints are provided for your OS, you should use them:
3646 although Perl can probably be built without hints on many platforms, using
3647 hints often improve performance and may enable features that Configure can't
3648 set up on its own. If there are no hints that match your OS, specify "none";
3649 DO NOT give a wrong version or a wrong OS.
3650
3651 EOM
3652
3653         rp="Which of these apply, if any?"
3654         . UU/myread
3655         tans=$ans
3656         for file in $tans; do
3657                 if $test X$file = XPolicy -a -f Policy.sh; then
3658                         . Policy.sh
3659                         $cat Policy.sh >> UU/config.sh
3660                 elif $test -f $src/hints/$file.sh; then
3661                         . $src/hints/$file.sh
3662                         $cat $src/hints/$file.sh >> UU/config.sh
3663                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3664                         : nothing
3665                 else
3666                         : Give one chance to correct a possible typo.
3667                         echo "$file.sh does not exist"
3668                         dflt=$file
3669                         rp="hint to use instead?"
3670                         . UU/myread
3671                         for file in $ans; do
3672                                 if $test -f "$src/hints/$file.sh"; then
3673                                         . $src/hints/$file.sh
3674                                         $cat $src/hints/$file.sh >> UU/config.sh
3675                                 elif $test X$ans = X -o X$ans = Xnone ; then
3676                                         : nothing
3677                                 else
3678                                         echo "$file.sh does not exist -- ignored."
3679                                 fi
3680                         done
3681                 fi
3682         done
3683
3684         hint=recommended
3685         : Remember our hint file for later.
3686         if $test -f "$src/hints/$file.sh" ; then
3687                 hintfile="$file"
3688         else
3689                 hintfile=''
3690         fi
3691 fi
3692 cd UU
3693 ;;
3694 *)
3695         echo " "
3696         echo "Fetching default answers from $config_sh..." >&4
3697         tmp_n="$n"
3698         tmp_c="$c"
3699         cd ..
3700         cp $config_sh config.sh 2>/dev/null
3701         chmod +w config.sh
3702         . ./config.sh
3703         cd UU
3704         cp ../config.sh .
3705         n="$tmp_n"
3706         c="$tmp_c"
3707         hint=previous
3708         ;;
3709 esac
3710 test "$override" && . ./optdef.sh
3711
3712 : Restore computed paths
3713 for file in $loclist $trylist; do
3714         eval $file="\$_$file"
3715 done
3716
3717 cat << EOM
3718
3719 Configure uses the operating system name and version to set some defaults.
3720 The default value is probably right if the name rings a bell. Otherwise,
3721 since spelling matters for me, either accept the default or answer "none"
3722 to leave it blank.
3723
3724 EOM
3725 case "$osname" in
3726         ''|' ')
3727                 case "$hintfile" in
3728                 ''|' '|none) dflt=none ;;
3729                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3730                 esac
3731                 ;;
3732         *) dflt="$osname" ;;
3733 esac
3734 rp="Operating system name?"
3735 . ./myread
3736 case "$ans" in
3737 none)  osname='' ;;
3738 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3739 esac
3740 echo " "
3741 case "$osvers" in
3742         ''|' ')
3743                 case "$hintfile" in
3744                 ''|' '|none) dflt=none ;;
3745                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3746                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3747                         case "$dflt" in
3748                         ''|' ') dflt=none ;;
3749                         esac
3750                         ;;
3751                 esac
3752                 ;;
3753         *) dflt="$osvers" ;;
3754 esac
3755 rp="Operating system version?"
3756 . ./myread
3757 case "$ans" in
3758 none)  osvers='' ;;
3759 *) osvers="$ans" ;;
3760 esac
3761
3762
3763 . ./posthint.sh
3764
3765 : who configured the system
3766 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3767 case "$cf_by" in
3768 "")
3769         cf_by=`(logname) 2>/dev/null`
3770         case "$cf_by" in
3771         "")
3772                 cf_by=`(whoami) 2>/dev/null`
3773                 case "$cf_by" in
3774                 "") cf_by=unknown ;;
3775                 esac ;;
3776         esac ;;
3777 esac
3778
3779 : decide how portable to be.  Allow command line overrides.
3780 case "$d_portable" in
3781 "$undef") ;;
3782 *)      d_portable="$define" ;;
3783 esac
3784
3785 : set up shell script to do ~ expansion
3786 cat >filexp <<EOSS
3787 $startsh
3788 : expand filename
3789 case "\$1" in
3790  \~/*|\~)
3791         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3792         ;;
3793  \~*)
3794         if $test -f /bin/csh; then
3795                 /bin/csh -f -c "glob \$1"
3796                 failed=\$?
3797                 echo ""
3798                 exit \$failed
3799         else
3800                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3801                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3802                 if $test ! -d "\$dir"; then
3803                         me=\`basename \$0\`
3804                         echo "\$me: can't locate home directory for: \$name" >&2
3805                         exit 1
3806                 fi
3807                 case "\$1" in
3808                 */*)
3809                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3810                         ;;
3811                 *)
3812                         echo \$dir
3813                         ;;
3814                 esac
3815         fi
3816         ;;
3817 *)
3818         echo \$1
3819         ;;
3820 esac
3821 EOSS
3822 chmod +x filexp
3823 $eunicefix filexp
3824
3825 : now set up to get a file name
3826 cat <<EOS >getfile
3827 $startsh
3828 EOS
3829 cat <<'EOSC' >>getfile
3830 tilde=''
3831 fullpath=''
3832 already=''
3833 skip=''
3834 none_ok=''
3835 exp_file=''
3836 nopath_ok=''
3837 orig_rp="$rp"
3838 orig_dflt="$dflt"
3839 case "$gfpth" in
3840 '') gfpth='.' ;;
3841 esac
3842
3843 case "$fn" in
3844 *\(*)
3845         : getfile will accept an answer from the comma-separated list
3846         : enclosed in parentheses even if it does not meet other criteria.
3847         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3848         fn=`echo $fn | sed 's/(.*)//'`
3849         ;;
3850 esac
3851
3852 case "$fn" in
3853 *:*)
3854         loc_file=`expr $fn : '.*:\(.*\)'`
3855         fn=`expr $fn : '\(.*\):.*'`
3856         ;;
3857 esac
3858
3859 case "$fn" in
3860 *~*) tilde=true;;
3861 esac
3862 case "$fn" in
3863 */*) fullpath=true;;
3864 esac
3865 case "$fn" in
3866 *+*) skip=true;;
3867 esac
3868 case "$fn" in
3869 *n*) none_ok=true;;
3870 esac
3871 case "$fn" in
3872 *e*) exp_file=true;;
3873 esac
3874 case "$fn" in
3875 *p*) nopath_ok=true;;
3876 esac
3877
3878 case "$fn" in
3879 *f*) type='File';;
3880 *d*) type='Directory';;
3881 *l*) type='Locate';;
3882 esac
3883
3884 what="$type"
3885 case "$what" in
3886 Locate) what='File';;
3887 esac
3888
3889 case "$exp_file" in
3890 '')
3891         case "$d_portable" in
3892         "$define") ;;
3893         *) exp_file=true;;
3894         esac
3895         ;;
3896 esac
3897
3898 cd ..
3899 while test "$type"; do
3900         redo=''
3901         rp="$orig_rp"
3902         dflt="$orig_dflt"
3903         case "$tilde" in
3904         true) rp="$rp (~name ok)";;
3905         esac
3906         . UU/myread
3907         if test -f UU/getfile.ok && \
3908                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3909         then
3910                 value="$ans"
3911                 ansexp="$ans"
3912                 break
3913         fi
3914         case "$ans" in
3915         none)
3916                 value=''
3917                 ansexp=''
3918                 case "$none_ok" in
3919                 true) type='';;
3920                 esac
3921                 ;;
3922         *)
3923                 case "$tilde" in
3924                 '') value="$ans"
3925                         ansexp="$ans";;
3926                 *)
3927                         value=`UU/filexp $ans`
3928                         case $? in
3929                         0)
3930                                 if test "$ans" != "$value"; then
3931                                         echo "(That expands to $value on this system.)"
3932                                 fi
3933                                 ;;
3934                         *) value="$ans";;
3935                         esac
3936                         ansexp="$value"
3937                         case "$exp_file" in
3938                         '') value="$ans";;
3939                         esac
3940                         ;;
3941                 esac
3942                 case "$fullpath" in
3943                 true)
3944                         case "$ansexp" in
3945                         /*) value="$ansexp" ;;
3946                         [a-zA-Z]:/*) value="$ansexp" ;;
3947                         *)
3948                                 redo=true
3949                                 case "$already" in
3950                                 true)
3951                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3952                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3953                                         ;;
3954                                 *)
3955                                 echo "Please give a full path name, starting with slash." >&4
3956                                         case "$tilde" in
3957                                         true)
3958                                 echo "Note that using ~name is ok provided it expands well." >&4
3959                                                 already=true
3960                                                 ;;
3961                                         esac
3962                                 esac
3963                                 ;;
3964                         esac
3965                         ;;
3966                 esac
3967                 case "$redo" in
3968                 '')
3969                         case "$type" in
3970                         File)
3971                                 for fp in $gfpth; do
3972                                         if test "X$fp" = X.; then
3973                                             pf="$ansexp"
3974                                         else    
3975                                             pf="$fp/$ansexp"
3976                                         fi
3977                                         if test -f "$pf"; then
3978                                                 type=''
3979                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3980                                         then
3981                                                 echo "($value is not a plain file, but that's ok.)"
3982                                                 type=''
3983                                         fi
3984                                         if test X"$type" = X; then
3985                                             value="$pf"
3986                                             break
3987                                         fi
3988                                 done
3989                                 ;;
3990                         Directory)
3991                                 for fp in $gfpth; do
3992                                         if test "X$fp" = X.; then
3993                                             dir="$ans"
3994                                             direxp="$ansexp"
3995                                         else    
3996                                             dir="$fp/$ansexp"
3997                                             direxp="$fp/$ansexp"
3998                                         fi
3999                                         if test -d "$direxp"; then
4000                                                 type=''
4001                                                 value="$dir"
4002                                                 break
4003                                         fi
4004                                 done
4005                                 ;;
4006                         Locate)
4007                                 if test -d "$ansexp"; then
4008                                         echo "(Looking for $loc_file in directory $value.)"
4009                                         value="$value/$loc_file"
4010                                         ansexp="$ansexp/$loc_file"
4011                                 fi
4012                                 if test -f "$ansexp"; then
4013                                         type=''
4014                                 fi
4015                                 case "$nopath_ok" in
4016                                 true)   case "$value" in
4017                                         */*) ;;
4018                                         *)      echo "Assuming $value will be in people's path."
4019                                                 type=''
4020                                                 ;;
4021                                         esac
4022                                         ;;
4023                                 esac
4024                                 ;;
4025                         esac
4026
4027                         case "$skip" in
4028                         true) type='';
4029                         esac
4030
4031                         case "$type" in
4032                         '') ;;
4033                         *)
4034                                 if test "$fastread" = yes; then
4035                                         dflt=y
4036                                 else
4037                                         dflt=n
4038                                 fi
4039                                 rp="$what $value doesn't exist.  Use that name anyway?"
4040                                 . UU/myread
4041                                 dflt=''
4042                                 case "$ans" in
4043                                 y*) type='';;
4044                                 *) echo " ";;
4045                                 esac
4046                                 ;;
4047                         esac
4048                         ;;
4049                 esac
4050                 ;;
4051         esac
4052 done
4053 cd UU
4054 ans="$value"
4055 rp="$orig_rp"
4056 dflt="$orig_dflt"
4057 rm -f getfile.ok
4058 test "X$gfpthkeep" != Xy && gfpth=""
4059 EOSC
4060
4061 : determine root of directory hierarchy where package will be installed.
4062 case "$prefix" in
4063 '')
4064         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4065         ;;
4066 *?/)
4067         dflt=`echo "$prefix" | sed 's/.$//'`
4068         ;;
4069 *)
4070         dflt="$prefix"
4071         ;;
4072 esac
4073 $cat <<EOM
4074
4075 By default, $package will be installed in $dflt/bin, manual pages
4076 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4077 installation directories. Typically this is something like /usr/local.
4078 If you wish to have binaries under /usr/bin but other parts of the
4079 installation under /usr/local, that's ok: you will be prompted
4080 separately for each of the installation directories, the prefix being
4081 only used to set the defaults.
4082
4083 EOM
4084 fn=d~
4085 rp='Installation prefix to use?'
4086 . ./getfile
4087 oldprefix=''
4088 case "$prefix" in
4089 '') ;;
4090 *)
4091         case "$ans" in
4092         "$prefix") ;;
4093         *) oldprefix="$prefix";;
4094         esac
4095         ;;
4096 esac
4097 prefix="$ans"
4098 prefixexp="$ansexp"
4099
4100 : allow them to override the AFS root
4101 case "$afsroot" in
4102 '')     afsroot=/afs ;;
4103 *)      afsroot=$afsroot ;;
4104 esac
4105
4106 : is AFS running?
4107 echo " "
4108 case "$afs" in
4109 $define|true)   afs=true ;;
4110 $undef|false)   afs=false ;;
4111 *)      if $test -d $afsroot; then
4112                 afs=true
4113         else
4114                 afs=false
4115         fi
4116         ;;
4117 esac
4118 if $afs; then
4119         echo "AFS may be running... I'll be extra cautious then..." >&4
4120 else
4121         echo "AFS does not seem to be running..." >&4
4122 fi
4123
4124 : determine installation prefix for where package is to be installed.
4125 if $afs; then
4126 $cat <<EOM
4127
4128 Since you are running AFS, I need to distinguish the directory in which
4129 files will reside from the directory in which they are installed (and from
4130 which they are presumably copied to the former directory by occult means).
4131
4132 EOM
4133         case "$installprefix" in
4134         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4135         *) dflt="$installprefix";;
4136         esac
4137 else
4138 $cat <<EOM
4139
4140 In some special cases, particularly when building $package for distribution,
4141 it is convenient to distinguish the directory in which files should be
4142 installed from the directory ($prefix) in which they will
4143 eventually reside.  For most users, these two directories are the same.
4144
4145 EOM
4146         case "$installprefix" in
4147         '') dflt=$prefix ;;
4148         *) dflt=$installprefix;;
4149         esac
4150 fi
4151 fn=d~
4152 rp='What installation prefix should I use for installing files?'
4153 . ./getfile
4154 installprefix="$ans"
4155 installprefixexp="$ansexp"
4156
4157 : Perform the prefixexp/installprefixexp correction if necessary
4158 cat <<EOS >installprefix
4159 $startsh
4160 EOS
4161 cat <<'EOSC' >>installprefix
4162 : Change installation prefix, if necessary.
4163 if $test X"$prefix" != X"$installprefix"; then
4164     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4165 else
4166     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4167 fi
4168 EOSC
4169 chmod +x installprefix
4170 $eunicefix installprefix
4171
4172 : Set variables such as privlib and privlibexp from the output of ./getfile
4173 : performing the prefixexp/installprefixexp correction if necessary.
4174 cat <<EOS >setprefixvar
4175 $startsh
4176 EOS
4177 cat <<'EOSC' >>setprefixvar
4178 eval "${prefixvar}=\"\$ans\""
4179 eval "${prefixvar}exp=\"\$ansexp\""
4180 . ./installprefix
4181 EOSC
4182 chmod +x setprefixvar
4183 $eunicefix setprefixvar
4184
4185 : set up the script used to warn in case of inconsistency
4186 cat <<EOS >whoa
4187 $startsh
4188 EOS
4189 cat <<'EOSC' >>whoa
4190 dflt=y
4191 case "$hint" in
4192     recommended)
4193         case "$hintfile" in
4194         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4195                 ;;
4196         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4197                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4198                 ;;
4199         esac
4200         ;;
4201     *)  echo " "
4202         echo "*** WHOA THERE!!! ***" >&4
4203         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4204         ;;
4205 esac
4206 rp="    Keep the $hint value?"
4207 . ./myread
4208 case "$ans" in
4209 y) td=$was; tu=$was;;
4210 esac
4211 EOSC
4212
4213 : function used to set '$1' to '$val'
4214 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4215 case "$val$was" in
4216 $define$undef) . ./whoa; eval "$var=\$td";;
4217 $undef$define) . ./whoa; eval "$var=\$tu";;
4218 *) eval "$var=$val";;
4219 esac'
4220
4221 : get the patchlevel
4222 echo " "
4223 echo "Getting the current patchlevel..." >&4
4224 if $test -r $rsrc/patchlevel.h;then
4225         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4226         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4227         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4228         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4229         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4230         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4231         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4232 else
4233         revision=0
4234         patchlevel=0
4235         subversion=0
4236         api_revision=0
4237         api_version=0
4238         api_subversion=0
4239         perl_patchlevel=0
4240         $echo "(You do not have patchlevel.h.  Eek.)"
4241 fi
4242 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4243 version_patchlevel_string="version $patchlevel subversion $subversion"
4244 case "$perl_patchlevel" in
4245 0|'') ;;
4246 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4247     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4248     ;;
4249 esac
4250
4251 $echo "(You have $package $version_patchlevel_string.)"
4252
4253 case "$osname" in
4254 dos|vms)
4255         : XXX Should be a Configure test for double-dots in filenames.
4256         version=`echo $revision $patchlevel $subversion | \
4257                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4258         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4259                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4260         ;;
4261 *)
4262         version=`echo $revision $patchlevel $subversion | \
4263                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4264         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4265                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4266         ;;
4267 esac
4268 : Special case the 5.005_xx maintenance series, which used 5.005
4269 : without any subversion label as a subdirectory in $sitelib
4270 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4271         api_versionstring='5.005'
4272 fi
4273
4274 : Do we want threads support and if so, what type
4275 case "$usethreads" in
4276 $define|true|[yY]*)     dflt='y';;
4277 *)     # Catch case where user specified ithreads or 5005threads but
4278        # forgot -Dusethreads (A.D. 4/2002)
4279        case "$useithreads$use5005threads" in
4280        *$define*)       dflt='y';;
4281        *)               dflt='n';;
4282        esac
4283        ;;
4284 esac
4285 cat <<EOM
4286
4287 Perl can be built to offer a form of threading support on some systems
4288 To do so, Configure can be run with -Dusethreads.
4289
4290 Note that Perl built with threading support runs slightly slower
4291 and uses slightly more memory than plain Perl.
4292
4293 If this doesn't make any sense to you, just accept the default '$dflt'.
4294 EOM
4295 rp='Build a threading Perl?'
4296 . ./myread
4297 case "$ans" in
4298 y|Y)    val="$define" ;;
4299 *)      val="$undef" ;;
4300 esac
4301 set usethreads
4302 eval $setvar
4303
4304 if $test $patchlevel -lt 9; then
4305     case "$usethreads" in
4306     $define)
4307         : Default to ithreads unless overridden on command line or with
4308         : old config.sh
4309         dflt='y'
4310         case "$use5005threads" in
4311                 $define|true|[yY]*)
4312                         echo "5.005 threads are no longer supported"
4313                         exit 1
4314                 ;;
4315         esac
4316         case "$useithreads" in
4317                 $undef|false|[nN]*) dflt='n';;
4318         esac
4319         rp='Use the newer interpreter-based ithreads?'
4320         . ./myread
4321         case "$ans" in
4322         y|Y)    val="$define" ;;
4323         *)      val="$undef" ;;
4324         esac
4325         set useithreads
4326         eval $setvar
4327         : Now set use5005threads to the opposite value.
4328         case "$useithreads" in
4329         $define) val="$undef" ;;
4330         *) val="$define" ;;
4331         esac
4332         set use5005threads
4333         eval $setvar
4334         ;;
4335     *)
4336         useithreads="$undef"
4337         use5005threads="$undef"
4338         ;;
4339     esac
4340
4341     case "$useithreads$use5005threads" in
4342     "$define$define")
4343         $cat >&4 <<EOM
4344
4345 You cannot have both the ithreads and the 5.005 threads enabled
4346 at the same time.  Disabling the 5.005 threads since they are
4347 much less stable than the ithreads.
4348
4349 EOM
4350         use5005threads="$undef"
4351         ;;
4352     esac
4353
4354 else
4355 : perl-5.9.x and later
4356
4357     if test X"$usethreads" = "X$define"; then
4358         case "$use5005threads" in
4359             $define|true|[yY]*)
4360                 $cat >&4 <<EOM
4361
4362 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4363
4364 EOM
4365             ;;
4366         esac
4367     fi
4368
4369     use5005threads="$undef"
4370     useithreads="$usethreads"
4371 fi
4372
4373 case "$d_oldpthreads" in
4374 '')     : Configure tests would be welcome here.  For now, assume undef.
4375         val="$undef" ;;
4376 *)      val="$d_oldpthreads" ;;
4377 esac
4378 set d_oldpthreads
4379 eval $setvar
4380
4381
4382 : Look for a hint-file generated 'call-back-unit'.  If the
4383 : user has specified that a threading perl is to be built,
4384 : we may need to set or change some other defaults.
4385 if $test -f usethreads.cbu; then
4386     echo "Your platform has some specific hints regarding threaded builds, using them..."
4387     . ./usethreads.cbu
4388 else
4389     case "$usethreads" in
4390         "$define"|true|[yY]*)
4391                 $cat <<EOM
4392 (Your platform does not have any specific hints for threaded builds.
4393  Assuming POSIX threads, then.)
4394 EOM
4395         ;;
4396     esac
4397 fi
4398
4399 : Check if multiplicity is required
4400 cat <<EOM
4401
4402 Perl can be built so that multiple Perl interpreters can coexist
4403 within the same Perl executable.
4404 EOM
4405
4406 case "$useithreads" in
4407 $define)
4408         cat <<EOM
4409 This multiple interpreter support is required for interpreter-based threads.
4410 EOM
4411         val="$define"
4412         ;;
4413 *)      case "$usemultiplicity" in
4414         $define|true|[yY]*)     dflt='y';;
4415         *) dflt='n';;
4416         esac
4417         echo " "
4418         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4419         rp='Build Perl for multiplicity?'
4420         . ./myread
4421         case "$ans" in
4422         y|Y)    val="$define" ;;
4423         *)      val="$undef" ;;
4424         esac
4425         ;;
4426 esac
4427 set usemultiplicity
4428 eval $setvar
4429
4430 : Check if morebits is requested
4431 case "$usemorebits" in
4432 "$define"|true|[yY]*)
4433         use64bitint="$define"
4434         uselongdouble="$define"
4435         usemorebits="$define"
4436         ;;
4437 *)      usemorebits="$undef"
4438         ;;
4439 esac
4440
4441 : Determine the C compiler to be used
4442 echo " "
4443 case "$cc" in
4444 '') dflt=cc;;
4445 *) dflt="$cc";;
4446 esac
4447 rp="Use which C compiler?"
4448 . ./myread
4449 cc="$ans"
4450
4451 : See whether they have no cc but they do have gcc
4452 . ./trygcc
4453 if $test -f cc.cbu; then
4454     . ./cc.cbu
4455 fi
4456 . ./checkcc
4457
4458 : make some quick guesses about what we are up against
4459 echo " "
4460 $echo $n "Hmm...  $c"
4461 echo exit 1 >bsd
4462 echo exit 1 >usg
4463 echo exit 1 >v7
4464 echo exit 1 >osf1
4465 echo exit 1 >eunice
4466 echo exit 1 >xenix
4467 echo exit 1 >venix
4468 echo exit 1 >os2
4469 d_bsd="$undef"
4470 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4471 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4472 then
4473         echo "Looks kind of like an OSF/1 system, but we'll see..."
4474         echo exit 0 >osf1
4475 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4476         xxx=`./loc addbib blurfl $pth`
4477         if $test -f $xxx; then
4478         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4479                 echo exit 0 >bsd
4480                 echo exit 0 >usg
4481         else
4482                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4483                         echo "Looks kind of like an extended USG system, but we'll see..."
4484                 else
4485                         echo "Looks kind of like a USG system, but we'll see..."
4486                 fi
4487                 echo exit 0 >usg
4488         fi
4489 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4490         echo "Looks kind of like a BSD system, but we'll see..."
4491         d_bsd="$define"
4492         echo exit 0 >bsd
4493 else
4494         echo "Looks kind of like a Version 7 system, but we'll see..."
4495         echo exit 0 >v7
4496 fi
4497 case "$eunicefix" in
4498 *unixtovms*)
4499         $cat <<'EOI'
4500 There is, however, a strange, musty smell in the air that reminds me of
4501 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4502 EOI
4503         echo exit 0 >eunice
4504         d_eunice="$define"
4505 : it so happens the Eunice I know will not run shell scripts in Unix format
4506         ;;
4507 *)
4508         echo " "
4509         echo "Congratulations.  You aren't running Eunice."
4510         d_eunice="$undef"
4511         ;;
4512 esac
4513 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4514 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4515 : semicolon as a patch separator
4516 case "$p_" in
4517 :) ;;
4518 *)
4519         $cat <<'EOI'
4520 I have the feeling something is not exactly right, however...don't tell me...
4521 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4522 (Or you may be running DOS with DJGPP.)
4523 EOI
4524         echo exit 0 >os2
4525         ;;
4526 esac
4527 if test -f /xenix; then
4528         echo "Actually, this looks more like a XENIX system..."
4529         echo exit 0 >xenix
4530         d_xenix="$define"
4531 else
4532         echo " "
4533         echo "It's not Xenix..."
4534         d_xenix="$undef"
4535 fi
4536 chmod +x xenix
4537 $eunicefix xenix
4538 if test -f /venix; then
4539         echo "Actually, this looks more like a VENIX system..."
4540         echo exit 0 >venix
4541 else
4542         echo " "
4543         if ./xenix; then
4544                 : null
4545         else
4546                 echo "Nor is it Venix..."
4547         fi
4548 fi
4549 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4550 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4551 $rm -f foo
4552
4553 : Check if we are using GNU gcc and what its version is
4554 echo " "
4555 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4556 $cat >try.c <<EOM
4557 #include <stdio.h>
4558 int main() {
4559 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4560 #ifdef __VERSION__
4561         printf("%s\n", __VERSION__);
4562 #else
4563         printf("%s\n", "1");
4564 #endif
4565 #endif
4566         return(0);
4567 }
4568 EOM
4569 if $cc -o try $ccflags $ldflags try.c; then
4570         gccversion=`$run ./try`
4571         case "$gccversion" in
4572         '') echo "You are not using GNU cc." ;;
4573         *)  echo "You are using GNU cc $gccversion."
4574             ccname=gcc
4575             ;;
4576         esac
4577 else
4578         echo " "
4579         echo "*** WHOA THERE!!! ***" >&4
4580         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4581         case "$knowitall" in
4582         '')
4583         echo "    You'd better start hunting for one and let me know about it." >&4
4584                 exit 1
4585                 ;;
4586         esac
4587 fi
4588 $rm -f try try.*
4589 case "$gccversion" in
4590 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4591 esac
4592 case "$gccversion" in
4593 '') gccosandvers='' ;;
4594 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4595    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4596    gccshortvers=''
4597    case "$gccosandvers" in
4598    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4599    $osname$osvers) ;; # looking good
4600    $osname*) cat <<EOM >&4
4601
4602 *** WHOA THERE!!! ***
4603
4604     Your gcc has not been compiled for the exact release of
4605     your operating system ($gccosandvers versus $osname$osvers).
4606
4607     In general it is a good idea to keep gcc synchronized with
4608     the operating system because otherwise serious problems
4609     may ensue when trying to compile software, like Perl.
4610
4611     I'm trying to be optimistic here, though, and will continue.
4612     If later during the configuration and build icky compilation
4613     problems appear (headerfile conflicts being the most common
4614     manifestation), I suggest reinstalling the gcc to match
4615     your operating system release.
4616
4617 EOM
4618       ;;
4619    *) gccosandvers='' ;; # failed to parse, better be silent
4620    esac
4621    ;;
4622 esac
4623 case "$ccname" in
4624 '') ccname="$cc" ;;
4625 esac
4626
4627 # gcc 3.* complain about adding -Idirectories that they already know about,
4628 # so we will take those off from locincpth.
4629 case "$gccversion" in
4630 3*)
4631     echo "main(){}">try.c
4632     for incdir in $locincpth; do
4633        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4634              grep '^c[cp]p*[01]: warning: changing search order '`
4635        if test "X$warn" != X; then
4636            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4637        fi
4638     done
4639     $rm -f try try.*
4640 esac
4641
4642 : What should the include directory be ?
4643 : Use sysroot if set, so findhdr looks in the right place.
4644 echo " "
4645 $echo $n "Hmm...  $c"
4646 dflt="$sysroot/usr/include"
4647 incpath=''
4648 mips_type=''
4649 if $test -f /bin/mips && /bin/mips; then
4650         echo "Looks like a MIPS system..."
4651         $cat >usr.c <<'EOCP'
4652 #ifdef SYSTYPE_BSD43
4653 /bsd43
4654 #endif
4655 EOCP
4656         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4657                 dflt='/bsd43/usr/include'
4658                 incpath='/bsd43'
4659                 mips_type='BSD 4.3'
4660         else
4661                 mips_type='System V'
4662         fi
4663         $rm -f usr.c usr.out
4664         echo "and you're compiling with the $mips_type compiler and libraries."
4665         xxx_prompt=y
4666         echo "exit 0" >mips
4667 else
4668         echo "Doesn't look like a MIPS system."
4669         xxx_prompt=n
4670         echo "exit 1" >mips
4671 fi
4672 chmod +x mips
4673 $eunicefix mips
4674 case "$usrinc" in
4675 '') ;;
4676 *) dflt="$usrinc";;
4677 esac
4678 case "$xxx_prompt" in
4679 y)      fn=d/
4680         echo " "
4681         rp='Where are the include files you want to use?'
4682         . ./getfile
4683         usrinc="$ans"
4684         ;;
4685 *)      usrinc="$dflt"
4686         ;;
4687 esac
4688
4689 : see how we invoke the C preprocessor
4690 echo " "
4691 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4692 cat <<'EOT' >testcpp.c
4693 #define ABC abc
4694 #define XYZ xyz
4695 ABC.XYZ
4696 EOT
4697 cd ..
4698 if test ! -f cppstdin; then
4699         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4700                 # AIX cc -E doesn't show the absolute headerfile
4701                 # locations but we'll cheat by using the -M flag.
4702                 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
4703         else
4704                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4705         fi
4706 else
4707         echo "Keeping your $hint cppstdin wrapper."
4708 fi
4709 chmod 755 cppstdin
4710 wrapper=`pwd`/cppstdin
4711 ok='false'
4712 cd UU
4713
4714 if $test "X$cppstdin" != "X" && \
4715         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4716         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4717 then
4718         echo "You used to use $cppstdin $cppminus so we'll use that again."
4719         case "$cpprun" in
4720         '') echo "But let's see if we can live without a wrapper..." ;;
4721         *)
4722                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4723                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4724                 then
4725                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4726                         ok='true'
4727                 else
4728                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4729                 fi
4730                 ;;
4731         esac
4732 else
4733         case "$cppstdin" in
4734         '') ;;
4735         *)
4736                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4737                 ;;
4738         esac
4739 fi
4740
4741 if $ok; then
4742         : nothing
4743 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4744         $cc -E <testcpp.c >testcpp.out 2>&1; \
4745         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4746         echo "Yup, it does."
4747         x_cpp="$cc $cppflags -E"
4748         x_minus='';
4749 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4750         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4751         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4752         echo "Yup, it does."
4753         x_cpp="$cc $cppflags -E"
4754         x_minus='-';
4755 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4756         $cc -P <testcpp.c >testcpp.out 2>&1; \
4757         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4758         echo "Yipee, that works!"
4759         x_cpp="$cc $cppflags -P"
4760         x_minus='';
4761 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4762         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4763         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4764         echo "At long last!"
4765         x_cpp="$cc $cppflags -P"
4766         x_minus='-';
4767 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4768         $cpp <testcpp.c >testcpp.out 2>&1; \
4769         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4770         echo "It works!"
4771         x_cpp="$cpp $cppflags"
4772         x_minus='';
4773 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4774         $cpp - <testcpp.c >testcpp.out 2>&1; \
4775         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4776         echo "Hooray, it works!  I was beginning to wonder."
4777         x_cpp="$cpp $cppflags"
4778         x_minus='-';
4779 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4780         $wrapper <testcpp.c >testcpp.out 2>&1; \
4781         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4782         x_cpp="$wrapper"
4783         x_minus=''
4784         echo "Eureka!"
4785 else
4786         dflt=''
4787         rp="No dice.  I can't find a C preprocessor.  Name one:"
4788         . ./myread
4789         x_cpp="$ans"
4790         x_minus=''
4791         $x_cpp <testcpp.c >testcpp.out 2>&1
4792         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4793                 echo "OK, that will do." >&4
4794         else
4795 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4796                 exit 1
4797         fi
4798 fi
4799
4800 case "$ok" in
4801 false)
4802         cppstdin="$x_cpp"
4803         cppminus="$x_minus"
4804         cpprun="$x_cpp"
4805         cpplast="$x_minus"
4806         set X $x_cpp
4807         shift
4808         case "$1" in
4809         "$cpp")
4810                 echo "Perhaps can we force $cc -E using a wrapper..."
4811                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4812                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4813                 then
4814                         echo "Yup, we can."
4815                         cppstdin="$wrapper"
4816                         cppminus='';
4817                 else
4818                         echo "Nope, we'll have to live without it..."
4819                 fi
4820                 ;;
4821         esac
4822         case "$cpprun" in
4823         "$wrapper")
4824                 cpprun=''
4825                 cpplast=''
4826                 ;;
4827         esac
4828         ;;
4829 esac
4830
4831 case "$cppstdin" in
4832 "$wrapper"|'cppstdin') ;;
4833 *) $rm -f $wrapper;;
4834 esac
4835 $rm -f testcpp.c testcpp.out
4836
4837 : Adjust cppfilter for path component separator
4838 case "$osname" in
4839 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4840 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4841 *)   cppfilter='' ;;
4842 esac
4843
4844 : Use gcc to determine libpth and incpth
4845 # If using gcc or clang, we can get better values for libpth, incpth
4846 # and usrinc directly from the compiler.
4847 # Note that ccname for clang is also gcc.
4848 case "$ccname" in
4849     gcc)
4850         $echo 'extern int foo;' > try.c
4851         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4852         shift
4853         if $test $# -gt 0; then
4854             incpth="$incpth $*"
4855             incpth="`$echo $incpth|$sed 's/^ //'`"
4856             for i in $*; do
4857                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4858                 if $test -d $j; then
4859                     libpth="$libpth $j"
4860                 fi
4861             done
4862             libpth="`$echo $libpth|$sed 's/^ //'`"
4863             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4864                 if $test -d $xxx; then
4865                     case " $libpth " in
4866                     *" $xxx "*) ;;
4867                     *) libpth="$libpth $xxx";;
4868                     esac
4869                 fi
4870             done
4871         fi
4872         $rm -f try.c
4873         case "$usrinc" in
4874         '') for i in $incpth; do
4875                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4876                     usrinc="$i"
4877                     break
4878                 fi
4879             done
4880             ;;
4881         esac
4882
4883         case "$usecrosscompile" in
4884         $define|true|[yY]*)
4885             case "$incpth" in
4886                 '') echo "Incpth not defined." >&4; croak=y ;;
4887                 *)  echo "Using incpth '$incpth'." >&4 ;;
4888             esac
4889             case "$libpth" in
4890                 '') echo "Libpth not defined." >&4; croak=y ;;
4891                 *)  echo "Using libpth '$libpth'." >&4 ;;
4892             esac
4893             case "$usrinc" in
4894                 '') echo "Usrinc not defined." >&4; croak=y ;;
4895                 *)  echo "Using usrinc $usrinc." >&4 ;;
4896             esac
4897             case "$croak" in
4898                 y)
4899                 if test "X$sysroot" = X; then
4900                     echo "Cannot continue, aborting." >&4; exit 1
4901                 else
4902                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4903                 fi
4904                 ;;
4905             esac
4906             ;;
4907         esac
4908     ;;
4909 esac
4910
4911 : Default value for incpth is just usrinc
4912 case "$incpth" in
4913 '') incpth="$usrinc";;
4914 esac
4915
4916 : Set private lib path
4917 case "$plibpth" in
4918 '') if ./mips; then
4919         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4920     fi;;
4921 esac
4922 case "$libpth" in
4923 ' ') dlist='';;
4924 '') dlist="$loclibpth $plibpth $glibpth";;
4925 *) dlist="$libpth";;
4926 esac
4927
4928 : Now check and see which directories actually exist, avoiding duplicates
4929 for xxx in $dlist
4930 do
4931     if $test -d $xxx; then
4932                 case " $libpth " in
4933                 *" $xxx "*) ;;
4934                 *) libpth="$libpth $xxx";;
4935                 esac
4936     fi
4937 done
4938 $cat <<'EOM'
4939
4940 Some systems have incompatible or broken versions of libraries.  Among
4941 the directories listed in the question below, please remove any you
4942 know not to be holding relevant libraries, and add any that are needed.
4943 Say "none" for none.
4944
4945 EOM
4946
4947 if test "X$sysroot" != X; then
4948     $cat <<EOM
4949 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4950
4951 EOM
4952 fi
4953
4954 case "$libpth" in
4955 '') dflt='none';;
4956 *)
4957         set X $libpth
4958         shift
4959         dflt=${1+"$@"}
4960         ;;
4961 esac
4962 rp="Directories to use for library searches?"
4963 . ./myread
4964 case "$ans" in
4965 none) libpth=' ';;
4966 *) libpth="$ans";;
4967 esac
4968
4969 : compute shared library extension
4970 case "$so" in
4971 '')
4972         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4973                 dflt='sl'
4974         else
4975                 dflt='so'
4976         fi
4977         ;;
4978 *) dflt="$so";;
4979 esac
4980 $cat <<EOM
4981
4982 On some systems, shared libraries may be available.  Answer 'none' if
4983 you want to suppress searching of shared libraries for the remainder
4984 of this configuration.
4985
4986 EOM
4987 rp='What is the file extension used for shared libraries?'
4988 . ./myread
4989 so="$ans"
4990
4991 : Does target system insist that shared library basenames are unique
4992 $cat << EOM
4993
4994 Some dynamic loaders assume that the *basename* of shared library filenames
4995 are globally unique.  We'll default this to undef as we assume your system
4996 is not this weird. Set to defined if you're on one of them.
4997
4998 EOM
4999
5000 dflt='n'
5001 rp='Make shared library basenames unique?'
5002 . ./myread
5003 case "$ans" in
5004 y|Y) val="$define" ;;
5005 *)   val="$undef"  ;;
5006 esac
5007 set d_libname_unique
5008 eval $setvar
5009
5010 : Define several unixisms.
5011 : Hints files or command line option can be used to override them.
5012 : The convoluted testing is in case hints files set either the old
5013 : or the new name.
5014 case "$_exe" in
5015 '')     case "$exe_ext" in
5016         '')     ;;
5017         *)      _exe="$exe_ext" ;;
5018         esac
5019         ;;
5020 esac
5021 case "$_a" in
5022 '')     case "$lib_ext" in
5023     '') _a='.a';;
5024         *)      _a="$lib_ext" ;;
5025         esac
5026         ;;
5027 esac
5028 case "$_o" in
5029 '') case "$obj_ext" in
5030         '')     _o='.o';;
5031         *)      _o="$obj_ext";;
5032         esac
5033         ;;
5034 esac
5035 case "$p_" in
5036 '') case "$path_sep" in
5037         '')     p_=':';;
5038         *)      p_="$path_sep";;
5039         esac
5040         ;;
5041 esac
5042 exe_ext=$_exe
5043 lib_ext=$_a
5044 obj_ext=$_o
5045 path_sep=$p_
5046
5047 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5048
5049 : Which makefile gets called first.  This is used by make depend.
5050 case "$firstmakefile" in
5051 '') firstmakefile='makefile';;
5052 esac
5053
5054 : Check is we will use socks
5055 case "$usesocks" in
5056 $define|true|[yY]*)     dflt='y';;
5057 *) dflt='n';;
5058 esac
5059 cat <<EOM
5060
5061 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5062 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5063 to use the PerlIO abstraction layer, this will be implicitly selected.
5064
5065 If this doesn't make any sense to you, just accept the default '$dflt'.
5066 EOM
5067 rp='Build Perl for SOCKS?'
5068 . ./myread
5069 case "$ans" in
5070 y|Y)    val="$define" ;;
5071 *)      val="$undef" ;;
5072 esac
5073 set usesocks
5074 eval $setvar
5075
5076 : Check for uselongdouble support
5077 case "$ccflags" in
5078 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5079 esac
5080
5081 case "$uselongdouble" in
5082 $define|true|[yY]*)     dflt='y';;
5083 *) dflt='n';;
5084 esac
5085 cat <<EOM
5086
5087 Perl can be built to take advantage of long doubles which
5088 (if available) may give more accuracy and range for floating point numbers.
5089
5090 If this doesn't make any sense to you, just accept the default '$dflt'.
5091 EOM
5092 rp='Try to use long doubles if available?'
5093 . ./myread
5094 case "$ans" in
5095 y|Y)    val="$define"   ;;
5096 *)      val="$undef"    ;;
5097 esac
5098 set uselongdouble
5099 eval $setvar
5100
5101 case "$uselongdouble" in
5102 true|[yY]*) uselongdouble="$define" ;;
5103 esac
5104
5105 : Look for a hint-file generated 'call-back-unit'.  If the
5106 : user has specified that long doubles should be used,
5107 : we may need to set or change some other defaults.
5108 if $test -f uselongdouble.cbu; then
5109     echo "Your platform has some specific hints regarding long doubles, using them..."
5110     . ./uselongdouble.cbu
5111 else
5112     case "$uselongdouble" in
5113         $define)
5114                 $cat <<EOM
5115 (Your platform does not have any specific hints for long doubles.)
5116 EOM
5117         ;;
5118     esac
5119 fi
5120
5121 : Looking for optional libraries
5122 echo " "
5123 echo "Checking for optional libraries..." >&4
5124 case "$libs" in
5125 ' '|'') dflt='';;
5126 *) dflt="$libs";;
5127 esac
5128 case "$libswanted" in
5129 '') libswanted='c_s';;
5130 esac
5131 case "$usesocks" in
5132 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5133 esac
5134 libsfound=''
5135 libsfiles=''
5136 libsdirs=''
5137 libspath=''
5138 for thisdir in $libpth $xlibpth; do
5139   test -d $thisdir && libspath="$libspath $thisdir"
5140 done
5141 for thislib in $libswanted; do
5142         for thisdir in $libspath; do
5143             xxx=''
5144             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5145                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5146                 $test -f "$xxx" && eval $libscheck
5147                 $test -f "$xxx" && libstyle=shared
5148             fi
5149             if test ! -f "$xxx"; then
5150                 xxx=$thisdir/lib$thislib.$so
5151                 $test -f "$xxx" && eval $libscheck
5152                 $test -f "$xxx" && libstyle=shared
5153             fi
5154             if test ! -f "$xxx"; then
5155                 xxx=$thisdir/lib$thislib$_a
5156                 $test -f "$xxx" && eval $libscheck
5157                 $test -f "$xxx" && libstyle=static
5158             fi
5159             if test ! -f "$xxx"; then
5160                 xxx=$thisdir/$thislib$_a
5161                 $test -f "$xxx" && eval $libscheck
5162                 $test -f "$xxx" && libstyle=static
5163             fi
5164             if test ! -f "$xxx"; then
5165                 xxx=$thisdir/lib${thislib}_s$_a
5166                 $test -f "$xxx" && eval $libscheck
5167                 $test -f "$xxx" && libstyle=static
5168                 $test -f "$xxx" && thislib=${thislib}_s
5169             fi
5170             if test ! -f "$xxx"; then
5171                 xxx=$thisdir/Slib$thislib$_a
5172                 $test -f "$xxx" && eval $libscheck
5173                 $test -f "$xxx" && libstyle=static
5174             fi
5175             if $test -f "$xxx"; then
5176                 case "$libstyle" in
5177                 shared) echo "Found -l$thislib (shared)." ;;
5178                 static) echo "Found -l$thislib." ;;
5179                 *)      echo "Found -l$thislib ($libstyle)." ;;
5180                 esac
5181                 case " $dflt " in
5182                 *"-l$thislib "*);;
5183                 *) dflt="$dflt -l$thislib"
5184                    libsfound="$libsfound $xxx"
5185                    yyy=`basename $xxx`
5186                    libsfiles="$libsfiles $yyy"
5187                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5188                    case " $libsdirs " in
5189                    *" $yyy "*) ;;
5190                    *) libsdirs="$libsdirs $yyy" ;;
5191                    esac
5192                    ;;
5193                 esac
5194                 break
5195             fi
5196         done
5197         if $test ! -f "$xxx"; then
5198             echo "No -l$thislib."
5199         fi
5200 done
5201 set X $dflt
5202 shift
5203 dflt="$*"
5204 case "$libs" in
5205 '') dflt="$dflt";;
5206 *) dflt="$libs";;
5207 esac
5208 case "$dflt" in
5209 ' '|'') dflt='none';;
5210 esac
5211
5212 $cat <<EOM
5213
5214 In order to compile $package on your machine, a number of libraries
5215 are usually needed.  Include any other special libraries here as well.
5216 Say "none" for none.  The default list is almost always right.
5217 EOM
5218
5219 echo " "
5220 rp="What libraries to use?"
5221 . ./myread
5222 case "$ans" in
5223 none) libs=' ';;
5224 *) libs="$ans";;
5225 esac
5226
5227 : determine optimization, if desired, or use for debug flag also
5228 case "$optimize" in
5229 ' '|$undef) dflt='none';;
5230 '') dflt='-O';;
5231 *) dflt="$optimize";;
5232 esac
5233 $cat <<EOH
5234
5235 By default, $package compiles with the -O flag to use the optimizer.
5236 Alternately, you might want to use the symbolic debugger, which uses
5237 the -g flag (on traditional Unix systems).  Either flag can be
5238 specified here.  To use neither flag, specify the word "none".
5239
5240 EOH
5241 rp="What optimizer/debugger flag should be used?"
5242 . ./myread
5243 optimize="$ans"
5244 case "$optimize" in
5245 'none') optimize=" ";;
5246 esac
5247
5248 : Check what DEBUGGING is required from the command line
5249 : -DEBUGGING      or -DDEBUGGING or
5250 : -DEBUGGING=both                       = -g + -DDEBUGGING
5251 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5252 : -DEBUGGING=none or -UDEBUGGING        =
5253 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5254 case "$EBUGGING" in
5255 '')     ;;
5256 *)      DEBUGGING=$EBUGGING ;;
5257 esac
5258
5259 case "$DEBUGGING" in
5260 -g|both|$define)
5261     case "$optimize" in
5262         *-g*) ;;
5263         *)    optimize="$optimize -g" ;;
5264     esac ;;
5265 none|$undef)
5266     case "$optimize" in
5267         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5268                 shift
5269                 optimize="$*"
5270                 ;;
5271     esac ;;
5272 esac
5273
5274 dflt=''
5275 case "$DEBUGGING" in
5276 both|$define) dflt='-DDEBUGGING'
5277 esac
5278
5279 : argument order is deliberate, as the flag will start with - which set could
5280 : think is an option
5281 checkccflag='check=$1; flag=$2; callback=$3;
5282 echo " ";
5283 echo "Checking if your compiler accepts $flag" 2>&1;
5284 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5285 echo "int main(void) { return 0; }" > gcctest.c;
5286 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5287     echo "Yes, it does." 2>&1;
5288     if $test -s gcctest.out ; then
5289         echo "But your platform does not like it:";
5290         cat gcctest.out;
5291     else
5292         case "$ccflags" in
5293         *$check*)
5294             echo "Leaving current flags $ccflags alone." 2>&1
5295             ;;
5296         *) dflt="$dflt $flag";
5297             eval $callback
5298             ;;
5299         esac
5300     fi
5301 else
5302     echo "Nope, it does not, but that is ok." 2>&1;
5303 fi
5304 '
5305
5306 : We will not override a previous value, but we might want to
5307 : augment a hint file
5308 case "$hint" in
5309 default|recommended)
5310         case "$gccversion" in
5311         1*) dflt="$dflt -fpcc-struct-return" ;;
5312         esac
5313         case "$optimize:$DEBUGGING" in
5314         *-g*:old) dflt="$dflt -DDEBUGGING";;
5315         esac
5316         case "$gccversion" in
5317         2*) if $test -d /etc/conf/kconfig.d &&
5318                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5319                 then
5320                         # Interactive Systems (ISC) POSIX mode.
5321                         dflt="$dflt -posix"
5322                 fi
5323                 ;;
5324         esac
5325         case "$gccversion" in
5326         1*) ;;
5327         2.[0-8]*) ;;
5328         ?*)     set strict-aliasing -fno-strict-aliasing
5329                 eval $checkccflag
5330                 ;;
5331         esac
5332         # For gcc, adding -pipe speeds up compilations for some, but apparently
5333         # some assemblers can't read from stdin.  (It also slows down compilations
5334         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5335         case "$gccversion" in
5336         ?*)     set pipe -pipe
5337                 eval $checkccflag
5338                 ;;
5339         esac
5340
5341         # on x86_64 (at least) we require an extra library (libssp) in the
5342         # link command line. This library is not named, so I infer that it is
5343         # an implementation detail that may change. Hence the safest approach
5344         # is to add the flag to the flags passed to the compiler at link time,
5345         # as that way the compiler can do the right implementation dependant
5346         # thing. (NWC)
5347         case "$gccversion" in
5348         ?*)     set stack-protector -fstack-protector
5349                 eval $checkccflag
5350                 ;;
5351         esac
5352         ;;
5353 esac
5354
5355 case "$mips_type" in
5356 *BSD*|'') inclwanted="$locincpth $usrinc";;
5357 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5358 esac
5359 for thisincl in $inclwanted; do
5360         if $test -d $thisincl; then
5361                 if $test x$thisincl != x$usrinc; then
5362                         case "$dflt" in
5363                         *" -I$thisincl "*);;
5364                         *) dflt="$dflt -I$thisincl ";;
5365                         esac
5366                 fi
5367         fi
5368 done
5369
5370 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5371         xxx=true;
5372 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5373         xxx=true;
5374 else
5375         xxx=false;
5376 fi;
5377 if $xxx; then
5378         case "$dflt" in
5379         *$2*);;
5380         *) dflt="$dflt -D$2";;
5381         esac;
5382 fi'
5383
5384 set signal.h LANGUAGE_C; eval $inctest
5385
5386 case "$usesocks" in
5387 $define)
5388         ccflags="$ccflags -DSOCKS"
5389         ;;
5390 esac
5391
5392 case "$hint" in
5393 default|recommended) dflt="$ccflags $dflt" ;;
5394 *) dflt="$ccflags";;
5395 esac
5396
5397 case "$dflt" in
5398 ''|' ') dflt=none;;
5399 esac
5400
5401 $cat <<EOH
5402
5403 Your C compiler may want other flags.  For this question you should include
5404 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5405 but you should NOT include libraries or ld flags like -lwhatever.  If you
5406 want $package to honor its debug switch, you should include -DDEBUGGING here.
5407 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5408
5409 To use no flags, specify the word "none".
5410
5411 EOH
5412 set X $dflt
5413 shift
5414 dflt=${1+"$@"}
5415 rp="Any additional cc flags?"
5416 . ./myread
5417 case "$ans" in
5418 none) ccflags='';;
5419 *) ccflags="$ans";;
5420 esac
5421
5422 : the following weeds options from ccflags that are of no interest to cpp
5423 case "$cppflags" in
5424 '') cppflags="$ccflags" ;;
5425 *)  cppflags="$cppflags $ccflags" ;;
5426 esac
5427 case "$gccversion" in
5428 1*) cppflags="$cppflags -D__GNUC__"
5429 esac
5430 case "$mips_type" in
5431 '');;
5432 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5433 esac
5434 case "$cppflags" in
5435 '');;
5436 *)
5437         echo " "
5438         echo "Let me guess what the preprocessor flags are..." >&4
5439         set X $cppflags
5440         shift
5441         cppflags=''
5442         $cat >cpp.c <<'EOM'
5443 #define BLURFL foo
5444
5445 BLURFL xx LFRULB
5446 EOM
5447         previous=''
5448         for flag in $*
5449         do
5450                 case "$flag" in
5451                 -*) ftry="$flag";;
5452                 *) ftry="$previous $flag";;
5453                 esac
5454                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5455                         >cpp1.out 2>/dev/null && \
5456                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5457                         >cpp2.out 2>/dev/null && \
5458                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5459                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5460                 then
5461                         cppflags="$cppflags $ftry"
5462                         previous=''
5463                 else
5464                         previous="$flag"
5465                 fi
5466         done
5467         set X $cppflags
5468         shift
5469         cppflags=${1+"$@"}
5470         case "$cppflags" in
5471         *-*)  echo "They appear to be: $cppflags";;
5472         esac
5473         $rm -f cpp.c cpp?.out
5474         ;;
5475 esac
5476
5477 : flags used in final linking phase
5478 case "$ldflags" in
5479 '') if ./venix; then
5480                 dflt='-i -z'
5481         else
5482                 dflt=''
5483         fi
5484         case "$ccflags" in
5485         *-posix*) dflt="$dflt -posix" ;;
5486         esac
5487         ;;
5488 *) dflt="$ldflags";;
5489 esac
5490 # See note above about -fstack-protector
5491 case "$ccflags" in
5492 *-fstack-protector*)
5493         case "$dflt" in
5494         *-fstack-protector*) ;; # Don't add it again
5495         *) dflt="$dflt -fstack-protector" ;;
5496         esac
5497         ;;
5498 esac
5499
5500 : Try to guess additional flags to pick up local libraries.
5501 for thislibdir in $libpth; do
5502         case " $loclibpth " in
5503         *" $thislibdir "*)
5504                 case "$dflt " in
5505                 *"-L$thislibdir "*) ;;
5506                 *)  dflt="$dflt -L$thislibdir" ;;
5507                 esac
5508                 ;;
5509         esac
5510 done
5511
5512 case "$dflt" in
5513 '') dflt='none' ;;
5514 esac
5515
5516 $cat <<EOH
5517
5518 Your C linker may need flags.  For this question you should
5519 include -L/whatever and any other flags used by the C linker, but you
5520 should NOT include libraries like -lwhatever.
5521
5522 Make sure you include the appropriate -L/path flags if your C linker
5523 does not normally search all of the directories you specified above,
5524 namely
5525         $libpth
5526 To use no flags, specify the word "none".
5527
5528 EOH
5529
5530 rp="Any additional ld flags (NOT including libraries)?"
5531 . ./myread
5532 case "$ans" in
5533 none) ldflags='';;
5534 *) ldflags="$ans";;
5535 esac
5536 rmlist="$rmlist pdp11"
5537
5538 : coherency check
5539 echo " "
5540 echo "Checking your choice of C compiler and flags for coherency..." >&4
5541 $cat > try.c <<'EOF'
5542 #include <stdio.h>
5543 int main() { printf("Ok\n"); return(0); }
5544 EOF
5545 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5546 shift
5547 $cat >try.msg <<'EOM'
5548 I've tried to compile and run the following simple program:
5549
5550 EOM
5551 $cat try.c >> try.msg
5552
5553 $cat >> try.msg <<EOM
5554
5555 I used the command:
5556
5557         $*
5558         $run ./try
5559
5560 and I got the following output:
5561
5562 EOM
5563 dflt=y
5564 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5565         if $sh -c "$run ./try " >>try.msg 2>&1; then
5566                 xxx=`$run ./try`
5567                 case "$xxx" in
5568                 "Ok") dflt=n ;;
5569                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5570                 esac
5571         else
5572                 echo "The program compiled OK, but exited with status $?." >>try.msg
5573                 rp="You have a problem.  Shall I abort Configure"
5574                 dflt=y
5575         fi
5576 else
5577         echo "I can't compile the test program." >>try.msg
5578         rp="You have a BIG problem.  Shall I abort Configure"
5579         dflt=y
5580 fi
5581 case "$dflt" in
5582 y)
5583         $cat try.msg >&4
5584         case "$knowitall" in
5585         '')
5586                 echo "(The supplied flags or libraries might be incorrect.)"
5587                 ;;
5588         *) dflt=n;;
5589         esac
5590         echo " "
5591         . ./myread
5592         case "$ans" in
5593         n*|N*) ;;
5594         *)      echo "Ok.  Stopping Configure." >&4
5595                 exit 1
5596                 ;;
5597         esac
5598         ;;
5599 n) echo "OK, that should do.";;
5600 esac
5601 $rm_try gcctest gcctest.out
5602
5603 : define a shorthand compile call
5604 compile='
5605 mc_file=$1;
5606 shift;
5607 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5608 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5609 exit 1;
5610 fi;
5611 esac;
5612 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5613 : define a shorthand compile call for compilations that should be ok.
5614 compile_ok='
5615 mc_file=$1;
5616 shift;
5617 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5618
5619 : determine filename position in cpp output
5620 echo " "
5621 echo "Computing filename position in cpp output for #include directives..." >&4
5622 case "$osname" in
5623 vos) testaccess=-e ;;
5624 *)   testaccess=-r ;;
5625 esac
5626 echo '#include <stdio.h>' > foo.c
5627 $cat >fieldn <<EOF
5628 $startsh
5629 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5630 $grep '^[       ]*#.*stdio\.h' | \
5631 while read cline; do
5632         pos=1
5633         set \$cline
5634         while $test \$# -gt 0; do
5635                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5636                         echo "\$pos"
5637                         exit 0
5638                 fi
5639                 shift
5640                 pos=\`expr \$pos + 1\`
5641         done
5642 done
5643 EOF
5644 chmod +x fieldn
5645 fieldn=`./fieldn`
5646 $rm -f foo.c fieldn
5647 case $fieldn in
5648 '') pos='???';;
5649 1) pos=first;;
5650 2) pos=second;;
5651 3) pos=third;;
5652 *) pos="${fieldn}th";;
5653 esac
5654 echo "Your cpp writes the filename in the $pos field of the line."
5655
5656 : locate header file
5657 $cat >findhdr <<EOF
5658 $startsh
5659 wanted=\$1
5660 name=''
5661 for usrincdir in $incpth
5662 do
5663         if test -f \$usrincdir/\$wanted; then
5664                 echo "\$usrincdir/\$wanted"
5665                 exit 0
5666         fi
5667 done
5668 awkprg='{ print \$$fieldn }'
5669 echo "#include <\$wanted>" > foo\$\$.c
5670 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5671 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5672 while read cline; do
5673         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5674         case "\$name" in
5675         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5676         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5677         *) exit 2;;
5678         esac;
5679 done;
5680 #
5681 # status = 0: grep returned 0 lines, case statement not executed
5682 # status = 1: headerfile found
5683 # status = 2: while loop executed, no headerfile found
5684 #
5685 status=\$?
5686 $rm -f foo\$\$.c;
5687 if test \$status -eq 1; then
5688         exit 0;
5689 fi
5690 exit 1
5691 EOF
5692 chmod +x findhdr
5693
5694 : define an alternate in-header-list? function
5695 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5696 cont=true; xxf="echo \"<\$1> found.\" >&4";
5697 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5698 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5699 esac;
5700 case $# in 4) instead=instead;; *) instead="at last";; esac;
5701 while $test "$cont"; do
5702         xxx=`./findhdr $1`
5703         var=$2; eval "was=\$$2";
5704         if $test "$xxx" && $test -r "$xxx";
5705         then eval $xxf;
5706         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5707                 cont="";
5708         else eval $xxnf;
5709         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5710         set $yyy; shift; shift; yyy=$@;
5711         case $# in 0) cont="";;
5712         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5713                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5714         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5715                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5716         esac;
5717 done;
5718 while $test "$yyy";
5719 do set $yyy; var=$2; eval "was=\$$2";
5720         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5721         set $yyy; shift; shift; yyy=$@;
5722 done'
5723
5724 : see if stdlib is available
5725 set stdlib.h i_stdlib
5726 eval $inhdr
5727
5728 : check for lengths of integral types
5729 echo " "
5730 case "$intsize" in
5731 '')
5732         echo "Checking to see how big your integers are..." >&4
5733         $cat >try.c <<EOCP
5734 #include <stdio.h>
5735 #$i_stdlib I_STDLIB
5736 #ifdef I_STDLIB
5737 #include <stdlib.h>
5738 #endif
5739 int main()
5740 {
5741         printf("intsize=%d;\n", (int)sizeof(int));
5742         printf("longsize=%d;\n", (int)sizeof(long));
5743         printf("shortsize=%d;\n", (int)sizeof(short));
5744         exit(0);
5745 }
5746 EOCP
5747         set try
5748         if eval $compile_ok && $run ./try > /dev/null; then
5749                 eval `$run ./try`
5750                 echo "Your integers are $intsize bytes long."
5751                 echo "Your long integers are $longsize bytes long."
5752                 echo "Your short integers are $shortsize bytes long."
5753         else
5754                 $cat >&4 <<EOM
5755 !
5756 Help! I can't compile and run the intsize test program: please enlighten me!
5757 (This is probably a misconfiguration in your system or libraries, and
5758 you really ought to fix it.  Still, I'll try anyway.)
5759 !
5760 EOM
5761                 dflt=4
5762                 rp="What is the size of an integer (in bytes)?"
5763                 . ./myread
5764                 intsize="$ans"
5765                 dflt=$intsize
5766                 rp="What is the size of a long integer (in bytes)?"
5767                 . ./myread
5768                 longsize="$ans"
5769                 dflt=2
5770                 rp="What is the size of a short integer (in bytes)?"
5771                 . ./myread
5772                 shortsize="$ans"
5773         fi
5774         ;;
5775 esac
5776 $rm_try
5777
5778 : check for long long
5779 echo " "
5780 echo "Checking to see if you have long long..." >&4
5781 echo 'int main() { long long x = 7; return 0; }' > try.c
5782 set try
5783 if eval $compile; then
5784         val="$define"
5785         echo "You have long long."
5786 else
5787         val="$undef"
5788         echo "You do not have long long."
5789 fi
5790 $rm_try
5791 set d_longlong
5792 eval $setvar
5793
5794 : check for length of long long
5795 case "${d_longlong}${longlongsize}" in
5796 $define)
5797         echo " "
5798         echo "Checking to see how big your long longs are..." >&4
5799         $cat >try.c <<'EOCP'
5800 #include <stdio.h>
5801 int main()
5802 {
5803     printf("%d\n", (int)sizeof(long long));
5804     return(0);
5805 }
5806 EOCP
5807         set try
5808         if eval $compile_ok; then
5809                 longlongsize=`$run ./try`
5810                 echo "Your long longs are $longlongsize bytes long."
5811         else
5812                 dflt='8'
5813                 echo " "
5814                 echo "(I can't seem to compile the test program.  Guessing...)"
5815                 rp="What is the size of a long long (in bytes)?"
5816                 . ./myread
5817                 longlongsize="$ans"
5818         fi
5819         if $test "X$longsize" = "X$longlongsize"; then
5820                 echo "(That isn't any different from an ordinary long.)"
5821         fi
5822         ;;
5823 esac
5824 $rm_try
5825
5826 : see if inttypes.h is available
5827 : we want a real compile instead of Inhdr because some systems
5828 : have an inttypes.h which includes non-existent headers
5829 echo " "
5830 $cat >try.c <<EOCP
5831 #include <inttypes.h>
5832 int main() {
5833         static int32_t foo32 = 0x12345678;
5834 }
5835 EOCP
5836 set try
5837 if eval $compile; then
5838         echo "<inttypes.h> found." >&4
5839         val="$define"
5840 else
5841         echo "<inttypes.h> NOT found." >&4
5842         val="$undef"
5843 fi
5844 $rm_try
5845 set i_inttypes
5846 eval $setvar
5847
5848 : check for int64_t
5849 echo " "
5850 echo "Checking to see if you have int64_t..." >&4
5851 $cat >try.c <<EOCP
5852 #include <sys/types.h>
5853 #$i_inttypes I_INTTYPES
5854 #ifdef I_INTTYPES
5855 #include <inttypes.h>
5856 #endif
5857 int main() { int64_t x = 7; }
5858 EOCP
5859 set try
5860 if eval $compile; then
5861         val="$define"
5862         echo "You have int64_t."
5863 else
5864         val="$undef"
5865         echo "You do not have int64_t."
5866 fi
5867 $rm_try
5868 set d_int64_t
5869 eval $setvar
5870
5871 : Check if 64bit ints have a quad type
5872 echo " "
5873 echo "Checking which 64-bit integer type we could use..." >&4
5874
5875 case "$intsize" in
5876 8) val=int
5877    set quadtype
5878    eval $setvar
5879    val='"unsigned int"'
5880    set uquadtype
5881    eval $setvar
5882    quadkind=1
5883    ;;
5884 *) case "$longsize" in
5885    8) val=long
5886       set quadtype
5887       eval $setvar
5888       val='"unsigned long"'
5889       set uquadtype
5890       eval $setvar
5891       quadkind=2
5892       ;;
5893    *) case "$d_longlong:$longlongsize" in
5894       define:8)
5895         val='"long long"'
5896         set quadtype
5897         eval $setvar
5898         val='"unsigned long long"'
5899         set uquadtype
5900         eval $setvar
5901         quadkind=3
5902         ;;
5903       *) case "$d_int64_t" in
5904          define)
5905            val=int64_t
5906            set quadtype
5907            eval $setvar
5908            val=uint64_t
5909            set uquadtype
5910            eval $setvar
5911            quadkind=4
5912            ;;
5913          esac
5914          ;;
5915       esac
5916       ;;
5917    esac
5918    ;;
5919 esac
5920
5921 case "$quadtype" in
5922 '')     echo "Alas, no 64-bit integer types in sight." >&4
5923         d_quad="$undef"
5924         ;;
5925 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5926         d_quad="$define"
5927         ;;
5928 esac
5929
5930 : Do we want 64bit support
5931 case "$uselonglong" in
5932 "$define"|true|[yY]*)
5933         cat <<EOM >&4
5934
5935 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5936 EOM
5937         use64bitint="$define"
5938         ;;
5939 esac
5940 case "$use64bits" in
5941 "$define"|true|[yY]*)
5942         cat <<EOM >&4
5943
5944 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5945 EOM
5946         use64bitint="$define"
5947         ;;
5948 esac
5949 case "$use64bitints" in
5950 "$define"|true|[yY]*)
5951         cat <<EOM >&4
5952
5953 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5954 EOM
5955         use64bitint="$define"
5956         ;;
5957 esac
5958 case "$use64bitsint" in
5959 "$define"|true|[yY]*)
5960         cat <<EOM >&4
5961
5962 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5963 EOM
5964         use64bitint="$define"
5965         ;;
5966 esac
5967 case "$uselonglongs" in
5968 "$define"|true|[yY]*)
5969         cat <<EOM >&4
5970
5971 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5972 EOM
5973         use64bitint="$define"
5974         ;;
5975 esac
5976 case "$use64bitsall" in
5977 "$define"|true|[yY]*)
5978         cat <<EOM >&4
5979
5980 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5981 EOM
5982         use64bitall="$define"
5983         ;;
5984 esac
5985
5986 case "$ccflags" in
5987 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5988 esac
5989 case "$use64bitall" in
5990 "$define"|true|[yY]*) use64bitint="$define" ;;
5991 esac
5992
5993 case "$longsize" in
5994 8) cat <<EOM
5995
5996 You have natively 64-bit long integers.
5997 EOM
5998    val="$define"
5999    ;;
6000 *) case "$use64bitint" in
6001    "$define"|true|[yY]*) dflt='y';;
6002    *) dflt='n';;
6003    esac
6004    case "$d_quad" in
6005    "$define") ;;
6006    *) dflt='n' ;;
6007    esac
6008    cat <<EOM
6009
6010 Perl can be built to take advantage of 64-bit integer types
6011 on some systems.  To do so, Configure can be run with -Duse64bitint.
6012 Choosing this option will most probably introduce binary incompatibilities.
6013
6014 If this doesn't make any sense to you, just accept the default '$dflt'.
6015 (The default has been chosen based on your configuration.)
6016 EOM
6017    rp='Try to use 64-bit integers, if available?'
6018    . ./myread
6019    case "$ans" in
6020    [yY]*) val="$define" ;;
6021    *)     val="$undef"  ;;
6022    esac
6023    ;;
6024 esac
6025 set use64bitint
6026 eval $setvar
6027
6028 case "$use64bitall" in
6029 "$define"|true|[yY]*) dflt='y' ;;
6030 *) case "$longsize" in
6031    8) dflt='y' ;;
6032    *) dflt='n' ;;
6033    esac
6034    ;;
6035 esac
6036 cat <<EOM
6037
6038 You may also choose to try maximal 64-bitness.  It means using as much
6039 64-bitness as possible on the platform.  This in turn means even more
6040 binary incompatibilities.  On the other hand, your platform may not
6041 have any more 64-bitness available than what you already have chosen.
6042
6043 If this doesn't make any sense to you, just accept the default '$dflt'.
6044 (The default has been chosen based on your configuration.)
6045 EOM
6046 rp='Try to use maximal 64-bit support, if available?'
6047 . ./myread
6048 case "$ans" in
6049 [yY]*) val="$define" ;;
6050 *)     val="$undef"  ;;
6051 esac
6052 set use64bitall
6053 eval $setvar
6054 case "$use64bitall" in
6055 "$define")
6056         case "$use64bitint" in
6057         "$undef")
6058                 cat <<EOM
6059
6060 Since you have chosen a maximally 64-bit build, I'm also turning on
6061 the use of 64-bit integers.
6062 EOM
6063                 use64bitint="$define" ;;
6064         esac
6065         ;;
6066 esac
6067
6068 : Look for a hint-file generated 'call-back-unit'.  If the
6069 : user has specified that a 64-bit perl is to be built,
6070 : we may need to set or change some other defaults.
6071 if $test -f use64bitint.cbu; then
6072         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6073         . ./use64bitint.cbu
6074 fi
6075 case "$use64bitint" in
6076 "$define"|true|[yY]*)
6077         : This test was common to all the OpenBSD forks, and seems harmless for
6078         : other platforms:
6079         echo " "
6080         echo "Checking if your C library has broken 64-bit functions..." >&4
6081         cat >try.c <<EOCP
6082 #include <stdio.h>
6083 typedef $uquadtype myULL;
6084 int main (void)
6085 {
6086     struct {
6087         double d;
6088         myULL  u;
6089     } *p, test[] = {
6090         {4294967303.15, 4294967303ULL},
6091         {4294967294.2,  4294967294ULL},
6092         {4294967295.7,  4294967295ULL},
6093         {0.0, 0ULL}
6094     };
6095     for (p = test; p->u; p++) {
6096         myULL x = (myULL)p->d;
6097         if (x != p->u) {
6098             printf("buggy\n");
6099             return 0;
6100         }
6101     }
6102     printf("ok\n");
6103     return 0;
6104 }
6105 EOCP
6106         set try
6107         if eval $compile_ok; then
6108             libcquad=`$run ./try`
6109             echo "Your C library's 64-bit functions are $libcquad."
6110         else
6111             echo "(I can't seem to compile the test program.)"
6112             echo "Assuming that your C library's 64-bit functions are ok."
6113             libcquad="ok"
6114         fi
6115         $rm_try
6116
6117         case "$libcquad" in
6118             buggy*)
6119                 cat >&4 <<EOM
6120
6121 *** You have a C library with broken 64-bit functions.
6122 *** 64-bit support does not work reliably in this configuration.
6123 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6124 *** Cannot continue, aborting.
6125
6126 EOM
6127                 exit 1
6128                 ;;
6129         esac
6130         case "$longsize" in
6131         4) case "$archname64" in
6132            '') archname64=64int ;;
6133            esac
6134            ;;
6135         esac
6136         ;;
6137 esac
6138
6139 : Look for a hint-file generated 'call-back-unit'.  If the
6140 : user has specified that a maximally 64-bit perl is to be built,
6141 : we may need to set or change some other defaults.
6142 if $test -f use64bitall.cbu; then
6143         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6144         . ./use64bitall.cbu
6145 fi
6146 case "$use64bitall" in
6147 "$define"|true|[yY]*)
6148         case "$longsize" in
6149         4) case "$archname64" in
6150            ''|64int) archname64=64all ;;
6151            esac
6152            ;;
6153         esac
6154         ;;
6155 esac
6156
6157 case "$d_quad:$use64bitint" in
6158 $undef:$define)
6159         cat >&4 <<EOF
6160
6161 *** You have chosen to use 64-bit integers,
6162 *** but none can be found.
6163 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6164 *** Cannot continue, aborting.
6165
6166 EOF
6167         exit 1
6168         ;;
6169 esac
6170
6171 : check for length of double
6172 echo " "
6173 case "$doublesize" in
6174 '')
6175         echo "Checking to see how big your double precision numbers are..." >&4
6176         $cat >try.c <<EOCP
6177 #include <stdio.h>
6178 #$i_stdlib I_STDLIB
6179 #ifdef I_STDLIB
6180 #include <stdlib.h>
6181 #endif
6182 int main()
6183 {
6184     printf("%d\n", (int)sizeof(double));
6185     exit(0);
6186 }
6187 EOCP
6188         set try
6189         if eval $compile_ok; then
6190                 doublesize=`$run ./try`
6191                 echo "Your double is $doublesize bytes long."
6192         else
6193                 dflt='8'
6194                 echo "(I can't seem to compile the test program.  Guessing...)"
6195                 rp="What is the size of a double precision number (in bytes)?"
6196                 . ./myread
6197                 doublesize="$ans"
6198         fi
6199         ;;
6200 esac
6201 $rm_try
6202
6203 : check for long doubles
6204 echo " "
6205 echo "Checking to see if you have long double..." >&4
6206 echo 'int main() { long double x = 7.0; }' > try.c
6207 set try
6208 if eval $compile; then
6209         val="$define"
6210         echo "You have long double."
6211 else
6212         val="$undef"
6213         echo "You do not have long double."
6214 fi
6215 $rm_try
6216 set d_longdbl
6217 eval $setvar
6218
6219 : check for length of long double
6220 case "${d_longdbl}${longdblsize}" in
6221 $define)
6222         echo " "
6223         echo "Checking to see how big your long doubles are..." >&4
6224         $cat >try.c <<'EOCP'
6225 #include <stdio.h>
6226 int main()
6227 {
6228         printf("%d\n", sizeof(long double));
6229 }
6230 EOCP
6231         set try
6232         set try
6233         if eval $compile; then
6234                 longdblsize=`$run ./try`
6235                 echo "Your long doubles are $longdblsize bytes long."
6236         else
6237                 dflt='8'
6238                 echo " "
6239                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6240                 rp="What is the size of a long double (in bytes)?"
6241                 . ./myread
6242                 longdblsize="$ans"
6243         fi
6244         if $test "X$doublesize" = "X$longdblsize"; then
6245                 echo "That isn't any different from an ordinary double."
6246                 echo "I'll keep your setting anyway, but you may see some"
6247                 echo "harmless compilation warnings."
6248         fi
6249         ;;
6250 esac
6251 $rm_try
6252
6253 : determine the architecture name
6254 echo " "
6255 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6256         tarch=`arch`"-$osname"
6257 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6258         if uname -m > tmparch 2>&1 ; then
6259                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6260                         -e 's/$/'"-$osname/" tmparch`
6261         else
6262                 tarch="$osname"
6263         fi
6264         $rm -f tmparch
6265 else
6266         tarch="$osname"
6267 fi
6268 case "$myarchname" in
6269 ''|"$tarch") ;;
6270 *)
6271         echo "(Your architecture name used to be $myarchname.)"
6272         archname=''
6273         ;;
6274 esac
6275 case "$targetarch" in
6276 '') ;;
6277 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6278 esac
6279 myarchname="$tarch"
6280 case "$archname" in
6281 '') dflt="$tarch";;
6282 *) dflt="$archname";;
6283 esac
6284 rp='What is your architecture name'
6285 . ./myread
6286 archname="$ans"
6287
6288 : optionally add API version to the architecture for versioned archlibs
6289 case "$useversionedarchname" in
6290 $define|true|[yY]*) dflt='y';;
6291 *)                  dflt='n';;
6292 esac
6293 rp='Add the Perl API version to your archname?'
6294 . ./myread
6295 case "$ans" in
6296 y|Y)    useversionedarchname="$define" ;;
6297 *)      useversionedarchname="$undef" ;;
6298 esac
6299 case "$useversionedarchname" in
6300 $define)
6301         case "$archname" in
6302         *-$api_versionstring)
6303                 echo "...and architecture name already has -$api_versionstring" >&4
6304                 ;;
6305         *)
6306                 archname="$archname-$api_versionstring"
6307                 echo "...setting architecture name to $archname." >&4
6308                 ;;
6309         esac
6310         ;;
6311 esac
6312
6313 case "$usethreads" in
6314 $define)
6315         echo "Threads selected." >&4
6316         case "$archname" in
6317         *-thread*) echo "...and architecture name already has -thread." >&4
6318                 ;;
6319         *)      archname="$archname-thread"
6320                 echo "...setting architecture name to $archname." >&4
6321                 ;;
6322         esac
6323         ;;
6324 esac
6325 case "$usemultiplicity" in
6326 $define)
6327         echo "Multiplicity selected." >&4
6328         case "$archname" in
6329         *-multi*) echo "...and architecture name already has -multi." >&4
6330                 ;;
6331         *)      archname="$archname-multi"
6332                 echo "...setting architecture name to $archname." >&4
6333                 ;;
6334         esac
6335         ;;
6336 esac
6337 case "$use64bitint$use64bitall" in
6338 *"$define"*)
6339         case "$archname64" in
6340         '')
6341                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6342                 ;;
6343         *)
6344                 case "$use64bitint" in
6345                 "$define") echo "64 bit integers selected." >&4 ;;
6346                 esac
6347                 case "$use64bitall" in
6348                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6349                 esac
6350                 case "$archname" in
6351                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6352                         ;;
6353                 *)      archname="$archname-$archname64"
6354                         echo "...setting architecture name to $archname." >&4
6355                         ;;
6356                 esac
6357                 ;;
6358         esac
6359 esac
6360 case "$uselongdouble" in
6361 $define)
6362         echo "Long doubles selected." >&4
6363         case "$longdblsize" in
6364         $doublesize)
6365                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6366                 ;;
6367         *)
6368                 case "$archname" in
6369                 *-ld*) echo "...and architecture name already has -ld." >&4
6370                         ;;
6371                 *)      archname="$archname-ld"
6372                         echo "...setting architecture name to $archname." >&4
6373                         ;;
6374                 esac
6375                 ;;
6376         esac
6377         ;;
6378 esac
6379 if $test -f archname.cbu; then
6380         echo "Your platform has some specific hints for architecture name, using them..."
6381         . ./archname.cbu
6382 fi
6383
6384 : set the prefixit variable, to compute a suitable default value
6385 prefixit='case "$3" in
6386 ""|none)
6387         case "$oldprefix" in
6388         "") eval "$1=\"\$$2\"";;
6389         *)
6390                 case "$3" in
6391                 "") eval "$1=";;
6392                 none)
6393                         eval "tp=\"\$$2\"";
6394                         case "$tp" in
6395                         ""|" ") eval "$1=\"\$$2\"";;
6396                         *) eval "$1=";;
6397                         esac;;
6398                 esac;;
6399         esac;;
6400 *)
6401         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6402         case "$tp" in
6403         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6404         /*-$oldprefix/*|\~*-$oldprefix/*)
6405                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6406         *) eval "$1=\"\$$2\"";;
6407         esac;;
6408 esac'
6409
6410 : determine installation style
6411 : For now, try to deduce it from prefix unless it is already set.
6412 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6413 case "$installstyle" in
6414 '')     case "$prefix" in
6415                 *perl*) dflt='lib';;
6416                 *) dflt='lib/perl5' ;;
6417         esac
6418         ;;
6419 *)      dflt="$installstyle" ;;
6420 esac
6421 : Probably not worth prompting for this since we prompt for all
6422 : the directories individually, and the prompt would be too long and
6423 : confusing anyway.
6424 installstyle=$dflt
6425
6426 : determine where public executables go
6427 echo " "
6428 set dflt bin bin
6429 eval $prefixit
6430 fn=d~
6431 rp='Pathname where the public executables will reside?'
6432 . ./getfile
6433 if $test "X$ansexp" != "X$binexp"; then
6434         installbin=''
6435 fi
6436 prefixvar=bin
6437 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6438 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6439 :     this via initialinstalllocation
6440 . ./setprefixvar
6441
6442 case "$userelocatableinc" in
6443 $define|true|[yY]*)     dflt='y' ;;
6444 *)                      dflt='n' ;;
6445 esac
6446 cat <<EOM
6447
6448 Would you like to build Perl so that the installation is relocatable, so that
6449 library paths in @INC are determined relative to the path of the perl binary?
6450 This is not advised for system Perl installs, or if you need to run setid
6451 scripts or scripts under taint mode.
6452
6453 If this doesn't make any sense to you, just accept the default '$dflt'.
6454 EOM
6455 rp='Use relocatable @INC?'
6456 . ./myread
6457 case "$ans" in
6458 y|Y)    val="$define" ;;
6459 *)      val="$undef"  ;;
6460 esac
6461 set userelocatableinc
6462 eval $setvar
6463
6464 initialinstalllocation="$binexp"
6465 : Default prefix is now "up one level from where the binaries are"
6466 case "$userelocatableinc" in
6467 $define|true|[yY]*)
6468     bin=".../"
6469     binexp=".../"
6470     prefix=".../.."
6471     prefixexp=".../.."
6472     installprefixexp=".../.."
6473     ;;
6474 esac
6475
6476 : determine where private library files go
6477 : Usual default is /usr/local/lib/perl5/$version.
6478 : Also allow things like /opt/perl/lib/$version, since
6479 : /opt/perl/lib/perl5... would be redundant.
6480 : The default "style" setting is made in installstyle.U
6481 case "$installstyle" in
6482 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6483 *)       set dflt privlib lib/$version ;;
6484 esac
6485 eval $prefixit
6486 $cat <<EOM
6487
6488 There are some auxiliary files for $package that need to be put into a
6489 private library directory that is accessible by everyone.
6490
6491 EOM
6492 fn=$binexp
6493 fn=d~+
6494 rp='Pathname where the private library files will reside?'
6495 . ./getfile
6496 prefixvar=privlib
6497 . ./setprefixvar
6498
6499 : set the prefixup variable, to restore leading tilda escape
6500 prefixup='case "$prefixexp" in
6501 "$prefix") ;;
6502 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6503 esac'
6504
6505 : determine where public architecture dependent libraries go
6506 set archlib archlib
6507 eval $prefixit
6508 : privlib default is /usr/local/lib/$package/$version
6509 : archlib default is /usr/local/lib/$package/$version/$archname
6510 : privlib may have an optional trailing /share.
6511 tdflt=`echo $privlib | $sed 's,/share$,,'`
6512 tdflt=$tdflt/$archname
6513 case "$archlib" in
6514 '')     dflt=$tdflt
6515         ;;
6516 *)      dflt="$archlib"
6517     ;;
6518 esac
6519 $cat <<EOM
6520
6521 $spackage contains architecture-dependent library files.  If you are
6522 sharing libraries in a heterogeneous environment, you might store
6523 these files in a separate location.  Otherwise, you can just include
6524 them with the rest of the public library files.
6525
6526 EOM
6527 fn=$binexp
6528 fn=d+~
6529 rp='Where do you want to put the public architecture-dependent libraries?'
6530 . ./getfile
6531 prefixvar=archlib
6532 . ./setprefixvar
6533 if $test X"$archlib" = X"$privlib"; then
6534         d_archlib="$undef"
6535 else
6536         d_archlib="$define"
6537 fi
6538
6539 : see if setuid scripts can be secure
6540 $cat <<EOM
6541
6542 Some kernels have a bug that prevents setuid #! scripts from being
6543 secure.  Some sites have disabled setuid #! scripts because of this.
6544
6545 First let's decide if your kernel supports secure setuid #! scripts.
6546 (If setuid #! scripts would be secure but have been disabled anyway,
6547 don't say that they are secure if asked.)
6548
6549 EOM
6550
6551 val="$undef"
6552 if $test -d /dev/fd; then
6553         echo "#!$ls" >reflect
6554         chmod +x,u+s reflect
6555         ./reflect >flect 2>&1
6556         if $contains "/dev/fd" flect >/dev/null; then
6557                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6558                 val="$define"
6559         else
6560                 $cat <<EOM
6561 If you are not sure if they are secure, I can check but I'll need a
6562 username and password different from the one you are using right now.
6563 If you don't have such a username or don't want me to test, simply
6564 enter 'none'.
6565
6566 EOM
6567                 rp='Other username to test security of setuid scripts with?'
6568                 dflt='none'
6569                 . ./myread
6570                 case "$ans" in
6571                 n|none)
6572                         case "$d_suidsafe" in
6573                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6574                                 dflt=n;;
6575                         "$undef")
6576                                 echo "Well, the $hint value is *not* secure." >&4
6577                                 dflt=n;;
6578                         *)      echo "Well, the $hint value *is* secure." >&4
6579                                 dflt=y;;
6580                         esac
6581                         ;;
6582                 *)
6583                         $rm -f reflect flect
6584                         echo "#!$ls" >reflect
6585                         chmod +x,u+s reflect
6586                         echo >flect
6587                         chmod a+w flect
6588                         echo '"su" will (probably) prompt you for '"$ans's password."
6589                         su $ans -c './reflect >flect'
6590                         if $contains "/dev/fd" flect >/dev/null; then
6591                                 echo "Okay, it looks like setuid scripts are secure." >&4
6592                                 dflt=y
6593                         else
6594                                 echo "I don't think setuid scripts are secure." >&4
6595                                 dflt=n
6596                         fi
6597                         ;;
6598                 esac
6599                 rp='Does your kernel have *secure* setuid scripts?'
6600                 . ./myread
6601                 case "$ans" in
6602                 [yY]*)  val="$define";;
6603                 *)      val="$undef";;
6604                 esac
6605         fi
6606 else
6607         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6608         echo "(That's for file descriptors, not floppy disks.)"
6609         val="$undef"
6610 fi
6611 set d_suidsafe
6612 eval $setvar
6613
6614 $rm -f reflect flect
6615
6616 : now see if they want to do setuid emulation
6617 if $test $patchlevel -lt 11; then
6618 echo " "
6619 val="$undef"
6620 case "$d_suidsafe" in
6621 "$define")
6622         val="$undef"
6623         echo "No need to emulate SUID scripts since they are secure here." >&4
6624         ;;
6625 *)
6626         $cat <<EOM
6627 Some systems have disabled setuid scripts, especially systems where
6628 setuid scripts cannot be secure.  On systems where setuid scripts have
6629 been disabled, the setuid/setgid bits on scripts are currently
6630 useless.  It is possible for $package to detect those bits and emulate
6631 setuid/setgid in a secure fashion.  This emulation will only work if
6632 setuid scripts have been disabled in your kernel.
6633
6634 EOM
6635         case "$d_dosuid" in
6636         "$define") dflt=y ;;
6637         *) dflt=n ;;
6638         esac
6639         rp="Do you want to do setuid/setgid emulation?"
6640         . ./myread
6641         case "$ans" in
6642         [yY]*)  val="$define";;
6643         *)      val="$undef";;
6644         esac
6645         ;;
6646 esac
6647 set d_dosuid
6648 eval $setvar
6649 else
6650     case "$d_dosuid" in
6651         "$define")
6652         cat >&4 <<EOH
6653
6654 SUID emulation has been removed for 5.12
6655 Please re-run Configure without -Dd_dosuid
6656
6657 EOH
6658         exit 1;
6659         ;;
6660     esac
6661     d_dosuid=undef
6662 fi
6663
6664 : Find perl5.005 or later.
6665 echo "Looking for a previously installed perl5.005 or later... "
6666 case "$perl5" in
6667 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6668                 : Check if this perl is recent and can load a simple module
6669                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6670                         perl5=$tdir/perl
6671                         break;
6672                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6673                         perl5=$tdir/perl5
6674                         break;
6675                 fi
6676         done
6677         ;;
6678 *)      perl5="$perl5"
6679         ;;
6680 esac
6681 case "$perl5" in
6682 '')     echo "None found.  That's ok.";;
6683 *)      echo "Using $perl5." ;;
6684 esac
6685
6686 : Set the siteprefix variables
6687 $cat <<EOM
6688
6689 After $package is installed, you may wish to install various
6690 add-on modules and utilities.  Typically, these add-ons will
6691 be installed under $prefix with the rest
6692 of this package.  However, you may wish to install such add-ons
6693 elsewhere under a different prefix.
6694
6695 If you do not wish to put everything under a single prefix, that's
6696 ok.  You will be prompted for the individual locations; this siteprefix
6697 is only used to suggest the defaults.
6698
6699 The default should be fine for most people.
6700
6701 EOM
6702 fn=d~+
6703 rp='Installation prefix to use for add-on modules and utilities?'
6704 : XXX Here might be another good place for an installstyle setting.
6705 case "$siteprefix" in
6706 '') dflt=$prefix ;;
6707 *)  dflt=$siteprefix ;;
6708 esac
6709 . ./getfile
6710 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6711 oldsiteprefix=''
6712 case "$siteprefix" in
6713 '') ;;
6714 *)      case "$ans" in
6715         "$prefix") ;;
6716         *) oldsiteprefix="$prefix";;
6717         esac
6718         ;;
6719 esac
6720 siteprefix="$ans"
6721 siteprefixexp="$ansexp"
6722
6723 : determine where site specific libraries go.
6724 : Usual default is /usr/local/lib/perl5/site_perl/$version
6725 : The default "style" setting is made in installstyle.U
6726 : XXX No longer works with Prefixit stuff.
6727 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6728 case "$sitelib" in
6729 '') case "$installstyle" in
6730         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6731         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6732         esac
6733         ;;
6734 *)      dflt="$sitelib"
6735         ;;
6736 esac
6737 $cat <<EOM
6738
6739 The installation process will create a directory for
6740 site-specific extensions and modules.  Most users find it convenient
6741 to place all site-specific files in this directory rather than in the
6742 main distribution directory.
6743
6744 EOM
6745 fn=d~+
6746 rp='Pathname for the site-specific library files?'
6747 . ./getfile
6748 prefixvar=sitelib
6749 . ./setprefixvar
6750 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6751
6752 : Determine list of previous versions to include in @INC
6753 $cat > getverlist <<EOPL
6754 #!$perl5 -w
6755 use File::Basename;
6756 \$api_versionstring = "$api_versionstring";
6757 \$version = "$version";
6758 \$stem = "$sitelib_stem";
6759 \$archname = "$archname";
6760 EOPL
6761         $cat >> getverlist <<'EOPL'
6762 # The list found is store twice for each entry: the original name, and
6763 # the binary broken down version as pack "sss", so sorting is easy and
6764 # unambiguous. This will work for all versions that have a maximum of
6765 # three digit groups, separate by '.'s or '_'s. Names are extended with
6766 # ".0.0" to ensure at least three elements for the pack.
6767 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6768
6769 # Can't have leading @ because metaconfig interprets it as a command!
6770 ;@inc_version_list=();
6771 # XXX Redo to do opendir/readdir?
6772 if (-d $stem) {
6773     chdir($stem);
6774     ;@candidates = map {
6775         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6776     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6777 }
6778 else {
6779     ;@candidates = ();
6780 }
6781
6782 ($pversion, $aversion, $vsn5005) = map {
6783     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6784 foreach $d (@candidates) {
6785     if ($d->[1] lt $pversion) {
6786         if ($d->[1] ge $aversion) {
6787             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6788         }
6789         elsif ($d->[1] ge $vsn5005) {
6790             unshift(@inc_version_list, grep { -d } $d->[0]);
6791         }
6792     }
6793     else {
6794         # Skip newer version.  I.e. don't look in
6795         # 5.7.0 if we're installing 5.6.1.
6796     }
6797 }
6798
6799 if (@inc_version_list) {
6800     print join(' ', @inc_version_list);
6801 }
6802 else {
6803     # Blank space to preserve value for next Configure run.
6804     print " ";
6805 }
6806 EOPL
6807 chmod +x getverlist
6808 case "$inc_version_list" in
6809 '')     if test -x "$perl5$exe_ext"; then
6810                 dflt=`$perl5 getverlist`
6811         else
6812                 dflt='none'
6813         fi
6814         ;;
6815 $undef) dflt='none' ;;
6816 *)  eval dflt=\"$inc_version_list\" ;;
6817 esac
6818 case "$dflt" in
6819 ''|' ') dflt=none ;;
6820 esac
6821 case "$dflt" in
6822 5.005) dflt=none ;;
6823 esac
6824 $cat <<EOM
6825
6826 In order to ease the process of upgrading, this version of perl
6827 can be configured to use modules built and installed with earlier
6828 versions of perl that were installed under $prefix.  Specify here
6829 the list of earlier versions that this version of perl should check.
6830 If Configure detected no earlier versions of perl installed under
6831 $prefix, then the list will be empty.  Answer 'none' to tell perl
6832 to not search earlier versions.
6833
6834 The default should almost always be sensible, so if you're not sure,
6835 just accept the default.
6836 EOM
6837
6838 rp='List of earlier versions to include in @INC?'
6839 . ./myread
6840 case "$ans" in
6841 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6842 *) inc_version_list="$ans" ;;
6843 esac
6844 case "$inc_version_list" in
6845 ''|' ')
6846         inc_version_list_init='0'
6847         d_inc_version_list="$undef"
6848         ;;
6849 *)      inc_version_list_init=`echo $inc_version_list |
6850                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6851         d_inc_version_list="$define"
6852         ;;
6853 esac
6854 $rm -f getverlist
6855
6856 : see if malloc/malloc.h has to be included
6857 set malloc/malloc.h i_mallocmalloc
6858 eval $inhdr
6859
6860 : see if this is a malloc.h system
6861 : we want a real compile instead of Inhdr because some systems have a
6862 : malloc.h that just gives a compile error saying to use stdlib.h instead
6863 echo " "
6864 $cat >try.c <<EOCP
6865 #include <stdlib.h>
6866 #include <malloc.h>
6867 #$i_mallocmalloc I_MALLOCMALLOC
6868 #ifdef I_MALLOCMALLOC
6869 # include <malloc/malloc.h>
6870 #endif
6871
6872 int main () { return 0; }
6873 EOCP
6874 set try
6875 if eval $compile; then
6876     echo "<malloc.h> found." >&4
6877     val="$define"
6878 else
6879     echo "<malloc.h> NOT found." >&4
6880     val="$undef"
6881 fi
6882 $rm_try
6883 set i_malloc
6884 eval $setvar
6885
6886 : check for length of pointer
6887 echo " "
6888 case "$ptrsize" in
6889 '')
6890         echo "Checking to see how big your pointers are..." >&4
6891         $cat >>try.c <<EOCP
6892 #include <stdio.h>
6893 #$i_stdlib I_STDLIB
6894 #ifdef I_STDLIB
6895 #include <stdlib.h>
6896 #endif
6897 int main()
6898 {
6899     printf("%d\n", (int)sizeof(void *));
6900     exit(0);
6901 }
6902 EOCP
6903         set try
6904         if eval $compile_ok; then
6905                 ptrsize=`$run ./try`
6906                 echo "Your pointers are $ptrsize bytes long."
6907         else
6908                 dflt='4'
6909                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6910                 rp="What is the size of a pointer (in bytes)?"
6911                 . ./myread
6912                 ptrsize="$ans"
6913         fi
6914         ;;
6915 esac
6916 $rm_try
6917 case "$use64bitall" in
6918 "$define"|true|[yY]*)
6919         case "$ptrsize" in
6920         4)      cat <<EOM >&4
6921
6922 *** You have chosen a maximally 64-bit build,
6923 *** but your pointers are only 4 bytes wide.
6924 *** Please rerun Configure without -Duse64bitall.
6925 EOM
6926                 case "$d_quad" in
6927                 define)
6928                         cat <<EOM >&4
6929 *** Since you have quads, you could possibly try with -Duse64bitint.
6930 EOM
6931                         ;;
6932                 esac
6933                 cat <<EOM >&4
6934 *** Cannot continue, aborting.
6935
6936 EOM
6937
6938                 exit 1
6939                 ;;
6940         esac
6941         ;;
6942 esac
6943
6944
6945 : determine whether to use malloc wrapping
6946 echo " "
6947 case "$usemallocwrap" in
6948 [yY]*|true|$define)     dflt='y' ;;
6949 [nN]*|false|$undef)     dflt='n' ;;
6950 *)      case "$usedevel" in
6951         [yY]*|true|$define)     dflt='y' ;;
6952         *) dflt='n' ;;
6953         esac
6954         ;;
6955 esac
6956 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6957 . ./myread
6958 usemallocwrap="$ans"
6959 case "$ans" in
6960 y*|true)
6961         usemallocwrap="$define" ;;
6962 *)
6963         usemallocwrap="$undef" ;;
6964 esac
6965
6966 : determine which malloc to compile in
6967 echo " "
6968 case "$usemymalloc" in
6969 [yY]*|true|$define)     dflt='y' ;;
6970 [nN]*|false|$undef)     dflt='n' ;;
6971 *)      case "$ptrsize" in
6972         4) dflt='y' ;;
6973         *) dflt='n' ;;
6974         esac
6975         if test "$useithreads" = "$define"; then dflt='n'; fi
6976         ;;
6977 esac
6978 rp="Do you wish to attempt to use the malloc that comes with $package?"
6979 . ./myread
6980 usemymalloc="$ans"
6981 case "$ans" in
6982 y*|true)
6983         usemymalloc='y'
6984         mallocsrc='malloc.c'
6985         mallocobj="malloc$_o"
6986         d_mymalloc="$define"
6987         case "$libs" in
6988         *-lmalloc*)
6989                 : Remove malloc from list of libraries to use
6990                 echo "Removing unneeded -lmalloc from library list" >&4
6991                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6992                 shift
6993                 libs="$*"
6994                 echo "libs = $libs" >&4
6995                 ;;
6996         esac
6997         ;;
6998 *)
6999         usemymalloc='n'
7000         mallocsrc=''
7001         mallocobj=''
7002         d_mymalloc="$undef"
7003         ;;
7004 esac
7005
7006 : compute the return types of malloc and free
7007 echo " "
7008 $cat >malloc.c <<END
7009 #$i_malloc I_MALLOC
7010 #$i_stdlib I_STDLIB
7011 #include <stdio.h>
7012 #include <sys/types.h>
7013 #ifdef I_MALLOC
7014 #include <malloc.h>
7015 #endif
7016 #ifdef I_STDLIB
7017 #include <stdlib.h>
7018 #endif
7019 #ifdef TRY_MALLOC
7020 void *malloc();
7021 #endif
7022 #ifdef TRY_FREE
7023 void free();
7024 #endif
7025 END
7026 case "$malloctype" in
7027 '')
7028         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7029                 malloctype='void *'
7030         else
7031                 malloctype='char *'
7032         fi
7033         ;;
7034 esac
7035 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7036
7037 case "$freetype" in
7038 '')
7039         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7040                 freetype='void'
7041         else
7042                 freetype='int'
7043         fi
7044         ;;
7045 esac
7046 echo "Your system uses $freetype free(), it would seem." >&4
7047 $rm -f malloc.[co]
7048 : determine where site specific architecture-dependent libraries go.
7049 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7050 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7051 : sitelib may have an optional trailing /share.
7052 case "$sitearch" in
7053 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7054         dflt="$dflt/$archname"
7055         ;;
7056 *)      dflt="$sitearch"
7057         ;;
7058 esac
7059 set sitearch sitearch none
7060 eval $prefixit
7061 $cat <<EOM
7062
7063 The installation process will also create a directory for
7064 architecture-dependent site-specific extensions and modules.
7065
7066 EOM
7067 fn=d~+
7068 rp='Pathname for the site-specific architecture-dependent library files?'
7069 . ./getfile
7070 prefixvar=sitearch
7071 . ./setprefixvar
7072 if $test X"$sitearch" = X"$sitelib"; then
7073         d_sitearch="$undef"
7074 else
7075         d_sitearch="$define"
7076 fi
7077
7078 : Set the vendorprefix variables
7079 $cat <<EOM
7080
7081 The installation process will also create a directory for
7082 vendor-supplied add-ons.  Vendors who supply perl with their system
7083 may find it convenient to place all vendor-supplied files in this
7084 directory rather than in the main distribution directory.  This will
7085 ease upgrades between binary-compatible maintenance versions of perl.
7086
7087 Of course you may also use these directories in whatever way you see
7088 fit.  For example, you might use them to access modules shared over a
7089 company-wide network.
7090
7091 The default answer should be fine for most people.
7092 This causes further questions about vendor add-ons to be skipped
7093 and no vendor-specific directories will be configured for perl.
7094
7095 EOM
7096 rp='Do you want to configure vendor-specific add-on directories?'
7097 case "$usevendorprefix" in
7098 define|true|[yY]*) dflt=y ;;
7099 *)      : User may have set vendorprefix directly on Configure command line.
7100         case "$vendorprefix" in
7101         ''|' ') dflt=n ;;
7102         *)      dflt=y ;;
7103         esac
7104         ;;
7105 esac
7106 . ./myread
7107 case "$ans" in
7108 [yY]*)  fn=d~+
7109         rp='Installation prefix to use for vendor-supplied add-ons?'
7110         case "$vendorprefix" in
7111         '') dflt="$prefix" ;;
7112         *)  dflt=$vendorprefix ;;
7113         esac
7114         . ./getfile
7115         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7116         oldvendorprefix=''
7117         case "$vendorprefix" in
7118         '') ;;
7119         *)      case "$ans" in
7120                 "$prefix") ;;
7121                 *) oldvendorprefix="$prefix";;
7122                 esac
7123                 ;;
7124         esac
7125         usevendorprefix="$define"
7126         vendorprefix="$ans"
7127         vendorprefixexp="$ansexp"
7128         ;;
7129 *)      usevendorprefix="$undef"
7130         vendorprefix=''
7131         vendorprefixexp=''
7132         ;;
7133 esac
7134
7135 : Set the vendorlib variables
7136 case "$vendorprefix" in
7137 '')     d_vendorlib="$undef"
7138         vendorlib=''
7139         vendorlibexp=''
7140         ;;
7141 *)      d_vendorlib="$define"
7142         : determine where vendor-supplied modules go.
7143         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7144         case "$vendorlib" in
7145         '')
7146                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7147                 case "$installstyle" in
7148                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7149                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7150                 esac
7151                 ;;
7152         *)      dflt="$vendorlib"
7153                 ;;
7154         esac
7155         fn=d~+
7156         rp='Pathname for the vendor-supplied library files?'
7157         . ./getfile
7158         vendorlib="$ans"
7159         vendorlibexp="$ansexp"
7160         ;;
7161 esac
7162 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7163 prefixvar=vendorlib
7164 . ./installprefix
7165
7166 : Set the vendorarch variables
7167 case "$vendorprefix" in
7168 '')     d_vendorarch="$undef"
7169         vendorarch=''
7170         vendorarchexp=''
7171         ;;
7172 *)      d_vendorarch="$define"
7173         : determine where vendor-supplied architecture-dependent libraries go.
7174         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7175         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7176         : vendorlib may have an optional trailing /share.
7177         case "$vendorarch" in
7178         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7179                 dflt="$dflt/$archname"
7180                 ;;
7181         *)      dflt="$vendorarch" ;;
7182         esac
7183         fn=d~+
7184         rp='Pathname for vendor-supplied architecture-dependent files?'
7185         . ./getfile
7186         vendorarch="$ans"
7187         vendorarchexp="$ansexp"
7188         ;;
7189 esac
7190 prefixvar=vendorarch
7191 . ./installprefix
7192 if $test X"$vendorarch" = X"$vendorlib"; then
7193         d_vendorarch="$undef"
7194 else
7195         d_vendorarch="$define"
7196 fi
7197
7198 : Final catch-all directories to search
7199 $cat <<EOM
7200
7201 Lastly, you can have perl look in other directories for extensions and
7202 modules in addition to those already specified.
7203 These directories will be searched after
7204         $sitearch
7205         $sitelib
7206 EOM
7207 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7208 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7209 echo ' '
7210 case "$otherlibdirs" in
7211 ''|' ') dflt='none' ;;
7212 *)      dflt="$otherlibdirs" ;;
7213 esac
7214 $cat <<EOM
7215 Enter a colon-separated set of extra paths to include in perl's @INC
7216 search path, or enter 'none' for no extra paths.
7217
7218 EOM
7219
7220 rp='Colon-separated list of additional directories for perl to search?'
7221 . ./myread
7222 case "$ans" in
7223 ' '|''|none)    otherlibdirs=' ' ;;
7224 *)      otherlibdirs="$ans" ;;
7225 esac
7226 case "$otherlibdirs" in
7227 ' ') val=$undef ;;
7228 *)      val=$define ;;
7229 esac
7230 set d_perl_otherlibdirs
7231 eval $setvar
7232
7233 : Cruising for prototypes
7234 echo " "
7235 echo "Checking out function prototypes..." >&4
7236 $cat >prototype.c <<EOCP
7237 #$i_stdlib I_STDLIB
7238 #ifdef I_STDLIB
7239 #include <stdlib.h>
7240 #endif
7241 int main(int argc, char *argv[]) {
7242         exit(0);}
7243 EOCP
7244 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7245         echo "Your C compiler appears to support function prototypes."
7246         val="$define"
7247 else
7248         echo "Your C compiler doesn't seem to understand function prototypes."
7249         val="$undef"
7250 fi
7251 set prototype
7252 eval $setvar
7253 $rm -f prototype*
7254
7255 : Check if ansi2knr is required
7256 case "$prototype" in
7257 "$define") ;;
7258 *)      ansi2knr='ansi2knr'
7259         echo " "
7260         cat <<EOM >&4
7261
7262 $me:  FATAL ERROR:
7263 This version of $package can only be compiled by a compiler that 
7264 understands function prototypes.  Unfortunately, your C compiler 
7265         $cc $ccflags
7266 doesn't seem to understand them.  Sorry about that.
7267
7268 If GNU cc is available for your system, perhaps you could try that instead.  
7269
7270 Eventually, we hope to support building Perl with pre-ANSI compilers.
7271 If you would like to help in that effort, please contact <perlbug@perl.org>.
7272
7273 Aborting Configure now.
7274 EOM
7275         exit 2
7276         ;;
7277 esac
7278
7279 : DTrace support
7280 dflt_dtrace='/usr/sbin/dtrace'
7281 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7282
7283 cat <<EOM
7284
7285 Perl can be built to support DTrace on platforms that support it.
7286 DTrace is a diagnosis and performance analysis tool from Sun.
7287
7288 If this doesn't make any sense to you, just accept the default '$dflt'.
7289 EOM
7290
7291 while $test 1 ; do
7292         case "$usedtrace" in
7293         $define|true|[yY]*)
7294                 dflt='y'
7295                 ;;
7296         ?*)
7297                 dflt='y'
7298                 dflt_dtrace=$usedtrace
7299                 ;;
7300         *)
7301                 dflt='n'
7302                 ;;
7303         esac
7304
7305         rp='Support DTrace if available?'
7306         . ./myread
7307         case "$ans" in
7308         y|Y)    val="$define" ;;
7309         *)      val="$undef" ;;
7310         esac
7311         set usedtrace
7312         eval $setvar
7313
7314         test "X$usedtrace" != "X$define" && break
7315
7316         echo " "
7317         rp='Where is the dtrace executable?'
7318         dflt=$dflt_dtrace
7319         . ./getfile
7320         val="$ans"
7321         set dtrace
7322         eval $setvar
7323
7324         if $test -f $dtrace
7325         then
7326                 if $dtrace -h -s ../perldtrace.d \
7327                         -o perldtrace.tmp >/dev/null 2>&1 \
7328                         && rm -f perldtrace.tmp
7329                 then
7330                         echo " "
7331                         echo "Good: your $dtrace knows about the -h flag."
7332                 else
7333                         cat >&2 <<EOM
7334
7335 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7336 ***
7337 *** Your installed dtrace doesn't support the -h switch to compile a D
7338 *** program into a C header. Can't continue.
7339
7340 EOM
7341                         exit 1
7342                 fi
7343                 break;
7344         fi
7345
7346         case "$fastread" in
7347         yes)
7348                 cat >&2 <<EOM
7349
7350 *** $me:  Fatal Error:  $dtrace not found.
7351 *** Can't continue.
7352
7353 EOM
7354                 exit 1
7355                 ;;
7356         *)
7357                 echo "*** $dtrace was not found."
7358                 echo " "
7359                 ;;
7360         esac
7361 done
7362
7363 : See if we want extra modules installed
7364 echo " "
7365 case "$extras" in
7366 '') dflt='n';;
7367 *) dflt='y';;
7368 esac
7369 cat <<EOM
7370 Perl can be built with extra modules or bundles of modules which
7371 will be fetched from the CPAN and installed alongside Perl.
7372
7373 Notice that you will need access to the CPAN; either via the Internet,
7374 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7375 be asked later to configure the CPAN.pm module which will in turn do
7376 the installation of the rest of the extra modules or bundles.)
7377
7378 Notice also that if the modules require any external software such as
7379 libraries and headers (the libz library and the zlib.h header for the
7380 Compress::Zlib module, for example) you MUST have any such software
7381 already installed, this configuration process will NOT install such
7382 things for you.
7383
7384 If this doesn't make any sense to you, just accept the default '$dflt'.
7385 EOM
7386 rp='Install any extra modules (y or n)?'
7387 . ./myread
7388 case "$ans" in
7389 y|Y)
7390         cat <<EOM
7391
7392 Please list any extra modules or bundles to be installed from CPAN,
7393 with spaces between the names.  The names can be in any format the
7394 'install' command of CPAN.pm will understand.  (Answer 'none',
7395 without the quotes, to install no extra modules or bundles.)
7396 EOM
7397         rp='Extras?'
7398         dflt="$extras"
7399         . ./myread
7400         extras="$ans"
7401 esac
7402 case "$extras" in
7403 ''|'none')
7404         val=''
7405         $rm -f ../extras.lst
7406         ;;
7407 *)      echo "(Saving the list of extras for later...)"
7408         echo "$extras" > ../extras.lst
7409         val="'$extras'"
7410         ;;
7411 esac
7412 set extras
7413 eval $setvar
7414 echo " "
7415
7416 : determine where html pages for programs go
7417 set html1dir html1dir none
7418 eval $prefixit
7419 $cat <<EOM
7420
7421 If you wish to install html files for programs in $spackage, indicate
7422 the appropriate directory here.  To skip installing html files,
7423 answer "none".
7424 EOM
7425 case "$html1dir" in
7426 ''|none|$undef|' ') dflt=none ;;
7427 *) dflt=$html1dir ;;
7428 esac
7429 fn=dn+~
7430 rp="Directory for the main $spackage html pages?"
7431 . ./getfile
7432 prefixvar=html1dir
7433 . ./setprefixvar
7434 : Use ' ' for none so value is preserved next time through Configure
7435 $test X"$html1dir" = "X" && html1dir=' '
7436
7437 : determine where html pages for libraries and modules go
7438 set html3dir html3dir none
7439 eval $prefixit
7440 $cat <<EOM
7441
7442 If you wish to install html files for modules associated with $spackage,
7443 indicate the appropriate directory here.  To skip installing html files,
7444 answer "none".
7445 EOM
7446 : There is no obvious default.  If they have specified html1dir, then
7447 : try to key off that, possibly changing .../html1 into .../html3.
7448 case "$html3dir" in
7449 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7450 *) dflt=$html3dir ;;
7451 esac
7452 fn=dn+~
7453 rp="Directory for the $spackage module html pages?"
7454 . ./getfile
7455 prefixvar=html3dir
7456 . ./setprefixvar
7457 : Use ' ' for none so value is preserved next time through Configure
7458 $test X"$html3dir" = "X" && html3dir=' '
7459
7460 : determine whether to install perl also as /usr/bin/perl
7461
7462 echo " "
7463 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7464         $cat <<EOM
7465 Many scripts expect perl to be installed as /usr/bin/perl.
7466
7467 If you want to, I can install the perl you are about to compile
7468 as /usr/bin/perl (in addition to $bin/perl).
7469 EOM
7470         if test -f /usr/bin/perl; then
7471             $cat <<EOM
7472
7473 However, please note that because you already have a /usr/bin/perl,
7474 overwriting that with a new Perl would very probably cause problems.
7475 Therefore I'm assuming you don't want to do that (unless you insist).
7476
7477 EOM
7478             case "$installusrbinperl" in
7479             "$define"|[yY]*)    dflt='y';;
7480             *)                  dflt='n';;
7481             esac
7482         else
7483             $cat <<EOM
7484
7485 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7486
7487 EOM
7488             case "$installusrbinperl" in
7489             "$undef"|[nN]*)     dflt='n';;
7490             *)                  dflt='y';;
7491             esac
7492         fi
7493         rp="Do you want to install perl as /usr/bin/perl?"
7494         . ./myread
7495         case "$ans" in
7496         [yY]*)  val="$define";;
7497         *)      val="$undef" ;;
7498         esac
7499 else
7500         val="$undef"
7501 fi
7502 set installusrbinperl
7503 eval $setvar
7504
7505 : Check if we are using the GNU C library
7506 echo " "
7507 echo "Checking for GNU C Library..." >&4
7508 cat >try.c <<'EOCP'
7509 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7510    alone are insufficient to distinguish different versions, such as
7511    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7512    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7513 */
7514 #include <stdio.h>
7515 int main(void)
7516 {
7517 #ifdef __GLIBC__
7518 #   ifdef __GLIBC_MINOR__
7519 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7520 #           include <gnu/libc-version.h>
7521             printf("%s\n",  gnu_get_libc_version());
7522 #       else
7523             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7524 #       endif
7525 #   else
7526         printf("%d\n",  __GLIBC__);
7527 #   endif
7528     return 0;
7529 #else
7530     return 1;
7531 #endif
7532 }
7533 EOCP
7534 set try
7535 if eval $compile_ok && $run ./try > glibc.ver; then
7536         val="$define"
7537         gnulibc_version=`$cat glibc.ver`
7538         echo "You are using the GNU C Library version $gnulibc_version"
7539 else
7540         val="$undef"
7541         gnulibc_version=''
7542         echo "You are not using the GNU C Library"
7543 fi
7544 $rm_try glibc.ver
7545 set d_gnulibc
7546 eval $setvar
7547
7548 : see if nm is to be used to determine whether a symbol is defined or not
7549 case "$usenm" in
7550 '')
7551         dflt=''
7552         case "$d_gnulibc" in
7553         "$define")
7554                 echo " "
7555                 echo "nm probably won't work on the GNU C Library." >&4
7556                 dflt=n
7557                 ;;
7558         esac
7559         case "$dflt" in
7560         '')
7561                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7562                         echo " "
7563                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7564                         echo "'nm' won't be sufficient on this system." >&4
7565                         dflt=n
7566                 fi
7567                 ;;
7568         esac
7569         case "$dflt" in
7570         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7571                 if $test $dflt -gt 20; then
7572                         dflt=y
7573                 else
7574                         dflt=n
7575                 fi
7576                 ;;
7577         esac
7578         ;;
7579 *)
7580         case "$usenm" in
7581         true|$define) dflt=y;;
7582         *) dflt=n;;
7583         esac
7584         ;;
7585 esac
7586 $cat <<EOM
7587
7588 I can use $nm to extract the symbols from your C libraries. This
7589 is a time consuming task which may generate huge output on the disk (up
7590 to 3 megabytes) but that should make the symbols extraction faster. The
7591 alternative is to skip the 'nm' extraction part and to compile a small
7592 test program instead to determine whether each symbol is present. If
7593 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7594 this may be the best solution.
7595
7596 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7597
7598 EOM
7599 rp="Shall I use $nm to extract C symbols from the libraries?"
7600 . ./myread
7601 case "$ans" in
7602 [Nn]*) usenm=false;;
7603 *) usenm=true;;
7604 esac
7605
7606 runnm=$usenm
7607 case "$reuseval" in
7608 true) runnm=false;;
7609 esac
7610
7611 : nm options which may be necessary
7612 case "$nm_opt" in
7613 '') if $test -f /mach_boot; then
7614                 nm_opt=''       # Mach
7615         elif $test -d /usr/ccs/lib; then
7616                 nm_opt='-p'     # Solaris (and SunOS?)
7617         elif $test -f /dgux; then
7618                 nm_opt='-p'     # DG-UX
7619         elif $test -f /lib64/rld; then
7620                 nm_opt='-p'     # 64-bit Irix
7621         else
7622                 nm_opt=''
7623         fi;;
7624 esac
7625
7626 : nm options which may be necessary for shared libraries but illegal
7627 : for archive libraries.  Thank you, Linux.
7628 case "$nm_so_opt" in
7629 '')     case "$myuname" in
7630         *linux*|gnu*)
7631                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7632                         nm_so_opt='--dynamic'
7633                 fi
7634                 ;;
7635         esac
7636         ;;
7637 esac
7638
7639 : Figure out where the libc is located
7640 case "$runnm" in
7641 true)
7642 : get list of predefined functions in a handy place
7643 echo " "
7644 case "$libc" in
7645 '') libc=unknown
7646         case "$libs" in
7647         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7648         esac
7649         ;;
7650 esac
7651 case "$libs" in
7652 '') ;;
7653 *)  for thislib in $libs; do
7654         case "$thislib" in
7655         -lc|-lc_s)
7656                 : Handle C library specially below.
7657                 ;;
7658         -l*)
7659                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7660                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7661                         :
7662                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7663                         :
7664                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7665                         :
7666                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7667                         :
7668                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7669                         :
7670                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7671                         :
7672                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7673                         :
7674                 else
7675                         try=''
7676                 fi
7677                 libnames="$libnames $try"
7678                 ;;
7679         *) libnames="$libnames $thislib" ;;
7680         esac
7681         done
7682         ;;
7683 esac
7684 xxx=normal
7685 case "$libc" in
7686 unknown)
7687         set /lib/libc.$so
7688         for xxx in $libpth; do
7689                 $test -r $1 || set $xxx/libc.$so
7690                 : The messy sed command sorts on library version numbers.
7691                 $test -r $1 || \
7692                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7693                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7694                                 h
7695                                 s/[0-9][0-9]*/0000&/g
7696                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7697                                 G
7698                                 s/\n/ /' | \
7699                          $sort | $sed -e 's/^.* //'`
7700                 eval set \$$#
7701         done
7702         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
7703         $test -r $1 || set $sysroot/lib/libsys_s$_a
7704         ;;
7705 *)
7706         set blurfl
7707         ;;
7708 esac
7709 if $test -r "$1"; then
7710         echo "Your (shared) C library seems to be in $1."
7711         libc="$1"
7712 elif $test -r /lib/libc && $test -r /lib/clib; then
7713         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7714         xxx=apollo
7715         libc='/lib/clib /lib/libc'
7716         if $test -r /lib/syslib; then
7717                 echo "(Your math library is in /lib/syslib.)"
7718                 libc="$libc /lib/syslib"
7719         fi
7720 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7721         echo "Your C library seems to be in $libc, as you said before."
7722 elif $test -r $incpath/usr/lib/libc$_a; then
7723         libc=$incpath/usr/lib/libc$_a;
7724         echo "Your C library seems to be in $libc.  That's fine."
7725 elif $test -r /lib/libc$_a; then
7726         libc=/lib/libc$_a;
7727         echo "Your C library seems to be in $libc.  You're normal."
7728 else
7729         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7730                 :
7731         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7732                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7733         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7734                 :
7735         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7736                 :
7737         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7738                 :
7739         else
7740                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7741         fi
7742         if $test -r "$tans"; then
7743                 echo "Your C library seems to be in $tans, of all places."
7744                 libc=$tans
7745         else
7746                 libc='blurfl'
7747         fi
7748 fi
7749 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7750         dflt="$libc"
7751         cat <<EOM
7752
7753 If the guess above is wrong (which it might be if you're using a strange
7754 compiler, or your machine supports multiple models), you can override it here.
7755
7756 EOM
7757 else
7758         dflt=''
7759         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7760         cat >&4 <<EOM
7761 I can't seem to find your C library.  I've looked in the following places:
7762
7763 EOM
7764         $sed 's/^/      /' libpath
7765         cat <<EOM
7766
7767 None of these seems to contain your C library. I need to get its name...
7768
7769 EOM
7770 fi
7771 fn=f
7772 rp='Where is your C library?'
7773 . ./getfile
7774 libc="$ans"
7775
7776 echo " "
7777 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7778 set X `cat libnames`
7779 shift
7780 xxx=files
7781 case $# in 1) xxx=file; esac
7782 echo "Extracting names from the following $xxx for later perusal:" >&4
7783 echo " "
7784 $sed 's/^/      /' libnames >&4
7785 echo " "
7786 $echo $n "This may take a while...$c" >&4
7787
7788 for file in $*; do
7789         case $file in
7790         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7791         *) $nm $nm_opt $file 2>/dev/null;;
7792         esac
7793 done >libc.tmp
7794
7795 $echo $n ".$c"
7796 $grep fprintf libc.tmp > libc.ptf
7797 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7798 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7799 xxx='[ADTSIWi]'
7800 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7801         eval $xscan;\
7802         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7803                 eval $xrun
7804 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7805         eval $xscan;\
7806         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7807                 eval $xrun
7808 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7809         eval $xscan;\
7810         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7811                 eval $xrun
7812 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7813         eval $xscan;\
7814         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7815                 eval $xrun
7816 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7817         eval $xscan;\
7818         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7819                 eval $xrun
7820 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7821         eval $xscan;\
7822         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7823                 eval $xrun
7824 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7825                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7826         eval $xscan;\
7827         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7828                 eval $xrun
7829 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7830         eval $xscan;\
7831         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7832                 eval $xrun
7833 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7834         eval $xscan;\
7835         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7836                 eval $xrun
7837 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7838         eval $xscan;\
7839         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7840                 eval $xrun
7841 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7842         eval $xscan;\
7843         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7844                 eval $xrun
7845 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7846         eval $xscan;\
7847         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7848                 eval $xrun
7849 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7850         eval $xscan;\
7851         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7852                 eval $xrun
7853 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7854         eval $xscan;\
7855         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7856                 eval $xrun
7857 else
7858         $nm -p $* 2>/dev/null >libc.tmp
7859         $grep fprintf libc.tmp > libc.ptf
7860         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7861                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7862         then
7863                 nm_opt='-p'
7864                 eval $xrun
7865         else
7866                 echo " "
7867                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7868                 com=''
7869                 if $ar t $libc > libc.tmp && \
7870                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7871                 then
7872                         for thisname in $libnames $libc; do
7873                                 $ar t $thisname >>libc.tmp
7874                         done
7875                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7876                         echo "Ok." >&4
7877                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7878                         for thisname in $libnames $libc; do
7879                                 $ar tv $thisname >>libc.tmp
7880                                 emximp -o tmp.imp $thisname \
7881                                     2>/dev/null && \
7882                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7883                                     < tmp.imp >>libc.tmp
7884                                 $rm -f tmp.imp
7885                         done
7886                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7887                         echo "Ok." >&4
7888                 else
7889                         echo "$ar didn't seem to work right." >&4
7890                         echo "Maybe this is a Cray...trying bld instead..." >&4
7891                         if  bld t $libc | \
7892                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7893                                 $test -s libc.list
7894                         then
7895                                 for thisname in $libnames; do
7896                                         bld t $libnames | \
7897                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7898                                         $ar t $thisname >>libc.tmp
7899                                 done
7900                                 echo "Ok." >&4
7901                         else
7902                                 echo "That didn't work either.  Giving up." >&4
7903                                 exit 1
7904                         fi
7905                 fi
7906         fi
7907 fi
7908 nm_extract="$com"
7909 case "$PASE" in
7910 define)
7911     echo " "
7912     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7913     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7914     ;;
7915 *)  if $test -f /lib/syscalls.exp; then
7916         echo " "
7917         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7918         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7919                 /lib/syscalls.exp >>libc.list
7920     fi
7921     ;;
7922 esac
7923 ;;
7924 esac
7925 $rm -f libnames libpath
7926
7927 : Check if we are using C++
7928 echo " "
7929 echo "Checking for C++..." >&4
7930 $cat >try.c <<'EOCP'
7931 #include <stdio.h>
7932 int main(void)
7933 {
7934 #ifdef __cplusplus
7935     return 0;
7936 #else
7937     return 1;
7938 #endif
7939 }
7940 EOCP
7941 set try
7942 if eval $compile_ok && $run ./try; then
7943         val="$define"
7944         echo "You are using a C++ compiler."
7945 else
7946         val="$undef"
7947         echo "You are not using a C++ compiler."
7948 fi
7949 $rm_try cplusplus$$
7950 set d_cplusplus
7951 eval $setvar
7952
7953 : is a C symbol defined?
7954 csym='tlook=$1;
7955 case "$3" in
7956 -v) tf=libc.tmp; tdc="";;
7957 -a) tf=libc.tmp; tdc="[]";;
7958 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7959 esac;
7960 case "$d_cplusplus" in
7961     $define)    extern_C="extern \"C\"" ;;
7962     *)          extern_C="extern"       ;;
7963 esac;
7964 tx=yes;
7965 case "$reuseval-$4" in
7966 true-) ;;
7967 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7968 esac;
7969 case "$tx" in
7970 yes)
7971         tval=false;
7972         if $test "$runnm" = true; then
7973                 if $contains $tlook $tf >/dev/null 2>&1; then
7974                         tval=true;
7975                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7976                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7977                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7978                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7979                         $rm_try;
7980                 fi;
7981         else
7982                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7983                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7984                 $rm_try;
7985         fi;
7986         ;;
7987 *)
7988         case "$tval" in
7989         $define) tval=true;;
7990         *) tval=false;;
7991         esac;
7992         ;;
7993 esac;
7994 eval "$2=$tval"'
7995
7996 : define an is-in-libc? function
7997 inlibc='echo " "; td=$define; tu=$undef;
7998 sym=$1; var=$2; eval "was=\$$2";
7999 tx=yes;
8000 case "$reuseval$was" in
8001 true) ;;
8002 true*) tx=no;;
8003 esac;
8004 case "$tx" in
8005 yes)
8006         set $sym tres -f;
8007         eval $csym;
8008         case "$tres" in
8009         true)
8010                 echo "$sym() found." >&4;
8011                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
8012         *)
8013                 echo "$sym() NOT found." >&4;
8014                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
8015         esac;;
8016 *)
8017         case "$was" in
8018         $define) echo "$sym() found." >&4;;
8019         *) echo "$sym() NOT found." >&4;;
8020         esac;;
8021 esac'
8022
8023 : see if dlopen exists
8024 xxx_runnm="$runnm"
8025 xxx_ccflags="$ccflags"
8026 runnm=false
8027 : with g++ one needs -shared to get is-in-libc to work for dlopen
8028 case "$gccversion" in
8029 '')     ;;
8030 *)      case "$d_cplusplus" in
8031         "$define") ccflags="$ccflags -shared" ;;
8032         esac
8033         ;;
8034 esac
8035 set dlopen d_dlopen
8036 eval $inlibc
8037 runnm="$xxx_runnm"
8038 ccflags="$xxx_ccflags"
8039
8040 : see if this is a unistd.h system
8041 set unistd.h i_unistd
8042 eval $inhdr
8043
8044 : determine which dynamic loading, if any, to compile in
8045 echo " "
8046 dldir="ext/DynaLoader"
8047 case "$usedl" in
8048     $define|y|true)
8049         dflt='y'
8050         usedl="$define"
8051         ;;
8052     $undef|n|false)
8053         dflt='n'
8054         usedl="$undef"
8055         ;;
8056     *)
8057         dflt='n'
8058         case "$d_dlopen" in
8059             $define) dflt='y' ;;
8060         esac
8061         : Does a dl_xxx.xs file exist for this operating system
8062         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8063         ;;
8064 esac
8065 rp="Do you wish to use dynamic loading?"
8066 . ./myread
8067 usedl="$ans"
8068 bin_ELF="$undef"
8069 case "$ans" in
8070     y*) usedl="$define"
8071         case "$dlsrc" in
8072             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8073                     dflt="$dldir/dl_${osname}.xs"
8074                 elif $test "$d_dlopen" = "$define" ; then
8075                     dflt="$dldir/dl_dlopen.xs"
8076                 else
8077                     dflt=''
8078                 fi
8079                 ;;
8080             *)  dflt="$dldir/$dlsrc"
8081                 ;;
8082         esac
8083         echo "The following dynamic loading files are available:"
8084         : Can not go over to $dldir because getfile has path hard-coded in.
8085         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8086         rp="Source file to use for dynamic loading"
8087         fn="fne"
8088         gfpth="$src"
8089         . ./getfile
8090         usedl="$define"
8091         : emulate basename
8092         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8093
8094         $cat << EOM
8095
8096 Some systems may require passing special flags to $cc -c to
8097 compile modules that will be used to create a shared library.
8098 To use no flags, say "none".
8099
8100 EOM
8101         case "$cccdlflags" in
8102             '') case "$gccversion" in
8103                 '') case "$osname" in
8104                         hpux)   dflt='+z' ;;
8105                         next)   dflt='none' ;;
8106                         irix*)  dflt='-KPIC' ;;
8107                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8108                         sunos)  dflt='-pic' ;;
8109                         *)      dflt='none' ;;
8110                     esac
8111                     ;;
8112                 *)  case "$osname" in
8113                         darwin) dflt='none' ;;
8114                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8115                         *)      dflt='-fpic' ;;
8116                     esac ;;
8117                 esac ;;
8118             ' ') dflt='none' ;;
8119             *)   dflt="$cccdlflags" ;;
8120         esac
8121
8122         case "$dflt" in
8123             none) dflt='' ;;
8124         esac
8125
8126         # If -Dsysroot was specified, now's the time to add it
8127         # to cccdlflags
8128         if test "X$sysroot" != X; then
8129             case "$gccversion" in
8130                 '') ;;
8131                 *)  case "$dflt" in
8132                         *sysroot*) ;;
8133                         'undef'|*)
8134                             dflt="$dflt --sysroot=$sysroot" ;;
8135                     esac
8136                     ;;
8137             esac
8138         fi
8139
8140         case "$dflt" in
8141             '') dflt='none';;
8142         esac
8143
8144         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8145         . ./myread
8146         case "$ans" in
8147             none) cccdlflags=' ' ;;
8148             *)    cccdlflags="$ans" ;;
8149         esac
8150
8151         cat << EOM
8152
8153 Some systems use ld to create libraries that can be dynamically loaded,
8154 while other systems (such as those using ELF) use $cc.
8155
8156 EOM
8157
8158 : Determine if this is ELF
8159         $cat >try.c <<EOM
8160 /* Test for whether ELF binaries are produced */
8161 #include <fcntl.h>
8162 #$i_stdlib I_STDLIB
8163 #ifdef I_STDLIB
8164 #include <stdlib.h>
8165 #endif
8166 #$i_unistd I_UNISTD
8167 #ifdef I_UNISTD
8168 #include <unistd.h>
8169 #endif
8170 int main() {
8171     char b[4];
8172     int i = open("a.out",O_RDONLY);
8173     if(i == -1)
8174         exit(1); /* fail */
8175     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8176         exit(0); /* succeed (yes, it is ELF) */
8177     exit(1); /* fail */
8178 }
8179 EOM
8180         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8181             bin_ELF="$define"
8182         fi
8183         $rm_try
8184
8185         case "$ld" in
8186             '') if $test $bin_ELF = "$define"; then
8187                     cat <<EOM
8188 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8189 EOM
8190                     dflt="$cc"
8191                 else
8192                     echo "I'll use ld to build dynamic libraries."
8193                     dflt='ld'
8194                 fi
8195                 ;;
8196             *)  dflt="$ld"
8197                 ;;
8198         esac
8199
8200         rp="What command should be used to create dynamic libraries?"
8201         . ./myread
8202         ld="$ans"
8203
8204         cat << EOM
8205
8206 Some systems may require passing special flags to $ld to create a
8207 library that can be dynamically loaded.  If your ld flags include
8208 -L/other/path options to locate libraries outside your loader's normal
8209 search path, you may need to specify those -L options here as well.  To
8210 use no flags, say "none".
8211
8212 EOM
8213         case "$lddlflags" in
8214             '') case "$osname" in
8215                     haiku) dflt='-shared' ;;
8216                     hpux) dflt='-b';
8217                           case "$gccversion" in
8218                               '') dflt="$dflt +vnocompatwarnings" ;;
8219                           esac
8220                           ;;
8221                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8222                     next)  dflt='none' ;;
8223                     solaris) # See [perl #66604].
8224                             # On Solaris 11, gcc -m64 on amd64
8225                             # appears not to understand -G.  gcc versions at
8226                             # least as old as 3.4.3 support -shared, so just
8227                             # use that with Solaris 11 and later, but keep
8228                             # the old behavior for older Solaris versions.
8229                             case "$gccversion" in
8230                                 '') dflt='-G' ;;
8231                                 *)  case "$osvers" in
8232                                         2.?|2.10) dflt='-G' ;;
8233                                         *) dflt='-shared' ;;
8234                                     esac
8235                                     ;;
8236                             esac
8237                             ;;
8238                     sunos) dflt='-assert nodefinitions' ;;
8239                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8240                     *)     dflt='none' ;;
8241                 esac
8242                 ;;
8243             *) dflt="$lddlflags" ;;
8244         esac
8245
8246         : Only do this for gcc, since, for example, qcc has no concept
8247         : of --sysroot.
8248         if $test "X$sysroot" != X; then
8249             case "$gccversion" in
8250                 '') ;;
8251                 *)  dflt="$dflt --sysroot $sysroot" ;;
8252             esac
8253         fi
8254
8255         : Try to guess additional flags to pick up local libraries.
8256         : Be careful not to append to a plain 'none'
8257         case "$dflt" in
8258             none) dflt='' ;;
8259         esac
8260         for thisflag in $ldflags; do
8261             case "$thisflag" in
8262                 -L*|-R*|-Wl,-R*)
8263                     case " $dflt " in
8264                         *" $thisflag "*) ;;
8265                         *) dflt="$dflt $thisflag" ;;
8266                     esac
8267                     ;;
8268             esac
8269         done
8270
8271         case "$dflt" in
8272             ''|' ') dflt='none' ;;
8273         esac
8274
8275         case "$ldflags" in
8276             *-fstack-protector*)
8277                 case "$dflt" in
8278                     *-fstack-protector*) ;; # Don't add it again
8279                     *) dflt="$dflt -fstack-protector" ;;
8280                 esac
8281                 ;;
8282         esac
8283
8284         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8285         . ./myread
8286         case "$ans" in
8287             none) lddlflags=' ' ;;
8288             *) lddlflags="$ans" ;;
8289         esac
8290
8291         cat <<EOM
8292
8293 Some systems may require passing special flags to $cc to indicate that
8294 the resulting executable will use dynamic linking.  To use no flags,
8295 say "none".
8296
8297 EOM
8298         case "$ccdlflags" in
8299             '') case "$osname" in
8300                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8301                     next|sunos)      dflt='none'   ;;
8302                     *)               dflt='none'   ;;
8303                 esac ;;
8304             ' ') dflt='none' ;;
8305             *)   dflt="$ccdlflags" ;;
8306         esac
8307         rp="Any special flags to pass to $cc to use dynamic linking?"
8308         . ./myread
8309         case "$ans" in
8310             none) ccdlflags=' ' ;;
8311             *)    ccdlflags="$ans" ;;
8312         esac
8313         ;;
8314
8315     *)  usedl="$undef"
8316         ld='ld'
8317         dlsrc='dl_none.xs'
8318         lddlflags=''
8319         ccdlflags=''
8320         ;;
8321 esac
8322
8323 ld_can_script="$undef"
8324 case "$bin_ELF$usedl" in
8325     $define$define)
8326         # Abuse try.h and a.out names for neat cleanup
8327         $cat >try.c <<EOM
8328 void foo() {}
8329 void bar() {}
8330 EOM
8331         $cat >try.h <<EOM
8332 LIBTEST_42 {
8333  global:
8334   foo;
8335  local: *;
8336  };
8337 EOM
8338         if $cc $cccdlflags $ccdlflags $ccflags \
8339                $ldflags $lddlflags -o a.out try.c \
8340                -Wl,--version-script=try.h >/dev/null 2>&1 \
8341            &&  $test -s a.out ; then
8342             echo "ld supports scripting" >&4
8343             ld_can_script="$define"
8344         else
8345             echo "ld does not support scripting" >&4
8346         fi
8347         $rm_try
8348         ;;
8349 esac
8350
8351 : Do we want a shared libperl?
8352 also=''
8353 case "$usedl" in
8354 $undef)
8355         # No dynamic loading being used, so don't bother even to prompt.
8356         useshrplib='false'
8357         ;;
8358 *)      case "$useshrplib" in
8359         '')     case "$osname" in
8360                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8361                         dflt=y
8362                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8363                         ;;
8364                 next*)
8365                         case "$osvers" in
8366                         4*)     dflt=y
8367                                 also='Building a shared libperl is needed for MAB support.'
8368                                 ;;
8369                         *)      dflt=n
8370                                 ;;
8371                         esac
8372                         ;;
8373                 *)      dflt=n
8374                         ;;
8375                 esac
8376                 ;;
8377         $define|true|[Yy]*)
8378                 dflt=y
8379                 ;;
8380         *)      dflt=n
8381                 ;;
8382         esac
8383         $cat << EOM
8384
8385 The perl executable is normally obtained by linking perlmain.c with
8386 libperl${_a}, any static extensions (usually just DynaLoader), and
8387 any other libraries needed on this system (such as -lm, etc.).  Since
8388 your system supports dynamic loading, it is probably possible to build
8389 a shared libperl.$so.  If you will have more than one executable linked
8390 to libperl.$so, this will significantly reduce the size of each
8391 executable, but it may have a noticeable effect on performance.  The
8392 default is probably sensible for your system.
8393 $also
8394
8395 EOM
8396         rp="Build a shared libperl.$so (y/n)"
8397         . ./myread
8398         case "$ans" in
8399         true|$define|[Yy]*)
8400                 useshrplib='true'  ;;
8401         *)      useshrplib='false' ;;
8402         esac
8403         ;;
8404 esac
8405
8406 case "$useshrplib" in
8407 true)
8408         case "$userelocatableinc" in
8409         true|define)
8410                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8411                 echo "See INSTALL for an explanation why that won't work." >&4
8412                 exit 4
8413                 ;;
8414         esac
8415         case "$libperl" in
8416         '')
8417                 # Figure out a good name for libperl.so.  Since it gets stored in
8418                 # a version-specific architecture-dependent library, the version
8419                 # number isn't really that important, except for making cc/ld happy.
8420                 #
8421                 # A name such as libperl.so.10.1
8422                 majmin="libperl.$so.$patchlevel.$subversion"
8423                 # A name such as libperl.so.100
8424                 majonly=`echo $patchlevel $subversion |
8425                         $awk '{printf "%d%02d", $1, $2}'`
8426                 majonly=libperl.$so.$majonly
8427                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8428                 # rely on figuring it out from the naming of libc.
8429                 case "${osname}${osvers}" in
8430                 next4*)
8431                         dflt=libperl.5.$so
8432                         # XXX How handle the --version stuff for MAB?
8433                         ;;
8434                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8435                         dflt=libperl.$so
8436                         ;;
8437                 cygwin*) # ld links now against the dll directly
8438                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8439                         majonly=`echo $patchlevel $subversion |
8440                                 $awk '{printf "%03d%03d", $1, $2}'`
8441                         majonly=cygperl5.$majonly.$so
8442                         dflt=$majmin
8443                         ;;
8444                 *)      # Try to guess based on whether libc has major.minor.
8445                         case "$libc" in
8446                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8447                         *libc.$so.[0-9]*) dflt=$majonly ;;
8448                         *)      dflt=libperl.$so ;;
8449                         esac
8450                         ;;
8451                 esac
8452                 ;;
8453         *)      dflt=$libperl
8454                 ;;
8455         esac
8456         cat << EOM
8457
8458 I need to select a good name for the shared libperl.  If your system uses
8459 library names with major and minor numbers, then you might want something
8460 like $majmin.  Alternatively, if your system uses a single version
8461 number for shared libraries, then you might want to use $majonly.
8462 Or, your system might be quite happy with a simple libperl.$so.
8463
8464 Since the shared libperl will get installed into a version-specific
8465 architecture-dependent directory, the version number of the shared perl
8466 library probably isn't important, so the default should be o.k.
8467
8468 EOM
8469         rp='What name do you want to give to the shared libperl?'
8470         . ./myread
8471         libperl=$ans
8472         echo "Ok, I'll use $libperl"
8473         ;;
8474 *)
8475         libperl="libperl${_a}"
8476         ;;
8477 esac
8478
8479 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8480 case "$shrpdir" in
8481 '') ;;
8482 *)      $cat >&4 <<EOM
8483 WARNING:  Use of the shrpdir variable for the installation location of
8484 the shared $libperl is not supported.  It was never documented and
8485 will not work in this version.  Let me (perlbug@perl.org)
8486 know of any problems this may cause.
8487
8488 EOM
8489         case "$shrpdir" in
8490         "$archlibexp/CORE")
8491                 $cat >&4 <<EOM
8492 But your current setting of $shrpdir is
8493 the default anyway, so it's harmless.
8494 EOM
8495                 ;;
8496         *)
8497                 $cat >&4 <<EOM
8498 Further, your current attempted setting of $shrpdir
8499 conflicts with the value of $archlibexp/CORE
8500 that installperl will use.
8501 EOM
8502                 ;;
8503         esac
8504         ;;
8505 esac
8506
8507 # How will the perl executable find the installed shared $libperl?
8508 # Add $xxx to ccdlflags.
8509 # If we can't figure out a command-line option, use $shrpenv to
8510 # set env LD_RUN_PATH.  The main perl makefile uses this.
8511 shrpdir=$archlibexp/CORE
8512 xxx=''
8513 tmp_shrpenv=''
8514 if "$useshrplib"; then
8515     case "$osname" in
8516         aix)
8517                 # We'll set it in Makefile.SH...
8518                 ;;
8519         solaris)
8520                 xxx="-R $shrpdir"
8521                 ;;
8522         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8523                 xxx="-Wl,-R$shrpdir"
8524                 ;;
8525         bsdos|linux|irix*|dec_osf|gnu*)
8526                 xxx="-Wl,-rpath,$shrpdir"
8527                 ;;
8528         next)
8529                 # next doesn't like the default...
8530                 ;;
8531         haiku)
8532                 # Haiku doesn't like the default, either.
8533                 ;;
8534         hpux*)
8535                 # hpux doesn't like the default, either.
8536                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8537                 ;;
8538         cygwin)
8539                 # cygwin needs only ldlibpth
8540                 ;;
8541         *)
8542                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8543                 ;;
8544         esac
8545         case "$xxx" in
8546         '') ;;
8547         *)
8548                 # Only add $xxx if it isn't already in ccdlflags.
8549                 case " $ccdlflags " in
8550                 *" $xxx "*)     ;;
8551                 *)      ccdlflags="$ccdlflags $xxx"
8552                         cat <<EOM >&4
8553
8554 Adding $xxx to the flags
8555 passed to $ld so that the perl executable will find the
8556 installed shared $libperl.
8557
8558 EOM
8559                         ;;
8560                 esac
8561                 ;;
8562         esac
8563 fi
8564 # Fix ccdlflags in AIX for building external extensions.
8565 # (For building Perl itself bare -bE:perl.exp is needed,
8566 #  Makefile.SH takes care of this.)
8567 case "$osname" in
8568 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8569 esac
8570 # Respect a hint or command-line value.
8571 case "$shrpenv" in
8572 '') shrpenv="$tmp_shrpenv" ;;
8573 esac
8574 case "$ldlibpthname" in
8575 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8576 none)   ldlibpthname='' ;;
8577 esac
8578
8579 : determine where manual pages are on this system
8580 echo " "
8581 case "$sysman" in
8582 '')
8583         syspath='/usr/share/man/man1 /usr/man/man1'
8584         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8585         syspath="$syspath /usr/man/u_man/man1"
8586         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8587         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8588         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8589         sysman=`./loc . /usr/man/man1 $syspath`
8590         ;;
8591 esac
8592 if $test -d "$sysman"; then
8593         echo "System manual is in $sysman." >&4
8594 else
8595         echo "Could not find manual pages in source form." >&4
8596 fi
8597
8598 : determine where manual pages go
8599 set man1dir man1dir none
8600 eval $prefixit
8601 $cat <<EOM
8602
8603 $spackage has manual pages available in source form.
8604 EOM
8605 case "$nroff" in
8606 nroff)
8607         echo "However, you don't have nroff, so they're probably useless to you."
8608         case "$man1dir" in
8609         '') man1dir="none";;
8610         esac;;
8611 esac
8612 echo "If you don't want the manual sources installed, answer 'none'."
8613 case "$man1dir" in
8614 ' ') dflt=none
8615         ;;
8616 '')
8617         lookpath="$prefixexp/share/man/man1"
8618         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8619         lookpath="$lookpath $prefixexp/man/p_man/man1"
8620         lookpath="$lookpath $prefixexp/man/u_man/man1"
8621         lookpath="$lookpath $prefixexp/man/man.1"
8622         case "$sysman" in
8623         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8624         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8625         esac
8626         set dflt
8627         eval $prefixup
8628         ;;
8629 *)  dflt="$man1dir"
8630         ;;
8631 esac
8632 echo " "
8633 fn=dn+~
8634 rp="Where do the main $spackage manual pages (source) go?"
8635 . ./getfile
8636 if $test "X$man1direxp" != "X$ansexp"; then
8637         installman1dir=''
8638 fi
8639 prefixvar=man1dir
8640 . ./setprefixvar
8641
8642 case "$man1dir" in
8643 '')     man1dir=' '
8644         installman1dir='';;
8645 esac
8646
8647 : What suffix to use on installed man pages
8648
8649 case "$man1dir" in
8650 ' ')
8651         man1ext='0'
8652         ;;
8653 *)
8654         rp="What suffix should be used for the main $spackage man pages?"
8655         case "$man1ext" in
8656         '')     case "$man1dir" in
8657                 *1)  dflt=1 ;;
8658                 *1p) dflt=1p ;;
8659                 *1pm) dflt=1pm ;;
8660                 *l) dflt=l;;
8661                 *n) dflt=n;;
8662                 *o) dflt=o;;
8663                 *p) dflt=p;;
8664                 *C) dflt=C;;
8665                 *L) dflt=L;;
8666                 *L1) dflt=L1;;
8667                 *) dflt=1;;
8668                 esac
8669                 ;;
8670         *)      dflt="$man1ext";;
8671         esac
8672         . ./myread
8673         man1ext="$ans"
8674         ;;
8675 esac
8676
8677 : see if we can have long filenames
8678 echo " "
8679 first=123456789abcdef
8680 $rm -f $first
8681 if (echo hi >$first) 2>/dev/null; then
8682         if $test -f 123456789abcde; then
8683                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8684                 val="$undef"
8685         else
8686                 echo 'You can have filenames longer than 14 characters.'>&4
8687                 val="$define"
8688         fi
8689 else
8690         $cat <<'EOM'
8691 You can't have filenames longer than 14 chars.
8692 You can't even think about them!
8693 EOM
8694         val="$undef"
8695 fi
8696 set d_flexfnam
8697 eval $setvar
8698 $rm -rf 123456789abcde*
8699
8700 : determine where library module manual pages go
8701 set man3dir man3dir none
8702 eval $prefixit
8703 $cat <<EOM
8704
8705 $spackage has manual pages for many of the library modules.
8706 EOM
8707
8708 case "$nroff" in
8709 nroff)
8710         $cat <<'EOM'
8711 However, you don't have nroff, so they're probably useless to you.
8712 EOM
8713         case "$man3dir" in
8714         '') man3dir="none";;
8715         esac;;
8716 esac
8717
8718 case "$d_flexfnam" in
8719 undef)
8720         $cat <<'EOM'
8721 However, your system can't handle the long file names like File::Basename.3.
8722 EOM
8723         case "$man3dir" in
8724         '') man3dir="none";;
8725         esac;;
8726 esac
8727
8728 echo "If you don't want the manual sources installed, answer 'none'."
8729 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8730 case "$man3dir" in
8731 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8732         if $test -d "$privlib/man/man3"; then
8733                 cat <<EOM >&4
8734
8735 WARNING:  Previous versions of perl installed man3 pages into
8736 $privlib/man/man3.  This version will suggest a
8737 new default of $dflt.
8738 EOM
8739                 tdflt=$dflt
8740                 dflt='n'
8741                 rp='Do you wish to preserve the old behavior?(y/n)'
8742                 . ./myread
8743                 case "$ans" in
8744                 y*) dflt="$privlib/man/man3" ;;
8745                 *)  dflt=$tdflt ;;
8746                 esac
8747     fi
8748         ;;
8749 *)      dflt="$man3dir" ;;
8750 esac
8751 case "$dflt" in
8752 ' ') dflt=none ;;
8753 esac
8754 echo " "
8755 fn=dn+~
8756 rp="Where do the $package library man pages (source) go?"
8757 . ./getfile
8758 prefixvar=man3dir
8759 . ./setprefixvar
8760
8761 case "$man3dir" in
8762 '')     man3dir=' '
8763         installman3dir='';;
8764 esac
8765
8766 : What suffix to use on installed man pages
8767 case "$man3dir" in
8768 ' ')
8769         man3ext='0'
8770         ;;
8771 *)
8772         rp="What suffix should be used for the $package library man pages?"
8773         case "$man3ext" in
8774         '')     case "$man3dir" in
8775                 *3)  dflt=3 ;;
8776                 *3p) dflt=3p ;;
8777                 *3pm) dflt=3pm ;;
8778                 *l) dflt=l;;
8779                 *n) dflt=n;;
8780                 *o) dflt=o;;
8781                 *p) dflt=p;;
8782                 *C) dflt=C;;
8783                 *L) dflt=L;;
8784                 *L3) dflt=L3;;
8785                 *) dflt=3;;
8786                 esac
8787                 ;;
8788         *)      dflt="$man3ext";;
8789         esac
8790         . ./myread
8791         man3ext="$ans"
8792         ;;
8793 esac
8794
8795 : see if we have to deal with yellow pages, now NIS.
8796 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8797         if $test -f /usr/etc/nibindd; then
8798                 echo " "
8799                 echo "I'm fairly confident you're on a NeXT."
8800                 echo " "
8801                 rp='Do you get the hosts file via NetInfo?'
8802                 dflt=y
8803                 case "$hostcat" in
8804                 nidump*) ;;
8805                 '') ;;
8806                 *) dflt=n;;
8807                 esac
8808                 . ./myread
8809                 case "$ans" in
8810                 y*) hostcat='nidump hosts .';;
8811                 *)      case "$hostcat" in
8812                         nidump*) hostcat='';;
8813                         esac
8814                         ;;
8815                 esac
8816         fi
8817         case "$hostcat" in
8818         nidump*) ;;
8819         *)
8820                 case "$hostcat" in
8821                 *ypcat*) dflt=y;;
8822                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8823                                 dflt=y
8824                         else
8825                                 dflt=n
8826                         fi;;
8827                 *) dflt=n;;
8828                 esac
8829                 echo " "
8830                 rp='Are you getting the hosts file via yellow pages?'
8831                 . ./myread
8832                 case "$ans" in
8833                 y*) hostcat='ypcat hosts';;
8834                 *) hostcat='cat /etc/hosts';;
8835                 esac
8836                 ;;
8837         esac
8838 fi
8839 case "$hostcat" in
8840 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8841 esac
8842 case "$groupcat" in
8843 '') test -f /etc/group && groupcat='cat /etc/group';;
8844 esac
8845 case "$passcat" in
8846 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8847 esac
8848
8849 : now get the host name
8850 echo " "
8851 echo "Figuring out host name..." >&4
8852 case "$myhostname" in
8853 '') cont=true
8854         echo 'Maybe "hostname" will work...'
8855         if tans=`sh -c hostname 2>&1` ; then
8856                 myhostname=$tans
8857                 phostname=hostname
8858                 cont=''
8859         fi
8860         ;;
8861 *) cont='';;
8862 esac
8863 if $test "$cont"; then
8864         if ./xenix; then
8865                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8866                 if tans=`cat /etc/systemid 2>&1` ; then
8867                         myhostname=$tans
8868                         phostname='cat /etc/systemid'
8869                         echo "Whadyaknow.  Xenix always was a bit strange..."
8870                         cont=''
8871                 fi
8872         elif $test -r /etc/systemid; then
8873                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8874         fi
8875 fi
8876 if $test "$cont"; then
8877         echo 'No, maybe "uuname -l" will work...'
8878         if tans=`sh -c 'uuname -l' 2>&1` ; then
8879                 myhostname=$tans
8880                 phostname='uuname -l'
8881         else
8882                 echo 'Strange.  Maybe "uname -n" will work...'
8883                 if tans=`sh -c 'uname -n' 2>&1` ; then
8884                         myhostname=$tans
8885                         phostname='uname -n'
8886                 else
8887                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8888                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8889                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8890                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8891                         else
8892                                 case "$myhostname" in
8893                                 '') echo "Does this machine have an identity crisis or something?"
8894                                         phostname='';;
8895                                 *)
8896                                         echo "Well, you said $myhostname before..."
8897                                         phostname='echo $myhostname';;
8898                                 esac
8899                         fi
8900                 fi
8901         fi
8902 fi
8903 case "$myhostname" in
8904 '') myhostname=noname ;;
8905 esac
8906 : you do not want to know about this
8907 set $myhostname
8908 myhostname=$1
8909
8910 : verify guess
8911 if $test "$myhostname" ; then
8912         dflt=y
8913         rp='Your host name appears to be "'$myhostname'".'" Right?"
8914         . ./myread
8915         case "$ans" in
8916         y*) ;;
8917         *) myhostname='';;
8918         esac
8919 fi
8920
8921 : bad guess or no guess
8922 while $test "X$myhostname" = X ; do
8923         dflt=''
8924         rp="Please type the (one word) name of your host:"
8925         . ./myread
8926         myhostname="$ans"
8927 done
8928
8929 : translate upper to lower if necessary
8930 case "$myhostname" in
8931 *[A-Z]*)
8932         echo "(Normalizing case in your host name)"
8933         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8934         ;;
8935 esac
8936
8937 case "$myhostname" in
8938 *.*)
8939         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8940         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8941         echo "(Trimming domain name from host name--host name is now $myhostname)"
8942         ;;
8943 *) case "$mydomain" in
8944         '')
8945                 {
8946                         test "X$hostcat" = "Xypcat hosts" &&
8947                         ypmatch "$myhostname" hosts 2>/dev/null |\
8948                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8949                         $test -s hosts
8950                 } || {
8951                         test "X$hostcat" != "X" &&
8952                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8953                                         /[       ]$myhostname[  . ]/p" > hosts
8954                 }
8955                 tmp_re="[       . ]"
8956                 if $test -f hosts; then
8957                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8958                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8959                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8960                                 hosts | $sort | $uniq | \
8961                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8962                         case `$echo X$dflt` in
8963                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8964                                 dflt=.
8965                                 ;;
8966                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8967                                 ;;
8968                         esac
8969                 else
8970                         echo "(I cannot locate a hosts database anywhere)"
8971                         dflt=.
8972                 fi
8973                 case "$dflt" in
8974                 .)
8975                         tans=`./loc resolv.conf X /etc /usr/etc`
8976                         if $test -f "$tans"; then
8977                                 echo "(Attempting domain name extraction from $tans)"
8978                                 dflt=.`$sed -n -e 's/   / /g' \
8979                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8980                                   -e 1q 2>/dev/null`
8981                                 case "$dflt" in
8982                                 .) dflt=.`$sed -n -e 's/        / /g' \
8983                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8984                                      -e 1q 2>/dev/null`
8985                                         ;;
8986                                 esac
8987                         fi
8988                         ;;
8989                 esac
8990                 case "$dflt" in
8991                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8992                         dflt=.`sh -c domainname 2>/dev/null`
8993                         case "$dflt" in
8994                         '') dflt='.';;
8995                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8996                         esac
8997                         ;;
8998                 esac
8999                 case "$dflt$osname" in
9000                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9001                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9002                         ;;
9003                 esac
9004                 case "$dflt" in
9005                 .) echo "(Lost all hope -- silly guess then)"
9006                         dflt='.nonet'
9007                         ;;
9008                 esac
9009                 $rm -f hosts
9010                 ;;
9011         *) dflt="$mydomain";;
9012         esac;;
9013 esac
9014 echo " "
9015 rp="What is your domain name?"
9016 . ./myread
9017 tans="$ans"
9018 case "$ans" in
9019 '') ;;
9020 .*) ;;
9021 *) tans=".$tans";;
9022 esac
9023 mydomain="$tans"
9024
9025 : translate upper to lower if necessary
9026 case "$mydomain" in
9027 *[A-Z]*)
9028         echo "(Normalizing case in your domain name)"
9029         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9030         ;;
9031 esac
9032
9033 : a little sanity check here
9034 case "$phostname" in
9035 '') ;;
9036 *)
9037         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9038         $myhostname$mydomain|$myhostname) ;;
9039         *)
9040                 case "$phostname" in
9041                 sed*)
9042                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9043                         ;;
9044                 *)
9045                         echo "(That doesn't agree with your $phostname command, by the way.)"
9046                         ;;
9047                 esac
9048         ;;
9049         esac
9050         ;;
9051 esac
9052
9053 : determine the e-mail address of the user who is running us
9054 $cat <<EOM
9055
9056 I need to get your e-mail address in Internet format if possible, i.e.
9057 something like user@host.domain. Please answer accurately since I have
9058 no easy means to double check it. The default value provided below
9059 is most probably close to reality but may not be valid from outside
9060 your organization...
9061
9062 EOM
9063 cont=x
9064 while test "$cont"; do
9065         case "$MAILDOMAIN" in
9066         '')
9067                 if $test -s /etc/mailname; then
9068                         maildomain=`$cat /etc/mailname`
9069                 else
9070                         maildomain="$myhostname$mydomain"
9071                 fi
9072                 ;;
9073         *)  maildomain="$MAILDOMAIN";;
9074         esac
9075         case "$cf_email" in
9076         '') dflt="$cf_by@$maildomain";;
9077         *)  dflt="$cf_email";;
9078         esac
9079         rp='What is your e-mail address?'
9080         . ./myread
9081         cf_email="$ans"
9082         case "$cf_email" in
9083         *@*.*) cont='' ;;
9084         *)
9085                 rp='Address does not look like an Internet one.  Use it anyway?'
9086                 case "$fastread" in
9087                 yes) dflt=y ;;
9088                 *) dflt=n ;;
9089                 esac
9090                 . ./myread
9091                 case "$ans" in
9092                 y*) cont='' ;;
9093                 *) echo " " ;;
9094                 esac
9095                 ;;
9096         esac
9097 done
9098
9099 : Ask e-mail of administrator
9100 $cat <<EOM
9101
9102 If you or somebody else will be maintaining perl at your site, please
9103 fill in the correct e-mail address here so that they may be contacted
9104 if necessary. Currently, the "perlbug" program included with perl
9105 will send mail to this address in addition to perlbug@perl.org. You may
9106 enter "none" for no administrator.
9107
9108 EOM
9109 case "$perladmin" in
9110 '') dflt="$cf_email";;
9111 *) dflt="$perladmin";;
9112 esac
9113 rp='Perl administrator e-mail address'
9114 . ./myread
9115 perladmin="$ans"
9116
9117 : determine whether to only install version-specific parts.
9118 echo " "
9119 $cat <<EOM
9120 Do you want to install only the version-specific parts of the perl
9121 distribution?  Usually you do *not* want to do this.
9122 EOM
9123 case "$versiononly" in
9124 "$define"|[Yy]*|true) dflt='y' ;;
9125 *) dflt='n';
9126 esac
9127 rp="Do you want to install only the version-specific parts of perl?"
9128 . ./myread
9129 case "$ans" in
9130 [yY]*)  val="$define";;
9131 *)      val="$undef" ;;
9132 esac
9133 set versiononly
9134 eval $setvar
9135
9136 case "$versiononly" in
9137 "$define") inc_version_list=''
9138            inc_version_list_init=0
9139            ;;
9140 esac
9141
9142 : figure out how to guarantee perl startup
9143 : XXX Note that this currently takes advantage of the bug that binexp ignores
9144 :     the Configure -Dinstallprefix setting, which in turn means that under
9145 :     relocatable @INC, initialinstalllocation is what binexp started as.
9146 case "$startperl" in
9147 '')
9148         case "$sharpbang" in
9149         *!)
9150                 $cat <<EOH
9151
9152 I can use the #! construct to start perl on your system. This will
9153 make startup of perl scripts faster, but may cause problems if you
9154 want to share those scripts and perl is not in a standard place
9155 ($initialinstalllocation/perl) on all your platforms. The alternative
9156 is to force a shell by starting the script with a single ':' character.
9157
9158 EOH
9159                 case "$versiononly" in
9160                 "$define")      dflt="$initialinstalllocation/perl$version";;
9161                 *)              dflt="$initialinstalllocation/perl";;
9162                 esac
9163                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9164                 . ./myread
9165                 case "$ans" in
9166                 none)   startperl=": # use perl";;
9167                 *)      startperl="#!$ans"
9168                         if $test 30 -lt `echo "$ans" | wc -c`; then
9169                                 $cat >&4 <<EOM
9170
9171 WARNING:  Some systems limit the #! command to 32 characters.
9172 If you experience difficulty running Perl scripts with #!, try
9173 installing Perl in a directory with a shorter pathname.
9174
9175 EOM
9176                         fi ;;
9177                 esac
9178                 ;;
9179         *) startperl=": # use perl"
9180                 ;;
9181         esac
9182         ;;
9183 esac
9184 echo "I'll use $startperl to start perl scripts."
9185
9186 : figure best path for perl in scripts
9187 case "$perlpath" in
9188 '')
9189         case "$versiononly" in
9190         "$define")      perlpath="$initialinstalllocation/perl$version";;
9191         *)              perlpath="$initialinstalllocation/perl";;
9192         esac
9193         case "$startperl" in
9194         *!*) ;;
9195         *)
9196                 $cat <<EOH
9197
9198 I will use the "eval 'exec'" idiom to start Perl on your system.
9199 I can use the full path of your Perl binary for this purpose, but
9200 doing so may cause problems if you want to share those scripts and
9201 Perl is not always in a standard place ($initialinstalllocation/perl).
9202
9203 EOH
9204                 dflt="$initialinstalllocation/perl"
9205                 rp="What path shall I use in \"eval 'exec'\"?"
9206                 . ./myread
9207                 perlpath="$ans"
9208                 ;;
9209         esac
9210         ;;
9211 esac
9212 case "$startperl" in
9213 *!*)    ;;
9214 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9215 esac
9216
9217 : determine where public executable scripts go
9218 set scriptdir scriptdir
9219 eval $prefixit
9220 case "$scriptdir" in
9221 '')
9222         dflt="$bin"
9223         : guess some guesses
9224         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9225         $test -d /usr/share/bin     && dflt=/usr/share/bin
9226         $test -d /usr/local/script  && dflt=/usr/local/script
9227         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9228         $test -d $prefixexp/script  && dflt=$prefixexp/script
9229         set dflt
9230         eval $prefixup
9231         ;;
9232 *)  dflt="$scriptdir"
9233         ;;
9234 esac
9235 $cat <<EOM
9236
9237 Some installations have a separate directory just for executable scripts so
9238 that they can mount it across multiple architectures but keep the scripts in
9239 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9240 Or you might just lump your scripts in with all your other executables.
9241
9242 EOM
9243 fn=d~
9244 rp='Where do you keep publicly executable scripts?'
9245 . ./getfile
9246 if $test "X$ansexp" != "X$scriptdirexp"; then
9247         installscript=''
9248 fi
9249 installscriptdir=''
9250 prefixvar=scriptdir
9251 . ./setprefixvar
9252 : A little fix up for an irregularly named variable.
9253 installscript="$installscriptdir"
9254
9255 : determine where add-on public executables go
9256 case "$sitebin" in
9257 '')     dflt=$siteprefix/bin ;;
9258 *)      dflt=$sitebin ;;
9259 esac
9260 fn=d~
9261 rp='Pathname where the add-on public executables should be installed?'
9262 . ./getfile
9263 prefixvar=sitebin
9264 . ./setprefixvar
9265
9266 : determine where add-on html pages go
9267 : There is no standard location, so try to copy the previously-selected
9268 : directory structure for the core html pages.
9269 case "$sitehtml1dir" in
9270 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9271 *)     dflt=$sitehtml1dir ;;
9272 esac
9273 case "$dflt" in
9274 ''|' ') dflt=none ;;
9275 esac
9276 fn=dn+~
9277 rp='Pathname where the site-specific html pages should be installed?'
9278 . ./getfile
9279 prefixvar=sitehtml1dir
9280 . ./setprefixvar
9281
9282 : determine where add-on library html pages go
9283 : There is no standard location, so try to copy the previously-selected
9284 : directory structure for the core html pages.
9285 case "$sitehtml3dir" in
9286 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9287 *)     dflt=$sitehtml3dir ;;
9288 esac
9289 case "$dflt" in
9290 ''|' ') dflt=none ;;
9291 esac
9292 fn=dn+~
9293 rp='Pathname where the site-specific library html pages should be installed?'
9294 . ./getfile
9295 prefixvar=sitehtml3dir
9296 . ./setprefixvar
9297
9298 : determine where add-on manual pages go
9299 case "$siteman1dir" in
9300 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9301 *)      dflt=$siteman1dir ;;
9302 esac
9303 case "$dflt" in
9304 ''|' ') dflt=none ;;
9305 esac
9306 fn=dn+~
9307 rp='Pathname where the site-specific manual pages should be installed?'
9308 . ./getfile
9309 prefixvar=siteman1dir
9310 . ./setprefixvar
9311
9312 : determine where add-on library man pages go
9313 case "$siteman3dir" in
9314 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9315 *)      dflt=$siteman3dir ;;
9316 esac
9317 case "$dflt" in
9318 ''|' ') dflt=none ;;
9319 esac
9320 fn=dn+~
9321 rp='Pathname where the site-specific library manual pages should be installed?'
9322 . ./getfile
9323 prefixvar=siteman3dir
9324 . ./setprefixvar
9325
9326 : determine where add-on public executable scripts go
9327 case "$sitescript" in
9328 '')     dflt=$siteprefix/script
9329         $test -d $dflt || dflt=$sitebin ;;
9330 *)  dflt="$sitescript" ;;
9331 esac
9332 fn=d~+
9333 rp='Pathname where add-on public executable scripts should be installed?'
9334 . ./getfile
9335 prefixvar=sitescript
9336 . ./setprefixvar
9337
9338 : Check if faststdio is requested and available
9339 case "$usefaststdio" in
9340 $define|true|[yY]*|'')
9341         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9342         case "$xversion" in
9343         [68])   dflt='y' ;;
9344         *)      dflt='n' ;;
9345         esac
9346         ;;
9347 *) dflt='n';;
9348 esac
9349 cat <<EOM
9350
9351 Perl can be built to use 'fast stdio', which means using the stdio
9352 library but also directly manipulating the stdio buffers to enable
9353 faster I/O.  Using stdio is better for backward compatibility (especially
9354 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9355 interface has been preferred instead of stdio.
9356
9357 If this doesn't make any sense to you, just accept the default '$dflt'.
9358 EOM
9359 rp='Use the "fast stdio" if available?'
9360 . ./myread
9361 case "$ans" in
9362 y|Y)    val="$define" ;;
9363 *)      val="$undef" ;;
9364 esac
9365 set usefaststdio
9366 eval $setvar
9367
9368
9369 : define an is-a-typedef? function
9370 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9371 case "$inclist" in
9372 "") inclist="sys/types.h";;
9373 esac;
9374 eval "varval=\$$var";
9375 case "$varval" in
9376 "")
9377         $rm -f temp.c;
9378         for inc in $inclist; do
9379                 echo "#include <$inc>" >>temp.c;
9380         done;
9381         echo "#ifdef $type" >> temp.c;
9382         echo "printf(\"We have $type\");" >> temp.c;
9383         echo "#endif" >> temp.c;
9384         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9385         if $contains $type temp.E >/dev/null 2>&1; then
9386                 eval "$var=\$type";
9387         else
9388                 eval "$var=\$def";
9389         fi;
9390         $rm -f temp.?;;
9391 *) eval "$var=\$varval";;
9392 esac'
9393
9394 : define an is-a-typedef? function that prompts if the type is not available.
9395 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9396 case "$inclist" in
9397 "") inclist="sys/types.h";;
9398 esac;
9399 eval "varval=\$$var";
9400 case "$varval" in
9401 "")
9402         $rm -f temp.c;
9403         for inc in $inclist; do
9404                 echo "#include <$inc>" >>temp.c;
9405         done;
9406         echo "#ifdef $type" >> temp.c;
9407         echo "printf(\"We have $type\");" >> temp.c;
9408         echo "#endif" >> temp.c;
9409         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9410         echo " " ;
9411         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9412         if $contains $type temp.E >/dev/null 2>&1; then
9413                 echo "$type found." >&4;
9414                 eval "$var=\$type";
9415         else
9416                 echo "$type NOT found." >&4;
9417                 dflt="$def";
9418                 . ./myread ;
9419                 eval "$var=\$ans";
9420         fi;
9421         $rm -f temp.?;;
9422 *) eval "$var=\$varval";;
9423 esac'
9424
9425 : see what type lseek is declared as in the kernel
9426 rp="What is the type used for lseek's offset on this system?"
9427 set off_t lseektype long stdio.h sys/types.h
9428 eval $typedef_ask
9429
9430 echo " "
9431 echo "Checking to see how big your file offsets are..." >&4
9432 $cat >try.c <<EOCP
9433 #include <sys/types.h>
9434 #include <stdio.h>
9435 int main()
9436 {
9437     printf("%d\n", (int)sizeof($lseektype));
9438     return(0);
9439 }
9440 EOCP
9441 set try
9442 if eval $compile_ok; then
9443         lseeksize=`$run ./try`
9444         echo "Your file offsets are $lseeksize bytes long."
9445 else
9446         dflt=$longsize
9447         echo " "
9448         echo "(I can't seem to compile the test program.  Guessing...)"
9449         rp="What is the size of your file offsets (in bytes)?"
9450         . ./myread
9451         lseeksize="$ans"
9452 fi
9453 $rm_try
9454
9455 : see what type file positions are declared as in the library
9456 rp="What is the type for file position used by fsetpos()?"
9457 set fpos_t fpostype long stdio.h sys/types.h
9458 eval $typedef_ask
9459
9460 : Check size for Fpos_t
9461 echo " "
9462 case "$fpostype" in
9463 *_t) zzz="$fpostype"    ;;
9464 *)   zzz="fpos_t"       ;;
9465 esac
9466 echo "Checking the size of $zzz..." >&4
9467 cat > try.c <<EOCP
9468 #include <sys/types.h>
9469 #include <stdio.h>
9470 #$i_stdlib I_STDLIB
9471 #ifdef I_STDLIB
9472 #include <stdlib.h>
9473 #endif
9474 int main() {
9475     printf("%d\n", (int)sizeof($fpostype));
9476     exit(0);
9477 }
9478 EOCP
9479 set try
9480 if eval $compile_ok; then
9481         yyy=`$run ./try`
9482         case "$yyy" in
9483         '')     fpossize=4
9484                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9485                 ;;
9486         *)      fpossize=$yyy
9487                 echo "Your $zzz is $fpossize bytes long."
9488                 ;;
9489         esac
9490 else
9491         dflt="$longsize"
9492         echo " " >&4
9493         echo "(I can't compile the test program.  Guessing...)" >&4
9494         rp="What is the size of your file positions (in bytes)?"
9495         . ./myread
9496         fpossize="$ans"
9497 fi
9498
9499 : Check for large file support
9500 # Backward compatibility (uselfs is deprecated).
9501 case "$uselfs" in
9502 "$define"|true|[yY]*)
9503         cat <<EOM >&4
9504
9505 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9506 EOM
9507         uselargefiles="$define"
9508         ;;
9509 esac
9510
9511 case "$lseeksize:$fpossize" in
9512 8:8) cat <<EOM
9513
9514 You can have files larger than 2 gigabytes.
9515 EOM
9516    val="$define" ;;
9517 *)    case "$uselargefiles" in
9518    "$undef"|false|[nN]*) dflt='n' ;;
9519    *)   dflt='y' ;;
9520    esac
9521    cat <<EOM
9522
9523 Perl can be built to understand large files (files larger than 2 gigabytes)
9524 on some systems.  To do so, Configure can be run with -Duselargefiles.
9525
9526 If this doesn't make any sense to you, just accept the default '$dflt'.
9527 EOM
9528    rp='Try to understand large files, if available?'
9529    . ./myread
9530    case "$ans" in
9531    y|Y)         val="$define" ;;
9532    *)           val="$undef"  ;;
9533    esac
9534    ;;
9535 esac
9536 set uselargefiles
9537 eval $setvar
9538 : Look for a hint-file generated 'call-back-unit'.  If the
9539 : user has specified that a large files perl is to be built,
9540 : we may need to set or change some other defaults.
9541 if $test -f uselargefiles.cbu; then
9542         echo "Your platform has some specific hints regarding large file builds, using them..."
9543         . ./uselargefiles.cbu
9544 fi
9545 case "$uselargefiles" in
9546 "$define")
9547         if $test -f uselargefiles.cbu; then
9548                 echo " "
9549                 echo "Rechecking to see how big your file offsets are..." >&4
9550                 $cat >try.c <<EOCP
9551 #include <sys/types.h>
9552 #include <stdio.h>
9553 int main()
9554 {
9555     printf("%d\n", (int)sizeof($lseektype));
9556     return(0);
9557 }
9558 EOCP
9559                 set try
9560                 if eval $compile_ok; then
9561                         lseeksize=`$run ./try`
9562                         $echo "Your file offsets are now $lseeksize bytes long."
9563                 else
9564                         dflt="$lseeksize"
9565                         echo " "
9566                         echo "(I can't seem to compile the test program.  Guessing...)"
9567                         rp="What is the size of your file offsets (in bytes)?"
9568                         . ./myread
9569                         lseeksize="$ans"
9570                 fi
9571                 case "$fpostype" in
9572                 *_t) zzz="$fpostype"    ;;
9573                 *)   zzz="fpos_t"       ;;
9574                 esac
9575                 $echo $n "Rechecking the size of $zzz...$c" >&4
9576                 $cat > try.c <<EOCP
9577 #include <sys/types.h>
9578 #include <stdio.h>
9579 #$i_stdlib I_STDLIB
9580 #ifdef I_STDLIB
9581 #include <stdlib.h>
9582 #endif
9583 int main() {
9584     printf("%d\n", (int)sizeof($fpostype));
9585     return(0);
9586 }
9587 EOCP
9588                 set try
9589                 if eval $compile_ok; then
9590                         yyy=`$run ./try`
9591                         dflt="$lseeksize"
9592                         case "$yyy" in
9593                         '')     echo " "
9594                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9595                                 ;;
9596                         *)      fpossize=$yyy
9597                                 echo " $fpossize bytes." >&4
9598                                 ;;
9599                         esac
9600                 else
9601                         dflt="$fpossize"
9602                         echo " "
9603                         echo "(I can't compile the test program.  Guessing...)" >&4
9604                         rp="What is the size of your file positions (in bytes)?"
9605                         . ./myread
9606                         fpossize="$ans"
9607                 fi
9608                 $rm_try
9609         fi
9610         ;;
9611 esac
9612
9613 : Check if we want perlio
9614 useperlio="$define"
9615
9616 : Set the vendorbin variables
9617 case "$vendorprefix" in
9618 '')     d_vendorbin="$undef"
9619         vendorbin=''
9620         vendorbinexp=''
9621         ;;
9622 *)      d_vendorbin="$define"
9623         : determine where vendor-supplied executables go.
9624         case "$vendorbin" in
9625         '') dflt=$vendorprefix/bin ;;
9626         *)      dflt="$vendorbin" ;;
9627         esac
9628         fn=d~+
9629         rp='Pathname for the vendor-supplied executables directory?'
9630         . ./getfile
9631         vendorbin="$ans"
9632         vendorbinexp="$ansexp"
9633         ;;
9634 esac
9635 prefixvar=vendorbin
9636 . ./installprefix
9637
9638 : Set the vendorhtml1dir variables
9639 case "$vendorprefix" in
9640 '')     vendorhtml1dir=''
9641         vendorhtml1direxp=''
9642         ;;
9643 *)      : determine where vendor-supplied html pages go.
9644         : There is no standard location, so try to copy the previously-selected
9645         : directory structure for the core html pages.
9646         : XXX Better default suggestions would be welcome.
9647         case "$vendorhtml1dir" in
9648         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9649         *)      dflt=$vendorhtml1dir ;;
9650         esac
9651         case "$dflt" in
9652         ''|' ') dflt=none ;;
9653         esac
9654         fn=dn+~
9655         rp='Pathname for the vendor-supplied html pages?'
9656         . ./getfile
9657         vendorhtml1dir="$ans"
9658         vendorhtml1direxp="$ansexp"
9659         ;;
9660 esac
9661 : Use ' ' for none so value is preserved next time through Configure
9662 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9663 prefixvar=vendorhtml1dir
9664 . ./installprefix
9665
9666 : Set the vendorhtml3dir variables
9667 case "$vendorprefix" in
9668 '')     vendorhtml3dir=''
9669         vendorhtml3direxp=''
9670         ;;
9671 *)      : determine where vendor-supplied module html pages go.
9672         : There is no standard location, so try to copy the previously-selected
9673         : directory structure for the core html pages.
9674         : XXX Better default suggestions would be welcome.
9675         case "$vendorhtml3dir" in
9676         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9677         *)      dflt=$vendorhtml3dir ;;
9678         esac
9679         case "$dflt" in
9680         ''|' ') dflt=none ;;
9681         esac
9682         fn=dn+~
9683         rp='Pathname for the vendor-supplied html pages?'
9684         . ./getfile
9685         vendorhtml3dir="$ans"
9686         vendorhtml3direxp="$ansexp"
9687         ;;
9688 esac
9689 : Use ' ' for none so value is preserved next time through Configure
9690 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9691 prefixvar=vendorhtml3dir
9692 . ./installprefix
9693
9694 : Set the vendorman1dir variables
9695 case "$vendorprefix" in
9696 '')     vendorman1dir=''
9697         vendorman1direxp=''
9698         ;;
9699 *)      : determine where vendor-supplied manual pages go.
9700         case "$vendorman1dir" in
9701         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9702         *)      dflt=$vendorman1dir ;;
9703         esac
9704         case "$dflt" in
9705         ''|' ') dflt=none ;;
9706         esac
9707         fn=nd~+
9708         rp='Pathname for the vendor-supplied manual section 1 pages?'
9709         . ./getfile
9710         vendorman1dir="$ans"
9711         vendorman1direxp="$ansexp"
9712         ;;
9713 esac
9714 : Use ' ' for none so value is preserved next time through Configure
9715 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9716 prefixvar=vendorman1dir
9717 . ./installprefix
9718
9719 : Set the vendorman3dir variables
9720 case "$vendorprefix" in
9721 '')     vendorman3dir=''
9722         vendorman3direxp=''
9723         ;;
9724 *)      : determine where vendor-supplied module manual pages go.
9725         case "$vendorman3dir" in
9726         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9727         *)      dflt=$vendorman3dir ;;
9728         esac
9729         case "$dflt" in
9730         ''|' ') dflt=none ;;
9731         esac
9732         fn=nd~+
9733         rp='Pathname for the vendor-supplied manual section 3 pages?'
9734         . ./getfile
9735         vendorman3dir="$ans"
9736         vendorman3direxp="$ansexp"
9737         ;;
9738 esac
9739 : Use ' ' for none so value is preserved next time through Configure
9740 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9741 prefixvar=vendorman3dir
9742 . ./installprefix
9743
9744 : Set the vendorscript variables
9745 case "$vendorprefix" in
9746 '')     d_vendorscript="$undef"
9747         vendorscript=''
9748         vendorscriptexp=''
9749         ;;
9750 *)      d_vendorscript="$define"
9751         : determine where vendor-supplied scripts go.
9752         case "$vendorscript" in
9753         '')     dflt=$vendorprefix/script
9754                 $test -d $dflt || dflt=$vendorbin ;;
9755         *)  dflt="$vendorscript" ;;
9756         esac
9757         $cat <<EOM
9758
9759 The installation process will create a directory for
9760 vendor-supplied scripts.
9761
9762 EOM
9763         fn=d~+
9764         rp='Pathname for the vendor-supplied scripts directory?'
9765         . ./getfile
9766         vendorscript="$ans"
9767         vendorscriptexp="$ansexp"
9768         ;;
9769 esac
9770 prefixvar=vendorscript
9771 . ./installprefix
9772
9773 : script used to emit important warnings
9774 cat >warn <<EOS
9775 $startsh
9776 if test \$# -gt 0; then
9777         echo "\$@" >msg
9778 else
9779         cat >msg
9780 fi
9781 echo "*** WARNING:" >&4
9782 sed -e 's/^/*** /' <msg >&4
9783 echo "*** " >&4
9784 cat msg >>config.msg
9785 echo " " >>config.msg
9786 rm -f msg
9787 EOS
9788 chmod +x warn
9789 $eunicefix warn
9790
9791 : see which of string.h or strings.h is needed
9792 echo " "
9793 strings=`./findhdr string.h`
9794 if $test "$strings" && $test -r "$strings"; then
9795         echo "Using <string.h> instead of <strings.h>." >&4
9796         val="$define"
9797 else
9798         val="$undef"
9799         strings=`./findhdr strings.h`
9800         if $test "$strings" && $test -r "$strings"; then
9801                 echo "Using <strings.h> instead of <string.h>." >&4
9802         else
9803                 ./warn "No string header found -- You'll surely have problems."
9804         fi
9805 fi
9806 set i_string
9807 eval $setvar
9808 case "$i_string" in
9809 "$undef") strings=`./findhdr strings.h`;;
9810 *)        strings=`./findhdr string.h`;;
9811 esac
9812
9813 : see if qgcvt exists
9814 set qgcvt d_qgcvt
9815 eval $inlibc
9816
9817 : Check print/scan long double stuff
9818 echo " "
9819
9820 if $test X"$d_longdbl" = X"$define"; then
9821
9822 echo "Checking how to print long doubles..." >&4
9823
9824 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9825         $cat >try.c <<'EOCP'
9826 #include <sys/types.h>
9827 #include <stdio.h>
9828 int main() {
9829   double d = 123.456;
9830   printf("%.3f\n", d);
9831 }
9832 EOCP
9833         set try
9834         if eval $compile; then
9835                 yyy=`$run ./try`
9836                 case "$yyy" in
9837                 123.456)
9838                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9839                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9840                         echo "We will use %f."
9841                         ;;
9842                 esac
9843         fi
9844 fi
9845
9846 if $test X"$sPRIfldbl" = X; then
9847         $cat >try.c <<'EOCP'
9848 #include <sys/types.h>
9849 #include <stdio.h>
9850 int main() {
9851   long double d = 123.456;
9852   printf("%.3Lf\n", d);
9853 }
9854 EOCP
9855         set try
9856         if eval $compile; then
9857                 yyy=`$run ./try`
9858                 case "$yyy" in
9859                 123.456)
9860                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9861                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9862                         echo "We will use %Lf."
9863                         ;;
9864                 esac
9865         fi
9866 fi
9867
9868 if $test X"$sPRIfldbl" = X; then
9869         $cat >try.c <<'EOCP'
9870 #include <sys/types.h>
9871 #include <stdio.h>
9872 int main() {
9873   long double d = 123.456;
9874   printf("%.3llf\n", d);
9875 }
9876 EOCP
9877         set try
9878         if eval $compile; then
9879                 yyy=`$run ./try`
9880                 case "$yyy" in
9881                 123.456)
9882                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9883                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9884                         echo "We will use %llf."
9885                         ;;
9886                 esac
9887         fi
9888 fi
9889
9890 if $test X"$sPRIfldbl" = X; then
9891         $cat >try.c <<'EOCP'
9892 #include <sys/types.h>
9893 #include <stdio.h>
9894 int main() {
9895   long double d = 123.456;
9896   printf("%.3lf\n", d);
9897 }
9898 EOCP
9899         set try
9900         if eval $compile; then
9901                 yyy=`$run ./try`
9902                 case "$yyy" in
9903                 123.456)
9904                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9905                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9906                         echo "We will use %lf."
9907                         ;;
9908                 esac
9909         fi
9910 fi
9911
9912 if $test X"$sPRIfldbl" = X; then
9913         echo "Cannot figure out how to print long doubles." >&4
9914 else
9915         sSCNfldbl=$sPRIfldbl    # expect consistency
9916 fi
9917
9918 $rm_try
9919
9920 fi # d_longdbl
9921
9922 case "$sPRIfldbl" in
9923 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9924         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9925         d_SCNfldbl="$undef";
9926         ;;
9927 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9928         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9929         d_SCNfldbl="$define";
9930         ;;
9931 esac
9932
9933 : Check how to convert floats to strings.
9934
9935 if test "X$d_Gconvert" = X; then
9936
9937 echo " "
9938 echo "Checking for an efficient way to convert floats to strings."
9939 echo " " > try.c
9940 case "$uselongdouble" in
9941 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9942 esac
9943 case "$d_longdbl" in
9944 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9945 esac
9946 case "$d_PRIgldbl" in
9947 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9948 esac
9949 $cat >>try.c <<EOP
9950 #ifdef TRY_gconvert
9951 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9952 char *myname = "gconvert";
9953 #endif
9954 #ifdef TRY_gcvt
9955 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9956 char *myname = "gcvt";
9957 #endif
9958 #ifdef TRY_qgcvt
9959 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9960 char *myname = "qgcvt";
9961 #define DOUBLETYPE long double
9962 #endif
9963 #ifdef TRY_sprintf
9964 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9965 #ifdef HAS_PRIgldbl
9966 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9967 #else
9968 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9969 #endif
9970 #else
9971 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9972 #endif
9973 char *myname = "sprintf";
9974 #endif
9975
9976 #ifndef DOUBLETYPE
9977 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9978 #define DOUBLETYPE long double
9979 #else
9980 #define DOUBLETYPE double
9981 #endif
9982 #endif
9983
9984 #include <stdio.h>
9985
9986 #$i_stdlib I_STDLIB
9987 #ifdef I_STDLIB
9988 #include <stdlib.h>
9989 #endif
9990 #$i_string I_STRING
9991 #ifdef I_STRING
9992 #  include <string.h>
9993 #else
9994 #  include <strings.h>
9995 #endif
9996
9997 int checkit(char *expect, char *got)
9998 {
9999     if (strcmp(expect, got)) {
10000                 printf("%s oddity:  Expected %s, got %s\n",
10001                         myname, expect, got);
10002                 exit(1);
10003         }
10004 }
10005
10006 int main()
10007 {
10008         char buf[64];
10009         buf[63] = '\0';
10010
10011         /* This must be 1st test on (which?) platform */
10012         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10013         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10014         checkit("0.1", buf);
10015
10016         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10017         checkit("0.01", buf);
10018
10019         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10020         checkit("0.001", buf);
10021
10022         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10023         checkit("0.0001", buf);
10024
10025         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10026         if (strlen(buf) > 5)
10027             checkit("9e-005", buf); /* for Microsoft ?? */
10028         else
10029             checkit("9e-05", buf);
10030
10031         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10032         checkit("1", buf);
10033
10034         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10035         checkit("1.1", buf);
10036
10037         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10038         checkit("1.01", buf);
10039
10040         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10041         checkit("1.001", buf);
10042
10043         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10044         checkit("1.0001", buf);
10045
10046         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10047         checkit("1.00001", buf);
10048
10049         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10050         checkit("1.000001", buf);
10051
10052         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10053         checkit("0", buf);
10054
10055         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10056         checkit("-1", buf);
10057
10058         /* Some Linux gcvt's give 1.e+5 here. */
10059         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10060         checkit("100000", buf);
10061
10062         /* Some Linux gcvt's give -1.e+5 here. */
10063         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10064         checkit("-100000", buf);
10065
10066         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10067         checkit("123.456", buf);
10068
10069         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10070         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10071         /* 34 should be enough to scare even long double
10072          * places into using the e notation. */
10073         if (strlen(buf) > 5)
10074             checkit("1e+034", buf); /* for Microsoft */
10075         else
10076             checkit("1e+34", buf);
10077
10078         /* For Perl, if you add additional tests here, also add them to
10079          * t/base/num.t for benefit of platforms not using Configure or
10080          * overriding d_Gconvert */
10081
10082         exit(0);
10083 }
10084 EOP
10085 : first add preferred functions to our list
10086 xxx_list=""
10087 for xxx_convert in $gconvert_preference; do
10088     case $xxx_convert in
10089     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10090     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10091     esac
10092 done
10093 : then add any others
10094 for xxx_convert in gconvert gcvt sprintf; do
10095     case "$xxx_list" in
10096     *$xxx_convert*) ;;
10097     *) xxx_list="$xxx_list $xxx_convert" ;;
10098     esac
10099 done
10100
10101 case "$d_longdbl$uselongdouble" in
10102 "$define$define")
10103     : again, add preferred functions to our list first
10104     xxx_ld_list=""
10105     for xxx_convert in $gconvert_ld_preference; do
10106         case $xxx_convert in
10107         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10108         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10109         esac
10110     done
10111     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10112     for xxx_convert in qgcvt sprintf $xxx_list; do
10113         case "$xxx_ld_list" in
10114         $xxx_convert*|*" $xxx_convert"*) ;;
10115         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10116         esac
10117     done
10118     : if sprintf cannot do long doubles, move it to the end
10119     if test "$d_PRIgldbl" != "$define"; then
10120         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10121     fi
10122     : if no qgcvt, remove it
10123     if test "$d_qgcvt" != "$define"; then
10124         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10125     fi
10126     : use the ld_list
10127     xxx_list="$xxx_ld_list"
10128     ;;
10129 esac
10130
10131 for xxx_convert in $xxx_list; do
10132         echo "Trying $xxx_convert..."
10133         $rm -f try try$_o core
10134         set try -DTRY_$xxx_convert
10135         if eval $compile; then
10136                 echo "$xxx_convert() found." >&4
10137                 if $run ./try; then
10138                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10139                         break;
10140                 else
10141                         echo "...But $xxx_convert didn't work as I expected."
10142                         xxx_convert=''
10143                 fi
10144         else
10145                 echo "$xxx_convert NOT found." >&4
10146         fi
10147 done
10148
10149 if test X$xxx_convert = X; then
10150     echo "*** WHOA THERE!!! ***" >&4
10151     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10152     xxx_convert=sprintf
10153 fi
10154
10155 case "$xxx_convert" in
10156 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10157 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10158 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10159 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10160    "$define$define$define")
10161       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10162    "$define$define$undef")
10163       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10164    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10165    esac
10166    ;;
10167 esac
10168
10169 fi
10170 $rm_try
10171
10172 : see if _fwalk exists
10173 set fwalk d__fwalk
10174 eval $inlibc
10175
10176 : Initialize h_fcntl
10177 h_fcntl=false
10178
10179 : Initialize h_sysfile
10180 h_sysfile=false
10181
10182 : access call always available on UNIX
10183 set access d_access
10184 eval $inlibc
10185
10186 : locate the flags for 'access()'
10187 case "$d_access" in
10188 "$define")
10189         echo " "
10190         $cat >access.c <<EOCP
10191 #include <sys/types.h>
10192 #ifdef I_FCNTL
10193 #include <fcntl.h>
10194 #endif
10195 #ifdef I_SYS_FILE
10196 #include <sys/file.h>
10197 #endif
10198 #ifdef I_UNISTD
10199 #include <unistd.h>
10200 #endif
10201 #$i_stdlib I_STDLIB
10202 #ifdef I_STDLIB
10203 #include <stdlib.h>
10204 #endif
10205 int main() {
10206         exit(R_OK);
10207 }
10208 EOCP
10209         : check sys/file.h first, no particular reason here
10210         if $test `./findhdr sys/file.h` && \
10211                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10212                 h_sysfile=true;
10213                 echo "<sys/file.h> defines the *_OK access constants." >&4
10214         elif $test `./findhdr fcntl.h` && \
10215                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10216                 h_fcntl=true;
10217                 echo "<fcntl.h> defines the *_OK access constants." >&4
10218         elif $test `./findhdr unistd.h` && \
10219                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10220                 echo "<unistd.h> defines the *_OK access constants." >&4
10221         else
10222                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10223         fi
10224         ;;
10225 esac
10226 $rm -f access*
10227
10228 : see if accessx exists
10229 set accessx d_accessx
10230 eval $inlibc
10231
10232 : see if aintl exists
10233 set aintl d_aintl
10234 eval $inlibc
10235
10236 : see if alarm exists
10237 set alarm d_alarm
10238 eval $inlibc
10239
10240 : see if 64bit time functions exists
10241
10242 set ctime64 d_ctime64
10243 eval $inlibc
10244
10245 set localtime64 d_localtime64
10246 eval $inlibc
10247
10248 set gmtime64 d_gmtime64
10249 eval $inlibc
10250
10251 set mktime64 d_mktime64
10252 eval $inlibc
10253
10254 set difftime64 d_difftime64
10255 eval $inlibc
10256
10257 set asctime64 d_asctime64
10258 eval $inlibc
10259
10260 : see if POSIX threads are available
10261 set pthread.h i_pthread
10262 eval $inhdr
10263
10264 : define a function to check prototypes
10265 $cat > protochk <<EOSH
10266 $startsh
10267 cc="$cc"
10268 optimize="$optimize"
10269 ccflags="$ccflags"
10270 prototype="$prototype"
10271 define="$define"
10272 rm_try="$rm_try"
10273 usethreads=$usethreads
10274 i_pthread=$i_pthread
10275 pthread_h_first=$pthread_h_first
10276 EOSH
10277
10278 $cat >> protochk <<'EOSH'
10279
10280 $rm_try
10281 foo="$1"
10282 shift
10283 while test $# -ge 2; do
10284         case "$1" in
10285                 $define) echo "#include <$2>" >> try.c ;;
10286                 literal) echo "$2" >> try.c ;;
10287         esac
10288     # Extra magic for the benefit of systems that need pthread.h
10289     # to be included early to correctly detect threadsafe functions.
10290     # Such functions must guarantee themselves, though, that the usethreads
10291     # and i_pthread have been defined, before calling protochk.
10292     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10293         echo "#include <pthread.h>" >> try.c
10294         pthread_h_done=yes
10295     fi
10296     shift 2
10297 done
10298 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10299 cat >> try.c <<'EOCP'
10300 #ifdef CAN_PROTOTYPE
10301 #define _(args) args
10302 #else
10303 #define _(args) ()
10304 #endif
10305 EOCP
10306 echo "$foo" >> try.c
10307 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10308 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10309 status=$?
10310 $rm_try
10311 exit $status
10312 EOSH
10313 chmod +x protochk
10314 $eunicefix protochk
10315
10316 : Define hasproto macro for Configure internal use
10317 hasproto='varname=$1; func=$2; shift; shift;
10318 while $test $# -ge 2; do
10319         case "$1" in
10320         $define) echo "#include <$2>";;
10321         esac ;
10322     shift 2;
10323 done > try.c;
10324 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10325 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10326         echo "$func() prototype found.";
10327         val="$define";
10328 else
10329         echo "$func() prototype NOT found.";
10330         val="$undef";
10331 fi;
10332 set $varname;
10333 eval $setvar;
10334 $rm_try tryout.c'
10335
10336 : see if sys/types.h has to be included
10337 set sys/types.h i_systypes
10338 eval $inhdr
10339
10340 : see if sys/select.h has to be included
10341 set sys/select.h i_sysselct
10342 eval $inhdr
10343
10344 : Define hasfield macro for Configure internal use
10345 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10346 while $test $# -ge 2; do
10347         case "$1" in
10348         $define) echo "#include <$2>";;
10349         esac ;
10350     shift 2;
10351 done > try.c;
10352 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10353 set try;
10354 if eval $compile; then
10355         val="$define";
10356 else
10357         val="$undef";
10358 fi;
10359 set $varname;
10360 eval $setvar;
10361 $rm_try'
10362
10363 : see if we should include time.h, sys/time.h, or both
10364 echo " "
10365 if test "X$timeincl" = X; then
10366         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10367         $echo $n "I'm now running the test program...$c"
10368         $cat >try.c <<EOCP
10369 #include <sys/types.h>
10370 #ifdef I_TIME
10371 #include <time.h>
10372 #endif
10373 #ifdef I_SYSTIME
10374 #ifdef SYSTIMEKERNEL
10375 #define KERNEL
10376 #endif
10377 #include <sys/time.h>
10378 #endif
10379 #ifdef I_SYSSELECT
10380 #include <sys/select.h>
10381 #endif
10382 #$i_stdlib I_STDLIB
10383 #ifdef I_STDLIB
10384 #include <stdlib.h>
10385 #endif
10386 int main()
10387 {
10388         struct tm foo;
10389 #ifdef S_TIMEVAL
10390         struct timeval bar;
10391 #endif
10392 #ifdef S_TIMEZONE
10393         struct timezone tzp;
10394 #endif
10395         if (foo.tm_sec == foo.tm_sec)
10396                 exit(0);
10397 #ifdef S_TIMEVAL
10398         if (bar.tv_sec == bar.tv_sec)
10399                 exit(0);
10400 #endif
10401         exit(1);
10402 }
10403 EOCP
10404         flags=''
10405         for s_timezone in '-DS_TIMEZONE' ''; do
10406         sysselect=''
10407         for s_timeval in '-DS_TIMEVAL' ''; do
10408         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10409         for i_time in '' '-DI_TIME'; do
10410         for i_systime in '-DI_SYSTIME' ''; do
10411                 case "$flags" in
10412                 '') $echo $n ".$c"
10413                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10414                         if eval $compile; then
10415                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10416                                 shift
10417                                 flags="$*"
10418                                 echo " "
10419                                 $echo $n "Succeeded with $flags$c"
10420                         fi
10421                         ;;
10422                 esac
10423         done
10424         done
10425         done
10426         done
10427         done
10428         timeincl=''
10429         echo " "
10430         case "$flags" in
10431         *SYSTIMEKERNEL*) i_systimek="$define"
10432                 timeincl=`./findhdr sys/time.h`
10433                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10434         *) i_systimek="$undef";;
10435         esac
10436         case "$flags" in
10437         *I_TIME*) i_time="$define"
10438                 timeincl=`./findhdr time.h`" $timeincl"
10439                 echo "We'll include <time.h>." >&4;;
10440         *) i_time="$undef";;
10441         esac
10442         case "$flags" in
10443         *I_SYSTIME*) i_systime="$define"
10444                 timeincl=`./findhdr sys/time.h`" $timeincl"
10445                 echo "We'll include <sys/time.h>." >&4;;
10446         *) i_systime="$undef";;
10447         esac
10448         $rm_try
10449 fi
10450 : see if struct tm knows about tm_zone
10451 case "$i_systime$i_time" in
10452 *$define*)
10453         echo " "
10454         echo "Checking to see if your struct tm has tm_zone field..." >&4
10455         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10456         eval $hasfield
10457         ;;
10458 *)      val="$undef"
10459         set d_tm_tm_zone
10460         eval $setvar
10461         ;;
10462 esac
10463 case "$d_tm_tm_zone" in
10464 "$define")      echo "Yes, it does."   ;;
10465 *)              echo "No, it doesn't." ;;
10466 esac
10467 : see if struct tm knows about tm_gmtoff
10468 case "$i_systime$i_time" in
10469 *$define*)
10470         echo " "
10471         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10472         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10473         eval $hasfield
10474         ;;
10475 *)      val="$undef"
10476         set d_tm_tm_gmtoff
10477         eval $setvar
10478         ;;
10479 esac
10480 case "$d_tm_tm_gmtoff" in
10481 "$define")      echo "Yes, it does."   ;;
10482 *)              echo "No, it doesn't." ;;
10483 esac
10484
10485 : see if asctime_r exists
10486 set asctime_r d_asctime_r
10487 eval $inlibc
10488 case "$d_asctime_r" in
10489 "$define")
10490         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10491         case "$d_asctime_r_proto:$usethreads" in
10492         ":define")      d_asctime_r_proto=define
10493                 set d_asctime_r_proto asctime_r $hdrs
10494                 eval $hasproto ;;
10495         *)      ;;
10496         esac
10497         case "$d_asctime_r_proto" in
10498         define)
10499         case "$asctime_r_proto" in
10500         ''|0) try='char* asctime_r(const struct tm*, char*);'
10501         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10502         esac
10503         case "$asctime_r_proto" in
10504         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10505         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10506         esac
10507         case "$asctime_r_proto" in
10508         ''|0) try='int asctime_r(const struct tm*, char*);'
10509         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10510         esac
10511         case "$asctime_r_proto" in
10512         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10513         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10514         esac
10515         case "$asctime_r_proto" in
10516         ''|0)   d_asctime_r=undef
10517                 asctime_r_proto=0
10518                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10519         * )     case "$asctime_r_proto" in
10520                 REENTRANT_PROTO*) ;;
10521                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10522                 esac
10523                 echo "Prototype: $try" ;;
10524         esac
10525         ;;
10526         *)      case "$usethreads" in
10527                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10528                 esac
10529                 d_asctime_r=undef
10530                 asctime_r_proto=0
10531                 ;;
10532         esac
10533         ;;
10534 *)      asctime_r_proto=0
10535         ;;
10536 esac
10537
10538 : see if atolf exists
10539 set atolf d_atolf
10540 eval $inlibc
10541
10542 : see if atoll exists
10543 set atoll d_atoll
10544 eval $inlibc
10545
10546 : Look for GCC-style attribute format
10547 case "$d_attribute_format" in
10548 '')
10549 echo " "
10550 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10551 $cat >attrib.c <<'EOCP'
10552 #include <stdio.h>
10553 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10554 EOCP
10555 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10556         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10557                 echo "Your C compiler doesn't support __attribute__((format))."
10558                 val="$undef"
10559         else
10560                 echo "Your C compiler supports __attribute__((format))."
10561                 val="$define"
10562         fi
10563 else
10564         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10565         val="$undef"
10566 fi
10567 ;;
10568 *) val="$d_attribute_format" ;;
10569 esac
10570 set d_attribute_format
10571 eval $setvar
10572 $rm -f attrib*
10573
10574 : Look for GCC-style attribute format with null format allowed
10575 case "$d_printf_format_null" in
10576 '') case "$d_attribute_format" in
10577     $define)
10578         echo " "
10579         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10580 $cat >attrib.c <<EOCP
10581 #include <stdio.h>
10582 #$i_stdlib I_STDLIB
10583 #ifdef I_STDLIB
10584 #include <stdlib.h>
10585 #endif
10586 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10587 int null_printf (char* pat,...) { return (int)pat; }
10588 int main () { exit(null_printf(NULL)); }
10589 EOCP
10590         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10591             : run the executable in case it produces a run-time warning
10592             if $run ./attrib >>attrib.out 2>&1; then
10593                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10594                     echo "Your C compiler doesn't allow __printf__ format to be null."
10595                     val="$undef"
10596                 else
10597                     echo "Your C compiler allows __printf__ format to be null."
10598                     val="$define"
10599                 fi
10600             else
10601             echo "Your C compiler executable failed with __printf__ format null."
10602             val="$undef"
10603         fi
10604     else
10605         echo "Your C compiler fails with __printf__ format null."
10606         val="$undef"
10607     fi
10608     ;;
10609     *)  val="$undef" ;;
10610     esac
10611 ;;
10612 *)  val="$d_printf_format_null" ;;
10613 esac
10614 set d_printf_format_null
10615 eval $setvar
10616 $rm -f attrib*
10617
10618 : Look for GCC-style attribute malloc
10619 case "$d_attribute_malloc" in
10620 '')
10621 echo " "
10622 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10623 $cat >attrib.c <<'EOCP'
10624 #include <stdio.h>
10625 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10626 EOCP
10627 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10628         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10629                 echo "Your C compiler doesn't support __attribute__((malloc))."
10630                 val="$undef"
10631         else
10632                 echo "Your C compiler supports __attribute__((malloc))."
10633                 val="$define"
10634         fi
10635 else
10636         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10637         val="$undef"
10638 fi
10639 ;;
10640 *) val="$d_attribute_malloc" ;;
10641 esac
10642 set d_attribute_malloc
10643 eval $setvar
10644 $rm -f attrib*
10645
10646 : Look for GCC-style attribute nonnull
10647 case "$d_attribute_nonnull" in
10648 '')
10649 echo " "
10650 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10651 $cat >attrib.c <<'EOCP'
10652 #include <stdio.h>
10653 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10654 EOCP
10655 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10656         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10657                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10658                 val="$undef"
10659         else
10660                 echo "Your C compiler supports __attribute__((nonnull))."
10661                 val="$define"
10662         fi
10663 else
10664         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10665         val="$undef"
10666 fi
10667 ;;
10668 *) val="$d_attribute_nonnull" ;;
10669 esac
10670 set d_attribute_nonnull
10671 eval $setvar
10672 $rm -f attrib*
10673
10674 : Look for GCC-style attribute noreturn
10675 case "$d_attribute_noreturn" in
10676 '')
10677 echo " "
10678 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10679 $cat >attrib.c <<'EOCP'
10680 #include <stdio.h>
10681 void fall_over_dead( void ) __attribute__((noreturn));
10682 EOCP
10683 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10684         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10685                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10686                 val="$undef"
10687         else
10688                 echo "Your C compiler supports __attribute__((noreturn))."
10689                 val="$define"
10690         fi
10691 else
10692         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10693         val="$undef"
10694 fi
10695 ;;
10696 *) val="$d_attribute_noreturn" ;;
10697 esac
10698 set d_attribute_noreturn
10699 eval $setvar
10700 $rm -f attrib*
10701
10702 : Look for GCC-style attribute pure
10703 case "$d_attribute_pure" in
10704 '')
10705 echo " "
10706 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10707 $cat >attrib.c <<'EOCP'
10708 #include <stdio.h>
10709 int square( int n ) __attribute__((pure));
10710 EOCP
10711 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10712         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10713                 echo "Your C compiler doesn't support __attribute__((pure))."
10714                 val="$undef"
10715         else
10716                 echo "Your C compiler supports __attribute__((pure))."
10717                 val="$define"
10718         fi
10719 else
10720         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10721         val="$undef"
10722 fi
10723 ;;
10724 *) val="$d_attribute_pure" ;;
10725 esac
10726 set d_attribute_pure
10727 eval $setvar
10728 $rm -f attrib*
10729
10730 : Look for GCC-style attribute unused
10731 case "$d_attribute_unused" in
10732 '')
10733 echo " "
10734 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10735 $cat >attrib.c <<'EOCP'
10736 #include <stdio.h>
10737 int do_something( int dummy __attribute__((unused)), int n );
10738 EOCP
10739 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10740         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10741                 echo "Your C compiler doesn't support __attribute__((unused))."
10742                 val="$undef"
10743         else
10744                 echo "Your C compiler supports __attribute__((unused))."
10745                 val="$define"
10746         fi
10747 else
10748         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10749         val="$undef"
10750 fi
10751 ;;
10752 *) val="$d_attribute_unused" ;;
10753 esac
10754 set d_attribute_unused
10755 eval $setvar
10756 $rm -f attrib*
10757
10758 : Look for GCC-style attribute deprecated
10759 case "$d_attribute_deprecated" in
10760 '')
10761 echo " "
10762 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10763 $cat >attrib.c <<'EOCP'
10764 #include <stdio.h>
10765 int I_am_deprecated(void) __attribute__((deprecated));
10766 EOCP
10767 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10768         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10769                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10770                 val="$undef"
10771         else
10772                 echo "Your C compiler supports __attribute__((deprecated))."
10773                 val="$define"
10774         fi
10775 else
10776         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10777         val="$undef"
10778 fi
10779 ;;
10780 *) val="$d_attribute_deprecated" ;;
10781 esac
10782 set d_attribute_deprecated
10783 eval $setvar
10784 $rm -f attrib*
10785
10786 : Look for GCC-style attribute warn_unused_result
10787 case "$d_attribute_warn_unused_result" in
10788 '')
10789 echo " "
10790 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10791 $cat >attrib.c <<'EOCP'
10792 #include <stdio.h>
10793 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10794 EOCP
10795 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10796         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10797                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10798                 val="$undef"
10799         else
10800                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10801                 val="$define"
10802         fi
10803 else
10804         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10805         val="$undef"
10806 fi
10807 ;;
10808 *) val="$d_attribute_warn_unused_result" ;;
10809 esac
10810 set d_attribute_warn_unused_result
10811 eval $setvar
10812 $rm -f attrib*
10813
10814 : see if bcmp exists
10815 set bcmp d_bcmp
10816 eval $inlibc
10817
10818 : see if bcopy exists
10819 set bcopy d_bcopy
10820 eval $inlibc
10821
10822 : see if getpgrp exists
10823 set getpgrp d_getpgrp
10824 eval $inlibc
10825
10826 case "$d_getpgrp" in
10827 "$define")
10828         echo " "
10829         echo "Checking to see which flavor of getpgrp is in use..."
10830         $cat >try.c <<EOP
10831 #$i_unistd I_UNISTD
10832 #include <sys/types.h>
10833 #ifdef I_UNISTD
10834 #  include <unistd.h>
10835 #endif
10836 #$i_stdlib I_STDLIB
10837 #ifdef I_STDLIB
10838 #include <stdlib.h>
10839 #endif
10840 int main()
10841 {
10842         if (getuid() == 0) {
10843                 printf("(I see you are running Configure as super-user...)\n");
10844                 setuid(1);
10845         }
10846 #ifdef TRY_BSD_PGRP
10847         if (getpgrp(1) == 0)
10848                 exit(0);
10849 #else
10850         if (getpgrp() > 0)
10851                 exit(0);
10852 #endif
10853         exit(1);
10854 }
10855 EOP
10856         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10857                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10858                 val="$define"
10859         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10860                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10861                 val="$undef"
10862         else
10863                 echo "I can't seem to compile and run the test program."
10864                 if ./usg; then
10865                         xxx="a USG one, i.e. you use getpgrp()."
10866                 else
10867                         # SVR4 systems can appear rather BSD-ish.
10868                         case "$i_unistd" in
10869                         $undef)
10870                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10871                                 val="$define"
10872                                 ;;
10873                         $define)
10874                                 xxx="probably a USG one, i.e. you use getpgrp()."
10875                                 val="$undef"
10876                                 ;;
10877                         esac
10878                 fi
10879                 echo "Assuming your getpgrp is $xxx" >&4
10880         fi
10881         ;;
10882 *) val="$undef";;
10883 esac
10884 set d_bsdgetpgrp
10885 eval $setvar
10886 $rm_try
10887
10888 : see if setpgrp exists
10889 set setpgrp d_setpgrp
10890 eval $inlibc
10891
10892 case "$d_setpgrp" in
10893 "$define")
10894         echo " "
10895         echo "Checking to see which flavor of setpgrp is in use..."
10896         $cat >try.c <<EOP
10897 #$i_unistd I_UNISTD
10898 #include <sys/types.h>
10899 #ifdef I_UNISTD
10900 #  include <unistd.h>
10901 #endif
10902 #$i_stdlib I_STDLIB
10903 #ifdef I_STDLIB
10904 #include <stdlib.h>
10905 #endif
10906 int main()
10907 {
10908         if (getuid() == 0) {
10909                 printf("(I see you are running Configure as super-user...)\n");
10910                 setuid(1);
10911         }
10912 #ifdef TRY_BSD_PGRP
10913         if (-1 == setpgrp(1, 1))
10914                 exit(0);
10915 #else
10916         if (setpgrp() != -1)
10917                 exit(0);
10918 #endif
10919         exit(1);
10920 }
10921 EOP
10922         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10923                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10924                 val="$define"
10925         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10926                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10927                 val="$undef"
10928         else
10929                 echo "(I can't seem to compile and run the test program.)"
10930                 if ./usg; then
10931                         xxx="a USG one, i.e. you use setpgrp()."
10932                 else
10933                         # SVR4 systems can appear rather BSD-ish.
10934                         case "$i_unistd" in
10935                         $undef)
10936                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10937                                 val="$define"
10938                                 ;;
10939                         $define)
10940                                 xxx="probably a USG one, i.e. you use setpgrp()."
10941                                 val="$undef"
10942                                 ;;
10943                         esac
10944                 fi
10945                 echo "Assuming your setpgrp is $xxx" >&4
10946         fi
10947         ;;
10948 *) val="$undef";;
10949 esac
10950 set d_bsdsetpgrp
10951 eval $setvar
10952 $rm_try
10953
10954 : Look for GCC-style __builtin_choose_expr
10955 case "$d_builtin_choose_expr" in
10956 '')
10957     echo " "
10958     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10959     $cat >try.c <<'EOCP'
10960 #include <assert.h>
10961 #include <stdlib.h>
10962 #include <stdio.h>
10963
10964 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10965
10966 int main(void) {
10967     assert( SYRINX(1) == 2112 );
10968     assert( SYRINX(1) != 5150 );
10969     assert( SYRINX(0) == 5150 );
10970     assert( SYRINX(0) != 2112 );
10971     puts( "All good!" );
10972     exit(0);
10973 }
10974
10975 EOCP
10976     set try
10977     if eval $compile && $run ./try; then
10978         echo "Your C compiler supports __builtin_choose_expr."
10979         val="$define"
10980     else
10981         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10982         val="$undef"
10983     fi
10984 ;;
10985 *) val="$d_builtin_choose_expr" ;;
10986 esac
10987
10988 set d_builtin_choose_expr
10989 eval $setvar
10990 $rm_try
10991
10992 : Look for GCC-style __builtin_expect
10993 case "$d_builtin_expect" in
10994 '')
10995     echo " "
10996     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10997     $cat >try.c <<'EOCP'
10998 int main(void) {
10999     int n = 50;
11000     if ( __builtin_expect(n, 0) ) n = 1;
11001     /* Remember shell exit code truth is 0, C truth is non-zero */
11002     return !(n == 1);
11003 }
11004 EOCP
11005     set try
11006     if eval $compile && $run ./try; then
11007         echo "Your C compiler supports __builtin_expect."
11008         val="$define"
11009     else
11010         echo "Your C compiler doesn't seem to understand __builtin_expect."
11011         val="$undef"
11012     fi
11013     ;;
11014 *) val="$d_builtin_expect" ;;
11015 esac
11016
11017 set d_builtin_expect
11018 eval $setvar
11019 $rm_try
11020
11021 : see if bzero exists
11022 set bzero d_bzero
11023 eval $inlibc
11024
11025 : see if stdarg is available
11026 echo " "
11027 if $test `./findhdr stdarg.h`; then
11028         echo "<stdarg.h> found." >&4
11029         valstd="$define"
11030 else
11031         echo "<stdarg.h> NOT found." >&4
11032         valstd="$undef"
11033 fi
11034
11035 : see if varargs is available
11036 echo " "
11037 if $test `./findhdr varargs.h`; then
11038         echo "<varargs.h> found." >&4
11039 else
11040         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11041 fi
11042
11043 : set up the varargs testing programs
11044 $cat > varargs.c <<EOP
11045 #ifdef I_STDARG
11046 #include <stdarg.h>
11047 #endif
11048 #ifdef I_VARARGS
11049 #include <varargs.h>
11050 #endif
11051
11052 #ifdef I_STDARG
11053 int f(char *p, ...)
11054 #else
11055 int f(va_alist)
11056 va_dcl
11057 #endif
11058 {
11059         va_list ap;
11060 #ifndef I_STDARG
11061         char *p;
11062 #endif
11063 #ifdef I_STDARG
11064         va_start(ap,p);
11065 #else
11066         va_start(ap);
11067         p = va_arg(ap, char *);
11068 #endif
11069         va_end(ap);
11070         return 0;
11071 }
11072 EOP
11073 $cat > varargs <<EOP
11074 $startsh
11075 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11076         echo "true"
11077 else
11078         echo "false"
11079 fi
11080 $rm -f varargs$_o
11081 EOP
11082 chmod +x varargs
11083
11084 : now check which varargs header should be included
11085 echo " "
11086 i_varhdr=''
11087 val=''
11088 case "$valstd" in
11089 "$define")
11090         if `./varargs I_STDARG`; then
11091                 val='stdarg.h'
11092         elif `./varargs I_VARARGS`; then
11093                 val='varargs.h'
11094         fi
11095         ;;
11096 *)
11097         if `./varargs I_VARARGS`; then
11098                 val='varargs.h'
11099         fi
11100         ;;
11101 esac
11102 case "$val" in
11103 '')
11104         echo " "
11105         echo "*** WHOA THERE!!! ***" >&4
11106         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11107         case "$knowitall" in
11108         '')
11109         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11110                 exit 1
11111                 ;;
11112         esac
11113 echo "I could not find the definition for va_dcl... You have problems..." >&4
11114         val="$undef"; set i_stdarg; eval $setvar
11115         val="$undef"; set i_varargs; eval $setvar
11116         ;;
11117 *)
11118         set i_varhdr
11119         eval $setvar
11120         case "$i_varhdr" in
11121         stdarg.h)
11122                 val="$define"; set i_stdarg; eval $setvar
11123                 val="$undef"; set i_varargs; eval $setvar
11124                 ;;
11125         varargs.h)
11126                 val="$undef"; set i_stdarg; eval $setvar
11127                 val="$define"; set i_varargs; eval $setvar
11128                 ;;
11129         esac
11130         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11131 esac
11132 $rm -f varargs*
11133
11134 : see if the Compiler supports C99 variadic macros
11135 case "$i_stdarg$i_stdlib" in
11136     "$define$define")
11137     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11138     $cat >try.c <<EOCP
11139 #include <stdio.h>
11140 #include <stdarg.h>
11141
11142 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11143
11144 int main() {
11145   char buf[20];
11146   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11147   puts(buf);
11148   return 0;
11149 }
11150 EOCP
11151     set try
11152     if eval $compile && $run ./try 2>&1 >/dev/null; then
11153         case "`$run ./try`" in
11154             "123 456 789")
11155             echo "You have C99 variadic macros." >&4
11156             d_c99_variadic_macros="$define"
11157             ;;
11158             *)
11159             echo "You don't have functional C99 variadic macros." >&4
11160             d_c99_variadic_macros="$undef"
11161             ;;
11162         esac
11163     else
11164         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11165         d_c99_variadic_macros="$undef"
11166     fi
11167     $rm_try
11168     ;;
11169     *)
11170     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11171     d_c99_variadic_macros="$undef"
11172     ;;
11173 esac
11174
11175 : see if signal is declared as pointer to function returning int or void
11176 echo " "
11177 xxx=`./findhdr signal.h`
11178 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11179 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11180         echo "You have int (*signal())() instead of void." >&4
11181         val="$undef"
11182 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11183         echo "You have void (*signal())()." >&4
11184         val="$define"
11185 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11186         echo "You have int (*signal())() instead of void." >&4
11187         val="$undef"
11188 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11189         echo "You have void (*signal())()." >&4
11190         val="$define"
11191 else
11192         case "$d_voidsig" in
11193         '')
11194         echo "I can't determine whether signal handler returns void or int..." >&4
11195                 dflt=void
11196                 rp="What type does your signal handler return?"
11197                 . ./myread
11198                 case "$ans" in
11199                 v*) val="$define";;
11200                 *) val="$undef";;
11201                 esac;;
11202         "$define")
11203                 echo "As you already told me, signal handler returns void." >&4
11204                 val="$define"
11205                 ;;
11206         *)      echo "As you already told me, signal handler returns int." >&4
11207                 val="$undef"
11208                 ;;
11209         esac
11210 fi
11211 set d_voidsig
11212 eval $setvar
11213 case "$d_voidsig" in
11214 "$define") signal_t="void";;
11215 *) signal_t="int";;
11216 esac
11217 $rm -f $$.tmp
11218
11219 : check for ability to cast large floats to 32-bit ints.
11220 echo " "
11221 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11222 if $test "$intsize" -ge 4; then
11223         xxx=int
11224 else
11225         xxx=long
11226 fi
11227 $cat >try.c <<EOCP
11228 #include <stdio.h>
11229 #$i_stdlib I_STDLIB
11230 #ifdef I_STDLIB
11231 #include <stdlib.h>
11232 #endif
11233 #include <sys/types.h>
11234 #include <signal.h>
11235 $signal_t blech(int s) { exit(3); }
11236 int main()
11237 {
11238         $xxx i32;
11239         double f, g;
11240         int result = 0;
11241         char str[16];
11242         signal(SIGFPE, blech);
11243
11244         /* Don't let compiler optimize the test away.  Store the number
11245            in a writable string for gcc to pass to sscanf under HP-UX.
11246         */
11247         sprintf(str, "2147483647");
11248         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11249         g = 10 * f;
11250         i32  = ($xxx) g;
11251
11252         /* x86 processors will probably give 0x8000 0000, which is a
11253            sign change.  We don't want that.  We want to mimic SPARC
11254            behavior here, which is to preserve the sign and give
11255            back 0x7fff ffff.
11256         */
11257         if (i32 != ($xxx) f)
11258                 result |= 1;
11259         exit(result);
11260 }
11261 EOCP
11262 set try
11263 if eval $compile_ok; then
11264         $run ./try
11265         yyy=$?
11266 else
11267         echo "(I can't seem to compile the test program--assuming it can't)"
11268         yyy=1
11269 fi
11270 case "$yyy" in
11271 0)      val="$define"
11272         echo "Yup, it can."
11273         ;;
11274 *)      val="$undef"
11275         echo "Nope, it can't."
11276         ;;
11277 esac
11278 set d_casti32
11279 eval $setvar
11280 $rm_try
11281
11282 : check for ability to cast negative floats to unsigned
11283 echo " "
11284 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11285 $cat >try.c <<EOCP
11286 #include <stdio.h>
11287 #$i_stdlib I_STDLIB
11288 #ifdef I_STDLIB
11289 #include <stdlib.h>
11290 #endif
11291 #include <sys/types.h>
11292 #include <signal.h>
11293 $signal_t blech(int s) { exit(7); }
11294 $signal_t blech_in_list(int s) { exit(4); }
11295 unsigned long dummy_long(unsigned long p) { return p; }
11296 unsigned int dummy_int(unsigned int p) { return p; }
11297 unsigned short dummy_short(unsigned short p) { return p; }
11298 int main()
11299 {
11300         double f;
11301         unsigned long along;
11302         unsigned int aint;
11303         unsigned short ashort;
11304         int result = 0;
11305         char str[16];
11306
11307         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11308            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11309            optimized the whole file away
11310         */
11311         /* Store the number in a writable string for gcc to pass to
11312            sscanf under HP-UX.
11313         */
11314         sprintf(str, "-123");
11315         sscanf(str, "%lf", &f);  /* f = -123.; */
11316
11317         signal(SIGFPE, blech);
11318         along = (unsigned long)f;
11319         aint = (unsigned int)f;
11320         ashort = (unsigned short)f;
11321         if (along != (unsigned long)-123)
11322                 result |= 1;
11323         if (aint != (unsigned int)-123)
11324                 result |= 1;
11325         if (ashort != (unsigned short)-123)
11326                 result |= 1;
11327         sprintf(str, "1073741824.");
11328         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11329         f = f + f;
11330         along = 0;
11331         along = (unsigned long)f;
11332         if (along != 0x80000000)
11333                 result |= 2;
11334         f -= 1.;
11335         along = 0;
11336         along = (unsigned long)f;
11337         if (along != 0x7fffffff)
11338                 result |= 1;
11339         f += 2.;
11340         along = 0;
11341         along = (unsigned long)f;
11342         if (along != 0x80000001)
11343                 result |= 2;
11344         if (result)
11345                 exit(result);
11346         signal(SIGFPE, blech_in_list);
11347         sprintf(str, "123.");
11348         sscanf(str, "%lf", &f);  /* f = 123.; */
11349         along = dummy_long((unsigned long)f);
11350         aint = dummy_int((unsigned int)f);
11351         ashort = dummy_short((unsigned short)f);
11352         if (along != (unsigned long)123)
11353                 result |= 4;
11354         if (aint != (unsigned int)123)
11355                 result |= 4;
11356         if (ashort != (unsigned short)123)
11357                 result |= 4;
11358         exit(result);
11359
11360 }
11361 EOCP
11362 set try
11363 if eval $compile_ok; then
11364         $run ./try
11365         castflags=$?
11366 else
11367         echo "(I can't seem to compile the test program--assuming it can't)"
11368         castflags=7
11369 fi
11370 case "$castflags" in
11371 0)      val="$define"
11372         echo "Yup, it can."
11373         ;;
11374 *)      val="$undef"
11375         echo "Nope, it can't."
11376         ;;
11377 esac
11378 set d_castneg
11379 eval $setvar
11380 $rm_try
11381
11382 : see if vprintf exists
11383 echo " "
11384 if set vprintf val -f d_vprintf; eval $csym; $val; then
11385         echo 'vprintf() found.' >&4
11386         val="$define"
11387         $cat >try.c <<EOF
11388 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11389 #$i_varargs I_VARARGS
11390
11391 #$i_stdlib I_STDLIB
11392 #$i_unistd I_UNISTD
11393
11394 #ifdef I_STDARG
11395 #  include <stdarg.h>
11396 #else /* I_VARARGS */
11397 #  include <varargs.h>
11398 #endif
11399
11400 #ifdef I_UNISTD
11401 #  include <unistd.h>
11402 #endif
11403
11404 #ifdef I_STDLIB
11405 #  include <stdlib.h>
11406 #endif
11407
11408 #include <stdio.h> /* vsprintf prototype */
11409
11410 #ifdef I_STDARG
11411 void xxx(int n, ...)
11412 {
11413     va_list args;
11414     char buf[10];
11415     va_start(args, n);
11416     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11417 }
11418 int main() { xxx(1, "foo"); }
11419
11420 #else /* I_VARARGS */
11421
11422 xxx(va_alist)
11423 va_dcl
11424 {
11425     va_list args;
11426     char buf[10];
11427     va_start(args);
11428     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11429 }
11430 int main() { xxx("foo"); }
11431
11432 #endif
11433
11434 EOF
11435         set try
11436         if eval $compile_ok; then
11437                 if $run ./try; then
11438                         echo "Your vsprintf() returns (int)." >&4
11439                         val2="$undef"
11440                 else
11441                         echo "Your vsprintf() returns (char*)." >&4
11442                         val2="$define"
11443                 fi
11444         else
11445                 echo 'I am unable to compile the vsprintf() test program.' >&4
11446                 # We shouldn't get here.  If we do, assume the standard signature,
11447                 # not the old BSD one.
11448                 echo 'Guessing that vsprintf() returns (int).' >&4
11449                 val2="$undef"
11450         fi
11451 else
11452         echo 'vprintf() NOT found.' >&4
11453         val="$undef"
11454         val2="$undef"
11455 fi
11456 $rm_try
11457 set d_vprintf
11458 eval $setvar
11459 val=$val2
11460 set d_charvspr
11461 eval $setvar
11462
11463 : see if chown exists
11464 set chown d_chown
11465 eval $inlibc
11466
11467 : see if chroot exists
11468 set chroot d_chroot
11469 eval $inlibc
11470
11471 : see if chsize exists
11472 set chsize d_chsize
11473 eval $inlibc
11474
11475 : see if class exists
11476 set class d_class
11477 eval $inlibc
11478
11479 : see if clearenv exists
11480 set clearenv d_clearenv
11481 eval $inlibc
11482
11483 : Define hasstruct macro for Configure internal use
11484 hasstruct='varname=$1; struct=$2; shift; shift;
11485 while $test $# -ge 2; do
11486         case "$1" in
11487         $define) echo "#include <$2>";;
11488         esac ;
11489     shift 2;
11490 done > try.c;
11491 echo "int main () { struct $struct foo; }" >> try.c;
11492 set try;
11493 if eval $compile; then
11494         val="$define";
11495 else
11496         val="$undef";
11497 fi;
11498 set $varname;
11499 eval $setvar;
11500 $rm_try'
11501
11502 : see whether socket exists
11503 socketlib=''
11504 sockethdr=''
11505 echo " "
11506 $echo $n "Hmm... $c" >&4
11507 if set socket val -f d_socket; eval $csym; $val; then
11508     echo "Looks like you have Berkeley networking support." >&4
11509     d_socket="$define"
11510     if set setsockopt val -f; eval $csym; $val; then
11511         d_oldsock="$undef"
11512     else
11513         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11514         d_oldsock="$define"
11515     fi
11516 else
11517     if $contains socklib libc.list >/dev/null 2>&1; then
11518         echo "Looks like you have Berkeley networking support." >&4
11519         d_socket="$define"
11520         : we will have to assume that it supports the 4.2 BSD interface
11521         d_oldsock="$undef"
11522     else
11523         echo "You don't have Berkeley networking in libc$_a..." >&4
11524         if test "X$d_socket" = "X$define"; then
11525             echo "...but you seem to believe that you have sockets." >&4
11526         else
11527             for net in net socket
11528             do
11529                 if test -f $sysroot/usr/lib/lib$net$_a; then
11530                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11531                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11532                     if $contains socket libc.list >/dev/null 2>&1; then
11533                         d_socket="$define"
11534                         socketlib="-l$net"
11535                         case "$net" in
11536                         net)
11537                             echo "...but the Wollongong group seems to have hacked it in." >&4
11538                             sockethdr="-I$sysroot/usr/netinclude"
11539                             ;;
11540                         esac
11541                         echo "Found Berkeley sockets interface in lib$net." >&4
11542                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11543                             d_oldsock="$undef"
11544                         else
11545                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11546                             d_oldsock="$define"
11547                         fi
11548                         break
11549                     fi
11550                 fi
11551             done
11552             if test "X$d_socket" != "X$define"; then
11553                echo "or anywhere else I see." >&4
11554                d_socket="$undef"
11555                d_oldsock="$undef"
11556             fi
11557         fi
11558     fi
11559 fi
11560
11561 : see if socketpair exists
11562 set socketpair d_sockpair
11563 eval $inlibc
11564
11565
11566 echo " "
11567 echo "Checking the availability sa_len in the sock struct ..." >&4
11568 $cat >try.c <<EOF
11569 #include <sys/types.h>
11570 #include <sys/socket.h>
11571 int main() {
11572 struct sockaddr sa;
11573 return (sa.sa_len);
11574 }
11575 EOF
11576 val="$undef"
11577 set try; if eval $compile; then
11578     val="$define"
11579 fi
11580 set d_sockaddr_sa_len; eval $setvar
11581 $rm_try
11582
11583 echo " "
11584 echo "Checking the availability struct sockaddr_in6 ..." >&4
11585 $cat >try.c <<EOF
11586 #include <sys/types.h>
11587 #include <sys/socket.h>
11588 #include <netinet/in.h>
11589 int main() {
11590 struct sockaddr_in6 sin6;
11591 return (sin6.sin6_family);
11592 }
11593 EOF
11594 val="$undef"
11595 set try; if eval $compile; then
11596     val="$define"
11597 fi
11598 set d_sockaddr_in6; eval $setvar
11599 $rm_try
11600
11601 echo " "
11602 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11603 $cat >try.c <<EOF
11604 #include <sys/types.h>
11605 #include <sys/socket.h>
11606 #include <netinet/in.h>
11607 int main() {
11608 struct sockaddr_in6 sin6;
11609 return (sin6.sin6_scope_id);
11610 }
11611 EOF
11612 val="$undef"
11613 set try; if eval $compile; then
11614     val="$define"
11615 fi
11616 set d_sin6_scope_id; eval $setvar
11617 $rm_try
11618
11619 echo " "
11620 echo "Checking the availability struct ip_mreq ..." >&4
11621 $cat >try.c <<EOF
11622 #include <sys/types.h>
11623 #include <sys/socket.h>
11624 #include <netinet/in.h>
11625 int main() {
11626 struct ip_mreq mreq;
11627 return (mreq.imr_multiaddr.s_addr);
11628 }
11629 EOF
11630 val="$undef"
11631 set try; if eval $compile; then
11632        val="$define"
11633 fi
11634 set d_ip_mreq; eval $setvar
11635 $rm_try
11636
11637 echo " "
11638 echo "Checking the availability struct ip_mreq_source ..." >&4
11639 $cat >try.c <<EOF
11640 #include <sys/types.h>
11641 #include <sys/socket.h>
11642 #include <netinet/in.h>
11643 int main() {
11644 struct ip_mreq_source mreq;
11645 return (mreq.imr_multiaddr.s_addr);
11646 }
11647 EOF
11648 val="$undef"
11649 set try; if eval $compile; then
11650        val="$define"
11651 fi
11652 set d_ip_mreq_source; eval $setvar
11653 $rm_try
11654
11655 echo " "
11656 echo "Checking the availability struct ipv6_mreq ..." >&4
11657 $cat >try.c <<EOF
11658 #include <sys/types.h>
11659 #include <sys/socket.h>
11660 #include <netinet/in.h>
11661 int main() {
11662 struct ipv6_mreq mreq;
11663 return (mreq.ipv6mr_interface);
11664 }
11665 EOF
11666 val="$undef"
11667 set try; if eval $compile; then
11668     val="$define"
11669 fi
11670 set d_ipv6_mreq; eval $setvar
11671 $rm_try
11672
11673 echo " "
11674 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11675 $cat >try.c <<EOF
11676 #include <sys/types.h>
11677 #include <sys/socket.h>
11678 #include <netinet/in.h>
11679 int main() {
11680 struct ipv6_mreq_source mreq;
11681 return (mreq.imr_multiaddr.s_addr);
11682 }
11683 EOF
11684 val="$undef"
11685 set try; if eval $compile; then
11686        val="$define"
11687 fi
11688 set d_ipv6_mreq_source; eval $setvar
11689 $rm_try
11690
11691 echo " "
11692 echo "Checking the availability of certain socket constants..." >&4
11693 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11694     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11695     $cat >try.c <<EOF
11696 #include <sys/types.h>
11697 #include <sys/socket.h>
11698 int main() {
11699     int i = $ENUM;
11700 }
11701 EOF
11702     val="$undef"
11703     set try; if eval $compile; then
11704         val="$define"
11705     fi
11706     set d_${enum}; eval $setvar
11707     $rm_try
11708 done
11709
11710 : see if this is a sys/uio.h system
11711 set sys/uio.h i_sysuio
11712 eval $inhdr
11713
11714 : Check for cmsghdr support
11715 echo " "
11716 echo "Checking to see if your system supports struct cmsghdr..." >&4
11717 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11718 eval $hasstruct
11719 case "$d_cmsghdr_s" in
11720 "$define")      echo "Yes, it does."   ;;
11721 *)              echo "No, it doesn't." ;;
11722 esac
11723
11724
11725 : check for const keyword
11726 echo " "
11727 echo 'Checking to see if your C compiler knows about "const"...' >&4
11728 $cat >const.c <<'EOCP'
11729 typedef struct spug { int drokk; } spug;
11730 int main()
11731 {
11732         const char *foo;
11733         const spug y = { 0 };
11734 }
11735 EOCP
11736 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11737         val="$define"
11738         echo "Yup, it does."
11739 else
11740         val="$undef"
11741         echo "Nope, it doesn't."
11742 fi
11743 set d_const
11744 eval $setvar
11745
11746 : see if copysignl exists
11747 set copysignl d_copysignl
11748 eval $inlibc
11749
11750 : see if crypt exists
11751 echo " "
11752 set crypt d_crypt
11753 eval $inlibc
11754 case "$d_crypt" in
11755 $define) cryptlib='' ;;
11756 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11757                 echo 'crypt() found.' >&4
11758                 val="$define"
11759                 cryptlib=''
11760         else
11761                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11762                 if $test -z "$cryptlib"; then
11763                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11764                 else
11765                         cryptlib=-lcrypt
11766                 fi
11767                 if $test -z "$cryptlib"; then
11768                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11769                 else
11770                         cryptlib=-lcrypt
11771                 fi
11772                 if $test -z "$cryptlib"; then
11773                         cryptlib=`./loc libcrypt$_a "" $libpth`
11774                 else
11775                         cryptlib=-lcrypt
11776                 fi
11777                 if $test -z "$cryptlib"; then
11778                         echo 'crypt() NOT found.' >&4
11779                         val="$undef"
11780                 else
11781                         val="$define"
11782                 fi
11783         fi
11784         set d_crypt
11785         eval $setvar
11786         ;;
11787 esac
11788
11789 : see if this is a crypt.h system
11790 set crypt.h i_crypt
11791 eval $inhdr
11792
11793 : see if crypt_r exists
11794 set crypt_r d_crypt_r
11795 eval $inlibc
11796 case "$d_crypt_r" in
11797 "$define")
11798         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11799         case "$d_crypt_r_proto:$usethreads" in
11800         ":define")      d_crypt_r_proto=define
11801                 set d_crypt_r_proto crypt_r $hdrs
11802                 eval $hasproto ;;
11803         *)      ;;
11804         esac
11805         case "$d_crypt_r_proto" in
11806         define)
11807         case "$crypt_r_proto" in
11808         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11809         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11810         esac
11811         case "$crypt_r_proto" in
11812         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11813         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11814         esac
11815         case "$crypt_r_proto" in
11816         ''|0)   d_crypt_r=undef
11817                 crypt_r_proto=0
11818                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11819         * )     case "$crypt_r_proto" in
11820                 REENTRANT_PROTO*) ;;
11821                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11822                 esac
11823                 echo "Prototype: $try" ;;
11824         esac
11825         ;;
11826         *)      case "$usethreads" in
11827                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11828                 esac
11829                 d_crypt_r=undef
11830                 crypt_r_proto=0
11831                 ;;
11832         esac
11833         ;;
11834 *)      crypt_r_proto=0
11835         ;;
11836 esac
11837
11838 : get csh whereabouts
11839 case "$csh" in
11840 'csh') val="$undef" ;;
11841 *) val="$define" ;;
11842 esac
11843 set d_csh
11844 eval $setvar
11845 : Respect a hint or command line value for full_csh.
11846 case "$full_csh" in
11847 '') full_csh=$csh ;;
11848 esac
11849
11850 : see if ctermid exists
11851 set ctermid d_ctermid
11852 eval $inlibc
11853
11854 : see if ctermid_r exists
11855 set ctermid_r d_ctermid_r
11856 eval $inlibc
11857 case "$d_ctermid_r" in
11858 "$define")
11859         hdrs="$i_systypes sys/types.h define stdio.h "
11860         case "$d_ctermid_r_proto:$usethreads" in
11861         ":define")      d_ctermid_r_proto=define
11862                 set d_ctermid_r_proto ctermid_r $hdrs
11863                 eval $hasproto ;;
11864         *)      ;;
11865         esac
11866         case "$d_ctermid_r_proto" in
11867         define)
11868         case "$ctermid_r_proto" in
11869         ''|0) try='char* ctermid_r(char*);'
11870         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11871         esac
11872         case "$ctermid_r_proto" in
11873         ''|0)   d_ctermid_r=undef
11874                 ctermid_r_proto=0
11875                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11876         * )     case "$ctermid_r_proto" in
11877                 REENTRANT_PROTO*) ;;
11878                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11879                 esac
11880                 echo "Prototype: $try" ;;
11881         esac
11882         ;;
11883         *)      case "$usethreads" in
11884                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11885                 esac
11886                 d_ctermid_r=undef
11887                 ctermid_r_proto=0
11888                 ;;
11889         esac
11890         ;;
11891 *)      ctermid_r_proto=0
11892         ;;
11893 esac
11894
11895 : see if ctime_r exists
11896 set ctime_r d_ctime_r
11897 eval $inlibc
11898 case "$d_ctime_r" in
11899 "$define")
11900         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11901         case "$d_ctime_r_proto:$usethreads" in
11902         ":define")      d_ctime_r_proto=define
11903                 set d_ctime_r_proto ctime_r $hdrs
11904                 eval $hasproto ;;
11905         *)      ;;
11906         esac
11907         case "$d_ctime_r_proto" in
11908         define)
11909         case "$ctime_r_proto" in
11910         ''|0) try='char* ctime_r(const time_t*, char*);'
11911         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11912         esac
11913         case "$ctime_r_proto" in
11914         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11915         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11916         esac
11917         case "$ctime_r_proto" in
11918         ''|0) try='int ctime_r(const time_t*, char*);'
11919         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11920         esac
11921         case "$ctime_r_proto" in
11922         ''|0) try='int ctime_r(const time_t*, char*, int);'
11923         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11924         esac
11925         case "$ctime_r_proto" in
11926         ''|0)   d_ctime_r=undef
11927                 ctime_r_proto=0
11928                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11929         * )     case "$ctime_r_proto" in
11930                 REENTRANT_PROTO*) ;;
11931                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11932                 esac
11933                 echo "Prototype: $try" ;;
11934         esac
11935         ;;
11936         *)      case "$usethreads" in
11937                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11938                 esac
11939                 d_ctime_r=undef
11940                 ctime_r_proto=0
11941                 ;;
11942         esac
11943         ;;
11944 *)      ctime_r_proto=0
11945         ;;
11946 esac
11947
11948 : see if cuserid exists
11949 set cuserid d_cuserid
11950 eval $inlibc
11951
11952 : see if this is a limits.h system
11953 set limits.h i_limits
11954 eval $inhdr
11955
11956 : see if this is a float.h system
11957 set float.h i_float
11958 eval $inhdr
11959
11960 : See if number of significant digits in a double precision number is known
11961 echo " "
11962 $cat >dbl_dig.c <<EOM
11963 #$i_limits I_LIMITS
11964 #$i_float I_FLOAT
11965 #ifdef I_LIMITS
11966 #include <limits.h>
11967 #endif
11968 #ifdef I_FLOAT
11969 #include <float.h>
11970 #endif
11971 #ifdef DBL_DIG
11972 printf("Contains DBL_DIG");
11973 #endif
11974 EOM
11975 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11976 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11977         echo "DBL_DIG found." >&4
11978         val="$define"
11979 else
11980         echo "DBL_DIG NOT found." >&4
11981         val="$undef"
11982 fi
11983 $rm -f dbl_dig.?
11984 set d_dbl_dig
11985 eval $setvar
11986
11987 : see if dbm.h is available
11988 : see if dbmclose exists
11989 set dbmclose d_dbmclose
11990 eval $inlibc
11991
11992 case "$d_dbmclose" in
11993 $define)
11994         set dbm.h i_dbm
11995         eval $inhdr
11996         case "$i_dbm" in
11997         $define)
11998                 val="$undef"
11999                 set i_rpcsvcdbm
12000                 eval $setvar
12001                 ;;
12002         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12003                 eval $inhdr
12004                 ;;
12005         esac
12006         ;;
12007 *)      echo "We won't be including <dbm.h>"
12008         val="$undef"
12009         set i_dbm
12010         eval $setvar
12011         val="$undef"
12012         set i_rpcsvcdbm
12013         eval $setvar
12014         ;;
12015 esac
12016
12017 : see if prototype for dbminit is available
12018 echo " "
12019 set d_dbminitproto dbminit $i_dbm dbm.h
12020 eval $hasproto
12021
12022 : see if difftime exists
12023 set difftime d_difftime
12024 eval $inlibc
12025
12026 : see if this is a dirent system
12027 echo " "
12028 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12029         val="$define"
12030         echo "<dirent.h> found." >&4
12031 else
12032         val="$undef"
12033         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12034                 echo "<sys/dir.h> found." >&4
12035                 echo " "
12036         else
12037                 xinc=`./findhdr sys/ndir.h`
12038         fi
12039         echo "<dirent.h> NOT found." >&4
12040 fi
12041 set i_dirent
12042 eval $setvar
12043
12044 : Look for type of directory structure.
12045 echo " "
12046 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12047
12048 case "$direntrytype" in
12049 ''|' ')
12050         case "$i_dirent" in
12051         $define) guess1='struct dirent' ;;
12052         *) guess1='struct direct'  ;;
12053         esac
12054         ;;
12055 *)      guess1="$direntrytype"
12056         ;;
12057 esac
12058
12059 case "$guess1" in
12060 'struct dirent') guess2='struct direct' ;;
12061 *) guess2='struct dirent' ;;
12062 esac
12063
12064 if $contains "$guess1" try.c >/dev/null 2>&1; then
12065         direntrytype="$guess1"
12066         echo "Your directory entries are $direntrytype." >&4
12067 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12068         direntrytype="$guess2"
12069         echo "Your directory entries seem to be $direntrytype." >&4
12070 else
12071         echo "I don't recognize your system's directory entries." >&4
12072         rp="What type is used for directory entries on this system?"
12073         dflt="$guess1"
12074         . ./myread
12075         direntrytype="$ans"
12076 fi
12077 $rm_try
12078
12079 : see if the directory entry stores field length
12080 echo " "
12081 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12082 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12083         echo "Good, your directory entry keeps length information in d_namlen." >&4
12084         val="$define"
12085 else
12086         echo "Your directory entry does not know about the d_namlen field." >&4
12087         val="$undef"
12088 fi
12089 set d_dirnamlen
12090 eval $setvar
12091 $rm_try
12092
12093 : Look for DIR.dd_fd
12094 case "$i_dirent" in
12095 "$define")
12096     echo "Checking to see if DIR has a dd_fd member variable" >&4
12097     $cat >try.c <<EOCP
12098 #$i_stdlib I_STDLIB
12099 #ifdef I_STDLIB
12100 #include <stdlib.h>
12101 #endif
12102 #include <dirent.h>
12103
12104 int main() {
12105     DIR dir;
12106     dir.dd_fd = 1;
12107     return 0;
12108 }
12109 EOCP
12110     val=$undef
12111     set try
12112     if eval $compile; then
12113         echo "Yes, it does."
12114         val="$define"
12115     else
12116         echo "No, it does not."
12117         val="$undef"
12118     fi
12119     ;;
12120 *)
12121     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12122     val="$undef"
12123     ;;
12124 esac
12125 set d_dir_dd_fd
12126 eval $setvar
12127 $rm_try
12128
12129 : see if this is an sysdir system
12130 set sys/dir.h i_sysdir
12131 eval $inhdr
12132
12133 : see if this is an sysndir system
12134 set sys/ndir.h i_sysndir
12135 eval $inhdr
12136
12137 : Look for dirfd
12138 echo " "
12139 $cat >dirfd.c <<EOM
12140 #include <stdio.h>
12141 #$i_stdlib I_STDLIB
12142 #ifdef I_STDLIB
12143 #include <stdlib.h>
12144 #endif
12145 #$i_dirent I_DIRENT             /**/
12146 #$i_sysdir I_SYS_DIR            /**/
12147 #$i_sysndir I_SYS_NDIR          /**/
12148 #$i_systypes I_SYS_TYPES        /**/
12149 #if defined(I_SYS_TYPES)
12150 #include <sys/types.h>
12151 #endif
12152 #if defined(I_DIRENT)
12153 #include <dirent.h>
12154 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12155 #include <sys/dir.h>
12156 #endif
12157 #else
12158 #ifdef I_SYS_NDIR
12159 #include <sys/ndir.h>
12160 #else
12161 #ifdef I_SYS_DIR
12162 #ifdef hp9000s500
12163 #include <ndir.h>       /* may be wrong in the future */
12164 #else
12165 #include <sys/dir.h>
12166 #endif
12167 #endif
12168 #endif
12169 #endif
12170 int main() {
12171         DIR *dirp = opendir(".");
12172         if (dirfd(dirp) >= 0)
12173                 exit(0);
12174         else
12175                 exit(1);
12176 }
12177 EOM
12178 val=$undef
12179 set dirfd
12180 if eval $compile; then
12181         val="$define"
12182 fi
12183 case "$val" in
12184 $define)        echo "dirfd() found." >&4       ;;
12185 *)              echo "dirfd() NOT found." >&4   ;;
12186 esac
12187 set d_dirfd
12188 eval $setvar
12189 $rm -f dirfd*
12190
12191 : see if dlerror exists
12192 xxx_runnm="$runnm"
12193 runnm=false
12194 set dlerror d_dlerror
12195 eval $inlibc
12196 runnm="$xxx_runnm"
12197
12198 : see if dlfcn is available
12199 set dlfcn.h i_dlfcn
12200 eval $inhdr
12201
12202 : Check what extension to use for shared libs
12203 case "$usedl" in
12204 $define|y|true)
12205         $cat << EOM
12206
12207 On a few systems, the dynamically loaded modules that perl generates and uses
12208 will need a different extension than shared libs. The default will probably
12209 be appropriate.
12210
12211 EOM
12212         case "$dlext" in
12213         '')     dflt="$so" ;;
12214         *)      dflt="$dlext" ;;
12215         esac
12216         rp='What is the extension of dynamically loaded modules'
12217         . ./myread
12218         dlext="$ans"
12219         ;;
12220 *)
12221         dlext="none"
12222         ;;
12223 esac
12224
12225 : Check if dlsym need a leading underscore
12226 echo " "
12227 val="$undef"
12228
12229 case "$dlsrc" in
12230 dl_dlopen.xs)
12231         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12232         $cat >dyna.c <<'EOM'
12233 fred () { }
12234 EOM
12235
12236 $cat >fred.c<<EOM
12237
12238 #include <stdio.h>
12239 #$i_stdlib I_STDLIB
12240 #ifdef I_STDLIB
12241 #include <stdlib.h>
12242 #endif
12243 #$i_dlfcn I_DLFCN
12244 #ifdef I_DLFCN
12245 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12246 #else
12247 #include <sys/types.h>
12248 #include <nlist.h>
12249 #include <link.h>
12250 #endif
12251
12252 extern int fred() ;
12253
12254 int main()
12255 {
12256     void * handle ;
12257     void * symbol ;
12258 #ifndef RTLD_LAZY
12259     int mode = 1 ;
12260 #else
12261     int mode = RTLD_LAZY ;
12262 #endif
12263     handle = dlopen("./dyna.$dlext", mode) ;
12264     if (handle == NULL) {
12265         printf ("1\n") ;
12266         fflush (stdout) ;
12267         exit(0);
12268     }
12269     symbol = dlsym(handle, "fred") ;
12270     if (symbol == NULL) {
12271         /* try putting a leading underscore */
12272         symbol = dlsym(handle, "_fred") ;
12273         if (symbol == NULL) {
12274             printf ("2\n") ;
12275             fflush (stdout) ;
12276             exit(0);
12277         }
12278         printf ("3\n") ;
12279     }
12280     else
12281         printf ("4\n") ;
12282     fflush (stdout) ;
12283     exit(0);
12284 }
12285 EOM
12286         : Call the object file tmp-dyna.o in case dlext=o.
12287         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12288                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12289                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12290                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12291                 xxx=`$run ./fred`
12292                 case $xxx in
12293                 1)      echo "Test program failed using dlopen." >&4
12294                         echo "Perhaps you should not use dynamic loading." >&4;;
12295                 2)      echo "Test program failed using dlsym." >&4
12296                         echo "Perhaps you should not use dynamic loading." >&4;;
12297                 3)      echo "dlsym needs a leading underscore" >&4
12298                         val="$define" ;;
12299                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12300                 esac
12301         else
12302                 echo "I can't compile and run the test program." >&4
12303                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12304         fi
12305         ;;
12306 esac
12307
12308 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12309
12310 set d_dlsymun
12311 eval $setvar
12312
12313 : see if drand48_r exists
12314 set drand48_r d_drand48_r
12315 eval $inlibc
12316 case "$d_drand48_r" in
12317 "$define")
12318         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12319         case "$d_drand48_r_proto:$usethreads" in
12320         ":define")      d_drand48_r_proto=define
12321                 set d_drand48_r_proto drand48_r $hdrs
12322                 eval $hasproto ;;
12323         *)      ;;
12324         esac
12325         case "$d_drand48_r_proto" in
12326         define)
12327         case "$drand48_r_proto" in
12328         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12329         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12330         esac
12331         case "$drand48_r_proto" in
12332         ''|0)   d_drand48_r=undef
12333                 drand48_r_proto=0
12334                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12335         * )     case "$drand48_r_proto" in
12336                 REENTRANT_PROTO*) ;;
12337                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12338                 esac
12339                 echo "Prototype: $try" ;;
12340         esac
12341         ;;
12342         *)      case "$usethreads" in
12343                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12344                 esac
12345                 d_drand48_r=undef
12346                 drand48_r_proto=0
12347                 ;;
12348         esac
12349         ;;
12350 *)      drand48_r_proto=0
12351         ;;
12352 esac
12353
12354 : see if prototype for drand48 is available
12355 echo " "
12356 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12357 eval $hasproto
12358
12359 : see if dup2 exists
12360 set dup2 d_dup2
12361 eval $inlibc
12362
12363 : see if eaccess exists
12364 set eaccess d_eaccess
12365 eval $inlibc
12366
12367 : see if endgrent exists
12368 set endgrent d_endgrent
12369 eval $inlibc
12370
12371 : see if this is an grp system
12372 set grp.h i_grp
12373 eval $inhdr
12374
12375 case "$i_grp" in
12376 $define)
12377         xxx=`./findhdr grp.h`
12378         $cppstdin $cppflags $cppminus < $xxx >$$.h
12379
12380         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12381                 val="$define"
12382         else
12383                 val="$undef"
12384         fi
12385         set d_grpasswd
12386         eval $setvar
12387
12388         $rm -f $$.h
12389         ;;
12390 *)
12391         val="$undef";
12392         set d_grpasswd; eval $setvar
12393         ;;
12394 esac
12395
12396 : see if endgrent_r exists
12397 set endgrent_r d_endgrent_r
12398 eval $inlibc
12399 case "$d_endgrent_r" in
12400 "$define")
12401         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12402         case "$d_endgrent_r_proto:$usethreads" in
12403         ":define")      d_endgrent_r_proto=define
12404                 set d_endgrent_r_proto endgrent_r $hdrs
12405                 eval $hasproto ;;
12406         *)      ;;
12407         esac
12408         case "$d_endgrent_r_proto" in
12409         define)
12410         case "$endgrent_r_proto" in
12411         ''|0) try='int endgrent_r(FILE**);'
12412         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12413         esac
12414         case "$endgrent_r_proto" in
12415         ''|0) try='void endgrent_r(FILE**);'
12416         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12417         esac
12418         case "$endgrent_r_proto" in
12419         ''|0)   d_endgrent_r=undef
12420                 endgrent_r_proto=0
12421                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12422         * )     case "$endgrent_r_proto" in
12423                 REENTRANT_PROTO*) ;;
12424                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12425                 esac
12426                 echo "Prototype: $try" ;;
12427         esac
12428         ;;
12429         *)      case "$usethreads" in
12430                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12431                 esac
12432                 d_endgrent_r=undef
12433                 endgrent_r_proto=0
12434                 ;;
12435         esac
12436         ;;
12437 *)      endgrent_r_proto=0
12438         ;;
12439 esac
12440
12441 : see if endhostent exists
12442 set endhostent d_endhent
12443 eval $inlibc
12444
12445 : see if this is a netdb.h system
12446 set netdb.h i_netdb
12447 eval $inhdr
12448
12449 : see if endhostent_r exists
12450 set endhostent_r d_endhostent_r
12451 eval $inlibc
12452 case "$d_endhostent_r" in
12453 "$define")
12454         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12455         case "$d_endhostent_r_proto:$usethreads" in
12456         ":define")      d_endhostent_r_proto=define
12457                 set d_endhostent_r_proto endhostent_r $hdrs
12458                 eval $hasproto ;;
12459         *)      ;;
12460         esac
12461         case "$d_endhostent_r_proto" in
12462         define)
12463         case "$endhostent_r_proto" in
12464         ''|0) try='int endhostent_r(struct hostent_data*);'
12465         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12466         esac
12467         case "$endhostent_r_proto" in
12468         ''|0) try='void endhostent_r(struct hostent_data*);'
12469         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12470         esac
12471         case "$endhostent_r_proto" in
12472         ''|0)   d_endhostent_r=undef
12473                 endhostent_r_proto=0
12474                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12475         * )     case "$endhostent_r_proto" in
12476                 REENTRANT_PROTO*) ;;
12477                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12478                 esac
12479                 echo "Prototype: $try" ;;
12480         esac
12481         ;;
12482         *)      case "$usethreads" in
12483                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12484                 esac
12485                 d_endhostent_r=undef
12486                 endhostent_r_proto=0
12487                 ;;
12488         esac
12489         ;;
12490 *)      endhostent_r_proto=0
12491         ;;
12492 esac
12493
12494 : see if endnetent exists
12495 set endnetent d_endnent
12496 eval $inlibc
12497
12498 : see if endnetent_r exists
12499 set endnetent_r d_endnetent_r
12500 eval $inlibc
12501 case "$d_endnetent_r" in
12502 "$define")
12503         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12504         case "$d_endnetent_r_proto:$usethreads" in
12505         ":define")      d_endnetent_r_proto=define
12506                 set d_endnetent_r_proto endnetent_r $hdrs
12507                 eval $hasproto ;;
12508         *)      ;;
12509         esac
12510         case "$d_endnetent_r_proto" in
12511         define)
12512         case "$endnetent_r_proto" in
12513         ''|0) try='int endnetent_r(struct netent_data*);'
12514         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12515         esac
12516         case "$endnetent_r_proto" in
12517         ''|0) try='void endnetent_r(struct netent_data*);'
12518         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12519         esac
12520         case "$endnetent_r_proto" in
12521         ''|0)   d_endnetent_r=undef
12522                 endnetent_r_proto=0
12523                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12524         * )     case "$endnetent_r_proto" in
12525                 REENTRANT_PROTO*) ;;
12526                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12527                 esac
12528                 echo "Prototype: $try" ;;
12529         esac
12530         ;;
12531         *)      case "$usethreads" in
12532                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12533                 esac
12534                 d_endnetent_r=undef
12535                 endnetent_r_proto=0
12536                 ;;
12537         esac
12538         ;;
12539 *)      endnetent_r_proto=0
12540         ;;
12541 esac
12542
12543 : see if endprotoent exists
12544 set endprotoent d_endpent
12545 eval $inlibc
12546
12547 : see if endprotoent_r exists
12548 set endprotoent_r d_endprotoent_r
12549 eval $inlibc
12550 case "$d_endprotoent_r" in
12551 "$define")
12552         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12553         case "$d_endprotoent_r_proto:$usethreads" in
12554         ":define")      d_endprotoent_r_proto=define
12555                 set d_endprotoent_r_proto endprotoent_r $hdrs
12556                 eval $hasproto ;;
12557         *)      ;;
12558         esac
12559         case "$d_endprotoent_r_proto" in
12560         define)
12561         case "$endprotoent_r_proto" in
12562         ''|0) try='int endprotoent_r(struct protoent_data*);'
12563         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12564         esac
12565         case "$endprotoent_r_proto" in
12566         ''|0) try='void endprotoent_r(struct protoent_data*);'
12567         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12568         esac
12569         case "$endprotoent_r_proto" in
12570         ''|0)   d_endprotoent_r=undef
12571                 endprotoent_r_proto=0
12572                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12573         * )     case "$endprotoent_r_proto" in
12574                 REENTRANT_PROTO*) ;;
12575                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12576                 esac
12577                 echo "Prototype: $try" ;;
12578         esac
12579         ;;
12580         *)      case "$usethreads" in
12581                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12582                 esac
12583                 d_endprotoent_r=undef
12584                 endprotoent_r_proto=0
12585                 ;;
12586         esac
12587         ;;
12588 *)      endprotoent_r_proto=0
12589         ;;
12590 esac
12591
12592 : see if endpwent exists
12593 set endpwent d_endpwent
12594 eval $inlibc
12595
12596 : see if this is a pwd.h system
12597 set pwd.h i_pwd
12598 eval $inhdr
12599
12600 case "$i_pwd" in
12601 $define)
12602         xxx=`./findhdr pwd.h`
12603         $cppstdin $cppflags $cppminus < $xxx >$$.h
12604
12605         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12606                 val="$define"
12607         else
12608                 val="$undef"
12609         fi
12610         set d_pwquota
12611         eval $setvar
12612
12613         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12614                 val="$define"
12615         else
12616                 val="$undef"
12617         fi
12618         set d_pwage
12619         eval $setvar
12620
12621         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12622                 val="$define"
12623         else
12624                 val="$undef"
12625         fi
12626         set d_pwchange
12627         eval $setvar
12628
12629         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12630                 val="$define"
12631         else
12632                 val="$undef"
12633         fi
12634         set d_pwclass
12635         eval $setvar
12636
12637         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12638                 val="$define"
12639         else
12640                 val="$undef"
12641         fi
12642         set d_pwexpire
12643         eval $setvar
12644
12645         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12646                 val="$define"
12647         else
12648                 val="$undef"
12649         fi
12650         set d_pwcomment
12651         eval $setvar
12652
12653         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12654                 val="$define"
12655         else
12656                 val="$undef"
12657         fi
12658         set d_pwgecos
12659         eval $setvar
12660
12661         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12662                 val="$define"
12663         else
12664                 val="$undef"
12665         fi
12666         set d_pwpasswd
12667         eval $setvar
12668
12669         $rm -f $$.h
12670         ;;
12671 *)
12672         val="$undef";
12673         set d_pwquota; eval $setvar
12674         set d_pwage; eval $setvar
12675         set d_pwchange; eval $setvar
12676         set d_pwclass; eval $setvar
12677         set d_pwexpire; eval $setvar
12678         set d_pwcomment; eval $setvar
12679         set d_pwgecos; eval $setvar
12680         set d_pwpasswd; eval $setvar
12681         ;;
12682 esac
12683
12684 : see if endpwent_r exists
12685 set endpwent_r d_endpwent_r
12686 eval $inlibc
12687 case "$d_endpwent_r" in
12688 "$define")
12689         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12690         case "$d_endpwent_r_proto:$usethreads" in
12691         ":define")      d_endpwent_r_proto=define
12692                 set d_endpwent_r_proto endpwent_r $hdrs
12693                 eval $hasproto ;;
12694         *)      ;;
12695         esac
12696         case "$d_endpwent_r_proto" in
12697         define)
12698         case "$endpwent_r_proto" in
12699         ''|0) try='int endpwent_r(FILE**);'
12700         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12701         esac
12702         case "$endpwent_r_proto" in
12703         ''|0) try='void endpwent_r(FILE**);'
12704         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12705         esac
12706         case "$endpwent_r_proto" in
12707         ''|0)   d_endpwent_r=undef
12708                 endpwent_r_proto=0
12709                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12710         * )     case "$endpwent_r_proto" in
12711                 REENTRANT_PROTO*) ;;
12712                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12713                 esac
12714                 echo "Prototype: $try" ;;
12715         esac
12716         ;;
12717         *)      case "$usethreads" in
12718                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12719                 esac
12720                 d_endpwent_r=undef
12721                 endpwent_r_proto=0
12722                 ;;
12723         esac
12724         ;;
12725 *)      endpwent_r_proto=0
12726         ;;
12727 esac
12728
12729 : see if endservent exists
12730 set endservent d_endsent
12731 eval $inlibc
12732
12733 : see if endservent_r exists
12734 set endservent_r d_endservent_r
12735 eval $inlibc
12736 case "$d_endservent_r" in
12737 "$define")
12738         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12739         case "$d_endservent_r_proto:$usethreads" in
12740         ":define")      d_endservent_r_proto=define
12741                 set d_endservent_r_proto endservent_r $hdrs
12742                 eval $hasproto ;;
12743         *)      ;;
12744         esac
12745         case "$d_endservent_r_proto" in
12746         define)
12747         case "$endservent_r_proto" in
12748         ''|0) try='int endservent_r(struct servent_data*);'
12749         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12750         esac
12751         case "$endservent_r_proto" in
12752         ''|0) try='void endservent_r(struct servent_data*);'
12753         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12754         esac
12755         case "$endservent_r_proto" in
12756         ''|0)   d_endservent_r=undef
12757                 endservent_r_proto=0
12758                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12759         * )     case "$endservent_r_proto" in
12760                 REENTRANT_PROTO*) ;;
12761                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12762                 esac
12763                 echo "Prototype: $try" ;;
12764         esac
12765         ;;
12766         *)      case "$usethreads" in
12767                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12768                 esac
12769                 d_endservent_r=undef
12770                 endservent_r_proto=0
12771                 ;;
12772         esac
12773         ;;
12774 *)      endservent_r_proto=0
12775         ;;
12776 esac
12777
12778 : Locate the flags for 'open()'
12779 echo " "
12780 $cat >try.c <<EOCP
12781 #include <sys/types.h>
12782 #ifdef I_FCNTL
12783 #include <fcntl.h>
12784 #endif
12785 #ifdef I_SYS_FILE
12786 #include <sys/file.h>
12787 #endif
12788 #$i_stdlib I_STDLIB
12789 #ifdef I_STDLIB
12790 #include <stdlib.h>
12791 #endif
12792 int main() {
12793         if(O_RDONLY);
12794 #ifdef O_TRUNC
12795         exit(0);
12796 #else
12797         exit(1);
12798 #endif
12799 }
12800 EOCP
12801 : check sys/file.h first to get FREAD on Sun
12802 if $test `./findhdr sys/file.h` && \
12803                 set try -DI_SYS_FILE && eval $compile; then
12804         h_sysfile=true;
12805         echo "<sys/file.h> defines the O_* constants..." >&4
12806         if $run ./try; then
12807                 echo "and you have the 3 argument form of open()." >&4
12808                 val="$define"
12809         else
12810                 echo "but not the 3 argument form of open().  Oh, well." >&4
12811                 val="$undef"
12812         fi
12813 elif $test `./findhdr fcntl.h` && \
12814                 set try -DI_FCNTL && eval $compile; then
12815         h_fcntl=true;
12816         echo "<fcntl.h> defines the O_* constants..." >&4
12817         if $run ./try; then
12818                 echo "and you have the 3 argument form of open()." >&4
12819                 val="$define"
12820         else
12821                 echo "but not the 3 argument form of open().  Oh, well." >&4
12822                 val="$undef"
12823         fi
12824 else
12825         val="$undef"
12826         echo "I can't find the O_* constant definitions!  You got problems." >&4
12827 fi
12828 set d_open3
12829 eval $setvar
12830 $rm_try
12831
12832 : see if this is a sys/file.h system
12833 val=''
12834 set sys/file.h val
12835 eval $inhdr
12836
12837 : do we need to include sys/file.h ?
12838 case "$val" in
12839 "$define")
12840         echo " "
12841         if $h_sysfile; then
12842                 val="$define"
12843                 echo "We'll be including <sys/file.h>." >&4
12844         else
12845                 val="$undef"
12846                 echo "We won't be including <sys/file.h>." >&4
12847         fi
12848         ;;
12849 *)
12850         h_sysfile=false
12851         ;;
12852 esac
12853 set i_sysfile
12854 eval $setvar
12855
12856 : see if fcntl.h is there
12857 val=''
12858 set fcntl.h val
12859 eval $inhdr
12860
12861 : see if we can include fcntl.h
12862 case "$val" in
12863 "$define")
12864         echo " "
12865         if $h_fcntl; then
12866                 val="$define"
12867                 echo "We'll be including <fcntl.h>." >&4
12868         else
12869                 val="$undef"
12870                 if $h_sysfile; then
12871         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12872                 else
12873                         echo "We won't be including <fcntl.h>." >&4
12874                 fi
12875         fi
12876         ;;
12877 *)
12878         h_fcntl=false
12879         val="$undef"
12880         ;;
12881 esac
12882 set i_fcntl
12883 eval $setvar
12884
12885 : see if fork exists
12886 set fork d_fork
12887 eval $inlibc
12888
12889 : see if pipe exists
12890 set pipe d_pipe
12891 eval $inlibc
12892
12893 : check for non-blocking I/O stuff
12894 case "$h_sysfile" in
12895 true) echo "#include <sys/file.h>" > head.c;;
12896 *)
12897        case "$h_fcntl" in
12898        true) echo "#include <fcntl.h>" > head.c;;
12899        *) echo "#include <sys/fcntl.h>" > head.c;;
12900        esac
12901        ;;
12902 esac
12903 echo " "
12904 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12905 case "$o_nonblock" in
12906 '')
12907         $cat head.c > try.c
12908         $cat >>try.c <<EOCP
12909 #include <stdio.h>
12910 #$i_stdlib I_STDLIB
12911 #ifdef I_STDLIB
12912 #include <stdlib.h>
12913 #endif
12914 #$i_fcntl I_FCNTL
12915 #ifdef I_FCNTL
12916 #include <fcntl.h>
12917 #endif
12918 int main() {
12919 #ifdef O_NONBLOCK
12920         printf("O_NONBLOCK\n");
12921         exit(0);
12922 #endif
12923 #ifdef O_NDELAY
12924         printf("O_NDELAY\n");
12925         exit(0);
12926 #endif
12927 #ifdef FNDELAY
12928         printf("FNDELAY\n");
12929         exit(0);
12930 #endif
12931         exit(0);
12932 }
12933 EOCP
12934         set try
12935         if eval $compile_ok; then
12936                 o_nonblock=`$run ./try`
12937                 case "$o_nonblock" in
12938                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12939                 *) echo "Seems like we can use $o_nonblock.";;
12940                 esac
12941         else
12942                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12943         fi
12944         ;;
12945 *) echo "Using $hint value $o_nonblock.";;
12946 esac
12947 $rm_try
12948
12949 echo " "
12950 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12951 case "$eagain" in
12952 '')
12953         case "$d_fork:$d_pipe" in
12954         define:define)
12955         $cat head.c > try.c
12956         $cat >>try.c <<EOCP
12957 #include <errno.h>
12958 #include <sys/types.h>
12959 #include <signal.h>
12960 #include <stdio.h>
12961 #$i_stdlib I_STDLIB
12962 #ifdef I_STDLIB
12963 #include <stdlib.h>
12964 #endif
12965 #$i_fcntl I_FCNTL
12966 #ifdef I_FCNTL
12967 #include <fcntl.h>
12968 #endif
12969 #define MY_O_NONBLOCK $o_nonblock
12970 #ifndef errno  /* XXX need better Configure test */
12971 extern int errno;
12972 #endif
12973 #$i_unistd I_UNISTD
12974 #ifdef I_UNISTD
12975 #include <unistd.h>
12976 #endif
12977 #$i_string I_STRING
12978 #ifdef I_STRING
12979 #include <string.h>
12980 #else
12981 #include <strings.h>
12982 #endif
12983 $signal_t blech(int x) { exit(3); }
12984 EOCP
12985         $cat >> try.c <<'EOCP'
12986 int main()
12987 {
12988         int pd[2];
12989         int pu[2];
12990         char buf[1];
12991         char string[100];
12992
12993         pipe(pd);       /* Down: child -> parent */
12994         pipe(pu);       /* Up: parent -> child */
12995         if (0 != fork()) {
12996                 int ret;
12997                 close(pd[1]);   /* Parent reads from pd[0] */
12998                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12999 #ifdef F_SETFL
13000                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13001                         exit(1);
13002 #else
13003                 exit(4);
13004 #endif
13005                 signal(SIGALRM, blech);
13006                 alarm(5);
13007                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13008                         exit(2);
13009                 sprintf(string, "%d\n", ret);
13010                 write(2, string, strlen(string));
13011                 alarm(0);
13012 #ifdef EAGAIN
13013                 if (errno == EAGAIN) {
13014                         printf("EAGAIN\n");
13015                         goto ok;
13016                 }
13017 #endif
13018 #ifdef EWOULDBLOCK
13019                 if (errno == EWOULDBLOCK)
13020                         printf("EWOULDBLOCK\n");
13021 #endif
13022         ok:
13023                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
13024                 sleep(2);                               /* Give it time to close our pipe */
13025                 alarm(5);
13026                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13027                 alarm(0);
13028                 sprintf(string, "%d\n", ret);
13029                 write(4, string, strlen(string));
13030                 exit(0);
13031         }
13032
13033         close(pd[0]);                   /* We write to pd[1] */
13034         close(pu[1]);                   /* We read from pu[0] */
13035         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
13036         close(pd[1]);                   /* Pipe pd is now fully closed! */
13037         exit(0);                                /* Bye bye, thank you for playing! */
13038 }
13039 EOCP
13040         set try
13041         if eval $compile_ok; then
13042                 echo "$startsh" >mtry
13043                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13044                 chmod +x mtry
13045                 $run ./mtry >/dev/null 2>&1
13046                 case $? in
13047                 0) eagain=`$cat try.out`;;
13048                 1) echo "Could not perform non-blocking setting!";;
13049                 2) echo "I did a successful read() for something that was not there!";;
13050                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13051                 4) echo "Could not find F_SETFL!";;
13052                 *) echo "Something terribly wrong happened during testing.";;
13053                 esac
13054                 rd_nodata=`$cat try.ret`
13055                 echo "A read() system call with no data present returns $rd_nodata."
13056                 case "$rd_nodata" in
13057                 0|-1) ;;
13058                 *)
13059                         echo "(That's peculiar, fixing that to be -1.)"
13060                         rd_nodata=-1
13061                         ;;
13062                 esac
13063                 case "$eagain" in
13064                 '')
13065                         echo "Forcing errno EAGAIN on read() with no data available."
13066                         eagain=EAGAIN
13067                         ;;
13068                 *)
13069                         echo "Your read() sets errno to $eagain when no data is available."
13070                         ;;
13071                 esac
13072                 status=`$cat try.err`
13073                 case "$status" in
13074                 0) echo "And it correctly returns 0 to signal EOF.";;
13075                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13076                 *) echo "However, your read() returns '$status' on EOF??";;
13077                 esac
13078                 val="$define"
13079                 if test "$status" = "$rd_nodata"; then
13080                         echo "WARNING: you can't distinguish between EOF and no data!"
13081                         val="$undef"
13082                 fi
13083         else
13084                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13085                 eagain=EAGAIN
13086         fi
13087         ;;
13088         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13089                 eagain=EAGAIN
13090                 val="$define"
13091                 ;;
13092         esac
13093         set d_eofnblk
13094         eval $setvar
13095         ;;
13096 *)
13097         echo "Using $hint value $eagain."
13098         echo "Your read() returns $rd_nodata when no data is present."
13099         case "$d_eofnblk" in
13100         "$define") echo "And you can see EOF because read() returns 0.";;
13101         "$undef") echo "But you can't see EOF status from read() returned value.";;
13102         *)
13103                 echo "(Assuming you can't see EOF status from read anyway.)"
13104                 d_eofnblk=$undef
13105                 ;;
13106         esac
13107         ;;
13108 esac
13109 $rm_try head.c mtry
13110
13111 : see if _ptr and _cnt from stdio act std
13112 echo " "
13113
13114 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13115         echo "(Looks like you have stdio.h from BSD.)"
13116         case "$stdio_ptr" in
13117         '') stdio_ptr='((fp)->_p)'
13118                 ptr_lval=$define
13119                 ;;
13120         *)      ptr_lval=$d_stdio_ptr_lval;;
13121         esac
13122         case "$stdio_cnt" in
13123         '') stdio_cnt='((fp)->_r)'
13124                 cnt_lval=$define
13125                 ;;
13126         *)      cnt_lval=$d_stdio_cnt_lval;;
13127         esac
13128         case "$stdio_base" in
13129         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13130         esac
13131         case "$stdio_bufsiz" in
13132         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13133         esac
13134 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13135         echo "(Looks like you have stdio.h from Linux.)"
13136         case "$stdio_ptr" in
13137         '') stdio_ptr='((fp)->_IO_read_ptr)'
13138                 ptr_lval=$define
13139                 ;;
13140         *)      ptr_lval=$d_stdio_ptr_lval;;
13141         esac
13142         case "$stdio_cnt" in
13143         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13144                 cnt_lval=$undef
13145                 ;;
13146         *)      cnt_lval=$d_stdio_cnt_lval;;
13147         esac
13148         case "$stdio_base" in
13149         '') stdio_base='((fp)->_IO_read_base)';;
13150         esac
13151         case "$stdio_bufsiz" in
13152         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13153         esac
13154 else
13155         case "$stdio_ptr" in
13156         '') stdio_ptr='((fp)->_ptr)'
13157                 ptr_lval=$define
13158                 ;;
13159         *)      ptr_lval=$d_stdio_ptr_lval;;
13160         esac
13161         case "$stdio_cnt" in
13162         '') stdio_cnt='((fp)->_cnt)'
13163                 cnt_lval=$define
13164                 ;;
13165         *)      cnt_lval=$d_stdio_cnt_lval;;
13166         esac
13167         case "$stdio_base" in
13168         '') stdio_base='((fp)->_base)';;
13169         esac
13170         case "$stdio_bufsiz" in
13171         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13172         esac
13173 fi
13174
13175 : test whether _ptr and _cnt really work
13176 echo "Checking how std your stdio is..." >&4
13177 $cat >try.c <<EOP
13178 #include <stdio.h>
13179 #$i_stdlib I_STDLIB
13180 #ifdef I_STDLIB
13181 #include <stdlib.h>
13182 #endif
13183 #define FILE_ptr(fp)    $stdio_ptr
13184 #define FILE_cnt(fp)    $stdio_cnt
13185 int main() {
13186         FILE *fp = fopen("try.c", "r");
13187         char c = getc(fp);
13188         if (
13189                 18 <= FILE_cnt(fp) &&
13190                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13191         )
13192                 exit(0);
13193         exit(1);
13194 }
13195 EOP
13196 val="$undef"
13197 set try
13198 if eval $compile && $to try.c; then
13199         if $run ./try; then
13200                 echo "Your stdio acts pretty std."
13201                 val="$define"
13202         else
13203                 echo "Your stdio isn't very std."
13204         fi
13205 else
13206         echo "Your stdio doesn't appear very std."
13207 fi
13208 $rm_try
13209
13210 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13211 # direct buffer manipulation no longer works.  The Configure tests
13212 # should be changed to correctly detect this, but until then,
13213 # the following check should at least let perl compile and run.
13214 # (This quick fix should be updated before 5.8.1.)
13215 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13216 # A. Dougherty, June 3, 2002.
13217 case "$d_gnulibc" in
13218 $define)
13219         case "$gnulibc_version" in
13220         2.[01]*)  ;;
13221         2.2) ;;
13222         2.2.[0-9]) ;;
13223         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13224                 val="$undef"
13225                 ;;
13226         esac
13227         ;;
13228 esac
13229 set d_stdstdio
13230 eval $setvar
13231
13232 : Can _ptr be used as an lvalue?
13233 case "$d_stdstdio$ptr_lval" in
13234 $define$define) val=$define ;;
13235 *) val=$undef ;;
13236 esac
13237 set d_stdio_ptr_lval
13238 eval $setvar
13239
13240 : Can _cnt be used as an lvalue?
13241 case "$d_stdstdio$cnt_lval" in
13242 $define$define) val=$define ;;
13243 *) val=$undef ;;
13244 esac
13245 set d_stdio_cnt_lval
13246 eval $setvar
13247
13248
13249 : test whether setting _ptr sets _cnt as a side effect
13250 d_stdio_ptr_lval_sets_cnt="$undef"
13251 d_stdio_ptr_lval_nochange_cnt="$undef"
13252 case "$d_stdio_ptr_lval$d_stdstdio" in
13253 $define$define)
13254         echo "Checking to see what happens if we set the stdio ptr..." >&4
13255 $cat >try.c <<EOP
13256 #include <stdio.h>
13257 /* Can we scream? */
13258 /* Eat dust sed :-) */
13259 /* In the buffer space, no one can hear you scream. */
13260 #$i_stdlib I_STDLIB
13261 #ifdef I_STDLIB
13262 #include <stdlib.h>
13263 #endif
13264 #define FILE_ptr(fp)    $stdio_ptr
13265 #define FILE_cnt(fp)    $stdio_cnt
13266 #include <sys/types.h>
13267 int main() {
13268         FILE *fp = fopen("try.c", "r");
13269         int c;
13270         char *ptr;
13271         size_t cnt;
13272         if (!fp) {
13273             puts("Fail even to read");
13274             exit(1);
13275         }
13276         c = getc(fp); /* Read away the first # */
13277         if (c == EOF) {
13278             puts("Fail even to read");
13279             exit(1);
13280         }
13281         if (!(
13282                 18 <= FILE_cnt(fp) &&
13283                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13284         )) {
13285                 puts("Fail even to read");
13286                 exit (1);
13287         }
13288         ptr = (char*) FILE_ptr(fp);
13289         cnt = (size_t)FILE_cnt(fp);
13290
13291         FILE_ptr(fp) += 42;
13292
13293         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13294                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13295                 exit (1);
13296         }
13297         if (FILE_cnt(fp) <= 20) {
13298                 printf ("Fail (<20 chars to test)");
13299                 exit (1);
13300         }
13301         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13302                 puts("Fail compare");
13303                 exit (1);
13304         }
13305         if (cnt == FILE_cnt(fp)) {
13306                 puts("Pass_unchanged");
13307                 exit (0);
13308         }
13309         if (FILE_cnt(fp) == (cnt - 42)) {
13310                 puts("Pass_changed");
13311                 exit (0);
13312         }
13313         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13314         return 1;
13315
13316 }
13317 EOP
13318         set try
13319         if eval $compile && $to try.c; then
13320                 case `$run ./try` in
13321                 Pass_changed)
13322                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13323                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13324                 Pass_unchanged)
13325                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13326                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13327                 Fail*)
13328                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13329                 *)
13330                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13331         esac
13332         else
13333                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13334         fi
13335         $rm_try
13336         ;;
13337 esac
13338
13339 : see if _base is also standard
13340 val="$undef"
13341 case "$d_stdstdio" in
13342 $define)
13343         $cat >try.c <<EOP
13344 #include <stdio.h>
13345 #$i_stdlib I_STDLIB
13346 #ifdef I_STDLIB
13347 #include <stdlib.h>
13348 #endif
13349 #define FILE_base(fp)   $stdio_base
13350 #define FILE_bufsiz(fp) $stdio_bufsiz
13351 int main() {
13352         FILE *fp = fopen("try.c", "r");
13353         char c = getc(fp);
13354         if (
13355                 19 <= FILE_bufsiz(fp) &&
13356                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13357         )
13358                 exit(0);
13359         exit(1);
13360 }
13361 EOP
13362         set try
13363         if eval $compile && $to try.c; then
13364                 if $run ./try; then
13365                         echo "And its _base field acts std."
13366                         val="$define"
13367                 else
13368                         echo "But its _base field isn't std."
13369                 fi
13370         else
13371                 echo "However, it seems to be lacking the _base field."
13372         fi
13373         $rm_try
13374         ;;
13375 esac
13376 set d_stdiobase
13377 eval $setvar
13378
13379 : see if fast_stdio exists
13380 val="$undef"
13381 case "$d_stdstdio:$d_stdio_ptr_lval" in
13382 "$define:$define")
13383         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13384         *$define*)
13385                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13386                 val="$define"
13387                 ;;
13388         esac
13389         ;;
13390 esac
13391 set d_faststdio
13392 eval $setvar
13393
13394
13395
13396 : see if fchdir exists
13397 set fchdir d_fchdir
13398 eval $inlibc
13399
13400 : see if fchmod exists
13401 set fchmod d_fchmod
13402 eval $inlibc
13403
13404 : see if fchown exists
13405 set fchown d_fchown
13406 eval $inlibc
13407
13408 : see if this is an fcntl system
13409 set fcntl d_fcntl
13410 eval $inlibc
13411
13412 : See if fcntl-based locking works.
13413 echo " "
13414 $cat >try.c <<EOCP
13415 #$i_stdlib I_STDLIB
13416 #ifdef I_STDLIB
13417 #include <stdlib.h>
13418 #endif
13419 #include <unistd.h>
13420 #include <fcntl.h>
13421 #include <signal.h>
13422 $signal_t blech(int x) { exit(3); }
13423 int main() {
13424 #if defined(F_SETLK) && defined(F_SETLKW)
13425      struct flock flock;
13426      int retval, fd;
13427      fd = open("try.c", O_RDONLY);
13428      flock.l_type = F_RDLCK;
13429      flock.l_whence = SEEK_SET;
13430      flock.l_start = flock.l_len = 0;
13431      signal(SIGALRM, blech);
13432      alarm(10);
13433      retval = fcntl(fd, F_SETLK, &flock);
13434      close(fd);
13435      (retval < 0 ? exit(2) : exit(0));
13436 #else
13437      exit(2);
13438 #endif
13439 }
13440 EOCP
13441 echo "Checking if fcntl-based file locking works... "
13442 case "$d_fcntl" in
13443 "$define")
13444         set try
13445         if eval $compile_ok; then
13446                 if $run ./try; then
13447                         echo "Yes, it seems to work."
13448                         val="$define"
13449                 else
13450                         echo "Nope, it didn't work."
13451                         val="$undef"
13452                         case "$?" in
13453                         3) $cat >&4 <<EOM
13454 ***
13455 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13456 *** This is (almost) impossible.
13457 *** If your NFS lock daemons are not feeling well, something like
13458 *** this may happen, please investigate.  Cannot continue, aborting.
13459 ***
13460 EOM
13461                                 exit 1
13462                                 ;;
13463                         esac
13464                 fi
13465         else
13466                 echo "I'm unable to compile the test program, so I'll assume not."
13467                 val="$undef"
13468         fi
13469         ;;
13470 *) val="$undef";
13471         echo "Nope, since you don't even have fcntl()."
13472         ;;
13473 esac
13474 set d_fcntl_can_lock
13475 eval $setvar
13476 $rm_try
13477
13478 : check for fd_set items
13479 $cat <<EOM
13480
13481 Checking to see how well your C compiler handles fd_set and friends ...
13482 EOM
13483 $cat >try.c <<EOCP
13484 #$i_stdlib I_STDLIB
13485 #ifdef I_STDLIB
13486 #include <stdlib.h>
13487 #endif
13488 #$i_systime I_SYS_TIME
13489 #$i_sysselct I_SYS_SELECT
13490 #$d_socket HAS_SOCKET
13491 #include <sys/types.h>
13492 #ifdef HAS_SOCKET
13493 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13494 #endif
13495 #ifdef I_SYS_TIME
13496 #include <sys/time.h>
13497 #endif
13498 #ifdef I_SYS_SELECT
13499 #include <sys/select.h>
13500 #endif
13501 int main() {
13502         fd_set fds;
13503
13504 #ifdef TRYBITS
13505         if(fds.fds_bits);
13506 #endif
13507
13508 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13509         exit(0);
13510 #else
13511         exit(1);
13512 #endif
13513 }
13514 EOCP
13515 set try -DTRYBITS
13516 if eval $compile; then
13517         d_fds_bits="$define"
13518         d_fd_set="$define"
13519         echo "Well, your system knows about the normal fd_set typedef..." >&4
13520         if $run ./try; then
13521                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13522                 d_fd_macros="$define"
13523         else
13524                 $cat >&4 <<'EOM'
13525 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13526 EOM
13527                 d_fd_macros="$undef"
13528         fi
13529 else
13530         $cat <<'EOM'
13531 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13532 EOM
13533         set try
13534         if eval $compile; then
13535                 d_fds_bits="$undef"
13536                 d_fd_set="$define"
13537                 echo "Well, your system has some sort of fd_set available..." >&4
13538                 if $run ./try; then
13539                         echo "and you have the normal fd_set macros." >&4
13540                         d_fd_macros="$define"
13541                 else
13542                         $cat <<'EOM'
13543 but not the normal fd_set macros!  Gross!  More work for me...
13544 EOM
13545                         d_fd_macros="$undef"
13546                 fi
13547         else
13548         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13549                 d_fd_set="$undef"
13550                 d_fds_bits="$undef"
13551                 d_fd_macros="$undef"
13552         fi
13553 fi
13554 $rm_try
13555
13556 : see if fgetpos exists
13557 set fgetpos d_fgetpos
13558 eval $inlibc
13559
13560 : see if finite exists
13561 set finite d_finite
13562 eval $inlibc
13563
13564 : see if finitel exists
13565 set finitel d_finitel
13566 eval $inlibc
13567
13568 : see if flock exists
13569 set flock d_flock
13570 eval $inlibc
13571
13572 : see if prototype for flock is available
13573 echo " "
13574 set d_flockproto flock $i_sysfile sys/file.h
13575 eval $hasproto
13576
13577 : see if fp_class exists
13578 set fp_class d_fp_class
13579 eval $inlibc
13580
13581 : see if pathconf exists
13582 set pathconf d_pathconf
13583 eval $inlibc
13584
13585 : see if fpathconf exists
13586 set fpathconf d_fpathconf
13587 eval $inlibc
13588
13589 : see if fpclass exists
13590 set fpclass d_fpclass
13591 eval $inlibc
13592
13593 : see if fpclassify exists
13594 set fpclassify d_fpclassify
13595 eval $inlibc
13596
13597 : see if fpclassl exists
13598 set fpclassl d_fpclassl
13599 eval $inlibc
13600
13601 : check for fpos64_t
13602 echo " "
13603 echo "Checking to see if you have fpos64_t..." >&4
13604 $cat >try.c <<EOCP
13605 #include <stdio.h>
13606 int main() { fpos64_t x = 7; }
13607 EOCP
13608 set try
13609 if eval $compile; then
13610         val="$define"
13611         echo "You have fpos64_t."
13612 else
13613         val="$undef"
13614         echo "You do not have fpos64_t."
13615         case "$fpossize" in
13616         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13617         esac
13618 fi
13619 $rm_try
13620 set d_fpos64_t
13621 eval $setvar
13622
13623 : see if frexpl exists
13624 set frexpl d_frexpl
13625 eval $inlibc
13626
13627 : see if this is a sys/param system
13628 set sys/param.h i_sysparam
13629 eval $inhdr
13630
13631 : see if this is a sys/mount.h system
13632 set sys/mount.h i_sysmount
13633 eval $inhdr
13634
13635 : Check for fs_data_s
13636 echo " "
13637 echo "Checking to see if your system supports struct fs_data..." >&4
13638 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13639 eval $hasstruct
13640 case "$d_fs_data_s" in
13641 "$define")      echo "Yes, it does."   ;;
13642 *)              echo "No, it doesn't." ;;
13643 esac
13644
13645 : see if fseeko exists
13646 set fseeko d_fseeko
13647 eval $inlibc
13648 case "$longsize" in
13649 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13650 esac
13651
13652 : see if fsetpos exists
13653 set fsetpos d_fsetpos
13654 eval $inlibc
13655
13656 : see if fstatfs exists
13657 set fstatfs d_fstatfs
13658 eval $inlibc
13659
13660 : see if statvfs exists
13661 set statvfs d_statvfs
13662 eval $inlibc
13663
13664 : see if fstatvfs exists
13665 set fstatvfs d_fstatvfs
13666 eval $inlibc
13667
13668
13669 : see if fsync exists
13670 set fsync d_fsync
13671 eval $inlibc
13672
13673 : see if ftello exists
13674 set ftello d_ftello
13675 eval $inlibc
13676 case "$longsize" in
13677 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13678 esac
13679
13680 : check for a working futimes
13681 d_futimes="$undef"
13682 echo " "
13683 echo "Checking if you have a working futimes()" >&4
13684 $cat >try.c <<EOCP
13685 #include <stdio.h>
13686 #include <sys/time.h>
13687 #include <errno.h>
13688 #include <fcntl.h>
13689
13690 int main ()
13691 {
13692     int fd, rv;
13693     fd = open ("try.c", O_RDWR);
13694     if (-1 == fd) exit (1);
13695     rv = futimes (fd, NULL);
13696     exit (rv == -1 ? errno : 0);
13697 }
13698 EOCP
13699 set try
13700 if eval $compile; then
13701     `$run ./try`
13702     rc=$?
13703     case "$rc" in
13704         0)  echo "Yes, you have" >&4
13705             d_futimes="$define"
13706             ;;
13707         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13708             ;;
13709     esac
13710 else
13711     echo "No, it does not (probably harmless)" >&4
13712 fi
13713 $rm_try
13714
13715 : see if ndbm.h is available
13716 set ndbm.h i_ndbm
13717 eval $inhdr
13718 : Compatibility location for RedHat 7.1
13719 set gdbm/ndbm.h i_gdbmndbm
13720 eval $inhdr
13721 : Compatibility location for Debian 4.0
13722 set gdbm-ndbm.h i_gdbm_ndbm
13723 eval $inhdr
13724
13725 val="$undef"
13726 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13727         : see if dbm_open exists
13728         set dbm_open d_dbm_open
13729         eval $inlibc
13730         case "$d_dbm_open" in
13731         $undef)
13732                 i_ndbm="$undef"
13733                 i_gdbmndbm="$undef"
13734                 i_gdbm_ndbm="$undef"
13735                 echo "We won't be including <ndbm.h>"
13736                 val="$undef"
13737                 ;;
13738         *) val="$define"
13739            ;;
13740         esac
13741 fi
13742 set d_ndbm
13743 eval $setvar
13744
13745 ndbm_hdr_protochk='name=$1; hdr=$2;
13746 eval "ihdr=\$""i_$name";
13747 val="$undef";
13748 if $test "$ihdr" = "$define"; then
13749         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13750         case "$d_cplusplus" in
13751         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13752         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13753         esac;
13754         case "$val" in
13755         $define) $echo "Your <$hdr> seems to have prototypes";;
13756         *) $echo "Your <$hdr> does not seem to have prototypes";;
13757         esac;
13758 fi;
13759 set "d_${name}_h_uses_prototypes";
13760 eval $setvar'
13761
13762 set ndbm ndbm.h
13763 eval $ndbm_hdr_protochk
13764 set gdbmndbm gdbm/ndbm.h
13765 eval $ndbm_hdr_protochk
13766 set gdbm_ndbm gdbm-ndbm.h
13767 eval $ndbm_hdr_protochk
13768
13769 : see if getaddrinfo exists
13770 set getaddrinfo d_getaddrinfo
13771 eval $inlibc
13772
13773 : see if getcwd exists
13774 set getcwd d_getcwd
13775 eval $inlibc
13776
13777 : see if getespwnam exists
13778 set getespwnam d_getespwnam
13779 eval $inlibc
13780
13781 : see if getfsstat exists
13782 set getfsstat d_getfsstat
13783 eval $inlibc
13784
13785 : see if getgrent exists
13786 set getgrent d_getgrent
13787 eval $inlibc
13788
13789 : see if getgrent_r exists
13790 set getgrent_r d_getgrent_r
13791 eval $inlibc
13792 case "$d_getgrent_r" in
13793 "$define")
13794         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13795         case "$d_getgrent_r_proto:$usethreads" in
13796         ":define")      d_getgrent_r_proto=define
13797                 set d_getgrent_r_proto getgrent_r $hdrs
13798                 eval $hasproto ;;
13799         *)      ;;
13800         esac
13801         case "$d_getgrent_r_proto" in
13802         define)
13803         case "$getgrent_r_proto" in
13804         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13805         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13806         esac
13807         case "$getgrent_r_proto" in
13808         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13809         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13810         esac
13811         case "$getgrent_r_proto" in
13812         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13813         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13814         esac
13815         case "$getgrent_r_proto" in
13816         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13817         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13818         esac
13819         case "$getgrent_r_proto" in
13820         ''|0) try='int getgrent_r(struct group*, char*, int);'
13821         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13822         esac
13823         case "$getgrent_r_proto" in
13824         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13825         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13826         esac
13827         case "$getgrent_r_proto" in
13828         ''|0)   d_getgrent_r=undef
13829                 getgrent_r_proto=0
13830                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13831         * )     case "$getgrent_r_proto" in
13832                 REENTRANT_PROTO*) ;;
13833                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13834                 esac
13835                 echo "Prototype: $try" ;;
13836         esac
13837         ;;
13838         *)      case "$usethreads" in
13839                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13840                 esac
13841                 d_getgrent_r=undef
13842                 getgrent_r_proto=0
13843                 ;;
13844         esac
13845         ;;
13846 *)      getgrent_r_proto=0
13847         ;;
13848 esac
13849
13850 : see if getgrgid_r exists
13851 set getgrgid_r d_getgrgid_r
13852 eval $inlibc
13853 case "$d_getgrgid_r" in
13854 "$define")
13855         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13856         case "$d_getgrgid_r_proto:$usethreads" in
13857         ":define")      d_getgrgid_r_proto=define
13858                 set d_getgrgid_r_proto getgrgid_r $hdrs
13859                 eval $hasproto ;;
13860         *)      ;;
13861         esac
13862         case "$d_getgrgid_r_proto" in
13863         define)
13864         case "$getgrgid_r_proto" in
13865         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13866         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13867         esac
13868         case "$getgrgid_r_proto" in
13869         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13870         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13871         esac
13872         case "$getgrgid_r_proto" in
13873         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13874         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13875         esac
13876         case "$getgrgid_r_proto" in
13877         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13878         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13879         esac
13880         case "$getgrgid_r_proto" in
13881         ''|0)   d_getgrgid_r=undef
13882                 getgrgid_r_proto=0
13883                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13884         * )     case "$getgrgid_r_proto" in
13885                 REENTRANT_PROTO*) ;;
13886                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13887                 esac
13888                 echo "Prototype: $try" ;;
13889         esac
13890         ;;
13891         *)      case "$usethreads" in
13892                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13893                 esac
13894                 d_getgrgid_r=undef
13895                 getgrgid_r_proto=0
13896                 ;;
13897         esac
13898         ;;
13899 *)      getgrgid_r_proto=0
13900         ;;
13901 esac
13902
13903 : see if getgrnam_r exists
13904 set getgrnam_r d_getgrnam_r
13905 eval $inlibc
13906 case "$d_getgrnam_r" in
13907 "$define")
13908         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13909         case "$d_getgrnam_r_proto:$usethreads" in
13910         ":define")      d_getgrnam_r_proto=define
13911                 set d_getgrnam_r_proto getgrnam_r $hdrs
13912                 eval $hasproto ;;
13913         *)      ;;
13914         esac
13915         case "$d_getgrnam_r_proto" in
13916         define)
13917         case "$getgrnam_r_proto" in
13918         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13919         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13920         esac
13921         case "$getgrnam_r_proto" in
13922         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13923         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13924         esac
13925         case "$getgrnam_r_proto" in
13926         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13927         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13928         esac
13929         case "$getgrnam_r_proto" in
13930         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13931         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13932         esac
13933         case "$getgrnam_r_proto" in
13934         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13935         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13936         esac
13937         case "$getgrnam_r_proto" in
13938         ''|0)   d_getgrnam_r=undef
13939                 getgrnam_r_proto=0
13940                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13941         * )     case "$getgrnam_r_proto" in
13942                 REENTRANT_PROTO*) ;;
13943                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13944                 esac
13945                 echo "Prototype: $try" ;;
13946         esac
13947         ;;
13948         *)      case "$usethreads" in
13949                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13950                 esac
13951                 d_getgrnam_r=undef
13952                 getgrnam_r_proto=0
13953                 ;;
13954         esac
13955         ;;
13956 *)      getgrnam_r_proto=0
13957         ;;
13958 esac
13959
13960 : see if gethostbyaddr exists
13961 set gethostbyaddr d_gethbyaddr
13962 eval $inlibc
13963
13964 : see if gethostbyname exists
13965 set gethostbyname d_gethbyname
13966 eval $inlibc
13967
13968 : see if gethostent exists
13969 set gethostent d_gethent
13970 eval $inlibc
13971
13972 : see how we will look up host name
13973 echo " "
13974 call=''
13975 if set gethostname val -f d_gethname; eval $csym; $val; then
13976         echo 'gethostname() found.' >&4
13977         d_gethname="$define"
13978         call=gethostname
13979 fi
13980 if set uname val -f d_uname; eval $csym; $val; then
13981         if ./xenix; then
13982                 $cat <<'EOM'
13983 uname() was found, but you're running xenix, and older versions of xenix
13984 have a broken uname(). If you don't really know whether your xenix is old
13985 enough to have a broken system call, use the default answer.
13986
13987 EOM
13988                 dflt=y
13989                 case "$d_uname" in
13990                 "$define") dflt=n;;
13991                 esac
13992                 rp='Is your uname() broken?'
13993                 . ./myread
13994                 case "$ans" in
13995                 n*) d_uname="$define"; call=uname;;
13996                 esac
13997         else
13998                 echo 'uname() found.' >&4
13999                 d_uname="$define"
14000                 case "$call" in
14001                 '') call=uname ;;
14002                 esac
14003         fi
14004 fi
14005 case "$d_gethname" in
14006 '') d_gethname="$undef";;
14007 esac
14008 case "$d_uname" in
14009 '') d_uname="$undef";;
14010 esac
14011 case "$d_uname$d_gethname" in
14012 *define*)
14013         dflt=n
14014         cat <<EOM
14015
14016 Every now and then someone has a $call() that lies about the hostname
14017 but can't be fixed for political or economic reasons.  If you wish, I can
14018 pretend $call() isn't there and maybe compute hostname at run-time
14019 thanks to the '$phostname' command.
14020
14021 EOM
14022         rp="Shall I ignore $call() from now on?"
14023         . ./myread
14024         case "$ans" in
14025         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14026         esac;;
14027 esac
14028 case "$phostname" in
14029 '') aphostname='';;
14030 *) case "$aphostname" in
14031         /*) ;;
14032         *) set X $phostname
14033                 shift
14034                 file=$1
14035                 shift
14036                 file=`./loc $file $file $pth`
14037                 aphostname=`echo $file $*`
14038                 ;;
14039         esac
14040         ;;
14041 esac
14042 case "$d_uname$d_gethname" in
14043 *define*) ;;
14044 *)
14045         case "$phostname" in
14046         '')
14047                 echo "There will be no way for $package to get your hostname." >&4;;
14048         *)
14049         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14050                 ;;
14051         esac;;
14052 esac
14053 case "$d_phostname" in
14054 '') d_phostname="$undef";;
14055 esac
14056
14057 : see if gethostbyaddr_r exists
14058 set gethostbyaddr_r d_gethostbyaddr_r
14059 eval $inlibc
14060 case "$d_gethostbyaddr_r" in
14061 "$define")
14062         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14063         case "$d_gethostbyaddr_r_proto:$usethreads" in
14064         ":define")      d_gethostbyaddr_r_proto=define
14065                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14066                 eval $hasproto ;;
14067         *)      ;;
14068         esac
14069         case "$d_gethostbyaddr_r_proto" in
14070         define)
14071         case "$gethostbyaddr_r_proto" in
14072         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14073         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14074         esac
14075         case "$gethostbyaddr_r_proto" in
14076         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14077         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14078         esac
14079         case "$gethostbyaddr_r_proto" in
14080         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14081         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14082         esac
14083         case "$gethostbyaddr_r_proto" in
14084         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14085         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14086         esac
14087         case "$gethostbyaddr_r_proto" in
14088         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14089         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14090         esac
14091         case "$gethostbyaddr_r_proto" in
14092         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14093         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14094         esac
14095         case "$gethostbyaddr_r_proto" in
14096         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14097         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14098         esac
14099         case "$gethostbyaddr_r_proto" in
14100         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14101         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14102         esac
14103         case "$gethostbyaddr_r_proto" in
14104         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14105         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14106         esac
14107         case "$gethostbyaddr_r_proto" in
14108         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14109         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14110         esac
14111         case "$gethostbyaddr_r_proto" in
14112         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14113         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14114         esac
14115         case "$gethostbyaddr_r_proto" in
14116         ''|0)   d_gethostbyaddr_r=undef
14117                 gethostbyaddr_r_proto=0
14118                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14119         * )     case "$gethostbyaddr_r_proto" in
14120                 REENTRANT_PROTO*) ;;
14121                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14122                 esac
14123                 echo "Prototype: $try" ;;
14124         esac
14125         ;;
14126         *)      case "$usethreads" in
14127                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14128                 esac
14129                 d_gethostbyaddr_r=undef
14130                 gethostbyaddr_r_proto=0
14131                 ;;
14132         esac
14133         ;;
14134 *)      gethostbyaddr_r_proto=0
14135         ;;
14136 esac
14137
14138 : see if gethostbyname_r exists
14139 set gethostbyname_r d_gethostbyname_r
14140 eval $inlibc
14141 case "$d_gethostbyname_r" in
14142 "$define")
14143         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14144         case "$d_gethostbyname_r_proto:$usethreads" in
14145         ":define")      d_gethostbyname_r_proto=define
14146                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14147                 eval $hasproto ;;
14148         *)      ;;
14149         esac
14150         case "$d_gethostbyname_r_proto" in
14151         define)
14152         case "$gethostbyname_r_proto" in
14153         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14154         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14155         esac
14156         case "$gethostbyname_r_proto" in
14157         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14158         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14159         esac
14160         case "$gethostbyname_r_proto" in
14161         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14162         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14163         esac
14164         case "$gethostbyname_r_proto" in
14165         ''|0)   d_gethostbyname_r=undef
14166                 gethostbyname_r_proto=0
14167                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14168         * )     case "$gethostbyname_r_proto" in
14169                 REENTRANT_PROTO*) ;;
14170                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14171                 esac
14172                 echo "Prototype: $try" ;;
14173         esac
14174         ;;
14175         *)      case "$usethreads" in
14176                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14177                 esac
14178                 d_gethostbyname_r=undef
14179                 gethostbyname_r_proto=0
14180                 ;;
14181         esac
14182         ;;
14183 *)      gethostbyname_r_proto=0
14184         ;;
14185 esac
14186
14187 : see if gethostent_r exists
14188 set gethostent_r d_gethostent_r
14189 eval $inlibc
14190 case "$d_gethostent_r" in
14191 "$define")
14192         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14193         case "$d_gethostent_r_proto:$usethreads" in
14194         ":define")      d_gethostent_r_proto=define
14195                 set d_gethostent_r_proto gethostent_r $hdrs
14196                 eval $hasproto ;;
14197         *)      ;;
14198         esac
14199         case "$d_gethostent_r_proto" in
14200         define)
14201         case "$gethostent_r_proto" in
14202         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14203         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14204         esac
14205         case "$gethostent_r_proto" in
14206         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14207         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14208         esac
14209         case "$gethostent_r_proto" in
14210         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14211         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14212         esac
14213         case "$gethostent_r_proto" in
14214         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14215         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14216         esac
14217         case "$gethostent_r_proto" in
14218         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14219         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14220         esac
14221         case "$gethostent_r_proto" in
14222         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14223         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14224         esac
14225         case "$gethostent_r_proto" in
14226         ''|0)   d_gethostent_r=undef
14227                 gethostent_r_proto=0
14228                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14229         * )     case "$gethostent_r_proto" in
14230                 REENTRANT_PROTO*) ;;
14231                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14232                 esac
14233                 echo "Prototype: $try" ;;
14234         esac
14235         ;;
14236         *)      case "$usethreads" in
14237                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14238                 esac
14239                 d_gethostent_r=undef
14240                 gethostent_r_proto=0
14241                 ;;
14242         esac
14243         ;;
14244 *)      gethostent_r_proto=0
14245         ;;
14246 esac
14247
14248 : see if prototypes for various gethostxxx netdb.h functions are available
14249 echo " "
14250 set d_gethostprotos gethostent $i_netdb netdb.h
14251 eval $hasproto
14252
14253 : see if getitimer exists
14254 set getitimer d_getitimer
14255 eval $inlibc
14256
14257 : see if getlogin exists
14258 set getlogin d_getlogin
14259 eval $inlibc
14260
14261 : see if getlogin_r exists
14262 set getlogin_r d_getlogin_r
14263 eval $inlibc
14264 case "$d_getlogin_r" in
14265 "$define")
14266         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14267         case "$d_getlogin_r_proto:$usethreads" in
14268         ":define")      d_getlogin_r_proto=define
14269                 set d_getlogin_r_proto getlogin_r $hdrs
14270                 eval $hasproto ;;
14271         *)      ;;
14272         esac
14273         case "$d_getlogin_r_proto" in
14274         define)
14275         case "$getlogin_r_proto" in
14276         ''|0) try='int getlogin_r(char*, size_t);'
14277         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14278         esac
14279         case "$getlogin_r_proto" in
14280         ''|0) try='int getlogin_r(char*, int);'
14281         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14282         esac
14283         case "$getlogin_r_proto" in
14284         ''|0) try='char* getlogin_r(char*, size_t);'
14285         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14286         esac
14287         case "$getlogin_r_proto" in
14288         ''|0) try='char* getlogin_r(char*, int);'
14289         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14290         esac
14291         case "$getlogin_r_proto" in
14292         ''|0)   d_getlogin_r=undef
14293                 getlogin_r_proto=0
14294                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14295         * )     case "$getlogin_r_proto" in
14296                 REENTRANT_PROTO*) ;;
14297                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14298                 esac
14299                 echo "Prototype: $try" ;;
14300         esac
14301         ;;
14302         *)      case "$usethreads" in
14303                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14304                 esac
14305                 d_getlogin_r=undef
14306                 getlogin_r_proto=0
14307                 ;;
14308         esac
14309         ;;
14310 *)      getlogin_r_proto=0
14311         ;;
14312 esac
14313
14314 : see if getmnt exists
14315 set getmnt d_getmnt
14316 eval $inlibc
14317
14318 : see if getmntent exists
14319 set getmntent d_getmntent
14320 eval $inlibc
14321
14322 : see if getnameinfo exists
14323 set getnameinfo d_getnameinfo
14324 eval $inlibc
14325
14326 : see if getnetbyaddr exists
14327 set getnetbyaddr d_getnbyaddr
14328 eval $inlibc
14329
14330 : see if getnetbyname exists
14331 set getnetbyname d_getnbyname
14332 eval $inlibc
14333
14334 : see if getnetent exists
14335 set getnetent d_getnent
14336 eval $inlibc
14337
14338 : see if getnetbyaddr_r exists
14339 set getnetbyaddr_r d_getnetbyaddr_r
14340 eval $inlibc
14341 case "$d_getnetbyaddr_r" in
14342 "$define")
14343         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14344         case "$d_getnetbyaddr_r_proto:$usethreads" in
14345         ":define")      d_getnetbyaddr_r_proto=define
14346                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14347                 eval $hasproto ;;
14348         *)      ;;
14349         esac
14350         case "$d_getnetbyaddr_r_proto" in
14351         define)
14352         case "$getnetbyaddr_r_proto" in
14353         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14354         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14355         esac
14356         case "$getnetbyaddr_r_proto" in
14357         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14358         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14359         esac
14360         case "$getnetbyaddr_r_proto" in
14361         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14362         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14363         esac
14364         case "$getnetbyaddr_r_proto" in
14365         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14366         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14367         esac
14368         case "$getnetbyaddr_r_proto" in
14369         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14370         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14371         esac
14372         case "$getnetbyaddr_r_proto" in
14373         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14374         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14375         esac
14376         case "$getnetbyaddr_r_proto" in
14377         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14378         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14379         esac
14380         case "$getnetbyaddr_r_proto" in
14381         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14382         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14383         esac
14384         case "$getnetbyaddr_r_proto" in
14385         ''|0)   d_getnetbyaddr_r=undef
14386                 getnetbyaddr_r_proto=0
14387                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14388         * )     case "$getnetbyaddr_r_proto" in
14389                 REENTRANT_PROTO*) ;;
14390                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14391                 esac
14392                 echo "Prototype: $try" ;;
14393         esac
14394         ;;
14395         *)      case "$usethreads" in
14396                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14397                 esac
14398                 d_getnetbyaddr_r=undef
14399                 getnetbyaddr_r_proto=0
14400                 ;;
14401         esac
14402         ;;
14403 *)      getnetbyaddr_r_proto=0
14404         ;;
14405 esac
14406
14407 : see if getnetbyname_r exists
14408 set getnetbyname_r d_getnetbyname_r
14409 eval $inlibc
14410 case "$d_getnetbyname_r" in
14411 "$define")
14412         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14413         case "$d_getnetbyname_r_proto:$usethreads" in
14414         ":define")      d_getnetbyname_r_proto=define
14415                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14416                 eval $hasproto ;;
14417         *)      ;;
14418         esac
14419         case "$d_getnetbyname_r_proto" in
14420         define)
14421         case "$getnetbyname_r_proto" in
14422         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14423         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14424         esac
14425         case "$getnetbyname_r_proto" in
14426         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14427         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14428         esac
14429         case "$getnetbyname_r_proto" in
14430         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14431         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14432         esac
14433         case "$getnetbyname_r_proto" in
14434         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14435         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14436         esac
14437         case "$getnetbyname_r_proto" in
14438         ''|0)   d_getnetbyname_r=undef
14439                 getnetbyname_r_proto=0
14440                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14441         * )     case "$getnetbyname_r_proto" in
14442                 REENTRANT_PROTO*) ;;
14443                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14444                 esac
14445                 echo "Prototype: $try" ;;
14446         esac
14447         ;;
14448         *)      case "$usethreads" in
14449                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14450                 esac
14451                 d_getnetbyname_r=undef
14452                 getnetbyname_r_proto=0
14453                 ;;
14454         esac
14455         ;;
14456 *)      getnetbyname_r_proto=0
14457         ;;
14458 esac
14459
14460 : see if getnetent_r exists
14461 set getnetent_r d_getnetent_r
14462 eval $inlibc
14463 case "$d_getnetent_r" in
14464 "$define")
14465         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14466         case "$d_getnetent_r_proto:$usethreads" in
14467         ":define")      d_getnetent_r_proto=define
14468                 set d_getnetent_r_proto getnetent_r $hdrs
14469                 eval $hasproto ;;
14470         *)      ;;
14471         esac
14472         case "$d_getnetent_r_proto" in
14473         define)
14474         case "$getnetent_r_proto" in
14475         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14476         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14477         esac
14478         case "$getnetent_r_proto" in
14479         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14480         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14481         esac
14482         case "$getnetent_r_proto" in
14483         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14484         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14485         esac
14486         case "$getnetent_r_proto" in
14487         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14488         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14489         esac
14490         case "$getnetent_r_proto" in
14491         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14492         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14493         esac
14494         case "$getnetent_r_proto" in
14495         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14496         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14497         esac
14498         case "$getnetent_r_proto" in
14499         ''|0)   d_getnetent_r=undef
14500                 getnetent_r_proto=0
14501                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14502         * )     case "$getnetent_r_proto" in
14503                 REENTRANT_PROTO*) ;;
14504                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14505                 esac
14506                 echo "Prototype: $try" ;;
14507         esac
14508         ;;
14509         *)      case "$usethreads" in
14510                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14511                 esac
14512                 d_getnetent_r=undef
14513                 getnetent_r_proto=0
14514                 ;;
14515         esac
14516         ;;
14517 *)      getnetent_r_proto=0
14518         ;;
14519 esac
14520
14521 : see if prototypes for various getnetxxx netdb.h functions are available
14522 echo " "
14523 set d_getnetprotos getnetent $i_netdb netdb.h
14524 eval $hasproto
14525
14526 : see if getpagesize exists
14527 set getpagesize d_getpagsz
14528 eval $inlibc
14529
14530 : Optional checks for getprotobyname and getprotobynumber
14531
14532 : see if getprotobyname exists
14533 set getprotobyname d_getpbyname
14534 eval $inlibc
14535
14536 : see if getprotobynumber exists
14537 set getprotobynumber d_getpbynumber
14538 eval $inlibc
14539
14540 : see if getprotoent exists
14541 set getprotoent d_getpent
14542 eval $inlibc
14543
14544 : see if getpgid exists
14545 set getpgid d_getpgid
14546 eval $inlibc
14547
14548 : see if getpgrp2 exists
14549 set getpgrp2 d_getpgrp2
14550 eval $inlibc
14551
14552 : see if getppid exists
14553 set getppid d_getppid
14554 eval $inlibc
14555
14556 : see if getpriority exists
14557 set getpriority d_getprior
14558 eval $inlibc
14559
14560 : see if getprotobyname_r exists
14561 set getprotobyname_r d_getprotobyname_r
14562 eval $inlibc
14563 case "$d_getprotobyname_r" in
14564 "$define")
14565         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14566         case "$d_getprotobyname_r_proto:$usethreads" in
14567         ":define")      d_getprotobyname_r_proto=define
14568                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14569                 eval $hasproto ;;
14570         *)      ;;
14571         esac
14572         case "$d_getprotobyname_r_proto" in
14573         define)
14574         case "$getprotobyname_r_proto" in
14575         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14576         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14577         esac
14578         case "$getprotobyname_r_proto" in
14579         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14580         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14581         esac
14582         case "$getprotobyname_r_proto" in
14583         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14584         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14585         esac
14586         case "$getprotobyname_r_proto" in
14587         ''|0)   d_getprotobyname_r=undef
14588                 getprotobyname_r_proto=0
14589                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14590         * )     case "$getprotobyname_r_proto" in
14591                 REENTRANT_PROTO*) ;;
14592                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14593                 esac
14594                 echo "Prototype: $try" ;;
14595         esac
14596         ;;
14597         *)      case "$usethreads" in
14598                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14599                 esac
14600                 d_getprotobyname_r=undef
14601                 getprotobyname_r_proto=0
14602                 ;;
14603         esac
14604         ;;
14605 *)      getprotobyname_r_proto=0
14606         ;;
14607 esac
14608
14609 : see if getprotobynumber_r exists
14610 set getprotobynumber_r d_getprotobynumber_r
14611 eval $inlibc
14612 case "$d_getprotobynumber_r" in
14613 "$define")
14614         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14615         case "$d_getprotobynumber_r_proto:$usethreads" in
14616         ":define")      d_getprotobynumber_r_proto=define
14617                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14618                 eval $hasproto ;;
14619         *)      ;;
14620         esac
14621         case "$d_getprotobynumber_r_proto" in
14622         define)
14623         case "$getprotobynumber_r_proto" in
14624         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14625         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14626         esac
14627         case "$getprotobynumber_r_proto" in
14628         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14629         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14630         esac
14631         case "$getprotobynumber_r_proto" in
14632         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14633         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14634         esac
14635         case "$getprotobynumber_r_proto" in
14636         ''|0)   d_getprotobynumber_r=undef
14637                 getprotobynumber_r_proto=0
14638                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14639         * )     case "$getprotobynumber_r_proto" in
14640                 REENTRANT_PROTO*) ;;
14641                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14642                 esac
14643                 echo "Prototype: $try" ;;
14644         esac
14645         ;;
14646         *)      case "$usethreads" in
14647                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14648                 esac
14649                 d_getprotobynumber_r=undef
14650                 getprotobynumber_r_proto=0
14651                 ;;
14652         esac
14653         ;;
14654 *)      getprotobynumber_r_proto=0
14655         ;;
14656 esac
14657
14658 : see if getprotoent_r exists
14659 set getprotoent_r d_getprotoent_r
14660 eval $inlibc
14661 case "$d_getprotoent_r" in
14662 "$define")
14663         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14664         case "$d_getprotoent_r_proto:$usethreads" in
14665         ":define")      d_getprotoent_r_proto=define
14666                 set d_getprotoent_r_proto getprotoent_r $hdrs
14667                 eval $hasproto ;;
14668         *)      ;;
14669         esac
14670         case "$d_getprotoent_r_proto" in
14671         define)
14672         case "$getprotoent_r_proto" in
14673         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14674         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14675         esac
14676         case "$getprotoent_r_proto" in
14677         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14678         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14679         esac
14680         case "$getprotoent_r_proto" in
14681         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14682         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14683         esac
14684         case "$getprotoent_r_proto" in
14685         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14686         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14687         esac
14688         case "$getprotoent_r_proto" in
14689         ''|0)   d_getprotoent_r=undef
14690                 getprotoent_r_proto=0
14691                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14692         * )     case "$getprotoent_r_proto" in
14693                 REENTRANT_PROTO*) ;;
14694                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14695                 esac
14696                 echo "Prototype: $try" ;;
14697         esac
14698         ;;
14699         *)      case "$usethreads" in
14700                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14701                 esac
14702                 d_getprotoent_r=undef
14703                 getprotoent_r_proto=0
14704                 ;;
14705         esac
14706         ;;
14707 *)      getprotoent_r_proto=0
14708         ;;
14709 esac
14710
14711 : see if prototypes for various getprotoxxx netdb.h functions are available
14712 echo " "
14713 set d_getprotoprotos getprotoent $i_netdb netdb.h
14714 eval $hasproto
14715
14716 : see if getprpwnam exists
14717 set getprpwnam d_getprpwnam
14718 eval $inlibc
14719
14720 : see if getpwent exists
14721 set getpwent d_getpwent
14722 eval $inlibc
14723
14724 : see if getpwent_r exists
14725 set getpwent_r d_getpwent_r
14726 eval $inlibc
14727 case "$d_getpwent_r" in
14728 "$define")
14729         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14730         case "$d_getpwent_r_proto:$usethreads" in
14731         ":define")      d_getpwent_r_proto=define
14732                 set d_getpwent_r_proto getpwent_r $hdrs
14733                 eval $hasproto ;;
14734         *)      ;;
14735         esac
14736         case "$d_getpwent_r_proto" in
14737         define)
14738         case "$getpwent_r_proto" in
14739         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14740         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14741         esac
14742         case "$getpwent_r_proto" in
14743         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14744         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14745         esac
14746         case "$getpwent_r_proto" in
14747         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14748         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14749         esac
14750         case "$getpwent_r_proto" in
14751         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14752         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14753         esac
14754         case "$getpwent_r_proto" in
14755         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14756         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14757         esac
14758         case "$getpwent_r_proto" in
14759         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14760         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14761         esac
14762         case "$getpwent_r_proto" in
14763         ''|0)   d_getpwent_r=undef
14764                 getpwent_r_proto=0
14765                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14766         * )     case "$getpwent_r_proto" in
14767                 REENTRANT_PROTO*) ;;
14768                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14769                 esac
14770                 echo "Prototype: $try" ;;
14771         esac
14772         ;;
14773         *)      case "$usethreads" in
14774                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14775                 esac
14776                 d_getpwent_r=undef
14777                 getpwent_r_proto=0
14778                 ;;
14779         esac
14780         ;;
14781 *)      getpwent_r_proto=0
14782         ;;
14783 esac
14784
14785 : see if getpwnam_r exists
14786 set getpwnam_r d_getpwnam_r
14787 eval $inlibc
14788 case "$d_getpwnam_r" in
14789 "$define")
14790         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14791         case "$d_getpwnam_r_proto:$usethreads" in
14792         ":define")      d_getpwnam_r_proto=define
14793                 set d_getpwnam_r_proto getpwnam_r $hdrs
14794                 eval $hasproto ;;
14795         *)      ;;
14796         esac
14797         case "$d_getpwnam_r_proto" in
14798         define)
14799         case "$getpwnam_r_proto" in
14800         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14801         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14802         esac
14803         case "$getpwnam_r_proto" in
14804         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14805         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14806         esac
14807         case "$getpwnam_r_proto" in
14808         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14809         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14810         esac
14811         case "$getpwnam_r_proto" in
14812         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14813         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14814         esac
14815         case "$getpwnam_r_proto" in
14816         ''|0)   d_getpwnam_r=undef
14817                 getpwnam_r_proto=0
14818                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14819         * )     case "$getpwnam_r_proto" in
14820                 REENTRANT_PROTO*) ;;
14821                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14822                 esac
14823                 echo "Prototype: $try" ;;
14824         esac
14825         ;;
14826         *)      case "$usethreads" in
14827                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14828                 esac
14829                 d_getpwnam_r=undef
14830                 getpwnam_r_proto=0
14831                 ;;
14832         esac
14833         ;;
14834 *)      getpwnam_r_proto=0
14835         ;;
14836 esac
14837
14838 : see if getpwuid_r exists
14839 set getpwuid_r d_getpwuid_r
14840 eval $inlibc
14841 case "$d_getpwuid_r" in
14842 "$define")
14843         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14844         case "$d_getpwuid_r_proto:$usethreads" in
14845         ":define")      d_getpwuid_r_proto=define
14846                 set d_getpwuid_r_proto getpwuid_r $hdrs
14847                 eval $hasproto ;;
14848         *)      ;;
14849         esac
14850         case "$d_getpwuid_r_proto" in
14851         define)
14852         case "$getpwuid_r_proto" in
14853         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14854         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14855         esac
14856         case "$getpwuid_r_proto" in
14857         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14858         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14859         esac
14860         case "$getpwuid_r_proto" in
14861         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14862         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14863         esac
14864         case "$getpwuid_r_proto" in
14865         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14866         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14867         esac
14868         case "$getpwuid_r_proto" in
14869         ''|0)   d_getpwuid_r=undef
14870                 getpwuid_r_proto=0
14871                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14872         * )     case "$getpwuid_r_proto" in
14873                 REENTRANT_PROTO*) ;;
14874                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14875                 esac
14876                 echo "Prototype: $try" ;;
14877         esac
14878         ;;
14879         *)      case "$usethreads" in
14880                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14881                 esac
14882                 d_getpwuid_r=undef
14883                 getpwuid_r_proto=0
14884                 ;;
14885         esac
14886         ;;
14887 *)      getpwuid_r_proto=0
14888         ;;
14889 esac
14890
14891 : Optional checks for getsbyname and getsbyport
14892
14893 : see if getservbyname exists
14894 set getservbyname d_getsbyname
14895 eval $inlibc
14896
14897 : see if getservbyport exists
14898 set getservbyport d_getsbyport
14899 eval $inlibc
14900
14901 : see if getservent exists
14902 set getservent d_getsent
14903 eval $inlibc
14904
14905 : see if getservbyname_r exists
14906 set getservbyname_r d_getservbyname_r
14907 eval $inlibc
14908 case "$d_getservbyname_r" in
14909 "$define")
14910         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14911         case "$d_getservbyname_r_proto:$usethreads" in
14912         ":define")      d_getservbyname_r_proto=define
14913                 set d_getservbyname_r_proto getservbyname_r $hdrs
14914                 eval $hasproto ;;
14915         *)      ;;
14916         esac
14917         case "$d_getservbyname_r_proto" in
14918         define)
14919         case "$getservbyname_r_proto" in
14920         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14921         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14922         esac
14923         case "$getservbyname_r_proto" in
14924         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14925         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14926         esac
14927         case "$getservbyname_r_proto" in
14928         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14929         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14930         esac
14931         case "$getservbyname_r_proto" in
14932         ''|0)   d_getservbyname_r=undef
14933                 getservbyname_r_proto=0
14934                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14935         * )     case "$getservbyname_r_proto" in
14936                 REENTRANT_PROTO*) ;;
14937                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14938                 esac
14939                 echo "Prototype: $try" ;;
14940         esac
14941         ;;
14942         *)      case "$usethreads" in
14943                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14944                 esac
14945                 d_getservbyname_r=undef
14946                 getservbyname_r_proto=0
14947                 ;;
14948         esac
14949         ;;
14950 *)      getservbyname_r_proto=0
14951         ;;
14952 esac
14953
14954 : see if getservbyport_r exists
14955 set getservbyport_r d_getservbyport_r
14956 eval $inlibc
14957 case "$d_getservbyport_r" in
14958 "$define")
14959         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14960         case "$d_getservbyport_r_proto:$usethreads" in
14961         ":define")      d_getservbyport_r_proto=define
14962                 set d_getservbyport_r_proto getservbyport_r $hdrs
14963                 eval $hasproto ;;
14964         *)      ;;
14965         esac
14966         case "$d_getservbyport_r_proto" in
14967         define)
14968         case "$getservbyport_r_proto" in
14969         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14970         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14971         esac
14972         case "$getservbyport_r_proto" in
14973         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14974         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14975         esac
14976         case "$getservbyport_r_proto" in
14977         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14978         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14979         esac
14980         case "$getservbyport_r_proto" in
14981         ''|0)   d_getservbyport_r=undef
14982                 getservbyport_r_proto=0
14983                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14984         * )     case "$getservbyport_r_proto" in
14985                 REENTRANT_PROTO*) ;;
14986                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14987                 esac
14988                 echo "Prototype: $try" ;;
14989         esac
14990         ;;
14991         *)      case "$usethreads" in
14992                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14993                 esac
14994                 d_getservbyport_r=undef
14995                 getservbyport_r_proto=0
14996                 ;;
14997         esac
14998         ;;
14999 *)      getservbyport_r_proto=0
15000         ;;
15001 esac
15002
15003 : see if getservent_r exists
15004 set getservent_r d_getservent_r
15005 eval $inlibc
15006 case "$d_getservent_r" in
15007 "$define")
15008         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15009         case "$d_getservent_r_proto:$usethreads" in
15010         ":define")      d_getservent_r_proto=define
15011                 set d_getservent_r_proto getservent_r $hdrs
15012                 eval $hasproto ;;
15013         *)      ;;
15014         esac
15015         case "$d_getservent_r_proto" in
15016         define)
15017         case "$getservent_r_proto" in
15018         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15019         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15020         esac
15021         case "$getservent_r_proto" in
15022         ''|0) try='int getservent_r(struct servent*, char*, int);'
15023         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15024         esac
15025         case "$getservent_r_proto" in
15026         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15027         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15028         esac
15029         case "$getservent_r_proto" in
15030         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15031         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15032         esac
15033         case "$getservent_r_proto" in
15034         ''|0)   d_getservent_r=undef
15035                 getservent_r_proto=0
15036                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15037         * )     case "$getservent_r_proto" in
15038                 REENTRANT_PROTO*) ;;
15039                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15040                 esac
15041                 echo "Prototype: $try" ;;
15042         esac
15043         ;;
15044         *)      case "$usethreads" in
15045                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15046                 esac
15047                 d_getservent_r=undef
15048                 getservent_r_proto=0
15049                 ;;
15050         esac
15051         ;;
15052 *)      getservent_r_proto=0
15053         ;;
15054 esac
15055
15056 : see if prototypes for various getservxxx netdb.h functions are available
15057 echo " "
15058 set d_getservprotos getservent $i_netdb netdb.h
15059 eval $hasproto
15060
15061 : see if getspnam exists
15062 set getspnam d_getspnam
15063 eval $inlibc
15064
15065 : see if this is a shadow.h system
15066 set shadow.h i_shadow
15067 eval $inhdr
15068
15069 : see if getspnam_r exists
15070 set getspnam_r d_getspnam_r
15071 eval $inlibc
15072 case "$d_getspnam_r" in
15073 "$define")
15074         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15075         case "$d_getspnam_r_proto:$usethreads" in
15076         ":define")      d_getspnam_r_proto=define
15077                 set d_getspnam_r_proto getspnam_r $hdrs
15078                 eval $hasproto ;;
15079         *)      ;;
15080         esac
15081         case "$d_getspnam_r_proto" in
15082         define)
15083         case "$getspnam_r_proto" in
15084         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15085         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15086         esac
15087         case "$getspnam_r_proto" in
15088         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15089         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15090         esac
15091         case "$getspnam_r_proto" in
15092         ''|0)   d_getspnam_r=undef
15093                 getspnam_r_proto=0
15094                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15095         * )     case "$getspnam_r_proto" in
15096                 REENTRANT_PROTO*) ;;
15097                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15098                 esac
15099                 echo "Prototype: $try" ;;
15100         esac
15101         ;;
15102         *)      case "$usethreads" in
15103                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15104                 esac
15105                 d_getspnam_r=undef
15106                 getspnam_r_proto=0
15107                 ;;
15108         esac
15109         ;;
15110 *)      getspnam_r_proto=0
15111         ;;
15112 esac
15113
15114 : see if gettimeofday or ftime exists
15115 set gettimeofday d_gettimeod
15116 eval $inlibc
15117 case "$d_gettimeod" in
15118 "$undef")
15119         set ftime d_ftime 
15120         eval $inlibc
15121         ;;
15122 *)
15123         val="$undef"; set d_ftime; eval $setvar
15124         ;;
15125 esac
15126 case "$d_gettimeod$d_ftime" in
15127 "$undef$undef")
15128         echo " "
15129         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15130         ;;
15131 esac
15132
15133 : see if gmtime_r exists
15134 set gmtime_r d_gmtime_r
15135 eval $inlibc
15136 case "$d_gmtime_r" in
15137 "$define")
15138         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15139         case "$d_gmtime_r_proto:$usethreads" in
15140         ":define")      d_gmtime_r_proto=define
15141                 set d_gmtime_r_proto gmtime_r $hdrs
15142                 eval $hasproto ;;
15143         *)      ;;
15144         esac
15145         case "$d_gmtime_r_proto" in
15146         define)
15147         case "$gmtime_r_proto" in
15148         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15149         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15150         esac
15151         case "$gmtime_r_proto" in
15152         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15153         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15154         esac
15155         case "$gmtime_r_proto" in
15156         ''|0)   d_gmtime_r=undef
15157                 gmtime_r_proto=0
15158                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15159         * )     case "$gmtime_r_proto" in
15160                 REENTRANT_PROTO*) ;;
15161                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15162                 esac
15163                 echo "Prototype: $try" ;;
15164         esac
15165         ;;
15166         *)      case "$usethreads" in
15167                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15168                 esac
15169                 d_gmtime_r=undef
15170                 gmtime_r_proto=0
15171                 ;;
15172         esac
15173         ;;
15174 *)      gmtime_r_proto=0
15175         ;;
15176 esac
15177
15178 : see if hasmntopt exists
15179 set hasmntopt d_hasmntopt
15180 eval $inlibc
15181
15182 : see if this is a netinet/in.h or sys/in.h system
15183 set netinet/in.h i_niin sys/in.h i_sysin
15184 eval $inhdr
15185
15186 : see if arpa/inet.h has to be included
15187 set arpa/inet.h i_arpainet
15188 eval $inhdr
15189
15190 : see if htonl --and friends-- exists
15191 val=''
15192 set htonl val
15193 eval $inlibc
15194
15195 : Maybe they are macros.
15196 case "$val" in
15197 $undef)
15198         $cat >htonl.c <<EOM
15199 #include <stdio.h>
15200 #include <sys/types.h>
15201 #$i_niin I_NETINET_IN
15202 #$i_sysin I_SYS_IN
15203 #$i_arpainet I_ARPA_INET
15204 #ifdef I_NETINET_IN
15205 #include <netinet/in.h>
15206 #endif
15207 #ifdef I_SYS_IN
15208 #include <sys/in.h>
15209 #endif
15210 #ifdef I_ARPA_INET
15211 #include <arpa/inet.h>
15212 #endif
15213 #ifdef htonl
15214 printf("Defined as a macro.");
15215 #endif
15216 EOM
15217         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15218         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15219                 val="$define"
15220                 echo "But it seems to be defined as a macro." >&4
15221         fi
15222         $rm -f htonl.?
15223         ;;
15224 esac
15225 set d_htonl
15226 eval $setvar
15227
15228 : see if ilogbl exists
15229 set ilogbl d_ilogbl
15230 eval $inlibc
15231
15232 : index or strchr
15233 echo " "
15234 if set index val -f; eval $csym; $val; then
15235         if set strchr val -f d_strchr; eval $csym; $val; then
15236                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15237                         val="$define"
15238                         vali="$undef"
15239                         echo "strchr() found." >&4
15240                 else
15241                         val="$undef"
15242                         vali="$define"
15243                         echo "index() found." >&4
15244                 fi
15245         else
15246                 val="$undef"
15247                 vali="$define"
15248                 echo "index() found." >&4
15249         fi
15250 else
15251         if set strchr val -f d_strchr; eval $csym; $val; then
15252                 val="$define"
15253                 vali="$undef"
15254                 echo "strchr() found." >&4
15255         else
15256                 echo "No index() or strchr() found!" >&4
15257                 val="$undef"
15258                 vali="$undef"
15259         fi
15260 fi
15261 set d_strchr; eval $setvar
15262 val="$vali"
15263 set d_index; eval $setvar
15264
15265 : check whether inet_aton exists
15266 set inet_aton d_inetaton
15267 eval $inlibc
15268
15269 : see if inet_ntop exists
15270 set inet_ntop d_inetntop
15271 eval $inlibc
15272
15273 : see if inet_pton exists
15274 set inet_pton d_inetpton
15275 eval $inlibc
15276
15277 : Look for isascii
15278 echo " "
15279 $cat >isascii.c <<EOCP
15280 #include <stdio.h>
15281 #include <ctype.h>
15282 #$i_stdlib I_STDLIB
15283 #ifdef I_STDLIB
15284 #include <stdlib.h>
15285 #endif
15286 int main() {
15287         int c = 'A';
15288         if (isascii(c))
15289                 exit(0);
15290         else
15291                 exit(1);
15292 }
15293 EOCP
15294 set isascii
15295 if eval $compile; then
15296         echo "isascii() found." >&4
15297         val="$define"
15298 else
15299         echo "isascii() NOT found." >&4
15300         val="$undef"
15301 fi
15302 set d_isascii
15303 eval $setvar
15304 $rm -f isascii*
15305
15306 : Look for isblank
15307 echo " "
15308 $cat >isblank.c <<'EOCP'
15309 #include <stdio.h>
15310 #include <ctype.h>
15311 int main() {
15312         int c = ' ';
15313         if (isblank(c))
15314                 return 0 ;
15315         else
15316                 return 1 ;
15317 }
15318 EOCP
15319 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15320         echo "isblank() found." >&4
15321         val="$define"
15322 else
15323         echo "isblank() NOT found." >&4
15324         val="$undef"
15325 fi
15326 set d_isblank
15327 eval $setvar
15328 $rm -f isblank*
15329
15330 : see if isfinite exists
15331 set isfinite d_isfinite
15332 eval $inlibc
15333
15334 : see if isinf exists
15335 set isinf d_isinf
15336 eval $inlibc
15337
15338 : see if isnan exists
15339 set isnan d_isnan
15340 eval $inlibc
15341
15342 : see if isnanl exists
15343 set isnanl d_isnanl
15344 eval $inlibc
15345
15346 : see if killpg exists
15347 set killpg d_killpg
15348 eval $inlibc
15349
15350 : see if lchown exists
15351 echo " "
15352 $cat > try.c <<'EOCP'
15353 /* System header to define __stub macros and hopefully few prototypes,
15354     which can conflict with char lchown(); below.  */
15355 #include <assert.h>
15356 /* Override any gcc2 internal prototype to avoid an error.  */
15357 /* We use char because int might match the return type of a gcc2
15358    builtin and then its argument prototype would still apply.  */
15359 char lchown();
15360 int main() {
15361     /*  The GNU C library defines this for functions which it implements
15362         to always fail with ENOSYS.  Some functions are actually named
15363         something starting with __ and the normal name is an alias.  */
15364 #if defined (__stub_lchown) || defined (__stub___lchown)
15365 choke me
15366 #else
15367 lchown();
15368 #endif
15369 ; return 0; }
15370 EOCP
15371 set try
15372 if eval $compile; then
15373     $echo "lchown() found." >&4
15374     val="$define"
15375 else
15376     $echo "lchown() NOT found." >&4
15377     val="$undef"
15378 fi
15379 set d_lchown
15380 eval $setvar
15381
15382 : See if number of significant digits in a double precision number is known
15383 echo " "
15384 $cat >ldbl_dig.c <<EOM
15385 #$i_limits I_LIMITS
15386 #$i_float I_FLOAT
15387 #ifdef I_LIMITS
15388 #include <limits.h>
15389 #endif
15390 #ifdef I_FLOAT
15391 #include <float.h>
15392 #endif
15393 #ifdef LDBL_DIG
15394 printf("Contains LDBL_DIG");
15395 #endif
15396 EOM
15397 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15398 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15399         echo "LDBL_DIG found." >&4
15400         val="$define"
15401 else
15402         echo "LDBL_DIG NOT found." >&4
15403         val="$undef"
15404 fi
15405 $rm -f ldbl_dig.?
15406 set d_ldbl_dig
15407 eval $setvar
15408
15409 : see if this is a math.h system
15410 set math.h i_math
15411 eval $inhdr
15412
15413 : check to see if math.h defines _LIB_VERSION
15414 d_libm_lib_version="$undef"
15415 case $i_math in
15416     $define)
15417         echo " "
15418         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15419         $cat >try.c <<EOCP
15420 #include <unistd.h>
15421 #include <math.h>
15422 int main (int argc, char *argv[])
15423 {
15424     printf ("%d\n", _LIB_VERSION);
15425     return (0);
15426     } /* main */
15427 EOCP
15428         set try
15429         if eval $compile; then
15430             foo=`$run ./try`
15431             echo "Yes, it does ($foo)" >&4
15432             d_libm_lib_version="$define"
15433         else
15434             echo "No, it does not (probably harmless)" >&4
15435             fi
15436         $rm_try
15437         ;;
15438
15439     esac
15440
15441 : see if link exists
15442 set link d_link
15443 eval $inlibc
15444
15445 : see if localtime_r exists
15446 set localtime_r d_localtime_r
15447 eval $inlibc
15448 case "$d_localtime_r" in
15449 "$define")
15450         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15451         case "$d_localtime_r_proto:$usethreads" in
15452         ":define")      d_localtime_r_proto=define
15453                 set d_localtime_r_proto localtime_r $hdrs
15454                 eval $hasproto ;;
15455         *)      ;;
15456         esac
15457         case "$d_localtime_r_proto" in
15458         define)
15459         case "$localtime_r_proto" in
15460         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15461         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15462         esac
15463         case "$localtime_r_proto" in
15464         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15465         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15466         esac
15467         case "$localtime_r_proto" in
15468         ''|0)   d_localtime_r=undef
15469                 localtime_r_proto=0
15470                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15471         * )     case "$localtime_r_proto" in
15472                 REENTRANT_PROTO*) ;;
15473                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15474                 esac
15475                 echo "Prototype: $try" ;;
15476         esac
15477         ;;
15478         *)      case "$usethreads" in
15479                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15480                 esac
15481                 d_localtime_r=undef
15482                 localtime_r_proto=0
15483                 ;;
15484         esac
15485         ;;
15486 *)      localtime_r_proto=0
15487         ;;
15488 esac
15489
15490 : see if localtime_r calls tzset
15491 case "$localtime_r_proto" in
15492 REENTRANT_PROTO*)
15493         $cat >try.c <<EOCP
15494 /*  Does our libc's localtime_r call tzset ?
15495  *  return 0 if so, 1 otherwise.
15496  */
15497 #$i_systypes    I_SYS_TYPES
15498 #$i_unistd      I_UNISTD
15499 #$i_time        I_TIME
15500 #$i_stdlib      I_STDLIB
15501 #$i_string      I_STRING
15502 #$i_malloc      I_MALLOC
15503 #ifdef I_SYS_TYPES
15504 #  include <sys/types.h>
15505 #endif
15506 #ifdef I_UNISTD
15507 #  include <unistd.h>
15508 #endif
15509 #ifdef I_TIME
15510 #  include <time.h>
15511 #endif
15512 #ifdef I_STDLIB
15513 #include <stdlib.h>
15514 #endif
15515 #ifdef I_STRING
15516 #  include <string.h>
15517 #else
15518 #  include <strings.h>
15519 #endif
15520 #ifdef I_MALLOC
15521 #  include <malloc.h>
15522 #endif
15523 int main()
15524 {
15525     time_t t = time(0L);
15526     char w_tz[]="TZ" "=GMT+5",
15527          e_tz[]="TZ" "=GMT-5",
15528         *tz_e = (char*)malloc(16),
15529         *tz_w = (char*)malloc(16);
15530     struct tm tm_e, tm_w;
15531     memset(&tm_e,'\0',sizeof(struct tm));
15532     memset(&tm_w,'\0',sizeof(struct tm));
15533     strcpy(tz_e,e_tz);
15534     strcpy(tz_w,w_tz);
15535
15536     putenv(tz_e);
15537     localtime_r(&t, &tm_e);
15538
15539     putenv(tz_w);
15540     localtime_r(&t, &tm_w);
15541
15542     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15543         return 1;
15544     return 0;
15545 }
15546 EOCP
15547         set try
15548         if eval $compile; then
15549             if $run ./try; then
15550                 d_localtime_r_needs_tzset=undef;
15551             else
15552                 d_localtime_r_needs_tzset=define;
15553             fi;
15554         else
15555             d_localtime_r_needs_tzset=undef;
15556         fi;
15557      ;;
15558   *)
15559      d_localtime_r_needs_tzset=undef;
15560      ;;
15561 esac
15562 $rm_try
15563
15564 : see if localeconv exists
15565 set localeconv d_locconv
15566 eval $inlibc
15567
15568 : see if lockf exists
15569 set lockf d_lockf
15570 eval $inlibc
15571
15572 : see if prototype for lseek is available
15573 echo " "
15574 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15575 eval $hasproto
15576
15577 : see if lstat exists
15578 set lstat d_lstat
15579 eval $inlibc
15580
15581 : see if madvise exists
15582 set madvise d_madvise
15583 eval $inlibc
15584
15585 : see if malloc_size exists
15586 set malloc_size d_malloc_size
15587 eval $inlibc
15588
15589 : see if malloc_size_good exists
15590 set malloc_good_size d_malloc_good_size
15591 eval $inlibc
15592
15593 : see if mblen exists
15594 set mblen d_mblen
15595 eval $inlibc
15596
15597 : see if mbstowcs exists
15598 set mbstowcs d_mbstowcs
15599 eval $inlibc
15600
15601 : see if mbtowc exists
15602 set mbtowc d_mbtowc
15603 eval $inlibc
15604
15605 : see if memchr exists
15606 set memchr d_memchr
15607 eval $inlibc
15608
15609 : see if memcmp exists
15610 set memcmp d_memcmp
15611 eval $inlibc
15612
15613 : see if memcpy exists
15614 set memcpy d_memcpy
15615 eval $inlibc
15616
15617 : see if memmove exists
15618 set memmove d_memmove
15619 eval $inlibc
15620
15621 : see if memset exists
15622 set memset d_memset
15623 eval $inlibc
15624
15625 : see if mkdir exists
15626 set mkdir d_mkdir
15627 eval $inlibc
15628
15629 : see if mkdtemp exists
15630 set mkdtemp d_mkdtemp
15631 eval $inlibc
15632
15633 : see if mkfifo exists
15634 set mkfifo d_mkfifo
15635 eval $inlibc
15636
15637 : see if mkstemp exists
15638 set mkstemp d_mkstemp
15639 eval $inlibc
15640
15641 : see if mkstemps exists
15642 set mkstemps d_mkstemps
15643 eval $inlibc
15644
15645 : see if mktime exists
15646 set mktime d_mktime
15647 eval $inlibc
15648
15649 : see if this is a sys/mman.h system
15650 set sys/mman.h i_sysmman
15651 eval $inhdr
15652
15653 : see if mmap exists
15654 set mmap d_mmap
15655 eval $inlibc
15656 : see what shmat returns
15657 : default to something harmless
15658 mmaptype='void *'
15659 case "$i_sysmman$d_mmap" in
15660 "$define$define")
15661         $cat >mmap.c <<'END'
15662 #include <sys/mman.h>
15663 void *mmap();
15664 END
15665         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15666                 mmaptype='void *'
15667         else
15668                 mmaptype='caddr_t'
15669         fi
15670         echo "and it returns ($mmaptype)." >&4
15671         ;;
15672 esac
15673
15674
15675
15676 : see if sqrtl exists
15677 set sqrtl d_sqrtl
15678 eval $inlibc
15679
15680 : see if scalbnl exists
15681 set scalbnl d_scalbnl
15682 eval $inlibc
15683
15684 : see if modfl exists
15685 set modfl d_modfl
15686 eval $inlibc
15687
15688 : see if prototype for modfl is available
15689 echo " "
15690 set d_modflproto modfl $i_math math.h
15691 eval $hasproto
15692
15693 d_modfl_pow32_bug="$undef"
15694
15695 case "$d_longdbl$d_modfl" in
15696 $define$define)
15697         $cat <<EOM
15698 Checking to see whether your modfl() is okay for large values...
15699 EOM
15700 $cat >try.c <<EOCP
15701 #include <math.h>
15702 #include <stdio.h>
15703 EOCP
15704 if $test "X$d_modflproto" != "X$define"; then
15705         $cat >>try.c <<EOCP
15706 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15707 long double modfl (long double, long double *);
15708 EOCP
15709 fi
15710 $cat >>try.c <<EOCP
15711 int main() {
15712     long double nv = 4294967303.15;
15713     long double v, w;
15714     v = modfl(nv, &w);
15715 #ifdef __GLIBC__
15716     printf("glibc");
15717 #endif
15718     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15719     return 0;
15720 }
15721 EOCP
15722         case "$osname:$gccversion" in
15723         aix:)   saveccflags="$ccflags"
15724                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15725         esac
15726         set try
15727         if eval $compile; then
15728                 foo=`$run ./try`
15729                 case "$foo" in
15730                 *" 4294967303.150000 1.150000 4294967302.000000")
15731                         echo >&4 "Your modfl() is broken for large values."
15732                         d_modfl_pow32_bug="$define"
15733                         case "$foo" in
15734                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15735                         ;;
15736                         esac
15737                         ;;
15738                 *" 4294967303.150000 0.150000 4294967303.000000")
15739                         echo >&4 "Your modfl() seems okay for large values."
15740                         ;;
15741                 *)      echo >&4 "I don't understand your modfl() at all."
15742                         d_modfl="$undef"
15743                         ;;
15744                 esac
15745                 $rm_try
15746         else
15747                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15748                 d_modfl="$undef"
15749         fi
15750         case "$osname:$gccversion" in
15751         aix:)   ccflags="$saveccflags" ;; # restore
15752         esac
15753         ;;
15754 esac
15755
15756 if $test "$uselongdouble" = "$define"; then
15757     message=""
15758     if $test "$d_sqrtl" != "$define"; then
15759         message="$message sqrtl"
15760     fi
15761     if $test "$d_modfl" != "$define"; then
15762         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15763             echo "You have both aintl and copysignl, so I can emulate modfl."
15764         else
15765             message="$message modfl"
15766         fi
15767     fi
15768     if $test "$d_frexpl" != "$define"; then
15769         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15770             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15771         else
15772             message="$message frexpl"
15773         fi
15774     fi
15775
15776     if $test "$message" != ""; then
15777         $cat <<EOM >&4
15778
15779 *** You requested the use of long doubles but you do not seem to have
15780 *** the following mathematical functions needed for long double support:
15781 ***    $message
15782 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15783 *** Cannot continue, aborting.
15784
15785 EOM
15786
15787         exit 1
15788     fi
15789 fi
15790
15791 : see if mprotect exists
15792 set mprotect d_mprotect
15793 eval $inlibc
15794
15795 : see if msgctl exists
15796 set msgctl d_msgctl
15797 eval $inlibc
15798
15799 : see if msgget exists
15800 set msgget d_msgget
15801 eval $inlibc
15802
15803 : see if msgsnd exists
15804 set msgsnd d_msgsnd
15805 eval $inlibc
15806
15807 : see if msgrcv exists
15808 set msgrcv d_msgrcv
15809 eval $inlibc
15810
15811 : see how much of the 'msg*(2)' library is present.
15812 h_msg=true
15813 echo " "
15814 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15815 *"$undef"*) h_msg=false;;
15816 esac
15817 case "$osname" in
15818 freebsd)
15819     case "`ipcs 2>&1`" in
15820     "SVID messages"*"not configured"*)
15821         echo "Your $osname does not have the msg*(2) configured." >&4
15822         h_msg=false
15823         val="$undef"
15824         set msgctl d_msgctl
15825         eval $setvar
15826         set msgget d_msgget
15827         eval $setvar
15828         set msgsnd d_msgsnd
15829         eval $setvar
15830         set msgrcv d_msgrcv
15831         eval $setvar
15832         ;;
15833     esac
15834     ;;
15835 esac
15836 : we could also check for sys/ipc.h ...
15837 if $h_msg && $test `./findhdr sys/msg.h`; then
15838         echo "You have the full msg*(2) library." >&4
15839         val="$define"
15840 else
15841         echo "You don't have the full msg*(2) library." >&4
15842         val="$undef"
15843 fi
15844 set d_msg
15845 eval $setvar
15846
15847 : Check for msghdr_s
15848 echo " "
15849 echo "Checking to see if your system supports struct msghdr..." >&4
15850 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15851 eval $hasstruct
15852 case "$d_msghdr_s" in
15853 "$define")      echo "Yes, it does."   ;;
15854 *)              echo "No, it doesn't." ;;
15855 esac
15856
15857
15858 : see if msync exists
15859 set msync d_msync
15860 eval $inlibc
15861
15862 : see if munmap exists
15863 set munmap d_munmap
15864 eval $inlibc
15865
15866 : see if nice exists
15867 set nice d_nice
15868 eval $inlibc
15869
15870 : see if this is a langinfo.h system
15871 set langinfo.h i_langinfo
15872 eval $inhdr
15873
15874 : see if nl_langinfo exists
15875 set nl_langinfo d_nl_langinfo
15876 eval $inlibc
15877
15878 : check for volatile keyword
15879 echo " "
15880 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15881 $cat >try.c <<'EOCP'
15882 int main()
15883 {
15884         typedef struct _goo_struct goo_struct;
15885         goo_struct * volatile goo = ((goo_struct *)0);
15886         struct _goo_struct {
15887                 long long_int;
15888                 int reg_int;
15889                 char char_var;
15890         };
15891         typedef unsigned short foo_t;
15892         char *volatile foo;
15893         volatile int bar;
15894         volatile foo_t blech;
15895         foo = foo;
15896 }
15897 EOCP
15898 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15899         val="$define"
15900         echo "Yup, it does."
15901 else
15902         val="$undef"
15903         echo "Nope, it doesn't."
15904 fi
15905 set d_volatile
15906 eval $setvar
15907 $rm_try
15908
15909 : Check basic sizes
15910 echo " "
15911 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15912
15913 case "$use64bitint:$d_quad:$quadtype" in
15914 define:define:?*)
15915         ivtype="$quadtype"
15916         uvtype="$uquadtype"
15917         ivsize=8
15918         uvsize=8
15919         ;;
15920 *)      ivtype="long"
15921         uvtype="unsigned long"
15922         ivsize=$longsize
15923         uvsize=$longsize
15924         ;;
15925 esac
15926
15927 case "$uselongdouble:$d_longdbl" in
15928 define:define)
15929         nvtype="long double"
15930         nvsize=$longdblsize
15931         ;;
15932 *)      nvtype=double
15933         nvsize=$doublesize
15934         ;;
15935 esac
15936
15937 $echo "(IV will be "$ivtype", $ivsize bytes)"
15938 $echo "(UV will be "$uvtype", $uvsize bytes)"
15939 $echo "(NV will be "$nvtype", $nvsize bytes)"
15940
15941 $cat >try.c <<EOCP
15942 #$i_inttypes I_INTTYPES
15943 #ifdef I_INTTYPES
15944 #include <inttypes.h>
15945 #endif
15946 #include <stdio.h>
15947 int main() {
15948 #ifdef INT8
15949    int8_t i =  INT8_MAX;
15950   uint8_t u = UINT8_MAX;
15951   printf("int8_t\n");
15952 #endif
15953 #ifdef INT16
15954    int16_t i =  INT16_MAX;
15955   uint16_t u = UINT16_MAX;
15956   printf("int16_t\n");
15957 #endif
15958 #ifdef INT32
15959    int32_t i =  INT32_MAX;
15960   uint32_t u = UINT32_MAX;
15961   printf("int32_t\n");
15962 #endif
15963 }
15964 EOCP
15965
15966 i8type="signed char"
15967 u8type="unsigned char"
15968 i8size=1
15969 u8size=1
15970
15971 case "$i16type" in
15972 '')     case "$shortsize" in
15973         2)      i16type=short
15974                 u16type="unsigned short"
15975                 i16size=$shortsize
15976                 u16size=$shortsize
15977                 ;;
15978         esac
15979         ;;
15980 esac
15981 case "$i16type" in
15982 '')     set try -DINT16
15983         if eval $compile; then
15984                 case "`$run ./try`" in
15985                 int16_t)
15986                         i16type=int16_t
15987                         u16type=uint16_t
15988                         i16size=2
15989                         u16size=2
15990                         ;;
15991                 esac
15992         fi
15993         ;;
15994 esac
15995 case "$i16type" in
15996 '')     if $test $shortsize -ge 2; then
15997                 i16type=short
15998                 u16type="unsigned short"
15999                 i16size=$shortsize
16000                 u16size=$shortsize
16001         fi
16002         ;;
16003 esac
16004
16005 case "$i32type" in
16006 '')     case "$longsize" in
16007         4)      i32type=long
16008                 u32type="unsigned long"
16009                 i32size=$longsize
16010                 u32size=$longsize
16011                 ;;
16012         *)      case "$intsize" in
16013                 4)      i32type=int
16014                         u32type="unsigned int"
16015                         i32size=$intsize
16016                         u32size=$intsize
16017                         ;;
16018                 esac
16019                 ;;
16020         esac
16021         ;;
16022 esac
16023 case "$i32type" in
16024 '')     set try -DINT32
16025         if eval $compile; then
16026                 case "`$run ./try`" in
16027                 int32_t)
16028                         i32type=int32_t
16029                         u32type=uint32_t
16030                         i32size=4
16031                         u32size=4
16032                         ;;
16033                 esac
16034         fi
16035         ;;
16036 esac
16037 case "$i32type" in
16038 '')     if $test $intsize -ge 4; then
16039                 i32type=int
16040                 u32type="unsigned int"
16041                 i32size=$intsize
16042                 u32size=$intsize
16043         fi
16044         ;;
16045 esac
16046
16047 case "$i64type" in
16048 '')     case "$d_quad:$quadtype" in
16049         define:?*)
16050                 i64type="$quadtype"
16051                 u64type="$uquadtype"
16052                 i64size=8
16053                 u64size=8
16054                 ;;
16055         esac
16056         ;;
16057 esac
16058
16059 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16060 : volatile so that the compiler has to store it out to memory.
16061 if test X"$d_volatile" = X"$define"; then
16062         volatile=volatile
16063 fi
16064 $cat <<EOP >try.c
16065 #include <stdio.h>
16066 #$i_stdlib I_STDLIB
16067 #ifdef I_STDLIB
16068 #include <stdlib.h>
16069 #endif
16070 #include <sys/types.h>
16071 #include <signal.h>
16072 #ifdef SIGFPE
16073 $volatile int bletched = 0;
16074 $signal_t blech(int s) { bletched = 1; }
16075 #endif
16076 int main() {
16077     $uvtype u = 0;
16078     $nvtype d;
16079     int     n = 8 * $uvsize;
16080     int     i;
16081 #ifdef SIGFPE
16082     signal(SIGFPE, blech);
16083 #endif
16084
16085     for (i = 0; i < n; i++) {
16086       u = u << 1 | ($uvtype)1;
16087       d = ($nvtype)u;
16088       if (($uvtype)d != u)
16089         break;
16090       if (d <= 0)
16091         break;
16092       d = ($nvtype)(u - 1);
16093       if (($uvtype)d != (u - 1))
16094         break;
16095 #ifdef SIGFPE
16096       if (bletched)
16097         break;
16098 #endif
16099     }
16100     printf("%d\n", ((i == n) ? -n : i));
16101     exit(0);
16102 }
16103 EOP
16104 set try
16105
16106 d_nv_preserves_uv="$undef"
16107 if eval $compile; then
16108         nv_preserves_uv_bits="`$run ./try`"
16109 fi
16110 case "$nv_preserves_uv_bits" in
16111 \-[1-9]*)
16112         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16113         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16114         d_nv_preserves_uv="$define"
16115         ;;
16116 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16117         d_nv_preserves_uv="$undef" ;;
16118 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16119         nv_preserves_uv_bits="0" ;;
16120 esac
16121 $rm_try
16122
16123 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16124 : volatile so that the compiler has to store it out to memory.
16125 if test X"$d_volatile" = X"$define"; then
16126         volatile=volatile
16127 fi
16128 $cat <<EOP >try.c
16129 #include <stdio.h>
16130
16131 typedef $nvtype NV;
16132
16133 int
16134 main() {
16135   NV value = 2;
16136   int count = 1;
16137
16138   while(count < 256) {
16139     $volatile NV up = value + 1.0;
16140     $volatile NV negated = -value;
16141     $volatile NV down = negated - 1.0;
16142     $volatile NV got_up = up - value;
16143     int up_good = got_up == 1.0;
16144     int got_down = down - negated;
16145     int down_good = got_down == -1.0;
16146
16147     if (down_good != up_good) {
16148       fprintf(stderr,
16149               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16150               up_good, (double) got_up, down_good, (double) got_down,
16151               count, (double) value);
16152       return 1;
16153     }
16154     if (!up_good) {
16155       while (1) {
16156         if (count > 8) {
16157           count -= 8;
16158           fputs("256.0", stdout);
16159         } else {
16160           count--;
16161           fputs("2.0", stdout);
16162         }
16163         if (!count) {
16164           puts("");
16165           return 0;
16166         }
16167         fputs("*", stdout);
16168       }
16169     }
16170     value *= 2;
16171     ++count;
16172   }
16173   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16174           count, (double) value);
16175   return 1;
16176 }
16177 EOP
16178 set try
16179
16180 nv_overflows_integers_at='0'
16181 if eval $compile; then
16182     xxx="`$run ./try`"
16183     case "$?" in
16184         0)
16185             case "$xxx" in
16186                 2*)  cat >&4 <<EOM
16187 The largest integer your NVs can preserve is equal to $xxx
16188 EOM
16189                     nv_overflows_integers_at="$xxx"
16190                     ;;
16191                 *)  cat >&4 <<EOM
16192 Cannot determine the largest integer value your NVs can hold, unexpected output
16193 '$xxx'
16194 EOM
16195                     ;;
16196             esac
16197             ;;
16198         *)  cat >&4 <<EOM
16199 Cannot determine the largest integer value your NVs can hold
16200 EOM
16201             ;;
16202     esac
16203 fi
16204 $rm_try
16205
16206 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16207 : volatile so that the compiler has to store it out to memory.
16208 if test X"$d_volatile" = X"$define"; then
16209         volatile=volatile
16210 fi
16211 $cat <<EOP >try.c
16212 #include <stdio.h>
16213 #$i_stdlib I_STDLIB
16214 #ifdef I_STDLIB
16215 #include <stdlib.h>
16216 #endif
16217 #$i_string I_STRING
16218 #ifdef I_STRING
16219 #  include <string.h>
16220 #else
16221 #  include <strings.h>
16222 #endif
16223 #include <sys/types.h>
16224 #include <signal.h>
16225 #ifdef SIGFPE
16226 $volatile int bletched = 0;
16227 $signal_t blech(int s) { bletched = 1; }
16228 #endif
16229
16230 int checkit($nvtype d, char *where) {
16231     unsigned char *p = (char *)&d;
16232     unsigned char *end = p + sizeof(d);
16233     int fail = 0;
16234
16235     while (p < end)
16236         fail += *p++;
16237
16238     if (!fail)
16239         return 0;
16240
16241     p = (char *)&d;
16242     printf("No - %s: 0x", where);
16243     while (p < end)
16244         printf ("%02X", *p++);
16245     printf("\n");
16246     return 1;
16247 }
16248
16249 int main(int argc, char **argv) {
16250     $nvtype d = 0.0;
16251     int fail = 0;
16252     fail += checkit(d, "0.0");
16253
16254     /* The compiler shouldn't be assuming that bletched is 0  */
16255     d = bletched;
16256
16257     fail += checkit(d, "bleched");
16258
16259 #ifdef SIGFPE
16260     signal(SIGFPE, blech);
16261 #endif
16262
16263     /* Paranoia - the compiler should have no way of knowing that ANSI says
16264        that argv[argc] will always be NULL.  Actually, if it did assume this it
16265        would be buggy, as this is C and main() can be called from elsewhere in
16266        the program.  */
16267     d = argv[argc] ? 1 : 0;
16268
16269     if (d) {
16270         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16271     }
16272
16273     fail += checkit(d, "ternary");
16274
16275     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16276
16277     if (d != 0.0) {
16278         printf("No - memset doesn't give 0.0\n");
16279         /* This might just blow up:  */
16280         printf("(gives %g)\n", d);
16281         return 1;
16282     }
16283
16284 #ifdef SIGFPE
16285     if (bletched) {
16286         printf("No - something bleched\n");
16287         return 1;
16288     }
16289 #endif
16290     if (fail) {
16291       printf("No - %d fail(s)\n", fail);
16292       return 1;
16293     }
16294     printf("Yes\n");
16295     return 0;
16296 }
16297 EOP
16298 set try
16299
16300 d_nv_zero_is_allbits_zero="$undef"
16301 if eval $compile; then
16302     xxx="`$run ./try`"
16303     case "$?" in
16304         0)
16305             case "$xxx" in
16306                 Yes)  cat >&4 <<EOM
16307 0.0 is represented as all bits zero in memory
16308 EOM
16309                     d_nv_zero_is_allbits_zero="$define"
16310                     ;;
16311                 *)  cat >&4 <<EOM
16312 0.0 is not represented as all bits zero in memory
16313 EOM
16314                     d_nv_zero_is_allbits_zero="$undef"
16315                     ;;
16316             esac
16317             ;;
16318         *)  cat >&4 <<EOM
16319 0.0 is not represented as all bits zero in memory
16320 EOM
16321             d_nv_zero_is_allbits_zero="$undef"
16322             ;;
16323     esac
16324 fi
16325 $rm_try
16326
16327 : check for off64_t
16328 echo " "
16329 echo "Checking to see if you have off64_t..." >&4
16330 $cat >try.c <<EOCP
16331 #include <sys/types.h>
16332 #include <unistd.h>
16333 int main() { off64_t x = 7; }
16334 EOCP
16335 set try
16336 if eval $compile; then
16337         val="$define"
16338         echo "You have off64_t."
16339 else
16340         val="$undef"
16341         echo "You do not have off64_t."
16342         case "$lseeksize" in
16343         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16344         esac
16345 fi
16346 $rm_try
16347 set d_off64_t
16348 eval $setvar
16349
16350 : how to create joinable pthreads
16351 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16352         echo " "
16353         echo "Checking what constant to use for creating joinable pthreads..." >&4
16354         $cat >try.c <<'EOCP'
16355 #include <pthread.h>
16356 int main() {
16357     int detachstate = JOINABLE;
16358 }
16359 EOCP
16360         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16361         if eval $compile; then
16362                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16363                 val="$undef" # Yes, undef.
16364                 set d_old_pthread_create_joinable
16365                 eval $setvar
16366                 val=""
16367                 set old_pthread_create_joinable
16368                 eval $setvar
16369         else
16370                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16371                 if eval $compile; then
16372                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16373                         val="$define"
16374                         set d_old_pthread_create_joinable
16375                         eval $setvar
16376                         val=PTHREAD_CREATE_UNDETACHED
16377                         set old_pthread_create_joinable
16378                         eval $setvar
16379                 else
16380                         set try -DJOINABLE=__UNDETACHED
16381                         if eval $compile; then
16382                                 echo "You seem to use __UNDETACHED." >&4
16383                                 val="$define"
16384                                 set d_old_pthread_create_joinable
16385                                 eval $setvar
16386                                 val=__UNDETACHED
16387                                 set old_pthread_create_joinable
16388                                 eval $setvar
16389                         else
16390                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16391                                 val="$define"
16392                                 set d_old_pthread_create_joinable
16393                                 eval $setvar
16394                                 val=0
16395                                 set old_pthread_create_joinable
16396                                 eval $setvar
16397                         fi
16398                 fi
16399         fi
16400         $rm_try
16401 else
16402     d_old_pthread_create_joinable="$undef"
16403     old_pthread_create_joinable=""
16404 fi
16405
16406 : see if pause exists
16407 set pause d_pause
16408 eval $inlibc
16409
16410 : see if poll exists
16411 set poll d_poll
16412 eval $inlibc
16413
16414 : see if prctl exists
16415 set prctl d_prctl
16416 eval $inlibc
16417
16418 : see if prctl supports PR_SET_NAME
16419 d_prctl_set_name=$undef
16420 case $d_prctl in
16421     $define)
16422         $cat >try.c <<EOM
16423 #include <sys/prctl.h>
16424
16425 int main (int argc, char *argv[])
16426 {
16427     return (prctl (PR_SET_NAME, "Test"));
16428     } /* main */
16429 EOM
16430         set try
16431         if eval $compile_ok && $run ./try; then
16432             echo "Your prctl (PR_SET_NAME, ...) works"
16433             d_prctl_set_name=$define
16434             fi
16435         $rm_try
16436         ;;
16437     esac
16438
16439 : see if readlink exists
16440 set readlink d_readlink
16441 eval $inlibc
16442
16443 : Check if exe is symlink to abs path of executing program
16444 echo " "
16445 procselfexe=''
16446 val="$undef"
16447 case "$d_readlink" in
16448     "$define")
16449         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16450         : more tidy to avoid an extra level of symlink
16451         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16452         while test $# -gt 0; do
16453             type=$1; try=$2
16454             shift; shift
16455             if $issymlink $try; then
16456                 $ls -l $try > reflect
16457                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16458                     echo "You have $type-like $try."
16459                     procselfexe='"'$try'"'
16460                     val="$define"
16461                     : This will break out of the loop
16462                     set X; shift
16463                 fi
16464             fi
16465         done
16466         ;;
16467 esac
16468 $rm -f reflect
16469 set d_procselfexe
16470 eval $setvar
16471
16472 : backward compatibility for d_hvfork
16473 if test X$d_hvfork != X; then
16474         d_vfork="$d_hvfork"
16475         d_hvfork=''
16476 fi
16477 : see if there is a vfork
16478 val=''
16479 set vfork val
16480 eval $inlibc
16481
16482 d_pseudofork=$undef
16483
16484 : Ok, but do we want to use it. vfork is reportedly unreliable in
16485 : perl on Solaris 2.x, and probably elsewhere.
16486 case "$val" in
16487 $define)
16488         echo " "
16489         case "$usevfork" in
16490         false) dflt='n';;
16491         *) dflt='y';;
16492         esac
16493         cat <<'EOM'
16494
16495 Perl can only use a vfork() that doesn't suffer from strict
16496 restrictions on calling functions or modifying global data in
16497 the child.  For example, glibc-2.1 contains such a vfork()
16498 that is unsuitable.  If your system provides a proper fork()
16499 call, chances are that you do NOT want perl to use vfork().
16500
16501 EOM
16502         rp="Do you still want to use vfork()?"
16503         . ./myread
16504         case "$ans" in
16505         y|Y) ;;
16506         *)
16507                 echo "Ok, we won't use vfork()."
16508                 val="$undef"
16509                 ;;
16510         esac
16511         ;;
16512 esac
16513 set d_vfork
16514 eval $setvar
16515 case "$d_vfork" in
16516 $define) usevfork='true';;
16517 *) usevfork='false';;
16518 esac
16519
16520 : see whether the pthread_atfork exists
16521 $cat >try.c <<EOP
16522 #include <pthread.h>
16523 #include <stdio.h>
16524 int main() {
16525 #ifdef  PTHREAD_ATFORK
16526         pthread_atfork(NULL,NULL,NULL);
16527 #endif
16528 }
16529 EOP
16530
16531 : see if pthread_atfork exists
16532 set try -DPTHREAD_ATFORK
16533 if eval $compile; then
16534     val="$define"
16535 else
16536     val="$undef"
16537 fi
16538 case "$usethreads" in
16539 $define)
16540         case "$val" in
16541         $define) echo 'pthread_atfork found.' >&4        ;;
16542         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16543         esac
16544 esac
16545 set d_pthread_atfork
16546 eval $setvar
16547
16548 : see if pthread_attr_setscope exists
16549 set pthread_attr_setscope d_pthread_attr_setscope
16550 eval $inlibc
16551
16552 : see whether the various POSIXish _yields exist
16553 $cat >try.c <<EOP
16554 #include <pthread.h>
16555 #include <stdio.h>
16556 int main() {
16557 #ifdef SCHED_YIELD
16558         sched_yield();
16559 #else
16560 #ifdef PTHREAD_YIELD
16561         pthread_yield();
16562 #else
16563 #ifdef PTHREAD_YIELD_NULL
16564         pthread_yield(NULL);
16565 #endif
16566 #endif
16567 #endif
16568 }
16569 EOP
16570 : see if sched_yield exists
16571 set try -DSCHED_YIELD
16572 if eval $compile; then
16573     val="$define"
16574     sched_yield='sched_yield()'
16575 else
16576     val="$undef"
16577 fi
16578 case "$usethreads" in
16579 $define)
16580         case "$val" in
16581         $define) echo 'sched_yield() found.' >&4        ;;
16582         *)       echo 'sched_yield() NOT found.' >&4    ;;
16583         esac
16584 esac
16585 set d_sched_yield
16586 eval $setvar
16587
16588 : see if pthread_yield exists
16589 set try -DPTHREAD_YIELD
16590 if eval $compile; then
16591     val="$define"
16592     case "$sched_yield" in
16593     '') sched_yield='pthread_yield()' ;;
16594     esac
16595 else
16596     set try -DPTHREAD_YIELD_NULL
16597     if eval $compile; then
16598         val="$define"
16599         case "$sched_yield" in
16600         '') sched_yield='pthread_yield(NULL)' ;;
16601         esac
16602     else
16603         val="$undef"
16604     fi
16605 fi
16606 case "$usethreads" in
16607 $define)
16608         case "$val" in
16609         $define) echo 'pthread_yield() found.' >&4      ;;
16610         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16611         esac
16612         ;;
16613 esac
16614 set d_pthread_yield
16615 eval $setvar
16616 case "$sched_yield" in
16617 '') sched_yield=undef ;;
16618 esac
16619 $rm_try
16620
16621 : see if random_r exists
16622 set random_r d_random_r
16623 eval $inlibc
16624 case "$d_random_r" in
16625 "$define")
16626         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16627         case "$d_random_r_proto:$usethreads" in
16628         ":define")      d_random_r_proto=define
16629                 set d_random_r_proto random_r $hdrs
16630                 eval $hasproto ;;
16631         *)      ;;
16632         esac
16633         case "$d_random_r_proto" in
16634         define)
16635         case "$random_r_proto" in
16636         ''|0) try='int random_r(int*, struct random_data*);'
16637         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16638         esac
16639         case "$random_r_proto" in
16640         ''|0) try='int random_r(long*, struct random_data*);'
16641         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16642         esac
16643         case "$random_r_proto" in
16644         ''|0) try='int random_r(struct random_data*, int32_t*);'
16645         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16646         esac
16647         case "$random_r_proto" in
16648         ''|0)   d_random_r=undef
16649                 random_r_proto=0
16650                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16651         * )     case "$random_r_proto" in
16652                 REENTRANT_PROTO*) ;;
16653                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16654                 esac
16655                 echo "Prototype: $try" ;;
16656         esac
16657         ;;
16658         *)      case "$usethreads" in
16659                 define) echo "random_r has no prototype, not using it." >&4 ;;
16660                 esac
16661                 d_random_r=undef
16662                 random_r_proto=0
16663                 ;;
16664         esac
16665         ;;
16666 *)      random_r_proto=0
16667         ;;
16668 esac
16669
16670 : see if readdir and friends exist
16671 set readdir d_readdir
16672 eval $inlibc
16673 set seekdir d_seekdir
16674 eval $inlibc
16675 set telldir d_telldir
16676 eval $inlibc
16677 set rewinddir d_rewinddir
16678 eval $inlibc
16679
16680 : see if readdir64_r exists
16681 set readdir64_r d_readdir64_r
16682 eval $inlibc
16683 case "$d_readdir64_r" in
16684 "$define")
16685         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16686         case "$d_readdir64_r_proto:$usethreads" in
16687         ":define")      d_readdir64_r_proto=define
16688                 set d_readdir64_r_proto readdir64_r $hdrs
16689                 eval $hasproto ;;
16690         *)      ;;
16691         esac
16692         case "$d_readdir64_r_proto" in
16693         define)
16694         case "$readdir64_r_proto" in
16695         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16696         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16697         esac
16698         case "$readdir64_r_proto" in
16699         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16700         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16701         esac
16702         case "$readdir64_r_proto" in
16703         ''|0)   d_readdir64_r=undef
16704                 readdir64_r_proto=0
16705                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16706         * )     case "$readdir64_r_proto" in
16707                 REENTRANT_PROTO*) ;;
16708                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16709                 esac
16710                 echo "Prototype: $try" ;;
16711         esac
16712         ;;
16713         *)      case "$usethreads" in
16714                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16715                 esac
16716                 d_readdir64_r=undef
16717                 readdir64_r_proto=0
16718                 ;;
16719         esac
16720         ;;
16721 *)      readdir64_r_proto=0
16722         ;;
16723 esac
16724
16725 : see if readdir_r exists
16726 set readdir_r d_readdir_r
16727 eval $inlibc
16728 case "$d_readdir_r" in
16729 "$define")
16730         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16731         case "$d_readdir_r_proto:$usethreads" in
16732         ":define")      d_readdir_r_proto=define
16733                 set d_readdir_r_proto readdir_r $hdrs
16734                 eval $hasproto ;;
16735         *)      ;;
16736         esac
16737         case "$d_readdir_r_proto" in
16738         define)
16739         case "$readdir_r_proto" in
16740         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16741         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16742         esac
16743         case "$readdir_r_proto" in
16744         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16745         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16746         esac
16747         case "$readdir_r_proto" in
16748         ''|0)   d_readdir_r=undef
16749                 readdir_r_proto=0
16750                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16751         * )     case "$readdir_r_proto" in
16752                 REENTRANT_PROTO*) ;;
16753                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16754                 esac
16755                 echo "Prototype: $try" ;;
16756         esac
16757         ;;
16758         *)      case "$usethreads" in
16759                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16760                 esac
16761                 d_readdir_r=undef
16762                 readdir_r_proto=0
16763                 ;;
16764         esac
16765         ;;
16766 *)      readdir_r_proto=0
16767         ;;
16768 esac
16769
16770 : see if readv exists
16771 set readv d_readv
16772 eval $inlibc
16773
16774 : see if recvmsg exists
16775 set recvmsg d_recvmsg
16776 eval $inlibc
16777
16778 : see if rename exists
16779 set rename d_rename
16780 eval $inlibc
16781
16782 : see if rmdir exists
16783 set rmdir d_rmdir
16784 eval $inlibc
16785
16786 : see if memory.h is available.
16787 val=''
16788 set memory.h val
16789 eval $inhdr
16790
16791 : See if it conflicts with string.h
16792 case "$val" in
16793 $define)
16794         case "$strings" in
16795         '') ;;
16796         *)
16797                 $cppstdin $cppflags $cppminus < $strings > mem.h
16798                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16799                         echo " "
16800                         echo "We won't be including <memory.h>."
16801                         val="$undef"
16802                 fi
16803                 $rm -f mem.h
16804                 ;;
16805         esac
16806 esac
16807 set i_memory
16808 eval $setvar
16809
16810 : can bcopy handle overlapping blocks?
16811 echo " "
16812 val="$undef"
16813 case "$d_memmove" in
16814 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16815 *)      case "$d_bcopy" in
16816         "$define")
16817                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16818                 $cat >try.c <<EOCP
16819 #$i_memory I_MEMORY
16820 #$i_stdlib I_STDLIB
16821 #$i_string I_STRING
16822 #$i_unistd I_UNISTD
16823 EOCP
16824         $cat >>try.c <<'EOCP'
16825 #include <stdio.h>
16826 #ifdef I_MEMORY
16827 #  include <memory.h>
16828 #endif
16829 #ifdef I_STDLIB
16830 #  include <stdlib.h>
16831 #endif
16832 #ifdef I_STRING
16833 #  include <string.h>
16834 #else
16835 #  include <strings.h>
16836 #endif
16837 #ifdef I_UNISTD
16838 #  include <unistd.h>  /* Needed for NetBSD */
16839 #endif
16840 int main()
16841 {
16842 char buf[128], abc[128];
16843 char *b;
16844 int len;
16845 int off;
16846 int align;
16847
16848 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16849    try to store the string in read-only memory. */
16850 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16851
16852 for (align = 7; align >= 0; align--) {
16853         for (len = 36; len; len--) {
16854                 b = buf+align;
16855                 bcopy(abc, b, len);
16856                 for (off = 1; off <= len; off++) {
16857                         bcopy(b, b+off, len);
16858                         bcopy(b+off, b, len);
16859                         if (bcmp(b, abc, len))
16860                                 exit(1);
16861                 }
16862         }
16863 }
16864 exit(0);
16865 }
16866 EOCP
16867                 set try
16868                 if eval $compile_ok; then
16869                         if $run ./try 2>/dev/null; then
16870                                 echo "Yes, it can."
16871                                 val="$define"
16872                         else
16873                                 echo "It can't, sorry."
16874                         fi
16875                 else
16876                         echo "(I can't compile the test program, so we'll assume not...)"
16877                 fi
16878                 ;;
16879         esac
16880         $rm_try
16881         ;;
16882 esac
16883 set d_safebcpy
16884 eval $setvar
16885
16886 : can memcpy handle overlapping blocks?
16887 echo " "
16888 val="$undef"
16889 case "$d_memmove" in
16890 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16891 *)      case "$d_memcpy" in
16892         "$define")
16893                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16894                 $cat >try.c <<EOCP
16895 #$i_memory I_MEMORY
16896 #$i_stdlib I_STDLIB
16897 #$i_string I_STRING
16898 #$i_unistd I_UNISTD
16899 EOCP
16900         $cat >>try.c <<'EOCP'
16901 #include <stdio.h>
16902 #ifdef I_MEMORY
16903 #  include <memory.h>
16904 #endif
16905 #ifdef I_STDLIB
16906 #  include <stdlib.h>
16907 #endif
16908 #ifdef I_STRING
16909 #  include <string.h>
16910 #else
16911 #  include <strings.h>
16912 #endif
16913 #ifdef I_UNISTD
16914 #  include <unistd.h>  /* Needed for NetBSD */
16915 #endif
16916 int main()
16917 {
16918 char buf[128], abc[128];
16919 char *b;
16920 int len;
16921 int off;
16922 int align;
16923
16924 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16925    try to store the string in read-only memory. */
16926 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16927
16928 for (align = 7; align >= 0; align--) {
16929         for (len = 36; len; len--) {
16930                 b = buf+align;
16931                 memcpy(b, abc, len);
16932                 for (off = 1; off <= len; off++) {
16933                         memcpy(b+off, b, len);
16934                         memcpy(b, b+off, len);
16935                         if (memcmp(b, abc, len))
16936                                 exit(1);
16937                 }
16938         }
16939 }
16940 exit(0);
16941 }
16942 EOCP
16943                 set try
16944                 if eval $compile_ok; then
16945                         if $run ./try 2>/dev/null; then
16946                                 echo "Yes, it can."
16947                                 val="$define"
16948                         else
16949                                 echo "It can't, sorry."
16950                         fi
16951                 else
16952                         echo "(I can't compile the test program, so we'll assume not...)"
16953                 fi
16954                 ;;
16955         esac
16956         $rm_try
16957         ;;
16958 esac
16959 set d_safemcpy
16960 eval $setvar
16961
16962 : can memcmp be trusted to compare relative magnitude?
16963 val="$undef"
16964 case "$d_memcmp" in
16965 "$define")
16966         echo " "
16967         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16968         $cat >try.c <<EOCP
16969 #$i_memory I_MEMORY
16970 #$i_stdlib I_STDLIB
16971 #$i_string I_STRING
16972 #$i_unistd I_UNISTD
16973 EOCP
16974         $cat >>try.c <<'EOCP'
16975 #include <stdio.h>
16976 #ifdef I_MEMORY
16977 #  include <memory.h>
16978 #endif
16979 #ifdef I_STDLIB
16980 #  include <stdlib.h>
16981 #endif
16982 #ifdef I_STRING
16983 #  include <string.h>
16984 #else
16985 #  include <strings.h>
16986 #endif
16987 #ifdef I_UNISTD
16988 #  include <unistd.h>  /* Needed for NetBSD */
16989 #endif
16990 int main()
16991 {
16992 char a = -1;
16993 char b = 0;
16994 if ((a < b) && memcmp(&a, &b, 1) < 0)
16995         exit(1);
16996 exit(0);
16997 }
16998 EOCP
16999         set try
17000         if eval $compile_ok; then
17001                 if $run ./try 2>/dev/null; then
17002                         echo "Yes, it can."
17003                         val="$define"
17004                 else
17005                         echo "No, it can't (it uses signed chars)."
17006                 fi
17007         else
17008                 echo "(I can't compile the test program, so we'll assume not...)"
17009         fi
17010         ;;
17011 esac
17012 $rm_try
17013 set d_sanemcmp
17014 eval $setvar
17015
17016 : see if prototype for sbrk is available
17017 echo " "
17018 set d_sbrkproto sbrk $i_unistd unistd.h
17019 eval $hasproto
17020
17021 : see if select exists
17022 set select d_select
17023 eval $inlibc
17024
17025 : see if semctl exists
17026 set semctl d_semctl
17027 eval $inlibc
17028
17029 : see if semget exists
17030 set semget d_semget
17031 eval $inlibc
17032
17033 : see if semop exists
17034 set semop d_semop
17035 eval $inlibc
17036
17037 : see how much of the 'sem*(2)' library is present.
17038 h_sem=true
17039 echo " "
17040 case "$d_semctl$d_semget$d_semop" in
17041 *"$undef"*) h_sem=false;;
17042 esac
17043 case "$osname" in
17044 freebsd)
17045     case "`ipcs 2>&1`" in
17046     "SVID messages"*"not configured"*)
17047         echo "Your $osname does not have the sem*(2) configured." >&4
17048         h_sem=false
17049         val="$undef"
17050         set semctl d_semctl
17051         eval $setvar
17052         set semget d_semget
17053         eval $setvar
17054         set semop d_semop
17055         eval $setvar
17056         ;;
17057     esac
17058     ;;
17059 esac
17060 : we could also check for sys/ipc.h ...
17061 if $h_sem && $test `./findhdr sys/sem.h`; then
17062         echo "You have the full sem*(2) library." >&4
17063         val="$define"
17064 else
17065         echo "You don't have the full sem*(2) library." >&4
17066         val="$undef"
17067 fi
17068 set d_sem
17069 eval $setvar
17070
17071 : see whether sys/sem.h defines union semun
17072 echo " "
17073 $cat > try.c <<'END'
17074 #include <sys/types.h>
17075 #include <sys/ipc.h>
17076 #include <sys/sem.h>
17077 int main () { union semun semun; semun.buf = 0; }
17078 END
17079 set try
17080 if eval $compile; then
17081     echo "You have union semun in <sys/sem.h>." >&4
17082     val="$define"
17083 else
17084     echo "You do not have union semun in <sys/sem.h>." >&4
17085     val="$undef"
17086 fi
17087 $rm_try
17088 set d_union_semun
17089 eval $setvar
17090
17091 : see how to do semctl IPC_STAT
17092 case "$d_sem" in
17093 $define)
17094     echo " "
17095     $cat > tryh.h <<END
17096 #ifndef S_IRUSR
17097 #   ifdef S_IREAD
17098 #       define S_IRUSR S_IREAD
17099 #       define S_IWUSR S_IWRITE
17100 #       define S_IXUSR S_IEXEC
17101 #   else
17102 #       define S_IRUSR 0400
17103 #       define S_IWUSR 0200
17104 #       define S_IXUSR 0100
17105 #   endif
17106 #   define S_IRGRP (S_IRUSR>>3)
17107 #   define S_IWGRP (S_IWUSR>>3)
17108 #   define S_IXGRP (S_IXUSR>>3)
17109 #   define S_IROTH (S_IRUSR>>6)
17110 #   define S_IWOTH (S_IWUSR>>6)
17111 #   define S_IXOTH (S_IXUSR>>6)
17112 #endif
17113 #ifndef S_IRWXU
17114 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17115 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17116 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17117 #endif
17118 END
17119     : see whether semctl IPC_STAT can use union semun
17120     case "$d_semctl_semun" in
17121     '')
17122       val="$undef"
17123       $cat > try.c <<END
17124 #include <sys/types.h>
17125 #include <sys/ipc.h>
17126 #include <sys/sem.h>
17127 #include <sys/stat.h>
17128 #include <stdio.h>
17129 #include <errno.h>
17130 #include "tryh.h"
17131 #ifndef errno
17132 extern int errno;
17133 #endif
17134 #$d_union_semun HAS_UNION_SEMUN
17135 int main() {
17136     union semun
17137 #ifndef HAS_UNION_SEMUN
17138     {
17139         int val;
17140         struct semid_ds *buf;
17141         unsigned short *array;
17142     }
17143 #endif
17144     arg;
17145     int sem, st;
17146
17147 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17148     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17149     if (sem > -1) {
17150         struct semid_ds argbuf;
17151         arg.buf = &argbuf;
17152 #       ifdef IPC_STAT
17153         st = semctl(sem, 0, IPC_STAT, arg);
17154         if (st == 0)
17155             printf("semun\n");
17156         else
17157 #       endif /* IPC_STAT */
17158             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17159 #       ifdef IPC_RMID
17160         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17161 #       endif /* IPC_RMID */
17162             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17163     } else
17164 #endif /* IPC_PRIVATE && ... */
17165         printf("semget failed: errno = %d\n", errno);
17166   return 0;
17167 }
17168 END
17169       set try
17170       if eval $compile; then
17171           xxx=`$run ./try`
17172           case "$xxx" in
17173           semun) val="$define" ;;
17174           esac
17175       fi
17176       $rm_try
17177       set d_semctl_semun
17178       eval $setvar
17179       ;;
17180     esac
17181     case "$d_semctl_semun" in
17182     $define)
17183         echo "You can use union semun for semctl IPC_STAT." >&4
17184         also='also'
17185         ;;
17186     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17187         also=''
17188         ;;
17189     esac
17190
17191     : see whether semctl IPC_STAT can use struct semid_ds pointer
17192     case "$d_semctl_semid_ds" in
17193     '')
17194       val="$undef"
17195       $cat > try.c <<'END'
17196 #include <sys/types.h>
17197 #include <sys/ipc.h>
17198 #include <sys/sem.h>
17199 #include <sys/stat.h>
17200 #include "tryh.h"
17201 #include <stdio.h>
17202 #include <errno.h>
17203 #ifndef errno
17204 extern int errno;
17205 #endif
17206 int main() {
17207     struct semid_ds arg;
17208     int sem, st;
17209
17210 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17211     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17212     if (sem > -1) {
17213 #       ifdef IPC_STAT
17214         st = semctl(sem, 0, IPC_STAT, &arg);
17215         if (st == 0)
17216             printf("semid_ds\n");
17217         else
17218 #       endif /* IPC_STAT */
17219             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17220 #       ifdef IPC_RMID
17221         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17222 #       endif /* IPC_RMID */
17223             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17224     } else
17225 #endif /* IPC_PRIVATE && ... */
17226         printf("semget failed: errno = %d\n", errno);
17227
17228     return 0;
17229 }
17230 END
17231       set try
17232       if eval $compile; then
17233           xxx=`$run ./try`
17234           case "$xxx" in
17235           semid_ds) val="$define" ;;
17236           esac
17237       fi
17238       $rm_try
17239       set d_semctl_semid_ds
17240       eval $setvar
17241       ;;
17242     esac
17243     case "$d_semctl_semid_ds" in
17244     $define)
17245         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17246         ;;
17247     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17248         ;;
17249     esac
17250     ;;
17251 *)  val="$undef"
17252
17253     # We do not have the full sem*(2) library, so assume we can not
17254     # use either.
17255
17256     set d_semctl_semun
17257     eval $setvar
17258
17259     set d_semctl_semid_ds
17260     eval $setvar
17261     ;;
17262 esac
17263 $rm_try tryh.h
17264
17265 : see if sendmsg exists
17266 set sendmsg d_sendmsg
17267 eval $inlibc
17268
17269 : see if setegid exists
17270 set setegid d_setegid
17271 eval $inlibc
17272
17273 : see if seteuid exists
17274 set seteuid d_seteuid
17275 eval $inlibc
17276
17277 : see if setgrent exists
17278 set setgrent d_setgrent
17279 eval $inlibc
17280
17281 : see if setgrent_r exists
17282 set setgrent_r d_setgrent_r
17283 eval $inlibc
17284 case "$d_setgrent_r" in
17285 "$define")
17286         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17287         case "$d_setgrent_r_proto:$usethreads" in
17288         ":define")      d_setgrent_r_proto=define
17289                 set d_setgrent_r_proto setgrent_r $hdrs
17290                 eval $hasproto ;;
17291         *)      ;;
17292         esac
17293         case "$d_setgrent_r_proto" in
17294         define)
17295         case "$setgrent_r_proto" in
17296         ''|0) try='int setgrent_r(FILE**);'
17297         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17298         esac
17299         case "$setgrent_r_proto" in
17300         ''|0) try='void setgrent_r(FILE**);'
17301         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17302         esac
17303         case "$setgrent_r_proto" in
17304         ''|0)   d_setgrent_r=undef
17305                 setgrent_r_proto=0
17306                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17307         * )     case "$setgrent_r_proto" in
17308                 REENTRANT_PROTO*) ;;
17309                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17310                 esac
17311                 echo "Prototype: $try" ;;
17312         esac
17313         ;;
17314         *)      case "$usethreads" in
17315                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17316                 esac
17317                 d_setgrent_r=undef
17318                 setgrent_r_proto=0
17319                 ;;
17320         esac
17321         ;;
17322 *)      setgrent_r_proto=0
17323         ;;
17324 esac
17325
17326 : see if sethostent exists
17327 set sethostent d_sethent
17328 eval $inlibc
17329
17330 : see if sethostent_r exists
17331 set sethostent_r d_sethostent_r
17332 eval $inlibc
17333 case "$d_sethostent_r" in
17334 "$define")
17335         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17336         case "$d_sethostent_r_proto:$usethreads" in
17337         ":define")      d_sethostent_r_proto=define
17338                 set d_sethostent_r_proto sethostent_r $hdrs
17339                 eval $hasproto ;;
17340         *)      ;;
17341         esac
17342         case "$d_sethostent_r_proto" in
17343         define)
17344         case "$sethostent_r_proto" in
17345         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17346         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17347         esac
17348         case "$sethostent_r_proto" in
17349         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17350         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17351         esac
17352         case "$sethostent_r_proto" in
17353         ''|0)   d_sethostent_r=undef
17354                 sethostent_r_proto=0
17355                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17356         * )     case "$sethostent_r_proto" in
17357                 REENTRANT_PROTO*) ;;
17358                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17359                 esac
17360                 echo "Prototype: $try" ;;
17361         esac
17362         ;;
17363         *)      case "$usethreads" in
17364                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17365                 esac
17366                 d_sethostent_r=undef
17367                 sethostent_r_proto=0
17368                 ;;
17369         esac
17370         ;;
17371 *)      sethostent_r_proto=0
17372         ;;
17373 esac
17374
17375 : see if setitimer exists
17376 set setitimer d_setitimer
17377 eval $inlibc
17378
17379 : see if setlinebuf exists
17380 set setlinebuf d_setlinebuf
17381 eval $inlibc
17382
17383 : see if setlocale exists
17384 set setlocale d_setlocale
17385 eval $inlibc
17386
17387 : see if locale.h is available
17388 set locale.h i_locale
17389 eval $inhdr
17390
17391 : see if setlocale_r exists
17392 set setlocale_r d_setlocale_r
17393 eval $inlibc
17394 case "$d_setlocale_r" in
17395 "$define")
17396         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17397         case "$d_setlocale_r_proto:$usethreads" in
17398         ":define")      d_setlocale_r_proto=define
17399                 set d_setlocale_r_proto setlocale_r $hdrs
17400                 eval $hasproto ;;
17401         *)      ;;
17402         esac
17403         case "$d_setlocale_r_proto" in
17404         define)
17405         case "$setlocale_r_proto" in
17406         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17407         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17408         esac
17409         case "$setlocale_r_proto" in
17410         ''|0)   d_setlocale_r=undef
17411                 setlocale_r_proto=0
17412                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17413         * )     case "$setlocale_r_proto" in
17414                 REENTRANT_PROTO*) ;;
17415                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17416                 esac
17417                 echo "Prototype: $try" ;;
17418         esac
17419         ;;
17420         *)      case "$usethreads" in
17421                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17422                 esac
17423                 d_setlocale_r=undef
17424                 setlocale_r_proto=0
17425                 ;;
17426         esac
17427         ;;
17428 *)      setlocale_r_proto=0
17429         ;;
17430 esac
17431
17432 : see if setnetent exists
17433 set setnetent d_setnent
17434 eval $inlibc
17435
17436 : see if setnetent_r exists
17437 set setnetent_r d_setnetent_r
17438 eval $inlibc
17439 case "$d_setnetent_r" in
17440 "$define")
17441         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17442         case "$d_setnetent_r_proto:$usethreads" in
17443         ":define")      d_setnetent_r_proto=define
17444                 set d_setnetent_r_proto setnetent_r $hdrs
17445                 eval $hasproto ;;
17446         *)      ;;
17447         esac
17448         case "$d_setnetent_r_proto" in
17449         define)
17450         case "$setnetent_r_proto" in
17451         ''|0) try='int setnetent_r(int, struct netent_data*);'
17452         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17453         esac
17454         case "$setnetent_r_proto" in
17455         ''|0) try='void setnetent_r(int, struct netent_data*);'
17456         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17457         esac
17458         case "$setnetent_r_proto" in
17459         ''|0)   d_setnetent_r=undef
17460                 setnetent_r_proto=0
17461                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17462         * )     case "$setnetent_r_proto" in
17463                 REENTRANT_PROTO*) ;;
17464                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17465                 esac
17466                 echo "Prototype: $try" ;;
17467         esac
17468         ;;
17469         *)      case "$usethreads" in
17470                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17471                 esac
17472                 d_setnetent_r=undef
17473                 setnetent_r_proto=0
17474                 ;;
17475         esac
17476         ;;
17477 *)      setnetent_r_proto=0
17478         ;;
17479 esac
17480
17481 : see if setprotoent exists
17482 set setprotoent d_setpent
17483 eval $inlibc
17484
17485 : see if setpgid exists
17486 set setpgid d_setpgid
17487 eval $inlibc
17488
17489 : see if setpgrp2 exists
17490 set setpgrp2 d_setpgrp2
17491 eval $inlibc
17492
17493 : see if setpriority exists
17494 set setpriority d_setprior
17495 eval $inlibc
17496
17497 : see if setproctitle exists
17498 set setproctitle d_setproctitle
17499 eval $inlibc
17500
17501 : see if setprotoent_r exists
17502 set setprotoent_r d_setprotoent_r
17503 eval $inlibc
17504 case "$d_setprotoent_r" in
17505 "$define")
17506         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17507         case "$d_setprotoent_r_proto:$usethreads" in
17508         ":define")      d_setprotoent_r_proto=define
17509                 set d_setprotoent_r_proto setprotoent_r $hdrs
17510                 eval $hasproto ;;
17511         *)      ;;
17512         esac
17513         case "$d_setprotoent_r_proto" in
17514         define)
17515         case "$setprotoent_r_proto" in
17516         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17517         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17518         esac
17519         case "$setprotoent_r_proto" in
17520         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17521         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17522         esac
17523         case "$setprotoent_r_proto" in
17524         ''|0)   d_setprotoent_r=undef
17525                 setprotoent_r_proto=0
17526                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17527         * )     case "$setprotoent_r_proto" in
17528                 REENTRANT_PROTO*) ;;
17529                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17530                 esac
17531                 echo "Prototype: $try" ;;
17532         esac
17533         ;;
17534         *)      case "$usethreads" in
17535                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17536                 esac
17537                 d_setprotoent_r=undef
17538                 setprotoent_r_proto=0
17539                 ;;
17540         esac
17541         ;;
17542 *)      setprotoent_r_proto=0
17543         ;;
17544 esac
17545
17546 : see if setpwent exists
17547 set setpwent d_setpwent
17548 eval $inlibc
17549
17550 : see if setpwent_r exists
17551 set setpwent_r d_setpwent_r
17552 eval $inlibc
17553 case "$d_setpwent_r" in
17554 "$define")
17555         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17556         case "$d_setpwent_r_proto:$usethreads" in
17557         ":define")      d_setpwent_r_proto=define
17558                 set d_setpwent_r_proto setpwent_r $hdrs
17559                 eval $hasproto ;;
17560         *)      ;;
17561         esac
17562         case "$d_setpwent_r_proto" in
17563         define)
17564         case "$setpwent_r_proto" in
17565         ''|0) try='int setpwent_r(FILE**);'
17566         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17567         esac
17568         case "$setpwent_r_proto" in
17569         ''|0) try='void setpwent_r(FILE**);'
17570         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17571         esac
17572         case "$setpwent_r_proto" in
17573         ''|0)   d_setpwent_r=undef
17574                 setpwent_r_proto=0
17575                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17576         * )     case "$setpwent_r_proto" in
17577                 REENTRANT_PROTO*) ;;
17578                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17579                 esac
17580                 echo "Prototype: $try" ;;
17581         esac
17582         ;;
17583         *)      case "$usethreads" in
17584                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17585                 esac
17586                 d_setpwent_r=undef
17587                 setpwent_r_proto=0
17588                 ;;
17589         esac
17590         ;;
17591 *)      setpwent_r_proto=0
17592         ;;
17593 esac
17594
17595 : see if setregid exists
17596 set setregid d_setregid
17597 eval $inlibc
17598 set setresgid d_setresgid
17599 eval $inlibc
17600
17601 : see if setreuid exists
17602 set setreuid d_setreuid
17603 eval $inlibc
17604 set setresuid d_setresuid
17605 eval $inlibc
17606
17607 : see if setrgid exists
17608 set setrgid d_setrgid
17609 eval $inlibc
17610
17611 : see if setruid exists
17612 set setruid d_setruid
17613 eval $inlibc
17614
17615 : see if setservent exists
17616 set setservent d_setsent
17617 eval $inlibc
17618
17619 : see if setservent_r exists
17620 set setservent_r d_setservent_r
17621 eval $inlibc
17622 case "$d_setservent_r" in
17623 "$define")
17624         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17625         case "$d_setservent_r_proto:$usethreads" in
17626         ":define")      d_setservent_r_proto=define
17627                 set d_setservent_r_proto setservent_r $hdrs
17628                 eval $hasproto ;;
17629         *)      ;;
17630         esac
17631         case "$d_setservent_r_proto" in
17632         define)
17633         case "$setservent_r_proto" in
17634         ''|0) try='int setservent_r(int, struct servent_data*);'
17635         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17636         esac
17637         case "$setservent_r_proto" in
17638         ''|0) try='void setservent_r(int, struct servent_data*);'
17639         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17640         esac
17641         case "$setservent_r_proto" in
17642         ''|0)   d_setservent_r=undef
17643                 setservent_r_proto=0
17644                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17645         * )     case "$setservent_r_proto" in
17646                 REENTRANT_PROTO*) ;;
17647                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17648                 esac
17649                 echo "Prototype: $try" ;;
17650         esac
17651         ;;
17652         *)      case "$usethreads" in
17653                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17654                 esac
17655                 d_setservent_r=undef
17656                 setservent_r_proto=0
17657                 ;;
17658         esac
17659         ;;
17660 *)      setservent_r_proto=0
17661         ;;
17662 esac
17663
17664 : see if setsid exists
17665 set setsid d_setsid
17666 eval $inlibc
17667
17668 : see if setvbuf exists
17669 set setvbuf d_setvbuf
17670 eval $inlibc
17671
17672 : see if shmctl exists
17673 set shmctl d_shmctl
17674 eval $inlibc
17675
17676 : see if shmget exists
17677 set shmget d_shmget
17678 eval $inlibc
17679
17680 : see if shmat exists
17681 set shmat d_shmat
17682 eval $inlibc
17683 : see what shmat returns
17684 case "$d_shmat" in
17685 "$define")
17686         $cat >shmat.c <<'END'
17687 #include <sys/shm.h>
17688 void *shmat();
17689 END
17690         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17691                 shmattype='void *'
17692         else
17693                 shmattype='char *'
17694         fi
17695         echo "and it returns ($shmattype)." >&4
17696         : see if a prototype for shmat is available
17697         xxx=`./findhdr sys/shm.h`
17698         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17699         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17700                 val="$define"
17701         else
17702                 val="$undef"
17703         fi
17704         $rm -f shmat.[co]
17705         ;;
17706 *)
17707         val="$undef"
17708         ;;
17709 esac
17710 set d_shmatprototype
17711 eval $setvar
17712
17713 : see if shmdt exists
17714 set shmdt d_shmdt
17715 eval $inlibc
17716
17717 : see how much of the 'shm*(2)' library is present.
17718 h_shm=true
17719 echo " "
17720 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17721 *"$undef"*) h_shm=false;;
17722 esac
17723 case "$osname" in
17724 freebsd)
17725     case "`ipcs 2>&1`" in
17726     "SVID shared memory"*"not configured"*)
17727         echo "Your $osname does not have the shm*(2) configured." >&4
17728         h_shm=false
17729         val="$undef"
17730         set shmctl d_shmctl
17731         evat $setvar
17732         set shmget d_shmget
17733         evat $setvar
17734         set shmat d_shmat
17735         evat $setvar
17736         set shmdt d_shmdt
17737         evat $setvar
17738         ;;
17739     esac
17740     ;;
17741 esac
17742 : we could also check for sys/ipc.h ...
17743 if $h_shm && $test `./findhdr sys/shm.h`; then
17744         echo "You have the full shm*(2) library." >&4
17745         val="$define"
17746 else
17747         echo "You don't have the full shm*(2) library." >&4
17748         val="$undef"
17749 fi
17750 set d_shm
17751 eval $setvar
17752
17753 : see if we have sigaction
17754 echo " "
17755 if set sigaction val -f d_sigaction; eval $csym; $val; then
17756         echo 'sigaction() found.' >&4
17757         $cat > try.c <<EOP
17758 #include <stdio.h>
17759 #include <sys/types.h>
17760 #include <signal.h>
17761 #$i_stdlib I_STDLIB
17762 #ifdef I_STDLIB
17763 #include <stdlib.h>
17764 #endif
17765 int main()
17766 {
17767     struct sigaction act, oact;
17768     act.sa_flags = 0;
17769     oact.sa_handler = 0;
17770     /* so that act and oact are used */
17771     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17772 }
17773 EOP
17774         set try
17775         if eval $compile_ok; then
17776                 val="$define"
17777         else
17778                 echo "But you don't seem to have a usable struct sigaction." >&4
17779                 val="$undef"
17780         fi
17781 else
17782         echo 'sigaction NOT found.' >&4
17783         val="$undef"
17784 fi
17785 set d_sigaction; eval $setvar
17786 $rm_try
17787
17788 : see if this is a sunmath.h system
17789 set sunmath.h i_sunmath
17790 eval $inhdr
17791
17792 : see if signbit exists
17793 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17794 $cat >try.c <<EOCP
17795 #$i_math I_MATH
17796 #$i_sunmath I_SUNMATH
17797 #ifdef I_MATH
17798 #  include <math.h>
17799 #endif
17800 #ifdef I_SUNMATH  /* Solaris special math library */
17801 #  include <sunmath.h>
17802 #endif
17803 #define NV $nvtype
17804 int main(int argc, char **argv)
17805 {
17806     NV x = 0.0;
17807     NV y = -0.0;
17808     if ((signbit(x) == 0) && (signbit(y) != 0))
17809         return 0;
17810     else
17811         return 1;
17812 }
17813 EOCP
17814 val="$undef"
17815 set try
17816 if eval $compile; then
17817     if $run ./try; then
17818         $echo "Yes." >&4
17819         val="$define"
17820     else
17821         $echo "Signbit seems to be available, but doesn't work as I expected."
17822         $echo "I won't use it." >&4
17823         val="$undef"
17824     fi
17825 else
17826     $echo "Nope." >&4
17827     dflt="$undef"
17828 fi
17829 set d_signbit
17830 eval $setvar
17831 $rm_try
17832
17833 : see if sigprocmask exists
17834 set sigprocmask d_sigprocmask
17835 eval $inlibc
17836
17837 : see if sigsetjmp exists
17838 echo " "
17839 case "$d_sigsetjmp" in
17840 '')
17841         $cat >try.c <<EOP
17842 #include <setjmp.h>
17843 #$i_stdlib I_STDLIB
17844 #ifdef I_STDLIB
17845 #include <stdlib.h>
17846 #endif
17847 sigjmp_buf env;
17848 int set = 1;
17849 int main()
17850 {
17851         if (sigsetjmp(env,1))
17852                 exit(set);
17853         set = 0;
17854         siglongjmp(env, 1);
17855         exit(1);
17856 }
17857 EOP
17858         set try
17859         if eval $compile; then
17860                 if $run ./try >/dev/null 2>&1; then
17861                         echo "POSIX sigsetjmp found." >&4
17862                         val="$define"
17863                 else
17864                         $cat >&4 <<EOM
17865 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17866 I'll ignore them.
17867 EOM
17868                         val="$undef"
17869                 fi
17870         else
17871                 echo "sigsetjmp not found." >&4
17872                 val="$undef"
17873         fi
17874         ;;
17875 *) val="$d_sigsetjmp"
17876         case "$d_sigsetjmp" in
17877         $define) echo "POSIX sigsetjmp found." >&4;;
17878         $undef) echo "sigsetjmp not found." >&4;;
17879         esac
17880         ;;
17881 esac
17882 set d_sigsetjmp
17883 eval $setvar
17884 $rm_try
17885
17886 : see if snprintf exists
17887 set snprintf d_snprintf
17888 eval $inlibc
17889
17890 : see if vsnprintf exists
17891 set vsnprintf d_vsnprintf
17892 eval $inlibc
17893
17894 case "$d_snprintf-$d_vsnprintf" in
17895 "$define-$define")
17896     $cat <<EOM
17897 Checking whether your snprintf() and vsnprintf() work okay...
17898 EOM
17899     $cat >try.c <<'EOCP'
17900 /* v?snprintf testing logic courtesy of Russ Allbery.
17901  * According to C99:
17902  * - if the buffer is too short it still must be \0-terminated
17903  * - if the buffer is too short the potentially required length
17904  *   must be returned and not -1
17905  * - if the buffer is NULL the potentially required length
17906  *   must be returned and not -1 or core dump
17907  */
17908 #include <stdio.h>
17909 #include <stdarg.h>
17910
17911 char buf[2];
17912
17913 int test (char *format, ...)
17914 {
17915     va_list args;
17916     int count;
17917
17918     va_start (args, format);
17919     count = vsnprintf (buf, sizeof buf, format, args);
17920     va_end (args);
17921     return count;
17922 }
17923
17924 int main ()
17925 {
17926     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17927              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17928 }
17929 EOCP
17930     set try
17931     if eval $compile; then
17932         `$run ./try`
17933         case "$?" in
17934         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17935         *) cat <<EOM >&4
17936 Your snprintf() and snprintf() don't seem to be working okay.
17937 EOM
17938            d_snprintf="$undef"
17939            d_vsnprintf="$undef"
17940            ;;
17941         esac
17942     else
17943         echo "(I can't seem to compile the test program--assuming they don't)"
17944         d_snprintf="$undef"
17945         d_vsnprintf="$undef"
17946     fi
17947     $rm_try
17948     ;;
17949 esac
17950
17951 : see if sockatmark exists
17952 set sockatmark d_sockatmark
17953 eval $inlibc
17954
17955 : see if prototype for sockatmark is available
17956 echo " "
17957 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17958 eval $hasproto
17959
17960 : see if socks5_init exists
17961 set socks5_init d_socks5_init
17962 eval $inlibc
17963
17964 : see if sprintf returns the length of the string in the buffer as per ANSI
17965 $echo "Checking whether sprintf returns the length of the string..." >&4
17966 $cat <<EOP >try.c
17967 #include <stdio.h>
17968 #$i_stdlib I_STDLIB
17969 #ifdef I_STDLIB
17970 #include <stdlib.h>
17971 #endif
17972 #$i_string I_STRING
17973 #ifdef I_STRING
17974 #  include <string.h>
17975 #else
17976 #  include <strings.h>
17977 #endif
17978 #$i_math I_MATH
17979 #ifdef I_MATH
17980 #include <math.h>
17981 #endif
17982
17983 char buffer[256];
17984
17985 int check (size_t expect, int test) {
17986   size_t got = strlen(buffer);
17987   if (expect == got)
17988     return 0;
17989
17990   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17991        test, buffer);
17992   exit (test);
17993 }
17994
17995 int main(int argc, char **argv) {
17996   int test = 0;
17997
17998   check(sprintf(buffer, ""), ++test);
17999   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18000   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18001
18002   return 0;
18003 }
18004 EOP
18005 set try
18006
18007 if eval $compile; then
18008     xxx="`$run ./try`"
18009     case "$?" in
18010         0) cat >&4 <<EOM
18011 sprintf returns the length of the string (as ANSI says it should)
18012 EOM
18013         d_sprintf_returns_strlen="$define"
18014         ;;
18015         *) cat >&4 <<EOM
18016 sprintf does not return the length of the string (how old is this system?)
18017 EOM
18018         d_sprintf_returns_strlen="$undef"
18019         ;;
18020     esac
18021 else
18022     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18023     d_sprintf_returns_strlen="$undef"
18024 fi
18025 $rm_try
18026
18027 : see if srand48_r exists
18028 set srand48_r d_srand48_r
18029 eval $inlibc
18030 case "$d_srand48_r" in
18031 "$define")
18032         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18033         case "$d_srand48_r_proto:$usethreads" in
18034         ":define")      d_srand48_r_proto=define
18035                 set d_srand48_r_proto srand48_r $hdrs
18036                 eval $hasproto ;;
18037         *)      ;;
18038         esac
18039         case "$d_srand48_r_proto" in
18040         define)
18041         case "$srand48_r_proto" in
18042         ''|0) try='int srand48_r(long, struct drand48_data*);'
18043         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18044         esac
18045         case "$srand48_r_proto" in
18046         ''|0)   d_srand48_r=undef
18047                 srand48_r_proto=0
18048                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18049         * )     case "$srand48_r_proto" in
18050                 REENTRANT_PROTO*) ;;
18051                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18052                 esac
18053                 echo "Prototype: $try" ;;
18054         esac
18055         ;;
18056         *)      case "$usethreads" in
18057                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18058                 esac
18059                 d_srand48_r=undef
18060                 srand48_r_proto=0
18061                 ;;
18062         esac
18063         ;;
18064 *)      srand48_r_proto=0
18065         ;;
18066 esac
18067
18068 : see if srandom_r exists
18069 set srandom_r d_srandom_r
18070 eval $inlibc
18071 case "$d_srandom_r" in
18072 "$define")
18073         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18074         case "$d_srandom_r_proto:$usethreads" in
18075         ":define")      d_srandom_r_proto=define
18076                 set d_srandom_r_proto srandom_r $hdrs
18077                 eval $hasproto ;;
18078         *)      ;;
18079         esac
18080         case "$d_srandom_r_proto" in
18081         define)
18082         case "$srandom_r_proto" in
18083         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18084         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18085         esac
18086         case "$srandom_r_proto" in
18087         ''|0)   d_srandom_r=undef
18088                 srandom_r_proto=0
18089                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18090         * )     case "$srandom_r_proto" in
18091                 REENTRANT_PROTO*) ;;
18092                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18093                 esac
18094                 echo "Prototype: $try" ;;
18095         esac
18096         ;;
18097         *)      case "$usethreads" in
18098                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18099                 esac
18100                 d_srandom_r=undef
18101                 srandom_r_proto=0
18102                 ;;
18103         esac
18104         ;;
18105 *)      srandom_r_proto=0
18106         ;;
18107 esac
18108
18109 : see if prototype for setresgid is available
18110 echo " "
18111 set d_sresgproto setresgid $i_unistd unistd.h
18112 eval $hasproto
18113
18114 : see if prototype for setresuid is available
18115 echo " "
18116 set d_sresuproto setresuid $i_unistd unistd.h
18117 eval $hasproto
18118
18119 : see if sys/stat.h is available
18120 set sys/stat.h i_sysstat
18121 eval $inhdr
18122
18123 : see if stat knows about block sizes
18124 echo " "
18125 echo "Checking to see if your struct stat has st_blocks field..." >&4
18126 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18127 eval $hasfield
18128
18129 : see if this is a sys/vfs.h system
18130 set sys/vfs.h i_sysvfs
18131 eval $inhdr
18132
18133 : see if this is a sys/statfs.h system
18134 set sys/statfs.h i_sysstatfs
18135 eval $inhdr
18136
18137 : Check for statfs_s
18138 echo " "
18139 echo "Checking to see if your system supports struct statfs..." >&4
18140 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
18141 eval $hasstruct
18142 case "$d_statfs_s" in
18143 "$define")      echo "Yes, it does."   ;;
18144 *)              echo "No, it doesn't." ;;
18145 esac
18146
18147
18148 : see if struct statfs knows about f_flags
18149 case "$d_statfs_s" in
18150 define)
18151         echo " "
18152         echo "Checking to see if your struct statfs has f_flags field..." >&4
18153         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
18154         eval $hasfield
18155         ;;
18156 *)      val="$undef"
18157         set d_statfs_f_flags
18158         eval $setvar
18159         ;;
18160 esac
18161 case "$d_statfs_f_flags" in
18162 "$define")      echo "Yes, it does."   ;;
18163 *)              echo "No, it doesn't." ;;
18164 esac
18165
18166 : see what flavor, if any, of static inline is supported
18167 echo " "
18168 echo "Checking to see if your system supports static inline..."
18169 $cat > try.c <<'EOCP'
18170 #include <stdlib.h>
18171 extern int f_via_a(int x);
18172 extern int f_via_b(int x);
18173 int main(int argc, char **argv)
18174 {
18175     int y;
18176
18177     y = f_via_a(0);
18178 #ifdef USE_B
18179     y = f_via_b(0);
18180 #endif
18181     if (y == 42) {
18182         return EXIT_SUCCESS;
18183     }
18184     else {
18185         return EXIT_FAILURE;
18186     }
18187 }
18188 EOCP
18189 $cat > a.c <<'EOCP'
18190 static INLINE int f(int x) {
18191     int y;
18192     y = x + 42;
18193     return y;
18194 }
18195
18196 int f_via_a(int x)
18197 {
18198     return f(x);
18199 }
18200 EOCP
18201 $cat > b.c <<'EOCP'
18202 extern int f(int x);
18203
18204 int f_via_b(int x)
18205 {
18206     return f(x);
18207 }
18208 EOCP
18209
18210 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18211 case "$perl_static_inline" in
18212 '')     # Check the various possibilities, and break out on success.
18213         # For gcc, prefer __inline__, which will still permit
18214         # cflags.SH to add in -ansi.
18215         case "$gccversion" in
18216                 '') xxx="inline __inline__ __inline _inline";;
18217                 *)  xxx="__inline__ inline __inline _inline";;
18218         esac
18219         for inline in $xxx; do
18220                 set try -DINLINE=$inline a.c
18221                 if eval $compile && $run ./try; then
18222                         # Now make sure there is no external linkage of static
18223                         # functions
18224                         set try -DINLINE=$inline -DUSE_B a.c b.c
18225                         if eval $compile && $run ./try; then
18226                                 $echo "Your compiler supports static $inline, " >&4
18227                                 $echo "but it also creates an external definition," >&4
18228                                 $echo "so I won't use it." >&4
18229                                 val=$undef
18230                         else
18231                                 $echo "Your compiler supports static $inline." >&4
18232                                 val=$define
18233                                 perl_static_inline="static $inline";
18234                                 break;
18235                         fi
18236                 else
18237                         $echo "Your compiler does NOT support static $inline." >&4
18238                         val="$undef"
18239                 fi
18240         done
18241         ;;
18242 *inline*) # Some variant of inline exists.
18243         echo "Keeping your $hint value of $perl_static_inline."
18244         val=$define
18245         ;;
18246 static)  # No inline capabilities
18247         echo "Keeping your $hint value of $perl_static_inline."
18248         val=$undef
18249         ;;
18250 *)  # Unrecognized previous value -- blindly trust the supplied
18251         # value and hope it makes sense.  Use old value for
18252         # d_static_inline, if there is one.
18253         echo "Keeping your $hint value of $perl_static_inline."
18254         case "$d_static_inline" in
18255                 '') val=$define ;;
18256                 *)  val=$d_static_inline ;;
18257         esac
18258         ;;
18259 esac
18260 # Fallback to plain 'static' if nothing worked.
18261 case "$perl_static_inline" in
18262 '')
18263         perl_static_inline="static"
18264         val=$undef
18265         ;;
18266 esac
18267 set d_static_inline
18268 eval $setvar
18269 $rm -f a.[co] b.[co]
18270 $rm_try
18271
18272 : Check stream access
18273 $cat >&4 <<EOM
18274 Checking how to access stdio streams by file descriptor number...
18275 EOM
18276 case "$stdio_stream_array" in
18277 '')     $cat >try.c <<EOCP
18278 #include <stdio.h>
18279 int main() {
18280   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18281     printf("yes\n");
18282 }
18283 EOCP
18284         for s in _iob __iob __sF
18285         do
18286                 set try -DSTDIO_STREAM_ARRAY=$s
18287                 if eval $compile; then
18288                         case "`$run ./try`" in
18289                         yes)    stdio_stream_array=$s; break ;;
18290                         esac
18291                 fi
18292         done
18293         $rm_try
18294 esac
18295 case "$stdio_stream_array" in
18296 '')     $cat >&4 <<EOM
18297 I can't figure out how to access stdio streams by file descriptor number.
18298 EOM
18299         d_stdio_stream_array="$undef"
18300         ;;
18301 *)      $cat >&4 <<EOM
18302 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18303 EOM
18304         d_stdio_stream_array="$define"
18305         ;;
18306 esac
18307
18308 : see if strcoll exists
18309 set strcoll d_strcoll
18310 eval $inlibc
18311
18312 : check for structure copying
18313 echo " "
18314 echo "Checking to see if your C compiler can copy structs..." >&4
18315 $cat >try.c <<'EOCP'
18316 int main()
18317 {
18318         struct blurfl {
18319                 int dyick;
18320         } foo, bar;
18321
18322         foo = bar;
18323 }
18324 EOCP
18325 if $cc -c try.c >/dev/null 2>&1 ; then
18326         val="$define"
18327         echo "Yup, it can."
18328 else
18329         val="$undef"
18330         echo "Nope, it can't."
18331 fi
18332 set d_strctcpy
18333 eval $setvar
18334 $rm_try
18335
18336 : see if strerror and/or sys_errlist[] exist
18337 echo " "
18338 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18339     if set strerror val -f d_strerror; eval $csym; $val; then
18340                 echo 'strerror() found.' >&4
18341                 d_strerror="$define"
18342                 d_strerrm='strerror(e)'
18343                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18344                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18345                         d_syserrlst="$define"
18346                 else
18347                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18348                         d_syserrlst="$undef"
18349                 fi
18350     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18351                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18352                 echo 'strerror() found in string header.' >&4
18353                 d_strerror="$define"
18354                 d_strerrm='strerror(e)'
18355                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18356                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18357                                 d_syserrlst="$define"
18358                 else
18359                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18360                         d_syserrlst="$undef"
18361                 fi
18362     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18363                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18364                 d_strerror="$undef"
18365                 d_syserrlst="$define"
18366                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18367     else
18368                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18369                 d_strerror="$undef"
18370                 d_syserrlst="$undef"
18371                 d_strerrm='"unknown"'
18372     fi
18373 fi
18374
18375 : see if strerror_r exists
18376 set strerror_r d_strerror_r
18377 eval $inlibc
18378 case "$d_strerror_r" in
18379 "$define")
18380         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18381         case "$d_strerror_r_proto:$usethreads" in
18382         ":define")      d_strerror_r_proto=define
18383                 set d_strerror_r_proto strerror_r $hdrs
18384                 eval $hasproto ;;
18385         *)      ;;
18386         esac
18387         case "$d_strerror_r_proto" in
18388         define)
18389         case "$strerror_r_proto" in
18390         ''|0) try='int strerror_r(int, char*, size_t);'
18391         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18392         esac
18393         case "$strerror_r_proto" in
18394         ''|0) try='int strerror_r(int, char*, int);'
18395         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18396         esac
18397         case "$strerror_r_proto" in
18398         ''|0) try='char* strerror_r(int, char*, size_t);'
18399         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18400         esac
18401         case "$strerror_r_proto" in
18402         ''|0)   d_strerror_r=undef
18403                 strerror_r_proto=0
18404                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18405         * )     case "$strerror_r_proto" in
18406                 REENTRANT_PROTO*) ;;
18407                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18408                 esac
18409                 echo "Prototype: $try" ;;
18410         esac
18411         ;;
18412         *)      case "$usethreads" in
18413                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18414                 esac
18415                 d_strerror_r=undef
18416                 strerror_r_proto=0
18417                 ;;
18418         esac
18419         ;;
18420 *)      strerror_r_proto=0
18421         ;;
18422 esac
18423
18424 : see if strftime exists
18425 set strftime d_strftime
18426 eval $inlibc
18427
18428 : see if strlcat exists
18429 set strlcat d_strlcat
18430 eval $inlibc
18431
18432 : see if strlcpy exists
18433 set strlcpy d_strlcpy
18434 eval $inlibc
18435
18436 : see if strtod exists
18437 set strtod d_strtod
18438 eval $inlibc
18439
18440 : see if strtol exists
18441 set strtol d_strtol
18442 eval $inlibc
18443
18444 : see if strtold exists
18445 set strtold d_strtold
18446 eval $inlibc
18447
18448 : see if strtoll exists
18449 set strtoll d_strtoll
18450 eval $inlibc
18451
18452 case "$d_longlong-$d_strtoll" in
18453 "$define-$define")
18454         $cat <<EOM
18455 Checking whether your strtoll() works okay...
18456 EOM
18457         $cat >try.c <<'EOCP'
18458 #include <errno.h>
18459 #ifdef __hpux
18460 #define strtoll __strtoll
18461 #endif
18462 #ifdef __EMX__
18463 #define strtoll _strtoll
18464 #endif
18465 #include <stdio.h>
18466 extern long long int strtoll(char *s, char **, int);
18467 static int bad = 0;
18468 int check(char *s, long long ell, int een) {
18469         long long gll;
18470         errno = 0;
18471         gll = strtoll(s, 0, 10);
18472         if (!((gll == ell) && (errno == een)))
18473                 bad++;
18474 }
18475 int main() {
18476         check(" 1",                                      1LL, 0);
18477         check(" 0",                                      0LL, 0);
18478         check("-1",                                     -1LL, 0);
18479         check("-9223372036854775808", -9223372036854775808LL, 0);
18480         check("-9223372036854775808", -9223372036854775808LL, 0);
18481         check(" 9223372036854775807",  9223372036854775807LL, 0);
18482         check("-9223372036854775808", -9223372036854775808LL, 0);
18483         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18484         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18485         if (!bad)
18486                 printf("ok\n");
18487 }
18488 EOCP
18489         set try
18490         if eval $compile; then
18491                 yyy=`$run ./try`
18492                 case "$yyy" in
18493                 ok) echo "Your strtoll() seems to be working okay." ;;
18494                 *) cat <<EOM >&4
18495 Your strtoll() doesn't seem to be working okay.
18496 EOM
18497                    d_strtoll="$undef"
18498                    ;;
18499                 esac
18500         else
18501                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18502                 d_strtoll="$undef"
18503         fi
18504         ;;
18505 esac
18506
18507 : see if strtoq exists
18508 set strtoq d_strtoq
18509 eval $inlibc
18510
18511 : see if strtoul exists
18512 set strtoul d_strtoul
18513 eval $inlibc
18514
18515 case "$d_strtoul" in
18516 "$define")
18517         $cat <<EOM
18518 Checking whether your strtoul() works okay...
18519 EOM
18520         $cat >try.c <<'EOCP'
18521 #include <errno.h>
18522 #include <stdio.h>
18523 extern unsigned long int strtoul(char *s, char **, int);
18524 static int bad = 0;
18525 void check(char *s, unsigned long eul, int een) {
18526         unsigned long gul;
18527         errno = 0;
18528         gul = strtoul(s, 0, 10);
18529         if (!((gul == eul) && (errno == een)))
18530                 bad++;
18531 }
18532 int main() {
18533         check(" 1", 1L, 0);
18534         check(" 0", 0L, 0);
18535 EOCP
18536         case "$longsize" in
18537         8)
18538             $cat >>try.c <<'EOCP'
18539         check("18446744073709551615", 18446744073709551615UL, 0);
18540         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18541 #if 0 /* strtoul() for /^-/ strings is undefined. */
18542         check("-1", 18446744073709551615UL, 0);
18543         check("-18446744073709551614", 2, 0);
18544         check("-18446744073709551615", 1, 0);
18545         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18546         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18547 #endif
18548 EOCP
18549                 ;;
18550         4)
18551                     $cat >>try.c <<'EOCP'
18552         check("4294967295", 4294967295UL, 0);
18553         check("4294967296", 4294967295UL, ERANGE);
18554 #if 0 /* strtoul() for /^-/ strings is undefined. */
18555         check("-1", 4294967295UL, 0);
18556         check("-4294967294", 2, 0);
18557         check("-4294967295", 1, 0);
18558         check("-4294967296", 4294967295UL, ERANGE);
18559         check("-4294967297", 4294967295UL, ERANGE);
18560 #endif
18561 EOCP
18562                 ;;
18563         *)
18564 : Should we write these tests to be more portable by sprintf-ing
18565 : ~0 and then manipulating that char string as input for strtol?
18566                 ;;
18567         esac
18568         $cat >>try.c <<'EOCP'
18569         if (!bad)
18570                 printf("ok\n");
18571         return 0;
18572 }
18573 EOCP
18574         set try
18575         if eval $compile; then
18576                 case "`$run ./try`" in
18577                 ok) echo "Your strtoul() seems to be working okay." ;;
18578                 *) cat <<EOM >&4
18579 Your strtoul() doesn't seem to be working okay.
18580 EOM
18581                    d_strtoul="$undef"
18582                    ;;
18583                 esac
18584         else
18585                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18586                 d_strtoul="$undef"
18587         fi
18588         ;;
18589 esac
18590
18591 : see if strtoull exists
18592 set strtoull d_strtoull
18593 eval $inlibc
18594
18595 case "$d_longlong-$d_strtoull" in
18596 "$define-$define")
18597         $cat <<EOM
18598 Checking whether your strtoull() works okay...
18599 EOM
18600         $cat >try.c <<'EOCP'
18601 #include <errno.h>
18602 #ifdef __hpux
18603 #define strtoull __strtoull
18604 #endif
18605 #include <stdio.h>
18606 extern unsigned long long int strtoull(char *s, char **, int);
18607 static int bad = 0;
18608 int check(char *s, long long eull, int een) {
18609         long long gull;
18610         errno = 0;
18611         gull = strtoull(s, 0, 10);
18612         if (!((gull == eull) && (errno == een)))
18613                 bad++;
18614 }
18615 int main() {
18616         check(" 1",                                        1LL, 0);
18617         check(" 0",                                        0LL, 0);
18618         check("18446744073709551615",  18446744073709551615ULL, 0);
18619         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18620 #if 0 /* strtoull() for /^-/ strings is undefined. */
18621         check("-1",                    18446744073709551615ULL, 0);
18622         check("-18446744073709551614",                     2LL, 0);
18623         check("-18446744073709551615",                     1LL, 0);
18624         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18625         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18626 #endif
18627         if (!bad)
18628                 printf("ok\n");
18629 }
18630 EOCP
18631         set try
18632         if eval $compile; then
18633                 case "`$run ./try`" in
18634                 ok) echo "Your strtoull() seems to be working okay." ;;
18635                 *) cat <<EOM >&4
18636 Your strtoull() doesn't seem to be working okay.
18637 EOM
18638                    d_strtoull="$undef"
18639                    ;;
18640                 esac
18641         else
18642                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18643                 d_strtoull="$undef"
18644         fi
18645         ;;
18646 esac
18647
18648 : see if strtouq exists
18649 set strtouq d_strtouq
18650 eval $inlibc
18651
18652 case "$d_strtouq" in
18653 "$define")
18654         $cat <<EOM
18655 Checking whether your strtouq() works okay...
18656 EOM
18657         $cat >try.c <<'EOCP'
18658 #include <errno.h>
18659 #include <stdio.h>
18660 extern unsigned long long int strtouq(char *s, char **, int);
18661 static int bad = 0;
18662 void check(char *s, unsigned long long eull, int een) {
18663         unsigned long long gull;
18664         errno = 0;
18665         gull = strtouq(s, 0, 10);
18666         if (!((gull == eull) && (errno == een)))
18667                 bad++;
18668 }
18669 int main() {
18670         check(" 1",                                        1LL, 0);
18671         check(" 0",                                        0LL, 0);
18672         check("18446744073709551615",  18446744073709551615ULL, 0);
18673         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18674 #if 0 /* strtouq() for /^-/ strings is undefined. */
18675         check("-1",                    18446744073709551615ULL, 0);
18676         check("-18446744073709551614",                     2LL, 0);
18677         check("-18446744073709551615",                     1LL, 0);
18678         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18679         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18680 #endif
18681         if (!bad)
18682                 printf("ok\n");
18683         return 0;
18684 }
18685 EOCP
18686         set try
18687         if eval $compile; then
18688                 case "`$run ./try`" in
18689                 ok) echo "Your strtouq() seems to be working okay." ;;
18690                 *) cat <<EOM >&4
18691 Your strtouq() doesn't seem to be working okay.
18692 EOM
18693                    d_strtouq="$undef"
18694                    ;;
18695                 esac
18696         else
18697                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18698                 d_strtouq="$undef"
18699         fi
18700         ;;
18701 esac
18702
18703 : see if strxfrm exists
18704 set strxfrm d_strxfrm
18705 eval $inlibc
18706
18707 : see if symlink exists
18708 set symlink d_symlink
18709 eval $inlibc
18710
18711 : see if syscall exists
18712 set syscall d_syscall
18713 eval $inlibc
18714
18715 : see if prototype for syscall is available
18716 echo " "
18717 set d_syscallproto syscall $i_unistd unistd.h
18718 eval $hasproto
18719
18720 : see if sysconf exists
18721 set sysconf d_sysconf
18722 eval $inlibc
18723
18724 : see if system exists
18725 set system d_system
18726 eval $inlibc
18727
18728 : see if tcgetpgrp exists
18729 set tcgetpgrp d_tcgetpgrp
18730 eval $inlibc
18731
18732 : see if tcsetpgrp exists
18733 set tcsetpgrp d_tcsetpgrp
18734 eval $inlibc
18735
18736 : see if prototype for telldir is available
18737 echo " "
18738 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18739 eval $hasproto
18740
18741 : see if time exists
18742 echo " "
18743 if test "X$d_time" = X -o X"$timetype" = X; then
18744     if set time val -f d_time; eval $csym; $val; then
18745                 echo 'time() found.' >&4
18746                 val="$define"
18747                 rp="What is the type returned by time() on this system?"
18748                 set time_t timetype long stdio.h sys/types.h
18749                 eval $typedef_ask
18750     else
18751                 echo 'time() not found, hope that will do.' >&4
18752                 val="$undef"
18753                 timetype='int';
18754     fi
18755     set d_time
18756     eval $setvar
18757 fi
18758
18759 : see if timegm exists
18760 set timegm d_timegm
18761 eval $inlibc
18762
18763 : see if this is a sys/times.h system
18764 set sys/times.h i_systimes
18765 eval $inhdr
18766
18767 : see if times exists
18768 echo " "
18769 if set times val -f d_times; eval $csym; $val; then
18770         echo 'times() found.' >&4
18771         d_times="$define"
18772         inc=''
18773         case "$i_systimes" in
18774         "$define") inc='sys/times.h';;
18775         esac
18776         rp="What is the type returned by times() on this system?"
18777         set clock_t clocktype long stdio.h sys/types.h $inc
18778         eval $typedef_ask
18779 else
18780         echo 'times() NOT found, hope that will do.' >&4
18781         d_times="$undef"
18782         clocktype='int'
18783 fi
18784
18785 : see if tmpnam_r exists
18786 set tmpnam_r d_tmpnam_r
18787 eval $inlibc
18788 case "$d_tmpnam_r" in
18789 "$define")
18790         hdrs="$i_systypes sys/types.h define stdio.h "
18791         case "$d_tmpnam_r_proto:$usethreads" in
18792         ":define")      d_tmpnam_r_proto=define
18793                 set d_tmpnam_r_proto tmpnam_r $hdrs
18794                 eval $hasproto ;;
18795         *)      ;;
18796         esac
18797         case "$d_tmpnam_r_proto" in
18798         define)
18799         case "$tmpnam_r_proto" in
18800         ''|0) try='char* tmpnam_r(char*);'
18801         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18802         esac
18803         case "$tmpnam_r_proto" in
18804         ''|0)   d_tmpnam_r=undef
18805                 tmpnam_r_proto=0
18806                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18807         * )     case "$tmpnam_r_proto" in
18808                 REENTRANT_PROTO*) ;;
18809                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18810                 esac
18811                 echo "Prototype: $try" ;;
18812         esac
18813         ;;
18814         *)      case "$usethreads" in
18815                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18816                 esac
18817                 d_tmpnam_r=undef
18818                 tmpnam_r_proto=0
18819                 ;;
18820         esac
18821         ;;
18822 *)      tmpnam_r_proto=0
18823         ;;
18824 esac
18825
18826 : see if truncate exists
18827 set truncate d_truncate
18828 eval $inlibc
18829
18830 : see if ttyname_r exists
18831 set ttyname_r d_ttyname_r
18832 eval $inlibc
18833 case "$d_ttyname_r" in
18834 "$define")
18835         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18836         case "$d_ttyname_r_proto:$usethreads" in
18837         ":define")      d_ttyname_r_proto=define
18838                 set d_ttyname_r_proto ttyname_r $hdrs
18839                 eval $hasproto ;;
18840         *)      ;;
18841         esac
18842         case "$d_ttyname_r_proto" in
18843         define)
18844         case "$ttyname_r_proto" in
18845         ''|0) try='int ttyname_r(int, char*, size_t);'
18846         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18847         esac
18848         case "$ttyname_r_proto" in
18849         ''|0) try='int ttyname_r(int, char*, int);'
18850         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18851         esac
18852         case "$ttyname_r_proto" in
18853         ''|0) try='char* ttyname_r(int, char*, int);'
18854         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18855         esac
18856         case "$ttyname_r_proto" in
18857         ''|0)   d_ttyname_r=undef
18858                 ttyname_r_proto=0
18859                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18860         * )     case "$ttyname_r_proto" in
18861                 REENTRANT_PROTO*) ;;
18862                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18863                 esac
18864                 echo "Prototype: $try" ;;
18865         esac
18866         ;;
18867         *)      case "$usethreads" in
18868                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18869                 esac
18870                 d_ttyname_r=undef
18871                 ttyname_r_proto=0
18872                 ;;
18873         esac
18874         ;;
18875 *)      ttyname_r_proto=0
18876         ;;
18877 esac
18878
18879 : see if tzname[] exists
18880 echo " "
18881 if set tzname val -a d_tzname; eval $csym; $val; then
18882         val="$define"
18883         echo 'tzname[] found.' >&4
18884 else
18885         val="$undef"
18886         echo 'tzname[] NOT found.' >&4
18887 fi
18888 set d_tzname
18889 eval $setvar
18890
18891 : Check if is a multiplatform env
18892 case "$osname" in
18893 next|darwin) multiarch="$define" ;;
18894 esac
18895 case "$multiarch" in
18896 ''|[nN]*) multiarch="$undef" ;;
18897 esac
18898
18899 : check for ordering of bytes in a UV
18900 echo " "
18901 case "$multiarch" in
18902 *$define*)
18903         $cat <<EOM
18904 You seem to be doing a multiarchitecture build,
18905 skipping the byteorder check.
18906
18907 EOM
18908         byteorder='ffff'
18909         ;;
18910 *)
18911         case "$byteorder" in
18912         '')
18913                 $cat <<'EOM'
18914 In the following, larger digits indicate more significance.  A big-endian
18915 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18916 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18917 machines may have weird orders like 3412.  A Cray will report 87654321,
18918 an Alpha will report 12345678. If the test program works the default is
18919 probably right.
18920 I'm now running the test program...
18921 EOM
18922                 $cat >try.c <<EOCP
18923 #include <stdio.h>
18924 #$i_stdlib I_STDLIB
18925 #ifdef I_STDLIB
18926 #include <stdlib.h>
18927 #endif
18928 #include <sys/types.h>
18929 typedef $uvtype UV;
18930 int main()
18931 {
18932         int i;
18933         union {
18934                 UV l;
18935                 char c[$uvsize];
18936         } u;
18937
18938         if ($uvsize > 4)
18939                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18940         else
18941                 u.l = (UV)0x04030201;
18942         for (i = 0; i < $uvsize; i++)
18943                 printf("%c", u.c[i]+'0');
18944         printf("\n");
18945         exit(0);
18946 }
18947 EOCP
18948                 xxx_prompt=y
18949                 set try
18950                 if eval $compile && $run ./try > /dev/null; then
18951                         dflt=`$run ./try`
18952                         case "$dflt" in
18953                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18954                                 echo "(The test program ran ok.)"
18955                                 echo "byteorder=$dflt"
18956                                 xxx_prompt=n
18957                         ;;
18958                         ????|????????) echo "(The test program ran ok.)" ;;
18959                         *) echo "(The test program didn't run right for some reason.)" ;;
18960                         esac
18961                 else
18962                         dflt='4321'
18963                         cat <<'EOM'
18964 (I can't seem to compile the test program.  Guessing big-endian...)
18965 EOM
18966                 fi
18967                 case "$xxx_prompt" in
18968                 y)
18969                         rp="What is the order of bytes in $uvtype?"
18970                         . ./myread
18971                         byteorder="$ans"
18972                         ;;
18973                 *)      byteorder=$dflt
18974                         ;;
18975                 esac
18976                 ;;
18977         esac
18978         $rm_try
18979         ;;
18980 esac
18981
18982 : Checking 32bit alignedness
18983 $cat <<EOM
18984
18985 Checking to see whether you can access character data unalignedly...
18986 EOM
18987 case "$d_u32align" in
18988 '')   $cat >try.c <<EOCP
18989 #include <stdio.h>
18990 #$i_stdlib I_STDLIB
18991 #ifdef I_STDLIB
18992 #include <stdlib.h>
18993 #endif
18994 #define U32 $u32type
18995 #define BYTEORDER 0x$byteorder
18996 #define U8 $u8type
18997 #include <signal.h>
18998 #ifdef SIGBUS
18999 $signal_t bletch(int s) { exit(4); }
19000 #endif
19001 int main() {
19002 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19003     volatile U8 buf[8];
19004     volatile U32 *up;
19005     int i;
19006
19007     if (sizeof(U32) != 4) {
19008         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19009         exit(1);
19010     }
19011
19012     fflush(stdout);
19013
19014 #ifdef SIGBUS
19015     signal(SIGBUS, bletch);
19016 #endif
19017
19018     buf[0] = 0;
19019     buf[1] = 0;
19020     buf[2] = 0;
19021     buf[3] = 1;
19022     buf[4] = 0;
19023     buf[5] = 0;
19024     buf[6] = 0;
19025     buf[7] = 1;
19026
19027     for (i = 0; i < 4; i++) {
19028         up = (U32*)(buf + i);
19029         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19030                (*up == 1 << (8*(3-i)))  /* little-endian */
19031               )
19032            )
19033         {
19034             printf("read failed (%x)\n", *up);
19035             exit(2);
19036         }
19037     }
19038
19039     /* write test */
19040     for (i = 0; i < 4; i++) {
19041         up = (U32*)(buf + i);
19042         *up = 0xBeef;
19043         if (*up != 0xBeef) {
19044             printf("write failed (%x)\n", *up);
19045             exit(3);
19046         }
19047     }
19048
19049     exit(0);
19050 #else
19051     printf("1\n");
19052     exit(1);
19053 #endif
19054     return 0;
19055 }
19056 EOCP
19057 set try
19058 if eval $compile_ok; then
19059         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19060         $run ./try 2>&1 >/dev/null
19061         case "$?" in
19062         0)      cat >&4 <<EOM
19063 You can access character data pretty unalignedly.
19064 EOM
19065                 d_u32align="$undef"
19066                 ;;
19067         *)      cat >&4 <<EOM
19068 It seems that you must access character data in an aligned manner.
19069 EOM
19070                 d_u32align="$define"
19071                 ;;
19072         esac
19073 else
19074         rp='Can you access character data at unaligned addresses?'
19075         dflt='n'
19076         . ./myread
19077         case "$ans" in
19078         [yY]*)  d_u32align="$undef"  ;;
19079         *)      d_u32align="$define" ;;
19080         esac
19081 fi
19082 $rm_try
19083 ;;
19084 esac
19085
19086 : see if ualarm exists
19087 set ualarm d_ualarm
19088 eval $inlibc
19089
19090 : see if umask exists
19091 set umask d_umask
19092 eval $inlibc
19093
19094 : see if unordered exists
19095 set unordered d_unordered
19096 eval $inlibc
19097
19098 : see if unsetenv exists
19099 set unsetenv d_unsetenv
19100 eval $inlibc
19101
19102 : see if usleep exists
19103 set usleep d_usleep
19104 eval $inlibc
19105
19106 : see if prototype for usleep is available
19107 echo " "
19108 set d_usleepproto usleep $i_unistd unistd.h
19109 eval $hasproto
19110
19111 : see if ustat exists
19112 set ustat d_ustat
19113 eval $inlibc
19114
19115 : see if closedir exists
19116 set closedir d_closedir
19117 eval $inlibc
19118
19119 case "$d_closedir" in
19120 "$define")
19121         echo " "
19122         echo "Checking whether closedir() returns a status..." >&4
19123         cat > try.c <<EOM
19124 #$i_dirent I_DIRENT             /**/
19125 #$i_sysdir I_SYS_DIR            /**/
19126 #$i_sysndir I_SYS_NDIR          /**/
19127 #$i_systypes I_SYS_TYPES        /**/
19128
19129 #if defined(I_SYS_TYPES)
19130 #include <sys/types.h>
19131 #endif
19132 #if defined(I_DIRENT)
19133 #include <dirent.h>
19134 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19135 #include <sys/dir.h>
19136 #endif
19137 #else
19138 #ifdef I_SYS_NDIR
19139 #include <sys/ndir.h>
19140 #else
19141 #ifdef I_SYS_DIR
19142 #ifdef hp9000s500
19143 #include <ndir.h>       /* may be wrong in the future */
19144 #else
19145 #include <sys/dir.h>
19146 #endif
19147 #endif
19148 #endif
19149 #endif
19150 int main() { return closedir(opendir(".")); }
19151 EOM
19152         set try
19153         if eval $compile_ok; then
19154                 if $run ./try > /dev/null 2>&1 ; then
19155                         echo "Yes, it does."
19156                         val="$undef"
19157                 else
19158                         echo "No, it doesn't."
19159                         val="$define"
19160                 fi
19161         else
19162                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19163                 val="$define"
19164         fi
19165         ;;
19166 *)
19167         val="$undef";
19168         ;;
19169 esac
19170 set d_void_closedir
19171 eval $setvar
19172 $rm_try
19173
19174 : see if there is a wait4
19175 set wait4 d_wait4
19176 eval $inlibc
19177
19178 : see if waitpid exists
19179 set waitpid d_waitpid
19180 eval $inlibc
19181
19182 : see if wcstombs exists
19183 set wcstombs d_wcstombs
19184 eval $inlibc
19185
19186 : see if wctomb exists
19187 set wctomb d_wctomb
19188 eval $inlibc
19189
19190 : see if writev exists
19191 set writev d_writev
19192 eval $inlibc
19193
19194 : preserve RCS keywords in files with variable substitution, grrr
19195 Date='$Date'
19196 Id='$Id'
19197 Log='$Log'
19198 RCSfile='$RCSfile'
19199 Revision='$Revision'
19200
19201 : check for alignment requirements
19202 echo " "
19203 case "$alignbytes" in
19204     '') echo "Checking alignment constraints..." >&4
19205         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19206             $cat >try.c <<'EOCP'
19207 typedef long double NV;
19208 EOCP
19209         else
19210             $cat >try.c <<'EOCP'
19211 typedef double NV;
19212 EOCP
19213         fi
19214         $cat >>try.c <<'EOCP'
19215 #include <stdio.h>
19216 struct foobar {
19217     char foo;
19218     NV bar;
19219 } try_algn;
19220 int main()
19221 {
19222     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19223     return(0);
19224 }
19225 EOCP
19226         set try
19227         if eval $compile_ok; then
19228             dflt=`$run ./try`
19229         else
19230             dflt='8'
19231             echo "(I can't seem to compile the test program...)"
19232         fi
19233         case "$multiarch" in
19234             *$define*)
19235                 : The usual safe value is 8, but Darwin with -Duselongdouble
19236                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19237                 : Configure to pick a larger value if needed.
19238                 if $test "$dflt" -lt 8; then
19239                     dflt='8'
19240                     echo "Setting alignment to 8 for multiarch support.">&4
19241                 fi
19242                 ;;
19243         esac
19244         ;;
19245     *) dflt="$alignbytes"
19246         ;;
19247 esac
19248 rp="Doubles must be aligned on a how-many-byte boundary?"
19249 . ./myread
19250 alignbytes="$ans"
19251 $rm_try
19252
19253 : set the base revision
19254 baserev=5.0
19255
19256 : Determine if this is an EBCDIC system
19257 echo " "
19258 echo "Determining whether or not we are on an EBCDIC system..." >&4
19259 $cat >try.c <<'EOM'
19260 int main()
19261 {
19262   if ('M'==0xd4) return 0;
19263   return 1;
19264 }
19265 EOM
19266
19267 case "$BOOTSTRAP_CHARSET" in
19268     Y|y|define) bootstrap_charset=$define       ;;
19269     *)          bootstrap_charset=$undef        ;;
19270 esac
19271
19272 val=$undef
19273 set try
19274 if eval $compile_ok; then
19275         if $run ./try; then
19276                 echo "You seem to speak EBCDIC." >&4
19277                 val="$define"
19278         else
19279                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19280         fi
19281 else
19282         echo "I'm unable to compile the test program." >&4
19283         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19284 fi
19285 $rm_try
19286 set ebcdic
19287 eval $setvar
19288
19289 : length of character in bytes. Is always 1, otherwise it is not C
19290 : This used to be a test using sizeof
19291 charsize=1
19292
19293 : Check for the number of bits in a character
19294 case "$charbits" in
19295 '')     echo "Checking how long a character is (in bits)..." >&4
19296         $cat >try.c <<EOCP
19297 #include <stdio.h>
19298 int main ()
19299 {
19300     int n;
19301     unsigned char c;
19302     for (c = 1, n = 0; c; c <<= 1, n++) ;
19303     printf ("%d\n", n);
19304     return (0);
19305     }
19306 EOCP
19307         set try
19308         if eval $compile_ok; then
19309                 dflt=`$run ./try`
19310         else
19311                 dflt='8'
19312                 echo "(I can't seem to compile the test program.  Guessing...)"
19313         fi
19314         ;;
19315 *)
19316         dflt="$charbits"
19317         ;;
19318 esac
19319 rp="What is the length of a character (in bits)?"
19320 . ./myread
19321 charbits="$ans"
19322 $rm_try
19323 case "$charbits" in
19324 8)      ;;
19325 *)      cat >&4 << EOM
19326 Your system has an unsigned character size of $charbits bits, which
19327 is rather unusual (normally it is 8 bits).  Perl likely will not work
19328 correctly on your system, with subtle bugs in various places.
19329 EOM
19330         rp='Do you really want to continue?'
19331         dflt='n'
19332         . ./myread
19333         case "$ans" in
19334                 [yY])   echo >&4 "Okay, continuing."    ;;
19335                 *)      exit 1                          ;;
19336         esac
19337 esac
19338
19339 : how do we concatenate cpp tokens here?
19340 echo " "
19341 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19342 $cat >cpp_stuff.c <<'EOCP'
19343 #define RCAT(a,b)a/**/b
19344 #define ACAT(a,b)a ## b
19345 RCAT(Rei,ser)
19346 ACAT(Cir,cus)
19347 EOCP
19348 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19349 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19350         echo "Oh!  Smells like ANSI's been here." >&4
19351         echo "We can catify or stringify, separately or together!"
19352         cpp_stuff=42
19353 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19354         echo "Ah, yes!  The good old days!" >&4
19355         echo "However, in the good old days we don't know how to stringify and"
19356         echo "catify at the same time."
19357         cpp_stuff=1
19358 else
19359         $cat >&4 <<EOM
19360 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19361 You're going to have to edit the values of CAT[2-5] in config.h...
19362 EOM
19363         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19364 fi
19365 $rm -f cpp_stuff.*
19366
19367 : see if this is a db.h system
19368 set db.h i_db
19369 eval $inhdr
19370
19371 case "$i_db" in
19372 $define)
19373         : Check db version.
19374         echo " "
19375         echo "Checking Berkeley DB version ..." >&4
19376         $cat >try.c <<EOCP
19377 #$d_const HASCONST
19378 #ifndef HASCONST
19379 #define const
19380 #endif
19381 #include <sys/types.h>
19382 #include <stdio.h>
19383 #$i_stdlib I_STDLIB
19384 #ifdef I_STDLIB
19385 #include <stdlib.h>
19386 #endif
19387 #include <db.h>
19388 int main(int argc, char *argv[])
19389 {
19390 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19391     int Major, Minor, Patch ;
19392     unsigned long Version ;
19393     (void)db_version(&Major, &Minor, &Patch) ;
19394     if (argc == 2) {
19395         printf("%d %d %d %d %d %d\n",
19396                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19397                Major, Minor, Patch);
19398         exit(0);
19399     }
19400     printf("You have Berkeley DB Version 2 or greater.\n");
19401
19402     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19403                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19404     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19405                 Major, Minor, Patch) ;
19406
19407     /* check that db.h & libdb are compatible */
19408     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19409         printf("db.h and libdb are incompatible.\n") ;
19410         exit(3);
19411     }
19412
19413     printf("db.h and libdb are compatible.\n") ;
19414
19415     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19416                 + DB_VERSION_PATCH ;
19417
19418     /* needs to be >= 2.3.4 */
19419     if (Version < 2003004) {
19420     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19421         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19422         exit(2);
19423     }
19424
19425     exit(0);
19426 #else
19427 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19428     if (argc == 2) {
19429         printf("1 0 0\n");
19430         exit(0);
19431     }
19432     printf("You have Berkeley DB Version 1.\n");
19433     exit(0);    /* DB version < 2: the coast is clear. */
19434 #else
19435     exit(1);    /* <db.h> not Berkeley DB? */
19436 #endif
19437 #endif
19438 }
19439 EOCP
19440         set try
19441         if eval $compile_ok && $run ./try; then
19442                 echo 'Looks OK.' >&4
19443                 set `$run ./try 1`
19444                 db_version_major=$1
19445                 db_version_minor=$2
19446                 db_version_patch=$3
19447         else
19448                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19449                 i_db=$undef
19450                 case " $libs " in
19451                 *"-ldb "*)
19452                         : Remove db from list of libraries to use
19453                         echo "Removing unusable -ldb from library list" >&4
19454                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19455                         shift
19456                         libs="$*"
19457                         echo "libs = $libs" >&4
19458                         ;;
19459                 esac
19460         fi
19461         $rm_try
19462         ;;
19463 esac
19464
19465 case "$i_db" in
19466 define)
19467         : Check the return type needed for hash
19468         echo " "
19469         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19470         $cat >try.c <<EOCP
19471 #$d_const HASCONST
19472 #ifndef HASCONST
19473 #define const
19474 #endif
19475 #include <sys/types.h>
19476 #include <db.h>
19477
19478 #ifndef DB_VERSION_MAJOR
19479 u_int32_t hash_cb (ptr, size)
19480 const void *ptr;
19481 size_t size;
19482 {
19483 }
19484 HASHINFO info;
19485 int main()
19486 {
19487         info.hash = hash_cb;
19488 }
19489 #endif
19490 EOCP
19491         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19492                 if $contains warning try.out >>/dev/null 2>&1 ; then
19493                         db_hashtype='int'
19494                 else
19495                         db_hashtype='u_int32_t'
19496                 fi
19497         else
19498                 : XXX Maybe we should just give up here.
19499                 db_hashtype=u_int32_t
19500                 $cat try.out >&4
19501                 echo "Help:  I can't seem to compile the db test program." >&4
19502                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19503         fi
19504         $rm_try
19505         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19506         ;;
19507 *)      db_hashtype=u_int32_t
19508         ;;
19509 esac
19510 case "$i_db" in
19511 define)
19512         : Check the return type needed for prefix
19513         echo " "
19514         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19515         cat >try.c <<EOCP
19516 #$d_const HASCONST
19517 #ifndef HASCONST
19518 #define const
19519 #endif
19520 #include <sys/types.h>
19521 #include <db.h>
19522
19523 #ifndef DB_VERSION_MAJOR
19524 size_t prefix_cb (key1, key2)
19525 const DBT *key1;
19526 const DBT *key2;
19527 {
19528 }
19529 BTREEINFO info;
19530 int main()
19531 {
19532         info.prefix = prefix_cb;
19533 }
19534 #endif
19535 EOCP
19536         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19537                 if $contains warning try.out >>/dev/null 2>&1 ; then
19538                         db_prefixtype='int'
19539                 else
19540                         db_prefixtype='size_t'
19541                 fi
19542         else
19543                 db_prefixtype='size_t'
19544                 : XXX Maybe we should just give up here.
19545                 $cat try.out >&4
19546                 echo "Help:  I can't seem to compile the db test program." >&4
19547                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19548         fi
19549         $rm_try
19550         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19551         ;;
19552 *)      db_prefixtype='size_t'
19553         ;;
19554 esac
19555
19556 : How can we generate normalized random numbers ?
19557 echo " "
19558 echo "Using our internal random number implementation..." >&4
19559
19560 case "$ccflags" in
19561 *-Dmy_rand=*|*-Dmy_srand=*)
19562         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19563         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19564         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19565         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19566         ;;
19567 esac
19568
19569 randfunc=Perl_drand48
19570 drand01="Perl_drand48()"
19571 seedfunc="Perl_drand48_init"
19572 randbits=48
19573 randseedtype=U32
19574
19575 : Check how to flush
19576 echo " "
19577 $cat >&4 <<EOM
19578 Checking how to flush all pending stdio output...
19579 EOM
19580 # I only know how to find the first 32 possibly open files on SunOS.
19581 # See also hints/sunos_4_1.sh and util.c  --AD
19582 case "$osname" in
19583 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19584 esac
19585 $cat >>try.c <<EOCP
19586 #include <stdio.h>
19587 #$i_stdlib I_STDLIB
19588 #ifdef I_STDLIB
19589 #include <stdlib.h>
19590 #endif
19591 #$i_unistd I_UNISTD
19592 #ifdef I_UNISTD
19593 # include <unistd.h>
19594 #endif
19595 #$d_sysconf HAS_SYSCONF
19596 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19597 #ifdef HAS_STDIO_STREAM_ARRAY
19598 # define STDIO_STREAM_ARRAY $stdio_stream_array
19599 #endif
19600 int main() {
19601   FILE* p;
19602   unlink("try.out");
19603   p = fopen("try.out", "w");
19604 #ifdef TRY_FPUTC
19605   fputc('x', p);
19606 #else
19607 # ifdef TRY_FPRINTF
19608   fprintf(p, "x");
19609 # endif
19610 #endif
19611 #ifdef TRY_FFLUSH_NULL
19612   fflush(NULL);
19613 #endif
19614 #ifdef TRY_FFLUSH_ALL
19615   {
19616     long open_max = -1;
19617 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19618     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19619 # else
19620 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19621     open_max = sysconf(_SC_OPEN_MAX);
19622 #  else
19623 #   ifdef FOPEN_MAX
19624     open_max = FOPEN_MAX;
19625 #   else
19626 #    ifdef OPEN_MAX
19627     open_max = OPEN_MAX;
19628 #    else
19629 #     ifdef _NFILE
19630     open_max = _NFILE;
19631 #     endif
19632 #    endif
19633 #   endif
19634 #  endif
19635 # endif
19636 # ifdef HAS_STDIO_STREAM_ARRAY
19637     if (open_max > 0) {
19638       long i;
19639       for (i = 0; i < open_max; i++)
19640             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19641                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19642                 STDIO_STREAM_ARRAY[i]._flag)
19643                 fflush(&STDIO_STREAM_ARRAY[i]);
19644     }
19645   }
19646 # endif
19647 #endif
19648   _exit(42);
19649 }
19650 EOCP
19651 : first we have to find out how _not_ to flush
19652 $to try.c
19653 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19654     output=''
19655     set try -DTRY_FPUTC
19656     if eval $compile; then
19657             $run ./try 2>/dev/null
19658             code="$?"
19659             $from try.out
19660             if $test ! -s try.out -a "X$code" = X42; then
19661                 output=-DTRY_FPUTC
19662             fi
19663     fi
19664     case "$output" in
19665     '')
19666             set try -DTRY_FPRINTF
19667             if eval $compile; then
19668                     $run ./try 2>/dev/null
19669                     code="$?"
19670                     $from try.out
19671                     if $test ! -s try.out -a "X$code" = X42; then
19672                         output=-DTRY_FPRINTF
19673                     fi
19674             fi
19675         ;;
19676     esac
19677 fi
19678 : check for fflush NULL behavior
19679 case "$fflushNULL" in
19680 '')     set try -DTRY_FFLUSH_NULL $output
19681         if eval $compile; then
19682                 $run ./try 2>/dev/null
19683                 code="$?"
19684                 $from try.out
19685                 if $test -s try.out -a "X$code" = X42; then
19686                         fflushNULL="`$cat try.out`"
19687                 else
19688                         if $test "X$code" != X42; then
19689                                 $cat >&4 <<EOM
19690 (If this test failed, don't worry, we'll try another method shortly.)
19691 EOM
19692                         fi
19693                 fi
19694         fi
19695         $rm -f core try.core core.try.*
19696         case "$fflushNULL" in
19697         x)      $cat >&4 <<EOM
19698 Your fflush(NULL) works okay for output streams.
19699 Let's see if it clobbers input pipes...
19700 EOM
19701 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19702 # bug that improperly flushes the input end of pipes.  So we avoid the
19703 # autoflush on fork/system/exec support for now. :-(
19704 $cat >tryp.c <<EOCP
19705 #include <stdio.h>
19706 int
19707 main(int argc, char **argv)
19708 {
19709     char buf[1024];
19710     int i;
19711     char *bp = buf;
19712     while (1) {
19713         while ((i = getc(stdin)) != -1
19714                && (*bp++ = i) != '\n'
19715                && bp < &buf[1024])
19716         /* DO NOTHING */ ;
19717         *bp = '\0';
19718         fprintf(stdout, "%s", buf);
19719         fflush(NULL);
19720         if (i == -1)
19721             return 0;
19722         bp = buf;
19723     }
19724 }
19725 EOCP
19726                 fflushNULL="$define"
19727                 set tryp
19728                 if eval $compile; then
19729                     $rm -f tryp.out
19730                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
19731                     if $test "X$targethost" != X; then
19732                         $to tryp.c
19733                         $to tryp
19734                         $run "cat tryp.c | ./tryp" 2>/dev/null > tryp.out
19735                     else
19736                         $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19737                     fi
19738                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19739                        $cat >&4 <<EOM
19740 fflush(NULL) seems to behave okay with input streams.
19741 EOM
19742                         fflushNULL="$define"
19743                     else
19744                         $cat >&4 <<EOM
19745 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19746 EOM
19747                         fflushNULL="$undef"
19748                     fi
19749                 fi
19750                 $rm -f core tryp.c tryp.core core.tryp.*
19751                 ;;
19752         '')     $cat >&4 <<EOM
19753 Your fflush(NULL) isn't working (contrary to ANSI C).
19754 EOM
19755                 fflushNULL="$undef"
19756                 ;;
19757         *)      $cat >&4 <<EOM
19758 Cannot figure out whether your fflush(NULL) works or not.
19759 I'm assuming it doesn't (contrary to ANSI C).
19760 EOM
19761                 fflushNULL="$undef"
19762                 ;;
19763         esac
19764         ;;
19765 $define|true|[yY]*)
19766         fflushNULL="$define"
19767         ;;
19768 *)
19769         fflushNULL="$undef"
19770         ;;
19771 esac
19772 : check explicit looping only if NULL did not work, and if the pipe
19773 : bug does not show up on an explicit flush too
19774 case "$fflushNULL" in
19775 "$undef")
19776         $cat >tryp.c <<EOCP
19777 #include <stdio.h>
19778 int
19779 main(int argc, char **argv)
19780 {
19781     char buf[1024];
19782     int i;
19783     char *bp = buf;
19784     while (1) {
19785         while ((i = getc(stdin)) != -1
19786                && (*bp++ = i) != '\n'
19787                && bp < &buf[1024])
19788         /* DO NOTHING */ ;
19789         *bp = '\0';
19790         fprintf(stdout, "%s", buf);
19791         fflush(stdin);
19792         if (i == -1)
19793             return 0;
19794         bp = buf;
19795     }
19796 }
19797 EOCP
19798         set tryp
19799         if eval $compile; then
19800             $rm -f tryp.out
19801             if $test "X$targethost" != X; then
19802                 $to tryp.c
19803                 $to tryp
19804                 $run "cat tryp.c | ./tryp" 2>/dev/null > tryp.out
19805             else
19806                 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19807             fi
19808             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19809                $cat >&4 <<EOM
19810 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19811 EOM
19812                 : now check for fflushall behaviour
19813                 case "$fflushall" in
19814                 '')     set try -DTRY_FFLUSH_ALL $output
19815                         if eval $compile; then
19816                                 $cat >&4 <<EOM
19817 (Now testing the other method--but note that this also may fail.)
19818 EOM
19819                                 $run ./try 2>/dev/null
19820                                 code=$?
19821                                 $from try.out
19822                                 if $test -s try.out -a "X$code" = X42; then
19823                                         fflushall="`$cat try.out`"
19824                                 fi
19825                         fi
19826                         $rm_try
19827                         case "$fflushall" in
19828                         x)      $cat >&4 <<EOM
19829 Whew. Flushing explicitly all the stdio streams works.
19830 EOM
19831                                 fflushall="$define"
19832                                 ;;
19833                         '')     $cat >&4 <<EOM
19834 Sigh. Flushing explicitly all the stdio streams doesn't work.
19835 EOM
19836                                 fflushall="$undef"
19837                                 ;;
19838                         *)      $cat >&4 <<EOM
19839 Cannot figure out whether flushing stdio streams explicitly works or not.
19840 I'm assuming it doesn't.
19841 EOM
19842                                 fflushall="$undef"
19843                                 ;;
19844                         esac
19845                         ;;
19846                 "$define"|true|[yY]*)
19847                         fflushall="$define"
19848                         ;;
19849                 *)
19850                         fflushall="$undef"
19851                         ;;
19852                 esac
19853             else
19854                 $cat >&4 <<EOM
19855 All is futile.  Even fflush(stdin) clobbers input pipes!
19856 EOM
19857                 fflushall="$undef"
19858             fi
19859         else
19860             fflushall="$undef"
19861         fi
19862         $rm -f core tryp.c tryp.core core.tryp.*
19863         ;;
19864 *)      fflushall="$undef"
19865         ;;
19866 esac
19867
19868 case "$fflushNULL$fflushall" in
19869 undefundef)
19870         $cat <<EOM
19871 OK, I give up.  I cannot figure out how to flush pending stdio output.
19872 We won't be flushing handles at all before fork/exec/popen.
19873 EOM
19874         ;;
19875 esac
19876 $rm_try tryp
19877
19878 : Store the full pathname to the ar program for use in the C program
19879 : Respect a hint or command line value for full_ar.
19880 case "$full_ar" in
19881 '') full_ar=$ar ;;
19882 esac
19883
19884 : Store the full pathname to the sed program for use in the C program
19885 full_sed=$sed
19886
19887 : see what type gids are declared as in the kernel
19888 echo " "
19889 echo "Looking for the type for group ids returned by getgid()."
19890 set gid_t gidtype xxx stdio.h sys/types.h
19891 eval $typedef
19892 case "$gidtype" in
19893 xxx)
19894         xxx=`./findhdr sys/user.h`
19895         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19896         case $1 in
19897         unsigned) dflt="$1 $2" ;;
19898         *) dflt="$1" ;;
19899         esac
19900         ;;
19901 *) dflt="$gidtype";;
19902 esac
19903 case "$gidtype" in
19904 gid_t) echo "gid_t found." ;;
19905 *)      rp="What is the type for group ids returned by getgid()?"
19906         . ./myread
19907         gidtype="$ans"
19908         ;;
19909 esac
19910
19911 : Check the size of GID
19912 echo " "
19913 case "$gidtype" in
19914 *_t) zzz="$gidtype"     ;;
19915 *)   zzz="gid"          ;;
19916 esac
19917 echo "Checking the size of $zzz..." >&4
19918 cat > try.c <<EOCP
19919 #include <sys/types.h>
19920 #include <stdio.h>
19921 #$i_stdlib I_STDLIB
19922 #ifdef I_STDLIB
19923 #include <stdlib.h>
19924 #endif
19925 int main() {
19926     printf("%d\n", (int)sizeof($gidtype));
19927     exit(0);
19928 }
19929 EOCP
19930 set try
19931 if eval $compile_ok; then
19932         yyy=`$run ./try`
19933         case "$yyy" in
19934         '')     gidsize=4
19935                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19936                 ;;
19937         *)      gidsize=$yyy
19938                 echo "Your $zzz is $gidsize bytes long."
19939                 ;;
19940         esac
19941 else
19942         gidsize=4
19943         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19944 fi
19945
19946
19947 : Check if GID is signed
19948 echo " "
19949 case "$gidtype" in
19950 *_t) zzz="$gidtype"     ;;
19951 *)   zzz="gid"          ;;
19952 esac
19953 echo "Checking the sign of $zzz..." >&4
19954 cat > try.c <<EOCP
19955 #include <sys/types.h>
19956 #include <stdio.h>
19957 int main() {
19958         $gidtype foo = -1;
19959         if (foo < 0)
19960                 printf("-1\n");
19961         else
19962                 printf("1\n");
19963 }
19964 EOCP
19965 set try
19966 if eval $compile; then
19967         yyy=`$run ./try`
19968         case "$yyy" in
19969         '')     gidsign=1
19970                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19971                 ;;
19972         *)      gidsign=$yyy
19973                 case "$gidsign" in
19974                  1) echo "Your $zzz is unsigned." ;;
19975                 -1) echo "Your $zzz is signed."   ;;
19976                 esac
19977                 ;;
19978         esac
19979 else
19980         gidsign=1
19981         echo "(I can't compile the test program--guessing unsigned.)" >&4
19982 fi
19983
19984
19985 : Check 64bit sizes
19986 echo " "
19987
19988 if $test X"$quadtype" != X; then
19989
19990 echo "Checking how to print 64-bit integers..." >&4
19991
19992 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19993         $cat >try.c <<'EOCP'
19994 #include <sys/types.h>
19995 #include <stdio.h>
19996 int main() {
19997   int q = 12345678901;
19998   printf("%ld\n", q);
19999 }
20000 EOCP
20001         set try
20002         if eval $compile; then
20003                 yyy=`$run ./try`
20004                 case "$yyy" in
20005                 12345678901)
20006                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20007                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20008                         echo "We will use %d."
20009                         ;;
20010                 esac
20011         fi
20012 fi
20013
20014 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20015         $cat >try.c <<'EOCP'
20016 #include <sys/types.h>
20017 #include <stdio.h>
20018 int main() {
20019   long q = 12345678901;
20020   printf("%ld\n", q);
20021 }
20022 EOCP
20023         set try
20024         if eval $compile; then
20025                 yyy=`$run ./try`
20026                 case "$yyy" in
20027                 12345678901)
20028                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20029                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20030                         echo "We will use %ld."
20031                         ;;
20032                 esac
20033         fi
20034 fi
20035
20036 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20037         $cat >try.c <<'EOCP'
20038 #include <sys/types.h>
20039 #include <inttypes.h>
20040 #include <stdio.h>
20041 int main() {
20042   int64_t q = 12345678901;
20043   printf("%" PRId64 "\n", q);
20044 }
20045 EOCP
20046         set try
20047         if eval $compile; then
20048                 yyy=`$run ./try`
20049                 case "$yyy" in
20050                 12345678901)
20051                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20052                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20053                         echo "We will use the C9X style."
20054                         ;;
20055                 esac
20056         fi
20057 fi
20058
20059 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20060         $cat >try.c <<EOCP
20061 #include <sys/types.h>
20062 #include <stdio.h>
20063 int main() {
20064   $quadtype q = 12345678901;
20065   printf("%Ld\n", q);
20066 }
20067 EOCP
20068         set try
20069         if eval $compile; then
20070                 yyy=`$run ./try`
20071                 case "$yyy" in
20072                 12345678901)
20073                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20074                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20075                         echo "We will use %Ld."
20076                         ;;
20077                 esac
20078         fi
20079 fi
20080
20081 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20082         $cat >try.c <<'EOCP'
20083 #include <sys/types.h>
20084 #include <stdio.h>
20085 int main() {
20086   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20087   printf("%lld\n", q);
20088 }
20089 EOCP
20090         set try
20091         if eval $compile; then
20092                 yyy=`$run ./try`
20093                 case "$yyy" in
20094                 12345678901)
20095                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20096                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20097                         echo "We will use the %lld style."
20098                         ;;
20099                 esac
20100         fi
20101 fi
20102
20103 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20104         $cat >try.c <<EOCP
20105 #include <sys/types.h>
20106 #include <stdio.h>
20107 int main() {
20108   $quadtype q = 12345678901;
20109   printf("%qd\n", q);
20110 }
20111 EOCP
20112         set try
20113         if eval $compile; then
20114                 yyy=`$run ./try`
20115                 case "$yyy" in
20116                 12345678901)
20117                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20118                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20119                         echo "We will use %qd."
20120                         ;;
20121                 esac
20122         fi
20123 fi
20124
20125 if $test X"$sPRId64" = X; then
20126         echo "Cannot figure out how to print 64-bit integers." >&4
20127 fi
20128 $rm_try
20129
20130 fi
20131
20132 case "$sPRId64" in
20133 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20134         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20135         ;;
20136 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20137         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20138         ;;
20139 esac
20140
20141 : Check format strings for internal types
20142 echo " "
20143 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20144
20145 if $test X"$ivsize" = X8; then
20146         ivdformat="$sPRId64"
20147         uvuformat="$sPRIu64"
20148         uvoformat="$sPRIo64"
20149         uvxformat="$sPRIx64"
20150         uvXUformat="$sPRIXU64"
20151 else
20152         if $test X"$ivsize" = X"$longsize"; then
20153                 ivdformat='"ld"'
20154                 uvuformat='"lu"'
20155                 uvoformat='"lo"'
20156                 uvxformat='"lx"'
20157                 uvXUformat='"lX"'
20158         else
20159                 if $test X"$ivsize" = X"$intsize"; then
20160                         ivdformat='"d"'
20161                         uvuformat='"u"'
20162                         uvoformat='"o"'
20163                         uvxformat='"x"'
20164                         uvXUformat='"X"'
20165                 else
20166                         : far out
20167                         if $test X"$ivsize" = X"$shortsize"; then
20168                                 ivdformat='"hd"'
20169                                 uvuformat='"hu"'
20170                                 uvoformat='"ho"'
20171                                 uvxformat='"hx"'
20172                                 uvXUformat='"hX"'
20173                         fi
20174                 fi
20175         fi
20176 fi
20177
20178 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20179         nveformat="$sPRIeldbl"
20180         nvfformat="$sPRIfldbl"
20181         nvgformat="$sPRIgldbl"
20182         nvEUformat="$sPRIEUldbl"
20183         nvFUformat="$sPRIFUldbl"
20184         nvGUformat="$sPRIGUldbl"
20185 else
20186         nveformat='"e"'
20187         nvfformat='"f"'
20188         nvgformat='"g"'
20189         nvEUformat='"E"'
20190         nvFUformat='"F"'
20191         nvGUformat='"G"'
20192 fi
20193
20194 case "$ivdformat" in
20195 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20196     exit 1
20197     ;;
20198 esac
20199
20200 : Check format string for GID
20201
20202 echo " "
20203 $echo "Checking the format string to be used for gids..." >&4
20204
20205 case "$gidsign" in
20206 -1)     if $test X"$gidsize" = X"$ivsize"; then
20207                 gidformat="$ivdformat"
20208         else
20209                 if $test X"$gidsize" = X"$longsize"; then
20210                         gidformat='"ld"'
20211                 else
20212                         if $test X"$gidsize" = X"$intsize"; then
20213                                 gidformat='"d"'
20214                         else
20215                                 if $test X"$gidsize" = X"$shortsize"; then
20216                                         gidformat='"hd"'
20217                                 fi
20218                         fi
20219                 fi
20220         fi
20221         ;;
20222 *)      if $test X"$gidsize" = X"$uvsize"; then
20223                 gidformat="$uvuformat"
20224         else
20225                 if $test X"$gidsize" = X"$longsize"; then
20226                         gidformat='"lu"'
20227                 else
20228                         if $test X"$gidsize" = X"$intsize"; then
20229                                 gidformat='"u"'
20230                         else
20231                                 if $test X"$gidsize" = X"$shortsize"; then
20232                                         gidformat='"hu"'
20233                                 fi
20234                         fi
20235                 fi
20236         fi
20237         ;;
20238 esac
20239
20240 : see if getgroups exists
20241 set getgroups d_getgrps
20242 eval $inlibc
20243
20244 : see if setgroups exists
20245 set setgroups d_setgrps
20246 eval $inlibc
20247
20248 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20249 echo " "
20250 case "$d_getgrps$d_setgrps" in
20251 *define*)
20252         case "$groupstype" in
20253         '') dflt="$gidtype" ;;
20254         *)  dflt="$groupstype" ;;
20255         esac
20256         $cat <<EOM
20257 What type of pointer is the second argument to getgroups() and setgroups()?
20258 Usually this is the same as group ids, $gidtype, but not always.
20259
20260 EOM
20261         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20262         . ./myread
20263         groupstype="$ans"
20264         ;;
20265 *)  groupstype="$gidtype";;
20266 esac
20267
20268 : MAD = Misc Attribute Definition
20269
20270 if $test $patchlevel -lt 9; then
20271 : MAD is not available in 5.8.x or earlier.
20272     ans=n;
20273 else
20274     case "$mad" in
20275     $define|true|[yY]*) dflt='y' ;;
20276     *)                  dflt='n' ;;
20277     esac
20278     cat <<EOM
20279
20280 Would you like to build with Misc Attribute Decoration? This is development
20281 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20282 overhead on the interpreter.
20283
20284 If this doesn't make any sense to you, just accept the default '$dflt'.
20285 EOM
20286     rp='Build Perl with MAD?'
20287     . ./myread
20288 fi
20289 case "$ans" in
20290 y|Y)    val="$define"
20291         madlyh='madly.h madly.act madly.tab'
20292         madlysrc='madly.c'
20293         madlyobj="madly$_o" ;;
20294 *)      val="$undef"
20295         madlyh=''
20296         madlysrc=''
20297         madlyobj='' ;;
20298 esac
20299 set mad
20300 eval $setvar
20301
20302 : check whether make sets MAKE
20303 echo " "
20304 echo "Checking if your $make program sets \$(MAKE)..." >&4
20305 case "$make_set_make" in
20306 '')
20307         $sed 's/^X //' > testmake.mak << 'EOF'
20308 Xall:
20309 X       @echo 'maketemp="$(MAKE)"'
20310 EOF
20311         case "`$make -f testmake.mak 2>/dev/null`" in
20312         *maketemp=*) make_set_make='#' ;;
20313         *)      make_set_make="MAKE=$make" ;;
20314         esac
20315         $rm -f testmake.mak
20316         ;;
20317 esac
20318 case "$make_set_make" in
20319 '#') echo "Yup, it does.";;
20320 *) echo "Nope, it doesn't.";;
20321 esac
20322
20323 : see what type is used for mode_t
20324 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20325 set mode_t modetype int stdio.h sys/types.h
20326 eval $typedef_ask
20327
20328 : see if we need va_copy
20329 echo " "
20330 case "$i_stdarg" in
20331 "$define")
20332         $cat >try.c <<EOCP
20333 #include <stdarg.h>
20334 #include <stdio.h>
20335 #$i_stdlib I_STDLIB
20336 #ifdef I_STDLIB
20337 #include <stdlib.h>
20338 #endif
20339 #include <signal.h>
20340
20341 int
20342 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20343 {
20344   return vfprintf(f, fmt, *valp);
20345 }
20346
20347 int
20348 myvfprintf(FILE *f, const  char *fmt, va_list val)
20349 {
20350   return ivfprintf(f, fmt, &val);
20351 }
20352
20353 int
20354 myprintf(char *fmt, ...)
20355 {
20356   va_list val;
20357   va_start(val, fmt);
20358   return myvfprintf(stdout, fmt, val);
20359 }
20360
20361 int
20362 main(int ac, char **av)
20363 {
20364   signal(SIGSEGV, exit);
20365
20366   myprintf("%s%cs all right, then\n", "that", '\'');
20367   exit(0);
20368 }
20369 EOCP
20370         set try
20371         if eval $compile && $run ./try 2>&1 >/dev/null; then
20372                 case "`$run ./try`" in
20373                 "that's all right, then")
20374                         okay=yes
20375                         ;;
20376                 esac
20377         fi
20378         case "$okay" in
20379         yes)    echo "It seems that you don't need va_copy()." >&4
20380                 need_va_copy="$undef"
20381                 ;;
20382         *)      echo "It seems that va_copy() or similar will be needed." >&4
20383                 need_va_copy="$define"
20384                 ;;
20385         esac
20386         $rm_try
20387         ;;
20388 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20389         need_va_copy="$undef"
20390         ;;
20391 esac
20392
20393 : see what type is used for size_t
20394 rp="What is the type used for the length parameter for string functions?"
20395 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20396 eval $typedef_ask
20397
20398 : check for type of arguments to gethostbyaddr. 
20399 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20400         case "$d_gethbyaddr" in
20401         $define)
20402                 $cat <<EOM
20403
20404 Checking to see what type of arguments are accepted by gethostbyaddr().
20405 EOM
20406                 hdrs="$define sys/types.h
20407                         $d_socket sys/socket.h 
20408                         $i_niin netinet/in.h 
20409                         $i_netdb netdb.h
20410                         $i_unistd unistd.h"
20411                 : The first arg can 'char *' or 'void *'
20412                 : The second arg is some of integral type
20413                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20414                         for yyy in size_t long int; do
20415                                 case "$netdb_host_type" in
20416                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20417                                         if ./protochk "$try" $hdrs; then
20418                                                 echo "Your system accepts $xxx for the first arg."
20419                                                 echo "...and $yyy for the second arg."
20420                                                 netdb_host_type="$xxx"
20421                                                 netdb_hlen_type="$yyy"
20422                                         fi
20423                                         ;;
20424                                 esac
20425                         done
20426                 done
20427                 : In case none of those worked, prompt the user.
20428                 case "$netdb_host_type" in
20429                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20430                         dflt='char *'
20431                         . ./myread
20432                         netdb_host_type=$ans
20433                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20434                         dflt="$sizetype"
20435                         . ./myread
20436                         netdb_hlen_type=$ans
20437                         ;;
20438                 esac
20439                 ;;
20440         *)      : no gethostbyaddr, so pick harmless defaults
20441                 netdb_host_type='char *'
20442                 netdb_hlen_type="$sizetype"
20443                 ;;
20444         esac
20445         # Remove the "const" if needed. -- but then we'll have a 
20446         # prototype clash!
20447         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20448 fi
20449
20450 : check for type of argument to gethostbyname. 
20451 if test "X$netdb_name_type" = X ; then
20452         case "$d_gethbyname" in
20453         $define)
20454                 $cat <<EOM
20455
20456 Checking to see what type of argument is accepted by gethostbyname().
20457 EOM
20458                 hdrs="$define sys/types.h
20459                         $d_socket sys/socket.h 
20460                         $i_niin netinet/in.h 
20461                         $i_netdb netdb.h
20462                         $i_unistd unistd.h"
20463                 for xxx in "const char *" "char *"; do
20464                         case "$netdb_name_type" in
20465                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20466                                 if ./protochk "$try" $hdrs; then
20467                                         echo "Your system accepts $xxx."
20468                                         netdb_name_type="$xxx"
20469                                 fi
20470                                 ;;
20471                         esac
20472                 done
20473                 : In case none of those worked, prompt the user.
20474                 case "$netdb_name_type" in
20475                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20476                         dflt='char *'
20477                         . ./myread
20478                         netdb_name_type=$ans
20479                         ;;
20480                 esac
20481                 ;;
20482         *)      : no gethostbyname, so pick harmless default
20483                 netdb_name_type='char *'
20484                 ;;
20485         esac
20486 fi
20487
20488 : check for type of 1st argument to getnetbyaddr. 
20489 if test "X$netdb_net_type" = X ; then
20490         case "$d_getnbyaddr" in
20491         $define)
20492                 $cat <<EOM
20493
20494 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20495 EOM
20496                 hdrs="$define sys/types.h
20497                         $d_socket sys/socket.h 
20498                         $i_niin netinet/in.h 
20499                         $i_netdb netdb.h
20500                         $i_unistd unistd.h"
20501                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20502                         case "$netdb_net_type" in
20503                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20504                                 if ./protochk "$try" $hdrs; then
20505                                         echo "Your system accepts $xxx."
20506                                         netdb_net_type="$xxx"
20507                                 fi
20508                                 ;;
20509                         esac
20510                 done
20511                 : In case none of those worked, prompt the user.
20512                 case "$netdb_net_type" in
20513                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20514                         dflt='long'
20515                         . ./myread
20516                         netdb_net_type=$ans
20517                         ;;
20518                 esac
20519                 ;;
20520         *)      : no getnetbyaddr, so pick harmless default
20521                 netdb_net_type='long'
20522                 ;;
20523         esac
20524 fi
20525 : locate the preferred pager for this system
20526 fn=f/
20527 case "$pager" in
20528 '')
20529         dflt=''
20530         case "$pg" in
20531         /*) dflt=$pg;;
20532         [a-zA-Z]:/*) dflt=$pg;;
20533         esac
20534         case "$more" in
20535         /*) dflt=$more;;
20536         [a-zA-Z]:/*) dflt=$more;;
20537         esac
20538         case "$less" in
20539         /*) dflt=$less;;
20540         [a-zA-Z]:/*) dflt=$less;;
20541         esac
20542         case "$dflt" in
20543         '') dflt=/usr/ucb/more;;
20544         esac
20545         ;;
20546 *)      dflt="$pager"
20547         ;;
20548 esac
20549 fn="f/($dflt)"
20550 echo " "
20551 rp='What pager is used on your system?'
20552 . ./getfile
20553 pager="$ans"
20554
20555 : see what type pids are declared as in the kernel
20556 rp="What is the type of process ids on this system?"
20557 set pid_t pidtype int stdio.h sys/types.h
20558 eval $typedef_ask
20559
20560 : see if ar generates random libraries by itself
20561 echo " "
20562 echo "Checking how to generate random libraries on your machine..." >&4
20563 echo 'int bar1() { return bar2(); }' > bar1.c
20564 echo 'int bar2() { return 2; }' > bar2.c
20565 $cat > foo.c <<EOP
20566 #$i_stdlib I_STDLIB
20567 #ifdef I_STDLIB
20568 #include <stdlib.h>
20569 #endif
20570 int main() { printf("%d\n", bar1()); exit(0); }
20571 EOP
20572 $cc $ccflags -c bar1.c >/dev/null 2>&1
20573 $cc $ccflags -c bar2.c >/dev/null 2>&1
20574 $cc $ccflags -c foo.c >/dev/null 2>&1
20575 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20576 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20577         $run ./foobar >/dev/null 2>&1; then
20578         echo "$ar appears to generate random libraries itself."
20579         orderlib=false
20580         if [ "X$ranlib" = "X" ]; then
20581             ranlib=":"
20582         fi
20583 elif $ar s bar$_a >/dev/null 2>&1 &&
20584         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20585         $run ./foobar >/dev/null 2>&1; then
20586                 echo "a table of contents needs to be added with '$ar s'."
20587                 orderlib=false
20588                 ranlib="$ar s"
20589 elif $ar ts bar$_a >/dev/null 2>&1 &&
20590         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20591         $run ./foobar >/dev/null 2>&1; then
20592                 echo "a table of contents needs to be added with '$ar ts'."
20593                 orderlib=false
20594                 ranlib="$ar ts"
20595 else
20596         case "$ranlib" in
20597         :) ranlib='';;
20598         '')
20599                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20600                 $test -f $ranlib || ranlib=''
20601                 ;;
20602         esac
20603         if $test -n "$ranlib"; then
20604                 echo "your system has '$ranlib'; we'll use that."
20605                 orderlib=false
20606         else
20607                 echo "your system doesn't seem to support random libraries"
20608                 echo "so we'll use lorder and tsort to order the libraries."
20609                 orderlib=true
20610                 ranlib=":"
20611         fi
20612 fi
20613 $rm -f foo* bar*
20614
20615 : see if this is a values.h system
20616 set values.h i_values
20617 eval $inhdr
20618
20619 : Check the max offset that gmtime and localtime accept
20620 echo "Checking max offsets that gmtime () accepts"
20621
20622 case $i_values in
20623     define) yyy="#include <values.h>" ;;
20624     *)      yyy="" ;;
20625     esac
20626
20627 case "$sGMTIME_min/$sGMTIME_max" in
20628     0/0|/)
20629         $cat >try.c <<EOCP
20630 #include <sys/types.h>
20631 #include <stdio.h>
20632 #include <time.h>
20633 $yyy
20634
20635 int i;
20636 struct tm *tmp;
20637 time_t pt;
20638
20639 void gm_check (time_t t, int min_year, int max_year)
20640 {
20641     tmp = gmtime (&t);
20642     if ( tmp == NULL ||
20643         /* Check tm_year overflow */
20644          tmp->tm_year < min_year || tmp->tm_year > max_year)
20645         tmp = NULL;
20646     else
20647         pt = t;
20648     } /* gm_check */
20649
20650 int check_max ()
20651 {
20652     tmp = NULL;
20653     pt  = 0;
20654 #ifdef MAXLONG
20655     gm_check (MAXLONG, 69, 0x7fffffff);
20656 #endif
20657     if (tmp == NULL || tmp->tm_year < 0) {
20658         for (i = 63; i >= 0; i--) {
20659             time_t x = pt | ((time_t)1 << i);
20660             if (x < 0 || x < pt) continue;
20661             gm_check (x, 69, 0x7fffffff);
20662             }
20663         }
20664     printf ("sGMTIME_max=%ld\n", pt);
20665     return (0);
20666     } /* check_max */
20667
20668 int check_min ()
20669 {
20670     tmp = NULL;
20671     pt  = 0;
20672 #ifdef MINLONG
20673     gm_check (MINLONG, -1900, 70);
20674 #endif
20675     if (tmp == NULL) {
20676         for (i = 36; i >= 0; i--) {
20677             time_t x = pt - ((time_t)1 << i);
20678             if (x > 0) continue;
20679             gm_check (x, -1900, 70);
20680             }
20681         }
20682     printf ("sGMTIME_min=%ld\n", pt);
20683     return (0);
20684     } /* check_min */
20685
20686 int main (int argc, char *argv[])
20687 {
20688     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20689     check_max ();
20690     check_min ();
20691     return (0);
20692     } /* main */
20693 EOCP
20694         set try
20695         if eval $compile; then
20696             eval `$run ./try`
20697         else
20698             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20699             fi
20700         $rm_try
20701         ;;
20702     esac
20703
20704 echo "Checking max offsets that localtime () accepts"
20705
20706 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20707     0/0|/)
20708         $cat >try.c <<EOCP
20709 #include <sys/types.h>
20710 #include <stdio.h>
20711 #include <time.h>
20712 $yyy
20713
20714 int i;
20715 struct tm *tmp;
20716 time_t pt;
20717
20718 void local_check (time_t t, int min_year, int max_year)
20719 {
20720     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20721         tmp = NULL;
20722     else
20723         tmp = localtime (&t);
20724     if ( tmp == NULL ||
20725         /* Check tm_year overflow */
20726          tmp->tm_year < min_year || tmp->tm_year > max_year)
20727         tmp = NULL;
20728     else
20729         pt = t;
20730     } /* local_check */
20731
20732 int check_max ()
20733 {
20734     tmp = NULL;
20735     pt  = 0;
20736 #ifdef MAXLONG
20737     local_check (MAXLONG, 69, 0x7fffffff);
20738 #endif
20739     if (tmp == NULL || tmp->tm_year < 0) {
20740         for (i = 63; i >= 0; i--) {
20741             time_t x = pt | ((time_t)1 << i);
20742             if (x < 0 || x < pt) continue;
20743             local_check (x, 69, 0x7fffffff);
20744             }
20745         }
20746     printf ("sLOCALTIME_max=%ld\n", pt);
20747     return (0);
20748    } /* check_max */
20749
20750 int check_min ()
20751 {
20752     tmp = NULL;
20753     pt  = 0;
20754 #ifdef MINLONG
20755     local_check (MINLONG, -1900, 70);
20756 #endif
20757     if (tmp == NULL) {
20758         for (i = 36; i >= 0; i--) {
20759             time_t x = pt - ((time_t)1 << i);
20760             if (x > 0) continue;
20761             local_check (x, -1900, 70);
20762             }
20763         }
20764     printf ("sLOCALTIME_min=%ld\n", pt);
20765     return (0);
20766     } /* check_min */
20767
20768 int main (int argc, char *argv[])
20769 {
20770     check_max ();
20771     check_min ();
20772     return (0);
20773     } /* main */
20774 EOCP
20775         set try
20776         if eval $compile; then
20777             eval `$run ./try`
20778         else
20779             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20780             fi
20781         $rm_try
20782         ;;
20783     esac
20784
20785 : check for type of arguments to select.
20786 case "$selecttype" in
20787 '') case "$d_select" in
20788         $define)
20789                 echo " "
20790                 $cat <<EOM
20791 Checking to see what type of arguments are accepted by select().
20792 EOM
20793                 hdrs="$define sys/types.h
20794                         $i_systime sys/time.h
20795                         $i_sysselct sys/select.h
20796                         $d_socket sys/socket.h"
20797                 : The first arg can be int, unsigned, or size_t
20798                 : The last arg may or may not be 'const'
20799                 val=''
20800                 : void pointer has been seen but using that
20801                 : breaks the selectminbits test
20802                 for xxx in 'fd_set *' 'int *'; do
20803                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20804                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20805                                         case "$val" in
20806                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20807                                                 if ./protochk "$try" $hdrs; then
20808                                                         echo "Your system accepts $xxx."
20809                                                         val="$xxx"
20810                                                 fi
20811                                                 ;;
20812                                         esac
20813                                 done
20814                         done
20815                 done
20816                 case "$val" in
20817                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20818                         case "$d_fd_set" in
20819                                 $define) dflt="fd_set *" ;;
20820                                 *)              dflt="int *" ;;
20821                         esac
20822                         . ./myread
20823                         val=$ans
20824                         ;;
20825                 esac
20826                 selecttype="$val"
20827                 ;;
20828         *)      : no select, so pick a harmless default
20829                 selecttype='int *'
20830                 ;;
20831         esac
20832         ;;
20833 esac
20834
20835 : check for the select 'width'
20836 case "$selectminbits" in
20837 '') safebits=`expr $ptrsize \* 8`
20838     case "$d_select" in
20839         $define)
20840                 $cat <<EOM
20841
20842 Checking to see on how many bits at a time your select() operates...
20843 EOM
20844                 $cat >try.c <<EOCP
20845 #include <sys/types.h>
20846 #$i_time I_TIME
20847 #$i_systime I_SYS_TIME
20848 #$i_systimek I_SYS_TIME_KERNEL
20849 #ifdef I_TIME
20850 #   include <time.h>
20851 #endif
20852 #ifdef I_SYS_TIME
20853 #   ifdef I_SYS_TIME_KERNEL
20854 #       define KERNEL
20855 #   endif
20856 #   include <sys/time.h>
20857 #   ifdef I_SYS_TIME_KERNEL
20858 #       undef KERNEL
20859 #   endif
20860 #endif
20861 #$i_sysselct I_SYS_SELECT
20862 #ifdef I_SYS_SELECT
20863 #include <sys/select.h>
20864 #endif
20865 #$d_socket HAS_SOCKET
20866 #ifdef HAS_SOCKET
20867 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20868 #endif
20869 #include <stdio.h>
20870 #$i_stdlib I_STDLIB
20871 #ifdef I_STDLIB
20872 #include <stdlib.h>
20873 #endif
20874 $selecttype b;
20875 #define S sizeof(*(b))
20876 #define MINBITS 64
20877 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20878 #define NBITS  (NBYTES * 8)
20879 int main() {
20880     char *s = (char *)malloc(NBYTES);
20881     struct timeval t;
20882     int i;
20883     FILE* fp;
20884     int fd;
20885
20886     if (!s)
20887         exit(1);
20888     fclose(stdin);
20889     fp = fopen("try.c", "r");
20890     if (fp == 0)
20891       exit(2);
20892     fd = fileno(fp);
20893     if (fd < 0)
20894       exit(3);
20895     b = ($selecttype)s;
20896     for (i = 0; i < NBITS; i++)
20897         FD_SET(i, b);
20898     t.tv_sec  = 0;
20899     t.tv_usec = 0;
20900     select(fd + 1, b, 0, 0, &t);
20901     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20902     free(s);
20903     printf("%d\n", i + 1);
20904     return 0;
20905 }
20906 EOCP
20907                 set try
20908                 if eval $compile_ok; then
20909                         selectminbits=`$run ./try`
20910                         case "$selectminbits" in
20911                         '')     cat >&4 <<EOM
20912 Cannot figure out on how many bits at a time your select() operates.
20913 I'll play safe and guess it is $safebits bits.
20914 EOM
20915                                 selectminbits=$safebits
20916                                 bits="$safebits bits"
20917                                 ;;
20918                         1)      bits="1 bit" ;;
20919                         *)      bits="$selectminbits bits" ;;
20920                         esac
20921                         echo "Your select() operates on $bits at a time." >&4
20922                 else
20923                         rp='What is the minimum number of bits your select() operates on?'
20924                         case "$byteorder" in
20925                         12345678)       dflt=64 ;;
20926                         1234)           dflt=32 ;;
20927                         *)              dflt=1  ;;
20928                         esac
20929                         . ./myread
20930                         val=$ans
20931                         selectminbits="$val"
20932                 fi
20933                 $rm_try
20934                 ;;
20935         *)      : no select, so pick a harmless default
20936                 selectminbits=$safebits
20937                 ;;
20938         esac
20939         ;;
20940 esac
20941
20942 : Trace out the files included by signal.h, then look for SIGxxx names.
20943 if [ "X$fieldn" = X ]; then
20944         : Just make some guesses.  We check them later.
20945         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
20946 else
20947         xxx=`echo '#include <signal.h>' |
20948         $cppstdin $cppminus $cppflags 2>/dev/null |
20949         $grep '^[       ]*#.*include' |
20950         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20951                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20952 fi
20953 xxxfiles=''
20954 for xx in $xxx /dev/null ; do
20955         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20956 done
20957 case "$xxxfiles" in
20958 '')     xxxfiles=`./findhdr signal.h` ;;
20959 esac
20960 xxx=`awk '
20961 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20962         print substr($2, 4, 20)
20963 }
20964 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20965         print substr($3, 4, 20)
20966 }' $xxxfiles`
20967 : Append some common names just in case the awk scan failed.
20968 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20969 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20970 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20971 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20972 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20973
20974 : generate a few handy files for later
20975 $cat > signal.c <<EOCP
20976 #include <sys/types.h>
20977 #include <signal.h>
20978 #$i_stdlib I_STDLIB
20979 #ifdef I_STDLIB
20980 #include <stdlib.h>
20981 #endif
20982 #include <stdio.h>
20983 int main() {
20984
20985 /* Strange style to avoid deeply-nested #if/#else/#endif */
20986 #ifndef NSIG
20987 #  ifdef _NSIG
20988 #    define NSIG (_NSIG)
20989 #  endif
20990 #endif
20991
20992 #ifndef NSIG
20993 #  ifdef SIGMAX
20994 #    define NSIG (SIGMAX+1)
20995 #  endif
20996 #endif
20997
20998 #ifndef NSIG
20999 #  ifdef SIG_MAX
21000 #    define NSIG (SIG_MAX+1)
21001 #  endif
21002 #endif
21003
21004 #ifndef NSIG
21005 #  ifdef _SIG_MAX
21006 #    define NSIG (_SIG_MAX+1)
21007 #  endif
21008 #endif
21009
21010 #ifndef NSIG
21011 #  ifdef MAXSIG
21012 #    define NSIG (MAXSIG+1)
21013 #  endif
21014 #endif
21015
21016 #ifndef NSIG
21017 #  ifdef MAX_SIG
21018 #    define NSIG (MAX_SIG+1)
21019 #  endif
21020 #endif
21021
21022 #ifndef NSIG
21023 #  ifdef SIGARRAYSIZE
21024 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21025 #  endif
21026 #endif
21027
21028 #ifndef NSIG
21029 #  ifdef _sys_nsig
21030 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21031 #  endif
21032 #endif
21033
21034 /* Default to some arbitrary number that's big enough to get most
21035    of the common signals.
21036 */
21037 #ifndef NSIG
21038 #    define NSIG 50
21039 #endif
21040
21041 printf("NSIG %d\n", NSIG);
21042
21043 #ifndef JUST_NSIG
21044
21045 EOCP
21046
21047 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21048 {
21049         printf "#ifdef SIG"; printf $1; printf "\n"
21050         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21051         printf $1; printf ");\n"
21052         printf "#endif\n"
21053 }
21054 END {
21055         printf "#endif /* JUST_NSIG */\n";
21056         printf "exit(0);\n}\n";
21057 }
21058 ' >>signal.c
21059 $cat >signal.awk <<'EOP'
21060 BEGIN { ndups = 0 }
21061 $1 ~ /^NSIG$/ { nsig = $2 }
21062 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21063     if ($2 > maxsig) { maxsig = $2 }
21064     if (sig_name[$2]) {
21065         dup_name[ndups] = $1
21066         dup_num[ndups] = $2
21067         ndups++
21068     }
21069     else {
21070         sig_name[$2] = $1
21071         sig_num[$2] = $2
21072     }
21073 }
21074 END {
21075     if (nsig == 0) {
21076         nsig = maxsig + 1
21077     }
21078     printf("NSIG %d\n", nsig);
21079     for (n = 1; n < nsig; n++) {
21080         if (sig_name[n]) {
21081             printf("%s %d\n", sig_name[n], sig_num[n])
21082         }
21083         else {
21084             printf("NUM%d %d\n", n, n)
21085         }
21086     }
21087     for (n = 0; n < ndups; n++) {
21088         printf("%s %d\n", dup_name[n], dup_num[n])
21089     }
21090 }
21091 EOP
21092 $cat >signal_cmd <<EOS
21093 $startsh
21094 if $test -s signal.lst; then
21095     echo "Using your existing signal.lst file"
21096         exit 0
21097 fi
21098 xxx="$xxx"
21099 EOS
21100 $cat >>signal_cmd <<'EOS'
21101
21102 set signal
21103 if eval $compile_ok; then
21104         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21105                 $uniq | $awk -f signal.awk >signal.lst
21106 else
21107         echo "(I can't seem be able to compile the whole test program)" >&4
21108         echo "(I'll try it in little pieces.)" >&4
21109         set signal -DJUST_NSIG
21110         if eval $compile_ok; then
21111                 $run ./signal$_exe > signal.nsg
21112                 $cat signal.nsg
21113         else
21114                 echo "I can't seem to figure out how many signals you have." >&4
21115                 echo "Guessing 50." >&4
21116                 echo 'NSIG 50' > signal.nsg
21117         fi
21118         : Now look at all the signal names, one at a time.
21119         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21120                 $cat > signal.c <<EOCP
21121 #include <sys/types.h>
21122 #include <signal.h>
21123 #include <stdio.h>
21124 int main() {
21125 printf("$xx %d\n", SIG${xx});
21126 return 0;
21127 }
21128 EOCP
21129                 set signal
21130                 if eval $compile; then
21131                         echo "SIG${xx} found."
21132                         $run ./signal$_exe  >> signal.ls1
21133                 else
21134                         echo "SIG${xx} NOT found."
21135                 fi
21136         done
21137         if $test -s signal.ls1; then
21138                 $cat signal.nsg signal.ls1 |
21139                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21140         fi
21141
21142 fi
21143 if $test -s signal.lst; then
21144         :
21145 else
21146         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21147         echo 'kill -l' >signal
21148         set X `csh -f <signal`
21149         $rm -f signal
21150         shift
21151         case $# in
21152         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21153         esac
21154         echo $@ | $tr ' ' $trnl | \
21155             $awk '{ printf "%s %d\n", $1, ++s; }
21156                   END { printf "NSIG %d\n", ++s }' >signal.lst
21157 fi
21158 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21159 EOS
21160 chmod a+x signal_cmd
21161 $eunicefix signal_cmd
21162
21163 : generate list of signal names
21164 echo " "
21165 case "$sig_name_init" in
21166 '') doinit=yes ;;
21167 *)  case "$sig_num_init" in
21168     ''|*,*) doinit=yes ;;
21169     esac ;;
21170 esac
21171 case "$doinit" in
21172 yes)
21173         echo "Generating a list of signal names and numbers..." >&4
21174         . ./signal_cmd
21175         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21176         sig_name=`$awk 'BEGIN { printf "ZERO " }
21177                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21178         sig_num=`$awk  'BEGIN { printf "0 " }
21179                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21180         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21181                              !/^NSIG/   { printf "\"%s\", ", $1 }
21182                              END        { printf "0\n" }' signal.lst`
21183         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21184                              !/^NSIG/   { printf "%d, ", $2}
21185                              END        { printf "0\n"}' signal.lst`
21186         ;;
21187 esac
21188 echo "The following $sig_count signals are available:"
21189 echo " "
21190 echo $sig_name | $awk \
21191 'BEGIN { linelen = 0 }
21192 {
21193         for (i = 1; i <= NF; i++) {
21194                 name = "SIG" $i " "
21195                 linelen = linelen + length(name)
21196                 if (linelen > 70) {
21197                         printf "\n"
21198                         linelen = length(name)
21199                 }
21200                 printf "%s", name
21201         }
21202         printf "\n"
21203 }'
21204 sig_size=`echo $sig_name | awk '{print NF}'`
21205 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21206
21207 : Check size of size
21208 echo " "
21209 case "$sizetype" in
21210 *_t) zzz="$sizetype"    ;;
21211 *)   zzz="filesize"     ;;
21212 esac
21213 echo "Checking the size of $zzz..." >&4
21214 cat > try.c <<EOCP
21215 #include <sys/types.h>
21216 #include <stdio.h>
21217 #$i_stdlib I_STDLIB
21218 #ifdef I_STDLIB
21219 #include <stdlib.h>
21220 #endif
21221 int main() {
21222     printf("%d\n", (int)sizeof($sizetype));
21223     exit(0);
21224 }
21225 EOCP
21226 set try
21227 if eval $compile_ok; then
21228         yyy=`$run ./try`
21229         case "$yyy" in
21230         '')     sizesize=4
21231                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21232                 ;;
21233         *)      sizesize=$yyy
21234                 echo "Your $zzz size is $sizesize bytes."
21235                 ;;
21236         esac
21237 else
21238         sizesize=4
21239         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21240 fi
21241
21242
21243 : check for socklen_t
21244 echo " "
21245 echo "Checking to see if you have socklen_t..." >&4
21246 $cat >try.c <<EOCP
21247 #include <sys/types.h>
21248 #$d_socket HAS_SOCKET
21249 #ifdef HAS_SOCKET
21250 #include <sys/socket.h>
21251 #endif
21252 int main() { socklen_t x = 16; }
21253 EOCP
21254 set try
21255 if eval $compile; then
21256         val="$define"
21257         echo "You have socklen_t."
21258 else
21259         val="$undef"
21260         echo "You do not have socklen_t."
21261         case "$sizetype" in
21262         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21263         esac
21264 fi
21265 $rm_try
21266 set d_socklen_t
21267 eval $setvar
21268
21269 : see if this is a socks.h system
21270 set socks.h i_socks
21271 eval $inhdr
21272
21273 : check for type of the size argument to socket calls
21274 case "$d_socket" in
21275 "$define")
21276         $cat <<EOM
21277
21278 Checking to see what type is the last argument of accept().
21279 EOM
21280         yyy=''
21281         case "$d_socklen_t" in
21282         "$define") yyy="$yyy socklen_t"
21283         esac
21284         yyy="$yyy $sizetype int long unsigned"
21285         for xxx in $yyy; do
21286                 case "$socksizetype" in
21287                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21288                         case "$usesocks" in
21289                         "$define")
21290                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21291                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21292                                         socksizetype="$xxx"
21293                                 fi
21294                                 ;;
21295                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21296                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21297                                         socksizetype="$xxx"
21298                                 fi
21299                                 ;;
21300                         esac
21301                         ;;
21302                 esac
21303         done
21304 : In case none of those worked, prompt the user.
21305         case "$socksizetype" in
21306         '')     rp='What is the type for socket address structure sizes?'
21307                 dflt='int'
21308                 . ./myread
21309                 socksizetype=$ans
21310                 ;;
21311         esac
21312         ;;
21313 *)      : no sockets, so pick relatively harmless default
21314         socksizetype='int'
21315         ;;
21316 esac
21317
21318 : see what type is used for signed size_t
21319 set ssize_t ssizetype int stdio.h sys/types.h
21320 eval $typedef
21321 dflt="$ssizetype"
21322 $cat > try.c <<EOM
21323 #include <stdio.h>
21324 #$i_stdlib I_STDLIB
21325 #ifdef I_STDLIB
21326 #include <stdlib.h>
21327 #endif
21328 #include <sys/types.h>
21329 #define Size_t $sizetype
21330 #define SSize_t $dflt
21331 int main()
21332 {
21333         if (sizeof(Size_t) == sizeof(SSize_t))
21334                 printf("$dflt\n");
21335         else if (sizeof(Size_t) == sizeof(int))
21336                 printf("int\n");
21337         else
21338                 printf("long\n");
21339         exit(0);
21340 }
21341 EOM
21342 echo " "
21343 set try
21344 if eval $compile_ok && $run ./try > /dev/null; then
21345         ssizetype=`$run ./try`
21346         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21347 else
21348         $cat >&4 <<EOM
21349 Help! I can't compile and run the ssize_t test program: please enlighten me!
21350 (This is probably a misconfiguration in your system or libraries, and
21351 you really ought to fix it.  Still, I'll try anyway.)
21352
21353 I need a type that is the same size as $sizetype, but is guaranteed to
21354 be signed.  Common values are ssize_t, int and long.
21355
21356 EOM
21357         rp="What signed type is the same size as $sizetype?"
21358         . ./myread
21359         ssizetype="$ans"
21360 fi
21361 $rm_try
21362
21363 : Check the size of st_ino
21364 $echo " "
21365 $echo "Checking the size of st_ino..." >&4
21366 $cat > try.c <<EOCP
21367 #include <sys/stat.h>
21368 #include <stdio.h>
21369 #$i_stdlib I_STDLIB
21370 #ifdef I_STDLIB
21371 #include <stdlib.h>
21372 #endif
21373 int main() {
21374     struct stat st;
21375     printf("%d\n", (int)sizeof(st.st_ino));
21376     exit(0);
21377 }
21378 EOCP
21379 set try
21380 if eval $compile_ok; then
21381         val=`$run ./try`
21382         case "$val" in
21383         '')     st_ino_size=4
21384                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21385                 ;;
21386         *)      st_ino_size=$val
21387                 $echo "Your st_ino is $st_ino_size bytes long."
21388                 ;;
21389         esac
21390 else
21391         st_ino_size=4
21392         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21393 fi
21394 $rm_try
21395
21396 : Check if st_ino is signed
21397 $echo " "
21398 $echo "Checking the sign of st_ino..." >&4
21399 $cat > try.c <<EOCP
21400 #include <sys/stat.h>
21401 #include <stdio.h>
21402 int main() {
21403         struct stat foo;
21404         foo.st_ino = -1;
21405         if (foo.st_ino < 0)
21406                 printf("-1\n");
21407         else
21408                 printf("1\n");
21409 }
21410 EOCP
21411 set try
21412 if eval $compile; then
21413         val=`$run ./try`
21414         case "$val" in
21415         '')     st_ino_sign=1
21416                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21417                 ;;
21418         *)      st_ino_sign=$val
21419                 case "$st_ino_sign" in
21420                  1) $echo "Your st_ino is unsigned." ;;
21421                 -1) $echo "Your st_ino is signed."   ;;
21422                 esac
21423                 ;;
21424         esac
21425 else
21426         st_ino_sign=1
21427         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21428 fi
21429 $rm_try
21430
21431 : see what type of char stdio uses.
21432 echo " "
21433 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21434 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21435         echo "Your stdio uses unsigned chars." >&4
21436         stdchar="unsigned char"
21437 else
21438         echo "Your stdio uses signed chars." >&4
21439         stdchar="char"
21440 fi
21441 $rm -f stdioh
21442
21443 : see what type uids are declared as in the kernel
21444 echo " "
21445 echo "Looking for the type for user ids returned by getuid()."
21446 set uid_t uidtype xxx stdio.h sys/types.h
21447 eval $typedef
21448 case "$uidtype" in
21449 xxx)
21450         xxx=`./findhdr sys/user.h`
21451         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21452         case $1 in
21453         unsigned) dflt="$1 $2" ;;
21454         *) dflt="$1" ;;
21455         esac
21456         ;;
21457 *) dflt="$uidtype";;
21458 esac
21459 case "$uidtype" in
21460 uid_t)  echo "uid_t found." ;;
21461 *)      rp="What is the type for user ids returned by getuid()?"
21462         . ./myread
21463         uidtype="$ans"
21464         ;;
21465 esac
21466
21467 : Check size of UID
21468 echo " "
21469 case "$uidtype" in
21470 *_t) zzz="$uidtype"     ;;
21471 *)   zzz="uid"          ;;
21472 esac
21473 echo "Checking the size of $zzz..." >&4
21474 cat > try.c <<EOCP
21475 #include <sys/types.h>
21476 #include <stdio.h>
21477 #$i_stdlib I_STDLIB
21478 #ifdef I_STDLIB
21479 #include <stdlib.h>
21480 #endif
21481 int main() {
21482     printf("%d\n", (int)sizeof($uidtype));
21483     exit(0);
21484 }
21485 EOCP
21486 set try
21487 if eval $compile_ok; then
21488         yyy=`$run ./try`
21489         case "$yyy" in
21490         '')     uidsize=4
21491                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21492                 ;;
21493         *)      uidsize=$yyy
21494                 echo "Your $zzz is $uidsize bytes long."
21495                 ;;
21496         esac
21497 else
21498         uidsize=4
21499         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21500 fi
21501
21502 : Check if UID is signed
21503 echo " "
21504 case "$uidtype" in
21505 *_t) zzz="$uidtype"     ;;
21506 *)   zzz="uid"          ;;
21507 esac
21508 echo "Checking the sign of $zzz..." >&4
21509 cat > try.c <<EOCP
21510 #include <sys/types.h>
21511 #include <stdio.h>
21512 int main() {
21513         $uidtype foo = -1;
21514         if (foo < 0)
21515                 printf("-1\n");
21516         else
21517                 printf("1\n");
21518 }
21519 EOCP
21520 set try
21521 if eval $compile; then
21522         yyy=`$run ./try`
21523         case "$yyy" in
21524         '')     uidsign=1
21525                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21526                 ;;
21527         *)      uidsign=$yyy
21528                 case "$uidsign" in
21529                  1) echo "Your $zzz is unsigned." ;;
21530                 -1) echo "Your $zzz is signed."   ;;
21531                 esac
21532                 ;;
21533         esac
21534 else
21535         uidsign=1
21536         echo "(I can't compile the test program--guessing unsigned.)" >&4
21537 fi
21538
21539
21540 : Check format string for UID
21541 echo " "
21542 $echo "Checking the format string to be used for uids..." >&4
21543
21544 case "$uidsign" in
21545 -1)     if $test X"$uidsize" = X"$ivsize"; then
21546                 uidformat="$ivdformat"
21547         else
21548                 if $test X"$uidsize" = X"$longsize"; then
21549                         uidformat='"ld"'
21550                 else
21551                         if $test X"$uidsize" = X"$intsize"; then
21552                                 uidformat='"d"'
21553                         else
21554                                 if $test X"$uidsize" = X"$shortsize"; then
21555                                         uidformat='"hd"'
21556                                 fi
21557                         fi
21558                 fi
21559         fi
21560         ;;
21561 *)      if $test X"$uidsize" = X"$uvsize"; then
21562                 uidformat="$uvuformat"
21563         else
21564                 if $test X"$uidsize" = X"$longsize"; then
21565                         uidformat='"lu"'
21566                 else
21567                         if $test X"$uidsize" = X"$intsize"; then
21568                                 uidformat='"u"'
21569                         else
21570                                 if $test X"$uidsize" = X"$shortsize"; then
21571                                         uidformat='"hu"'
21572                                 fi
21573                         fi
21574                 fi
21575         fi
21576         ;;
21577 esac
21578
21579 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21580 echo " "
21581 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21582 $cat >try.c <<'EOM'
21583 /* Intentionally a long probe as I'd like to sanity check that the exact
21584    approach is going to work, as thinking it will work, but only having it
21585    part working at runtime is worse than not having it.  */
21586
21587 #include <sys/types.h>
21588 #include <sys/sysctl.h>
21589 #include <sys/param.h>
21590 #include <stdio.h>
21591 #include <string.h>
21592 #include <stdlib.h>
21593 #include <unistd.h>
21594
21595 int
21596 main(int argc, char **argv) {
21597     char *buffer;
21598     char *argv_leaf = strrchr(argv[0], '/');
21599     char *buffer_leaf;
21600     size_t size = 0;
21601     int mib[4];
21602
21603     mib[0] = CTL_KERN;
21604     mib[1] = KERN_PROC;
21605     mib[2] = KERN_PROC_PATHNAME;
21606     mib[3] = -1;
21607
21608     if (!argv_leaf) {
21609         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21610         return 1;
21611     }
21612
21613     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21614         perror("sysctl");
21615         return 2;
21616     }
21617
21618     if (size < strlen(argv_leaf) + 1) {
21619         fprintf(stderr, "size %lu is too short for a path\n",
21620                 (unsigned long) size);
21621         return 3;
21622     }
21623
21624     if (size > MAXPATHLEN * MAXPATHLEN) {
21625         fprintf(stderr, "size %lu is too long for a path\n",
21626                 (unsigned long) size);
21627         return 4;
21628     }
21629
21630     buffer = malloc(size);
21631     if (!buffer) {
21632         perror("malloc");
21633         return 5;
21634     }
21635
21636     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21637         perror("sysctl");
21638         return 6;
21639     }
21640
21641     if (strlen(buffer) + 1 != size) {
21642         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21643                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21644         return 7;
21645     }
21646
21647
21648     if (*buffer != '/') {
21649         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21650         return 8;
21651     }
21652
21653     if (strstr(buffer, "/./")) {
21654         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21655         return 9;
21656     }
21657
21658     if (strstr(buffer, "/../")) {
21659         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21660         return 10;
21661     }
21662
21663     buffer_leaf = strrchr(buffer, '/');
21664     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21665         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21666         return 11;
21667     }
21668
21669     free(buffer);
21670
21671     return 0;
21672 }
21673 EOM
21674
21675 val=$undef
21676 set try
21677 if eval $compile; then
21678         if $run ./try; then
21679                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21680                 val="$define"
21681         else
21682                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21683                 val="$undef"
21684         fi
21685 else
21686         echo "I'm unable to compile the test program." >&4
21687         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21688         val="$undef"
21689 fi
21690 $rm_try
21691 set usekernprocpathname
21692 eval $setvar
21693
21694 : Determine if we can use _NSGetExecutablePath to find executing program
21695 echo " "
21696 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21697 $cat >try.c <<'EOM'
21698 /* Intentionally a long probe as I'd like to sanity check that the exact
21699    approach is going to work, as thinking it will work, but only having it
21700    part working at runtime is worse than not having it.  */
21701 #include <mach-o/dyld.h>
21702 #include <stdio.h>
21703 #include <stdlib.h>
21704 #include <sys/param.h>
21705 #include <string.h>
21706
21707 int
21708 main(int argc, char **argv) {
21709     char buf[1];
21710     uint32_t size = sizeof(buf);
21711     int result;
21712     char *buffer;
21713     char *tidied;
21714     char *argv_leaf = strrchr(argv[0], '/');
21715     char *tidied_leaf;
21716
21717     if (!argv_leaf) {
21718         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21719         return 1;
21720     }
21721
21722     _NSGetExecutablePath(buf, &size);
21723     if (size > MAXPATHLEN * MAXPATHLEN) {
21724         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21725                 (unsigned int) size);
21726         return 2;
21727     }
21728
21729     buffer = malloc(size);
21730     if (!buffer) {
21731         perror("malloc");
21732         return 3;
21733     }
21734
21735     result = _NSGetExecutablePath(buffer, &size);
21736     if (result != 0) {
21737         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21738                 result, (unsigned int) size);
21739         return 4;
21740     }
21741
21742     tidied = realpath(buffer, NULL);
21743     if (!tidied) {
21744         perror("realpath");
21745         return 5;
21746     }
21747
21748     free(buffer);
21749
21750     if (*tidied != '/') {
21751         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21752         return 6;
21753     }
21754
21755     if (strstr(tidied, "/./")) {
21756         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21757         return 7;
21758     }
21759
21760     if (strstr(tidied, "/../")) {
21761         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21762         return 8;
21763     }
21764
21765     tidied_leaf = strrchr(tidied, '/');
21766     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21767         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21768         return 9;
21769     }
21770
21771     free(tidied);
21772
21773     return 0;
21774 }
21775 EOM
21776
21777 val=$undef
21778 set try
21779 if eval $compile; then
21780         if $run ./try; then
21781                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21782                 val="$define"
21783         else
21784                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21785         fi
21786 else
21787         echo "I'm unable to compile the test program." >&4
21788         echo "I'll assume no _NSGetExecutablePath here." >&4
21789 fi
21790 $rm_try
21791 set usensgetexecutablepath
21792 eval $setvar
21793
21794 : Check if site customization support was requested
21795 case "$usesitecustomize" in
21796     $define|true|[Yy]*)
21797         usesitecustomize="$define"
21798         ;;
21799     *)
21800         usesitecustomize="$undef"
21801         ;;
21802     esac
21803
21804 : see if prototypes support variable argument declarations
21805 echo " "
21806 case "$prototype$i_stdarg" in
21807 $define$define)
21808         echo "It appears we'll be able to prototype varargs functions." >&4
21809         val="$define"
21810         ;;
21811 *)
21812         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21813         val="$undef"
21814         ;;
21815 esac
21816 set vaproto
21817 eval $setvar
21818
21819 : determine compiler compiler
21820 case "$yacc" in
21821 '')
21822         dflt=yacc;;
21823 *)
21824         dflt="$yacc";;
21825 esac
21826 echo " "
21827 comp='yacc'
21828 if $test -f "$byacc$_exe"; then
21829         dflt="$byacc"
21830         comp="byacc or $comp"
21831 fi
21832 if $test -f "$bison$_exe"; then
21833         comp="$comp or bison -y"
21834 fi
21835 rp="Which compiler compiler ($comp) shall I use?"
21836 . ./myread
21837 yacc="$ans"
21838 case "$yacc" in
21839 *bis*)
21840         case "$yacc" in
21841         *-y*) ;;
21842         *)
21843                 yacc="$yacc -y"
21844                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21845                 ;;
21846         esac
21847         ;;
21848 esac
21849
21850 : see if this is a assert.h system
21851 set assert.h i_assert
21852 eval $inhdr
21853
21854 : see if this is a fp.h system
21855 set fp.h i_fp
21856 eval $inhdr
21857
21858 : see if this is a fp_class.h system
21859 set fp_class.h i_fp_class
21860 eval $inhdr
21861
21862 : see if gdbm.h is available
21863 set gdbm.h t_gdbm
21864 eval $inhdr
21865 case "$t_gdbm" in
21866 $define)
21867         : see if gdbm_open exists
21868         set gdbm_open d_gdbm_open
21869         eval $inlibc
21870         case "$d_gdbm_open" in
21871         $undef)
21872                 t_gdbm="$undef"
21873                 echo "We won't be including <gdbm.h>"
21874                 ;;
21875         esac
21876         ;;
21877 esac
21878 val="$t_gdbm"
21879 set i_gdbm
21880 eval $setvar
21881
21882 : see if this is a ieeefp.h system
21883 case "$i_ieeefp" in
21884 '' ) set ieeefp.h i_ieeefp
21885      eval $inhdr
21886      ;;
21887 esac
21888
21889 : see if this is a libutil.h system
21890 set libutil.h i_libutil
21891 eval $inhdr
21892
21893 : see if mach cthreads are available
21894 if test "X$usethreads" = "X$define"; then
21895         set mach/cthreads.h i_machcthr
21896         eval $inhdr
21897 else
21898         i_machcthr="$undef"
21899 fi
21900
21901 : see if this is a mntent.h system
21902 set mntent.h i_mntent
21903 eval $inhdr
21904
21905 : see if net/errno.h is available
21906 val=''
21907 set net/errno.h val
21908 eval $inhdr
21909
21910 : Unfortunately, it causes problems on some systems.  Arrgh.
21911 case "$val" in
21912 $define)
21913         cat > try.c <<'EOM'
21914 #include <stdio.h>
21915 #include <errno.h>
21916 #include <net/errno.h>
21917 int func()
21918 {
21919         return ENOTSOCK;
21920 }
21921 EOM
21922         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21923                 echo "We'll be including <net/errno.h>." >&4
21924         else
21925                 echo "We won't be including <net/errno.h>." >&4
21926                 val="$undef"
21927         fi
21928         $rm_try
21929         ;;
21930 esac
21931 set i_neterrno
21932 eval $setvar
21933
21934 : see if netinet/tcp.h is available
21935 set netinet/tcp.h i_netinettcp
21936 eval $inhdr
21937
21938 : see if this is a poll.h system
21939 set poll.h i_poll
21940 eval $inhdr
21941
21942 : see if this is a prot.h system
21943 set prot.h i_prot
21944 eval $inhdr
21945
21946 : Preprocessor symbols
21947 echo " "
21948 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21949 $cat <<'EOSH' > Cppsym.know
21950 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21951 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21952 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21953 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21954 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21955 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21956 bull c cadmus clipper CMU COFF COMPILER_VERSION
21957 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21958 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21959 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21960 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21961 GLIBC GLIBC_MINOR
21962 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21963 H3050R H3050RX hbullx20 hcx host_mips
21964 hp200 hp300 hp700 HP700 hp800 hp9000
21965 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21966 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21967 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21968 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21969 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21970 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21971 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21972 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21973 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21974 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21975 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21976 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21977 MATH_HAS_NO_SIDE_EFFECTS
21978 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21979 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21980 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21981 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21982 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21983 NetBSD news1500 news1700 news1800 news1900 news3700
21984 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21985 ns32016 ns32332 ns32k nsc32000
21986 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21987 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21988 pc532 pdp11 PGC PIC plexus PORTAR posix
21989 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21990 POSIX_C_SOURCE POSIX_SOURCE POWER
21991 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21992 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21993 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21994 sony sony_news sonyrisc sparc sparclite spectrum
21995 stardent stdc STDC_EXT stratos sun sun3 sun386
21996 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21997 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21998 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21999 sysV68 sysV88 Tek4132 Tek4300 titan
22000 TM3200 TM5400 TM5600
22001 tower tower32 tower32_200 tower32_600 tower32_700
22002 tower32_800 tower32_850 tss
22003 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
22004 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
22005 unix UNIX95 UNIX99 unixpc unos
22006 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
22007 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
22008 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
22009 USGr4 USGr4_2
22010 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
22011 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
22012 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22013 z8000
22014 EOSH
22015 # Maybe put other stuff here too.
22016 cat <<EOSH >>Cppsym.know
22017 $osname
22018 EOSH
22019 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22020 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22021 $cat Cppsym.know > Cppsym.c
22022 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22023 $rm -f Cppsym.a Cppsym.b Cppsym.c
22024 cat <<EOSH > Cppsym
22025 $startsh
22026 if $test \$# -gt 0; then
22027     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22028     if $test -s Cppsym.got; then
22029         $rm -f Cppsym.got
22030         exit 0
22031     fi
22032     $rm -f Cppsym.got
22033     exit 1
22034 else
22035     $tr " " "$trnl" | ./Cppsym.try
22036     exit 0
22037 fi
22038 EOSH
22039 chmod +x Cppsym
22040 $eunicefix Cppsym
22041 cat <<EOSH > Cppsym.try
22042 $startsh
22043 cat <<'EOCP' > try.c
22044 #include <stdio.h>
22045 #if cpp_stuff == 1
22046 #define STRINGIFY(a)    "a"
22047 #endif
22048 #if cpp_stuff == 42
22049 #define StGiFy(a)  #a
22050 #define STRINGIFY(a)    StGiFy(a)
22051 #endif
22052 #if $cpp_stuff != 1 && $cpp_stuff != 42
22053 #   include "Bletch: How does this C preprocessor stringify macros?"
22054 #endif
22055 int main() {
22056 EOCP
22057 $awk \\
22058 EOSH
22059 cat <<'EOSH' >> Cppsym.try
22060 'length($1) > 0 {
22061     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22062     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22063     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22064     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22065 }'       >> try.c
22066 echo 'return 0;}' >> try.c
22067 EOSH
22068 cat <<EOSH >> Cppsym.try
22069 ccflags="$ccflags"
22070 case "$osname-$gccversion" in
22071 irix-) ccflags="\$ccflags -woff 1178" ;;
22072 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22073 esac
22074 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22075 EOSH
22076 chmod +x Cppsym.try
22077 $eunicefix Cppsym.try
22078 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22079 : Add in any Linux cpp "predefined macros":
22080 case "$osname::$gccversion" in
22081   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22082     tHdrH=_tmpHdr
22083     rm -f $tHdrH'.h' $tHdrH
22084     touch $tHdrH'.h'
22085     # Filter out macro arguments, such as Linux's __INT8_C(c)
22086     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22087        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22088        if [ -s $tHdrH'_cppsym.real' ]; then
22089           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22090        fi
22091     fi
22092     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22093   ;;
22094 esac
22095 : now check the C compiler for additional symbols
22096 postprocess_cc_v=''
22097 case "$osname" in
22098 aix) postprocess_cc_v="|$tr , ' '" ;;
22099 esac
22100 $cat >ccsym <<EOS
22101 $startsh
22102 $cat >tmp.c <<EOF
22103 extern int foo;
22104 EOF
22105 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22106 do
22107         case "\$i" in
22108         -D*) echo "\$i" | $sed 's/^-D//';;
22109         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22110         esac
22111 done
22112 $rm_try
22113 EOS
22114 postprocess_cc_v=''
22115 chmod +x ccsym
22116 $eunicefix ccsym
22117 ./ccsym > ccsym1.raw
22118 if $test -s ccsym1.raw; then
22119        $sort ccsym1.raw | $uniq >ccsym.raw
22120 else
22121        mv ccsym1.raw ccsym.raw
22122 fi
22123
22124 $awk '/\=/ { print $0; next }
22125         { print $0"=1" }' ccsym.raw >ccsym.list
22126 $comm -13 Cppsym.true ccsym.list >ccsym.own
22127 $comm -12 Cppsym.true ccsym.list >ccsym.com
22128 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22129 also=''
22130 if $test -z ccsym.raw; then
22131         echo "Your C compiler doesn't seem to define any symbols!" >&4
22132         echo " "
22133         echo "However, your C preprocessor defines the following symbols:"
22134         $cat Cppsym.true
22135         ccsymbols=''
22136         cppsymbols=`$cat Cppsym.true`
22137         cppsymbols=`echo $cppsymbols`
22138         cppccsymbols="$cppsymbols"
22139 else
22140         if $test -s ccsym.com; then
22141                 echo "Your C compiler and pre-processor define these symbols:"
22142                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22143                 also='also '
22144                 symbols='ones'
22145                 cppccsymbols=`$cat ccsym.com`
22146                 cppccsymbols=`echo $cppccsymbols`
22147                 $test "$silent" || sleep 1
22148         fi
22149         if $test -s ccsym.cpp; then
22150                 $test "$also" && echo " "
22151                 echo "Your C pre-processor ${also}defines the following symbols:"
22152                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22153                 also='further '
22154                 cppsymbols=`$cat ccsym.cpp`
22155                 cppsymbols=`echo $cppsymbols`
22156                 $test "$silent" || sleep 1
22157         fi
22158         if $test -s ccsym.own; then
22159                 $test "$also" && echo " "
22160                 echo "Your C compiler ${also}defines the following cpp symbols:"
22161                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22162                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22163                 ccsymbols=`$cat ccsym.own`
22164                 ccsymbols=`echo $ccsymbols`
22165                 $test "$silent" || sleep 1
22166         fi
22167 fi
22168
22169 : see if this is a termio system
22170 val="$undef"
22171 val2="$undef"
22172 val3="$undef"
22173 if $test `./findhdr termios.h`; then
22174     set tcsetattr i_termios
22175     eval $inlibc
22176     val3="$i_termios"
22177 fi
22178 echo " "
22179 case "$val3" in
22180     "$define") echo "You have POSIX termios.h... good!" >&4;;
22181     *)  if ./Cppsym pyr; then
22182             case "`$run /bin/universe`" in
22183                 ucb) if $test `./findhdr sgtty.h`; then
22184                         val2="$define"
22185                         echo "<sgtty.h> found." >&4
22186                     else
22187                         echo "System is pyramid with BSD universe."
22188                         ./warn "<sgtty.h> not found--you could have problems."
22189                     fi;;
22190                 *)  if $test `./findhdr termio.h`; then
22191                         val="$define"
22192                         echo "<termio.h> found." >&4
22193                     else
22194                         echo "System is pyramid with USG universe."
22195                         ./warn "<termio.h> not found--you could have problems."
22196                     fi;;
22197             esac
22198         elif ./usg; then
22199             if $test `./findhdr termio.h`; then
22200                 echo "<termio.h> found." >&4
22201                 val="$define"
22202             elif $test `./findhdr sgtty.h`; then
22203                 echo "<sgtty.h> found." >&4
22204                 val2="$define"
22205             else
22206                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22207             fi
22208         else
22209             if $test `./findhdr sgtty.h`; then
22210                 echo "<sgtty.h> found." >&4
22211                 val2="$define"
22212             elif $test `./findhdr termio.h`; then
22213                 echo "<termio.h> found." >&4
22214                 val="$define"
22215             else
22216                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22217             fi
22218         fi;;
22219 esac
22220 set i_termio; eval $setvar
22221 val=$val2; set i_sgtty; eval $setvar
22222 val=$val3; set i_termios; eval $setvar
22223
22224 : see if stdbool is available
22225 : we want a real compile instead of Inhdr because some Solaris systems
22226 : have stdbool.h, but it can only be used if the compiler indicates it
22227 : is sufficiently c99-compliant.
22228 echo " "
22229 $cat >try.c <<EOCP
22230 #include <stdio.h>
22231 #include <stdbool.h>
22232 int func(bool x)
22233 {
22234     return x ? 1 : 0;
22235 }
22236 int main(int argc, char **argv)
22237 {
22238     return func(0);
22239 }
22240 EOCP
22241 set try
22242 if eval $compile; then
22243         echo "<stdbool.h> found." >&4
22244         val="$define"
22245 else
22246         echo "<stdbool.h> NOT found." >&4
22247         val="$undef"
22248 fi
22249 $rm_try
22250 set i_stdbool
22251 eval $setvar
22252
22253 : see if stddef is available
22254 set stddef.h i_stddef
22255 eval $inhdr
22256
22257 : see if sys/access.h is available
22258 set sys/access.h i_sysaccess
22259 eval $inhdr
22260
22261 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22262 set sys/filio.h i_sysfilio
22263 eval $inhdr
22264 echo " "
22265 if $test `./findhdr sys/ioctl.h`; then
22266         val="$define"
22267         echo '<sys/ioctl.h> found.' >&4
22268 else
22269         val="$undef"
22270         if $test $i_sysfilio = "$define"; then
22271             echo '<sys/ioctl.h> NOT found.' >&4
22272         else
22273                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22274                 $test $i_termio = "$define" && xxx="termio.h"
22275                 $test $i_termios = "$define" && xxx="termios.h"
22276 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22277         fi
22278 fi
22279 set i_sysioctl
22280 eval $setvar
22281
22282 : see if socket ioctl defs are in sys/sockio.h
22283 echo " "
22284 xxx=`./findhdr sys/sockio.h`
22285 if $test "$xxx"; then
22286         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22287                 val="$define"
22288                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22289         else
22290                 val="$undef"
22291                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22292         fi
22293 else
22294         val="$undef"
22295         $cat <<EOM
22296 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22297 EOM
22298 fi
22299 set i_syssockio
22300 eval $setvar
22301
22302 : see if this is a syslog.h system
22303 set syslog.h i_syslog
22304 eval $inhdr
22305
22306 : see if this is a sys/mode.h system
22307 set sys/mode.h i_sysmode
22308 eval $inhdr
22309
22310 : see if there is a sys/poll.h file
22311 set sys/poll.h i_syspoll
22312 eval $inhdr
22313
22314 : see if sys/resource.h has to be included
22315 set sys/resource.h i_sysresrc
22316 eval $inhdr
22317
22318 : see if sys/security.h is available
22319 set sys/security.h i_syssecrt
22320 eval $inhdr
22321
22322 : see if this is a sys/statvfs.h system
22323 set sys/statvfs.h i_sysstatvfs
22324 eval $inhdr
22325
22326 : see if this is a sys/un.h system
22327 set sys/un.h i_sysun
22328 eval $inhdr
22329
22330 : see if this is a sys/utsname.h system
22331 set sys/utsname.h i_sysutsname
22332 eval $inhdr
22333
22334 : see if this is a syswait system
22335 set sys/wait.h i_syswait
22336 eval $inhdr
22337
22338 : see if this is a ustat.h system
22339 set ustat.h i_ustat
22340 eval $inhdr
22341
22342 : see if this is an utime system
22343 set utime.h i_utime
22344 eval $inhdr
22345
22346 : see if this is a vfork system
22347 case "$d_vfork" in
22348 "$define")
22349         set vfork.h i_vfork
22350         eval $inhdr
22351         ;;
22352 *)
22353         i_vfork="$undef"
22354         ;;
22355 esac
22356
22357 : Check extensions
22358 echo " "
22359 echo "Looking for extensions..." >&4
22360 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22361 : contain old or inaccurate or duplicate values.
22362 nonxs_extensions=''
22363 xs_extensions=''
22364 : We do not use find because it might not be available.
22365 : We do not just use MANIFEST because the user may have dropped
22366 : some additional extensions into the source tree and expect them
22367 : to be built.
22368
22369 : Function to recursively find available extensions, ignoring DynaLoader
22370 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22371 : In 5.10.1 and later, extensions are stored in directories
22372 : like File-Glob instead of the older File/Glob/.
22373 find_extensions='
22374     for xxx in *; do
22375         case "$xxx" in
22376             DynaLoader|dynaload) ;;
22377             *)
22378             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22379             case "$this_ext" in
22380                 Scalar/List/Utils) this_ext="List/Util" ;;
22381                 PathTools)         this_ext="Cwd"       ;;
22382             esac;
22383             echo " $xs_extensions $nonxs_extensions" > $$.tmp;
22384             if $contains " $this_ext " $$.tmp; then
22385                 echo >&4;
22386                 echo "Duplicate directories detected for extension $xxx" >&4;
22387                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22388                 case "$knowitall" in
22389                 "") dflt=y;;
22390                 *) dflt=n;;
22391                 esac;
22392                 . ../UU/myread;
22393                 case "$ans" in
22394                 n*|N*) ;;
22395                 *) echo >&4;
22396                     echo "Ok.  Stopping Configure." >&4;
22397                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22398                     exit 1;;
22399                 esac;
22400                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22401             fi;
22402             $ls -1 $xxx > $$.tmp;
22403             if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22404                 xs_extensions="$xs_extensions $this_ext";
22405             elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22406                 xs_extensions="$xs_extensions $this_ext";
22407             elif $test -d $xxx; then
22408                 nonxs_extensions="$nonxs_extensions $this_ext";
22409             fi;
22410             $rm -f $$.tmp;
22411             ;;
22412         esac;
22413     done'
22414 tdir=`pwd`
22415 cd "$rsrc/cpan"
22416 set X
22417 shift
22418 eval $find_extensions
22419 cd "$rsrc/dist"
22420 set X
22421 shift
22422 eval $find_extensions
22423 cd "$rsrc/ext"
22424 set X
22425 shift
22426 eval $find_extensions
22427 set X $xs_extensions
22428 shift
22429 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22430 set X $nonxs_extensions
22431 shift
22432 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22433 cd "$tdir"
22434 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22435
22436 : Now see which are supported on this system.
22437 avail_ext=''
22438 for xxx in $xs_extensions ; do
22439         case "$xxx" in
22440         DB_File|db_file)
22441                 case "$i_db" in
22442                 $define) avail_ext="$avail_ext $xxx" ;;
22443                 esac
22444                 ;;
22445         GDBM_File|gdbm_fil)
22446                 case "$i_gdbm" in
22447                 $define) avail_ext="$avail_ext $xxx" ;;
22448                 esac
22449                 ;;
22450         I18N/Langinfo|i18n_lan)
22451                 case "$i_langinfo$d_nl_langinfo" in
22452                 $define$define) avail_ext="$avail_ext $xxx" ;;
22453                 esac
22454                 ;;
22455         IPC/SysV|ipc/sysv)
22456                 : XXX Do we need a useipcsysv variable here
22457                 case "${d_msg}${d_sem}${d_shm}" in
22458                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22459                 esac
22460                 ;;
22461         NDBM_File|ndbm_fil)
22462                 case "$d_ndbm" in
22463                 $define)
22464                     case "$osname-$use64bitint" in
22465                     hpux-define)
22466                         case "$libs" in
22467                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22468                         esac
22469                         ;;
22470                     *) avail_ext="$avail_ext $xxx" ;;
22471                     esac
22472                     ;;
22473                 esac
22474                 ;;
22475         ODBM_File|odbm_fil)
22476                 case "${i_dbm}${i_rpcsvcdbm}" in
22477                 *"${define}"*)
22478                     case "$d_cplusplus" in
22479                     define) ;; # delete as a function name will not work
22480                     *)  case "$osname-$use64bitint" in
22481                         hpux-define)
22482                             case "$libs" in
22483                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22484                             esac
22485                             ;;
22486                         *) avail_ext="$avail_ext $xxx" ;;
22487                         esac
22488                         ;;
22489                     esac
22490                     ;;
22491                 esac
22492                 ;;
22493         Opcode|opcode)
22494                 case "$useopcode" in
22495                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22496                 esac
22497                 ;;
22498         POSIX|posix)
22499                 case "$useposix" in
22500                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22501                 esac
22502                 ;;
22503         Socket|socket)
22504                 case "$d_socket" in
22505                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22506                 esac
22507                 ;;
22508         Sys/Syslog|sys/syslog)
22509                 : XXX syslog requires socket
22510                 case "$d_socket" in
22511                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22512                 esac
22513                 ;;
22514         Thread|thread)
22515                 case "$usethreads" in
22516                 true|$define|y)
22517                         case "$use5005threads" in
22518                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22519                         esac
22520                 esac
22521                 ;;
22522         threads|threads/shared)
22523                 # threads and threads::shared are special cases.
22524                 # To stop people from asking "Perl 5.8.0 was supposed
22525                 # to have this new fancy threads implementation but my
22526                 # perl doesn't have it" and from people trying to
22527                 # (re)install the threads module using CPAN.pm and
22528                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22529                 # the threads.pm and threads/shared.pm will always be
22530                 # there, croaking informatively ("you need to rebuild
22531                 # all of Perl with threads, sorry") when threads haven't
22532                 # been compiled in.
22533                 # --jhi
22534                 avail_ext="$avail_ext $xxx"
22535                 ;;
22536         VMS*)
22537                 ;;
22538         Win32*)
22539                 case "$osname" in
22540                 cygwin) avail_ext="$avail_ext $xxx" ;;
22541                 esac
22542                 ;;
22543         XS/APItest|xs/apitest)
22544                 # This is just for testing.  Skip it unless we have dynamic loading.
22545
22546                 case "$usedl" in
22547                 $define) avail_ext="$avail_ext $xxx" ;;
22548                 esac
22549                 ;;
22550         XS/Typemap|xs/typemap)
22551                 # This is just for testing.  Skip it unless we have dynamic loading.
22552                 case "$usedl" in
22553                 $define) avail_ext="$avail_ext $xxx" ;;
22554                 esac
22555                 ;;
22556         *)      avail_ext="$avail_ext $xxx"
22557                 ;;
22558         esac
22559 done
22560
22561 set X $avail_ext
22562 shift
22563 avail_ext="$*"
22564
22565 case "$onlyextensions" in
22566 '') ;;
22567 *)  keepextensions=''
22568     echo "You have requested that only certain extensions be included..." >&4
22569     for i in $onlyextensions; do
22570         case " $avail_ext " in
22571         *" $i "*)
22572             echo "Keeping extension $i."
22573             keepextensions="$keepextensions $i"
22574             ;;
22575         *) echo "Ignoring extension $i." ;;
22576         esac
22577     done
22578     avail_ext="$keepextensions"
22579     ;;
22580 esac
22581
22582 case "$noextensions" in
22583 '') ;;
22584 *)  keepextensions=''
22585     echo "You have requested that certain extensions be ignored..." >&4
22586     for i in $avail_ext; do
22587         case " $noextensions " in
22588         *" $i "*) echo "Ignoring extension $i." ;;
22589         *) echo "Keeping extension $i.";
22590            keepextensions="$keepextensions $i"
22591            ;;
22592         esac
22593     done
22594     avail_ext="$keepextensions"
22595     ;;
22596 esac
22597
22598 : Now see which nonxs extensions are supported on this system.
22599 : For now assume all are.
22600 nonxs_ext=''
22601 for xxx in $nonxs_extensions ; do
22602         case "$xxx" in
22603         VMS*)
22604                 ;;
22605         *)      nonxs_ext="$nonxs_ext $xxx"
22606                 ;;
22607         esac
22608 done
22609
22610 set X $nonxs_ext
22611 shift
22612 nonxs_ext="$*"
22613
22614 case $usedl in
22615 $define)
22616         $cat <<EOM
22617 A number of extensions are supplied with $package.  You may choose to
22618 compile these extensions for dynamic loading (the default), compile
22619 them into the $package executable (static loading), or not include
22620 them at all.  Answer "none" to include no extensions.
22621 Note that DynaLoader is always built and need not be mentioned here.
22622
22623 EOM
22624         case "$dynamic_ext" in
22625         '')
22626                 : Exclude those listed in static_ext
22627                 dflt=''
22628                 for xxx in $avail_ext; do
22629                         case " $static_ext " in
22630                         *" $xxx "*) ;;
22631                         *) dflt="$dflt $xxx" ;;
22632                         esac
22633                 done
22634                 set X $dflt
22635                 shift
22636                 dflt="$*"
22637                 ;;
22638         *)      dflt="$dynamic_ext"
22639                 # Perhaps we are reusing an old out-of-date config.sh.
22640                 case "$hint" in
22641                 previous)
22642                         if test X"$dynamic_ext" != X"$avail_ext"; then
22643                                 $cat <<EOM
22644 NOTICE:  Your previous config.sh list may be incorrect.
22645 The extensions now available to you are
22646         ${avail_ext}
22647 but the default list from your previous config.sh is
22648         ${dynamic_ext}
22649
22650 EOM
22651                         fi
22652                         ;;
22653                 esac
22654                 ;;
22655         esac
22656         case "$dflt" in
22657         '')     dflt=none;;
22658         esac
22659         rp="What extensions do you wish to load dynamically?"
22660         . ./myread
22661         case "$ans" in
22662         none) dynamic_ext=' ' ;;
22663         *) dynamic_ext="$ans" ;;
22664         esac
22665
22666         case "$static_ext" in
22667         '')
22668                 : Exclude those already listed in dynamic linking
22669                 dflt=''
22670                 for xxx in $avail_ext; do
22671                         case " $dynamic_ext " in
22672                         *" $xxx "*) ;;
22673                         *) dflt="$dflt $xxx" ;;
22674                         esac
22675                 done
22676                 set X $dflt
22677                 shift
22678                 dflt="$*"
22679                 ;;
22680         *)  dflt="$static_ext"
22681                 ;;
22682         esac
22683
22684         case "$dflt" in
22685         '')     dflt=none;;
22686         esac
22687         rp="What extensions do you wish to load statically?"
22688         . ./myread
22689         case "$ans" in
22690         none) static_ext=' ' ;;
22691         *) static_ext="$ans" ;;
22692         esac
22693         ;;
22694 *)
22695         $cat <<EOM
22696 A number of extensions are supplied with $package.  Answer "none"
22697 to include no extensions.
22698 Note that DynaLoader is always built and need not be mentioned here.
22699
22700 EOM
22701         case "$static_ext" in
22702         '') dflt="$avail_ext" ;;
22703         *)      dflt="$static_ext"
22704                 # Perhaps we are reusing an old out-of-date config.sh.
22705                 case "$hint" in
22706                 previous)
22707                         if test X"$static_ext" != X"$avail_ext"; then
22708                                 $cat <<EOM
22709 NOTICE:  Your previous config.sh list may be incorrect.
22710 The extensions now available to you are
22711         ${avail_ext}
22712 but the default list from your previous config.sh is
22713         ${static_ext}
22714
22715 EOM
22716                         fi
22717                         ;;
22718                 esac
22719                 ;;
22720         esac
22721         : Exclude those that are not xs extensions
22722         case "$dflt" in
22723         '')     dflt=none;;
22724         esac
22725         rp="What extensions do you wish to include?"
22726         . ./myread
22727         case "$ans" in
22728         none) static_ext=' ' ;;
22729         *) static_ext="$ans" ;;
22730         esac
22731         ;;
22732 esac
22733 #
22734 # Encode is a special case.  If we are building Encode as a static
22735 # extension, we need to explicitly list its subextensions as well.
22736 # For other nested extensions, this is handled automatically by
22737 # the appropriate Makefile.PL.
22738 case " $static_ext " in
22739         *" Encode "*) # Add the subextensions of Encode
22740         cd "$rsrc/cpan"
22741         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22742                 static_ext="$static_ext Encode/$xxx"
22743                 known_extensions="$known_extensions Encode/$xxx"
22744         done
22745         cd "$tdir"
22746         ;;
22747 esac
22748
22749 set X $dynamic_ext $static_ext $nonxs_ext
22750 shift
22751 extensions="$*"
22752
22753 # Sanity check:  We require an extension suitable for use with
22754 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22755 # should show up as failures in the test suite, but it's helpful to
22756 # catch them now.) The 'extensions' list is normally sorted
22757 # alphabetically, so we need to accept either
22758 #    DB_File ... Fcntl ... IO  ....
22759 # or something like
22760 #    Fcntl ... NDBM_File ... IO  ....
22761 case " $extensions"  in
22762 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22763 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22764 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22765 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22766    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22767    ;;
22768 esac
22769
22770 : Remove libraries needed only for extensions
22771 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22772 : The exception is SunOS 4.x, which needs them.
22773 case "${osname}X${osvers}" in
22774 sunos*X4*)
22775     perllibs="$libs"
22776     ;;
22777 *) case "$usedl" in
22778     $define|true|[yY]*)
22779             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22780             shift
22781             perllibs="$*"
22782             ;;
22783     *)  perllibs="$libs"
22784             ;;
22785     esac
22786     ;;
22787 esac
22788
22789 : Remove build directory name from cppstdin so it can be used from
22790 : either the present location or the final installed location.
22791 echo " "
22792 : Get out of the UU directory to get correct path name.
22793 cd ..
22794 case "$cppstdin" in
22795 `pwd`/cppstdin)
22796         echo "Stripping down cppstdin path name"
22797         cppstdin=cppstdin
22798         ;;
22799 esac
22800 cd UU
22801
22802 : end of configuration questions
22803 echo " "
22804 echo "End of configuration questions."
22805 echo " "
22806
22807 : back to where it started
22808 if test -d ../UU; then
22809         cd ..
22810 fi
22811
22812 : configuration may be unconditionally patched via a 'config.arch' file
22813 if $test -f config.arch; then
22814         echo "I see a config.arch file, loading it." >&4
22815         . ./config.arch
22816 fi
22817
22818 : configuration may be patched via a 'config.over' file
22819 if $test -f config.over; then
22820         echo " "
22821         dflt=y
22822         rp='I see a config.over file.  Do you wish to load it?'
22823         . UU/myread
22824         case "$ans" in
22825         n*) echo "OK, I'll ignore it.";;
22826         *)      . ./config.over
22827                 echo "Configuration override changes have been loaded."
22828                 ;;
22829         esac
22830 fi
22831
22832 : in case they want portability, strip down executable paths
22833 case "$d_portable" in
22834 "$define")
22835         echo " "
22836         echo "Stripping down executable paths..." >&4
22837         for file in $loclist $trylist; do
22838                 eval temp=\$$file
22839                 eval $file=`basename $temp`
22840         done
22841         ;;
22842 esac
22843
22844 : create config.sh file
22845 echo " "
22846 echo "Creating config.sh..." >&4
22847 $spitshell <<EOT >config.sh
22848 $startsh
22849 #
22850 # This file was produced by running the Configure script. It holds all the
22851 # definitions figured out by Configure. Should you modify one of these values,
22852 # do not forget to propagate your changes by running "Configure -der". You may
22853 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22854 #
22855
22856 # Package name      : $package
22857 # Source directory  : $src
22858 # Configuration time: $cf_time
22859 # Configured by     : $cf_by
22860 # Target system     : $myuname
22861
22862 EOT
22863 : Add in command line options if available
22864 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22865
22866 $spitshell <<EOT >>config.sh
22867
22868 Author='$Author'
22869 Date='$Date'
22870 Header='$Header'
22871 Id='$Id'
22872 Locker='$Locker'
22873 Log='$Log'
22874 RCSfile='$RCSfile'
22875 Revision='$Revision'
22876 Source='$Source'
22877 State='$State'
22878 _a='$_a'
22879 _exe='$_exe'
22880 _o='$_o'
22881 afs='$afs'
22882 afsroot='$afsroot'
22883 alignbytes='$alignbytes'
22884 ansi2knr='$ansi2knr'
22885 aphostname='$aphostname'
22886 api_revision='$api_revision'
22887 api_subversion='$api_subversion'
22888 api_version='$api_version'
22889 api_versionstring='$api_versionstring'
22890 ar='$ar'
22891 archlib='$archlib'
22892 archlibexp='$archlibexp'
22893 archname64='$archname64'
22894 archname='$archname'
22895 archobjs='$archobjs'
22896 asctime_r_proto='$asctime_r_proto'
22897 awk='$awk'
22898 baserev='$baserev'
22899 bash='$bash'
22900 bin='$bin'
22901 bin_ELF='$bin_ELF'
22902 binexp='$binexp'
22903 bison='$bison'
22904 bootstrap_charset='$bootstrap_charset'
22905 byacc='$byacc'
22906 byteorder='$byteorder'
22907 c='$c'
22908 castflags='$castflags'
22909 cat='$cat'
22910 cc='$cc'
22911 cccdlflags='$cccdlflags'
22912 ccdlflags='$ccdlflags'
22913 ccflags='$ccflags'
22914 ccflags_uselargefiles='$ccflags_uselargefiles'
22915 ccname='$ccname'
22916 ccsymbols='$ccsymbols'
22917 ccversion='$ccversion'
22918 cf_by='$cf_by'
22919 cf_email='$cf_email'
22920 cf_time='$cf_time'
22921 charbits='$charbits'
22922 charsize='$charsize'
22923 chgrp='$chgrp'
22924 chmod='$chmod'
22925 chown='$chown'
22926 clocktype='$clocktype'
22927 comm='$comm'
22928 compress='$compress'
22929 contains='$contains'
22930 cp='$cp'
22931 cpio='$cpio'
22932 cpp='$cpp'
22933 cpp_stuff='$cpp_stuff'
22934 cppccsymbols='$cppccsymbols'
22935 cppflags='$cppflags'
22936 cpplast='$cpplast'
22937 cppminus='$cppminus'
22938 cpprun='$cpprun'
22939 cppstdin='$cppstdin'
22940 cppsymbols='$cppsymbols'
22941 crypt_r_proto='$crypt_r_proto'
22942 cryptlib='$cryptlib'
22943 csh='$csh'
22944 ctermid_r_proto='$ctermid_r_proto'
22945 ctime_r_proto='$ctime_r_proto'
22946 d_Gconvert='$d_Gconvert'
22947 d_PRIEUldbl='$d_PRIEUldbl'
22948 d_PRIFUldbl='$d_PRIFUldbl'
22949 d_PRIGUldbl='$d_PRIGUldbl'
22950 d_PRIXU64='$d_PRIXU64'
22951 d_PRId64='$d_PRId64'
22952 d_PRIeldbl='$d_PRIeldbl'
22953 d_PRIfldbl='$d_PRIfldbl'
22954 d_PRIgldbl='$d_PRIgldbl'
22955 d_PRIi64='$d_PRIi64'
22956 d_PRIo64='$d_PRIo64'
22957 d_PRIu64='$d_PRIu64'
22958 d_PRIx64='$d_PRIx64'
22959 d_SCNfldbl='$d_SCNfldbl'
22960 d__fwalk='$d__fwalk'
22961 d_access='$d_access'
22962 d_accessx='$d_accessx'
22963 d_aintl='$d_aintl'
22964 d_alarm='$d_alarm'
22965 d_archlib='$d_archlib'
22966 d_asctime64='$d_asctime64'
22967 d_asctime_r='$d_asctime_r'
22968 d_atolf='$d_atolf'
22969 d_atoll='$d_atoll'
22970 d_attribute_deprecated='$d_attribute_deprecated'
22971 d_attribute_format='$d_attribute_format'
22972 d_attribute_malloc='$d_attribute_malloc'
22973 d_attribute_nonnull='$d_attribute_nonnull'
22974 d_attribute_noreturn='$d_attribute_noreturn'
22975 d_attribute_pure='$d_attribute_pure'
22976 d_attribute_unused='$d_attribute_unused'
22977 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22978 d_bcmp='$d_bcmp'
22979 d_bcopy='$d_bcopy'
22980 d_bsd='$d_bsd'
22981 d_bsdgetpgrp='$d_bsdgetpgrp'
22982 d_bsdsetpgrp='$d_bsdsetpgrp'
22983 d_builtin_choose_expr='$d_builtin_choose_expr'
22984 d_builtin_expect='$d_builtin_expect'
22985 d_bzero='$d_bzero'
22986 d_c99_variadic_macros='$d_c99_variadic_macros'
22987 d_casti32='$d_casti32'
22988 d_castneg='$d_castneg'
22989 d_charvspr='$d_charvspr'
22990 d_chown='$d_chown'
22991 d_chroot='$d_chroot'
22992 d_chsize='$d_chsize'
22993 d_class='$d_class'
22994 d_clearenv='$d_clearenv'
22995 d_closedir='$d_closedir'
22996 d_cmsghdr_s='$d_cmsghdr_s'
22997 d_const='$d_const'
22998 d_copysignl='$d_copysignl'
22999 d_cplusplus='$d_cplusplus'
23000 d_crypt='$d_crypt'
23001 d_crypt_r='$d_crypt_r'
23002 d_csh='$d_csh'
23003 d_ctermid='$d_ctermid'
23004 d_ctermid_r='$d_ctermid_r'
23005 d_ctime64='$d_ctime64'
23006 d_ctime_r='$d_ctime_r'
23007 d_cuserid='$d_cuserid'
23008 d_dbl_dig='$d_dbl_dig'
23009 d_dbminitproto='$d_dbminitproto'
23010 d_difftime64='$d_difftime64'
23011 d_difftime='$d_difftime'
23012 d_dir_dd_fd='$d_dir_dd_fd'
23013 d_dirfd='$d_dirfd'
23014 d_dirnamlen='$d_dirnamlen'
23015 d_dlerror='$d_dlerror'
23016 d_dlopen='$d_dlopen'
23017 d_dlsymun='$d_dlsymun'
23018 d_dosuid='$d_dosuid'
23019 d_drand48_r='$d_drand48_r'
23020 d_drand48proto='$d_drand48proto'
23021 d_dup2='$d_dup2'
23022 d_eaccess='$d_eaccess'
23023 d_endgrent='$d_endgrent'
23024 d_endgrent_r='$d_endgrent_r'
23025 d_endhent='$d_endhent'
23026 d_endhostent_r='$d_endhostent_r'
23027 d_endnent='$d_endnent'
23028 d_endnetent_r='$d_endnetent_r'
23029 d_endpent='$d_endpent'
23030 d_endprotoent_r='$d_endprotoent_r'
23031 d_endpwent='$d_endpwent'
23032 d_endpwent_r='$d_endpwent_r'
23033 d_endsent='$d_endsent'
23034 d_endservent_r='$d_endservent_r'
23035 d_eofnblk='$d_eofnblk'
23036 d_eunice='$d_eunice'
23037 d_faststdio='$d_faststdio'
23038 d_fchdir='$d_fchdir'
23039 d_fchmod='$d_fchmod'
23040 d_fchown='$d_fchown'
23041 d_fcntl='$d_fcntl'
23042 d_fcntl_can_lock='$d_fcntl_can_lock'
23043 d_fd_macros='$d_fd_macros'
23044 d_fd_set='$d_fd_set'
23045 d_fds_bits='$d_fds_bits'
23046 d_fgetpos='$d_fgetpos'
23047 d_finite='$d_finite'
23048 d_finitel='$d_finitel'
23049 d_flexfnam='$d_flexfnam'
23050 d_flock='$d_flock'
23051 d_flockproto='$d_flockproto'
23052 d_fork='$d_fork'
23053 d_fp_class='$d_fp_class'
23054 d_fpathconf='$d_fpathconf'
23055 d_fpclass='$d_fpclass'
23056 d_fpclassify='$d_fpclassify'
23057 d_fpclassl='$d_fpclassl'
23058 d_fpos64_t='$d_fpos64_t'
23059 d_frexpl='$d_frexpl'
23060 d_fs_data_s='$d_fs_data_s'
23061 d_fseeko='$d_fseeko'
23062 d_fsetpos='$d_fsetpos'
23063 d_fstatfs='$d_fstatfs'
23064 d_fstatvfs='$d_fstatvfs'
23065 d_fsync='$d_fsync'
23066 d_ftello='$d_ftello'
23067 d_ftime='$d_ftime'
23068 d_futimes='$d_futimes'
23069 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23070 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23071 d_getaddrinfo='$d_getaddrinfo'
23072 d_getcwd='$d_getcwd'
23073 d_getespwnam='$d_getespwnam'
23074 d_getfsstat='$d_getfsstat'
23075 d_getgrent='$d_getgrent'
23076 d_getgrent_r='$d_getgrent_r'
23077 d_getgrgid_r='$d_getgrgid_r'
23078 d_getgrnam_r='$d_getgrnam_r'
23079 d_getgrps='$d_getgrps'
23080 d_gethbyaddr='$d_gethbyaddr'
23081 d_gethbyname='$d_gethbyname'
23082 d_gethent='$d_gethent'
23083 d_gethname='$d_gethname'
23084 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23085 d_gethostbyname_r='$d_gethostbyname_r'
23086 d_gethostent_r='$d_gethostent_r'
23087 d_gethostprotos='$d_gethostprotos'
23088 d_getitimer='$d_getitimer'
23089 d_getlogin='$d_getlogin'
23090 d_getlogin_r='$d_getlogin_r'
23091 d_getmnt='$d_getmnt'
23092 d_getmntent='$d_getmntent'
23093 d_getnameinfo='$d_getnameinfo'
23094 d_getnbyaddr='$d_getnbyaddr'
23095 d_getnbyname='$d_getnbyname'
23096 d_getnent='$d_getnent'
23097 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23098 d_getnetbyname_r='$d_getnetbyname_r'
23099 d_getnetent_r='$d_getnetent_r'
23100 d_getnetprotos='$d_getnetprotos'
23101 d_getpagsz='$d_getpagsz'
23102 d_getpbyname='$d_getpbyname'
23103 d_getpbynumber='$d_getpbynumber'
23104 d_getpent='$d_getpent'
23105 d_getpgid='$d_getpgid'
23106 d_getpgrp2='$d_getpgrp2'
23107 d_getpgrp='$d_getpgrp'
23108 d_getppid='$d_getppid'
23109 d_getprior='$d_getprior'
23110 d_getprotobyname_r='$d_getprotobyname_r'
23111 d_getprotobynumber_r='$d_getprotobynumber_r'
23112 d_getprotoent_r='$d_getprotoent_r'
23113 d_getprotoprotos='$d_getprotoprotos'
23114 d_getprpwnam='$d_getprpwnam'
23115 d_getpwent='$d_getpwent'
23116 d_getpwent_r='$d_getpwent_r'
23117 d_getpwnam_r='$d_getpwnam_r'
23118 d_getpwuid_r='$d_getpwuid_r'
23119 d_getsbyname='$d_getsbyname'
23120 d_getsbyport='$d_getsbyport'
23121 d_getsent='$d_getsent'
23122 d_getservbyname_r='$d_getservbyname_r'
23123 d_getservbyport_r='$d_getservbyport_r'
23124 d_getservent_r='$d_getservent_r'
23125 d_getservprotos='$d_getservprotos'
23126 d_getspnam='$d_getspnam'
23127 d_getspnam_r='$d_getspnam_r'
23128 d_gettimeod='$d_gettimeod'
23129 d_gmtime64='$d_gmtime64'
23130 d_gmtime_r='$d_gmtime_r'
23131 d_gnulibc='$d_gnulibc'
23132 d_grpasswd='$d_grpasswd'
23133 d_hasmntopt='$d_hasmntopt'
23134 d_htonl='$d_htonl'
23135 d_ilogbl='$d_ilogbl'
23136 d_inc_version_list='$d_inc_version_list'
23137 d_index='$d_index'
23138 d_inetaton='$d_inetaton'
23139 d_inetntop='$d_inetntop'
23140 d_inetpton='$d_inetpton'
23141 d_int64_t='$d_int64_t'
23142 d_ip_mreq='$d_ip_mreq'
23143 d_ip_mreq_source='$d_ip_mreq_source'
23144 d_ipv6_mreq='$d_ipv6_mreq'
23145 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23146 d_isascii='$d_isascii'
23147 d_isblank='$d_isblank'
23148 d_isfinite='$d_isfinite'
23149 d_isinf='$d_isinf'
23150 d_isnan='$d_isnan'
23151 d_isnanl='$d_isnanl'
23152 d_killpg='$d_killpg'
23153 d_lchown='$d_lchown'
23154 d_ldbl_dig='$d_ldbl_dig'
23155 d_libm_lib_version='$d_libm_lib_version'
23156 d_libname_unique='$d_libname_unique'
23157 d_link='$d_link'
23158 d_localtime64='$d_localtime64'
23159 d_localtime_r='$d_localtime_r'
23160 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23161 d_locconv='$d_locconv'
23162 d_lockf='$d_lockf'
23163 d_longdbl='$d_longdbl'
23164 d_longlong='$d_longlong'
23165 d_lseekproto='$d_lseekproto'
23166 d_lstat='$d_lstat'
23167 d_madvise='$d_madvise'
23168 d_malloc_good_size='$d_malloc_good_size'
23169 d_malloc_size='$d_malloc_size'
23170 d_mblen='$d_mblen'
23171 d_mbstowcs='$d_mbstowcs'
23172 d_mbtowc='$d_mbtowc'
23173 d_memchr='$d_memchr'
23174 d_memcmp='$d_memcmp'
23175 d_memcpy='$d_memcpy'
23176 d_memmove='$d_memmove'
23177 d_memset='$d_memset'
23178 d_mkdir='$d_mkdir'
23179 d_mkdtemp='$d_mkdtemp'
23180 d_mkfifo='$d_mkfifo'
23181 d_mkstemp='$d_mkstemp'
23182 d_mkstemps='$d_mkstemps'
23183 d_mktime64='$d_mktime64'
23184 d_mktime='$d_mktime'
23185 d_mmap='$d_mmap'
23186 d_modfl='$d_modfl'
23187 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23188 d_modflproto='$d_modflproto'
23189 d_mprotect='$d_mprotect'
23190 d_msg='$d_msg'
23191 d_msg_ctrunc='$d_msg_ctrunc'
23192 d_msg_dontroute='$d_msg_dontroute'
23193 d_msg_oob='$d_msg_oob'
23194 d_msg_peek='$d_msg_peek'
23195 d_msg_proxy='$d_msg_proxy'
23196 d_msgctl='$d_msgctl'
23197 d_msgget='$d_msgget'
23198 d_msghdr_s='$d_msghdr_s'
23199 d_msgrcv='$d_msgrcv'
23200 d_msgsnd='$d_msgsnd'
23201 d_msync='$d_msync'
23202 d_munmap='$d_munmap'
23203 d_mymalloc='$d_mymalloc'
23204 d_ndbm='$d_ndbm'
23205 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23206 d_nice='$d_nice'
23207 d_nl_langinfo='$d_nl_langinfo'
23208 d_nv_preserves_uv='$d_nv_preserves_uv'
23209 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23210 d_off64_t='$d_off64_t'
23211 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23212 d_oldpthreads='$d_oldpthreads'
23213 d_oldsock='$d_oldsock'
23214 d_open3='$d_open3'
23215 d_pathconf='$d_pathconf'
23216 d_pause='$d_pause'
23217 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23218 d_phostname='$d_phostname'
23219 d_pipe='$d_pipe'
23220 d_poll='$d_poll'
23221 d_portable='$d_portable'
23222 d_prctl='$d_prctl'
23223 d_prctl_set_name='$d_prctl_set_name'
23224 d_printf_format_null='$d_printf_format_null'
23225 d_procselfexe='$d_procselfexe'
23226 d_pseudofork='$d_pseudofork'
23227 d_pthread_atfork='$d_pthread_atfork'
23228 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23229 d_pthread_yield='$d_pthread_yield'
23230 d_pwage='$d_pwage'
23231 d_pwchange='$d_pwchange'
23232 d_pwclass='$d_pwclass'
23233 d_pwcomment='$d_pwcomment'
23234 d_pwexpire='$d_pwexpire'
23235 d_pwgecos='$d_pwgecos'
23236 d_pwpasswd='$d_pwpasswd'
23237 d_pwquota='$d_pwquota'
23238 d_qgcvt='$d_qgcvt'
23239 d_quad='$d_quad'
23240 d_random_r='$d_random_r'
23241 d_readdir64_r='$d_readdir64_r'
23242 d_readdir='$d_readdir'
23243 d_readdir_r='$d_readdir_r'
23244 d_readlink='$d_readlink'
23245 d_readv='$d_readv'
23246 d_recvmsg='$d_recvmsg'
23247 d_rename='$d_rename'
23248 d_rewinddir='$d_rewinddir'
23249 d_rmdir='$d_rmdir'
23250 d_safebcpy='$d_safebcpy'
23251 d_safemcpy='$d_safemcpy'
23252 d_sanemcmp='$d_sanemcmp'
23253 d_sbrkproto='$d_sbrkproto'
23254 d_scalbnl='$d_scalbnl'
23255 d_sched_yield='$d_sched_yield'
23256 d_scm_rights='$d_scm_rights'
23257 d_seekdir='$d_seekdir'
23258 d_select='$d_select'
23259 d_sem='$d_sem'
23260 d_semctl='$d_semctl'
23261 d_semctl_semid_ds='$d_semctl_semid_ds'
23262 d_semctl_semun='$d_semctl_semun'
23263 d_semget='$d_semget'
23264 d_semop='$d_semop'
23265 d_sendmsg='$d_sendmsg'
23266 d_setegid='$d_setegid'
23267 d_seteuid='$d_seteuid'
23268 d_setgrent='$d_setgrent'
23269 d_setgrent_r='$d_setgrent_r'
23270 d_setgrps='$d_setgrps'
23271 d_sethent='$d_sethent'
23272 d_sethostent_r='$d_sethostent_r'
23273 d_setitimer='$d_setitimer'
23274 d_setlinebuf='$d_setlinebuf'
23275 d_setlocale='$d_setlocale'
23276 d_setlocale_r='$d_setlocale_r'
23277 d_setnent='$d_setnent'
23278 d_setnetent_r='$d_setnetent_r'
23279 d_setpent='$d_setpent'
23280 d_setpgid='$d_setpgid'
23281 d_setpgrp2='$d_setpgrp2'
23282 d_setpgrp='$d_setpgrp'
23283 d_setprior='$d_setprior'
23284 d_setproctitle='$d_setproctitle'
23285 d_setprotoent_r='$d_setprotoent_r'
23286 d_setpwent='$d_setpwent'
23287 d_setpwent_r='$d_setpwent_r'
23288 d_setregid='$d_setregid'
23289 d_setresgid='$d_setresgid'
23290 d_setresuid='$d_setresuid'
23291 d_setreuid='$d_setreuid'
23292 d_setrgid='$d_setrgid'
23293 d_setruid='$d_setruid'
23294 d_setsent='$d_setsent'
23295 d_setservent_r='$d_setservent_r'
23296 d_setsid='$d_setsid'
23297 d_setvbuf='$d_setvbuf'
23298 d_shm='$d_shm'
23299 d_shmat='$d_shmat'
23300 d_shmatprototype='$d_shmatprototype'
23301 d_shmctl='$d_shmctl'
23302 d_shmdt='$d_shmdt'
23303 d_shmget='$d_shmget'
23304 d_sigaction='$d_sigaction'
23305 d_signbit='$d_signbit'
23306 d_sigprocmask='$d_sigprocmask'
23307 d_sigsetjmp='$d_sigsetjmp'
23308 d_sin6_scope_id='$d_sin6_scope_id'
23309 d_sitearch='$d_sitearch'
23310 d_snprintf='$d_snprintf'
23311 d_sockaddr_in6='$d_sockaddr_in6'
23312 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23313 d_sockatmark='$d_sockatmark'
23314 d_sockatmarkproto='$d_sockatmarkproto'
23315 d_socket='$d_socket'
23316 d_socklen_t='$d_socklen_t'
23317 d_sockpair='$d_sockpair'
23318 d_socks5_init='$d_socks5_init'
23319 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23320 d_sqrtl='$d_sqrtl'
23321 d_srand48_r='$d_srand48_r'
23322 d_srandom_r='$d_srandom_r'
23323 d_sresgproto='$d_sresgproto'
23324 d_sresuproto='$d_sresuproto'
23325 d_statblks='$d_statblks'
23326 d_statfs_f_flags='$d_statfs_f_flags'
23327 d_statfs_s='$d_statfs_s'
23328 d_static_inline='$d_static_inline'
23329 d_statvfs='$d_statvfs'
23330 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23331 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23332 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23333 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23334 d_stdio_stream_array='$d_stdio_stream_array'
23335 d_stdiobase='$d_stdiobase'
23336 d_stdstdio='$d_stdstdio'
23337 d_strchr='$d_strchr'
23338 d_strcoll='$d_strcoll'
23339 d_strctcpy='$d_strctcpy'
23340 d_strerrm='$d_strerrm'
23341 d_strerror='$d_strerror'
23342 d_strerror_r='$d_strerror_r'
23343 d_strftime='$d_strftime'
23344 d_strlcat='$d_strlcat'
23345 d_strlcpy='$d_strlcpy'
23346 d_strtod='$d_strtod'
23347 d_strtol='$d_strtol'
23348 d_strtold='$d_strtold'
23349 d_strtoll='$d_strtoll'
23350 d_strtoq='$d_strtoq'
23351 d_strtoul='$d_strtoul'
23352 d_strtoull='$d_strtoull'
23353 d_strtouq='$d_strtouq'
23354 d_strxfrm='$d_strxfrm'
23355 d_suidsafe='$d_suidsafe'
23356 d_symlink='$d_symlink'
23357 d_syscall='$d_syscall'
23358 d_syscallproto='$d_syscallproto'
23359 d_sysconf='$d_sysconf'
23360 d_sysernlst='$d_sysernlst'
23361 d_syserrlst='$d_syserrlst'
23362 d_system='$d_system'
23363 d_tcgetpgrp='$d_tcgetpgrp'
23364 d_tcsetpgrp='$d_tcsetpgrp'
23365 d_telldir='$d_telldir'
23366 d_telldirproto='$d_telldirproto'
23367 d_time='$d_time'
23368 d_timegm='$d_timegm'
23369 d_times='$d_times'
23370 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23371 d_tm_tm_zone='$d_tm_tm_zone'
23372 d_tmpnam_r='$d_tmpnam_r'
23373 d_truncate='$d_truncate'
23374 d_ttyname_r='$d_ttyname_r'
23375 d_tzname='$d_tzname'
23376 d_u32align='$d_u32align'
23377 d_ualarm='$d_ualarm'
23378 d_umask='$d_umask'
23379 d_uname='$d_uname'
23380 d_union_semun='$d_union_semun'
23381 d_unordered='$d_unordered'
23382 d_unsetenv='$d_unsetenv'
23383 d_usleep='$d_usleep'
23384 d_usleepproto='$d_usleepproto'
23385 d_ustat='$d_ustat'
23386 d_vendorarch='$d_vendorarch'
23387 d_vendorbin='$d_vendorbin'
23388 d_vendorlib='$d_vendorlib'
23389 d_vendorscript='$d_vendorscript'
23390 d_vfork='$d_vfork'
23391 d_void_closedir='$d_void_closedir'
23392 d_voidsig='$d_voidsig'
23393 d_voidtty='$d_voidtty'
23394 d_volatile='$d_volatile'
23395 d_vprintf='$d_vprintf'
23396 d_vsnprintf='$d_vsnprintf'
23397 d_wait4='$d_wait4'
23398 d_waitpid='$d_waitpid'
23399 d_wcstombs='$d_wcstombs'
23400 d_wctomb='$d_wctomb'
23401 d_writev='$d_writev'
23402 d_xenix='$d_xenix'
23403 date='$date'
23404 db_hashtype='$db_hashtype'
23405 db_prefixtype='$db_prefixtype'
23406 db_version_major='$db_version_major'
23407 db_version_minor='$db_version_minor'
23408 db_version_patch='$db_version_patch'
23409 direntrytype='$direntrytype'
23410 dlext='$dlext'
23411 dlsrc='$dlsrc'
23412 doublesize='$doublesize'
23413 drand01='$drand01'
23414 drand48_r_proto='$drand48_r_proto'
23415 dtrace='$dtrace'
23416 dynamic_ext='$dynamic_ext'
23417 eagain='$eagain'
23418 ebcdic='$ebcdic'
23419 echo='$echo'
23420 egrep='$egrep'
23421 emacs='$emacs'
23422 endgrent_r_proto='$endgrent_r_proto'
23423 endhostent_r_proto='$endhostent_r_proto'
23424 endnetent_r_proto='$endnetent_r_proto'
23425 endprotoent_r_proto='$endprotoent_r_proto'
23426 endpwent_r_proto='$endpwent_r_proto'
23427 endservent_r_proto='$endservent_r_proto'
23428 eunicefix='$eunicefix'
23429 exe_ext='$exe_ext'
23430 expr='$expr'
23431 extensions='$extensions'
23432 extern_C='$extern_C'
23433 extras='$extras'
23434 fflushNULL='$fflushNULL'
23435 fflushall='$fflushall'
23436 find='$find'
23437 firstmakefile='$firstmakefile'
23438 flex='$flex'
23439 fpossize='$fpossize'
23440 fpostype='$fpostype'
23441 freetype='$freetype'
23442 from='$from'
23443 full_ar='$full_ar'
23444 full_csh='$full_csh'
23445 full_sed='$full_sed'
23446 gccansipedantic='$gccansipedantic'
23447 gccosandvers='$gccosandvers'
23448 gccversion='$gccversion'
23449 getgrent_r_proto='$getgrent_r_proto'
23450 getgrgid_r_proto='$getgrgid_r_proto'
23451 getgrnam_r_proto='$getgrnam_r_proto'
23452 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23453 gethostbyname_r_proto='$gethostbyname_r_proto'
23454 gethostent_r_proto='$gethostent_r_proto'
23455 getlogin_r_proto='$getlogin_r_proto'
23456 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23457 getnetbyname_r_proto='$getnetbyname_r_proto'
23458 getnetent_r_proto='$getnetent_r_proto'
23459 getprotobyname_r_proto='$getprotobyname_r_proto'
23460 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23461 getprotoent_r_proto='$getprotoent_r_proto'
23462 getpwent_r_proto='$getpwent_r_proto'
23463 getpwnam_r_proto='$getpwnam_r_proto'
23464 getpwuid_r_proto='$getpwuid_r_proto'
23465 getservbyname_r_proto='$getservbyname_r_proto'
23466 getservbyport_r_proto='$getservbyport_r_proto'
23467 getservent_r_proto='$getservent_r_proto'
23468 getspnam_r_proto='$getspnam_r_proto'
23469 gidformat='$gidformat'
23470 gidsign='$gidsign'
23471 gidsize='$gidsize'
23472 gidtype='$gidtype'
23473 glibpth='$glibpth'
23474 gmake='$gmake'
23475 gmtime_r_proto='$gmtime_r_proto'
23476 gnulibc_version='$gnulibc_version'
23477 grep='$grep'
23478 groupcat='$groupcat'
23479 groupstype='$groupstype'
23480 gzip='$gzip'
23481 h_fcntl='$h_fcntl'
23482 h_sysfile='$h_sysfile'
23483 hint='$hint'
23484 hostcat='$hostcat'
23485 html1dir='$html1dir'
23486 html1direxp='$html1direxp'
23487 html3dir='$html3dir'
23488 html3direxp='$html3direxp'
23489 hostgenerate='$hostgenerate'
23490 hostperl='$hostperl'
23491 hostosname='$hostosname'
23492 i16size='$i16size'
23493 i16type='$i16type'
23494 i32size='$i32size'
23495 i32type='$i32type'
23496 i64size='$i64size'
23497 i64type='$i64type'
23498 i8size='$i8size'
23499 i8type='$i8type'
23500 i_arpainet='$i_arpainet'
23501 i_assert='$i_assert'
23502 i_bsdioctl='$i_bsdioctl'
23503 i_crypt='$i_crypt'
23504 i_db='$i_db'
23505 i_dbm='$i_dbm'
23506 i_dirent='$i_dirent'
23507 i_dlfcn='$i_dlfcn'
23508 i_fcntl='$i_fcntl'
23509 i_float='$i_float'
23510 i_fp='$i_fp'
23511 i_fp_class='$i_fp_class'
23512 i_gdbm='$i_gdbm'
23513 i_gdbm_ndbm='$i_gdbm_ndbm'
23514 i_gdbmndbm='$i_gdbmndbm'
23515 i_grp='$i_grp'
23516 i_ieeefp='$i_ieeefp'
23517 i_inttypes='$i_inttypes'
23518 i_langinfo='$i_langinfo'
23519 i_libutil='$i_libutil'
23520 i_limits='$i_limits'
23521 i_locale='$i_locale'
23522 i_machcthr='$i_machcthr'
23523 i_malloc='$i_malloc'
23524 i_mallocmalloc='$i_mallocmalloc'
23525 i_math='$i_math'
23526 i_memory='$i_memory'
23527 i_mntent='$i_mntent'
23528 i_ndbm='$i_ndbm'
23529 i_netdb='$i_netdb'
23530 i_neterrno='$i_neterrno'
23531 i_netinettcp='$i_netinettcp'
23532 i_niin='$i_niin'
23533 i_poll='$i_poll'
23534 i_prot='$i_prot'
23535 i_pthread='$i_pthread'
23536 i_pwd='$i_pwd'
23537 i_rpcsvcdbm='$i_rpcsvcdbm'
23538 i_sgtty='$i_sgtty'
23539 i_shadow='$i_shadow'
23540 i_socks='$i_socks'
23541 i_stdarg='$i_stdarg'
23542 i_stdbool='$i_stdbool'
23543 i_stddef='$i_stddef'
23544 i_stdlib='$i_stdlib'
23545 i_string='$i_string'
23546 i_sunmath='$i_sunmath'
23547 i_sysaccess='$i_sysaccess'
23548 i_sysdir='$i_sysdir'
23549 i_sysfile='$i_sysfile'
23550 i_sysfilio='$i_sysfilio'
23551 i_sysin='$i_sysin'
23552 i_sysioctl='$i_sysioctl'
23553 i_syslog='$i_syslog'
23554 i_sysmman='$i_sysmman'
23555 i_sysmode='$i_sysmode'
23556 i_sysmount='$i_sysmount'
23557 i_sysndir='$i_sysndir'
23558 i_sysparam='$i_sysparam'
23559 i_syspoll='$i_syspoll'
23560 i_sysresrc='$i_sysresrc'
23561 i_syssecrt='$i_syssecrt'
23562 i_sysselct='$i_sysselct'
23563 i_syssockio='$i_syssockio'
23564 i_sysstat='$i_sysstat'
23565 i_sysstatfs='$i_sysstatfs'
23566 i_sysstatvfs='$i_sysstatvfs'
23567 i_systime='$i_systime'
23568 i_systimek='$i_systimek'
23569 i_systimes='$i_systimes'
23570 i_systypes='$i_systypes'
23571 i_sysuio='$i_sysuio'
23572 i_sysun='$i_sysun'
23573 i_sysutsname='$i_sysutsname'
23574 i_sysvfs='$i_sysvfs'
23575 i_syswait='$i_syswait'
23576 i_termio='$i_termio'
23577 i_termios='$i_termios'
23578 i_time='$i_time'
23579 i_unistd='$i_unistd'
23580 i_ustat='$i_ustat'
23581 i_utime='$i_utime'
23582 i_values='$i_values'
23583 i_varargs='$i_varargs'
23584 i_varhdr='$i_varhdr'
23585 i_vfork='$i_vfork'
23586 ignore_versioned_solibs='$ignore_versioned_solibs'
23587 inc_version_list='$inc_version_list'
23588 inc_version_list_init='$inc_version_list_init'
23589 incpath='$incpath'
23590 incpth='$incpth'
23591 inews='$inews'
23592 initialinstalllocation='$initialinstalllocation'
23593 installarchlib='$installarchlib'
23594 installbin='$installbin'
23595 installhtml1dir='$installhtml1dir'
23596 installhtml3dir='$installhtml3dir'
23597 installman1dir='$installman1dir'
23598 installman3dir='$installman3dir'
23599 installprefix='$installprefix'
23600 installprefixexp='$installprefixexp'
23601 installprivlib='$installprivlib'
23602 installscript='$installscript'
23603 installsitearch='$installsitearch'
23604 installsitebin='$installsitebin'
23605 installsitehtml1dir='$installsitehtml1dir'
23606 installsitehtml3dir='$installsitehtml3dir'
23607 installsitelib='$installsitelib'
23608 installsiteman1dir='$installsiteman1dir'
23609 installsiteman3dir='$installsiteman3dir'
23610 installsitescript='$installsitescript'
23611 installstyle='$installstyle'
23612 installusrbinperl='$installusrbinperl'
23613 installvendorarch='$installvendorarch'
23614 installvendorbin='$installvendorbin'
23615 installvendorhtml1dir='$installvendorhtml1dir'
23616 installvendorhtml3dir='$installvendorhtml3dir'
23617 installvendorlib='$installvendorlib'
23618 installvendorman1dir='$installvendorman1dir'
23619 installvendorman3dir='$installvendorman3dir'
23620 installvendorscript='$installvendorscript'
23621 intsize='$intsize'
23622 issymlink='$issymlink'
23623 ivdformat='$ivdformat'
23624 ivsize='$ivsize'
23625 ivtype='$ivtype'
23626 known_extensions='$known_extensions'
23627 ksh='$ksh'
23628 ld='$ld'
23629 ld_can_script='$ld_can_script'
23630 lddlflags='$lddlflags'
23631 ldflags='$ldflags'
23632 ldflags_uselargefiles='$ldflags_uselargefiles'
23633 ldlibpthname='$ldlibpthname'
23634 less='$less'
23635 lib_ext='$lib_ext'
23636 libc='$libc'
23637 libperl='$libperl'
23638 libpth='$libpth'
23639 libs='$libs'
23640 libsdirs='$libsdirs'
23641 libsfiles='$libsfiles'
23642 libsfound='$libsfound'
23643 libspath='$libspath'
23644 libswanted='$libswanted'
23645 libswanted_uselargefiles='$libswanted_uselargefiles'
23646 line='$line'
23647 lint='$lint'
23648 lkflags='$lkflags'
23649 ln='$ln'
23650 lns='$lns'
23651 localtime_r_proto='$localtime_r_proto'
23652 locincpth='$locincpth'
23653 loclibpth='$loclibpth'
23654 longdblsize='$longdblsize'
23655 longlongsize='$longlongsize'
23656 longsize='$longsize'
23657 lp='$lp'
23658 lpr='$lpr'
23659 ls='$ls'
23660 lseeksize='$lseeksize'
23661 lseektype='$lseektype'
23662 mad='$mad'
23663 madlyh='$madlyh'
23664 madlyobj='$madlyobj'
23665 madlysrc='$madlysrc'
23666 mail='$mail'
23667 mailx='$mailx'
23668 make='$make'
23669 make_set_make='$make_set_make'
23670 mallocobj='$mallocobj'
23671 mallocsrc='$mallocsrc'
23672 malloctype='$malloctype'
23673 man1dir='$man1dir'
23674 man1direxp='$man1direxp'
23675 man1ext='$man1ext'
23676 man3dir='$man3dir'
23677 man3direxp='$man3direxp'
23678 man3ext='$man3ext'
23679 mips_type='$mips_type'
23680 mistrustnm='$mistrustnm'
23681 mkdir='$mkdir'
23682 mmaptype='$mmaptype'
23683 modetype='$modetype'
23684 more='$more'
23685 multiarch='$multiarch'
23686 mv='$mv'
23687 myarchname='$myarchname'
23688 mydomain='$mydomain'
23689 myhostname='$myhostname'
23690 myuname='$myuname'
23691 n='$n'
23692 need_va_copy='$need_va_copy'
23693 netdb_hlen_type='$netdb_hlen_type'
23694 netdb_host_type='$netdb_host_type'
23695 netdb_name_type='$netdb_name_type'
23696 netdb_net_type='$netdb_net_type'
23697 nm='$nm'
23698 nm_opt='$nm_opt'
23699 nm_so_opt='$nm_so_opt'
23700 nonxs_ext='$nonxs_ext'
23701 nroff='$nroff'
23702 nvEUformat='$nvEUformat'
23703 nvFUformat='$nvFUformat'
23704 nvGUformat='$nvGUformat'
23705 nv_overflows_integers_at='$nv_overflows_integers_at'
23706 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23707 nveformat='$nveformat'
23708 nvfformat='$nvfformat'
23709 nvgformat='$nvgformat'
23710 nvsize='$nvsize'
23711 nvtype='$nvtype'
23712 o_nonblock='$o_nonblock'
23713 obj_ext='$obj_ext'
23714 old_pthread_create_joinable='$old_pthread_create_joinable'
23715 optimize='$optimize'
23716 orderlib='$orderlib'
23717 osname='$osname'
23718 osvers='$osvers'
23719 otherlibdirs='$otherlibdirs'
23720 package='$package'
23721 pager='$pager'
23722 passcat='$passcat'
23723 patchlevel='$patchlevel'
23724 path_sep='$path_sep'
23725 perl5='$perl5'
23726 perl='$perl'
23727 perl_patchlevel='$perl_patchlevel'
23728 perl_static_inline='$perl_static_inline'
23729 perladmin='$perladmin'
23730 perllibs='$perllibs'
23731 perlpath='$perlpath'
23732 pg='$pg'
23733 phostname='$phostname'
23734 pidtype='$pidtype'
23735 plibpth='$plibpth'
23736 pmake='$pmake'
23737 pr='$pr'
23738 prefix='$prefix'
23739 prefixexp='$prefixexp'
23740 privlib='$privlib'
23741 privlibexp='$privlibexp'
23742 procselfexe='$procselfexe'
23743 prototype='$prototype'
23744 ptrsize='$ptrsize'
23745 quadkind='$quadkind'
23746 quadtype='$quadtype'
23747 randbits='$randbits'
23748 randfunc='$randfunc'
23749 random_r_proto='$random_r_proto'
23750 randseedtype='$randseedtype'
23751 ranlib='$ranlib'
23752 rd_nodata='$rd_nodata'
23753 readdir64_r_proto='$readdir64_r_proto'
23754 readdir_r_proto='$readdir_r_proto'
23755 revision='$revision'
23756 rm='$rm'
23757 rm_try='$rm_try'
23758 rmail='$rmail'
23759 run='$run'
23760 runnm='$runnm'
23761 sGMTIME_max='$sGMTIME_max'
23762 sGMTIME_min='$sGMTIME_min'
23763 sLOCALTIME_max='$sLOCALTIME_max'
23764 sLOCALTIME_min='$sLOCALTIME_min'
23765 sPRIEUldbl='$sPRIEUldbl'
23766 sPRIFUldbl='$sPRIFUldbl'
23767 sPRIGUldbl='$sPRIGUldbl'
23768 sPRIXU64='$sPRIXU64'
23769 sPRId64='$sPRId64'
23770 sPRIeldbl='$sPRIeldbl'
23771 sPRIfldbl='$sPRIfldbl'
23772 sPRIgldbl='$sPRIgldbl'
23773 sPRIi64='$sPRIi64'
23774 sPRIo64='$sPRIo64'
23775 sPRIu64='$sPRIu64'
23776 sPRIx64='$sPRIx64'
23777 sSCNfldbl='$sSCNfldbl'
23778 sched_yield='$sched_yield'
23779 scriptdir='$scriptdir'
23780 scriptdirexp='$scriptdirexp'
23781 sed='$sed'
23782 seedfunc='$seedfunc'
23783 selectminbits='$selectminbits'
23784 selecttype='$selecttype'
23785 sendmail='$sendmail'
23786 setgrent_r_proto='$setgrent_r_proto'
23787 sethostent_r_proto='$sethostent_r_proto'
23788 setlocale_r_proto='$setlocale_r_proto'
23789 setnetent_r_proto='$setnetent_r_proto'
23790 setprotoent_r_proto='$setprotoent_r_proto'
23791 setpwent_r_proto='$setpwent_r_proto'
23792 setservent_r_proto='$setservent_r_proto'
23793 sh='$sh'
23794 shar='$shar'
23795 sharpbang='$sharpbang'
23796 shmattype='$shmattype'
23797 shortsize='$shortsize'
23798 shrpenv='$shrpenv'
23799 shsharp='$shsharp'
23800 sig_count='$sig_count'
23801 sig_name='$sig_name'
23802 sig_name_init='$sig_name_init'
23803 sig_num='$sig_num'
23804 sig_num_init='$sig_num_init'
23805 sig_size='$sig_size'
23806 signal_t='$signal_t'
23807 sitearch='$sitearch'
23808 sitearchexp='$sitearchexp'
23809 sitebin='$sitebin'
23810 sitebinexp='$sitebinexp'
23811 sitehtml1dir='$sitehtml1dir'
23812 sitehtml1direxp='$sitehtml1direxp'
23813 sitehtml3dir='$sitehtml3dir'
23814 sitehtml3direxp='$sitehtml3direxp'
23815 sitelib='$sitelib'
23816 sitelib_stem='$sitelib_stem'
23817 sitelibexp='$sitelibexp'
23818 siteman1dir='$siteman1dir'
23819 siteman1direxp='$siteman1direxp'
23820 siteman3dir='$siteman3dir'
23821 siteman3direxp='$siteman3direxp'
23822 siteprefix='$siteprefix'
23823 siteprefixexp='$siteprefixexp'
23824 sitescript='$sitescript'
23825 sitescriptexp='$sitescriptexp'
23826 sizesize='$sizesize'
23827 sizetype='$sizetype'
23828 sleep='$sleep'
23829 smail='$smail'
23830 so='$so'
23831 sockethdr='$sockethdr'
23832 socketlib='$socketlib'
23833 socksizetype='$socksizetype'
23834 sort='$sort'
23835 spackage='$spackage'
23836 spitshell='$spitshell'
23837 srand48_r_proto='$srand48_r_proto'
23838 srandom_r_proto='$srandom_r_proto'
23839 src='$src'
23840 ssizetype='$ssizetype'
23841 st_ino_sign='$st_ino_sign'
23842 st_ino_size='$st_ino_size'
23843 startperl='$startperl'
23844 startsh='$startsh'
23845 static_ext='$static_ext'
23846 stdchar='$stdchar'
23847 stdio_base='$stdio_base'
23848 stdio_bufsiz='$stdio_bufsiz'
23849 stdio_cnt='$stdio_cnt'
23850 stdio_filbuf='$stdio_filbuf'
23851 stdio_ptr='$stdio_ptr'
23852 stdio_stream_array='$stdio_stream_array'
23853 strerror_r_proto='$strerror_r_proto'
23854 strings='$strings'
23855 submit='$submit'
23856 subversion='$subversion'
23857 sysman='$sysman'
23858 sysroot='$sysroot'
23859 tail='$tail'
23860 tar='$tar'
23861 targetarch='$targetarch'
23862 targetdir='$targetdir'
23863 targetenv='$targetenv'
23864 targethost='$targethost'
23865 targetmkdir='$targetmkdir'
23866 targetport='$targetport'
23867 targetsh='$targetsh'
23868 tbl='$tbl'
23869 tee='$tee'
23870 test='$test'
23871 timeincl='$timeincl'
23872 timetype='$timetype'
23873 tmpnam_r_proto='$tmpnam_r_proto'
23874 to='$to'
23875 touch='$touch'
23876 tr='$tr'
23877 trnl='$trnl'
23878 troff='$troff'
23879 ttyname_r_proto='$ttyname_r_proto'
23880 u16size='$u16size'
23881 u16type='$u16type'
23882 u32size='$u32size'
23883 u32type='$u32type'
23884 u64size='$u64size'
23885 u64type='$u64type'
23886 u8size='$u8size'
23887 u8type='$u8type'
23888 uidformat='$uidformat'
23889 uidsign='$uidsign'
23890 uidsize='$uidsize'
23891 uidtype='$uidtype'
23892 uname='$uname'
23893 uniq='$uniq'
23894 uquadtype='$uquadtype'
23895 use5005threads='$use5005threads'
23896 use64bitall='$use64bitall'
23897 use64bitint='$use64bitint'
23898 usecrosscompile='$usecrosscompile'
23899 usedevel='$usedevel'
23900 usedl='$usedl'
23901 usedtrace='$usedtrace'
23902 usefaststdio='$usefaststdio'
23903 useithreads='$useithreads'
23904 usekernprocpathname='$usekernprocpathname'
23905 uselargefiles='$uselargefiles'
23906 uselongdouble='$uselongdouble'
23907 usemallocwrap='$usemallocwrap'
23908 usemorebits='$usemorebits'
23909 usemultiplicity='$usemultiplicity'
23910 usemymalloc='$usemymalloc'
23911 usenm='$usenm'
23912 usensgetexecutablepath='$usensgetexecutablepath'
23913 useopcode='$useopcode'
23914 useperlio='$useperlio'
23915 useposix='$useposix'
23916 usereentrant='$usereentrant'
23917 userelocatableinc='$userelocatableinc'
23918 useshrplib='$useshrplib'
23919 usesitecustomize='$usesitecustomize'
23920 usesocks='$usesocks'
23921 usethreads='$usethreads'
23922 usevendorprefix='$usevendorprefix'
23923 useversionedarchname='$useversionedarchname'
23924 usevfork='$usevfork'
23925 usrinc='$usrinc'
23926 uuname='$uuname'
23927 uvXUformat='$uvXUformat'
23928 uvoformat='$uvoformat'
23929 uvsize='$uvsize'
23930 uvtype='$uvtype'
23931 uvuformat='$uvuformat'
23932 uvxformat='$uvxformat'
23933 vaproto='$vaproto'
23934 vendorarch='$vendorarch'
23935 vendorarchexp='$vendorarchexp'
23936 vendorbin='$vendorbin'
23937 vendorbinexp='$vendorbinexp'
23938 vendorhtml1dir='$vendorhtml1dir'
23939 vendorhtml1direxp='$vendorhtml1direxp'
23940 vendorhtml3dir='$vendorhtml3dir'
23941 vendorhtml3direxp='$vendorhtml3direxp'
23942 vendorlib='$vendorlib'
23943 vendorlib_stem='$vendorlib_stem'
23944 vendorlibexp='$vendorlibexp'
23945 vendorman1dir='$vendorman1dir'
23946 vendorman1direxp='$vendorman1direxp'
23947 vendorman3dir='$vendorman3dir'
23948 vendorman3direxp='$vendorman3direxp'
23949 vendorprefix='$vendorprefix'
23950 vendorprefixexp='$vendorprefixexp'
23951 vendorscript='$vendorscript'
23952 vendorscriptexp='$vendorscriptexp'
23953 version='$version'
23954 version_patchlevel_string='$version_patchlevel_string'
23955 versiononly='$versiononly'
23956 vi='$vi'
23957 xlibpth='$xlibpth'
23958 yacc='$yacc'
23959 yaccflags='$yaccflags'
23960 zcat='$zcat'
23961 zip='$zip'
23962 EOT
23963
23964 : add special variables
23965 $test -f $src/patchlevel.h && \
23966 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23967 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23968 echo "PERL_CONFIG_SH=true" >>config.sh
23969
23970 : propagate old symbols
23971 if $test -f UU/config.sh; then
23972         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23973         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23974                 config.sh config.sh UU/oldconfig.sh |\
23975                 $sort | $uniq -u >UU/oldsyms
23976         set X `$cat UU/oldsyms`
23977         shift
23978         case $# in
23979         0) ;;
23980         *)
23981                 $cat <<EOM
23982 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23983 EOM
23984                 echo ": Variables propagated from previous config.sh file." >>config.sh
23985                 for sym in `$cat UU/oldsyms`; do
23986                         echo "    Propagating $hint variable "'$'"$sym..."
23987                         eval 'tmp="$'"${sym}"'"'
23988                         echo "$tmp" | \
23989                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23990                 done
23991                 ;;
23992         esac
23993 fi
23994
23995 : Finish up by extracting the .SH files
23996 case "$alldone" in
23997 exit)
23998         $rm -rf UU
23999         echo "Extraction done."
24000         exit 0
24001         ;;
24002 cont)
24003         ;;
24004 '')
24005         dflt=''
24006         nostick=true
24007         $cat <<EOM
24008
24009 If you'd like to make any changes to the config.sh file before I begin
24010 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24011
24012 EOM
24013         rp="Press return or use a shell escape to edit config.sh:"
24014         . UU/myread
24015         nostick=''
24016         case "$ans" in
24017         '') ;;
24018         *) : in case they cannot read
24019                 sh 1>&4 -c "$ans";;
24020         esac
24021         ;;
24022 esac
24023
24024 : if this fails, just run all the .SH files by hand
24025 . ./config.sh
24026
24027 echo " "
24028 exec 1>&4
24029 pwd=`pwd`
24030 . ./UU/extract
24031 cd "$pwd"
24032
24033 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24034         dflt=y
24035         case "$silent" in
24036         true) ;;
24037         *)
24038                 $cat <<EOM
24039
24040 Now you need to generate make dependencies by running "$make depend".
24041 You might prefer to run it in background: "$make depend > makedepend.out &"
24042 It can take a while, so you might not want to run it right now.
24043
24044 EOM
24045                 ;;
24046         esac
24047         rp="Run $make depend now?"
24048         . UU/myread
24049         case "$ans" in
24050         y*)
24051                 $make depend && echo "Now you must run '$make'."
24052                 ;;
24053         *)
24054                 echo "You must run '$make depend' then '$make'."
24055                 ;;
24056         esac
24057 elif test -f [Mm]akefile; then
24058         echo " "
24059         echo "Now you must run a $make."
24060 else
24061         echo "Configure done."
24062 fi
24063
24064 if $test -f Policy.sh; then
24065     $cat <<EOM
24066
24067 If you compile $package on a different machine or from a different object
24068 directory, copy the Policy.sh file from this object directory to the
24069 new one before you run Configure -- this will help you with most of
24070 the policy defaults.
24071
24072 EOM
24073 fi
24074 if $test -f config.msg; then
24075     echo "Hmm.  I also noted the following information while running:"
24076     echo " "
24077     $cat config.msg >&4
24078     $rm -f config.msg
24079 fi
24080 $rm -f kit*isdone ark*isdone
24081 $rm -rf UU
24082
24083 : End of Configure
24084