This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for 6567ce2473
[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  1 18:06:40 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 targethost=''
213 targetport=''
214 to=''
215 sysroot=''
216 usecrosscompile=''
217 extern_C=''
218 mistrustnm=''
219 usedevel=''
220 perllibs=''
221 dynamic_ext=''
222 extensions=''
223 known_extensions=''
224 nonxs_ext=''
225 static_ext=''
226 useopcode=''
227 useposix=''
228 extras=''
229 d_bsd=''
230 d_eunice=''
231 d_xenix=''
232 eunicefix=''
233 ar=''
234 awk=''
235 bash=''
236 bison=''
237 byacc=''
238 cat=''
239 chgrp=''
240 chmod=''
241 chown=''
242 comm=''
243 compress=''
244 cp=''
245 cpio=''
246 cpp=''
247 csh=''
248 date=''
249 echo=''
250 egrep=''
251 emacs=''
252 expr=''
253 find=''
254 flex=''
255 gmake=''
256 grep=''
257 gzip=''
258 inews=''
259 ksh=''
260 less=''
261 line=''
262 lint=''
263 ln=''
264 lp=''
265 lpr=''
266 ls=''
267 mail=''
268 mailx=''
269 make=''
270 mkdir=''
271 more=''
272 mv=''
273 nm=''
274 nroff=''
275 perl=''
276 pg=''
277 pmake=''
278 pr=''
279 rm=''
280 rmail=''
281 sed=''
282 sendmail=''
283 shar=''
284 sleep=''
285 smail=''
286 sort=''
287 submit=''
288 tail=''
289 tar=''
290 tbl=''
291 tee=''
292 test=''
293 touch=''
294 tr=''
295 troff=''
296 uname=''
297 uniq=''
298 uuname=''
299 vi=''
300 zcat=''
301 zip=''
302 full_ar=''
303 full_sed=''
304 libswanted=''
305 hint=''
306 myuname=''
307 osname=''
308 osvers=''
309 Author=''
310 Date=''
311 Header=''
312 Id=''
313 Locker=''
314 Log=''
315 RCSfile=''
316 Revision=''
317 Source=''
318 State=''
319 _a=''
320 _exe=''
321 _o=''
322 archobjs=''
323 exe_ext=''
324 firstmakefile=''
325 lib_ext=''
326 obj_ext=''
327 path_sep=''
328 rm_try=''
329 afs=''
330 afsroot=''
331 alignbytes=''
332 ansi2knr=''
333 archlib=''
334 archlibexp=''
335 d_archlib=''
336 installarchlib=''
337 archname=''
338 myarchname=''
339 useversionedarchname=''
340 d_atolf=''
341 d_atoll=''
342 baserev=''
343 bin=''
344 binexp=''
345 initialinstalllocation=''
346 installbin=''
347 userelocatableinc=''
348 byteorder=''
349 cc=''
350 ccflags=''
351 cppflags=''
352 ldflags=''
353 lkflags=''
354 locincpth=''
355 optimize=''
356 cf_email=''
357 cf_by=''
358 cf_time=''
359 charbits=''
360 charsize=''
361 contains=''
362 cpp_stuff=''
363 cpplast=''
364 cppminus=''
365 cpprun=''
366 cppstdin=''
367 d__fwalk=''
368 d_access=''
369 d_accessx=''
370 d_aintl=''
371 d_alarm=''
372 asctime_r_proto=''
373 d_asctime_r=''
374 d_attribute_deprecated=''
375 d_attribute_format=''
376 d_attribute_malloc=''
377 d_attribute_nonnull=''
378 d_attribute_noreturn=''
379 d_attribute_pure=''
380 d_attribute_unused=''
381 d_attribute_warn_unused_result=''
382 d_printf_format_null=''
383 d_bcmp=''
384 d_bcopy=''
385 d_builtin_choose_expr=''
386 d_builtin_expect=''
387 d_bzero=''
388 d_c99_variadic_macros=''
389 d_casti32=''
390 castflags=''
391 d_castneg=''
392 d_chown=''
393 d_chroot=''
394 d_chsize=''
395 d_class=''
396 d_clearenv=''
397 d_closedir=''
398 d_void_closedir=''
399 d_cmsghdr_s=''
400 d_const=''
401 d_copysignl=''
402 d_cplusplus=''
403 cryptlib=''
404 d_crypt=''
405 crypt_r_proto=''
406 d_crypt_r=''
407 d_csh=''
408 full_csh=''
409 d_ctermid=''
410 ctermid_r_proto=''
411 d_ctermid_r=''
412 ctime_r_proto=''
413 d_ctime_r=''
414 d_cuserid=''
415 d_dbl_dig=''
416 d_dbminitproto=''
417 d_difftime=''
418 d_dir_dd_fd=''
419 d_dirfd=''
420 d_dlerror=''
421 d_dlopen=''
422 d_dlsymun=''
423 d_dosuid=''
424 d_suidsafe=''
425 d_drand48_r=''
426 drand48_r_proto=''
427 d_drand48proto=''
428 d_dup2=''
429 d_eaccess=''
430 d_endgrent=''
431 d_endgrent_r=''
432 endgrent_r_proto=''
433 d_endhent=''
434 d_endhostent_r=''
435 endhostent_r_proto=''
436 d_endnent=''
437 d_endnetent_r=''
438 endnetent_r_proto=''
439 d_endpent=''
440 d_endprotoent_r=''
441 endprotoent_r_proto=''
442 d_endpwent=''
443 d_endpwent_r=''
444 endpwent_r_proto=''
445 d_endsent=''
446 d_endservent_r=''
447 endservent_r_proto=''
448 d_faststdio=''
449 d_fchdir=''
450 d_fchmod=''
451 d_fchown=''
452 d_fcntl=''
453 d_fcntl_can_lock=''
454 d_fd_macros=''
455 d_fd_set=''
456 d_fds_bits=''
457 d_fgetpos=''
458 d_finite=''
459 d_finitel=''
460 d_flexfnam=''
461 d_flock=''
462 d_flockproto=''
463 d_fork=''
464 d_fp_class=''
465 d_fpclass=''
466 d_fpclassify=''
467 d_fpclassl=''
468 d_fpos64_t=''
469 d_frexpl=''
470 d_fs_data_s=''
471 d_fseeko=''
472 d_fsetpos=''
473 d_fstatfs=''
474 d_fsync=''
475 d_ftello=''
476 d_ftime=''
477 d_gettimeod=''
478 d_futimes=''
479 d_Gconvert=''
480 d_getaddrinfo=''
481 d_getcwd=''
482 d_getespwnam=''
483 d_getfsstat=''
484 d_getgrent=''
485 d_getgrent_r=''
486 getgrent_r_proto=''
487 d_getgrgid_r=''
488 getgrgid_r_proto=''
489 d_getgrnam_r=''
490 getgrnam_r_proto=''
491 d_getgrps=''
492 d_gethbyaddr=''
493 d_gethbyname=''
494 d_gethent=''
495 aphostname=''
496 d_gethname=''
497 d_phostname=''
498 d_uname=''
499 d_gethostbyaddr_r=''
500 gethostbyaddr_r_proto=''
501 d_gethostbyname_r=''
502 gethostbyname_r_proto=''
503 d_gethostent_r=''
504 gethostent_r_proto=''
505 d_gethostprotos=''
506 d_getitimer=''
507 d_getlogin=''
508 d_getlogin_r=''
509 getlogin_r_proto=''
510 d_getmnt=''
511 d_getmntent=''
512 d_getnameinfo=''
513 d_getnbyaddr=''
514 d_getnbyname=''
515 d_getnent=''
516 d_getnetbyaddr_r=''
517 getnetbyaddr_r_proto=''
518 d_getnetbyname_r=''
519 getnetbyname_r_proto=''
520 d_getnetent_r=''
521 getnetent_r_proto=''
522 d_getnetprotos=''
523 d_getpagsz=''
524 d_getpent=''
525 d_getpgid=''
526 d_getpgrp2=''
527 d_bsdgetpgrp=''
528 d_getpgrp=''
529 d_getppid=''
530 d_getprior=''
531 d_getpbyname=''
532 d_getpbynumber=''
533 d_getprotobyname_r=''
534 getprotobyname_r_proto=''
535 d_getprotobynumber_r=''
536 getprotobynumber_r_proto=''
537 d_getprotoent_r=''
538 getprotoent_r_proto=''
539 d_getprotoprotos=''
540 d_getprpwnam=''
541 d_getpwent=''
542 d_getpwent_r=''
543 getpwent_r_proto=''
544 d_getpwnam_r=''
545 getpwnam_r_proto=''
546 d_getpwuid_r=''
547 getpwuid_r_proto=''
548 d_getsent=''
549 d_getservbyname_r=''
550 getservbyname_r_proto=''
551 d_getservbyport_r=''
552 getservbyport_r_proto=''
553 d_getservent_r=''
554 getservent_r_proto=''
555 d_getservprotos=''
556 d_getspnam=''
557 d_getspnam_r=''
558 getspnam_r_proto=''
559 d_getsbyname=''
560 d_getsbyport=''
561 d_gmtime_r=''
562 gmtime_r_proto=''
563 d_gnulibc=''
564 gnulibc_version=''
565 d_hasmntopt=''
566 d_htonl=''
567 d_ilogbl=''
568 d_inetaton=''
569 d_inetntop=''
570 d_inetpton=''
571 d_int64_t=''
572 d_isascii=''
573 d_isblank=''
574 d_isfinite=''
575 d_isinf=''
576 d_isnan=''
577 d_isnanl=''
578 d_killpg=''
579 d_lchown=''
580 d_ldbl_dig=''
581 d_libm_lib_version=''
582 d_libname_unique=''
583 d_link=''
584 d_localtime_r=''
585 d_localtime_r_needs_tzset=''
586 localtime_r_proto=''
587 d_locconv=''
588 d_lockf=''
589 d_longdbl=''
590 longdblsize=''
591 d_longlong=''
592 longlongsize=''
593 d_lseekproto=''
594 d_lstat=''
595 d_madvise=''
596 d_malloc_good_size=''
597 d_malloc_size=''
598 d_mblen=''
599 d_mbstowcs=''
600 d_mbtowc=''
601 d_memchr=''
602 d_memcmp=''
603 d_memcpy=''
604 d_memmove=''
605 d_memset=''
606 d_mkdir=''
607 d_mkdtemp=''
608 d_mkfifo=''
609 d_mkstemp=''
610 d_mkstemps=''
611 d_mktime=''
612 d_mmap=''
613 mmaptype=''
614 d_modfl=''
615 d_modfl_pow32_bug=''
616 d_modflproto=''
617 d_mprotect=''
618 d_msg=''
619 d_msgctl=''
620 d_msgget=''
621 d_msghdr_s=''
622 d_msgrcv=''
623 d_msgsnd=''
624 d_msync=''
625 d_munmap=''
626 d_nice=''
627 d_nl_langinfo=''
628 d_off64_t=''
629 d_open3=''
630 d_fpathconf=''
631 d_pathconf=''
632 d_pause=''
633 d_pipe=''
634 d_poll=''
635 d_portable=''
636 d_prctl=''
637 d_prctl_set_name=''
638 d_procselfexe=''
639 procselfexe=''
640 d_old_pthread_create_joinable=''
641 old_pthread_create_joinable=''
642 d_pthread_atfork=''
643 d_pthread_attr_setscope=''
644 d_pthread_yield=''
645 d_sched_yield=''
646 sched_yield=''
647 d_qgcvt=''
648 d_random_r=''
649 random_r_proto=''
650 d_readdir64_r=''
651 readdir64_r_proto=''
652 d_readdir=''
653 d_rewinddir=''
654 d_seekdir=''
655 d_telldir=''
656 d_readdir_r=''
657 readdir_r_proto=''
658 d_readlink=''
659 d_readv=''
660 d_recvmsg=''
661 d_rename=''
662 d_rmdir=''
663 d_safebcpy=''
664 d_safemcpy=''
665 d_sanemcmp=''
666 d_sbrkproto=''
667 d_scalbnl=''
668 d_select=''
669 d_sem=''
670 d_semctl=''
671 d_semget=''
672 d_semop=''
673 d_sendmsg=''
674 d_setegid=''
675 d_seteuid=''
676 d_setgrent=''
677 d_setgrent_r=''
678 setgrent_r_proto=''
679 d_setgrps=''
680 d_sethent=''
681 d_sethostent_r=''
682 sethostent_r_proto=''
683 d_setitimer=''
684 d_setlinebuf=''
685 d_setlocale=''
686 d_setlocale_r=''
687 setlocale_r_proto=''
688 d_setnent=''
689 d_setnetent_r=''
690 setnetent_r_proto=''
691 d_setpent=''
692 d_setpgid=''
693 d_setpgrp2=''
694 d_bsdsetpgrp=''
695 d_setpgrp=''
696 d_setprior=''
697 d_setproctitle=''
698 d_setprotoent_r=''
699 setprotoent_r_proto=''
700 d_setpwent=''
701 d_setpwent_r=''
702 setpwent_r_proto=''
703 d_setregid=''
704 d_setresgid=''
705 d_setresuid=''
706 d_setreuid=''
707 d_setrgid=''
708 d_setruid=''
709 d_setsent=''
710 d_setservent_r=''
711 setservent_r_proto=''
712 d_setsid=''
713 d_setvbuf=''
714 d_shm=''
715 d_shmat=''
716 d_shmatprototype=''
717 shmattype=''
718 d_shmctl=''
719 d_shmdt=''
720 d_shmget=''
721 d_sigaction=''
722 d_signbit=''
723 d_sigprocmask=''
724 d_sigsetjmp=''
725 usesitecustomize=''
726 d_snprintf=''
727 d_vsnprintf=''
728 d_sockatmark=''
729 d_sockatmarkproto=''
730 d_ip_mreq=''
731 d_ip_mreq_source=''
732 d_ipv6_mreq=''
733 d_ipv6_mreq_source=''
734 d_msg_ctrunc=''
735 d_msg_dontroute=''
736 d_msg_oob=''
737 d_msg_peek=''
738 d_msg_proxy=''
739 d_oldsock=''
740 d_scm_rights=''
741 d_sin6_scope_id=''
742 d_sockaddr_in6=''
743 d_sockaddr_sa_len=''
744 d_socket=''
745 d_sockpair=''
746 sockethdr=''
747 socketlib=''
748 d_socklen_t=''
749 d_socks5_init=''
750 d_sprintf_returns_strlen=''
751 d_sqrtl=''
752 d_srand48_r=''
753 srand48_r_proto=''
754 d_srandom_r=''
755 srandom_r_proto=''
756 d_sresgproto=''
757 d_sresuproto=''
758 d_statblks=''
759 d_statfs_f_flags=''
760 d_statfs_s=''
761 d_static_inline=''
762 perl_static_inline=''
763 d_fstatvfs=''
764 d_statvfs=''
765 d_stdio_cnt_lval=''
766 d_stdio_ptr_lval=''
767 d_stdio_ptr_lval_nochange_cnt=''
768 d_stdio_ptr_lval_sets_cnt=''
769 d_stdiobase=''
770 d_stdstdio=''
771 stdio_base=''
772 stdio_bufsiz=''
773 stdio_cnt=''
774 stdio_filbuf=''
775 stdio_ptr=''
776 d_index=''
777 d_strchr=''
778 d_strcoll=''
779 d_strctcpy=''
780 d_strerrm=''
781 d_strerror=''
782 d_sysernlst=''
783 d_syserrlst=''
784 d_strerror_r=''
785 strerror_r_proto=''
786 d_strftime=''
787 d_strlcat=''
788 d_strlcpy=''
789 d_strtod=''
790 d_strtol=''
791 d_strtold=''
792 d_strtoll=''
793 d_strtoq=''
794 d_strtoul=''
795 d_strtoull=''
796 d_strtouq=''
797 d_strxfrm=''
798 d_symlink=''
799 d_syscall=''
800 d_syscallproto=''
801 d_sysconf=''
802 d_system=''
803 d_tcgetpgrp=''
804 d_tcsetpgrp=''
805 d_telldirproto=''
806 d_time=''
807 timetype=''
808 d_asctime64=''
809 d_ctime64=''
810 d_difftime64=''
811 d_gmtime64=''
812 d_localtime64=''
813 d_mktime64=''
814 d_timegm=''
815 clocktype=''
816 d_times=''
817 d_tmpnam_r=''
818 tmpnam_r_proto=''
819 d_truncate=''
820 d_ttyname_r=''
821 ttyname_r_proto=''
822 d_tzname=''
823 d_u32align=''
824 d_ualarm=''
825 d_umask=''
826 d_semctl_semid_ds=''
827 d_semctl_semun=''
828 d_union_semun=''
829 d_unordered=''
830 d_unsetenv=''
831 d_usleep=''
832 d_usleepproto=''
833 d_ustat=''
834 d_pseudofork=''
835 d_vfork=''
836 usevfork=''
837 d_voidsig=''
838 signal_t=''
839 d_volatile=''
840 d_charvspr=''
841 d_vprintf=''
842 d_wait4=''
843 d_waitpid=''
844 d_wcstombs=''
845 d_wctomb=''
846 d_writev=''
847 dlext=''
848 bin_ELF=''
849 cccdlflags=''
850 ccdlflags=''
851 dlsrc=''
852 ld=''
853 ld_can_script=''
854 lddlflags=''
855 usedl=''
856 doublesize=''
857 bootstrap_charset=''
858 ebcdic=''
859 fflushNULL=''
860 fflushall=''
861 fpossize=''
862 fpostype=''
863 gccansipedantic=''
864 gccosandvers=''
865 gccversion=''
866 gidformat=''
867 gidsign=''
868 gidsize=''
869 gidtype=''
870 groupstype=''
871 h_fcntl=''
872 h_sysfile=''
873 html1dir=''
874 html1direxp=''
875 installhtml1dir=''
876 html3dir=''
877 html3direxp=''
878 installhtml3dir=''
879 i_arpainet=''
880 i_assert=''
881 i_crypt=''
882 db_hashtype=''
883 db_prefixtype=''
884 db_version_major=''
885 db_version_minor=''
886 db_version_patch=''
887 i_db=''
888 i_dbm=''
889 i_rpcsvcdbm=''
890 d_dirnamlen=''
891 direntrytype=''
892 i_dirent=''
893 i_dlfcn=''
894 i_fcntl=''
895 i_float=''
896 i_fp=''
897 i_fp_class=''
898 i_gdbm=''
899 d_grpasswd=''
900 i_grp=''
901 i_ieeefp=''
902 i_inttypes=''
903 i_langinfo=''
904 i_libutil=''
905 i_limits=''
906 i_locale=''
907 i_machcthr=''
908 i_malloc=''
909 i_mallocmalloc=''
910 i_math=''
911 i_memory=''
912 i_mntent=''
913 d_gdbm_ndbm_h_uses_prototypes=''
914 d_gdbmndbm_h_uses_prototypes=''
915 d_ndbm=''
916 d_ndbm_h_uses_prototypes=''
917 i_gdbm_ndbm=''
918 i_gdbmndbm=''
919 i_ndbm=''
920 i_netdb=''
921 i_neterrno=''
922 i_netinettcp=''
923 i_niin=''
924 i_sysin=''
925 i_poll=''
926 i_prot=''
927 i_pthread=''
928 d_pwage=''
929 d_pwchange=''
930 d_pwclass=''
931 d_pwcomment=''
932 d_pwexpire=''
933 d_pwgecos=''
934 d_pwpasswd=''
935 d_pwquota=''
936 i_pwd=''
937 i_shadow=''
938 i_socks=''
939 i_stdbool=''
940 i_stddef=''
941 i_stdlib=''
942 i_string=''
943 strings=''
944 i_sunmath=''
945 i_sysaccess=''
946 i_sysdir=''
947 i_sysfile=''
948 d_voidtty=''
949 i_bsdioctl=''
950 i_sysfilio=''
951 i_sysioctl=''
952 i_syssockio=''
953 i_syslog=''
954 i_sysmman=''
955 i_sysmode=''
956 i_sysmount=''
957 i_sysndir=''
958 i_sysparam=''
959 i_syspoll=''
960 i_sysresrc=''
961 i_syssecrt=''
962 i_sysselct=''
963 i_sysstat=''
964 i_sysstatfs=''
965 i_sysstatvfs=''
966 i_systimes=''
967 i_systypes=''
968 i_sysuio=''
969 i_sysun=''
970 i_sysutsname=''
971 i_sysvfs=''
972 i_syswait=''
973 i_sgtty=''
974 i_termio=''
975 i_termios=''
976 d_tm_tm_gmtoff=''
977 d_tm_tm_zone=''
978 i_systime=''
979 i_systimek=''
980 i_time=''
981 timeincl=''
982 i_unistd=''
983 i_ustat=''
984 i_utime=''
985 i_values=''
986 i_stdarg=''
987 i_varargs=''
988 i_varhdr=''
989 i_vfork=''
990 d_inc_version_list=''
991 inc_version_list=''
992 inc_version_list_init=''
993 installprefix=''
994 installprefixexp=''
995 installstyle=''
996 installusrbinperl=''
997 intsize=''
998 longsize=''
999 shortsize=''
1000 issymlink=''
1001 libc=''
1002 ldlibpthname=''
1003 libperl=''
1004 shrpenv=''
1005 useshrplib=''
1006 glibpth=''
1007 libpth=''
1008 loclibpth=''
1009 plibpth=''
1010 xlibpth=''
1011 ignore_versioned_solibs=''
1012 libs=''
1013 libsdirs=''
1014 libsfiles=''
1015 libsfound=''
1016 libspath=''
1017 lns=''
1018 d_PRIEUldbl=''
1019 d_PRIFUldbl=''
1020 d_PRIGUldbl=''
1021 d_PRIeldbl=''
1022 d_PRIfldbl=''
1023 d_PRIgldbl=''
1024 d_SCNfldbl=''
1025 sPRIEUldbl=''
1026 sPRIFUldbl=''
1027 sPRIGUldbl=''
1028 sPRIeldbl=''
1029 sPRIfldbl=''
1030 sPRIgldbl=''
1031 sSCNfldbl=''
1032 lseeksize=''
1033 lseektype=''
1034 mad=''
1035 madlyh=''
1036 madlyobj=''
1037 madlysrc=''
1038 make_set_make=''
1039 d_mymalloc=''
1040 freetype=''
1041 mallocobj=''
1042 mallocsrc=''
1043 malloctype=''
1044 usemallocwrap=''
1045 usemymalloc=''
1046 installman1dir=''
1047 man1dir=''
1048 man1direxp=''
1049 man1ext=''
1050 installman3dir=''
1051 man3dir=''
1052 man3direxp=''
1053 man3ext=''
1054 modetype=''
1055 multiarch=''
1056 mydomain=''
1057 myhostname=''
1058 phostname=''
1059 c=''
1060 n=''
1061 d_eofnblk=''
1062 eagain=''
1063 o_nonblock=''
1064 rd_nodata=''
1065 need_va_copy=''
1066 netdb_hlen_type=''
1067 netdb_host_type=''
1068 netdb_name_type=''
1069 netdb_net_type=''
1070 groupcat=''
1071 hostcat=''
1072 passcat=''
1073 orderlib=''
1074 ranlib=''
1075 d_perl_otherlibdirs=''
1076 otherlibdirs=''
1077 package=''
1078 spackage=''
1079 pager=''
1080 api_revision=''
1081 api_subversion=''
1082 api_version=''
1083 api_versionstring=''
1084 patchlevel=''
1085 perl_patchlevel=''
1086 revision=''
1087 subversion=''
1088 version=''
1089 version_patchlevel_string=''
1090 perl5=''
1091 perladmin=''
1092 perlpath=''
1093 d_nv_preserves_uv=''
1094 d_nv_zero_is_allbits_zero=''
1095 i16size=''
1096 i16type=''
1097 i32size=''
1098 i32type=''
1099 i64size=''
1100 i64type=''
1101 i8size=''
1102 i8type=''
1103 ivsize=''
1104 ivtype=''
1105 nv_overflows_integers_at=''
1106 nv_preserves_uv_bits=''
1107 nvsize=''
1108 nvtype=''
1109 u16size=''
1110 u16type=''
1111 u32size=''
1112 u32type=''
1113 u64size=''
1114 u64type=''
1115 u8size=''
1116 u8type=''
1117 uvsize=''
1118 uvtype=''
1119 ivdformat=''
1120 nvEUformat=''
1121 nvFUformat=''
1122 nvGUformat=''
1123 nveformat=''
1124 nvfformat=''
1125 nvgformat=''
1126 uvXUformat=''
1127 uvoformat=''
1128 uvuformat=''
1129 uvxformat=''
1130 pidtype=''
1131 prefix=''
1132 prefixexp=''
1133 installprivlib=''
1134 privlib=''
1135 privlibexp=''
1136 prototype=''
1137 ptrsize=''
1138 d_PRIXU64=''
1139 d_PRId64=''
1140 d_PRIi64=''
1141 d_PRIo64=''
1142 d_PRIu64=''
1143 d_PRIx64=''
1144 sPRIXU64=''
1145 sPRId64=''
1146 sPRIi64=''
1147 sPRIo64=''
1148 sPRIu64=''
1149 sPRIx64=''
1150 d_quad=''
1151 quadkind=''
1152 quadtype=''
1153 uquadtype=''
1154 drand01=''
1155 randbits=''
1156 randfunc=''
1157 randseedtype=''
1158 seedfunc=''
1159 installscript=''
1160 scriptdir=''
1161 scriptdirexp=''
1162 selectminbits=''
1163 selecttype=''
1164 sh=''
1165 sig_count=''
1166 sig_name=''
1167 sig_name_init=''
1168 sig_num=''
1169 sig_num_init=''
1170 sig_size=''
1171 d_sitearch=''
1172 installsitearch=''
1173 sitearch=''
1174 sitearchexp=''
1175 installsitebin=''
1176 sitebin=''
1177 sitebinexp=''
1178 installsitehtml1dir=''
1179 sitehtml1dir=''
1180 sitehtml1direxp=''
1181 installsitehtml3dir=''
1182 sitehtml3dir=''
1183 sitehtml3direxp=''
1184 installsitelib=''
1185 sitelib=''
1186 sitelib_stem=''
1187 sitelibexp=''
1188 installsiteman1dir=''
1189 siteman1dir=''
1190 siteman1direxp=''
1191 installsiteman3dir=''
1192 siteman3dir=''
1193 siteman3direxp=''
1194 siteprefix=''
1195 siteprefixexp=''
1196 installsitescript=''
1197 sitescript=''
1198 sitescriptexp=''
1199 sizesize=''
1200 sizetype=''
1201 so=''
1202 socksizetype=''
1203 sharpbang=''
1204 shsharp=''
1205 spitshell=''
1206 src=''
1207 ssizetype=''
1208 st_ino_sign=''
1209 st_ino_size=''
1210 startperl=''
1211 startsh=''
1212 stdchar=''
1213 d_stdio_stream_array=''
1214 stdio_stream_array=''
1215 sysman=''
1216 sGMTIME_max=''
1217 sGMTIME_min=''
1218 sLOCALTIME_max=''
1219 sLOCALTIME_min=''
1220 trnl=''
1221 uidformat=''
1222 uidsign=''
1223 uidsize=''
1224 uidtype=''
1225 archname64=''
1226 use64bitall=''
1227 use64bitint=''
1228 dtrace=''
1229 usedtrace=''
1230 usefaststdio=''
1231 usekernprocpathname=''
1232 ccflags_uselargefiles=''
1233 ldflags_uselargefiles=''
1234 libswanted_uselargefiles=''
1235 uselargefiles=''
1236 uselongdouble=''
1237 usemorebits=''
1238 usemultiplicity=''
1239 nm_opt=''
1240 nm_so_opt=''
1241 runnm=''
1242 usenm=''
1243 usensgetexecutablepath=''
1244 useperlio=''
1245 usesocks=''
1246 d_oldpthreads=''
1247 use5005threads=''
1248 useithreads=''
1249 usereentrant=''
1250 usethreads=''
1251 incpath=''
1252 mips_type=''
1253 usrinc=''
1254 vaproto=''
1255 d_vendorarch=''
1256 installvendorarch=''
1257 vendorarch=''
1258 vendorarchexp=''
1259 d_vendorbin=''
1260 installvendorbin=''
1261 vendorbin=''
1262 vendorbinexp=''
1263 installvendorhtml1dir=''
1264 vendorhtml1dir=''
1265 vendorhtml1direxp=''
1266 installvendorhtml3dir=''
1267 vendorhtml3dir=''
1268 vendorhtml3direxp=''
1269 d_vendorlib=''
1270 installvendorlib=''
1271 vendorlib=''
1272 vendorlib_stem=''
1273 vendorlibexp=''
1274 installvendorman1dir=''
1275 vendorman1dir=''
1276 vendorman1direxp=''
1277 installvendorman3dir=''
1278 vendorman3dir=''
1279 vendorman3direxp=''
1280 usevendorprefix=''
1281 vendorprefix=''
1282 vendorprefixexp=''
1283 d_vendorscript=''
1284 installvendorscript=''
1285 vendorscript=''
1286 vendorscriptexp=''
1287 versiononly=''
1288 yacc=''
1289 yaccflags=''
1290 CONFIG=''
1291
1292 : Detect odd OSs
1293 define='define'
1294 undef='undef'
1295 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1296 rmlist=''
1297
1298 : We must find out about Eunice early
1299 eunicefix=':'
1300 if test -f /etc/unixtovms; then
1301         eunicefix=/etc/unixtovms
1302 fi
1303 if test -f /etc/unixtovms.exe; then
1304         eunicefix=/etc/unixtovms.exe
1305 fi
1306
1307 : Set executable suffix now -- needed before hints available
1308 if test -f "/libs/version.library"; then
1309 : Amiga OS
1310     _exe=""
1311 elif test -f "/system/gnu_library/bin/ar.pm"; then
1312 : Stratus VOS
1313     _exe=".pm"
1314 elif test -n "$DJGPP"; then
1315 : DOS DJGPP
1316     _exe=".exe"
1317 elif test -f /kern/cookiejar; then
1318 : MiNT
1319     _exe=""
1320 elif test -d c:/. -o -n "$is_os2" ; then
1321 : OS/2 or cygwin
1322     _exe=".exe"
1323 fi
1324
1325 groupstype=''
1326 i_whoami=''
1327 : Trailing extension.  Override this in a hint file, if needed.
1328 : Extra object files, if any, needed on this platform.
1329 archobjs=''
1330 archname=''
1331 : Possible local include directories to search.
1332 : Set locincpth to "" in a hint file to defeat local include searches.
1333 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1334 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1335 :
1336 : no include file wanted by default
1337 inclwanted=''
1338
1339 : Enable -DEBUGGING and -DDEBUGGING from the command line
1340 EBUGGING=''
1341 DEBUGGING=''
1342
1343 libnames=''
1344 : change the next line if compiling for Xenix/286 on Xenix/386
1345 xlibpth='/usr/lib/386 /lib/386'
1346 : Possible local library directories to search.
1347 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1348 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1349
1350 : general looking path for locating libraries
1351 glibpth="/lib /usr/lib $xlibpth"
1352 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1353 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1354 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1355 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1356
1357 : Private path used by Configure to find libraries.  Its value
1358 : is prepended to libpth. This variable takes care of special
1359 : machines, like the mips.  Usually, it should be empty.
1360 plibpth=''
1361
1362 : default library list
1363 libswanted=''
1364 : some systems want to use only the non-versioned libso:s
1365 ignore_versioned_solibs=''
1366 : set usethreads on the Configure command line to enable threads.
1367 usereentrant='undef'
1368 ccname=''
1369 ccversion=''
1370 perllibs=''
1371 : set useposix=false in your hint file to disable the POSIX extension.
1372 useposix=true
1373 : set useopcode=false in your hint file to disable the Opcode extension.
1374 useopcode=true
1375 archname64=''
1376 ccflags_uselargefiles=''
1377 ldflags_uselargefiles=''
1378 libswanted_uselargefiles=''
1379 : set usemultiplicity on the Configure command line to enable multiplicity.
1380 : set usesocks on the Configure command line to enable socks.
1381 : List of libraries we want.
1382 : If anyone needs extra -lxxx, put those in a hint file.
1383 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1384 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1385 : We probably want to search /usr/shlib before most other libraries.
1386 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1387 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1388 glibpth="/usr/shlib $glibpth"
1389 : Do not use vfork unless overridden by a hint file.
1390 usevfork=false
1391
1392 : Find the basic shell for Bourne shell scripts
1393 case "$sh" in
1394 '')
1395         case "$SYSTYPE" in
1396         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1397         *) xxx='/bin/sh';;
1398         esac
1399         if test -f "$xxx"; then
1400                 sh="$xxx"
1401         else
1402                 : Build up a list and do a single loop so we can 'break' out.
1403                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1404                 for xxx in sh bash ksh pdksh ash; do
1405                         for p in $pth; do
1406                                 try="$try ${p}/${xxx}"
1407                         done
1408                 done
1409                 for xxx in $try; do
1410                         if test -f "$xxx"; then
1411                                 sh="$xxx";
1412                                 break
1413                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1414                                 sh="$xxx";
1415                                 break
1416                         elif test -f "$xxx.exe"; then
1417                                 sh="$xxx";
1418                                 break
1419                         fi
1420                 done
1421         fi
1422         ;;
1423 esac
1424
1425 case "$sh" in
1426 '')     cat >&2 <<EOM
1427 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1428
1429 Usually it's in /bin/sh.  How did you even get this far?
1430 Please contact me (Perl Maintainers) at perlbug@perl.org and
1431 we'll try to straighten this all out.
1432 EOM
1433         exit 1
1434         ;;
1435 esac
1436
1437 : see if sh knows # comments
1438 if `$sh -c '#' >/dev/null 2>&1`; then
1439         shsharp=true
1440         spitshell=cat
1441         xcat=/bin/cat
1442         test -f $xcat$_exe || xcat=/usr/bin/cat
1443         if test ! -f $xcat$_exe; then
1444                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1445                         if test -f $p/cat$_exe; then
1446                                 xcat=$p/cat
1447                                 break
1448                         fi
1449                 done
1450                 if test ! -f $xcat$_exe; then
1451                         echo "Can't find cat anywhere!"
1452                         exit 1
1453                 fi
1454         fi
1455         echo "#!$xcat" >sharp
1456         $eunicefix sharp
1457         chmod +x sharp
1458         ./sharp > today 2>/dev/null
1459         if test -s today; then
1460                 sharpbang='#!'
1461         else
1462                 echo "#! $xcat" > sharp
1463                 $eunicefix sharp
1464                 chmod +x sharp
1465                 ./sharp > today 2>/dev/null
1466                 if test -s today; then
1467                         sharpbang='#! '
1468                 else
1469                         sharpbang=': use '
1470                 fi
1471         fi
1472 else
1473         echo " "
1474         echo "Your $sh doesn't grok # comments--I will strip them later on."
1475         shsharp=false
1476         cd ..
1477         echo "exec grep -v '^[  ]*#'" >spitshell
1478         chmod +x spitshell
1479         $eunicefix spitshell
1480         spitshell=`pwd`/spitshell
1481         cd UU
1482         echo "I presume that if # doesn't work, #! won't work either!"
1483         sharpbang=': use '
1484 fi
1485 rm -f sharp today
1486
1487 : figure out how to guarantee sh startup
1488 case "$startsh" in
1489 '') startsh=${sharpbang}${sh} ;;
1490 *)
1491 esac
1492 cat >sharp <<EOSS
1493 $startsh
1494 set abc
1495 test "$?abc" != 1
1496 EOSS
1497
1498 chmod +x sharp
1499 $eunicefix sharp
1500 if ./sharp; then
1501         : echo "Yup, it does."
1502 else
1503         echo "Hmm... '$startsh' does not guarantee sh startup..."
1504         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1505 fi
1506 rm -f sharp
1507
1508 : Save command line options in file UU/cmdline.opt for later use in
1509 : generating config.sh.
1510 cat > cmdline.opt <<EOSH
1511 : Configure command line arguments.
1512 config_arg0='$0'
1513 config_args='$*'
1514 config_argc=$#
1515 EOSH
1516 argn=1
1517 args_exp=''
1518 args_sep=''
1519 for arg in "$@"; do
1520         cat >>cmdline.opt <<EOSH
1521 config_arg$argn='$arg'
1522 EOSH
1523         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1524 $arg
1525 EOC
1526         arg_exp=`cat cmdl.opt`
1527         args_exp="$args_exp$args_sep'$arg_exp'"
1528         argn=`expr $argn + 1`
1529         args_sep=' '
1530 done
1531 rm -f cmdl.opt
1532
1533 : produce awk script to parse command line options
1534 cat >options.awk <<'EOF'
1535 BEGIN {
1536         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1537
1538         len = length(optstr);
1539         for (i = 1; i <= len; i++) {
1540                 c = substr(optstr, i, 1);
1541                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1542                 if (a == ":") {
1543                         arg[c] = 1;
1544                         i++;
1545                 }
1546                 opt[c] = 1;
1547         }
1548 }
1549 {
1550         expect = 0;
1551         str = $0;
1552         if (substr(str, 1, 1) != "-") {
1553                 printf("'%s'\n", str);
1554                 next;
1555         }
1556         len = length($0);
1557         for (i = 2; i <= len; i++) {
1558                 c = substr(str, i, 1);
1559                 if (!opt[c]) {
1560                         printf("-%s\n", substr(str, i));
1561                         next;
1562                 }
1563                 printf("-%s\n", c);
1564                 if (arg[c]) {
1565                         if (i < len)
1566                                 printf("'%s'\n", substr(str, i + 1));
1567                         else
1568                                 expect = 1;
1569                         next;
1570                 }
1571         }
1572 }
1573 END {
1574         if (expect)
1575                 print "?";
1576 }
1577 EOF
1578
1579 : process the command line options
1580 set X `for arg in "$@"; do echo "X$arg"; done |
1581         sed -e s/X// | awk -f options.awk`
1582 eval "set $*"
1583 shift
1584 rm -f options.awk
1585
1586 : set up default values
1587 fastread=''
1588 reuseval=false
1589 config_sh=''
1590 alldone=''
1591 error=''
1592 silent=''
1593 extractsh=''
1594 override=''
1595 knowitall=''
1596 rm -f optdef.sh posthint.sh
1597 cat >optdef.sh <<EOS
1598 $startsh
1599 EOS
1600
1601
1602 : option parsing
1603 while test $# -gt 0; do
1604         case "$1" in
1605         -d) shift; fastread=yes;;
1606         -e) shift; alldone=cont;;
1607         -f)
1608                 shift
1609                 cd ..
1610                 if test -r "$1"; then
1611                         config_sh="$1"
1612                 else
1613                         echo "$me: cannot read config file $1." >&2
1614                         error=true
1615                 fi
1616                 cd UU
1617                 shift;;
1618         --help|\
1619         -h) shift; error=true;;
1620         -r) shift; reuseval=true;;
1621         -s) shift; silent=true; realsilent=true;;
1622         -E) shift; alldone=exit;;
1623         -K) shift; knowitall=true;;
1624         -O) shift; override=true;;
1625         -S) shift; silent=true; extractsh=true;;
1626         -D)
1627                 shift
1628                 case "$1" in
1629                 *=)
1630                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1631                         echo "$me: ignoring -D $1" >&2
1632                         ;;
1633                 *=*) echo "$1" | \
1634                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1635                 *) echo "$1='define'" >> optdef.sh;;
1636                 esac
1637                 shift
1638                 ;;
1639         -U)
1640                 shift
1641                 case "$1" in
1642                 *=) echo "$1" >> optdef.sh;;
1643                 *=*)
1644                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1645                         echo "$me: ignoring -U $1" >&2
1646                         ;;
1647                 *) echo "$1='undef'" >> optdef.sh;;
1648                 esac
1649                 shift
1650                 ;;
1651         -A)
1652             shift
1653             xxx=''
1654             yyy="$1"
1655             zzz=''
1656             uuu=undef
1657             case "$yyy" in
1658             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1659                  case "$zzz" in
1660                  *:*) zzz='' ;;
1661                  *)   xxx=append
1662                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1663                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1664                  esac
1665                  ;;
1666             esac
1667             case "$xxx" in
1668             '')  case "$yyy" in
1669                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1670                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1671                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1672                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1673                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1674                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1675                  esac
1676                  ;;
1677             esac
1678             case "$xxx" in
1679             append)
1680                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1681             clear)
1682                 echo "$yyy=''"                  >> posthint.sh ;;
1683             define)
1684                 case "$zzz" in
1685                 '') zzz=define ;;
1686                 esac
1687                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1688             eval)
1689                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1690             prepend)
1691                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1692             undef)
1693                 case "$zzz" in
1694                 '') zzz="$uuu" ;;
1695                 esac
1696                 echo "$yyy=$zzz"                >> posthint.sh ;;
1697             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1698             esac
1699             shift
1700             ;;
1701         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1702             exit 0;;
1703         --) break;;
1704         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1705         *) break;;
1706         esac
1707 done
1708
1709 case "$error" in
1710 true)
1711         cat >&2 <<EOM
1712 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1713                  [-U symbol] [-U symbol=] [-A command:symbol...]
1714   -d : use defaults for all answers.
1715   -e : go on without questioning past the production of config.sh.
1716   -f : specify an alternate default configuration file.
1717   -h : print this help message and exit (with an error status).
1718   -r : reuse C symbols value if possible (skips costly nm extraction).
1719   -s : silent mode, only echoes questions and essential information.
1720   -D : define symbol to have some value:
1721          -D symbol         symbol gets the value 'define'
1722          -D symbol=value   symbol gets the value 'value'
1723        common used examples (see INSTALL for more info):
1724          -Duse64bitint            use 64bit integers
1725          -Duse64bitall            use 64bit integers and pointers
1726          -Dusethreads             use thread support
1727          -Dinc_version_list=none  do not include older perl trees in @INC
1728          -DEBUGGING=none          DEBUGGING options
1729          -Dcc=gcc                 choose your compiler
1730          -Dprefix=/opt/perl5      choose your destination
1731   -E : stop at the end of questions, after having produced config.sh.
1732   -K : do not use unless you know what you are doing.
1733   -O : let -D and -U override definitions from loaded configuration file.
1734   -S : perform variable substitutions on all .SH files (can mix with -f)
1735   -U : undefine symbol:
1736          -U symbol    symbol gets the value 'undef'
1737          -U symbol=   symbol gets completely empty
1738        e.g.:  -Uversiononly
1739   -A : manipulate symbol after the platform specific hints have been applied:
1740          -A append:symbol=value   append value to symbol
1741          -A symbol=value          like append:, but with a separating space
1742          -A define:symbol=value   define symbol to have value
1743          -A clear:symbol          define symbol to be ''
1744          -A define:symbol         define symbol to be 'define'
1745          -A eval:symbol=value     define symbol to be eval of value
1746          -A prepend:symbol=value  prepend value to symbol
1747          -A undef:symbol          define symbol to be 'undef'
1748          -A undef:symbol=         define symbol to be ''
1749        e.g.:  -A prepend:libswanted='cl pthread '
1750               -A ccflags=-DSOME_MACRO
1751   -V : print version number and exit (with a zero status).
1752 EOM
1753         exit 1
1754         ;;
1755 esac
1756
1757 : Sanity checks
1758 case "$fastread$alldone" in
1759 yescont|yesexit) ;;
1760 *)
1761         case "$extractsh" in
1762         true) ;;
1763         *)
1764                 if test ! -t 0; then
1765                         echo "Say 'sh Configure', not 'sh <Configure'"
1766                         exit 1
1767                 fi
1768                 ;;
1769         esac
1770         ;;
1771 esac
1772
1773 exec 4>&1
1774 case "$silent" in
1775 true) exec 1>/dev/null;;
1776 esac
1777
1778 : run the defines and the undefines, if any, but leave the file out there...
1779 touch optdef.sh
1780 . ./optdef.sh
1781 : create the posthint manipulation script and leave the file out there...
1782 touch posthint.sh
1783
1784 : set package name
1785 package='perl5'
1786 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1787 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1788 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1789 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1790 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1791 esac
1792
1793 : Some greps do not return status, grrr.
1794 echo "grimblepritz" >grimble
1795 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1796         contains=contains
1797 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1798         contains=grep
1799 else
1800         contains=contains
1801 fi
1802 rm -f grimble
1803 : the following should work in any shell
1804 case "$contains" in
1805 contains*)
1806         echo " "
1807         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1808         cat >contains <<'EOSS'
1809 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1810 EOSS
1811 chmod +x contains
1812 esac
1813
1814 : Find the path to the source tree
1815 case "$src" in
1816 '') case "$0" in
1817     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1818          case "$src" in
1819          /*)    ;;
1820          .)     ;;
1821          *)     src=`cd ../$src && pwd` ;;
1822          esac
1823          ;;
1824     *)   src='.';;
1825     esac;;
1826 esac
1827 case "$src" in
1828 '')     src=/
1829         rsrc=/
1830         ;;
1831 /*)     rsrc="$src";;
1832 *)      rsrc="../$src";;
1833 esac
1834 if test -f $rsrc/Configure && \
1835         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1836 then
1837    : found it, so we are ok.
1838 else
1839         rsrc=''
1840         for src in . .. ../.. ../../.. ../../../..; do
1841                 if test -f ../$src/Configure && \
1842                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1843                 then
1844                         rsrc=../$src
1845                         break
1846                 fi
1847         done
1848 fi
1849 case "$rsrc" in
1850 '')
1851         cat <<EOM >&4
1852
1853 Sorry, I can't seem to locate the source dir for $package.  Please start
1854 Configure with an explicit path -- i.e. /some/path/Configure.
1855
1856 EOM
1857         exit 1
1858         ;;
1859 ../.)   rsrc='..';;
1860 *)
1861         echo " "
1862         echo "Sources for $package found in \"$src\"." >&4
1863         ;;
1864 esac
1865
1866 : script used to extract .SH files with variable substitutions
1867 cat >extract <<'EOS'
1868 PERL_CONFIG_SH=true
1869 echo "Doing variable substitutions on .SH files..."
1870 if test -f MANIFEST; then
1871         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1872 else
1873         echo "(Looking for .SH files under the source directory.)"
1874         set x `(cd "$src"; find . -name "*.SH" -print)`
1875 fi
1876 shift
1877 case $# in
1878 0) set x `(cd "$src"; echo *.SH)`; shift;;
1879 esac
1880 if test ! -f "$src/$1"; then
1881         shift
1882 fi
1883 mkdir_p='
1884 name=$1;
1885 create="";
1886 while test $name; do
1887         if test ! -d "$name"; then
1888                 create="$name $create";
1889                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1890                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1891         else
1892                 name="";
1893         fi;
1894 done;
1895 for file in $create; do
1896         mkdir $file;
1897 done
1898 '
1899 for file in $*; do
1900         case "$src" in
1901         ".")
1902                 case "$file" in
1903                 */*)
1904                         dir=`expr X$file : 'X\(.*\)/'`
1905                         file=`expr X$file : 'X.*/\(.*\)'`
1906                         (cd "$dir" && . ./$file)
1907                         ;;
1908                 *)
1909                         . ./$file
1910                         ;;
1911                 esac
1912                 ;;
1913         *)
1914                 case "$file" in
1915                 */*)
1916                         dir=`expr X$file : 'X\(.*\)/'`
1917                         file=`expr X$file : 'X.*/\(.*\)'`
1918                         (set x $dir; shift; eval $mkdir_p)
1919                         sh <"$src/$dir/$file"
1920                         ;;
1921                 *)
1922                         sh <"$src/$file"
1923                         ;;
1924                 esac
1925                 ;;
1926         esac
1927 done
1928 if test -f "$src/config_h.SH"; then
1929         if test ! -f config.h; then
1930         : oops, they left it out of MANIFEST, probably, so do it anyway.
1931         . "$src/config_h.SH"
1932         fi
1933 fi
1934 EOS
1935
1936 : extract files and exit if asked to do so
1937 case "$extractsh" in
1938 true)
1939         case "$realsilent" in
1940         true) ;;
1941         *) exec 1>&4;;
1942         esac
1943         case "$config_sh" in
1944         '') config_sh='config.sh';;
1945         esac
1946         echo " "
1947         echo "Fetching answers from $config_sh..."
1948         cd ..
1949         . $config_sh
1950         test "$override" && . ./optdef.sh
1951         echo " "
1952         . UU/extract
1953         rm -rf UU
1954         echo "Extraction done."
1955         exit 0
1956         ;;
1957 esac
1958
1959 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
1960 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
1961
1962 if test "X$sysroot" != X; then
1963   case "$cc" in
1964     *gcc*|*g++*)
1965         echo "Using $sysroot to find your headers and libraries, adding to ccflags"
1966         # _sysroot is used in places where we need --sysroot=foo
1967         # but using the rest of the flags could cause issues.
1968         _sysroot="--sysroot=$sysroot";
1969         case "$ccflags" in
1970             *sysroot*) ;;
1971             'undef'|*)
1972                 ccflags="$ccflags $_sysroot"
1973         esac
1974         case "$ldflags" in
1975             *sysroot*) ;;
1976             'undef'|*)
1977                 ldflags="$ldflags $_sysroot"
1978         esac
1979         case "$cppflags" in
1980             *sysroot*) ;;
1981             'undef'|*)
1982                 cppflags="$cppflags $_sysroot"
1983         esac
1984         # lddlflags updated below in lddlflags section;
1985         # same with cccdlflags
1986   ;;
1987   esac
1988   
1989   # Adjust some defaults to also use $sysroot
1990   for var in xlibpth loclibpth locincpth glibpth; do
1991     eval xxx=\$$var
1992     eval $var=''
1993     for path in $xxx; do
1994       eval $var=\"\$$var $sysroot$path\"
1995     done
1996   done
1997
1998 fi
1999
2000 : Eunice requires " " instead of "", can you believe it
2001 echo " "
2002 : Here we go...
2003 echo "Beginning of configuration questions for $package."
2004
2005 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2006
2007 : first determine how to suppress newline on echo command
2008 echo " "
2009 echo "Checking echo to see how to suppress newlines..."
2010 (echo "hi there\c" ; echo " ") >.echotmp
2011 if $contains c .echotmp >/dev/null 2>&1 ; then
2012         echo "...using -n."
2013         n='-n'
2014         c=''
2015 else
2016         cat <<'EOM'
2017 ...using \c
2018 EOM
2019         n=''
2020         c='\c'
2021 fi
2022 echo $n "The star should be here-->$c"
2023 echo '*'
2024 rm -f .echotmp
2025
2026 : Now test for existence of everything in MANIFEST
2027 echo " "
2028 if test -f "$rsrc/MANIFEST"; then
2029         echo "First let's make sure your kit is complete.  Checking..." >&4
2030         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2031                 (split -l 50 2>/dev/null || split -50)
2032         rm -f missing
2033         tmppwd=`pwd`
2034         for filelist in x??; do
2035                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2036                         >/dev/null 2>>"$tmppwd/missing")
2037         done
2038         if test -s missing; then
2039                 cat missing >&4
2040                 cat >&4 <<'EOM'
2041
2042 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2043
2044 You have the option of continuing the configuration process, despite the
2045 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2046 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2047 and contact the author (perlbug@perl.org).
2048
2049 EOM
2050                 echo $n "Continue? [n] $c" >&4
2051                 read ans
2052                 case "$ans" in
2053                 y*)
2054                         echo "Continuing..." >&4
2055                         rm -f missing
2056                         ;;
2057                 *)
2058                         echo "ABORTING..." >&4
2059                         kill $$
2060                         ;;
2061                 esac
2062         else
2063                 echo "Looks good..."
2064         fi
2065 else
2066         echo "There is no MANIFEST file.  I hope your kit is complete !"
2067 fi
2068 rm -f missing x??
2069
2070 : Find the appropriate value for a newline for tr
2071 echo " "
2072 if test -n "$DJGPP"; then
2073        trnl='\012'
2074 fi
2075 if test X"$trnl" = X; then
2076         case "`echo foo|tr '\n' x 2>/dev/null`" in
2077         foox) trnl='\n' ;;
2078         esac
2079 fi
2080 if test X"$trnl" = X; then
2081         case "`echo foo|tr '\012' x 2>/dev/null`" in
2082         foox) trnl='\012' ;;
2083         esac
2084 fi
2085 if test X"$trnl" = X; then
2086        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2087        fooxy) trnl='\n\r' ;;
2088        esac
2089 fi
2090 if test X"$trnl" = X; then
2091         cat <<EOM >&2
2092
2093 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2094
2095 EOM
2096         exit 1
2097 fi
2098
2099 : compute the number of columns on the terminal for proper question formatting
2100 case "$COLUMNS" in
2101 '') COLUMNS='80';;
2102 esac
2103
2104 : set up the echo used in my read
2105 myecho="case \"\$xxxm\" in
2106 '') echo $n \"\$rp $c\" >&4;;
2107 *) case \"\$rp\" in
2108         '') echo $n \"[\$xxxm] $c\";;
2109         *)
2110                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2111                         echo \"\$rp\" >&4
2112                         echo $n \"[\$xxxm] $c\" >&4
2113                 else
2114                         echo $n \"\$rp [\$xxxm] $c\" >&4
2115                 fi
2116                 ;;
2117         esac;;
2118 esac"
2119
2120 : now set up to do reads with possible shell escape and default assignment
2121 cat <<EOSC >myread
2122 $startsh
2123 xxxm=\$dflt
2124 $myecho
2125 ans='!'
2126 case "\$fastread" in
2127 yes) case "\$dflt" in
2128         '') ;;
2129         *) ans='';
2130                 case "\$silent-\$rp" in
2131                 true-) ;;
2132                 *) echo " " >&4;;
2133                 esac;;
2134         esac;;
2135 *) case "\$silent" in
2136         true) case "\$rp" in
2137                 '') ans='';;
2138                 esac;;
2139         esac;;
2140 esac
2141 while expr "X\$ans" : "X!" >/dev/null; do
2142         read answ
2143         set x \$xxxm
2144         shift
2145         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2146         case  "\$answ" in
2147         "!")
2148                 sh 1>&4
2149                 echo " "
2150                 $myecho
2151                 ;;
2152         !*)
2153                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2154                 shift
2155                 sh 1>&4 -c "\$*"
2156                 echo " "
2157                 $myecho
2158                 ;;
2159         "\$ans")
2160                 case "\$ans" in
2161                 \\&*)
2162                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2163                         shift
2164                         case "\$1" in
2165                         -d)
2166                                 fastread=yes
2167                                 echo "(OK, I'll run with -d after this question.)" >&4
2168                                 ;;
2169                         -*)
2170                                 echo "*** Sorry, \$1 not supported yet." >&4
2171                                 ;;
2172                         esac
2173                         $myecho
2174                         ans=!
2175                         ;;
2176                 esac;;
2177         *)
2178                 case "\$aok" in
2179                 y)
2180                         echo "*** Substitution done -- please confirm."
2181                         xxxm="\$ans"
2182                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2183                         xxxm="\$ans"
2184                         ans=!
2185                         ;;
2186                 *)
2187                         echo "*** Error -- try again."
2188                         ans=!
2189                         ;;
2190                 esac
2191                 $myecho
2192                 ;;
2193         esac
2194         case "\$ans\$xxxm\$nostick" in
2195         '')
2196                 ans=!
2197                 $myecho
2198                 ;;
2199         esac
2200 done
2201 case "\$ans" in
2202 '') ans="\$xxxm";;
2203 esac
2204 EOSC
2205
2206 : create .config dir to save info across Configure sessions
2207 test -d ../.config || mkdir ../.config
2208 cat >../.config/README <<EOF
2209 This directory created by Configure to save information that should
2210 persist across sessions for $package.
2211
2212 You may safely delete it if you wish.
2213 EOF
2214
2215 : See if we are using a devel version and want that
2216 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2217 case "$usedevel" in
2218 $define|true|[yY]*)
2219     usedevel="$define" ;;
2220 *) case "$xversion" in
2221    *[13579])
2222         cat >&4 <<EOH
2223 *** WHOA THERE!!! ***
2224
2225     This is an UNSTABLE DEVELOPMENT release.
2226     The version of this $package distribution is $xversion, that is, odd,
2227     (as opposed to even) and that signifies a development release.
2228     If you want a maintenance release, you want an even-numbered version.
2229
2230     Do ***NOT*** install this into production use.
2231     Data corruption and crashes are possible.
2232
2233     It is most seriously suggested that you do not continue any further
2234     unless you want to help in developing and debugging Perl.
2235
2236     If you *still* want to build perl, you can answer 'y' now,
2237     or pass -Dusedevel to Configure.
2238
2239 EOH
2240         rp='Do you really want to continue?'
2241         dflt='n'
2242         . ./myread
2243         case "$ans" in
2244         [yY]) echo >&4 "Okay, continuing."
2245               usedevel="$define" ;;
2246         *) echo >&4 "Okay, bye."
2247            exit 1
2248            ;;
2249         esac
2250         ;;
2251     esac
2252     usedevel="$undef"
2253     ;;
2254 esac
2255 case "$usedevel" in
2256 $define|true|[yY]*)
2257         case "$versiononly" in
2258         '') versiononly="$define" ;;
2259         esac
2260         case "$installusrbinperl" in
2261         '') installusrbinperl="$undef" ;;
2262         esac
2263         ;;
2264 esac
2265
2266 : general instructions
2267 needman=true
2268 firsttime=true
2269 user=`(logname) 2>/dev/null`
2270 case "$user" in
2271 '') user=`whoami 2>&1`;;
2272 esac
2273 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2274         firsttime=false
2275         echo " "
2276         rp='Would you like to see the instructions?'
2277         dflt=n
2278         . ./myread
2279         case "$ans" in
2280         [yY]*) ;;
2281         *) needman=false;;
2282         esac
2283 fi
2284 if $needman; then
2285         cat <<EOH
2286
2287 This installation shell script will examine your system and ask you questions
2288 to determine how the perl5 package should be installed. If you get
2289 stuck on a question, you may use a ! shell escape to start a subshell or
2290 execute a command.  Many of the questions will have default answers in square
2291 brackets; typing carriage return will give you the default.
2292
2293 On some of the questions which ask for file or directory names you are allowed
2294 to use the ~name construct to specify the login directory belonging to "name",
2295 even if you don't have a shell which knows about that.  Questions where this is
2296 allowed will be marked "(~name ok)".
2297
2298 EOH
2299         rp=''
2300         dflt='Type carriage return to continue'
2301         . ./myread
2302         cat <<'EOH'
2303
2304 The prompter used in this script allows you to use shell variables and
2305 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2306 in the default answer, as if the default line was a set of arguments given to a
2307 script shell.  This means you may also use $* to repeat the whole default line,
2308 so you do not have to re-type everything to add something to the default.
2309
2310 Every time there is a substitution, you will have to confirm.  If there is an
2311 error (e.g. an unmatched backtick), the default answer will remain unchanged
2312 and you will be prompted again.
2313
2314 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2315 the questions and use the computed defaults (or the previous answers if there
2316 was already a config.sh file). Type 'Configure -h' for a list of options.
2317 You may also start interactively and then answer '& -d' at any prompt to turn
2318 on the non-interactive behaviour for the remainder of the execution.
2319
2320 EOH
2321         . ./myread
2322         cat <<EOH
2323
2324 Much effort has been expended to ensure that this shell script will run on any
2325 Unix system.  If despite that it blows up on yours, your best bet is to edit
2326 Configure and run it again.  If you can't run Configure for some reason,
2327 you'll have to generate a config.sh file by hand.  Whatever problems you
2328 have, let me (perlbug@perl.org) know how I blew it.
2329
2330 This installation script affects things in two ways:
2331
2332 1) it may do direct variable substitutions on some of the files included
2333    in this kit.
2334 2) it builds a config.h file for inclusion in C programs.  You may edit
2335    any of these files as the need arises after running this script.
2336
2337 If you make a mistake on a question, there is no easy way to back up to it
2338 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2339 files.  Configure will offer to let you do this before it runs the SH files.
2340
2341 EOH
2342         dflt='Type carriage return to continue'
2343         . ./myread
2344         case "$firsttime" in
2345         true) echo $user >>../.config/instruct;;
2346         esac
2347 fi
2348
2349 : find out where common programs are
2350 echo " "
2351 echo "Locating common programs..." >&4
2352 cat <<EOSC >loc
2353 $startsh
2354 case \$# in
2355 0) exit 1;;
2356 esac
2357 thing=\$1
2358 shift
2359 dflt=\$1
2360 shift
2361 for dir in \$*; do
2362         case "\$thing" in
2363         .)
2364         if test -d \$dir/\$thing; then
2365                 echo \$dir
2366                 exit 0
2367         fi
2368         ;;
2369         *)
2370         for thisthing in \$dir/\$thing; do
2371                 : just loop through to pick last item
2372         done
2373         if test -f \$thisthing; then
2374                 echo \$thisthing
2375                 exit 0
2376         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2377                 echo \$thisthing
2378                 exit 0
2379         elif test -f \$dir/\$thing.exe; then
2380                 if test -n "$DJGPP"; then
2381                         echo \$dir/\$thing.exe
2382                 elif test "$eunicefix" != ":"; then
2383                         : on Eunice apparently
2384                         echo \$dir/\$thing
2385                 fi
2386                 exit 0
2387         fi
2388         ;;
2389         esac
2390 done
2391 echo \$dflt
2392 exit 1
2393 EOSC
2394 chmod +x loc
2395 $eunicefix loc
2396 loclist="
2397 awk
2398 cat
2399 chmod
2400 comm
2401 cp
2402 echo
2403 expr
2404 grep
2405 ls
2406 mkdir
2407 rm
2408 sed
2409 sort
2410 touch
2411 tr
2412 uniq
2413 "
2414 trylist="
2415 ar
2416 bison
2417 byacc
2418 cpp
2419 csh
2420 date
2421 egrep
2422 gmake
2423 gzip
2424 less
2425 ln
2426 make
2427 more
2428 nm
2429 nroff
2430 perl
2431 pg
2432 test
2433 uname
2434 zip
2435 "
2436 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2437 pth="$pth $sysroot/lib $sysroot/usr/lib"
2438 for file in $loclist; do
2439         eval xxx=\$$file
2440         case "$xxx" in
2441         /*|?:[\\/]*)
2442                 if test -f "$xxx"; then
2443                         : ok
2444                 else
2445                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2446                         xxx=`./loc $file $file $pth`
2447                 fi
2448                 ;;
2449         '') xxx=`./loc $file $file $pth`;;
2450         *) xxx=`./loc $xxx $xxx $pth`;;
2451         esac
2452         eval $file=$xxx$_exe
2453         eval _$file=$xxx
2454         case "$xxx" in
2455         /*)
2456                 echo $file is in $xxx.
2457                 ;;
2458         ?:[\\/]*)
2459                 echo $file is in $xxx.
2460                 ;;
2461         *)
2462                 echo "I don't know where '$file' is, and my life depends on it." >&4
2463                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2464                 exit 1
2465                 ;;
2466         esac
2467 done
2468 echo " "
2469 echo "Don't worry if any of the following aren't found..."
2470 say=offhand
2471 for file in $trylist; do
2472         eval xxx=\$$file
2473         case "$xxx" in
2474         /*|?:[\\/]*)
2475                 if test -f "$xxx"; then
2476                         : ok
2477                 else
2478                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2479                         xxx=`./loc $file $file $pth`
2480                 fi
2481                 ;;
2482         '') xxx=`./loc $file $file $pth`;;
2483         *) xxx=`./loc $xxx $xxx $pth`;;
2484         esac
2485         eval $file=$xxx$_exe
2486         eval _$file=$xxx
2487         case "$xxx" in
2488         /*)
2489                 echo $file is in $xxx.
2490                 ;;
2491         ?:[\\/]*)
2492                 echo $file is in $xxx.
2493                 ;;
2494         *)
2495                 echo "I don't see $file out there, $say."
2496                 say=either
2497                 ;;
2498         esac
2499 done
2500 case "$egrep" in
2501 egrep)
2502         echo "Substituting grep for egrep."
2503         egrep=$grep
2504         _egrep=$grep
2505         ;;
2506 esac
2507 case "$less" in
2508 '')     ;;
2509 *)      if $less -R </dev/null >/dev/null; then
2510                echo "Substituting less -R for less."
2511                less="$less -R"
2512                _less=$less
2513         fi
2514         ;;
2515 esac
2516 case "$ln" in
2517 ln)
2518         echo "Substituting cp for ln."
2519         ln=$cp
2520         _ln=$cp
2521         ;;
2522 esac
2523 case "$make" in
2524 make)
2525         case "$gmake" in
2526         gmake)
2527         echo "I can't find make or gmake, and my life depends on it." >&4
2528         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2529         exit 1
2530         ;;
2531         esac
2532         ;;
2533 esac
2534 case "$gmake" in
2535 gmake)  ;;
2536 *)      # We can't have osname yet.
2537         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2538                 # Assume that gmake, if found, is definitely GNU make
2539                 # and prefer it over the system make.
2540                 echo "Substituting gmake for make."
2541                 make=$gmake
2542                 _make=$gmake
2543         fi
2544         ;;
2545 esac
2546 case "$test" in
2547 test)
2548         echo "Hopefully test is built into your sh."
2549         ;;
2550 *)
2551         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2552                 echo "Using the test built into your sh."
2553                 test=test
2554                 _test=test
2555         fi
2556         ;;
2557 esac
2558 case "$echo" in
2559 echo)
2560         echo "Hopefully echo is built into your sh."
2561         ;;
2562 '') ;;
2563 *)
2564         echo " "
2565 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2566         $echo $n "hi there$c" >foo1
2567         echo $n "hi there$c" >foo2
2568         if cmp foo1 foo2 >/dev/null 2>&1; then
2569                 echo "They are compatible.  In fact, they may be identical."
2570         else
2571                 case "$n" in
2572                 '-n') n='' c='\c';;
2573                 *) n='-n' c='';;
2574                 esac
2575                 cat <<FOO
2576 They are not compatible!  You are probably running ksh on a non-USG system.
2577 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2578 have echo built in and we may have to run some Bourne shell scripts.  That
2579 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2580
2581 FOO
2582                 $echo $n "The star should be here-->$c"
2583                 $echo "*"
2584         fi
2585         $rm -f foo1 foo2
2586         ;;
2587 esac
2588
2589 # This question was auctioned at YAPC::Europe-2007 in Vienna
2590 # I never promised you could answer it. I only auctioned the question.
2591 cat <<FOO
2592 The following message is sponsored by
2593
2594   Dresden.pm<--The stars should be here.
2595
2596 Dear Perl user, system administrator or package
2597 maintainer, the Perl community sends greetings to
2598 you. Do you (emblematical) greet back [Y/n]? n
2599
2600 FOO
2601
2602 : Check what type of C compiler we use
2603 cat <<EOS >trygcc
2604 $startsh
2605 EOS
2606 cat <<'EOSC' >>trygcc
2607 case "$cc" in
2608 '') ;;
2609 *)  $rm -f try try.*
2610     $cat >try.c <<EOM
2611 int main(int argc, char *argv[]) {
2612   return 0;
2613 }
2614 EOM
2615     if $cc -o try $ccflags $ldflags try.c; then
2616        :
2617     else
2618         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2619         despair=yes
2620         trygcc=yes
2621         case "$cc" in
2622         *gcc*) trygcc=no ;;
2623         esac
2624         # Skip this test because it gives a false match on output like:
2625         #    ./trygcc: line 23: cc: command not found
2626         # case "`$cc -v -c try.c 2>&1`" in
2627         # *gcc*) trygcc=no ;;
2628         # esac
2629         if $test X"$trygcc" = Xyes; then
2630             if gcc -o try -c try.c; then
2631                 echo " "
2632                 echo "You seem to have a working gcc, though." >&4
2633                 # Switching compilers may undo the work of hints files.
2634                 # The most common problem is -D_REENTRANT for threads.
2635                 # This heuristic catches that case, but gets false positives
2636                 # if -Dusethreads was not actually specified.  Better to
2637                 # bail out here with a useful message than fail 
2638                 # mysteriously later. Should we perhaps just try to
2639                 # re-invoke Configure -Dcc=gcc config_args ?
2640                 if $test -f usethreads.cbu; then
2641                         $cat >&4 <<EOM 
2642
2643 *** However, any setting of the C compiler flags (e.g. for thread support)
2644 *** will be lost.  It may be necessary for you to restart Configure and
2645 *** add -Dcc=gcc to your Configure command line.
2646
2647 EOM
2648                         rp="Would you like to go ahead and try gcc anyway?"
2649                         dflt=n
2650                 else
2651                         rp="Would you like to use it?"
2652                         dflt=y
2653                 fi
2654                 if $test -f myread; then
2655                     . ./myread
2656                 else
2657                     if $test -f UU/myread; then
2658                         . ./UU/myread
2659                     else
2660                         echo "Cannot find myread, sorry.  Aborting." >&2
2661                         exit 1
2662                     fi
2663                 fi  
2664                 case "$ans" in
2665                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2666                 esac
2667             fi
2668         fi
2669     fi
2670     $rm -f try try.*
2671     ;;
2672 esac
2673 EOSC
2674
2675 cat <<EOS >checkcc
2676 $startsh
2677 EOS
2678 cat <<'EOSC' >>checkcc
2679 case "$cc" in        
2680 '') ;;
2681 *)  $rm -f try try.*              
2682     $cat >try.c <<EOM
2683 int main(int argc, char *argv[]) {
2684   return 0;
2685 }
2686 EOM
2687     if $cc -o try $ccflags $ldflags try.c; then
2688        :
2689     else
2690         if $test X"$despair" = Xyes; then
2691            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2692         fi
2693         $cat >&4 <<EOM         
2694 You need to find a working C compiler.
2695 Either (purchase and) install the C compiler supplied by your OS vendor,
2696 or for a free C compiler try http://gcc.gnu.org/
2697 I cannot continue any further, aborting.
2698 EOM
2699         exit 1
2700     fi
2701     $rm -f try try.*
2702     ;;
2703 esac
2704 EOSC
2705
2706 : determine whether symbolic links are supported
2707 echo " "
2708 $touch blurfl
2709 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2710         echo "Symbolic links are supported." >&4
2711         lns="$ln -s"
2712 else
2713         echo "Symbolic links are NOT supported." >&4
2714         lns="$ln"
2715 fi
2716 $rm -f blurfl sym
2717
2718 : determine whether symbolic links are supported
2719 echo " "
2720 case "$lns" in
2721 *"ln"*" -s")
2722         echo "Checking how to test for symbolic links..." >&4
2723         $lns blurfl sym
2724         if $test "X$issymlink" = X; then
2725                 case "$newsh" in
2726                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2727                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2728                 esac
2729                 if test $? = 0; then
2730                         issymlink="test -h"
2731                 else
2732                         echo "Your builtin 'test -h' may be broken." >&4
2733                         case "$test" in
2734                         /*)     ;;
2735                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2736                                 for p in $pth
2737                                 do
2738                                         if test -f "$p/$test"; then
2739                                                 test="$p/$test"
2740                                                 break
2741                                         fi
2742                                 done
2743                                 ;;
2744                         esac
2745                         case "$test" in
2746                         /*)
2747                                 echo "Trying external '$test -h'." >&4
2748                                 issymlink="$test -h"
2749                                 if $test ! -h sym >/dev/null 2>&1; then
2750                                         echo "External '$test -h' is broken, too." >&4
2751                                         issymlink=''
2752                                 fi
2753                                 ;;
2754                         *)      issymlink='' ;;
2755                         esac
2756                 fi
2757         fi
2758         if $test "X$issymlink" = X; then
2759                 if $test -L sym 2>/dev/null; then
2760                         issymlink="$test -L"
2761                         echo "The builtin '$test -L' worked." >&4
2762                 fi
2763         fi
2764         if $test "X$issymlink" != X; then
2765                 echo "You can test for symbolic links with '$issymlink'." >&4
2766         else
2767                 echo "I do not know how you can test for symbolic links." >&4
2768         fi
2769         $rm -f blurfl sym
2770         ;;
2771 *)      echo "No symbolic links, so not testing for their testing..." >&4
2772         ;;
2773 esac
2774 echo " "
2775
2776 : Make symlinks util
2777 case "$mksymlinks" in
2778 $define|true|[yY]*)
2779         case "$src" in
2780         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2781                 exit 1
2782                 ;;
2783         *)      case "$lns:$issymlink" in
2784                 *"ln"*" -s:"*"test -"?)
2785                         echo "Creating the symbolic links..." >&4
2786                         echo "(First creating the subdirectories...)" >&4
2787                         cd ..
2788                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2789                                 read directory
2790                                 test -z "$directory" && break
2791                                 mkdir -p $directory
2792                         done
2793                         # Sanity check 1.
2794                         if test ! -d t/base; then
2795                                 echo "Failed to create the subdirectories.  Aborting." >&4
2796                                 exit 1
2797                         fi
2798                         echo "(Then creating the symlinks...)" >&4
2799                         awk '{print $1}' $src/MANIFEST | while true; do
2800                                 read filename
2801                                 test -z "$filename" && break
2802                                 if test -f $filename; then
2803                                         if $issymlink $filename; then
2804                                                 rm -f $filename
2805                                         fi
2806                                 fi
2807                                 if test -f $filename; then
2808                                         echo "$filename already exists, not symlinking."
2809                                 else
2810                                         ln -s $src/$filename $filename
2811                                 fi
2812                         done
2813                         # Sanity check 2.
2814                         if test ! -f t/base/lex.t; then
2815                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2816                                 exit 1
2817                         fi
2818                         cd UU
2819                         ;;
2820                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2821                         ;;
2822                 esac
2823                 ;;
2824         esac
2825         ;;
2826 esac
2827
2828 : Check for Cross-Compilation
2829 case "$usecrosscompile" in
2830 $define|true|[yY]*)
2831         $echo "Cross-compiling..."
2832         croak=''
2833         case "$cc" in
2834         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2835             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2836             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2837             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2838             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2839             # leave out ld, choosing it is more complex
2840             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2841             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2842             # We are in a weird spot. Just before us, some values
2843             # were 'saved', to be restored after the hints are
2844             # run.  This means that the changes we made to ar,
2845             # nm and ranlib will get reverted.
2846             # To avoid that, we hijack the saving mechanism and
2847             # have it save our new values.
2848             for file in ar nm ranlib; do
2849                 eval xxx=\$$file
2850                 eval $file=$xxx$_exe
2851                 eval _$file=$xxx
2852             done
2853         ;;
2854         esac
2855         case "$targetarch" in
2856         '') echo "Targetarch not defined." >&4; croak=y ;;
2857         *)  echo "Using targetarch $targetarch." >&4 ;;
2858         esac
2859         case "$targethost" in
2860         '') echo "Targethost not defined." >&4; croak=y ;;
2861         *)  echo "Using targethost $targethost." >&4
2862         esac
2863         locincpth=' '
2864         loclibpth=' '
2865         case "$croak" in
2866         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2867         esac
2868         case "$src" in
2869         /*) run=$src/Cross/run
2870             targetmkdir=$src/Cross/mkdir
2871             to=$src/Cross/to
2872             from=$src/Cross/from
2873             ;;
2874         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2875             run=$pwd/Cross/run
2876             targetmkdir=$pwd/Cross/mkdir
2877             to=$pwd/Cross/to
2878             from=$pwd/Cross/from
2879             ;;
2880         esac
2881         case "$targetrun" in
2882         '') targetrun=ssh ;;
2883         esac
2884         case "$targetto" in
2885         '') targetto=scp ;;
2886         esac
2887         case "$targetfrom" in
2888         '') targetfrom=scp ;;
2889         esac
2890         run=$run-$targetrun
2891         to=$to-$targetto
2892         from=$from-$targetfrom
2893         case "$targetdir" in
2894         '')  targetdir=/tmp
2895              echo "Guessing targetdir $targetdir." >&4
2896              ;;
2897         esac
2898         case "$targetuser" in
2899         '')  targetuser=root
2900              echo "Guessing targetuser $targetuser." >&4
2901              ;;
2902         esac
2903         case "$targetport" in
2904         '')  targetport=22
2905              echo "Guessing targetport $targetport." >&4
2906              ;;
2907         esac
2908         case "$targetfrom" in
2909         scp)    q=-q ;;
2910         *)      q='' ;;
2911         esac
2912         case "$targetrun" in
2913         ssh|rsh)
2914             cat >$run <<EOF
2915 #!/bin/sh
2916 case "\$1" in
2917 -cwd)
2918   shift
2919   cwd=\$1
2920   shift
2921   ;;
2922 esac
2923 case "\$cwd" in
2924 '') cwd=$targetdir ;;
2925 esac
2926 exe=\$1
2927 shift
2928 $to \$exe
2929 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2930 EOF
2931             ;;
2932         *)  echo "Unknown targetrun '$targetrun'" >&4
2933             exit 1
2934             ;;
2935         esac
2936         case "$targetmkdir" in
2937         */Cross/mkdir)
2938             cat >$targetmkdir <<EOF
2939 #!/bin/sh
2940 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
2941 EOF
2942             $chmod a+rx $targetmkdir
2943             ;;
2944         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2945             exit 1
2946             ;;
2947         esac
2948         case "$targetto" in
2949         scp|rcp)
2950             cat >$to <<EOF
2951 #!/bin/sh
2952 for f in \$@
2953 do
2954   case "\$f" in
2955   /*)
2956     $targetmkdir \`dirname \$f\`
2957     $targetto -P $targetport $q \$f $targetuser@$targethost:\$f            || exit 1
2958     ;;
2959   *)
2960     $targetmkdir $targetdir/\`dirname \$f\`
2961     $targetto -P $targetport $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2962     ;;
2963   esac
2964 done
2965 exit 0
2966 EOF
2967             ;;
2968         cp) cat >$to <<EOF
2969 #!/bin/sh
2970 for f in \$@
2971 do
2972   case "\$f" in
2973   /*)
2974     $mkdir -p $targetdir/\`dirname \$f\`
2975     $cp \$f $targetdir/\$f || exit 1
2976     ;;
2977   *)
2978     $targetmkdir $targetdir/\`dirname \$f\`
2979     $cp \$f $targetdir/\$f || exit 1
2980     ;;
2981   esac
2982 done
2983 exit 0
2984 EOF
2985             ;;
2986         *)  echo "Unknown targetto '$targetto'" >&4
2987             exit 1
2988             ;;
2989         esac
2990         case "$targetfrom" in
2991         scp|rcp)
2992           cat >$from <<EOF
2993 #!/bin/sh
2994 for f in \$@
2995 do
2996   $rm -f \$f
2997   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2998 done
2999 exit 0
3000 EOF
3001             ;;
3002         cp) cat >$from <<EOF
3003 #!/bin/sh
3004 for f in \$@
3005 do
3006   $rm -f \$f
3007   cp $targetdir/\$f . || exit 1
3008 done
3009 exit 0
3010 EOF
3011             ;;
3012         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3013             exit 1
3014             ;;
3015         esac
3016         if $test ! -f $run; then
3017             echo "Target 'run' script '$run' not found." >&4
3018         else
3019             $chmod a+rx $run
3020         fi
3021         if $test ! -f $to; then
3022             echo "Target 'to' script '$to' not found." >&4
3023         else
3024             $chmod a+rx $to
3025         fi
3026         if $test ! -f $from; then
3027             echo "Target 'from' script '$from' not found." >&4
3028         else
3029             $chmod a+rx $from
3030         fi
3031         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3032             exit 1
3033         fi
3034         cat >&4 <<EOF
3035 Using '$run' for remote execution,
3036 and '$from' and '$to'
3037 for remote file transfer.
3038 EOF
3039         ;;
3040 *)      run=''
3041         to=:
3042         from=:
3043         usecrosscompile='undef'
3044         targetarch=''
3045         ;;
3046 esac
3047
3048 : see whether [:lower:] and [:upper:] are supported character classes
3049 echo " "
3050 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3051 ABYZ)
3052         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3053         up='[:upper:]'
3054         low='[:lower:]'
3055         ;;
3056 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3057         # (0xd9 and 0xe2), therefore that is a nice testing point.
3058         if test "X$up" = X -o "X$low" = X; then
3059             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3060             rs) up='[A-Z]'
3061                 low='[a-z]'
3062                 ;;
3063             esac
3064         fi
3065         if test "X$up" = X -o "X$low" = X; then
3066             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3067             rs) up='A-Z'
3068                 low='a-z'
3069                 ;;
3070             esac
3071         fi
3072         if test "X$up" = X -o "X$low" = X; then
3073             case "`echo RS | od -x 2>/dev/null`" in
3074             *D9E2*|*d9e2*)
3075                 echo "Hey, this might be EBCDIC." >&4
3076                 if test "X$up" = X -o "X$low" = X; then
3077                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3078                     rs) up='[A-IJ-RS-Z]'
3079                         low='[a-ij-rs-z]'
3080                         ;;
3081                     esac
3082                 fi
3083                 if test "X$up" = X -o "X$low" = X; then
3084                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3085                     rs) up='A-IJ-RS-Z'
3086                         low='a-ij-rs-z'
3087                         ;;
3088                     esac
3089                 fi
3090                 ;;
3091             esac
3092         fi
3093 esac
3094 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3095 rs)
3096     echo "Using $up and $low to convert case." >&4
3097     ;;
3098 *)
3099     echo "I don't know how to translate letters from upper to lower case." >&4
3100     echo "Your tr is not acting any way I know of." >&4
3101     exit 1
3102     ;;
3103 esac
3104 : set up the translation script tr, must be called with ./tr of course
3105 cat >tr <<EOSC
3106 $startsh
3107 case "\$1\$2" in
3108 '[A-Z][a-z]') exec $tr '$up' '$low';;
3109 '[a-z][A-Z]') exec $tr '$low' '$up';;
3110 esac
3111 exec $tr "\$@"
3112 EOSC
3113 chmod +x tr
3114 $eunicefix tr
3115
3116 : Try to determine whether config.sh was made on this system
3117 case "$config_sh" in
3118 '')
3119 myuname=`$uname -a 2>/dev/null`
3120 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3121 # Downcase everything to avoid ambiguity.
3122 # Remove slashes and single quotes so we can use parts of this in
3123 # directory and file names.
3124 # Remove newlines so myuname is sane to use elsewhere.
3125 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3126 # because the A-Z/a-z are not consecutive.
3127 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3128         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3129 newmyuname="$myuname"
3130 dflt=n
3131 case "$knowitall" in
3132 '')
3133         if test -f ../config.sh; then
3134                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3135                         eval "`grep myuname= ../config.sh`"
3136                 fi
3137                 if test "X$myuname" = "X$newmyuname"; then
3138                         dflt=y
3139                 fi
3140         fi
3141         ;;
3142 *) dflt=y;;
3143 esac
3144
3145 : Get old answers from old config file if Configure was run on the
3146 : same system, otherwise use the hints.
3147 hint=default
3148 cd ..
3149 if test -f config.sh; then
3150         echo " "
3151         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3152         . UU/myread
3153         case "$ans" in
3154         n*|N*) echo "OK, I'll ignore it."
3155                 mv config.sh config.sh.old
3156                 myuname="$newmyuname"
3157                 ;;
3158         *)  echo "Fetching default answers from your old config.sh file..." >&4
3159                 tmp_n="$n"
3160                 tmp_c="$c"
3161                 tmp_sh="$sh"
3162                 . ./config.sh
3163                 cp config.sh UU
3164                 n="$tmp_n"
3165                 c="$tmp_c"
3166                 : Older versions did not always set $sh.  Catch re-use of such
3167                 : an old config.sh.
3168                 case "$sh" in
3169                 '') sh="$tmp_sh" ;;
3170                 esac
3171                 hint=previous
3172                 ;;
3173         esac
3174 fi
3175 . ./UU/checkcc
3176 if test ! -f config.sh; then
3177         $cat <<EOM
3178
3179 First time through, eh?  I have some defaults handy for some systems
3180 that need some extra help getting the Configure answers right:
3181
3182 EOM
3183         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3184         dflt=''
3185         : Half the following guesses are probably wrong... If you have better
3186         : tests or hints, please send them to perlbug@perl.org
3187         : The metaconfig authors would also appreciate a copy...
3188         $test -f /irix && osname=irix
3189         $test -f /xenix && osname=sco_xenix
3190         $test -f /dynix && osname=dynix
3191         $test -f /dnix && osname=dnix
3192         $test -f /lynx.os && osname=lynxos
3193         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3194         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3195         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3196         $test -f /bin/mips && /bin/mips && osname=mips
3197         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3198                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3199         $test -d /usr/apollo/bin && osname=apollo
3200         $test -f /etc/saf/_sactab && osname=svr4
3201         $test -d /usr/include/minix && osname=minix
3202         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3203         if $test -d /MachTen -o -d /MachTen_Folder; then
3204                 osname=machten
3205                 if $test -x /sbin/version; then
3206                         osvers=`/sbin/version | $awk '{print $2}' |
3207                         $sed -e 's/[A-Za-z]$//'`
3208                 elif $test -x /usr/etc/version; then
3209                         osvers=`/usr/etc/version | $awk '{print $2}' |
3210                         $sed -e 's/[A-Za-z]$//'`
3211                 else
3212                         osvers="$2.$3"
3213                 fi
3214         fi
3215
3216         $test -f /sys/posix.dll &&
3217                 $test -f /usr/bin/what &&
3218                 set X `/usr/bin/what /sys/posix.dll` &&
3219                 $test "$3" = UWIN &&
3220                 osname=uwin &&
3221                 osvers="$5"
3222
3223         if $test -f $uname; then
3224                 set X $myuname
3225                 shift
3226
3227                 case "$5" in
3228                 fps*) osname=fps ;;
3229                 mips*)
3230                         case "$4" in
3231                         umips) osname=umips ;;
3232                         *) osname=mips ;;
3233                         esac;;
3234                 [23]100) osname=mips ;;
3235                 next*) osname=next ;;
3236                 i386*)
3237                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3238                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3239                                 osname='sco'
3240                                 osvers=$tmp
3241                         elif $test -f /etc/kconfig; then
3242                                 osname=isc
3243                                 if test "$lns" = "$ln -s"; then
3244                                         osvers=4
3245                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3246                                         osvers=3
3247                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3248                                         osvers=2
3249                                 fi
3250                         fi
3251                         tmp=''
3252                         ;;
3253                 pc*)
3254                         if test -n "$DJGPP"; then
3255                                 osname=dos
3256                                 osvers=djgpp
3257                         fi
3258                         ;;
3259                 esac
3260
3261                 case "$1" in
3262                 aix) osname=aix
3263                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3264                         case "$tmp" in
3265                         # oslevel can fail with:
3266                         # oslevel: Unable to acquire lock.
3267                         *not\ found) osvers="$4"."$3" ;;
3268                         '<3240'|'<>3240') osvers=3.2.0 ;;
3269                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3270                         '=3250'|'>3250') osvers=3.2.5 ;;
3271                         *) osvers=$tmp;;
3272                         esac
3273                         ;;
3274                 bitrig) osname=bitrig
3275                         osvers="$3"
3276                         ;;
3277                 bsd386) osname=bsd386
3278                         osvers=`$uname -r`
3279                         ;;
3280                 cygwin*) osname=cygwin
3281                         osvers="$3"
3282                         ;;
3283                 *dc.osx) osname=dcosx
3284                         osvers="$3"
3285                         ;;
3286                 dnix) osname=dnix
3287                         osvers="$3"
3288                         ;;
3289                 domainos) osname=apollo
3290                         osvers="$3"
3291                         ;;
3292                 dgux)   osname=dgux
3293                         osvers="$3"
3294                         ;;
3295                 dragonfly) osname=dragonfly
3296                         osvers="$3"
3297                         ;;
3298                 dynixptx*) osname=dynixptx
3299                         osvers=`echo "$4"|sed 's/^v//'`
3300                         ;;
3301                 freebsd) osname=freebsd
3302                         osvers="$3" ;;
3303                 genix)  osname=genix ;;
3304                 gnu)    osname=gnu
3305                         osvers="$3" ;;
3306                 hp*)    osname=hpux
3307                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3308                         ;;
3309                 irix*)  osname=irix
3310                         case "$3" in
3311                         4*) osvers=4 ;;
3312                         5*) osvers=5 ;;
3313                         *)      osvers="$3" ;;
3314                         esac
3315                         ;;
3316                 linux)  osname=linux
3317                         case "$3" in
3318                         *)      osvers="$3" ;;
3319                         esac
3320                         ;;
3321                 MiNT)   osname=mint
3322                         ;;
3323                 netbsd*) osname=netbsd
3324                         osvers="$3"
3325                         ;;
3326                 news-os) osvers="$3"
3327                         case "$3" in
3328                         4*) osname=newsos4 ;;
3329                         *) osname=newsos ;;
3330                         esac
3331                         ;;
3332                 next*) osname=next ;;
3333                 nonstop-ux) osname=nonstopux ;;
3334                 openbsd) osname=openbsd
3335                         osvers="$3"
3336                         ;;
3337                 os2)    osname=os2
3338                         osvers="$4"
3339                         ;;
3340                 POSIX-BC | posix-bc ) osname=posix-bc
3341                         osvers="$3"
3342                         ;;
3343                 powerux | power_ux | powermax_os | powermaxos | \
3344                 powerunix | power_unix) osname=powerux
3345                         osvers="$3"
3346                         ;;
3347                 qnx) osname=qnx
3348                         osvers="$4"
3349                         ;;
3350                 solaris) osname=solaris
3351                         case "$3" in
3352                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3353                         *)      osvers="$3" ;;
3354                         esac
3355                         ;;
3356                 sunos) osname=sunos
3357                         case "$3" in
3358                         5*) osname=solaris
3359                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3360                         *)      osvers="$3" ;;
3361                         esac
3362                         ;;
3363                 titanos) osname=titanos
3364                         case "$3" in
3365                         1*) osvers=1 ;;
3366                         2*) osvers=2 ;;
3367                         3*) osvers=3 ;;
3368                         4*) osvers=4 ;;
3369                         *)      osvers="$3" ;;
3370                         esac
3371                         ;;
3372                 ultrix) osname=ultrix
3373                         osvers="$3"
3374                         ;;
3375                 osf1|mls+)      case "$5" in
3376                                 alpha)
3377                                         osname=dec_osf
3378                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3379                                         case "$osvers" in
3380                                         [1-9].[0-9]*) ;;
3381                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3382                                         esac
3383                                         ;;
3384                         hp*)    osname=hp_osf1  ;;
3385                         mips)   osname=mips_osf1 ;;
3386                         esac
3387                         ;;
3388                 # UnixWare 7.1.2 is known as Open UNIX 8
3389                 openunix|unixware) osname=svr5
3390                         osvers="$4"
3391                         ;;
3392                 uts)    osname=uts
3393                         osvers="$3"
3394                         ;;
3395                 vos) osvers="$3"
3396                         ;;
3397                 $2) case "$osname" in
3398                         *isc*) ;;
3399                         *freebsd*) ;;
3400                         svr*)
3401                                 : svr4.x or possibly later
3402                                 case "svr$3" in
3403                                 ${osname}*)
3404                                         osname=svr$3
3405                                         osvers=$4
3406                                         ;;
3407                                 esac
3408                                 case "$osname" in
3409                                 svr4.0)
3410                                         : Check for ESIX
3411                                         if test -f /stand/boot ; then
3412                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3413                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3414                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3415                                                         if test -n "$isesix"; then
3416                                                                 osname=esix4
3417                                                         fi
3418                                                 fi
3419                                         fi
3420                                         ;;
3421                                 esac
3422                                 ;;
3423                         *)      if test -f /etc/systemid; then
3424                                         osname=sco
3425                                         set `echo $3 | $sed 's/\./ /g'` $4
3426                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3427                                                 osvers=$1.$2.$3
3428                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3429                                                 osvers=$1.$2
3430                                         elif $test -f $src/hints/sco_$1.sh; then
3431                                                 osvers=$1
3432                                         fi
3433                                 else
3434                                         case "$osname" in
3435                                         '') : Still unknown.  Probably a generic Sys V.
3436                                                 osname="sysv"
3437                                                 osvers="$3"
3438                                                 ;;
3439                                         esac
3440                                 fi
3441                                 ;;
3442                         esac
3443                         ;;
3444                 *)      case "$osname" in
3445                         '') : Still unknown.  Probably a generic BSD.
3446                                 osname="$1"
3447                                 osvers="$3"
3448                                 ;;
3449                         esac
3450                         ;;
3451                 esac
3452         else
3453                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3454                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3455                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3456                                 osname=news_os
3457                         fi
3458                         $rm -f UU/kernel.what
3459                 elif test -d c:/. -o -n "$is_os2" ; then
3460                         set X $myuname
3461                         osname=os2
3462                         osvers="$5"
3463                 fi
3464         fi
3465
3466         case "$targetarch" in
3467         '') ;;
3468         *)  hostarch=$osname
3469             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3470             osvers=''
3471             ;;
3472         esac
3473
3474         : Now look for a hint file osname_osvers, unless one has been
3475         : specified already.
3476         case "$hintfile" in
3477         ''|' ')
3478                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3479                 : Also try without trailing minor version numbers.
3480                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3481                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3482                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3483                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3484                 case "$file" in
3485                 '') dflt=none ;;
3486                 *)  case "$osvers" in
3487                         '') dflt=$file
3488                                 ;;
3489                         *)  if $test -f $src/hints/$file.sh ; then
3490                                         dflt=$file
3491                                 elif $test -f $src/hints/$xfile.sh ; then
3492                                         dflt=$xfile
3493                                 elif $test -f $src/hints/$xxfile.sh ; then
3494                                         dflt=$xxfile
3495                                 elif $test -f $src/hints/$xxxfile.sh ; then
3496                                         dflt=$xxxfile
3497                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3498                                         dflt=$xxxxfile
3499                                 elif $test -f "$src/hints/${osname}.sh" ; then
3500                                         dflt="${osname}"
3501                                 else
3502                                         dflt=none
3503                                 fi
3504                                 ;;
3505                         esac
3506                         ;;
3507                 esac
3508                 if $test -f Policy.sh ; then
3509                         case "$dflt" in
3510                         *Policy*) ;;
3511                         none) dflt="Policy" ;;
3512                         *) dflt="Policy $dflt" ;;
3513                         esac
3514                 fi
3515                 ;;
3516         *)
3517                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3518                 ;;
3519         esac
3520
3521         if $test -f Policy.sh ; then
3522                 $cat <<EOM
3523
3524 There's also a Policy hint file available, which should make the
3525 site-specific (policy) questions easier to answer.
3526 EOM
3527
3528         fi
3529
3530         $cat <<EOM
3531
3532 You may give one or more space-separated answers, or "none" if appropriate.
3533 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3534 previous run of Configure, you may specify it as well as or instead of
3535 OS-specific hints.  If hints are provided for your OS, you should use them:
3536 although Perl can probably be built without hints on many platforms, using
3537 hints often improve performance and may enable features that Configure can't
3538 set up on its own. If there are no hints that match your OS, specify "none";
3539 DO NOT give a wrong version or a wrong OS.
3540
3541 EOM
3542
3543         rp="Which of these apply, if any?"
3544         . UU/myread
3545         tans=$ans
3546         for file in $tans; do
3547                 if $test X$file = XPolicy -a -f Policy.sh; then
3548                         . Policy.sh
3549                         $cat Policy.sh >> UU/config.sh
3550                 elif $test -f $src/hints/$file.sh; then
3551                         . $src/hints/$file.sh
3552                         $cat $src/hints/$file.sh >> UU/config.sh
3553                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3554                         : nothing
3555                 else
3556                         : Give one chance to correct a possible typo.
3557                         echo "$file.sh does not exist"
3558                         dflt=$file
3559                         rp="hint to use instead?"
3560                         . UU/myread
3561                         for file in $ans; do
3562                                 if $test -f "$src/hints/$file.sh"; then
3563                                         . $src/hints/$file.sh
3564                                         $cat $src/hints/$file.sh >> UU/config.sh
3565                                 elif $test X$ans = X -o X$ans = Xnone ; then
3566                                         : nothing
3567                                 else
3568                                         echo "$file.sh does not exist -- ignored."
3569                                 fi
3570                         done
3571                 fi
3572         done
3573
3574         hint=recommended
3575         : Remember our hint file for later.
3576         if $test -f "$src/hints/$file.sh" ; then
3577                 hintfile="$file"
3578         else
3579                 hintfile=''
3580         fi
3581 fi
3582 cd UU
3583 ;;
3584 *)
3585         echo " "
3586         echo "Fetching default answers from $config_sh..." >&4
3587         tmp_n="$n"
3588         tmp_c="$c"
3589         cd ..
3590         cp $config_sh config.sh 2>/dev/null
3591         chmod +w config.sh
3592         . ./config.sh
3593         cd UU
3594         cp ../config.sh .
3595         n="$tmp_n"
3596         c="$tmp_c"
3597         hint=previous
3598         ;;
3599 esac
3600 test "$override" && . ./optdef.sh
3601
3602 : Restore computed paths
3603 for file in $loclist $trylist; do
3604         eval $file="\$_$file"
3605 done
3606
3607 cat << EOM
3608
3609 Configure uses the operating system name and version to set some defaults.
3610 The default value is probably right if the name rings a bell. Otherwise,
3611 since spelling matters for me, either accept the default or answer "none"
3612 to leave it blank.
3613
3614 EOM
3615 case "$osname" in
3616         ''|' ')
3617                 case "$hintfile" in
3618                 ''|' '|none) dflt=none ;;
3619                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3620                 esac
3621                 ;;
3622         *) dflt="$osname" ;;
3623 esac
3624 rp="Operating system name?"
3625 . ./myread
3626 case "$ans" in
3627 none)  osname='' ;;
3628 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3629 esac
3630 echo " "
3631 case "$osvers" in
3632         ''|' ')
3633                 case "$hintfile" in
3634                 ''|' '|none) dflt=none ;;
3635                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3636                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3637                         case "$dflt" in
3638                         ''|' ') dflt=none ;;
3639                         esac
3640                         ;;
3641                 esac
3642                 ;;
3643         *) dflt="$osvers" ;;
3644 esac
3645 rp="Operating system version?"
3646 . ./myread
3647 case "$ans" in
3648 none)  osvers='' ;;
3649 *) osvers="$ans" ;;
3650 esac
3651
3652
3653 . ./posthint.sh
3654
3655 : who configured the system
3656 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3657 case "$cf_by" in
3658 "")
3659         cf_by=`(logname) 2>/dev/null`
3660         case "$cf_by" in
3661         "")
3662                 cf_by=`(whoami) 2>/dev/null`
3663                 case "$cf_by" in
3664                 "") cf_by=unknown ;;
3665                 esac ;;
3666         esac ;;
3667 esac
3668
3669 : decide how portable to be.  Allow command line overrides.
3670 case "$d_portable" in
3671 "$undef") ;;
3672 *)      d_portable="$define" ;;
3673 esac
3674
3675 : set up shell script to do ~ expansion
3676 cat >filexp <<EOSS
3677 $startsh
3678 : expand filename
3679 case "\$1" in
3680  \~/*|\~)
3681         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3682         ;;
3683  \~*)
3684         if $test -f /bin/csh; then
3685                 /bin/csh -f -c "glob \$1"
3686                 failed=\$?
3687                 echo ""
3688                 exit \$failed
3689         else
3690                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3691                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3692                 if $test ! -d "\$dir"; then
3693                         me=\`basename \$0\`
3694                         echo "\$me: can't locate home directory for: \$name" >&2
3695                         exit 1
3696                 fi
3697                 case "\$1" in
3698                 */*)
3699                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3700                         ;;
3701                 *)
3702                         echo \$dir
3703                         ;;
3704                 esac
3705         fi
3706         ;;
3707 *)
3708         echo \$1
3709         ;;
3710 esac
3711 EOSS
3712 chmod +x filexp
3713 $eunicefix filexp
3714
3715 : now set up to get a file name
3716 cat <<EOS >getfile
3717 $startsh
3718 EOS
3719 cat <<'EOSC' >>getfile
3720 tilde=''
3721 fullpath=''
3722 already=''
3723 skip=''
3724 none_ok=''
3725 exp_file=''
3726 nopath_ok=''
3727 orig_rp="$rp"
3728 orig_dflt="$dflt"
3729 case "$gfpth" in
3730 '') gfpth='.' ;;
3731 esac
3732
3733 case "$fn" in
3734 *\(*)
3735         : getfile will accept an answer from the comma-separated list
3736         : enclosed in parentheses even if it does not meet other criteria.
3737         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3738         fn=`echo $fn | sed 's/(.*)//'`
3739         ;;
3740 esac
3741
3742 case "$fn" in
3743 *:*)
3744         loc_file=`expr $fn : '.*:\(.*\)'`
3745         fn=`expr $fn : '\(.*\):.*'`
3746         ;;
3747 esac
3748
3749 case "$fn" in
3750 *~*) tilde=true;;
3751 esac
3752 case "$fn" in
3753 */*) fullpath=true;;
3754 esac
3755 case "$fn" in
3756 *+*) skip=true;;
3757 esac
3758 case "$fn" in
3759 *n*) none_ok=true;;
3760 esac
3761 case "$fn" in
3762 *e*) exp_file=true;;
3763 esac
3764 case "$fn" in
3765 *p*) nopath_ok=true;;
3766 esac
3767
3768 case "$fn" in
3769 *f*) type='File';;
3770 *d*) type='Directory';;
3771 *l*) type='Locate';;
3772 esac
3773
3774 what="$type"
3775 case "$what" in
3776 Locate) what='File';;
3777 esac
3778
3779 case "$exp_file" in
3780 '')
3781         case "$d_portable" in
3782         "$define") ;;
3783         *) exp_file=true;;
3784         esac
3785         ;;
3786 esac
3787
3788 cd ..
3789 while test "$type"; do
3790         redo=''
3791         rp="$orig_rp"
3792         dflt="$orig_dflt"
3793         case "$tilde" in
3794         true) rp="$rp (~name ok)";;
3795         esac
3796         . UU/myread
3797         if test -f UU/getfile.ok && \
3798                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3799         then
3800                 value="$ans"
3801                 ansexp="$ans"
3802                 break
3803         fi
3804         case "$ans" in
3805         none)
3806                 value=''
3807                 ansexp=''
3808                 case "$none_ok" in
3809                 true) type='';;
3810                 esac
3811                 ;;
3812         *)
3813                 case "$tilde" in
3814                 '') value="$ans"
3815                         ansexp="$ans";;
3816                 *)
3817                         value=`UU/filexp $ans`
3818                         case $? in
3819                         0)
3820                                 if test "$ans" != "$value"; then
3821                                         echo "(That expands to $value on this system.)"
3822                                 fi
3823                                 ;;
3824                         *) value="$ans";;
3825                         esac
3826                         ansexp="$value"
3827                         case "$exp_file" in
3828                         '') value="$ans";;
3829                         esac
3830                         ;;
3831                 esac
3832                 case "$fullpath" in
3833                 true)
3834                         case "$ansexp" in
3835                         /*) value="$ansexp" ;;
3836                         [a-zA-Z]:/*) value="$ansexp" ;;
3837                         *)
3838                                 redo=true
3839                                 case "$already" in
3840                                 true)
3841                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3842                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3843                                         ;;
3844                                 *)
3845                                 echo "Please give a full path name, starting with slash." >&4
3846                                         case "$tilde" in
3847                                         true)
3848                                 echo "Note that using ~name is ok provided it expands well." >&4
3849                                                 already=true
3850                                                 ;;
3851                                         esac
3852                                 esac
3853                                 ;;
3854                         esac
3855                         ;;
3856                 esac
3857                 case "$redo" in
3858                 '')
3859                         case "$type" in
3860                         File)
3861                                 for fp in $gfpth; do
3862                                         if test "X$fp" = X.; then
3863                                             pf="$ansexp"
3864                                         else    
3865                                             pf="$fp/$ansexp"
3866                                         fi
3867                                         if test -f "$pf"; then
3868                                                 type=''
3869                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3870                                         then
3871                                                 echo "($value is not a plain file, but that's ok.)"
3872                                                 type=''
3873                                         fi
3874                                         if test X"$type" = X; then
3875                                             value="$pf"
3876                                             break
3877                                         fi
3878                                 done
3879                                 ;;
3880                         Directory)
3881                                 for fp in $gfpth; do
3882                                         if test "X$fp" = X.; then
3883                                             dir="$ans"
3884                                             direxp="$ansexp"
3885                                         else    
3886                                             dir="$fp/$ansexp"
3887                                             direxp="$fp/$ansexp"
3888                                         fi
3889                                         if test -d "$direxp"; then
3890                                                 type=''
3891                                                 value="$dir"
3892                                                 break
3893                                         fi
3894                                 done
3895                                 ;;
3896                         Locate)
3897                                 if test -d "$ansexp"; then
3898                                         echo "(Looking for $loc_file in directory $value.)"
3899                                         value="$value/$loc_file"
3900                                         ansexp="$ansexp/$loc_file"
3901                                 fi
3902                                 if test -f "$ansexp"; then
3903                                         type=''
3904                                 fi
3905                                 case "$nopath_ok" in
3906                                 true)   case "$value" in
3907                                         */*) ;;
3908                                         *)      echo "Assuming $value will be in people's path."
3909                                                 type=''
3910                                                 ;;
3911                                         esac
3912                                         ;;
3913                                 esac
3914                                 ;;
3915                         esac
3916
3917                         case "$skip" in
3918                         true) type='';
3919                         esac
3920
3921                         case "$type" in
3922                         '') ;;
3923                         *)
3924                                 if test "$fastread" = yes; then
3925                                         dflt=y
3926                                 else
3927                                         dflt=n
3928                                 fi
3929                                 rp="$what $value doesn't exist.  Use that name anyway?"
3930                                 . UU/myread
3931                                 dflt=''
3932                                 case "$ans" in
3933                                 y*) type='';;
3934                                 *) echo " ";;
3935                                 esac
3936                                 ;;
3937                         esac
3938                         ;;
3939                 esac
3940                 ;;
3941         esac
3942 done
3943 cd UU
3944 ans="$value"
3945 rp="$orig_rp"
3946 dflt="$orig_dflt"
3947 rm -f getfile.ok
3948 test "X$gfpthkeep" != Xy && gfpth=""
3949 EOSC
3950
3951 : determine root of directory hierarchy where package will be installed.
3952 case "$prefix" in
3953 '')
3954         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3955         ;;
3956 *?/)
3957         dflt=`echo "$prefix" | sed 's/.$//'`
3958         ;;
3959 *)
3960         dflt="$prefix"
3961         ;;
3962 esac
3963 $cat <<EOM
3964
3965 By default, $package will be installed in $dflt/bin, manual pages
3966 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3967 installation directories. Typically this is something like /usr/local.
3968 If you wish to have binaries under /usr/bin but other parts of the
3969 installation under /usr/local, that's ok: you will be prompted
3970 separately for each of the installation directories, the prefix being
3971 only used to set the defaults.
3972
3973 EOM
3974 fn=d~
3975 rp='Installation prefix to use?'
3976 . ./getfile
3977 oldprefix=''
3978 case "$prefix" in
3979 '') ;;
3980 *)
3981         case "$ans" in
3982         "$prefix") ;;
3983         *) oldprefix="$prefix";;
3984         esac
3985         ;;
3986 esac
3987 prefix="$ans"
3988 prefixexp="$ansexp"
3989
3990 : allow them to override the AFS root
3991 case "$afsroot" in
3992 '')     afsroot=/afs ;;
3993 *)      afsroot=$afsroot ;;
3994 esac
3995
3996 : is AFS running?
3997 echo " "
3998 case "$afs" in
3999 $define|true)   afs=true ;;
4000 $undef|false)   afs=false ;;
4001 *)      if $test -d $afsroot; then
4002                 afs=true
4003         else
4004                 afs=false
4005         fi
4006         ;;
4007 esac
4008 if $afs; then
4009         echo "AFS may be running... I'll be extra cautious then..." >&4
4010 else
4011         echo "AFS does not seem to be running..." >&4
4012 fi
4013
4014 : determine installation prefix for where package is to be installed.
4015 if $afs; then
4016 $cat <<EOM
4017
4018 Since you are running AFS, I need to distinguish the directory in which
4019 files will reside from the directory in which they are installed (and from
4020 which they are presumably copied to the former directory by occult means).
4021
4022 EOM
4023         case "$installprefix" in
4024         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4025         *) dflt="$installprefix";;
4026         esac
4027 else
4028 $cat <<EOM
4029
4030 In some special cases, particularly when building $package for distribution,
4031 it is convenient to distinguish the directory in which files should be
4032 installed from the directory ($prefix) in which they will
4033 eventually reside.  For most users, these two directories are the same.
4034
4035 EOM
4036         case "$installprefix" in
4037         '') dflt=$prefix ;;
4038         *) dflt=$installprefix;;
4039         esac
4040 fi
4041 fn=d~
4042 rp='What installation prefix should I use for installing files?'
4043 . ./getfile
4044 installprefix="$ans"
4045 installprefixexp="$ansexp"
4046
4047 : Perform the prefixexp/installprefixexp correction if necessary
4048 cat <<EOS >installprefix
4049 $startsh
4050 EOS
4051 cat <<'EOSC' >>installprefix
4052 : Change installation prefix, if necessary.
4053 if $test X"$prefix" != X"$installprefix"; then
4054     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4055 else
4056     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4057 fi
4058 EOSC
4059 chmod +x installprefix
4060 $eunicefix installprefix
4061
4062 : Set variables such as privlib and privlibexp from the output of ./getfile
4063 : performing the prefixexp/installprefixexp correction if necessary.
4064 cat <<EOS >setprefixvar
4065 $startsh
4066 EOS
4067 cat <<'EOSC' >>setprefixvar
4068 eval "${prefixvar}=\"\$ans\""
4069 eval "${prefixvar}exp=\"\$ansexp\""
4070 . ./installprefix
4071 EOSC
4072 chmod +x setprefixvar
4073 $eunicefix setprefixvar
4074
4075 : set up the script used to warn in case of inconsistency
4076 cat <<EOS >whoa
4077 $startsh
4078 EOS
4079 cat <<'EOSC' >>whoa
4080 dflt=y
4081 case "$hint" in
4082     recommended)
4083         case "$hintfile" in
4084         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4085                 ;;
4086         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4087                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4088                 ;;
4089         esac
4090         ;;
4091     *)  echo " "
4092         echo "*** WHOA THERE!!! ***" >&4
4093         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4094         ;;
4095 esac
4096 rp="    Keep the $hint value?"
4097 . ./myread
4098 case "$ans" in
4099 y) td=$was; tu=$was;;
4100 esac
4101 EOSC
4102
4103 : function used to set '$1' to '$val'
4104 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4105 case "$val$was" in
4106 $define$undef) . ./whoa; eval "$var=\$td";;
4107 $undef$define) . ./whoa; eval "$var=\$tu";;
4108 *) eval "$var=$val";;
4109 esac'
4110
4111 : get the patchlevel
4112 echo " "
4113 echo "Getting the current patchlevel..." >&4
4114 if $test -r $rsrc/patchlevel.h;then
4115         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4116         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4117         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4118         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4119         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4120         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4121         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4122 else
4123         revision=0
4124         patchlevel=0
4125         subversion=0
4126         api_revision=0
4127         api_version=0
4128         api_subversion=0
4129         perl_patchlevel=0
4130         $echo "(You do not have patchlevel.h.  Eek.)"
4131 fi
4132 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4133 version_patchlevel_string="version $patchlevel subversion $subversion"
4134 case "$perl_patchlevel" in
4135 0|'') ;;
4136 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4137     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4138     ;;
4139 esac
4140
4141 $echo "(You have $package $version_patchlevel_string.)"
4142
4143 case "$osname" in
4144 dos|vms)
4145         : XXX Should be a Configure test for double-dots in filenames.
4146         version=`echo $revision $patchlevel $subversion | \
4147                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4148         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4149                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4150         ;;
4151 *)
4152         version=`echo $revision $patchlevel $subversion | \
4153                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4154         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4155                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4156         ;;
4157 esac
4158 : Special case the 5.005_xx maintenance series, which used 5.005
4159 : without any subversion label as a subdirectory in $sitelib
4160 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4161         api_versionstring='5.005'
4162 fi
4163
4164 : Do we want threads support and if so, what type
4165 case "$usethreads" in
4166 $define|true|[yY]*)     dflt='y';;
4167 *)     # Catch case where user specified ithreads or 5005threads but
4168        # forgot -Dusethreads (A.D. 4/2002)
4169        case "$useithreads$use5005threads" in
4170        *$define*)       dflt='y';;
4171        *)               dflt='n';;
4172        esac
4173        ;;
4174 esac
4175 cat <<EOM
4176
4177 Perl can be built to offer a form of threading support on some systems
4178 To do so, Configure can be run with -Dusethreads.
4179
4180 Note that Perl built with threading support runs slightly slower
4181 and uses slightly more memory than plain Perl.
4182
4183 If this doesn't make any sense to you, just accept the default '$dflt'.
4184 EOM
4185 rp='Build a threading Perl?'
4186 . ./myread
4187 case "$ans" in
4188 y|Y)    val="$define" ;;
4189 *)      val="$undef" ;;
4190 esac
4191 set usethreads
4192 eval $setvar
4193
4194 if $test $patchlevel -lt 9; then
4195     case "$usethreads" in
4196     $define)
4197         : Default to ithreads unless overridden on command line or with
4198         : old config.sh
4199         dflt='y'
4200         case "$use5005threads" in
4201                 $define|true|[yY]*)
4202                         echo "5.005 threads are no longer supported"
4203                         exit 1
4204                 ;;
4205         esac
4206         case "$useithreads" in
4207                 $undef|false|[nN]*) dflt='n';;
4208         esac
4209         rp='Use the newer interpreter-based ithreads?'
4210         . ./myread
4211         case "$ans" in
4212         y|Y)    val="$define" ;;
4213         *)      val="$undef" ;;
4214         esac
4215         set useithreads
4216         eval $setvar
4217         : Now set use5005threads to the opposite value.
4218         case "$useithreads" in
4219         $define) val="$undef" ;;
4220         *) val="$define" ;;
4221         esac
4222         set use5005threads
4223         eval $setvar
4224         ;;
4225     *)
4226         useithreads="$undef"
4227         use5005threads="$undef"
4228         ;;
4229     esac
4230
4231     case "$useithreads$use5005threads" in
4232     "$define$define")
4233         $cat >&4 <<EOM
4234
4235 You cannot have both the ithreads and the 5.005 threads enabled
4236 at the same time.  Disabling the 5.005 threads since they are
4237 much less stable than the ithreads.
4238
4239 EOM
4240         use5005threads="$undef"
4241         ;;
4242     esac
4243
4244 else
4245 : perl-5.9.x and later
4246
4247     if test X"$usethreads" = "X$define"; then
4248         case "$use5005threads" in
4249             $define|true|[yY]*)
4250                 $cat >&4 <<EOM
4251
4252 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4253
4254 EOM
4255             ;;
4256         esac
4257     fi
4258
4259     use5005threads="$undef"
4260     useithreads="$usethreads"
4261 fi
4262
4263 case "$d_oldpthreads" in
4264 '')     : Configure tests would be welcome here.  For now, assume undef.
4265         val="$undef" ;;
4266 *)      val="$d_oldpthreads" ;;
4267 esac
4268 set d_oldpthreads
4269 eval $setvar
4270
4271
4272 : Look for a hint-file generated 'call-back-unit'.  If the
4273 : user has specified that a threading perl is to be built,
4274 : we may need to set or change some other defaults.
4275 if $test -f usethreads.cbu; then
4276     echo "Your platform has some specific hints regarding threaded builds, using them..."
4277     . ./usethreads.cbu
4278 else
4279     case "$usethreads" in
4280         "$define"|true|[yY]*)
4281                 $cat <<EOM
4282 (Your platform does not have any specific hints for threaded builds.
4283  Assuming POSIX threads, then.)
4284 EOM
4285         ;;
4286     esac
4287 fi
4288
4289 : Check if multiplicity is required
4290 cat <<EOM
4291
4292 Perl can be built so that multiple Perl interpreters can coexist
4293 within the same Perl executable.
4294 EOM
4295
4296 case "$useithreads" in
4297 $define)
4298         cat <<EOM
4299 This multiple interpreter support is required for interpreter-based threads.
4300 EOM
4301         val="$define"
4302         ;;
4303 *)      case "$usemultiplicity" in
4304         $define|true|[yY]*)     dflt='y';;
4305         *) dflt='n';;
4306         esac
4307         echo " "
4308         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4309         rp='Build Perl for multiplicity?'
4310         . ./myread
4311         case "$ans" in
4312         y|Y)    val="$define" ;;
4313         *)      val="$undef" ;;
4314         esac
4315         ;;
4316 esac
4317 set usemultiplicity
4318 eval $setvar
4319
4320 : Check if morebits is requested
4321 case "$usemorebits" in
4322 "$define"|true|[yY]*)
4323         use64bitint="$define"
4324         uselongdouble="$define"
4325         usemorebits="$define"
4326         ;;
4327 *)      usemorebits="$undef"
4328         ;;
4329 esac
4330
4331 : Determine the C compiler to be used
4332 echo " "
4333 case "$cc" in
4334 '') dflt=cc;;
4335 *) dflt="$cc";;
4336 esac
4337 rp="Use which C compiler?"
4338 . ./myread
4339 cc="$ans"
4340
4341 : See whether they have no cc but they do have gcc
4342 . ./trygcc
4343 if $test -f cc.cbu; then
4344     . ./cc.cbu
4345 fi
4346 . ./checkcc
4347
4348 : make some quick guesses about what we are up against
4349 echo " "
4350 $echo $n "Hmm...  $c"
4351 echo exit 1 >bsd
4352 echo exit 1 >usg
4353 echo exit 1 >v7
4354 echo exit 1 >osf1
4355 echo exit 1 >eunice
4356 echo exit 1 >xenix
4357 echo exit 1 >venix
4358 echo exit 1 >os2
4359 d_bsd="$undef"
4360 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4361 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4362 then
4363         echo "Looks kind of like an OSF/1 system, but we'll see..."
4364         echo exit 0 >osf1
4365 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4366         xxx=`./loc addbib blurfl $pth`
4367         if $test -f $xxx; then
4368         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4369                 echo exit 0 >bsd
4370                 echo exit 0 >usg
4371         else
4372                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4373                         echo "Looks kind of like an extended USG system, but we'll see..."
4374                 else
4375                         echo "Looks kind of like a USG system, but we'll see..."
4376                 fi
4377                 echo exit 0 >usg
4378         fi
4379 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4380         echo "Looks kind of like a BSD system, but we'll see..."
4381         d_bsd="$define"
4382         echo exit 0 >bsd
4383 else
4384         echo "Looks kind of like a Version 7 system, but we'll see..."
4385         echo exit 0 >v7
4386 fi
4387 case "$eunicefix" in
4388 *unixtovms*)
4389         $cat <<'EOI'
4390 There is, however, a strange, musty smell in the air that reminds me of
4391 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4392 EOI
4393         echo exit 0 >eunice
4394         d_eunice="$define"
4395 : it so happens the Eunice I know will not run shell scripts in Unix format
4396         ;;
4397 *)
4398         echo " "
4399         echo "Congratulations.  You aren't running Eunice."
4400         d_eunice="$undef"
4401         ;;
4402 esac
4403 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4404 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4405 : semicolon as a patch separator
4406 case "$p_" in
4407 :) ;;
4408 *)
4409         $cat <<'EOI'
4410 I have the feeling something is not exactly right, however...don't tell me...
4411 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4412 (Or you may be running DOS with DJGPP.)
4413 EOI
4414         echo exit 0 >os2
4415         ;;
4416 esac
4417 if test -f /xenix; then
4418         echo "Actually, this looks more like a XENIX system..."
4419         echo exit 0 >xenix
4420         d_xenix="$define"
4421 else
4422         echo " "
4423         echo "It's not Xenix..."
4424         d_xenix="$undef"
4425 fi
4426 chmod +x xenix
4427 $eunicefix xenix
4428 if test -f /venix; then
4429         echo "Actually, this looks more like a VENIX system..."
4430         echo exit 0 >venix
4431 else
4432         echo " "
4433         if ./xenix; then
4434                 : null
4435         else
4436                 echo "Nor is it Venix..."
4437         fi
4438 fi
4439 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4440 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4441 $rm -f foo
4442
4443 : Check if we are using GNU gcc and what its version is
4444 echo " "
4445 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4446 $cat >try.c <<EOM
4447 #include <stdio.h>
4448 int main() {
4449 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4450 #ifdef __VERSION__
4451         printf("%s\n", __VERSION__);
4452 #else
4453         printf("%s\n", "1");
4454 #endif
4455 #endif
4456         return(0);
4457 }
4458 EOM
4459 if $cc -o try $ccflags $ldflags try.c; then
4460         gccversion=`$run ./try`
4461         case "$gccversion" in
4462         '') echo "You are not using GNU cc." ;;
4463         *)  echo "You are using GNU cc $gccversion."
4464             ccname=gcc
4465             ;;
4466         esac
4467 else
4468         echo " "
4469         echo "*** WHOA THERE!!! ***" >&4
4470         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4471         case "$knowitall" in
4472         '')
4473         echo "    You'd better start hunting for one and let me know about it." >&4
4474                 exit 1
4475                 ;;
4476         esac
4477 fi
4478 $rm -f try try.*
4479 case "$gccversion" in
4480 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4481 esac
4482 case "$gccversion" in
4483 '') gccosandvers='' ;;
4484 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4485    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4486    gccshortvers=''
4487    case "$gccosandvers" in
4488    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4489    $osname$osvers) ;; # looking good
4490    $osname*) cat <<EOM >&4
4491
4492 *** WHOA THERE!!! ***
4493
4494     Your gcc has not been compiled for the exact release of
4495     your operating system ($gccosandvers versus $osname$osvers).
4496
4497     In general it is a good idea to keep gcc synchronized with
4498     the operating system because otherwise serious problems
4499     may ensue when trying to compile software, like Perl.
4500
4501     I'm trying to be optimistic here, though, and will continue.
4502     If later during the configuration and build icky compilation
4503     problems appear (headerfile conflicts being the most common
4504     manifestation), I suggest reinstalling the gcc to match
4505     your operating system release.
4506
4507 EOM
4508       ;;
4509    *) gccosandvers='' ;; # failed to parse, better be silent
4510    esac
4511    ;;
4512 esac
4513 case "$ccname" in
4514 '') ccname="$cc" ;;
4515 esac
4516
4517 # gcc 3.* complain about adding -Idirectories that they already know about,
4518 # so we will take those off from locincpth.
4519 case "$gccversion" in
4520 3*)
4521     echo "main(){}">try.c
4522     for incdir in $locincpth; do
4523        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4524              grep '^c[cp]p*[01]: warning: changing search order '`
4525        if test "X$warn" != X; then
4526            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4527        fi
4528     done
4529     $rm -f try try.*
4530 esac
4531
4532 : see how we invoke the C preprocessor
4533 echo " "
4534 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4535 cat <<'EOT' >testcpp.c
4536 #define ABC abc
4537 #define XYZ xyz
4538 ABC.XYZ
4539 EOT
4540 cd ..
4541 if test ! -f cppstdin; then
4542         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4543                 # AIX cc -E doesn't show the absolute headerfile
4544                 # locations but we'll cheat by using the -M flag.
4545                 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
4546         else
4547                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4548         fi
4549 else
4550         echo "Keeping your $hint cppstdin wrapper."
4551 fi
4552 chmod 755 cppstdin
4553 wrapper=`pwd`/cppstdin
4554 ok='false'
4555 cd UU
4556
4557 if $test "X$cppstdin" != "X" && \
4558         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4559         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4560 then
4561         echo "You used to use $cppstdin $cppminus so we'll use that again."
4562         case "$cpprun" in
4563         '') echo "But let's see if we can live without a wrapper..." ;;
4564         *)
4565                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4566                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4567                 then
4568                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4569                         ok='true'
4570                 else
4571                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4572                 fi
4573                 ;;
4574         esac
4575 else
4576         case "$cppstdin" in
4577         '') ;;
4578         *)
4579                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4580                 ;;
4581         esac
4582 fi
4583
4584 if $ok; then
4585         : nothing
4586 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4587         $cc -E <testcpp.c >testcpp.out 2>&1; \
4588         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4589         echo "Yup, it does."
4590         x_cpp="$cc $cppflags -E"
4591         x_minus='';
4592 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4593         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4594         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4595         echo "Yup, it does."
4596         x_cpp="$cc $cppflags -E"
4597         x_minus='-';
4598 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4599         $cc -P <testcpp.c >testcpp.out 2>&1; \
4600         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4601         echo "Yipee, that works!"
4602         x_cpp="$cc $cppflags -P"
4603         x_minus='';
4604 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4605         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4606         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4607         echo "At long last!"
4608         x_cpp="$cc $cppflags -P"
4609         x_minus='-';
4610 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4611         $cpp <testcpp.c >testcpp.out 2>&1; \
4612         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4613         echo "It works!"
4614         x_cpp="$cpp $cppflags"
4615         x_minus='';
4616 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4617         $cpp - <testcpp.c >testcpp.out 2>&1; \
4618         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4619         echo "Hooray, it works!  I was beginning to wonder."
4620         x_cpp="$cpp $cppflags"
4621         x_minus='-';
4622 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4623         $wrapper <testcpp.c >testcpp.out 2>&1; \
4624         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4625         x_cpp="$wrapper"
4626         x_minus=''
4627         echo "Eureka!"
4628 else
4629         dflt=''
4630         rp="No dice.  I can't find a C preprocessor.  Name one:"
4631         . ./myread
4632         x_cpp="$ans"
4633         x_minus=''
4634         $x_cpp <testcpp.c >testcpp.out 2>&1
4635         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4636                 echo "OK, that will do." >&4
4637         else
4638 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4639                 exit 1
4640         fi
4641 fi
4642
4643 case "$ok" in
4644 false)
4645         cppstdin="$x_cpp"
4646         cppminus="$x_minus"
4647         cpprun="$x_cpp"
4648         cpplast="$x_minus"
4649         set X $x_cpp
4650         shift
4651         case "$1" in
4652         "$cpp")
4653                 echo "Perhaps can we force $cc -E using a wrapper..."
4654                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4655                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4656                 then
4657                         echo "Yup, we can."
4658                         cppstdin="$wrapper"
4659                         cppminus='';
4660                 else
4661                         echo "Nope, we'll have to live without it..."
4662                 fi
4663                 ;;
4664         esac
4665         case "$cpprun" in
4666         "$wrapper")
4667                 cpprun=''
4668                 cpplast=''
4669                 ;;
4670         esac
4671         ;;
4672 esac
4673
4674 case "$cppstdin" in
4675 "$wrapper"|'cppstdin') ;;
4676 *) $rm -f $wrapper;;
4677 esac
4678 $rm -f testcpp.c testcpp.out
4679
4680 case "$osname" in
4681 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4682 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4683 *)   cppfilter='' ;;
4684 esac
4685
4686 # If using gcc or clang, we can get better values for libpth, incpth
4687 # and usrinc directly from the compiler.
4688 # Note that ccname for clang is also gcc.
4689 case "$ccname" in
4690     gcc)
4691         $echo 'extern int foo;' > try.c
4692         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4693         shift
4694         if $test $# -gt 0; then
4695             incpth="$incpth $*"
4696             incpth="`$echo $incpth|$sed 's/^ //'`"
4697             for i in $*; do
4698                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4699                 if $test -d $j; then
4700                     libpth="$libpth $j"
4701                 fi
4702             done
4703             libpth="`$echo $libpth|$sed 's/^ //'`"
4704             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4705                 if $test -d $xxx; then
4706                     case " $libpth " in
4707                     *" $xxx "*) ;;
4708                     *) libpth="$libpth $xxx";;
4709                     esac
4710                 fi
4711             done
4712         fi
4713         $rm -f try.c
4714         case "$usrinc" in
4715         '') for i in $incpth; do
4716                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4717                     usrinc="$i"
4718                     break
4719                 fi
4720             done
4721             ;;
4722         esac
4723         
4724         case "$usecrosscompile" in
4725         $define|true|[yY]*)
4726             case "$incpth" in
4727                 '') echo "Incpth not defined." >&4; croak=y ;;
4728                 *)  echo "Using incpth '$incpth'." >&4 ;;
4729             esac
4730             case "$libpth" in
4731                 '') echo "Libpth not defined." >&4; croak=y ;;
4732                 *)  echo "Using libpth '$libpth'." >&4 ;;
4733             esac
4734             case "$usrinc" in
4735                 '') echo "Usrinc not defined." >&4; croak=y ;;
4736                 *)  echo "Using usrinc $usrinc." >&4 ;;
4737             esac
4738             case "$croak" in
4739                 y) 
4740                 if test "X$sysroot" = X; then
4741                     echo "Cannot continue, aborting." >&4; exit 1
4742                 else
4743                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4744                 fi
4745                 ;;
4746             esac
4747             ;;
4748         esac
4749     ;;
4750 esac
4751
4752 : What should the include directory be ?
4753 : Use sysroot if set, so findhdr looks in the right place.
4754 echo " "
4755 $echo $n "Hmm...  $c"
4756 dflt="$sysroot/usr/include"
4757 incpath=''
4758 mips_type=''
4759 if $test -f /bin/mips && /bin/mips; then
4760         echo "Looks like a MIPS system..."
4761         $cat >usr.c <<'EOCP'
4762 #ifdef SYSTYPE_BSD43
4763 /bsd43
4764 #endif
4765 EOCP
4766         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4767                 dflt='/bsd43/usr/include'
4768                 incpath='/bsd43'
4769                 mips_type='BSD 4.3'
4770         else
4771                 mips_type='System V'
4772         fi
4773         $rm -f usr.c usr.out
4774         echo "and you're compiling with the $mips_type compiler and libraries."
4775         xxx_prompt=y
4776         echo "exit 0" >mips
4777 else
4778         echo "Doesn't look like a MIPS system."
4779         xxx_prompt=n
4780         echo "exit 1" >mips
4781 fi
4782 chmod +x mips
4783 $eunicefix mips
4784 case "$usrinc" in
4785 '') ;;
4786 *) dflt="$usrinc";;
4787 esac
4788 case "$xxx_prompt" in
4789 y)      fn=d/
4790         echo " "
4791         rp='Where are the include files you want to use?'
4792         . ./getfile
4793         usrinc="$ans"
4794         ;;
4795 *)      usrinc="$dflt"
4796         ;;
4797 esac
4798
4799 : Default value for incpth is just usrinc
4800 case "$incpth" in
4801 '') incpth="$usrinc";;
4802 esac
4803
4804 : Set private lib path
4805 case "$plibpth" in
4806 '') if ./mips; then
4807                 plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4808         fi;;
4809 esac
4810 case "$libpth" in
4811 ' ') dlist='';;
4812 '') dlist="$loclibpth $plibpth $glibpth";;
4813 *) dlist="$libpth";;
4814 esac
4815
4816 : Now check and see which directories actually exist, avoiding duplicates
4817 for xxx in $dlist
4818 do
4819     if $test -d $xxx; then
4820                 case " $libpth " in
4821                 *" $xxx "*) ;;
4822                 *) libpth="$libpth $xxx";;
4823                 esac
4824     fi
4825 done
4826 $cat <<'EOM'
4827
4828 Some systems have incompatible or broken versions of libraries.  Among
4829 the directories listed in the question below, please remove any you
4830 know not to be holding relevant libraries, and add any that are needed.
4831 Say "none" for none.
4832
4833 EOM
4834
4835 if test "X$sysroot" != X; then
4836   $cat <<EOM
4837 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4838
4839 EOM
4840 fi
4841
4842 case "$libpth" in
4843 '') dflt='none';;
4844 *)
4845         set X $libpth
4846         shift
4847         dflt=${1+"$@"}
4848         ;;
4849 esac
4850 rp="Directories to use for library searches?"
4851 . ./myread
4852 case "$ans" in
4853 none) libpth=' ';;
4854 *) libpth="$ans";;
4855 esac
4856
4857 : compute shared library extension
4858 case "$so" in
4859 '')
4860         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4861                 dflt='sl'
4862         else
4863                 dflt='so'
4864         fi
4865         ;;
4866 *) dflt="$so";;
4867 esac
4868 $cat <<EOM
4869
4870 On some systems, shared libraries may be available.  Answer 'none' if
4871 you want to suppress searching of shared libraries for the remainder
4872 of this configuration.
4873
4874 EOM
4875 rp='What is the file extension used for shared libraries?'
4876 . ./myread
4877 so="$ans"
4878
4879 : Does target system insist that shared library basenames are unique
4880 $cat << EOM
4881
4882 Some dynamic loaders assume that the *basename* of shared
4883 library filenames are globally unique.
4884 We'll default this to undef as we assume your system is not this
4885 weird. Set to defined if you're on one of them.
4886
4887 EOM
4888
4889 dflt='n'
4890 rp='Make shared library basenames unique?'
4891 . ./myread
4892 case "$ans" in
4893 y|Y)    val="$define" ;;
4894 *)      val="$undef"  ;;
4895 esac
4896 set d_libname_unique
4897 eval $setvar
4898
4899 : Define several unixisms.
4900 : Hints files or command line option can be used to override them.
4901 : The convoluted testing is in case hints files set either the old
4902 : or the new name.
4903 case "$_exe" in
4904 '')     case "$exe_ext" in
4905         '')     ;;
4906         *)      _exe="$exe_ext" ;;
4907         esac
4908         ;;
4909 esac
4910 case "$_a" in
4911 '')     case "$lib_ext" in
4912     '') _a='.a';;
4913         *)      _a="$lib_ext" ;;
4914         esac
4915         ;;
4916 esac
4917 case "$_o" in
4918 '') case "$obj_ext" in
4919         '')     _o='.o';;
4920         *)      _o="$obj_ext";;
4921         esac
4922         ;;
4923 esac
4924 case "$p_" in
4925 '') case "$path_sep" in
4926         '')     p_=':';;
4927         *)      p_="$path_sep";;
4928         esac
4929         ;;
4930 esac
4931 exe_ext=$_exe
4932 lib_ext=$_a
4933 obj_ext=$_o
4934 path_sep=$p_
4935
4936 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4937
4938 : Which makefile gets called first.  This is used by make depend.
4939 case "$firstmakefile" in
4940 '') firstmakefile='makefile';;
4941 esac
4942
4943 : Check is we will use socks
4944 case "$usesocks" in
4945 $define|true|[yY]*)     dflt='y';;
4946 *) dflt='n';;
4947 esac
4948 cat <<EOM
4949
4950 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4951 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4952 to use the PerlIO abstraction layer, this will be implicitly selected.
4953
4954 If this doesn't make any sense to you, just accept the default '$dflt'.
4955 EOM
4956 rp='Build Perl for SOCKS?'
4957 . ./myread
4958 case "$ans" in
4959 y|Y)    val="$define" ;;
4960 *)      val="$undef" ;;
4961 esac
4962 set usesocks
4963 eval $setvar
4964
4965 : Check for uselongdouble support
4966 case "$ccflags" in
4967 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4968 esac
4969
4970 case "$uselongdouble" in
4971 $define|true|[yY]*)     dflt='y';;
4972 *) dflt='n';;
4973 esac
4974 cat <<EOM
4975
4976 Perl can be built to take advantage of long doubles which
4977 (if available) may give more accuracy and range for floating point numbers.
4978
4979 If this doesn't make any sense to you, just accept the default '$dflt'.
4980 EOM
4981 rp='Try to use long doubles if available?'
4982 . ./myread
4983 case "$ans" in
4984 y|Y)    val="$define"   ;;
4985 *)      val="$undef"    ;;
4986 esac
4987 set uselongdouble
4988 eval $setvar
4989
4990 case "$uselongdouble" in
4991 true|[yY]*) uselongdouble="$define" ;;
4992 esac
4993
4994 : Look for a hint-file generated 'call-back-unit'.  If the
4995 : user has specified that long doubles should be used,
4996 : we may need to set or change some other defaults.
4997 if $test -f uselongdouble.cbu; then
4998     echo "Your platform has some specific hints regarding long doubles, using them..."
4999     . ./uselongdouble.cbu
5000 else
5001     case "$uselongdouble" in
5002         $define)
5003                 $cat <<EOM
5004 (Your platform does not have any specific hints for long doubles.)
5005 EOM
5006         ;;
5007     esac
5008 fi
5009
5010 : Looking for optional libraries
5011 echo " "
5012 echo "Checking for optional libraries..." >&4
5013 case "$libs" in
5014 ' '|'') dflt='';;
5015 *) dflt="$libs";;
5016 esac
5017 case "$libswanted" in
5018 '') libswanted='c_s';;
5019 esac
5020 case "$usesocks" in
5021 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5022 esac
5023 libsfound=''
5024 libsfiles=''
5025 libsdirs=''
5026 libspath=''
5027 for thisdir in $libpth $xlibpth; do
5028   test -d $thisdir && libspath="$libspath $thisdir"
5029 done
5030 for thislib in $libswanted; do
5031         for thisdir in $libspath; do
5032             xxx=''
5033             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5034                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5035                 $test -f "$xxx" && eval $libscheck
5036                 $test -f "$xxx" && libstyle=shared
5037             fi
5038             if test ! -f "$xxx"; then
5039                 xxx=$thisdir/lib$thislib.$so
5040                 $test -f "$xxx" && eval $libscheck
5041                 $test -f "$xxx" && libstyle=shared
5042             fi
5043             if test ! -f "$xxx"; then
5044                 xxx=$thisdir/lib$thislib$_a
5045                 $test -f "$xxx" && eval $libscheck
5046                 $test -f "$xxx" && libstyle=static
5047             fi
5048             if test ! -f "$xxx"; then
5049                 xxx=$thisdir/$thislib$_a
5050                 $test -f "$xxx" && eval $libscheck
5051                 $test -f "$xxx" && libstyle=static
5052             fi
5053             if test ! -f "$xxx"; then
5054                 xxx=$thisdir/lib${thislib}_s$_a
5055                 $test -f "$xxx" && eval $libscheck
5056                 $test -f "$xxx" && libstyle=static
5057                 $test -f "$xxx" && thislib=${thislib}_s
5058             fi
5059             if test ! -f "$xxx"; then
5060                 xxx=$thisdir/Slib$thislib$_a
5061                 $test -f "$xxx" && eval $libscheck
5062                 $test -f "$xxx" && libstyle=static
5063             fi
5064             if $test -f "$xxx"; then
5065                 case "$libstyle" in
5066                 shared) echo "Found -l$thislib (shared)." ;;
5067                 static) echo "Found -l$thislib." ;;
5068                 *)      echo "Found -l$thislib ($libstyle)." ;;
5069                 esac
5070                 case " $dflt " in
5071                 *"-l$thislib "*);;
5072                 *) dflt="$dflt -l$thislib"
5073                    libsfound="$libsfound $xxx"
5074                    yyy=`basename $xxx`
5075                    libsfiles="$libsfiles $yyy"
5076                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5077                    case " $libsdirs " in
5078                    *" $yyy "*) ;;
5079                    *) libsdirs="$libsdirs $yyy" ;;
5080                    esac
5081                    ;;
5082                 esac
5083                 break
5084             fi
5085         done
5086         if $test ! -f "$xxx"; then
5087             echo "No -l$thislib."
5088         fi
5089 done
5090 set X $dflt
5091 shift
5092 dflt="$*"
5093 case "$libs" in
5094 '') dflt="$dflt";;
5095 *) dflt="$libs";;
5096 esac
5097 case "$dflt" in
5098 ' '|'') dflt='none';;
5099 esac
5100
5101 $cat <<EOM
5102
5103 In order to compile $package on your machine, a number of libraries
5104 are usually needed.  Include any other special libraries here as well.
5105 Say "none" for none.  The default list is almost always right.
5106 EOM
5107
5108 echo " "
5109 rp="What libraries to use?"
5110 . ./myread
5111 case "$ans" in
5112 none) libs=' ';;
5113 *) libs="$ans";;
5114 esac
5115
5116 : determine optimization, if desired, or use for debug flag also
5117 case "$optimize" in
5118 ' '|$undef) dflt='none';;
5119 '') dflt='-O';;
5120 *) dflt="$optimize";;
5121 esac
5122 $cat <<EOH
5123
5124 By default, $package compiles with the -O flag to use the optimizer.
5125 Alternately, you might want to use the symbolic debugger, which uses
5126 the -g flag (on traditional Unix systems).  Either flag can be
5127 specified here.  To use neither flag, specify the word "none".
5128
5129 EOH
5130 rp="What optimizer/debugger flag should be used?"
5131 . ./myread
5132 optimize="$ans"
5133 case "$optimize" in
5134 'none') optimize=" ";;
5135 esac
5136
5137 : Check what DEBUGGING is required from the command line
5138 : -DEBUGGING      or -DDEBUGGING or
5139 : -DEBUGGING=both                       = -g + -DDEBUGGING
5140 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5141 : -DEBUGGING=none or -UDEBUGGING        =
5142 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5143 case "$EBUGGING" in
5144 '')     ;;
5145 *)      DEBUGGING=$EBUGGING ;;
5146 esac
5147
5148 case "$DEBUGGING" in
5149 -g|both|$define)
5150     case "$optimize" in
5151         *-g*) ;;
5152         *)    optimize="$optimize -g" ;;
5153     esac ;;
5154 none|$undef)
5155     case "$optimize" in
5156         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5157                 shift
5158                 optimize="$*"
5159                 ;;
5160     esac ;;
5161 esac
5162
5163 dflt=''
5164 case "$DEBUGGING" in
5165 both|$define) dflt='-DDEBUGGING'
5166 esac
5167
5168 : argument order is deliberate, as the flag will start with - which set could
5169 : think is an option
5170 checkccflag='check=$1; flag=$2; callback=$3;
5171 echo " ";
5172 echo "Checking if your compiler accepts $flag" 2>&1;
5173 echo "int main(void) { return 0; }" > gcctest.c;
5174 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5175     echo "Yes, it does." 2>&1;
5176     if $test -s gcctest.out ; then
5177         echo "But your platform does not like it:";
5178         cat gcctest.out;
5179     else
5180         case "$ccflags" in
5181         *$check*)
5182             echo "Leaving current flags $ccflags alone." 2>&1
5183             ;;
5184         *) dflt="$dflt $flag";
5185             eval $callback
5186             ;;
5187         esac
5188     fi
5189 else
5190     echo "Nope, it does not, but that is ok." 2>&1;
5191 fi
5192 '
5193
5194 : We will not override a previous value, but we might want to
5195 : augment a hint file
5196 case "$hint" in
5197 default|recommended)
5198         case "$gccversion" in
5199         1*) dflt="$dflt -fpcc-struct-return" ;;
5200         esac
5201         case "$optimize:$DEBUGGING" in
5202         *-g*:old) dflt="$dflt -DDEBUGGING";;
5203         esac
5204         case "$gccversion" in
5205         2*) if $test -d /etc/conf/kconfig.d &&
5206                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5207                 then
5208                         # Interactive Systems (ISC) POSIX mode.
5209                         dflt="$dflt -posix"
5210                 fi
5211                 ;;
5212         esac
5213         case "$gccversion" in
5214         1*) ;;
5215         2.[0-8]*) ;;
5216         ?*)     set strict-aliasing -fno-strict-aliasing
5217                 eval $checkccflag
5218                 ;;
5219         esac
5220         # For gcc, adding -pipe speeds up compilations for some, but apparently
5221         # some assemblers can't read from stdin.  (It also slows down compilations
5222         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5223         case "$gccversion" in
5224         ?*)     set pipe -pipe
5225                 eval $checkccflag
5226                 ;;
5227         esac
5228
5229         # on x86_64 (at least) we require an extra library (libssp) in the
5230         # link command line. This library is not named, so I infer that it is
5231         # an implementation detail that may change. Hence the safest approach
5232         # is to add the flag to the flags passed to the compiler at link time,
5233         # as that way the compiler can do the right implementation dependant
5234         # thing. (NWC)
5235         case "$gccversion" in
5236         ?*)     set stack-protector -fstack-protector
5237                 eval $checkccflag
5238                 ;;
5239         esac
5240         ;;
5241 esac
5242
5243 case "$mips_type" in
5244 *BSD*|'') inclwanted="$locincpth $usrinc";;
5245 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5246 esac
5247 for thisincl in $inclwanted; do
5248         if $test -d $thisincl; then
5249                 if $test x$thisincl != x$usrinc; then
5250                         case "$dflt" in
5251                         *" -I$thisincl "*);;
5252                         *) dflt="$dflt -I$thisincl ";;
5253                         esac
5254                 fi
5255         fi
5256 done
5257
5258 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5259         xxx=true;
5260 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5261         xxx=true;
5262 else
5263         xxx=false;
5264 fi;
5265 if $xxx; then
5266         case "$dflt" in
5267         *$2*);;
5268         *) dflt="$dflt -D$2";;
5269         esac;
5270 fi'
5271
5272 set signal.h LANGUAGE_C; eval $inctest
5273
5274 case "$usesocks" in
5275 $define)
5276         ccflags="$ccflags -DSOCKS"
5277         ;;
5278 esac
5279
5280 case "$hint" in
5281 default|recommended) dflt="$ccflags $dflt" ;;
5282 *) dflt="$ccflags";;
5283 esac
5284
5285 case "$dflt" in
5286 ''|' ') dflt=none;;
5287 esac
5288
5289 $cat <<EOH
5290
5291 Your C compiler may want other flags.  For this question you should include
5292 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5293 but you should NOT include libraries or ld flags like -lwhatever.  If you
5294 want $package to honor its debug switch, you should include -DDEBUGGING here.
5295 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5296
5297 To use no flags, specify the word "none".
5298
5299 EOH
5300 set X $dflt
5301 shift
5302 dflt=${1+"$@"}
5303 rp="Any additional cc flags?"
5304 . ./myread
5305 case "$ans" in
5306 none) ccflags='';;
5307 *) ccflags="$ans";;
5308 esac
5309
5310 : the following weeds options from ccflags that are of no interest to cpp
5311 case "$cppflags" in
5312 '') cppflags="$ccflags" ;;
5313 *)  cppflags="$cppflags $ccflags" ;;
5314 esac
5315 case "$gccversion" in
5316 1*) cppflags="$cppflags -D__GNUC__"
5317 esac
5318 case "$mips_type" in
5319 '');;
5320 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5321 esac
5322 case "$cppflags" in
5323 '');;
5324 *)
5325         echo " "
5326         echo "Let me guess what the preprocessor flags are..." >&4
5327         set X $cppflags
5328         shift
5329         cppflags=''
5330         $cat >cpp.c <<'EOM'
5331 #define BLURFL foo
5332
5333 BLURFL xx LFRULB
5334 EOM
5335         previous=''
5336         for flag in $*
5337         do
5338                 case "$flag" in
5339                 -*) ftry="$flag";;
5340                 *) ftry="$previous $flag";;
5341                 esac
5342                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5343                         >cpp1.out 2>/dev/null && \
5344                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5345                         >cpp2.out 2>/dev/null && \
5346                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5347                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5348                 then
5349                         cppflags="$cppflags $ftry"
5350                         previous=''
5351                 else
5352                         previous="$flag"
5353                 fi
5354         done
5355         set X $cppflags
5356         shift
5357         cppflags=${1+"$@"}
5358         case "$cppflags" in
5359         *-*)  echo "They appear to be: $cppflags";;
5360         esac
5361         $rm -f cpp.c cpp?.out
5362         ;;
5363 esac
5364
5365 : flags used in final linking phase
5366 case "$ldflags" in
5367 '') if ./venix; then
5368                 dflt='-i -z'
5369         else
5370                 dflt=''
5371         fi
5372         case "$ccflags" in
5373         *-posix*) dflt="$dflt -posix" ;;
5374         esac
5375         ;;
5376 *) dflt="$ldflags";;
5377 esac
5378 # See note above about -fstack-protector
5379 case "$ccflags" in
5380 *-fstack-protector*)
5381         case "$dflt" in
5382         *-fstack-protector*) ;; # Don't add it again
5383         *) dflt="$dflt -fstack-protector" ;;
5384         esac
5385         ;;
5386 esac
5387
5388 : Try to guess additional flags to pick up local libraries.
5389 for thislibdir in $libpth; do
5390         case " $loclibpth " in
5391         *" $thislibdir "*)
5392                 case "$dflt " in
5393                 *"-L$thislibdir "*) ;;
5394                 *)  dflt="$dflt -L$thislibdir" ;;
5395                 esac
5396                 ;;
5397         esac
5398 done
5399
5400 case "$dflt" in
5401 '') dflt='none' ;;
5402 esac
5403
5404 $cat <<EOH
5405
5406 Your C linker may need flags.  For this question you should
5407 include -L/whatever and any other flags used by the C linker, but you
5408 should NOT include libraries like -lwhatever.
5409
5410 Make sure you include the appropriate -L/path flags if your C linker
5411 does not normally search all of the directories you specified above,
5412 namely
5413         $libpth
5414 To use no flags, specify the word "none".
5415
5416 EOH
5417
5418 rp="Any additional ld flags (NOT including libraries)?"
5419 . ./myread
5420 case "$ans" in
5421 none) ldflags='';;
5422 *) ldflags="$ans";;
5423 esac
5424 rmlist="$rmlist pdp11"
5425
5426 : coherency check
5427 echo " "
5428 echo "Checking your choice of C compiler and flags for coherency..." >&4
5429 $cat > try.c <<'EOF'
5430 #include <stdio.h>
5431 int main() { printf("Ok\n"); return(0); }
5432 EOF
5433 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5434 shift
5435 $cat >try.msg <<'EOM'
5436 I've tried to compile and run the following simple program:
5437
5438 EOM
5439 $cat try.c >> try.msg
5440
5441 $cat >> try.msg <<EOM
5442
5443 I used the command:
5444
5445         $*
5446         $run ./try
5447
5448 and I got the following output:
5449
5450 EOM
5451 dflt=y
5452 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5453         if $sh -c "$run ./try " >>try.msg 2>&1; then
5454                 xxx=`$run ./try`
5455                 case "$xxx" in
5456                 "Ok") dflt=n ;;
5457                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5458                 esac
5459         else
5460                 echo "The program compiled OK, but exited with status $?." >>try.msg
5461                 rp="You have a problem.  Shall I abort Configure"
5462                 dflt=y
5463         fi
5464 else
5465         echo "I can't compile the test program." >>try.msg
5466         rp="You have a BIG problem.  Shall I abort Configure"
5467         dflt=y
5468 fi
5469 case "$dflt" in
5470 y)
5471         $cat try.msg >&4
5472         case "$knowitall" in
5473         '')
5474                 echo "(The supplied flags or libraries might be incorrect.)"
5475                 ;;
5476         *) dflt=n;;
5477         esac
5478         echo " "
5479         . ./myread
5480         case "$ans" in
5481         n*|N*) ;;
5482         *)      echo "Ok.  Stopping Configure." >&4
5483                 exit 1
5484                 ;;
5485         esac
5486         ;;
5487 n) echo "OK, that should do.";;
5488 esac
5489 $rm_try gcctest gcctest.out
5490
5491 : define a shorthand compile call
5492 compile='
5493 mc_file=$1;
5494 shift;
5495 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5496 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5497 exit 1;
5498 fi;
5499 esac;
5500 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5501 : define a shorthand compile call for compilations that should be ok.
5502 compile_ok='
5503 mc_file=$1;
5504 shift;
5505 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5506
5507 : determine filename position in cpp output
5508 echo " "
5509 echo "Computing filename position in cpp output for #include directives..." >&4
5510 case "$osname" in
5511 vos) testaccess=-e ;;
5512 *)   testaccess=-r ;;
5513 esac
5514 echo '#include <stdio.h>' > foo.c
5515 $cat >fieldn <<EOF
5516 $startsh
5517 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5518 $grep '^[       ]*#.*stdio\.h' | \
5519 while read cline; do
5520         pos=1
5521         set \$cline
5522         while $test \$# -gt 0; do
5523                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5524                         echo "\$pos"
5525                         exit 0
5526                 fi
5527                 shift
5528                 pos=\`expr \$pos + 1\`
5529         done
5530 done
5531 EOF
5532 chmod +x fieldn
5533 fieldn=`./fieldn`
5534 $rm -f foo.c fieldn
5535 case $fieldn in
5536 '') pos='???';;
5537 1) pos=first;;
5538 2) pos=second;;
5539 3) pos=third;;
5540 *) pos="${fieldn}th";;
5541 esac
5542 echo "Your cpp writes the filename in the $pos field of the line."
5543
5544 : locate header file
5545 $cat >findhdr <<EOF
5546 $startsh
5547 wanted=\$1
5548 name=''
5549 for usrincdir in $incpth
5550 do
5551         if test -f \$usrincdir/\$wanted; then
5552                 echo "\$usrincdir/\$wanted"
5553                 exit 0
5554         fi
5555 done
5556 awkprg='{ print \$$fieldn }'
5557 echo "#include <\$wanted>" > foo\$\$.c
5558 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5559 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5560 while read cline; do
5561         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5562         case "\$name" in
5563         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5564         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5565         *) exit 2;;
5566         esac;
5567 done;
5568 #
5569 # status = 0: grep returned 0 lines, case statement not executed
5570 # status = 1: headerfile found
5571 # status = 2: while loop executed, no headerfile found
5572 #
5573 status=\$?
5574 $rm -f foo\$\$.c;
5575 if test \$status -eq 1; then
5576         exit 0;
5577 fi
5578 exit 1
5579 EOF
5580 chmod +x findhdr
5581
5582 : define an alternate in-header-list? function
5583 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5584 cont=true; xxf="echo \"<\$1> found.\" >&4";
5585 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5586 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5587 esac;
5588 case $# in 4) instead=instead;; *) instead="at last";; esac;
5589 while $test "$cont"; do
5590         xxx=`./findhdr $1`
5591         var=$2; eval "was=\$$2";
5592         if $test "$xxx" && $test -r "$xxx";
5593         then eval $xxf;
5594         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5595                 cont="";
5596         else eval $xxnf;
5597         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5598         set $yyy; shift; shift; yyy=$@;
5599         case $# in 0) cont="";;
5600         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5601                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5602         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5603                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5604         esac;
5605 done;
5606 while $test "$yyy";
5607 do set $yyy; var=$2; eval "was=\$$2";
5608         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5609         set $yyy; shift; shift; yyy=$@;
5610 done'
5611
5612 : see if stdlib is available
5613 set stdlib.h i_stdlib
5614 eval $inhdr
5615
5616 : check for lengths of integral types
5617 echo " "
5618 case "$intsize" in
5619 '')
5620         echo "Checking to see how big your integers are..." >&4
5621         $cat >try.c <<EOCP
5622 #include <stdio.h>
5623 #$i_stdlib I_STDLIB
5624 #ifdef I_STDLIB
5625 #include <stdlib.h>
5626 #endif
5627 int main()
5628 {
5629         printf("intsize=%d;\n", (int)sizeof(int));
5630         printf("longsize=%d;\n", (int)sizeof(long));
5631         printf("shortsize=%d;\n", (int)sizeof(short));
5632         exit(0);
5633 }
5634 EOCP
5635         set try
5636         if eval $compile_ok && $run ./try > /dev/null; then
5637                 eval `$run ./try`
5638                 echo "Your integers are $intsize bytes long."
5639                 echo "Your long integers are $longsize bytes long."
5640                 echo "Your short integers are $shortsize bytes long."
5641         else
5642                 $cat >&4 <<EOM
5643 !
5644 Help! I can't compile and run the intsize test program: please enlighten me!
5645 (This is probably a misconfiguration in your system or libraries, and
5646 you really ought to fix it.  Still, I'll try anyway.)
5647 !
5648 EOM
5649                 dflt=4
5650                 rp="What is the size of an integer (in bytes)?"
5651                 . ./myread
5652                 intsize="$ans"
5653                 dflt=$intsize
5654                 rp="What is the size of a long integer (in bytes)?"
5655                 . ./myread
5656                 longsize="$ans"
5657                 dflt=2
5658                 rp="What is the size of a short integer (in bytes)?"
5659                 . ./myread
5660                 shortsize="$ans"
5661         fi
5662         ;;
5663 esac
5664 $rm_try
5665
5666 : check for long long
5667 echo " "
5668 echo "Checking to see if you have long long..." >&4
5669 echo 'int main() { long long x = 7; return 0; }' > try.c
5670 set try
5671 if eval $compile; then
5672         val="$define"
5673         echo "You have long long."
5674 else
5675         val="$undef"
5676         echo "You do not have long long."
5677 fi
5678 $rm_try
5679 set d_longlong
5680 eval $setvar
5681
5682 : check for length of long long
5683 case "${d_longlong}${longlongsize}" in
5684 $define)
5685         echo " "
5686         echo "Checking to see how big your long longs are..." >&4
5687         $cat >try.c <<'EOCP'
5688 #include <stdio.h>
5689 int main()
5690 {
5691     printf("%d\n", (int)sizeof(long long));
5692     return(0);
5693 }
5694 EOCP
5695         set try
5696         if eval $compile_ok; then
5697                 longlongsize=`$run ./try`
5698                 echo "Your long longs are $longlongsize bytes long."
5699         else
5700                 dflt='8'
5701                 echo " "
5702                 echo "(I can't seem to compile the test program.  Guessing...)"
5703                 rp="What is the size of a long long (in bytes)?"
5704                 . ./myread
5705                 longlongsize="$ans"
5706         fi
5707         if $test "X$longsize" = "X$longlongsize"; then
5708                 echo "(That isn't any different from an ordinary long.)"
5709         fi
5710         ;;
5711 esac
5712 $rm_try
5713
5714 : see if inttypes.h is available
5715 : we want a real compile instead of Inhdr because some systems
5716 : have an inttypes.h which includes non-existent headers
5717 echo " "
5718 $cat >try.c <<EOCP
5719 #include <inttypes.h>
5720 int main() {
5721         static int32_t foo32 = 0x12345678;
5722 }
5723 EOCP
5724 set try
5725 if eval $compile; then
5726         echo "<inttypes.h> found." >&4
5727         val="$define"
5728 else
5729         echo "<inttypes.h> NOT found." >&4
5730         val="$undef"
5731 fi
5732 $rm_try
5733 set i_inttypes
5734 eval $setvar
5735
5736 : check for int64_t
5737 echo " "
5738 echo "Checking to see if you have int64_t..." >&4
5739 $cat >try.c <<EOCP
5740 #include <sys/types.h>
5741 #$i_inttypes I_INTTYPES
5742 #ifdef I_INTTYPES
5743 #include <inttypes.h>
5744 #endif
5745 int main() { int64_t x = 7; }
5746 EOCP
5747 set try
5748 if eval $compile; then
5749         val="$define"
5750         echo "You have int64_t."
5751 else
5752         val="$undef"
5753         echo "You do not have int64_t."
5754 fi
5755 $rm_try
5756 set d_int64_t
5757 eval $setvar
5758
5759 : Check if 64bit ints have a quad type
5760 echo " "
5761 echo "Checking which 64-bit integer type we could use..." >&4
5762
5763 case "$intsize" in
5764 8) val=int
5765    set quadtype
5766    eval $setvar
5767    val='"unsigned int"'
5768    set uquadtype
5769    eval $setvar
5770    quadkind=1
5771    ;;
5772 *) case "$longsize" in
5773    8) val=long
5774       set quadtype
5775       eval $setvar
5776       val='"unsigned long"'
5777       set uquadtype
5778       eval $setvar
5779       quadkind=2
5780       ;;
5781    *) case "$d_longlong:$longlongsize" in
5782       define:8)
5783         val='"long long"'
5784         set quadtype
5785         eval $setvar
5786         val='"unsigned long long"'
5787         set uquadtype
5788         eval $setvar
5789         quadkind=3
5790         ;;
5791       *) case "$d_int64_t" in
5792          define)
5793            val=int64_t
5794            set quadtype
5795            eval $setvar
5796            val=uint64_t
5797            set uquadtype
5798            eval $setvar
5799            quadkind=4
5800            ;;
5801          esac
5802          ;;
5803       esac
5804       ;;
5805    esac
5806    ;;
5807 esac
5808
5809 case "$quadtype" in
5810 '')     echo "Alas, no 64-bit integer types in sight." >&4
5811         d_quad="$undef"
5812         ;;
5813 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5814         d_quad="$define"
5815         ;;
5816 esac
5817
5818 : Do we want 64bit support
5819 case "$uselonglong" in
5820 "$define"|true|[yY]*)
5821         cat <<EOM >&4
5822
5823 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5824 EOM
5825         use64bitint="$define"
5826         ;;
5827 esac
5828 case "$use64bits" in
5829 "$define"|true|[yY]*)
5830         cat <<EOM >&4
5831
5832 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5833 EOM
5834         use64bitint="$define"
5835         ;;
5836 esac
5837 case "$use64bitints" in
5838 "$define"|true|[yY]*)
5839         cat <<EOM >&4
5840
5841 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5842 EOM
5843         use64bitint="$define"
5844         ;;
5845 esac
5846 case "$use64bitsint" in
5847 "$define"|true|[yY]*)
5848         cat <<EOM >&4
5849
5850 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5851 EOM
5852         use64bitint="$define"
5853         ;;
5854 esac
5855 case "$uselonglongs" in
5856 "$define"|true|[yY]*)
5857         cat <<EOM >&4
5858
5859 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5860 EOM
5861         use64bitint="$define"
5862         ;;
5863 esac
5864 case "$use64bitsall" in
5865 "$define"|true|[yY]*)
5866         cat <<EOM >&4
5867
5868 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5869 EOM
5870         use64bitall="$define"
5871         ;;
5872 esac
5873
5874 case "$ccflags" in
5875 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5876 esac
5877 case "$use64bitall" in
5878 "$define"|true|[yY]*) use64bitint="$define" ;;
5879 esac
5880
5881 case "$longsize" in
5882 8) cat <<EOM
5883
5884 You have natively 64-bit long integers.
5885 EOM
5886    val="$define"
5887    ;;
5888 *) case "$use64bitint" in
5889    "$define"|true|[yY]*) dflt='y';;
5890    *) dflt='n';;
5891    esac
5892    case "$d_quad" in
5893    "$define") ;;
5894    *) dflt='n' ;;
5895    esac
5896    cat <<EOM
5897
5898 Perl can be built to take advantage of 64-bit integer types
5899 on some systems.  To do so, Configure can be run with -Duse64bitint.
5900 Choosing this option will most probably introduce binary incompatibilities.
5901
5902 If this doesn't make any sense to you, just accept the default '$dflt'.
5903 (The default has been chosen based on your configuration.)
5904 EOM
5905    rp='Try to use 64-bit integers, if available?'
5906    . ./myread
5907    case "$ans" in
5908    [yY]*) val="$define" ;;
5909    *)     val="$undef"  ;;
5910    esac
5911    ;;
5912 esac
5913 set use64bitint
5914 eval $setvar
5915
5916 case "$use64bitall" in
5917 "$define"|true|[yY]*) dflt='y' ;;
5918 *) case "$longsize" in
5919    8) dflt='y' ;;
5920    *) dflt='n' ;;
5921    esac
5922    ;;
5923 esac
5924 cat <<EOM
5925
5926 You may also choose to try maximal 64-bitness.  It means using as much
5927 64-bitness as possible on the platform.  This in turn means even more
5928 binary incompatibilities.  On the other hand, your platform may not
5929 have any more 64-bitness available than what you already have chosen.
5930
5931 If this doesn't make any sense to you, just accept the default '$dflt'.
5932 (The default has been chosen based on your configuration.)
5933 EOM
5934 rp='Try to use maximal 64-bit support, if available?'
5935 . ./myread
5936 case "$ans" in
5937 [yY]*) val="$define" ;;
5938 *)     val="$undef"  ;;
5939 esac
5940 set use64bitall
5941 eval $setvar
5942 case "$use64bitall" in
5943 "$define")
5944         case "$use64bitint" in
5945         "$undef")
5946                 cat <<EOM
5947
5948 Since you have chosen a maximally 64-bit build, I'm also turning on
5949 the use of 64-bit integers.
5950 EOM
5951                 use64bitint="$define" ;;
5952         esac
5953         ;;
5954 esac
5955
5956 : Look for a hint-file generated 'call-back-unit'.  If the
5957 : user has specified that a 64-bit perl is to be built,
5958 : we may need to set or change some other defaults.
5959 if $test -f use64bitint.cbu; then
5960         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5961         . ./use64bitint.cbu
5962 fi
5963 case "$use64bitint" in
5964 "$define"|true|[yY]*)
5965         : This test was common to all the OpenBSD forks, and seems harmless for
5966         : other platforms:
5967         echo " "
5968         echo "Checking if your C library has broken 64-bit functions..." >&4
5969         cat >try.c <<EOCP
5970 #include <stdio.h>
5971 typedef $uquadtype myULL;
5972 int main (void)
5973 {
5974     struct {
5975         double d;
5976         myULL  u;
5977     } *p, test[] = {
5978         {4294967303.15, 4294967303ULL},
5979         {4294967294.2,  4294967294ULL},
5980         {4294967295.7,  4294967295ULL},
5981         {0.0, 0ULL}
5982     };
5983     for (p = test; p->u; p++) {
5984         myULL x = (myULL)p->d;
5985         if (x != p->u) {
5986             printf("buggy\n");
5987             return 0;
5988         }
5989     }
5990     printf("ok\n");
5991     return 0;
5992 }
5993 EOCP
5994         set try
5995         if eval $compile_ok; then
5996             libcquad=`$run ./try`
5997             echo "Your C library's 64-bit functions are $libcquad."
5998         else
5999             echo "(I can't seem to compile the test program.)"
6000             echo "Assuming that your C library's 64-bit functions are ok."
6001             libcquad="ok"
6002         fi
6003         $rm_try
6004
6005         case "$libcquad" in
6006             buggy*)
6007                 cat >&4 <<EOM
6008
6009 *** You have a C library with broken 64-bit functions.
6010 *** 64-bit support does not work reliably in this configuration.
6011 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6012 *** Cannot continue, aborting.
6013
6014 EOM
6015                 exit 1
6016                 ;;
6017         esac
6018         case "$longsize" in
6019         4) case "$archname64" in
6020            '') archname64=64int ;;
6021            esac
6022            ;;
6023         esac
6024         ;;
6025 esac
6026
6027 : Look for a hint-file generated 'call-back-unit'.  If the
6028 : user has specified that a maximally 64-bit perl is to be built,
6029 : we may need to set or change some other defaults.
6030 if $test -f use64bitall.cbu; then
6031         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6032         . ./use64bitall.cbu
6033 fi
6034 case "$use64bitall" in
6035 "$define"|true|[yY]*)
6036         case "$longsize" in
6037         4) case "$archname64" in
6038            ''|64int) archname64=64all ;;
6039            esac
6040            ;;
6041         esac
6042         ;;
6043 esac
6044
6045 case "$d_quad:$use64bitint" in
6046 $undef:$define)
6047         cat >&4 <<EOF
6048
6049 *** You have chosen to use 64-bit integers,
6050 *** but none can be found.
6051 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6052 *** Cannot continue, aborting.
6053
6054 EOF
6055         exit 1
6056         ;;
6057 esac
6058
6059 : check for length of double
6060 echo " "
6061 case "$doublesize" in
6062 '')
6063         echo "Checking to see how big your double precision numbers are..." >&4
6064         $cat >try.c <<EOCP
6065 #include <stdio.h>
6066 #$i_stdlib I_STDLIB
6067 #ifdef I_STDLIB
6068 #include <stdlib.h>
6069 #endif
6070 int main()
6071 {
6072     printf("%d\n", (int)sizeof(double));
6073     exit(0);
6074 }
6075 EOCP
6076         set try
6077         if eval $compile_ok; then
6078                 doublesize=`$run ./try`
6079                 echo "Your double is $doublesize bytes long."
6080         else
6081                 dflt='8'
6082                 echo "(I can't seem to compile the test program.  Guessing...)"
6083                 rp="What is the size of a double precision number (in bytes)?"
6084                 . ./myread
6085                 doublesize="$ans"
6086         fi
6087         ;;
6088 esac
6089 $rm_try
6090
6091 : check for long doubles
6092 echo " "
6093 echo "Checking to see if you have long double..." >&4
6094 echo 'int main() { long double x = 7.0; }' > try.c
6095 set try
6096 if eval $compile; then
6097         val="$define"
6098         echo "You have long double."
6099 else
6100         val="$undef"
6101         echo "You do not have long double."
6102 fi
6103 $rm_try
6104 set d_longdbl
6105 eval $setvar
6106
6107 : check for length of long double
6108 case "${d_longdbl}${longdblsize}" in
6109 $define)
6110         echo " "
6111         echo "Checking to see how big your long doubles are..." >&4
6112         $cat >try.c <<'EOCP'
6113 #include <stdio.h>
6114 int main()
6115 {
6116         printf("%d\n", sizeof(long double));
6117 }
6118 EOCP
6119         set try
6120         set try
6121         if eval $compile; then
6122                 longdblsize=`$run ./try`
6123                 echo "Your long doubles are $longdblsize bytes long."
6124         else
6125                 dflt='8'
6126                 echo " "
6127                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6128                 rp="What is the size of a long double (in bytes)?"
6129                 . ./myread
6130                 longdblsize="$ans"
6131         fi
6132         if $test "X$doublesize" = "X$longdblsize"; then
6133                 echo "That isn't any different from an ordinary double."
6134                 echo "I'll keep your setting anyway, but you may see some"
6135                 echo "harmless compilation warnings."
6136         fi
6137         ;;
6138 esac
6139 $rm_try
6140
6141 : determine the architecture name
6142 echo " "
6143 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6144         tarch=`arch`"-$osname"
6145 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6146         if uname -m > tmparch 2>&1 ; then
6147                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6148                         -e 's/$/'"-$osname/" tmparch`
6149         else
6150                 tarch="$osname"
6151         fi
6152         $rm -f tmparch
6153 else
6154         tarch="$osname"
6155 fi
6156 case "$myarchname" in
6157 ''|"$tarch") ;;
6158 *)
6159         echo "(Your architecture name used to be $myarchname.)"
6160         archname=''
6161         ;;
6162 esac
6163 case "$targetarch" in
6164 '') ;;
6165 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6166 esac
6167 myarchname="$tarch"
6168 case "$archname" in
6169 '') dflt="$tarch";;
6170 *) dflt="$archname";;
6171 esac
6172 rp='What is your architecture name'
6173 . ./myread
6174 archname="$ans"
6175
6176 : optionally add API version to the architecture for versioned archlibs
6177 case "$useversionedarchname" in
6178 $define|true|[yY]*) dflt='y';;
6179 *)                  dflt='n';;
6180 esac
6181 rp='Add the Perl API version to your archname?'
6182 . ./myread
6183 case "$ans" in
6184 y|Y)    useversionedarchname="$define" ;;
6185 *)      useversionedarchname="$undef" ;;
6186 esac
6187 case "$useversionedarchname" in
6188 $define)
6189         case "$archname" in
6190         *-$api_versionstring)
6191                 echo "...and architecture name already has -$api_versionstring" >&4
6192                 ;;
6193         *)
6194                 archname="$archname-$api_versionstring"
6195                 echo "...setting architecture name to $archname." >&4
6196                 ;;
6197         esac
6198         ;;
6199 esac
6200
6201 case "$usethreads" in
6202 $define)
6203         echo "Threads selected." >&4
6204         case "$archname" in
6205         *-thread*) echo "...and architecture name already has -thread." >&4
6206                 ;;
6207         *)      archname="$archname-thread"
6208                 echo "...setting architecture name to $archname." >&4
6209                 ;;
6210         esac
6211         ;;
6212 esac
6213 case "$usemultiplicity" in
6214 $define)
6215         echo "Multiplicity selected." >&4
6216         case "$archname" in
6217         *-multi*) echo "...and architecture name already has -multi." >&4
6218                 ;;
6219         *)      archname="$archname-multi"
6220                 echo "...setting architecture name to $archname." >&4
6221                 ;;
6222         esac
6223         ;;
6224 esac
6225 case "$use64bitint$use64bitall" in
6226 *"$define"*)
6227         case "$archname64" in
6228         '')
6229                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6230                 ;;
6231         *)
6232                 case "$use64bitint" in
6233                 "$define") echo "64 bit integers selected." >&4 ;;
6234                 esac
6235                 case "$use64bitall" in
6236                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6237                 esac
6238                 case "$archname" in
6239                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6240                         ;;
6241                 *)      archname="$archname-$archname64"
6242                         echo "...setting architecture name to $archname." >&4
6243                         ;;
6244                 esac
6245                 ;;
6246         esac
6247 esac
6248 case "$uselongdouble" in
6249 $define)
6250         echo "Long doubles selected." >&4
6251         case "$longdblsize" in
6252         $doublesize)
6253                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6254                 ;;
6255         *)
6256                 case "$archname" in
6257                 *-ld*) echo "...and architecture name already has -ld." >&4
6258                         ;;
6259                 *)      archname="$archname-ld"
6260                         echo "...setting architecture name to $archname." >&4
6261                         ;;
6262                 esac
6263                 ;;
6264         esac
6265         ;;
6266 esac
6267 if $test -f archname.cbu; then
6268         echo "Your platform has some specific hints for architecture name, using them..."
6269         . ./archname.cbu
6270 fi
6271
6272 : set the prefixit variable, to compute a suitable default value
6273 prefixit='case "$3" in
6274 ""|none)
6275         case "$oldprefix" in
6276         "") eval "$1=\"\$$2\"";;
6277         *)
6278                 case "$3" in
6279                 "") eval "$1=";;
6280                 none)
6281                         eval "tp=\"\$$2\"";
6282                         case "$tp" in
6283                         ""|" ") eval "$1=\"\$$2\"";;
6284                         *) eval "$1=";;
6285                         esac;;
6286                 esac;;
6287         esac;;
6288 *)
6289         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6290         case "$tp" in
6291         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6292         /*-$oldprefix/*|\~*-$oldprefix/*)
6293                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6294         *) eval "$1=\"\$$2\"";;
6295         esac;;
6296 esac'
6297
6298 : determine installation style
6299 : For now, try to deduce it from prefix unless it is already set.
6300 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6301 case "$installstyle" in
6302 '')     case "$prefix" in
6303                 *perl*) dflt='lib';;
6304                 *) dflt='lib/perl5' ;;
6305         esac
6306         ;;
6307 *)      dflt="$installstyle" ;;
6308 esac
6309 : Probably not worth prompting for this since we prompt for all
6310 : the directories individually, and the prompt would be too long and
6311 : confusing anyway.
6312 installstyle=$dflt
6313
6314 : determine where public executables go
6315 echo " "
6316 set dflt bin bin
6317 eval $prefixit
6318 fn=d~
6319 rp='Pathname where the public executables will reside?'
6320 . ./getfile
6321 if $test "X$ansexp" != "X$binexp"; then
6322         installbin=''
6323 fi
6324 prefixvar=bin
6325 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6326 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6327 :     this via initialinstalllocation
6328 . ./setprefixvar
6329
6330 case "$userelocatableinc" in
6331 $define|true|[yY]*)     dflt='y' ;;
6332 *)                      dflt='n' ;;
6333 esac
6334 cat <<EOM
6335
6336 Would you like to build Perl so that the installation is relocatable, so that
6337 library paths in @INC are determined relative to the path of the perl binary?
6338 This is not advised for system Perl installs, or if you need to run setid
6339 scripts or scripts under taint mode.
6340
6341 If this doesn't make any sense to you, just accept the default '$dflt'.
6342 EOM
6343 rp='Use relocatable @INC?'
6344 . ./myread
6345 case "$ans" in
6346 y|Y)    val="$define" ;;
6347 *)      val="$undef"  ;;
6348 esac
6349 set userelocatableinc
6350 eval $setvar
6351
6352 initialinstalllocation="$binexp"
6353 : Default prefix is now "up one level from where the binaries are"
6354 case "$userelocatableinc" in
6355 $define|true|[yY]*)
6356     bin=".../"
6357     binexp=".../"
6358     prefix=".../.."
6359     prefixexp=".../.."
6360     installprefixexp=".../.."
6361     ;;
6362 esac
6363
6364 : determine where private library files go
6365 : Usual default is /usr/local/lib/perl5/$version.
6366 : Also allow things like /opt/perl/lib/$version, since
6367 : /opt/perl/lib/perl5... would be redundant.
6368 : The default "style" setting is made in installstyle.U
6369 case "$installstyle" in
6370 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6371 *)       set dflt privlib lib/$version ;;
6372 esac
6373 eval $prefixit
6374 $cat <<EOM
6375
6376 There are some auxiliary files for $package that need to be put into a
6377 private library directory that is accessible by everyone.
6378
6379 EOM
6380 fn=$binexp
6381 fn=d~+
6382 rp='Pathname where the private library files will reside?'
6383 . ./getfile
6384 prefixvar=privlib
6385 . ./setprefixvar
6386
6387 : set the prefixup variable, to restore leading tilda escape
6388 prefixup='case "$prefixexp" in
6389 "$prefix") ;;
6390 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6391 esac'
6392
6393 : determine where public architecture dependent libraries go
6394 set archlib archlib
6395 eval $prefixit
6396 : privlib default is /usr/local/lib/$package/$version
6397 : archlib default is /usr/local/lib/$package/$version/$archname
6398 : privlib may have an optional trailing /share.
6399 tdflt=`echo $privlib | $sed 's,/share$,,'`
6400 tdflt=$tdflt/$archname
6401 case "$archlib" in
6402 '')     dflt=$tdflt
6403         ;;
6404 *)      dflt="$archlib"
6405     ;;
6406 esac
6407 $cat <<EOM
6408
6409 $spackage contains architecture-dependent library files.  If you are
6410 sharing libraries in a heterogeneous environment, you might store
6411 these files in a separate location.  Otherwise, you can just include
6412 them with the rest of the public library files.
6413
6414 EOM
6415 fn=$binexp
6416 fn=d+~
6417 rp='Where do you want to put the public architecture-dependent libraries?'
6418 . ./getfile
6419 prefixvar=archlib
6420 . ./setprefixvar
6421 if $test X"$archlib" = X"$privlib"; then
6422         d_archlib="$undef"
6423 else
6424         d_archlib="$define"
6425 fi
6426
6427 : see if setuid scripts can be secure
6428 $cat <<EOM
6429
6430 Some kernels have a bug that prevents setuid #! scripts from being
6431 secure.  Some sites have disabled setuid #! scripts because of this.
6432
6433 First let's decide if your kernel supports secure setuid #! scripts.
6434 (If setuid #! scripts would be secure but have been disabled anyway,
6435 don't say that they are secure if asked.)
6436
6437 EOM
6438
6439 val="$undef"
6440 if $test -d /dev/fd; then
6441         echo "#!$ls" >reflect
6442         chmod +x,u+s reflect
6443         ./reflect >flect 2>&1
6444         if $contains "/dev/fd" flect >/dev/null; then
6445                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6446                 val="$define"
6447         else
6448                 $cat <<EOM
6449 If you are not sure if they are secure, I can check but I'll need a
6450 username and password different from the one you are using right now.
6451 If you don't have such a username or don't want me to test, simply
6452 enter 'none'.
6453
6454 EOM
6455                 rp='Other username to test security of setuid scripts with?'
6456                 dflt='none'
6457                 . ./myread
6458                 case "$ans" in
6459                 n|none)
6460                         case "$d_suidsafe" in
6461                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6462                                 dflt=n;;
6463                         "$undef")
6464                                 echo "Well, the $hint value is *not* secure." >&4
6465                                 dflt=n;;
6466                         *)      echo "Well, the $hint value *is* secure." >&4
6467                                 dflt=y;;
6468                         esac
6469                         ;;
6470                 *)
6471                         $rm -f reflect flect
6472                         echo "#!$ls" >reflect
6473                         chmod +x,u+s reflect
6474                         echo >flect
6475                         chmod a+w flect
6476                         echo '"su" will (probably) prompt you for '"$ans's password."
6477                         su $ans -c './reflect >flect'
6478                         if $contains "/dev/fd" flect >/dev/null; then
6479                                 echo "Okay, it looks like setuid scripts are secure." >&4
6480                                 dflt=y
6481                         else
6482                                 echo "I don't think setuid scripts are secure." >&4
6483                                 dflt=n
6484                         fi
6485                         ;;
6486                 esac
6487                 rp='Does your kernel have *secure* setuid scripts?'
6488                 . ./myread
6489                 case "$ans" in
6490                 [yY]*)  val="$define";;
6491                 *)      val="$undef";;
6492                 esac
6493         fi
6494 else
6495         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6496         echo "(That's for file descriptors, not floppy disks.)"
6497         val="$undef"
6498 fi
6499 set d_suidsafe
6500 eval $setvar
6501
6502 $rm -f reflect flect
6503
6504 : now see if they want to do setuid emulation
6505 if $test $patchlevel -lt 11; then
6506 echo " "
6507 val="$undef"
6508 case "$d_suidsafe" in
6509 "$define")
6510         val="$undef"
6511         echo "No need to emulate SUID scripts since they are secure here." >&4
6512         ;;
6513 *)
6514         $cat <<EOM
6515 Some systems have disabled setuid scripts, especially systems where
6516 setuid scripts cannot be secure.  On systems where setuid scripts have
6517 been disabled, the setuid/setgid bits on scripts are currently
6518 useless.  It is possible for $package to detect those bits and emulate
6519 setuid/setgid in a secure fashion.  This emulation will only work if
6520 setuid scripts have been disabled in your kernel.
6521
6522 EOM
6523         case "$d_dosuid" in
6524         "$define") dflt=y ;;
6525         *) dflt=n ;;
6526         esac
6527         rp="Do you want to do setuid/setgid emulation?"
6528         . ./myread
6529         case "$ans" in
6530         [yY]*)  val="$define";;
6531         *)      val="$undef";;
6532         esac
6533         ;;
6534 esac
6535 set d_dosuid
6536 eval $setvar
6537 else
6538     case "$d_dosuid" in
6539         "$define")
6540         cat >&4 <<EOH
6541
6542 SUID emulation has been removed for 5.12
6543 Please re-run Configure without -Dd_dosuid
6544
6545 EOH
6546         exit 1;
6547         ;;
6548     esac
6549     d_dosuid=undef
6550 fi
6551
6552 : Find perl5.005 or later.
6553 echo "Looking for a previously installed perl5.005 or later... "
6554 case "$perl5" in
6555 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6556                 : Check if this perl is recent and can load a simple module
6557                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6558                         perl5=$tdir/perl
6559                         break;
6560                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6561                         perl5=$tdir/perl5
6562                         break;
6563                 fi
6564         done
6565         ;;
6566 *)      perl5="$perl5"
6567         ;;
6568 esac
6569 case "$perl5" in
6570 '')     echo "None found.  That's ok.";;
6571 *)      echo "Using $perl5." ;;
6572 esac
6573
6574 : Set the siteprefix variables
6575 $cat <<EOM
6576
6577 After $package is installed, you may wish to install various
6578 add-on modules and utilities.  Typically, these add-ons will
6579 be installed under $prefix with the rest
6580 of this package.  However, you may wish to install such add-ons
6581 elsewhere under a different prefix.
6582
6583 If you do not wish to put everything under a single prefix, that's
6584 ok.  You will be prompted for the individual locations; this siteprefix
6585 is only used to suggest the defaults.
6586
6587 The default should be fine for most people.
6588
6589 EOM
6590 fn=d~+
6591 rp='Installation prefix to use for add-on modules and utilities?'
6592 : XXX Here might be another good place for an installstyle setting.
6593 case "$siteprefix" in
6594 '') dflt=$prefix ;;
6595 *)  dflt=$siteprefix ;;
6596 esac
6597 . ./getfile
6598 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6599 oldsiteprefix=''
6600 case "$siteprefix" in
6601 '') ;;
6602 *)      case "$ans" in
6603         "$prefix") ;;
6604         *) oldsiteprefix="$prefix";;
6605         esac
6606         ;;
6607 esac
6608 siteprefix="$ans"
6609 siteprefixexp="$ansexp"
6610
6611 : determine where site specific libraries go.
6612 : Usual default is /usr/local/lib/perl5/site_perl/$version
6613 : The default "style" setting is made in installstyle.U
6614 : XXX No longer works with Prefixit stuff.
6615 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6616 case "$sitelib" in
6617 '') case "$installstyle" in
6618         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6619         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6620         esac
6621         ;;
6622 *)      dflt="$sitelib"
6623         ;;
6624 esac
6625 $cat <<EOM
6626
6627 The installation process will create a directory for
6628 site-specific extensions and modules.  Most users find it convenient
6629 to place all site-specific files in this directory rather than in the
6630 main distribution directory.
6631
6632 EOM
6633 fn=d~+
6634 rp='Pathname for the site-specific library files?'
6635 . ./getfile
6636 prefixvar=sitelib
6637 . ./setprefixvar
6638 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6639
6640 : Determine list of previous versions to include in @INC
6641 $cat > getverlist <<EOPL
6642 #!$perl5 -w
6643 use File::Basename;
6644 \$api_versionstring = "$api_versionstring";
6645 \$version = "$version";
6646 \$stem = "$sitelib_stem";
6647 \$archname = "$archname";
6648 EOPL
6649         $cat >> getverlist <<'EOPL'
6650 # The list found is store twice for each entry: the original name, and
6651 # the binary broken down version as pack "sss", so sorting is easy and
6652 # unambiguous. This will work for all versions that have a maximum of
6653 # three digit groups, separate by '.'s or '_'s. Names are extended with
6654 # ".0.0" to ensure at least three elements for the pack.
6655 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6656
6657 # Can't have leading @ because metaconfig interprets it as a command!
6658 ;@inc_version_list=();
6659 # XXX Redo to do opendir/readdir?
6660 if (-d $stem) {
6661     chdir($stem);
6662     ;@candidates = map {
6663         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6664     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6665 }
6666 else {
6667     ;@candidates = ();
6668 }
6669
6670 ($pversion, $aversion, $vsn5005) = map {
6671     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6672 foreach $d (@candidates) {
6673     if ($d->[1] lt $pversion) {
6674         if ($d->[1] ge $aversion) {
6675             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6676         }
6677         elsif ($d->[1] ge $vsn5005) {
6678             unshift(@inc_version_list, grep { -d } $d->[0]);
6679         }
6680     }
6681     else {
6682         # Skip newer version.  I.e. don't look in
6683         # 5.7.0 if we're installing 5.6.1.
6684     }
6685 }
6686
6687 if (@inc_version_list) {
6688     print join(' ', @inc_version_list);
6689 }
6690 else {
6691     # Blank space to preserve value for next Configure run.
6692     print " ";
6693 }
6694 EOPL
6695 chmod +x getverlist
6696 case "$inc_version_list" in
6697 '')     if test -x "$perl5$exe_ext"; then
6698                 dflt=`$perl5 getverlist`
6699         else
6700                 dflt='none'
6701         fi
6702         ;;
6703 $undef) dflt='none' ;;
6704 *)  eval dflt=\"$inc_version_list\" ;;
6705 esac
6706 case "$dflt" in
6707 ''|' ') dflt=none ;;
6708 esac
6709 case "$dflt" in
6710 5.005) dflt=none ;;
6711 esac
6712 $cat <<EOM
6713
6714 In order to ease the process of upgrading, this version of perl
6715 can be configured to use modules built and installed with earlier
6716 versions of perl that were installed under $prefix.  Specify here
6717 the list of earlier versions that this version of perl should check.
6718 If Configure detected no earlier versions of perl installed under
6719 $prefix, then the list will be empty.  Answer 'none' to tell perl
6720 to not search earlier versions.
6721
6722 The default should almost always be sensible, so if you're not sure,
6723 just accept the default.
6724 EOM
6725
6726 rp='List of earlier versions to include in @INC?'
6727 . ./myread
6728 case "$ans" in
6729 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6730 *) inc_version_list="$ans" ;;
6731 esac
6732 case "$inc_version_list" in
6733 ''|' ')
6734         inc_version_list_init='0'
6735         d_inc_version_list="$undef"
6736         ;;
6737 *)      inc_version_list_init=`echo $inc_version_list |
6738                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6739         d_inc_version_list="$define"
6740         ;;
6741 esac
6742 $rm -f getverlist
6743
6744 : see if malloc/malloc.h has to be included
6745 set malloc/malloc.h i_mallocmalloc
6746 eval $inhdr
6747
6748 : see if this is a malloc.h system
6749 : we want a real compile instead of Inhdr because some systems have a
6750 : malloc.h that just gives a compile error saying to use stdlib.h instead
6751 echo " "
6752 $cat >try.c <<EOCP
6753 #include <stdlib.h>
6754 #include <malloc.h>
6755 #$i_mallocmalloc I_MALLOCMALLOC
6756 #ifdef I_MALLOCMALLOC
6757 # include <malloc/malloc.h>
6758 #endif
6759
6760 int main () { return 0; }
6761 EOCP
6762 set try
6763 if eval $compile; then
6764     echo "<malloc.h> found." >&4
6765     val="$define"
6766 else
6767     echo "<malloc.h> NOT found." >&4
6768     val="$undef"
6769 fi
6770 $rm_try
6771 set i_malloc
6772 eval $setvar
6773
6774 : check for length of pointer
6775 echo " "
6776 case "$ptrsize" in
6777 '')
6778         echo "Checking to see how big your pointers are..." >&4
6779         $cat >>try.c <<EOCP
6780 #include <stdio.h>
6781 #$i_stdlib I_STDLIB
6782 #ifdef I_STDLIB
6783 #include <stdlib.h>
6784 #endif
6785 int main()
6786 {
6787     printf("%d\n", (int)sizeof(void *));
6788     exit(0);
6789 }
6790 EOCP
6791         set try
6792         if eval $compile_ok; then
6793                 ptrsize=`$run ./try`
6794                 echo "Your pointers are $ptrsize bytes long."
6795         else
6796                 dflt='4'
6797                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6798                 rp="What is the size of a pointer (in bytes)?"
6799                 . ./myread
6800                 ptrsize="$ans"
6801         fi
6802         ;;
6803 esac
6804 $rm_try
6805 case "$use64bitall" in
6806 "$define"|true|[yY]*)
6807         case "$ptrsize" in
6808         4)      cat <<EOM >&4
6809
6810 *** You have chosen a maximally 64-bit build,
6811 *** but your pointers are only 4 bytes wide.
6812 *** Please rerun Configure without -Duse64bitall.
6813 EOM
6814                 case "$d_quad" in
6815                 define)
6816                         cat <<EOM >&4
6817 *** Since you have quads, you could possibly try with -Duse64bitint.
6818 EOM
6819                         ;;
6820                 esac
6821                 cat <<EOM >&4
6822 *** Cannot continue, aborting.
6823
6824 EOM
6825
6826                 exit 1
6827                 ;;
6828         esac
6829         ;;
6830 esac
6831
6832
6833 : determine whether to use malloc wrapping
6834 echo " "
6835 case "$usemallocwrap" in
6836 [yY]*|true|$define)     dflt='y' ;;
6837 [nN]*|false|$undef)     dflt='n' ;;
6838 *)      case "$usedevel" in
6839         [yY]*|true|$define)     dflt='y' ;;
6840         *) dflt='n' ;;
6841         esac
6842         ;;
6843 esac
6844 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6845 . ./myread
6846 usemallocwrap="$ans"
6847 case "$ans" in
6848 y*|true)
6849         usemallocwrap="$define" ;;
6850 *)
6851         usemallocwrap="$undef" ;;
6852 esac
6853
6854 : determine which malloc to compile in
6855 echo " "
6856 case "$usemymalloc" in
6857 [yY]*|true|$define)     dflt='y' ;;
6858 [nN]*|false|$undef)     dflt='n' ;;
6859 *)      case "$ptrsize" in
6860         4) dflt='y' ;;
6861         *) dflt='n' ;;
6862         esac
6863         if test "$useithreads" = "$define"; then dflt='n'; fi
6864         ;;
6865 esac
6866 rp="Do you wish to attempt to use the malloc that comes with $package?"
6867 . ./myread
6868 usemymalloc="$ans"
6869 case "$ans" in
6870 y*|true)
6871         usemymalloc='y'
6872         mallocsrc='malloc.c'
6873         mallocobj="malloc$_o"
6874         d_mymalloc="$define"
6875         case "$libs" in
6876         *-lmalloc*)
6877                 : Remove malloc from list of libraries to use
6878                 echo "Removing unneeded -lmalloc from library list" >&4
6879                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6880                 shift
6881                 libs="$*"
6882                 echo "libs = $libs" >&4
6883                 ;;
6884         esac
6885         ;;
6886 *)
6887         usemymalloc='n'
6888         mallocsrc=''
6889         mallocobj=''
6890         d_mymalloc="$undef"
6891         ;;
6892 esac
6893
6894 : compute the return types of malloc and free
6895 echo " "
6896 $cat >malloc.c <<END
6897 #$i_malloc I_MALLOC
6898 #$i_stdlib I_STDLIB
6899 #include <stdio.h>
6900 #include <sys/types.h>
6901 #ifdef I_MALLOC
6902 #include <malloc.h>
6903 #endif
6904 #ifdef I_STDLIB
6905 #include <stdlib.h>
6906 #endif
6907 #ifdef TRY_MALLOC
6908 void *malloc();
6909 #endif
6910 #ifdef TRY_FREE
6911 void free();
6912 #endif
6913 END
6914 case "$malloctype" in
6915 '')
6916         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6917                 malloctype='void *'
6918         else
6919                 malloctype='char *'
6920         fi
6921         ;;
6922 esac
6923 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6924
6925 case "$freetype" in
6926 '')
6927         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6928                 freetype='void'
6929         else
6930                 freetype='int'
6931         fi
6932         ;;
6933 esac
6934 echo "Your system uses $freetype free(), it would seem." >&4
6935 $rm -f malloc.[co]
6936 : determine where site specific architecture-dependent libraries go.
6937 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6938 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6939 : sitelib may have an optional trailing /share.
6940 case "$sitearch" in
6941 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6942         dflt="$dflt/$archname"
6943         ;;
6944 *)      dflt="$sitearch"
6945         ;;
6946 esac
6947 set sitearch sitearch none
6948 eval $prefixit
6949 $cat <<EOM
6950
6951 The installation process will also create a directory for
6952 architecture-dependent site-specific extensions and modules.
6953
6954 EOM
6955 fn=d~+
6956 rp='Pathname for the site-specific architecture-dependent library files?'
6957 . ./getfile
6958 prefixvar=sitearch
6959 . ./setprefixvar
6960 if $test X"$sitearch" = X"$sitelib"; then
6961         d_sitearch="$undef"
6962 else
6963         d_sitearch="$define"
6964 fi
6965
6966 : Set the vendorprefix variables
6967 $cat <<EOM
6968
6969 The installation process will also create a directory for
6970 vendor-supplied add-ons.  Vendors who supply perl with their system
6971 may find it convenient to place all vendor-supplied files in this
6972 directory rather than in the main distribution directory.  This will
6973 ease upgrades between binary-compatible maintenance versions of perl.
6974
6975 Of course you may also use these directories in whatever way you see
6976 fit.  For example, you might use them to access modules shared over a
6977 company-wide network.
6978
6979 The default answer should be fine for most people.
6980 This causes further questions about vendor add-ons to be skipped
6981 and no vendor-specific directories will be configured for perl.
6982
6983 EOM
6984 rp='Do you want to configure vendor-specific add-on directories?'
6985 case "$usevendorprefix" in
6986 define|true|[yY]*) dflt=y ;;
6987 *)      : User may have set vendorprefix directly on Configure command line.
6988         case "$vendorprefix" in
6989         ''|' ') dflt=n ;;
6990         *)      dflt=y ;;
6991         esac
6992         ;;
6993 esac
6994 . ./myread
6995 case "$ans" in
6996 [yY]*)  fn=d~+
6997         rp='Installation prefix to use for vendor-supplied add-ons?'
6998         case "$vendorprefix" in
6999         '') dflt="$prefix" ;;
7000         *)  dflt=$vendorprefix ;;
7001         esac
7002         . ./getfile
7003         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7004         oldvendorprefix=''
7005         case "$vendorprefix" in
7006         '') ;;
7007         *)      case "$ans" in
7008                 "$prefix") ;;
7009                 *) oldvendorprefix="$prefix";;
7010                 esac
7011                 ;;
7012         esac
7013         usevendorprefix="$define"
7014         vendorprefix="$ans"
7015         vendorprefixexp="$ansexp"
7016         ;;
7017 *)      usevendorprefix="$undef"
7018         vendorprefix=''
7019         vendorprefixexp=''
7020         ;;
7021 esac
7022
7023 : Set the vendorlib variables
7024 case "$vendorprefix" in
7025 '')     d_vendorlib="$undef"
7026         vendorlib=''
7027         vendorlibexp=''
7028         ;;
7029 *)      d_vendorlib="$define"
7030         : determine where vendor-supplied modules go.
7031         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7032         case "$vendorlib" in
7033         '')
7034                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7035                 case "$installstyle" in
7036                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7037                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7038                 esac
7039                 ;;
7040         *)      dflt="$vendorlib"
7041                 ;;
7042         esac
7043         fn=d~+
7044         rp='Pathname for the vendor-supplied library files?'
7045         . ./getfile
7046         vendorlib="$ans"
7047         vendorlibexp="$ansexp"
7048         ;;
7049 esac
7050 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7051 prefixvar=vendorlib
7052 . ./installprefix
7053
7054 : Set the vendorarch variables
7055 case "$vendorprefix" in
7056 '')     d_vendorarch="$undef"
7057         vendorarch=''
7058         vendorarchexp=''
7059         ;;
7060 *)      d_vendorarch="$define"
7061         : determine where vendor-supplied architecture-dependent libraries go.
7062         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7063         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7064         : vendorlib may have an optional trailing /share.
7065         case "$vendorarch" in
7066         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7067                 dflt="$dflt/$archname"
7068                 ;;
7069         *)      dflt="$vendorarch" ;;
7070         esac
7071         fn=d~+
7072         rp='Pathname for vendor-supplied architecture-dependent files?'
7073         . ./getfile
7074         vendorarch="$ans"
7075         vendorarchexp="$ansexp"
7076         ;;
7077 esac
7078 prefixvar=vendorarch
7079 . ./installprefix
7080 if $test X"$vendorarch" = X"$vendorlib"; then
7081         d_vendorarch="$undef"
7082 else
7083         d_vendorarch="$define"
7084 fi
7085
7086 : Final catch-all directories to search
7087 $cat <<EOM
7088
7089 Lastly, you can have perl look in other directories for extensions and
7090 modules in addition to those already specified.
7091 These directories will be searched after
7092         $sitearch
7093         $sitelib
7094 EOM
7095 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7096 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7097 echo ' '
7098 case "$otherlibdirs" in
7099 ''|' ') dflt='none' ;;
7100 *)      dflt="$otherlibdirs" ;;
7101 esac
7102 $cat <<EOM
7103 Enter a colon-separated set of extra paths to include in perl's @INC
7104 search path, or enter 'none' for no extra paths.
7105
7106 EOM
7107
7108 rp='Colon-separated list of additional directories for perl to search?'
7109 . ./myread
7110 case "$ans" in
7111 ' '|''|none)    otherlibdirs=' ' ;;
7112 *)      otherlibdirs="$ans" ;;
7113 esac
7114 case "$otherlibdirs" in
7115 ' ') val=$undef ;;
7116 *)      val=$define ;;
7117 esac
7118 set d_perl_otherlibdirs
7119 eval $setvar
7120
7121 : Cruising for prototypes
7122 echo " "
7123 echo "Checking out function prototypes..." >&4
7124 $cat >prototype.c <<EOCP
7125 #$i_stdlib I_STDLIB
7126 #ifdef I_STDLIB
7127 #include <stdlib.h>
7128 #endif
7129 int main(int argc, char *argv[]) {
7130         exit(0);}
7131 EOCP
7132 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7133         echo "Your C compiler appears to support function prototypes."
7134         val="$define"
7135 else
7136         echo "Your C compiler doesn't seem to understand function prototypes."
7137         val="$undef"
7138 fi
7139 set prototype
7140 eval $setvar
7141 $rm -f prototype*
7142
7143 : Check if ansi2knr is required
7144 case "$prototype" in
7145 "$define") ;;
7146 *)      ansi2knr='ansi2knr'
7147         echo " "
7148         cat <<EOM >&4
7149
7150 $me:  FATAL ERROR:
7151 This version of $package can only be compiled by a compiler that 
7152 understands function prototypes.  Unfortunately, your C compiler 
7153         $cc $ccflags
7154 doesn't seem to understand them.  Sorry about that.
7155
7156 If GNU cc is available for your system, perhaps you could try that instead.  
7157
7158 Eventually, we hope to support building Perl with pre-ANSI compilers.
7159 If you would like to help in that effort, please contact <perlbug@perl.org>.
7160
7161 Aborting Configure now.
7162 EOM
7163         exit 2
7164         ;;
7165 esac
7166
7167 : DTrace support
7168 dflt_dtrace='/usr/sbin/dtrace'
7169 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7170
7171 cat <<EOM
7172
7173 Perl can be built to support DTrace on platforms that support it.
7174 DTrace is a diagnosis and performance analysis tool from Sun.
7175
7176 If this doesn't make any sense to you, just accept the default '$dflt'.
7177 EOM
7178
7179 while $test 1 ; do
7180         case "$usedtrace" in
7181         $define|true|[yY]*)
7182                 dflt='y'
7183                 ;;
7184         ?*)
7185                 dflt='y'
7186                 dflt_dtrace=$usedtrace
7187                 ;;
7188         *)
7189                 dflt='n'
7190                 ;;
7191         esac
7192
7193         rp='Support DTrace if available?'
7194         . ./myread
7195         case "$ans" in
7196         y|Y)    val="$define" ;;
7197         *)      val="$undef" ;;
7198         esac
7199         set usedtrace
7200         eval $setvar
7201
7202         test "X$usedtrace" != "X$define" && break
7203
7204         echo " "
7205         rp='Where is the dtrace executable?'
7206         dflt=$dflt_dtrace
7207         . ./getfile
7208         val="$ans"
7209         set dtrace
7210         eval $setvar
7211
7212         if $test -f $dtrace
7213         then
7214                 if $dtrace -h -s ../perldtrace.d \
7215                         -o perldtrace.tmp >/dev/null 2>&1 \
7216                         && rm -f perldtrace.tmp
7217                 then
7218                         echo " "
7219                         echo "Good: your $dtrace knows about the -h flag."
7220                 else
7221                         cat >&2 <<EOM
7222
7223 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7224 ***
7225 *** Your installed dtrace doesn't support the -h switch to compile a D
7226 *** program into a C header. Can't continue.
7227
7228 EOM
7229                         exit 1
7230                 fi
7231                 break;
7232         fi
7233
7234         case "$fastread" in
7235         yes)
7236                 cat >&2 <<EOM
7237
7238 *** $me:  Fatal Error:  $dtrace not found.
7239 *** Can't continue.
7240
7241 EOM
7242                 exit 1
7243                 ;;
7244         *)
7245                 echo "*** $dtrace was not found."
7246                 echo " "
7247                 ;;
7248         esac
7249 done
7250
7251 : See if we want extra modules installed
7252 echo " "
7253 case "$extras" in
7254 '') dflt='n';;
7255 *) dflt='y';;
7256 esac
7257 cat <<EOM
7258 Perl can be built with extra modules or bundles of modules which
7259 will be fetched from the CPAN and installed alongside Perl.
7260
7261 Notice that you will need access to the CPAN; either via the Internet,
7262 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7263 be asked later to configure the CPAN.pm module which will in turn do
7264 the installation of the rest of the extra modules or bundles.)
7265
7266 Notice also that if the modules require any external software such as
7267 libraries and headers (the libz library and the zlib.h header for the
7268 Compress::Zlib module, for example) you MUST have any such software
7269 already installed, this configuration process will NOT install such
7270 things for you.
7271
7272 If this doesn't make any sense to you, just accept the default '$dflt'.
7273 EOM
7274 rp='Install any extra modules (y or n)?'
7275 . ./myread
7276 case "$ans" in
7277 y|Y)
7278         cat <<EOM
7279
7280 Please list any extra modules or bundles to be installed from CPAN,
7281 with spaces between the names.  The names can be in any format the
7282 'install' command of CPAN.pm will understand.  (Answer 'none',
7283 without the quotes, to install no extra modules or bundles.)
7284 EOM
7285         rp='Extras?'
7286         dflt="$extras"
7287         . ./myread
7288         extras="$ans"
7289 esac
7290 case "$extras" in
7291 ''|'none')
7292         val=''
7293         $rm -f ../extras.lst
7294         ;;
7295 *)      echo "(Saving the list of extras for later...)"
7296         echo "$extras" > ../extras.lst
7297         val="'$extras'"
7298         ;;
7299 esac
7300 set extras
7301 eval $setvar
7302 echo " "
7303
7304 : determine where html pages for programs go
7305 set html1dir html1dir none
7306 eval $prefixit
7307 $cat <<EOM
7308
7309 If you wish to install html files for programs in $spackage, indicate
7310 the appropriate directory here.  To skip installing html files,
7311 answer "none".
7312 EOM
7313 case "$html1dir" in
7314 ''|none|$undef|' ') dflt=none ;;
7315 *) dflt=$html1dir ;;
7316 esac
7317 fn=dn+~
7318 rp="Directory for the main $spackage html pages?"
7319 . ./getfile
7320 prefixvar=html1dir
7321 . ./setprefixvar
7322 : Use ' ' for none so value is preserved next time through Configure
7323 $test X"$html1dir" = "X" && html1dir=' '
7324
7325 : determine where html pages for libraries and modules go
7326 set html3dir html3dir none
7327 eval $prefixit
7328 $cat <<EOM
7329
7330 If you wish to install html files for modules associated with $spackage,
7331 indicate the appropriate directory here.  To skip installing html files,
7332 answer "none".
7333 EOM
7334 : There is no obvious default.  If they have specified html1dir, then
7335 : try to key off that, possibly changing .../html1 into .../html3.
7336 case "$html3dir" in
7337 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7338 *) dflt=$html3dir ;;
7339 esac
7340 fn=dn+~
7341 rp="Directory for the $spackage module html pages?"
7342 . ./getfile
7343 prefixvar=html3dir
7344 . ./setprefixvar
7345 : Use ' ' for none so value is preserved next time through Configure
7346 $test X"$html3dir" = "X" && html3dir=' '
7347
7348 : determine whether to install perl also as /usr/bin/perl
7349
7350 echo " "
7351 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7352         $cat <<EOM
7353 Many scripts expect perl to be installed as /usr/bin/perl.
7354
7355 If you want to, I can install the perl you are about to compile
7356 as /usr/bin/perl (in addition to $bin/perl).
7357 EOM
7358         if test -f /usr/bin/perl; then
7359             $cat <<EOM
7360
7361 However, please note that because you already have a /usr/bin/perl,
7362 overwriting that with a new Perl would very probably cause problems.
7363 Therefore I'm assuming you don't want to do that (unless you insist).
7364
7365 EOM
7366             case "$installusrbinperl" in
7367             "$define"|[yY]*)    dflt='y';;
7368             *)                  dflt='n';;
7369             esac
7370         else
7371             $cat <<EOM
7372
7373 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7374
7375 EOM
7376             case "$installusrbinperl" in
7377             "$undef"|[nN]*)     dflt='n';;
7378             *)                  dflt='y';;
7379             esac
7380         fi
7381         rp="Do you want to install perl as /usr/bin/perl?"
7382         . ./myread
7383         case "$ans" in
7384         [yY]*)  val="$define";;
7385         *)      val="$undef" ;;
7386         esac
7387 else
7388         val="$undef"
7389 fi
7390 set installusrbinperl
7391 eval $setvar
7392
7393 : Check if we are using the GNU C library
7394 echo " "
7395 echo "Checking for GNU C Library..." >&4
7396 cat >try.c <<'EOCP'
7397 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7398    alone are insufficient to distinguish different versions, such as
7399    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7400    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7401 */
7402 #include <stdio.h>
7403 int main(void)
7404 {
7405 #ifdef __GLIBC__
7406 #   ifdef __GLIBC_MINOR__
7407 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7408 #           include <gnu/libc-version.h>
7409             printf("%s\n",  gnu_get_libc_version());
7410 #       else
7411             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7412 #       endif
7413 #   else
7414         printf("%d\n",  __GLIBC__);
7415 #   endif
7416     return 0;
7417 #else
7418     return 1;
7419 #endif
7420 }
7421 EOCP
7422 set try
7423 if eval $compile_ok && $run ./try > glibc.ver; then
7424         val="$define"
7425         gnulibc_version=`$cat glibc.ver`
7426         echo "You are using the GNU C Library version $gnulibc_version"
7427 else
7428         val="$undef"
7429         gnulibc_version=''
7430         echo "You are not using the GNU C Library"
7431 fi
7432 $rm_try glibc.ver
7433 set d_gnulibc
7434 eval $setvar
7435
7436 : see if nm is to be used to determine whether a symbol is defined or not
7437 case "$usenm" in
7438 '')
7439         dflt=''
7440         case "$d_gnulibc" in
7441         "$define")
7442                 echo " "
7443                 echo "nm probably won't work on the GNU C Library." >&4
7444                 dflt=n
7445                 ;;
7446         esac
7447         case "$dflt" in
7448         '')
7449                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7450                         echo " "
7451                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7452                         echo "'nm' won't be sufficient on this system." >&4
7453                         dflt=n
7454                 fi
7455                 ;;
7456         esac
7457         case "$dflt" in
7458         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7459                 if $test $dflt -gt 20; then
7460                         dflt=y
7461                 else
7462                         dflt=n
7463                 fi
7464                 ;;
7465         esac
7466         ;;
7467 *)
7468         case "$usenm" in
7469         true|$define) dflt=y;;
7470         *) dflt=n;;
7471         esac
7472         ;;
7473 esac
7474 $cat <<EOM
7475
7476 I can use $nm to extract the symbols from your C libraries. This
7477 is a time consuming task which may generate huge output on the disk (up
7478 to 3 megabytes) but that should make the symbols extraction faster. The
7479 alternative is to skip the 'nm' extraction part and to compile a small
7480 test program instead to determine whether each symbol is present. If
7481 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7482 this may be the best solution.
7483
7484 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7485
7486 EOM
7487 rp="Shall I use $nm to extract C symbols from the libraries?"
7488 . ./myread
7489 case "$ans" in
7490 [Nn]*) usenm=false;;
7491 *) usenm=true;;
7492 esac
7493
7494 runnm=$usenm
7495 case "$reuseval" in
7496 true) runnm=false;;
7497 esac
7498
7499 : nm options which may be necessary
7500 case "$nm_opt" in
7501 '') if $test -f /mach_boot; then
7502                 nm_opt=''       # Mach
7503         elif $test -d /usr/ccs/lib; then
7504                 nm_opt='-p'     # Solaris (and SunOS?)
7505         elif $test -f /dgux; then
7506                 nm_opt='-p'     # DG-UX
7507         elif $test -f /lib64/rld; then
7508                 nm_opt='-p'     # 64-bit Irix
7509         else
7510                 nm_opt=''
7511         fi;;
7512 esac
7513
7514 : nm options which may be necessary for shared libraries but illegal
7515 : for archive libraries.  Thank you, Linux.
7516 case "$nm_so_opt" in
7517 '')     case "$myuname" in
7518         *linux*|gnu*)
7519                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7520                         nm_so_opt='--dynamic'
7521                 fi
7522                 ;;
7523         esac
7524         ;;
7525 esac
7526
7527 : Figure out where the libc is located
7528 case "$runnm" in
7529 true)
7530 : get list of predefined functions in a handy place
7531 echo " "
7532 case "$libc" in
7533 '') libc=unknown
7534         case "$libs" in
7535         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7536         esac
7537         ;;
7538 esac
7539 case "$libs" in
7540 '') ;;
7541 *)  for thislib in $libs; do
7542         case "$thislib" in
7543         -lc|-lc_s)
7544                 : Handle C library specially below.
7545                 ;;
7546         -l*)
7547                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7548                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7549                         :
7550                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7551                         :
7552                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7553                         :
7554                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7555                         :
7556                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7557                         :
7558                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7559                         :
7560                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7561                         :
7562                 else
7563                         try=''
7564                 fi
7565                 libnames="$libnames $try"
7566                 ;;
7567         *) libnames="$libnames $thislib" ;;
7568         esac
7569         done
7570         ;;
7571 esac
7572 xxx=normal
7573 case "$libc" in
7574 unknown)
7575         set /lib/libc.$so
7576         for xxx in $libpth; do
7577                 $test -r $1 || set $xxx/libc.$so
7578                 : The messy sed command sorts on library version numbers.
7579                 $test -r $1 || \
7580                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7581                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7582                                 h
7583                                 s/[0-9][0-9]*/0000&/g
7584                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7585                                 G
7586                                 s/\n/ /' | \
7587                          $sort | $sed -e 's/^.* //'`
7588                 eval set \$$#
7589         done
7590         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
7591         $test -r $1 || set $sysroot/lib/libsys_s$_a
7592         ;;
7593 *)
7594         set blurfl
7595         ;;
7596 esac
7597 if $test -r "$1"; then
7598         echo "Your (shared) C library seems to be in $1."
7599         libc="$1"
7600 elif $test -r /lib/libc && $test -r /lib/clib; then
7601         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7602         xxx=apollo
7603         libc='/lib/clib /lib/libc'
7604         if $test -r /lib/syslib; then
7605                 echo "(Your math library is in /lib/syslib.)"
7606                 libc="$libc /lib/syslib"
7607         fi
7608 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7609         echo "Your C library seems to be in $libc, as you said before."
7610 elif $test -r $incpath/usr/lib/libc$_a; then
7611         libc=$incpath/usr/lib/libc$_a;
7612         echo "Your C library seems to be in $libc.  That's fine."
7613 elif $test -r /lib/libc$_a; then
7614         libc=/lib/libc$_a;
7615         echo "Your C library seems to be in $libc.  You're normal."
7616 else
7617         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7618                 :
7619         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7620                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7621         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7622                 :
7623         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7624                 :
7625         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7626                 :
7627         else
7628                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7629         fi
7630         if $test -r "$tans"; then
7631                 echo "Your C library seems to be in $tans, of all places."
7632                 libc=$tans
7633         else
7634                 libc='blurfl'
7635         fi
7636 fi
7637 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7638         dflt="$libc"
7639         cat <<EOM
7640
7641 If the guess above is wrong (which it might be if you're using a strange
7642 compiler, or your machine supports multiple models), you can override it here.
7643
7644 EOM
7645 else
7646         dflt=''
7647         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7648         cat >&4 <<EOM
7649 I can't seem to find your C library.  I've looked in the following places:
7650
7651 EOM
7652         $sed 's/^/      /' libpath
7653         cat <<EOM
7654
7655 None of these seems to contain your C library. I need to get its name...
7656
7657 EOM
7658 fi
7659 fn=f
7660 rp='Where is your C library?'
7661 . ./getfile
7662 libc="$ans"
7663
7664 echo " "
7665 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7666 set X `cat libnames`
7667 shift
7668 xxx=files
7669 case $# in 1) xxx=file; esac
7670 echo "Extracting names from the following $xxx for later perusal:" >&4
7671 echo " "
7672 $sed 's/^/      /' libnames >&4
7673 echo " "
7674 $echo $n "This may take a while...$c" >&4
7675
7676 for file in $*; do
7677         case $file in
7678         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7679         *) $nm $nm_opt $file 2>/dev/null;;
7680         esac
7681 done >libc.tmp
7682
7683 $echo $n ".$c"
7684 $grep fprintf libc.tmp > libc.ptf
7685 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7686 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7687 xxx='[ADTSIWi]'
7688 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7689         eval $xscan;\
7690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7691                 eval $xrun
7692 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7693         eval $xscan;\
7694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7695                 eval $xrun
7696 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7697         eval $xscan;\
7698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7699                 eval $xrun
7700 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7701         eval $xscan;\
7702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7703                 eval $xrun
7704 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7705         eval $xscan;\
7706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7707                 eval $xrun
7708 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7709         eval $xscan;\
7710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7711                 eval $xrun
7712 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7713                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7714         eval $xscan;\
7715         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7716                 eval $xrun
7717 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7718         eval $xscan;\
7719         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7720                 eval $xrun
7721 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7722         eval $xscan;\
7723         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7724                 eval $xrun
7725 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7726         eval $xscan;\
7727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7728                 eval $xrun
7729 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7730         eval $xscan;\
7731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7732                 eval $xrun
7733 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7734         eval $xscan;\
7735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7736                 eval $xrun
7737 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7738         eval $xscan;\
7739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7740                 eval $xrun
7741 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7742         eval $xscan;\
7743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7744                 eval $xrun
7745 else
7746         $nm -p $* 2>/dev/null >libc.tmp
7747         $grep fprintf libc.tmp > libc.ptf
7748         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7749                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7750         then
7751                 nm_opt='-p'
7752                 eval $xrun
7753         else
7754                 echo " "
7755                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7756                 com=''
7757                 if $ar t $libc > libc.tmp && \
7758                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7759                 then
7760                         for thisname in $libnames $libc; do
7761                                 $ar t $thisname >>libc.tmp
7762                         done
7763                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7764                         echo "Ok." >&4
7765                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7766                         for thisname in $libnames $libc; do
7767                                 $ar tv $thisname >>libc.tmp
7768                                 emximp -o tmp.imp $thisname \
7769                                     2>/dev/null && \
7770                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7771                                     < tmp.imp >>libc.tmp
7772                                 $rm -f tmp.imp
7773                         done
7774                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7775                         echo "Ok." >&4
7776                 else
7777                         echo "$ar didn't seem to work right." >&4
7778                         echo "Maybe this is a Cray...trying bld instead..." >&4
7779                         if  bld t $libc | \
7780                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7781                                 $test -s libc.list
7782                         then
7783                                 for thisname in $libnames; do
7784                                         bld t $libnames | \
7785                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7786                                         $ar t $thisname >>libc.tmp
7787                                 done
7788                                 echo "Ok." >&4
7789                         else
7790                                 echo "That didn't work either.  Giving up." >&4
7791                                 exit 1
7792                         fi
7793                 fi
7794         fi
7795 fi
7796 nm_extract="$com"
7797 case "$PASE" in
7798 define)
7799     echo " "
7800     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7801     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7802     ;;
7803 *)  if $test -f /lib/syscalls.exp; then
7804         echo " "
7805         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7806         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7807                 /lib/syscalls.exp >>libc.list
7808     fi
7809     ;;
7810 esac
7811 ;;
7812 esac
7813 $rm -f libnames libpath
7814
7815 : Check if we are using C++
7816 echo " "
7817 echo "Checking for C++..." >&4
7818 $cat >try.c <<'EOCP'
7819 #include <stdio.h>
7820 int main(void)
7821 {
7822 #ifdef __cplusplus
7823     return 0;
7824 #else
7825     return 1;
7826 #endif
7827 }
7828 EOCP
7829 set try
7830 if eval $compile_ok && $run ./try; then
7831         val="$define"
7832         echo "You are using a C++ compiler."
7833 else
7834         val="$undef"
7835         echo "You are not using a C++ compiler."
7836 fi
7837 $rm_try cplusplus$$
7838 set d_cplusplus
7839 eval $setvar
7840
7841 : is a C symbol defined?
7842 csym='tlook=$1;
7843 case "$3" in
7844 -v) tf=libc.tmp; tdc="";;
7845 -a) tf=libc.tmp; tdc="[]";;
7846 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7847 esac;
7848 case "$d_cplusplus" in
7849     $define)    extern_C="extern \"C\"" ;;
7850     *)          extern_C="extern"       ;;
7851 esac;
7852 tx=yes;
7853 case "$reuseval-$4" in
7854 true-) ;;
7855 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7856 esac;
7857 case "$tx" in
7858 yes)
7859         tval=false;
7860         if $test "$runnm" = true; then
7861                 if $contains $tlook $tf >/dev/null 2>&1; then
7862                         tval=true;
7863                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7864                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7865                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7866                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7867                         $rm_try;
7868                 fi;
7869         else
7870                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7871                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7872                 $rm_try;
7873         fi;
7874         ;;
7875 *)
7876         case "$tval" in
7877         $define) tval=true;;
7878         *) tval=false;;
7879         esac;
7880         ;;
7881 esac;
7882 eval "$2=$tval"'
7883
7884 : define an is-in-libc? function
7885 inlibc='echo " "; td=$define; tu=$undef;
7886 sym=$1; var=$2; eval "was=\$$2";
7887 tx=yes;
7888 case "$reuseval$was" in
7889 true) ;;
7890 true*) tx=no;;
7891 esac;
7892 case "$tx" in
7893 yes)
7894         set $sym tres -f;
7895         eval $csym;
7896         case "$tres" in
7897         true)
7898                 echo "$sym() found." >&4;
7899                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7900         *)
7901                 echo "$sym() NOT found." >&4;
7902                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7903         esac;;
7904 *)
7905         case "$was" in
7906         $define) echo "$sym() found." >&4;;
7907         *) echo "$sym() NOT found." >&4;;
7908         esac;;
7909 esac'
7910
7911 : see if dlopen exists
7912 xxx_runnm="$runnm"
7913 xxx_ccflags="$ccflags"
7914 runnm=false
7915 : with g++ one needs -shared to get is-in-libc to work for dlopen
7916 case "$gccversion" in
7917 '')     ;;
7918 *)      case "$d_cplusplus" in
7919         "$define") ccflags="$ccflags -shared" ;;
7920         esac
7921         ;;
7922 esac
7923 set dlopen d_dlopen
7924 eval $inlibc
7925 runnm="$xxx_runnm"
7926 ccflags="$xxx_ccflags"
7927
7928 : see if this is a unistd.h system
7929 set unistd.h i_unistd
7930 eval $inhdr
7931
7932 : determine which dynamic loading, if any, to compile in
7933 echo " "
7934 dldir="ext/DynaLoader"
7935 case "$usedl" in
7936 $define|y|true)
7937         dflt='y'
7938         usedl="$define"
7939         ;;
7940 $undef|n|false)
7941         dflt='n'
7942         usedl="$undef"
7943         ;;
7944 *)
7945         dflt='n'
7946         case "$d_dlopen" in
7947             $define) dflt='y' ;;
7948         esac
7949         : Does a dl_xxx.xs file exist for this operating system
7950         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7951         ;;
7952 esac
7953 rp="Do you wish to use dynamic loading?"
7954 . ./myread
7955 usedl="$ans"
7956 bin_ELF="$undef"
7957 case "$ans" in
7958 y*) usedl="$define"
7959         case "$dlsrc" in
7960         '')
7961                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7962                         dflt="$dldir/dl_${osname}.xs"
7963                 elif $test "$d_dlopen" = "$define" ; then
7964                         dflt="$dldir/dl_dlopen.xs"
7965                 else
7966                         dflt=''
7967                 fi
7968                 ;;
7969         *)      dflt="$dldir/$dlsrc"
7970                 ;;
7971         esac
7972     echo "The following dynamic loading files are available:"
7973         : Can not go over to $dldir because getfile has path hard-coded in.
7974         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7975         rp="Source file to use for dynamic loading"
7976         fn="fne"
7977         gfpth="$src"
7978         . ./getfile
7979         usedl="$define"
7980         : emulate basename
7981         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7982
7983         $cat << EOM
7984
7985 Some systems may require passing special flags to $cc -c to
7986 compile modules that will be used to create a shared library.
7987 To use no flags, say "none".
7988
7989 EOM
7990     case "$cccdlflags" in
7991     '') case "$gccversion" in
7992                 '') case "$osname" in
7993                         hpux)   dflt='+z' ;;
7994                         next)   dflt='none' ;;
7995                         irix*)  dflt='-KPIC' ;;
7996                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7997                         sunos)  dflt='-pic' ;;
7998                         *)      dflt='none' ;;
7999                     esac
8000                         ;;
8001                 *)  case "$osname" in
8002                         darwin) dflt='none' ;;
8003                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8004                         *)      dflt='-fpic' ;;
8005                     esac ;;
8006             esac ;;
8007         ' ') dflt='none' ;;
8008     *)  dflt="$cccdlflags" ;;
8009     esac
8010     
8011     case "$dflt" in
8012     none) dflt='' ;;
8013     esac
8014     
8015     # If -Dsysroot was specified, now's the time to add it
8016     # to cccdlflags
8017     if test "X$sysroot" != X; then
8018         case "$gccversion" in
8019         '') ;;
8020         *)  case "$dflt" in
8021                 *sysroot*) ;;
8022                 'undef'|*)
8023                     dflt="$dflt --sysroot=$sysroot" ;;
8024             esac
8025             ;;
8026         esac
8027     fi
8028     
8029     case "$dflt" in
8030     '') dflt='none';;
8031     esac
8032     
8033     rp="Any special flags to pass to $cc -c to compile shared library modules?"
8034     . ./myread
8035     case "$ans" in
8036     none) cccdlflags=' ' ;;
8037     *) cccdlflags="$ans" ;;
8038     esac
8039
8040     cat << EOM
8041
8042 Some systems use ld to create libraries that can be dynamically loaded,
8043 while other systems (such as those using ELF) use $cc.
8044
8045 EOM
8046
8047 : Determine if this is ELF
8048         $cat >try.c <<EOM
8049 /* Test for whether ELF binaries are produced */
8050 #include <fcntl.h>
8051 #$i_stdlib I_STDLIB
8052 #ifdef I_STDLIB
8053 #include <stdlib.h>
8054 #endif
8055 #$i_unistd I_UNISTD
8056 #ifdef I_UNISTD
8057 #include <unistd.h>
8058 #endif
8059 int main() {
8060         char b[4];
8061         int i = open("a.out",O_RDONLY);
8062         if(i == -1)
8063                 exit(1); /* fail */
8064         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8065                 exit(0); /* succeed (yes, it is ELF) */
8066         else
8067                 exit(1); /* fail */
8068 }
8069 EOM
8070         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8071                 bin_ELF="$define"
8072         fi
8073         $rm_try
8074
8075         case "$ld" in
8076         '')     if $test $bin_ELF = "$define"; then
8077                         cat <<EOM
8078 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8079 EOM
8080                         dflt="$cc"
8081                 else
8082                         echo "I'll use ld to build dynamic libraries."
8083                         dflt='ld'
8084                 fi
8085                 ;;
8086         *)      dflt="$ld"
8087                 ;;
8088         esac
8089
8090     rp="What command should be used to create dynamic libraries?"
8091     . ./myread
8092         ld="$ans"
8093
8094     cat << EOM
8095
8096 Some systems may require passing special flags to $ld to create a
8097 library that can be dynamically loaded.  If your ld flags include
8098 -L/other/path options to locate libraries outside your loader's normal
8099 search path, you may need to specify those -L options here as well.  To
8100 use no flags, say "none".
8101
8102 EOM
8103     case "$lddlflags" in
8104     '') case "$osname" in
8105                         haiku) dflt='-shared' ;;
8106                         hpux) dflt='-b';
8107                               case "$gccversion" in
8108                               '') dflt="$dflt +vnocompatwarnings" ;;
8109                               esac
8110                               ;;
8111                         *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8112                         next)  dflt='none' ;;
8113                         solaris) # See [perl #66604].
8114                                 # On Solaris 11, gcc -m64 on amd64 
8115                                 # appears not to understand -G.  gcc versions at
8116                                 # least as old as 3.4.3 support -shared, so just
8117                                 # use that with Solaris 11 and later, but keep
8118                                 # the old behavior for older Solaris versions.
8119                                 case "$gccversion" in
8120                                         '') dflt='-G' ;;
8121                                         *)      case "$osvers" in
8122                                                         2.?|2.10) dflt='-G' ;;
8123                                                         *) dflt='-shared' ;;
8124                                                 esac
8125                                                 ;;
8126                                 esac
8127                                 ;;
8128                         sunos) dflt='-assert nodefinitions' ;;
8129                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8130                 *)     dflt='none' ;;
8131                         esac
8132                         ;;
8133     *) dflt="$lddlflags" ;;
8134     esac
8135
8136     : Only do this for gcc, since, for example, qcc has no concept
8137     : of --sysroot.
8138     if $test "X$sysroot" != X; then
8139         case "$gccversion" in
8140         '') ;;
8141         *)
8142                dflt="$dflt --sysroot $sysroot"
8143         ;;
8144         esac
8145     fi
8146
8147         : Try to guess additional flags to pick up local libraries.
8148         : Be careful not to append to a plain 'none'
8149         case "$dflt" in
8150         none) dflt='' ;;
8151         esac
8152         for thisflag in $ldflags; do
8153                 case "$thisflag" in
8154                 -L*|-R*|-Wl,-R*)
8155                         case " $dflt " in
8156                         *" $thisflag "*) ;;
8157                         *) dflt="$dflt $thisflag" ;;
8158                         esac
8159                         ;;
8160                 esac
8161         done
8162
8163         case "$dflt" in
8164         ''|' ') dflt='none' ;;
8165         esac
8166
8167         case "$ldflags" in
8168         *-fstack-protector*)
8169             case "$dflt" in
8170                         *-fstack-protector*) ;; # Don't add it again
8171                         *) dflt="$dflt -fstack-protector" ;; 
8172                 esac
8173                 ;;
8174         esac
8175
8176
8177     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8178     . ./myread
8179     case "$ans" in
8180     none) lddlflags=' ' ;;
8181     *) lddlflags="$ans" ;;
8182     esac
8183
8184         cat <<EOM
8185
8186 Some systems may require passing special flags to $cc to indicate that
8187 the resulting executable will use dynamic linking.  To use no flags,
8188 say "none".
8189
8190 EOM
8191     case "$ccdlflags" in
8192     '') case "$osname" in
8193             *linux*|hpux|gnu*)  dflt='-Wl,-E' ;;
8194             next|sunos) dflt='none' ;;
8195             *)          dflt='none' ;;
8196             esac ;;
8197     ' ')  dflt='none' ;;
8198     *)  dflt="$ccdlflags" ;;
8199     esac
8200     rp="Any special flags to pass to $cc to use dynamic linking?"
8201     . ./myread
8202     case "$ans" in
8203     none) ccdlflags=' ' ;;
8204     *) ccdlflags="$ans" ;;
8205     esac
8206     ;;
8207 *)  usedl="$undef"
8208         ld='ld'
8209     dlsrc='dl_none.xs'
8210     lddlflags=''
8211     ccdlflags=''
8212     ;;
8213 esac
8214
8215 ld_can_script="$undef"
8216 case "$bin_ELF$usedl" in
8217 $define$define)
8218     # Abuse try.h and a.out names for neat cleanup
8219     $cat >try.c <<EOM
8220 void foo() {}
8221 void bar() {}
8222 EOM
8223     $cat >try.h <<EOM
8224 LIBTEST_42 {
8225  global:
8226   foo;
8227  local: *;
8228  };
8229 EOM
8230     if $cc $cccdlflags $ccdlflags $ccflags \
8231            $ldflags $lddlflags -o a.out try.c \
8232            -Wl,--version-script=try.h >/dev/null 2>&1 \
8233        &&  $test -s a.out ; then
8234         echo "ld supports scripting" >&4
8235         ld_can_script="$define"
8236     else
8237         echo "ld does not support scripting" >&4
8238     fi
8239     $rm_try
8240     ;;
8241 esac
8242
8243 : Do we want a shared libperl?
8244 also=''
8245 case "$usedl" in
8246 $undef)
8247         # No dynamic loading being used, so don't bother even to prompt.
8248         useshrplib='false'
8249         ;;
8250 *)      case "$useshrplib" in
8251         '')     case "$osname" in
8252                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8253                         dflt=y
8254                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8255                         ;;
8256                 next*)
8257                         case "$osvers" in
8258                         4*)     dflt=y
8259                                 also='Building a shared libperl is needed for MAB support.'
8260                                 ;;
8261                         *)      dflt=n
8262                                 ;;
8263                         esac
8264                         ;;
8265                 *)      dflt=n
8266                         ;;
8267                 esac
8268                 ;;
8269         $define|true|[Yy]*)
8270                 dflt=y
8271                 ;;
8272         *)      dflt=n
8273                 ;;
8274         esac
8275         $cat << EOM
8276
8277 The perl executable is normally obtained by linking perlmain.c with
8278 libperl${_a}, any static extensions (usually just DynaLoader), and
8279 any other libraries needed on this system (such as -lm, etc.).  Since
8280 your system supports dynamic loading, it is probably possible to build
8281 a shared libperl.$so.  If you will have more than one executable linked
8282 to libperl.$so, this will significantly reduce the size of each
8283 executable, but it may have a noticeable effect on performance.  The
8284 default is probably sensible for your system.
8285 $also
8286
8287 EOM
8288         rp="Build a shared libperl.$so (y/n)"
8289         . ./myread
8290         case "$ans" in
8291         true|$define|[Yy]*)
8292                 useshrplib='true'  ;;
8293         *)      useshrplib='false' ;;
8294         esac
8295         ;;
8296 esac
8297
8298 case "$useshrplib" in
8299 true)
8300         case "$userelocatableinc" in
8301         true|define)
8302                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8303                 echo "See INSTALL for an explanation why that won't work." >&4
8304                 exit 4
8305                 ;;
8306         esac
8307         case "$libperl" in
8308         '')
8309                 # Figure out a good name for libperl.so.  Since it gets stored in
8310                 # a version-specific architecture-dependent library, the version
8311                 # number isn't really that important, except for making cc/ld happy.
8312                 #
8313                 # A name such as libperl.so.10.1
8314                 majmin="libperl.$so.$patchlevel.$subversion"
8315                 # A name such as libperl.so.100
8316                 majonly=`echo $patchlevel $subversion |
8317                         $awk '{printf "%d%02d", $1, $2}'`
8318                 majonly=libperl.$so.$majonly
8319                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8320                 # rely on figuring it out from the naming of libc.
8321                 case "${osname}${osvers}" in
8322                 next4*)
8323                         dflt=libperl.5.$so
8324                         # XXX How handle the --version stuff for MAB?
8325                         ;;
8326                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8327                         dflt=libperl.$so
8328                         ;;
8329                 cygwin*) # ld links now against the dll directly
8330                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8331                         majonly=`echo $patchlevel $subversion |
8332                                 $awk '{printf "%03d%03d", $1, $2}'`
8333                         majonly=cygperl5.$majonly.$so
8334                         dflt=$majmin
8335                         ;;
8336                 *)      # Try to guess based on whether libc has major.minor.
8337                         case "$libc" in
8338                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8339                         *libc.$so.[0-9]*) dflt=$majonly ;;
8340                         *)      dflt=libperl.$so ;;
8341                         esac
8342                         ;;
8343                 esac
8344                 ;;
8345         *)      dflt=$libperl
8346                 ;;
8347         esac
8348         cat << EOM
8349
8350 I need to select a good name for the shared libperl.  If your system uses
8351 library names with major and minor numbers, then you might want something
8352 like $majmin.  Alternatively, if your system uses a single version
8353 number for shared libraries, then you might want to use $majonly.
8354 Or, your system might be quite happy with a simple libperl.$so.
8355
8356 Since the shared libperl will get installed into a version-specific
8357 architecture-dependent directory, the version number of the shared perl
8358 library probably isn't important, so the default should be o.k.
8359
8360 EOM
8361         rp='What name do you want to give to the shared libperl?'
8362         . ./myread
8363         libperl=$ans
8364         echo "Ok, I'll use $libperl"
8365         ;;
8366 *)
8367         libperl="libperl${_a}"
8368         ;;
8369 esac
8370
8371 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8372 case "$shrpdir" in
8373 '') ;;
8374 *)      $cat >&4 <<EOM
8375 WARNING:  Use of the shrpdir variable for the installation location of
8376 the shared $libperl is not supported.  It was never documented and
8377 will not work in this version.  Let me (perlbug@perl.org)
8378 know of any problems this may cause.
8379
8380 EOM
8381         case "$shrpdir" in
8382         "$archlibexp/CORE")
8383                 $cat >&4 <<EOM
8384 But your current setting of $shrpdir is
8385 the default anyway, so it's harmless.
8386 EOM
8387                 ;;
8388         *)
8389                 $cat >&4 <<EOM
8390 Further, your current attempted setting of $shrpdir
8391 conflicts with the value of $archlibexp/CORE
8392 that installperl will use.
8393 EOM
8394                 ;;
8395         esac
8396         ;;
8397 esac
8398
8399 # How will the perl executable find the installed shared $libperl?
8400 # Add $xxx to ccdlflags.
8401 # If we can't figure out a command-line option, use $shrpenv to
8402 # set env LD_RUN_PATH.  The main perl makefile uses this.
8403 shrpdir=$archlibexp/CORE
8404 xxx=''
8405 tmp_shrpenv=''
8406 if "$useshrplib"; then
8407     case "$osname" in
8408         aix)
8409                 # We'll set it in Makefile.SH...
8410                 ;;
8411         solaris)
8412                 xxx="-R $shrpdir"
8413                 ;;
8414         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8415                 xxx="-Wl,-R$shrpdir"
8416                 ;;
8417         bsdos|linux|irix*|dec_osf|gnu*)
8418                 xxx="-Wl,-rpath,$shrpdir"
8419                 ;;
8420         next)
8421                 # next doesn't like the default...
8422                 ;;
8423         haiku)
8424                 # Haiku doesn't like the default, either.
8425                 ;;
8426         hpux*)
8427                 # hpux doesn't like the default, either.
8428                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8429                 ;;
8430         cygwin)
8431                 # cygwin needs only ldlibpth
8432                 ;;
8433         *)
8434                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8435                 ;;
8436         esac
8437         case "$xxx" in
8438         '') ;;
8439         *)
8440                 # Only add $xxx if it isn't already in ccdlflags.
8441                 case " $ccdlflags " in
8442                 *" $xxx "*)     ;;
8443                 *)      ccdlflags="$ccdlflags $xxx"
8444                         cat <<EOM >&4
8445
8446 Adding $xxx to the flags
8447 passed to $ld so that the perl executable will find the
8448 installed shared $libperl.
8449
8450 EOM
8451                         ;;
8452                 esac
8453                 ;;
8454         esac
8455 fi
8456 # Fix ccdlflags in AIX for building external extensions.
8457 # (For building Perl itself bare -bE:perl.exp is needed,
8458 #  Makefile.SH takes care of this.)
8459 case "$osname" in
8460 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8461 esac
8462 # Respect a hint or command-line value.
8463 case "$shrpenv" in
8464 '') shrpenv="$tmp_shrpenv" ;;
8465 esac
8466 case "$ldlibpthname" in
8467 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8468 none)   ldlibpthname='' ;;
8469 esac
8470
8471 : determine where manual pages are on this system
8472 echo " "
8473 case "$sysman" in
8474 '')
8475         syspath='/usr/share/man/man1 /usr/man/man1'
8476         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8477         syspath="$syspath /usr/man/u_man/man1"
8478         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8479         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8480         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8481         sysman=`./loc . /usr/man/man1 $syspath`
8482         ;;
8483 esac
8484 if $test -d "$sysman"; then
8485         echo "System manual is in $sysman." >&4
8486 else
8487         echo "Could not find manual pages in source form." >&4
8488 fi
8489
8490 : determine where manual pages go
8491 set man1dir man1dir none
8492 eval $prefixit
8493 $cat <<EOM
8494
8495 $spackage has manual pages available in source form.
8496 EOM
8497 case "$nroff" in
8498 nroff)
8499         echo "However, you don't have nroff, so they're probably useless to you."
8500         case "$man1dir" in
8501         '') man1dir="none";;
8502         esac;;
8503 esac
8504 echo "If you don't want the manual sources installed, answer 'none'."
8505 case "$man1dir" in
8506 ' ') dflt=none
8507         ;;
8508 '')
8509         lookpath="$prefixexp/share/man/man1"
8510         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8511         lookpath="$lookpath $prefixexp/man/p_man/man1"
8512         lookpath="$lookpath $prefixexp/man/u_man/man1"
8513         lookpath="$lookpath $prefixexp/man/man.1"
8514         case "$sysman" in
8515         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8516         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8517         esac
8518         set dflt
8519         eval $prefixup
8520         ;;
8521 *)  dflt="$man1dir"
8522         ;;
8523 esac
8524 echo " "
8525 fn=dn+~
8526 rp="Where do the main $spackage manual pages (source) go?"
8527 . ./getfile
8528 if $test "X$man1direxp" != "X$ansexp"; then
8529         installman1dir=''
8530 fi
8531 prefixvar=man1dir
8532 . ./setprefixvar
8533
8534 case "$man1dir" in
8535 '')     man1dir=' '
8536         installman1dir='';;
8537 esac
8538
8539 : What suffix to use on installed man pages
8540
8541 case "$man1dir" in
8542 ' ')
8543         man1ext='0'
8544         ;;
8545 *)
8546         rp="What suffix should be used for the main $spackage man pages?"
8547         case "$man1ext" in
8548         '')     case "$man1dir" in
8549                 *1)  dflt=1 ;;
8550                 *1p) dflt=1p ;;
8551                 *1pm) dflt=1pm ;;
8552                 *l) dflt=l;;
8553                 *n) dflt=n;;
8554                 *o) dflt=o;;
8555                 *p) dflt=p;;
8556                 *C) dflt=C;;
8557                 *L) dflt=L;;
8558                 *L1) dflt=L1;;
8559                 *) dflt=1;;
8560                 esac
8561                 ;;
8562         *)      dflt="$man1ext";;
8563         esac
8564         . ./myread
8565         man1ext="$ans"
8566         ;;
8567 esac
8568
8569 : see if we can have long filenames
8570 echo " "
8571 first=123456789abcdef
8572 $rm -f $first
8573 if (echo hi >$first) 2>/dev/null; then
8574         if $test -f 123456789abcde; then
8575                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8576                 val="$undef"
8577         else
8578                 echo 'You can have filenames longer than 14 characters.'>&4
8579                 val="$define"
8580         fi
8581 else
8582         $cat <<'EOM'
8583 You can't have filenames longer than 14 chars.
8584 You can't even think about them!
8585 EOM
8586         val="$undef"
8587 fi
8588 set d_flexfnam
8589 eval $setvar
8590 $rm -rf 123456789abcde*
8591
8592 : determine where library module manual pages go
8593 set man3dir man3dir none
8594 eval $prefixit
8595 $cat <<EOM
8596
8597 $spackage has manual pages for many of the library modules.
8598 EOM
8599
8600 case "$nroff" in
8601 nroff)
8602         $cat <<'EOM'
8603 However, you don't have nroff, so they're probably useless to you.
8604 EOM
8605         case "$man3dir" in
8606         '') man3dir="none";;
8607         esac;;
8608 esac
8609
8610 case "$d_flexfnam" in
8611 undef)
8612         $cat <<'EOM'
8613 However, your system can't handle the long file names like File::Basename.3.
8614 EOM
8615         case "$man3dir" in
8616         '') man3dir="none";;
8617         esac;;
8618 esac
8619
8620 echo "If you don't want the manual sources installed, answer 'none'."
8621 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8622 case "$man3dir" in
8623 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8624         if $test -d "$privlib/man/man3"; then
8625                 cat <<EOM >&4
8626
8627 WARNING:  Previous versions of perl installed man3 pages into
8628 $privlib/man/man3.  This version will suggest a
8629 new default of $dflt.
8630 EOM
8631                 tdflt=$dflt
8632                 dflt='n'
8633                 rp='Do you wish to preserve the old behavior?(y/n)'
8634                 . ./myread
8635                 case "$ans" in
8636                 y*) dflt="$privlib/man/man3" ;;
8637                 *)  dflt=$tdflt ;;
8638                 esac
8639     fi
8640         ;;
8641 *)      dflt="$man3dir" ;;
8642 esac
8643 case "$dflt" in
8644 ' ') dflt=none ;;
8645 esac
8646 echo " "
8647 fn=dn+~
8648 rp="Where do the $package library man pages (source) go?"
8649 . ./getfile
8650 prefixvar=man3dir
8651 . ./setprefixvar
8652
8653 case "$man3dir" in
8654 '')     man3dir=' '
8655         installman3dir='';;
8656 esac
8657
8658 : What suffix to use on installed man pages
8659 case "$man3dir" in
8660 ' ')
8661         man3ext='0'
8662         ;;
8663 *)
8664         rp="What suffix should be used for the $package library man pages?"
8665         case "$man3ext" in
8666         '')     case "$man3dir" in
8667                 *3)  dflt=3 ;;
8668                 *3p) dflt=3p ;;
8669                 *3pm) dflt=3pm ;;
8670                 *l) dflt=l;;
8671                 *n) dflt=n;;
8672                 *o) dflt=o;;
8673                 *p) dflt=p;;
8674                 *C) dflt=C;;
8675                 *L) dflt=L;;
8676                 *L3) dflt=L3;;
8677                 *) dflt=3;;
8678                 esac
8679                 ;;
8680         *)      dflt="$man3ext";;
8681         esac
8682         . ./myread
8683         man3ext="$ans"
8684         ;;
8685 esac
8686
8687 : see if we have to deal with yellow pages, now NIS.
8688 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8689         if $test -f /usr/etc/nibindd; then
8690                 echo " "
8691                 echo "I'm fairly confident you're on a NeXT."
8692                 echo " "
8693                 rp='Do you get the hosts file via NetInfo?'
8694                 dflt=y
8695                 case "$hostcat" in
8696                 nidump*) ;;
8697                 '') ;;
8698                 *) dflt=n;;
8699                 esac
8700                 . ./myread
8701                 case "$ans" in
8702                 y*) hostcat='nidump hosts .';;
8703                 *)      case "$hostcat" in
8704                         nidump*) hostcat='';;
8705                         esac
8706                         ;;
8707                 esac
8708         fi
8709         case "$hostcat" in
8710         nidump*) ;;
8711         *)
8712                 case "$hostcat" in
8713                 *ypcat*) dflt=y;;
8714                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8715                                 dflt=y
8716                         else
8717                                 dflt=n
8718                         fi;;
8719                 *) dflt=n;;
8720                 esac
8721                 echo " "
8722                 rp='Are you getting the hosts file via yellow pages?'
8723                 . ./myread
8724                 case "$ans" in
8725                 y*) hostcat='ypcat hosts';;
8726                 *) hostcat='cat /etc/hosts';;
8727                 esac
8728                 ;;
8729         esac
8730 fi
8731 case "$hostcat" in
8732 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8733 esac
8734 case "$groupcat" in
8735 '') test -f /etc/group && groupcat='cat /etc/group';;
8736 esac
8737 case "$passcat" in
8738 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8739 esac
8740
8741 : now get the host name
8742 echo " "
8743 echo "Figuring out host name..." >&4
8744 case "$myhostname" in
8745 '') cont=true
8746         echo 'Maybe "hostname" will work...'
8747         if tans=`sh -c hostname 2>&1` ; then
8748                 myhostname=$tans
8749                 phostname=hostname
8750                 cont=''
8751         fi
8752         ;;
8753 *) cont='';;
8754 esac
8755 if $test "$cont"; then
8756         if ./xenix; then
8757                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8758                 if tans=`cat /etc/systemid 2>&1` ; then
8759                         myhostname=$tans
8760                         phostname='cat /etc/systemid'
8761                         echo "Whadyaknow.  Xenix always was a bit strange..."
8762                         cont=''
8763                 fi
8764         elif $test -r /etc/systemid; then
8765                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8766         fi
8767 fi
8768 if $test "$cont"; then
8769         echo 'No, maybe "uuname -l" will work...'
8770         if tans=`sh -c 'uuname -l' 2>&1` ; then
8771                 myhostname=$tans
8772                 phostname='uuname -l'
8773         else
8774                 echo 'Strange.  Maybe "uname -n" will work...'
8775                 if tans=`sh -c 'uname -n' 2>&1` ; then
8776                         myhostname=$tans
8777                         phostname='uname -n'
8778                 else
8779                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8780                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8781                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8782                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8783                         else
8784                                 case "$myhostname" in
8785                                 '') echo "Does this machine have an identity crisis or something?"
8786                                         phostname='';;
8787                                 *)
8788                                         echo "Well, you said $myhostname before..."
8789                                         phostname='echo $myhostname';;
8790                                 esac
8791                         fi
8792                 fi
8793         fi
8794 fi
8795 case "$myhostname" in
8796 '') myhostname=noname ;;
8797 esac
8798 : you do not want to know about this
8799 set $myhostname
8800 myhostname=$1
8801
8802 : verify guess
8803 if $test "$myhostname" ; then
8804         dflt=y
8805         rp='Your host name appears to be "'$myhostname'".'" Right?"
8806         . ./myread
8807         case "$ans" in
8808         y*) ;;
8809         *) myhostname='';;
8810         esac
8811 fi
8812
8813 : bad guess or no guess
8814 while $test "X$myhostname" = X ; do
8815         dflt=''
8816         rp="Please type the (one word) name of your host:"
8817         . ./myread
8818         myhostname="$ans"
8819 done
8820
8821 : translate upper to lower if necessary
8822 case "$myhostname" in
8823 *[A-Z]*)
8824         echo "(Normalizing case in your host name)"
8825         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8826         ;;
8827 esac
8828
8829 case "$myhostname" in
8830 *.*)
8831         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8832         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8833         echo "(Trimming domain name from host name--host name is now $myhostname)"
8834         ;;
8835 *) case "$mydomain" in
8836         '')
8837                 {
8838                         test "X$hostcat" = "Xypcat hosts" &&
8839                         ypmatch "$myhostname" hosts 2>/dev/null |\
8840                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8841                         $test -s hosts
8842                 } || {
8843                         test "X$hostcat" != "X" &&
8844                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8845                                         /[       ]$myhostname[  . ]/p" > hosts
8846                 }
8847                 tmp_re="[       . ]"
8848                 if $test -f hosts; then
8849                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8850                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8851                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8852                                 hosts | $sort | $uniq | \
8853                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8854                         case `$echo X$dflt` in
8855                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8856                                 dflt=.
8857                                 ;;
8858                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8859                                 ;;
8860                         esac
8861                 else
8862                         echo "(I cannot locate a hosts database anywhere)"
8863                         dflt=.
8864                 fi
8865                 case "$dflt" in
8866                 .)
8867                         tans=`./loc resolv.conf X /etc /usr/etc`
8868                         if $test -f "$tans"; then
8869                                 echo "(Attempting domain name extraction from $tans)"
8870                                 dflt=.`$sed -n -e 's/   / /g' \
8871                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8872                                   -e 1q 2>/dev/null`
8873                                 case "$dflt" in
8874                                 .) dflt=.`$sed -n -e 's/        / /g' \
8875                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8876                                      -e 1q 2>/dev/null`
8877                                         ;;
8878                                 esac
8879                         fi
8880                         ;;
8881                 esac
8882                 case "$dflt" in
8883                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8884                         dflt=.`sh -c domainname 2>/dev/null`
8885                         case "$dflt" in
8886                         '') dflt='.';;
8887                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8888                         esac
8889                         ;;
8890                 esac
8891                 case "$dflt$osname" in
8892                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8893                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8894                         ;;
8895                 esac
8896                 case "$dflt" in
8897                 .) echo "(Lost all hope -- silly guess then)"
8898                         dflt='.nonet'
8899                         ;;
8900                 esac
8901                 $rm -f hosts
8902                 ;;
8903         *) dflt="$mydomain";;
8904         esac;;
8905 esac
8906 echo " "
8907 rp="What is your domain name?"
8908 . ./myread
8909 tans="$ans"
8910 case "$ans" in
8911 '') ;;
8912 .*) ;;
8913 *) tans=".$tans";;
8914 esac
8915 mydomain="$tans"
8916
8917 : translate upper to lower if necessary
8918 case "$mydomain" in
8919 *[A-Z]*)
8920         echo "(Normalizing case in your domain name)"
8921         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8922         ;;
8923 esac
8924
8925 : a little sanity check here
8926 case "$phostname" in
8927 '') ;;
8928 *)
8929         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8930         $myhostname$mydomain|$myhostname) ;;
8931         *)
8932                 case "$phostname" in
8933                 sed*)
8934                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8935                         ;;
8936                 *)
8937                         echo "(That doesn't agree with your $phostname command, by the way.)"
8938                         ;;
8939                 esac
8940         ;;
8941         esac
8942         ;;
8943 esac
8944
8945 : determine the e-mail address of the user who is running us
8946 $cat <<EOM
8947
8948 I need to get your e-mail address in Internet format if possible, i.e.
8949 something like user@host.domain. Please answer accurately since I have
8950 no easy means to double check it. The default value provided below
8951 is most probably close to reality but may not be valid from outside
8952 your organization...
8953
8954 EOM
8955 cont=x
8956 while test "$cont"; do
8957         case "$MAILDOMAIN" in
8958         '')
8959                 if $test -s /etc/mailname; then
8960                         maildomain=`$cat /etc/mailname`
8961                 else
8962                         maildomain="$myhostname$mydomain"
8963                 fi
8964                 ;;
8965         *)  maildomain="$MAILDOMAIN";;
8966         esac
8967         case "$cf_email" in
8968         '') dflt="$cf_by@$maildomain";;
8969         *)  dflt="$cf_email";;
8970         esac
8971         rp='What is your e-mail address?'
8972         . ./myread
8973         cf_email="$ans"
8974         case "$cf_email" in
8975         *@*.*) cont='' ;;
8976         *)
8977                 rp='Address does not look like an Internet one.  Use it anyway?'
8978                 case "$fastread" in
8979                 yes) dflt=y ;;
8980                 *) dflt=n ;;
8981                 esac
8982                 . ./myread
8983                 case "$ans" in
8984                 y*) cont='' ;;
8985                 *) echo " " ;;
8986                 esac
8987                 ;;
8988         esac
8989 done
8990
8991 : Ask e-mail of administrator
8992 $cat <<EOM
8993
8994 If you or somebody else will be maintaining perl at your site, please
8995 fill in the correct e-mail address here so that they may be contacted
8996 if necessary. Currently, the "perlbug" program included with perl
8997 will send mail to this address in addition to perlbug@perl.org. You may
8998 enter "none" for no administrator.
8999
9000 EOM
9001 case "$perladmin" in
9002 '') dflt="$cf_email";;
9003 *) dflt="$perladmin";;
9004 esac
9005 rp='Perl administrator e-mail address'
9006 . ./myread
9007 perladmin="$ans"
9008
9009 : determine whether to only install version-specific parts.
9010 echo " "
9011 $cat <<EOM
9012 Do you want to install only the version-specific parts of the perl
9013 distribution?  Usually you do *not* want to do this.
9014 EOM
9015 case "$versiononly" in
9016 "$define"|[Yy]*|true) dflt='y' ;;
9017 *) dflt='n';
9018 esac
9019 rp="Do you want to install only the version-specific parts of perl?"
9020 . ./myread
9021 case "$ans" in
9022 [yY]*)  val="$define";;
9023 *)      val="$undef" ;;
9024 esac
9025 set versiononly
9026 eval $setvar
9027
9028 case "$versiononly" in
9029 "$define") inc_version_list=''
9030            inc_version_list_init=0
9031            ;;
9032 esac
9033
9034 : figure out how to guarantee perl startup
9035 : XXX Note that this currently takes advantage of the bug that binexp ignores
9036 :     the Configure -Dinstallprefix setting, which in turn means that under
9037 :     relocatable @INC, initialinstalllocation is what binexp started as.
9038 case "$startperl" in
9039 '')
9040         case "$sharpbang" in
9041         *!)
9042                 $cat <<EOH
9043
9044 I can use the #! construct to start perl on your system. This will
9045 make startup of perl scripts faster, but may cause problems if you
9046 want to share those scripts and perl is not in a standard place
9047 ($initialinstalllocation/perl) on all your platforms. The alternative
9048 is to force a shell by starting the script with a single ':' character.
9049
9050 EOH
9051                 case "$versiononly" in
9052                 "$define")      dflt="$initialinstalllocation/perl$version";;
9053                 *)              dflt="$initialinstalllocation/perl";;
9054                 esac
9055                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9056                 . ./myread
9057                 case "$ans" in
9058                 none)   startperl=": # use perl";;
9059                 *)      startperl="#!$ans"
9060                         if $test 30 -lt `echo "$ans" | wc -c`; then
9061                                 $cat >&4 <<EOM
9062
9063 WARNING:  Some systems limit the #! command to 32 characters.
9064 If you experience difficulty running Perl scripts with #!, try
9065 installing Perl in a directory with a shorter pathname.
9066
9067 EOM
9068                         fi ;;
9069                 esac
9070                 ;;
9071         *) startperl=": # use perl"
9072                 ;;
9073         esac
9074         ;;
9075 esac
9076 echo "I'll use $startperl to start perl scripts."
9077
9078 : figure best path for perl in scripts
9079 case "$perlpath" in
9080 '')
9081         case "$versiononly" in
9082         "$define")      perlpath="$initialinstalllocation/perl$version";;
9083         *)              perlpath="$initialinstalllocation/perl";;
9084         esac
9085         case "$startperl" in
9086         *!*) ;;
9087         *)
9088                 $cat <<EOH
9089
9090 I will use the "eval 'exec'" idiom to start Perl on your system.
9091 I can use the full path of your Perl binary for this purpose, but
9092 doing so may cause problems if you want to share those scripts and
9093 Perl is not always in a standard place ($initialinstalllocation/perl).
9094
9095 EOH
9096                 dflt="$initialinstalllocation/perl"
9097                 rp="What path shall I use in \"eval 'exec'\"?"
9098                 . ./myread
9099                 perlpath="$ans"
9100                 ;;
9101         esac
9102         ;;
9103 esac
9104 case "$startperl" in
9105 *!*)    ;;
9106 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9107 esac
9108
9109 : determine where public executable scripts go
9110 set scriptdir scriptdir
9111 eval $prefixit
9112 case "$scriptdir" in
9113 '')
9114         dflt="$bin"
9115         : guess some guesses
9116         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9117         $test -d /usr/share/bin     && dflt=/usr/share/bin
9118         $test -d /usr/local/script  && dflt=/usr/local/script
9119         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9120         $test -d $prefixexp/script  && dflt=$prefixexp/script
9121         set dflt
9122         eval $prefixup
9123         ;;
9124 *)  dflt="$scriptdir"
9125         ;;
9126 esac
9127 $cat <<EOM
9128
9129 Some installations have a separate directory just for executable scripts so
9130 that they can mount it across multiple architectures but keep the scripts in
9131 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9132 Or you might just lump your scripts in with all your other executables.
9133
9134 EOM
9135 fn=d~
9136 rp='Where do you keep publicly executable scripts?'
9137 . ./getfile
9138 if $test "X$ansexp" != "X$scriptdirexp"; then
9139         installscript=''
9140 fi
9141 installscriptdir=''
9142 prefixvar=scriptdir
9143 . ./setprefixvar
9144 : A little fix up for an irregularly named variable.
9145 installscript="$installscriptdir"
9146
9147 : determine where add-on public executables go
9148 case "$sitebin" in
9149 '')     dflt=$siteprefix/bin ;;
9150 *)      dflt=$sitebin ;;
9151 esac
9152 fn=d~
9153 rp='Pathname where the add-on public executables should be installed?'
9154 . ./getfile
9155 prefixvar=sitebin
9156 . ./setprefixvar
9157
9158 : determine where add-on html pages go
9159 : There is no standard location, so try to copy the previously-selected
9160 : directory structure for the core html pages.
9161 case "$sitehtml1dir" in
9162 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9163 *)     dflt=$sitehtml1dir ;;
9164 esac
9165 case "$dflt" in
9166 ''|' ') dflt=none ;;
9167 esac
9168 fn=dn+~
9169 rp='Pathname where the site-specific html pages should be installed?'
9170 . ./getfile
9171 prefixvar=sitehtml1dir
9172 . ./setprefixvar
9173
9174 : determine where add-on library html pages go
9175 : There is no standard location, so try to copy the previously-selected
9176 : directory structure for the core html pages.
9177 case "$sitehtml3dir" in
9178 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9179 *)     dflt=$sitehtml3dir ;;
9180 esac
9181 case "$dflt" in
9182 ''|' ') dflt=none ;;
9183 esac
9184 fn=dn+~
9185 rp='Pathname where the site-specific library html pages should be installed?'
9186 . ./getfile
9187 prefixvar=sitehtml3dir
9188 . ./setprefixvar
9189
9190 : determine where add-on manual pages go
9191 case "$siteman1dir" in
9192 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9193 *)      dflt=$siteman1dir ;;
9194 esac
9195 case "$dflt" in
9196 ''|' ') dflt=none ;;
9197 esac
9198 fn=dn+~
9199 rp='Pathname where the site-specific manual pages should be installed?'
9200 . ./getfile
9201 prefixvar=siteman1dir
9202 . ./setprefixvar
9203
9204 : determine where add-on library man pages go
9205 case "$siteman3dir" in
9206 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9207 *)      dflt=$siteman3dir ;;
9208 esac
9209 case "$dflt" in
9210 ''|' ') dflt=none ;;
9211 esac
9212 fn=dn+~
9213 rp='Pathname where the site-specific library manual pages should be installed?'
9214 . ./getfile
9215 prefixvar=siteman3dir
9216 . ./setprefixvar
9217
9218 : determine where add-on public executable scripts go
9219 case "$sitescript" in
9220 '')     dflt=$siteprefix/script
9221         $test -d $dflt || dflt=$sitebin ;;
9222 *)  dflt="$sitescript" ;;
9223 esac
9224 fn=d~+
9225 rp='Pathname where add-on public executable scripts should be installed?'
9226 . ./getfile
9227 prefixvar=sitescript
9228 . ./setprefixvar
9229
9230 : Check if faststdio is requested and available
9231 case "$usefaststdio" in
9232 $define|true|[yY]*|'')
9233         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9234         case "$xversion" in
9235         [68])   dflt='y' ;;
9236         *)      dflt='n' ;;
9237         esac
9238         ;;
9239 *) dflt='n';;
9240 esac
9241 cat <<EOM
9242
9243 Perl can be built to use 'fast stdio', which means using the stdio
9244 library but also directly manipulating the stdio buffers to enable
9245 faster I/O.  Using stdio is better for backward compatibility (especially
9246 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9247 interface has been preferred instead of stdio.
9248
9249 If this doesn't make any sense to you, just accept the default '$dflt'.
9250 EOM
9251 rp='Use the "fast stdio" if available?'
9252 . ./myread
9253 case "$ans" in
9254 y|Y)    val="$define" ;;
9255 *)      val="$undef" ;;
9256 esac
9257 set usefaststdio
9258 eval $setvar
9259
9260
9261 : define an is-a-typedef? function
9262 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9263 case "$inclist" in
9264 "") inclist="sys/types.h";;
9265 esac;
9266 eval "varval=\$$var";
9267 case "$varval" in
9268 "")
9269         $rm -f temp.c;
9270         for inc in $inclist; do
9271                 echo "#include <$inc>" >>temp.c;
9272         done;
9273         echo "#ifdef $type" >> temp.c;
9274         echo "printf(\"We have $type\");" >> temp.c;
9275         echo "#endif" >> temp.c;
9276         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9277         if $contains $type temp.E >/dev/null 2>&1; then
9278                 eval "$var=\$type";
9279         else
9280                 eval "$var=\$def";
9281         fi;
9282         $rm -f temp.?;;
9283 *) eval "$var=\$varval";;
9284 esac'
9285
9286 : define an is-a-typedef? function that prompts if the type is not available.
9287 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9288 case "$inclist" in
9289 "") inclist="sys/types.h";;
9290 esac;
9291 eval "varval=\$$var";
9292 case "$varval" in
9293 "")
9294         $rm -f temp.c;
9295         for inc in $inclist; do
9296                 echo "#include <$inc>" >>temp.c;
9297         done;
9298         echo "#ifdef $type" >> temp.c;
9299         echo "printf(\"We have $type\");" >> temp.c;
9300         echo "#endif" >> temp.c;
9301         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9302         echo " " ;
9303         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9304         if $contains $type temp.E >/dev/null 2>&1; then
9305                 echo "$type found." >&4;
9306                 eval "$var=\$type";
9307         else
9308                 echo "$type NOT found." >&4;
9309                 dflt="$def";
9310                 . ./myread ;
9311                 eval "$var=\$ans";
9312         fi;
9313         $rm -f temp.?;;
9314 *) eval "$var=\$varval";;
9315 esac'
9316
9317 : see what type lseek is declared as in the kernel
9318 rp="What is the type used for lseek's offset on this system?"
9319 set off_t lseektype long stdio.h sys/types.h
9320 eval $typedef_ask
9321
9322 echo " "
9323 echo "Checking to see how big your file offsets are..." >&4
9324 $cat >try.c <<EOCP
9325 #include <sys/types.h>
9326 #include <stdio.h>
9327 int main()
9328 {
9329     printf("%d\n", (int)sizeof($lseektype));
9330     return(0);
9331 }
9332 EOCP
9333 set try
9334 if eval $compile_ok; then
9335         lseeksize=`$run ./try`
9336         echo "Your file offsets are $lseeksize bytes long."
9337 else
9338         dflt=$longsize
9339         echo " "
9340         echo "(I can't seem to compile the test program.  Guessing...)"
9341         rp="What is the size of your file offsets (in bytes)?"
9342         . ./myread
9343         lseeksize="$ans"
9344 fi
9345 $rm_try
9346
9347 : see what type file positions are declared as in the library
9348 rp="What is the type for file position used by fsetpos()?"
9349 set fpos_t fpostype long stdio.h sys/types.h
9350 eval $typedef_ask
9351
9352 : Check size for Fpos_t
9353 echo " "
9354 case "$fpostype" in
9355 *_t) zzz="$fpostype"    ;;
9356 *)   zzz="fpos_t"       ;;
9357 esac
9358 echo "Checking the size of $zzz..." >&4
9359 cat > try.c <<EOCP
9360 #include <sys/types.h>
9361 #include <stdio.h>
9362 #$i_stdlib I_STDLIB
9363 #ifdef I_STDLIB
9364 #include <stdlib.h>
9365 #endif
9366 int main() {
9367     printf("%d\n", (int)sizeof($fpostype));
9368     exit(0);
9369 }
9370 EOCP
9371 set try
9372 if eval $compile_ok; then
9373         yyy=`$run ./try`
9374         case "$yyy" in
9375         '')     fpossize=4
9376                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9377                 ;;
9378         *)      fpossize=$yyy
9379                 echo "Your $zzz is $fpossize bytes long."
9380                 ;;
9381         esac
9382 else
9383         dflt="$longsize"
9384         echo " " >&4
9385         echo "(I can't compile the test program.  Guessing...)" >&4
9386         rp="What is the size of your file positions (in bytes)?"
9387         . ./myread
9388         fpossize="$ans"
9389 fi
9390
9391 : Check for large file support
9392 # Backward compatibility (uselfs is deprecated).
9393 case "$uselfs" in
9394 "$define"|true|[yY]*)
9395         cat <<EOM >&4
9396
9397 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9398 EOM
9399         uselargefiles="$define"
9400         ;;
9401 esac
9402
9403 case "$lseeksize:$fpossize" in
9404 8:8) cat <<EOM
9405
9406 You can have files larger than 2 gigabytes.
9407 EOM
9408    val="$define" ;;
9409 *)    case "$uselargefiles" in
9410    "$undef"|false|[nN]*) dflt='n' ;;
9411    *)   dflt='y' ;;
9412    esac
9413    cat <<EOM
9414
9415 Perl can be built to understand large files (files larger than 2 gigabytes)
9416 on some systems.  To do so, Configure can be run with -Duselargefiles.
9417
9418 If this doesn't make any sense to you, just accept the default '$dflt'.
9419 EOM
9420    rp='Try to understand large files, if available?'
9421    . ./myread
9422    case "$ans" in
9423    y|Y)         val="$define" ;;
9424    *)           val="$undef"  ;;
9425    esac
9426    ;;
9427 esac
9428 set uselargefiles
9429 eval $setvar
9430 : Look for a hint-file generated 'call-back-unit'.  If the
9431 : user has specified that a large files perl is to be built,
9432 : we may need to set or change some other defaults.
9433 if $test -f uselargefiles.cbu; then
9434         echo "Your platform has some specific hints regarding large file builds, using them..."
9435         . ./uselargefiles.cbu
9436 fi
9437 case "$uselargefiles" in
9438 "$define")
9439         if $test -f uselargefiles.cbu; then
9440                 echo " "
9441                 echo "Rechecking to see how big your file offsets are..." >&4
9442                 $cat >try.c <<EOCP
9443 #include <sys/types.h>
9444 #include <stdio.h>
9445 int main()
9446 {
9447     printf("%d\n", (int)sizeof($lseektype));
9448     return(0);
9449 }
9450 EOCP
9451                 set try
9452                 if eval $compile_ok; then
9453                         lseeksize=`$run ./try`
9454                         $echo "Your file offsets are now $lseeksize bytes long."
9455                 else
9456                         dflt="$lseeksize"
9457                         echo " "
9458                         echo "(I can't seem to compile the test program.  Guessing...)"
9459                         rp="What is the size of your file offsets (in bytes)?"
9460                         . ./myread
9461                         lseeksize="$ans"
9462                 fi
9463                 case "$fpostype" in
9464                 *_t) zzz="$fpostype"    ;;
9465                 *)   zzz="fpos_t"       ;;
9466                 esac
9467                 $echo $n "Rechecking the size of $zzz...$c" >&4
9468                 $cat > try.c <<EOCP
9469 #include <sys/types.h>
9470 #include <stdio.h>
9471 #$i_stdlib I_STDLIB
9472 #ifdef I_STDLIB
9473 #include <stdlib.h>
9474 #endif
9475 int main() {
9476     printf("%d\n", (int)sizeof($fpostype));
9477     return(0);
9478 }
9479 EOCP
9480                 set try
9481                 if eval $compile_ok; then
9482                         yyy=`$run ./try`
9483                         dflt="$lseeksize"
9484                         case "$yyy" in
9485                         '')     echo " "
9486                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9487                                 ;;
9488                         *)      fpossize=$yyy
9489                                 echo " $fpossize bytes." >&4
9490                                 ;;
9491                         esac
9492                 else
9493                         dflt="$fpossize"
9494                         echo " "
9495                         echo "(I can't compile the test program.  Guessing...)" >&4
9496                         rp="What is the size of your file positions (in bytes)?"
9497                         . ./myread
9498                         fpossize="$ans"
9499                 fi
9500                 $rm_try
9501         fi
9502         ;;
9503 esac
9504
9505 : Check if we want perlio
9506 useperlio="$define"
9507
9508 : Set the vendorbin variables
9509 case "$vendorprefix" in
9510 '')     d_vendorbin="$undef"
9511         vendorbin=''
9512         vendorbinexp=''
9513         ;;
9514 *)      d_vendorbin="$define"
9515         : determine where vendor-supplied executables go.
9516         case "$vendorbin" in
9517         '') dflt=$vendorprefix/bin ;;
9518         *)      dflt="$vendorbin" ;;
9519         esac
9520         fn=d~+
9521         rp='Pathname for the vendor-supplied executables directory?'
9522         . ./getfile
9523         vendorbin="$ans"
9524         vendorbinexp="$ansexp"
9525         ;;
9526 esac
9527 prefixvar=vendorbin
9528 . ./installprefix
9529
9530 : Set the vendorhtml1dir variables
9531 case "$vendorprefix" in
9532 '')     vendorhtml1dir=''
9533         vendorhtml1direxp=''
9534         ;;
9535 *)      : determine where vendor-supplied html pages go.
9536         : There is no standard location, so try to copy the previously-selected
9537         : directory structure for the core html pages.
9538         : XXX Better default suggestions would be welcome.
9539         case "$vendorhtml1dir" in
9540         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9541         *)      dflt=$vendorhtml1dir ;;
9542         esac
9543         case "$dflt" in
9544         ''|' ') dflt=none ;;
9545         esac
9546         fn=dn+~
9547         rp='Pathname for the vendor-supplied html pages?'
9548         . ./getfile
9549         vendorhtml1dir="$ans"
9550         vendorhtml1direxp="$ansexp"
9551         ;;
9552 esac
9553 : Use ' ' for none so value is preserved next time through Configure
9554 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9555 prefixvar=vendorhtml1dir
9556 . ./installprefix
9557
9558 : Set the vendorhtml3dir variables
9559 case "$vendorprefix" in
9560 '')     vendorhtml3dir=''
9561         vendorhtml3direxp=''
9562         ;;
9563 *)      : determine where vendor-supplied module html pages go.
9564         : There is no standard location, so try to copy the previously-selected
9565         : directory structure for the core html pages.
9566         : XXX Better default suggestions would be welcome.
9567         case "$vendorhtml3dir" in
9568         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9569         *)      dflt=$vendorhtml3dir ;;
9570         esac
9571         case "$dflt" in
9572         ''|' ') dflt=none ;;
9573         esac
9574         fn=dn+~
9575         rp='Pathname for the vendor-supplied html pages?'
9576         . ./getfile
9577         vendorhtml3dir="$ans"
9578         vendorhtml3direxp="$ansexp"
9579         ;;
9580 esac
9581 : Use ' ' for none so value is preserved next time through Configure
9582 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9583 prefixvar=vendorhtml3dir
9584 . ./installprefix
9585
9586 : Set the vendorman1dir variables
9587 case "$vendorprefix" in
9588 '')     vendorman1dir=''
9589         vendorman1direxp=''
9590         ;;
9591 *)      : determine where vendor-supplied manual pages go.
9592         case "$vendorman1dir" in
9593         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9594         *)      dflt=$vendorman1dir ;;
9595         esac
9596         case "$dflt" in
9597         ''|' ') dflt=none ;;
9598         esac
9599         fn=nd~+
9600         rp='Pathname for the vendor-supplied manual section 1 pages?'
9601         . ./getfile
9602         vendorman1dir="$ans"
9603         vendorman1direxp="$ansexp"
9604         ;;
9605 esac
9606 : Use ' ' for none so value is preserved next time through Configure
9607 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9608 prefixvar=vendorman1dir
9609 . ./installprefix
9610
9611 : Set the vendorman3dir variables
9612 case "$vendorprefix" in
9613 '')     vendorman3dir=''
9614         vendorman3direxp=''
9615         ;;
9616 *)      : determine where vendor-supplied module manual pages go.
9617         case "$vendorman3dir" in
9618         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9619         *)      dflt=$vendorman3dir ;;
9620         esac
9621         case "$dflt" in
9622         ''|' ') dflt=none ;;
9623         esac
9624         fn=nd~+
9625         rp='Pathname for the vendor-supplied manual section 3 pages?'
9626         . ./getfile
9627         vendorman3dir="$ans"
9628         vendorman3direxp="$ansexp"
9629         ;;
9630 esac
9631 : Use ' ' for none so value is preserved next time through Configure
9632 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9633 prefixvar=vendorman3dir
9634 . ./installprefix
9635
9636 : Set the vendorscript variables
9637 case "$vendorprefix" in
9638 '')     d_vendorscript="$undef"
9639         vendorscript=''
9640         vendorscriptexp=''
9641         ;;
9642 *)      d_vendorscript="$define"
9643         : determine where vendor-supplied scripts go.
9644         case "$vendorscript" in
9645         '')     dflt=$vendorprefix/script
9646                 $test -d $dflt || dflt=$vendorbin ;;
9647         *)  dflt="$vendorscript" ;;
9648         esac
9649         $cat <<EOM
9650
9651 The installation process will create a directory for
9652 vendor-supplied scripts.
9653
9654 EOM
9655         fn=d~+
9656         rp='Pathname for the vendor-supplied scripts directory?'
9657         . ./getfile
9658         vendorscript="$ans"
9659         vendorscriptexp="$ansexp"
9660         ;;
9661 esac
9662 prefixvar=vendorscript
9663 . ./installprefix
9664
9665 : script used to emit important warnings
9666 cat >warn <<EOS
9667 $startsh
9668 if test \$# -gt 0; then
9669         echo "\$@" >msg
9670 else
9671         cat >msg
9672 fi
9673 echo "*** WARNING:" >&4
9674 sed -e 's/^/*** /' <msg >&4
9675 echo "*** " >&4
9676 cat msg >>config.msg
9677 echo " " >>config.msg
9678 rm -f msg
9679 EOS
9680 chmod +x warn
9681 $eunicefix warn
9682
9683 : see which of string.h or strings.h is needed
9684 echo " "
9685 strings=`./findhdr string.h`
9686 if $test "$strings" && $test -r "$strings"; then
9687         echo "Using <string.h> instead of <strings.h>." >&4
9688         val="$define"
9689 else
9690         val="$undef"
9691         strings=`./findhdr strings.h`
9692         if $test "$strings" && $test -r "$strings"; then
9693                 echo "Using <strings.h> instead of <string.h>." >&4
9694         else
9695                 ./warn "No string header found -- You'll surely have problems."
9696         fi
9697 fi
9698 set i_string
9699 eval $setvar
9700 case "$i_string" in
9701 "$undef") strings=`./findhdr strings.h`;;
9702 *)        strings=`./findhdr string.h`;;
9703 esac
9704
9705 : see if qgcvt exists
9706 set qgcvt d_qgcvt
9707 eval $inlibc
9708
9709 : Check print/scan long double stuff
9710 echo " "
9711
9712 if $test X"$d_longdbl" = X"$define"; then
9713
9714 echo "Checking how to print long doubles..." >&4
9715
9716 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9717         $cat >try.c <<'EOCP'
9718 #include <sys/types.h>
9719 #include <stdio.h>
9720 int main() {
9721   double d = 123.456;
9722   printf("%.3f\n", d);
9723 }
9724 EOCP
9725         set try
9726         if eval $compile; then
9727                 yyy=`$run ./try`
9728                 case "$yyy" in
9729                 123.456)
9730                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9731                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9732                         echo "We will use %f."
9733                         ;;
9734                 esac
9735         fi
9736 fi
9737
9738 if $test X"$sPRIfldbl" = X; then
9739         $cat >try.c <<'EOCP'
9740 #include <sys/types.h>
9741 #include <stdio.h>
9742 int main() {
9743   long double d = 123.456;
9744   printf("%.3Lf\n", d);
9745 }
9746 EOCP
9747         set try
9748         if eval $compile; then
9749                 yyy=`$run ./try`
9750                 case "$yyy" in
9751                 123.456)
9752                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9753                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9754                         echo "We will use %Lf."
9755                         ;;
9756                 esac
9757         fi
9758 fi
9759
9760 if $test X"$sPRIfldbl" = X; then
9761         $cat >try.c <<'EOCP'
9762 #include <sys/types.h>
9763 #include <stdio.h>
9764 int main() {
9765   long double d = 123.456;
9766   printf("%.3llf\n", d);
9767 }
9768 EOCP
9769         set try
9770         if eval $compile; then
9771                 yyy=`$run ./try`
9772                 case "$yyy" in
9773                 123.456)
9774                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9775                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9776                         echo "We will use %llf."
9777                         ;;
9778                 esac
9779         fi
9780 fi
9781
9782 if $test X"$sPRIfldbl" = X; then
9783         $cat >try.c <<'EOCP'
9784 #include <sys/types.h>
9785 #include <stdio.h>
9786 int main() {
9787   long double d = 123.456;
9788   printf("%.3lf\n", d);
9789 }
9790 EOCP
9791         set try
9792         if eval $compile; then
9793                 yyy=`$run ./try`
9794                 case "$yyy" in
9795                 123.456)
9796                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9797                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9798                         echo "We will use %lf."
9799                         ;;
9800                 esac
9801         fi
9802 fi
9803
9804 if $test X"$sPRIfldbl" = X; then
9805         echo "Cannot figure out how to print long doubles." >&4
9806 else
9807         sSCNfldbl=$sPRIfldbl    # expect consistency
9808 fi
9809
9810 $rm_try
9811
9812 fi # d_longdbl
9813
9814 case "$sPRIfldbl" in
9815 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9816         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9817         d_SCNfldbl="$undef";
9818         ;;
9819 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9820         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9821         d_SCNfldbl="$define";
9822         ;;
9823 esac
9824
9825 : Check how to convert floats to strings.
9826
9827 if test "X$d_Gconvert" = X; then
9828
9829 echo " "
9830 echo "Checking for an efficient way to convert floats to strings."
9831 echo " " > try.c
9832 case "$uselongdouble" in
9833 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9834 esac
9835 case "$d_longdbl" in
9836 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9837 esac
9838 case "$d_PRIgldbl" in
9839 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9840 esac
9841 $cat >>try.c <<EOP
9842 #ifdef TRY_gconvert
9843 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9844 char *myname = "gconvert";
9845 #endif
9846 #ifdef TRY_gcvt
9847 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9848 char *myname = "gcvt";
9849 #endif
9850 #ifdef TRY_qgcvt
9851 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9852 char *myname = "qgcvt";
9853 #define DOUBLETYPE long double
9854 #endif
9855 #ifdef TRY_sprintf
9856 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9857 #ifdef HAS_PRIgldbl
9858 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9859 #else
9860 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9861 #endif
9862 #else
9863 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9864 #endif
9865 char *myname = "sprintf";
9866 #endif
9867
9868 #ifndef DOUBLETYPE
9869 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9870 #define DOUBLETYPE long double
9871 #else
9872 #define DOUBLETYPE double
9873 #endif
9874 #endif
9875
9876 #include <stdio.h>
9877
9878 #$i_stdlib I_STDLIB
9879 #ifdef I_STDLIB
9880 #include <stdlib.h>
9881 #endif
9882 #$i_string I_STRING
9883 #ifdef I_STRING
9884 #  include <string.h>
9885 #else
9886 #  include <strings.h>
9887 #endif
9888
9889 int checkit(char *expect, char *got)
9890 {
9891     if (strcmp(expect, got)) {
9892                 printf("%s oddity:  Expected %s, got %s\n",
9893                         myname, expect, got);
9894                 exit(1);
9895         }
9896 }
9897
9898 int main()
9899 {
9900         char buf[64];
9901         buf[63] = '\0';
9902
9903         /* This must be 1st test on (which?) platform */
9904         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9905         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9906         checkit("0.1", buf);
9907
9908         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9909         checkit("0.01", buf);
9910
9911         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9912         checkit("0.001", buf);
9913
9914         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9915         checkit("0.0001", buf);
9916
9917         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9918         if (strlen(buf) > 5)
9919             checkit("9e-005", buf); /* for Microsoft ?? */
9920         else
9921             checkit("9e-05", buf);
9922
9923         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9924         checkit("1", buf);
9925
9926         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9927         checkit("1.1", buf);
9928
9929         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9930         checkit("1.01", buf);
9931
9932         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9933         checkit("1.001", buf);
9934
9935         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9936         checkit("1.0001", buf);
9937
9938         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9939         checkit("1.00001", buf);
9940
9941         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9942         checkit("1.000001", buf);
9943
9944         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9945         checkit("0", buf);
9946
9947         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9948         checkit("-1", buf);
9949
9950         /* Some Linux gcvt's give 1.e+5 here. */
9951         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9952         checkit("100000", buf);
9953
9954         /* Some Linux gcvt's give -1.e+5 here. */
9955         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9956         checkit("-100000", buf);
9957
9958         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9959         checkit("123.456", buf);
9960
9961         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9962         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9963         /* 34 should be enough to scare even long double
9964          * places into using the e notation. */
9965         if (strlen(buf) > 5)
9966             checkit("1e+034", buf); /* for Microsoft */
9967         else
9968             checkit("1e+34", buf);
9969
9970         /* For Perl, if you add additional tests here, also add them to
9971          * t/base/num.t for benefit of platforms not using Configure or
9972          * overriding d_Gconvert */
9973
9974         exit(0);
9975 }
9976 EOP
9977 : first add preferred functions to our list
9978 xxx_list=""
9979 for xxx_convert in $gconvert_preference; do
9980     case $xxx_convert in
9981     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9982     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9983     esac
9984 done
9985 : then add any others
9986 for xxx_convert in gconvert gcvt sprintf; do
9987     case "$xxx_list" in
9988     *$xxx_convert*) ;;
9989     *) xxx_list="$xxx_list $xxx_convert" ;;
9990     esac
9991 done
9992
9993 case "$d_longdbl$uselongdouble" in
9994 "$define$define")
9995     : again, add preferred functions to our list first
9996     xxx_ld_list=""
9997     for xxx_convert in $gconvert_ld_preference; do
9998         case $xxx_convert in
9999         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10000         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10001         esac
10002     done
10003     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10004     for xxx_convert in qgcvt sprintf $xxx_list; do
10005         case "$xxx_ld_list" in
10006         $xxx_convert*|*" $xxx_convert"*) ;;
10007         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10008         esac
10009     done
10010     : if sprintf cannot do long doubles, move it to the end
10011     if test "$d_PRIgldbl" != "$define"; then
10012         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10013     fi
10014     : if no qgcvt, remove it
10015     if test "$d_qgcvt" != "$define"; then
10016         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10017     fi
10018     : use the ld_list
10019     xxx_list="$xxx_ld_list"
10020     ;;
10021 esac
10022
10023 for xxx_convert in $xxx_list; do
10024         echo "Trying $xxx_convert..."
10025         $rm -f try try$_o core
10026         set try -DTRY_$xxx_convert
10027         if eval $compile; then
10028                 echo "$xxx_convert() found." >&4
10029                 if $run ./try; then
10030                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10031                         break;
10032                 else
10033                         echo "...But $xxx_convert didn't work as I expected."
10034                         xxx_convert=''
10035                 fi
10036         else
10037                 echo "$xxx_convert NOT found." >&4
10038         fi
10039 done
10040
10041 if test X$xxx_convert = X; then
10042     echo "*** WHOA THERE!!! ***" >&4
10043     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10044     xxx_convert=sprintf
10045 fi
10046
10047 case "$xxx_convert" in
10048 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10049 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10050 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10051 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10052    "$define$define$define")
10053       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10054    "$define$define$undef")
10055       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10056    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10057    esac
10058    ;;
10059 esac
10060
10061 fi
10062 $rm_try
10063
10064 : see if _fwalk exists
10065 set fwalk d__fwalk
10066 eval $inlibc
10067
10068 : Initialize h_fcntl
10069 h_fcntl=false
10070
10071 : Initialize h_sysfile
10072 h_sysfile=false
10073
10074 : access call always available on UNIX
10075 set access d_access
10076 eval $inlibc
10077
10078 : locate the flags for 'access()'
10079 case "$d_access" in
10080 "$define")
10081         echo " "
10082         $cat >access.c <<EOCP
10083 #include <sys/types.h>
10084 #ifdef I_FCNTL
10085 #include <fcntl.h>
10086 #endif
10087 #ifdef I_SYS_FILE
10088 #include <sys/file.h>
10089 #endif
10090 #ifdef I_UNISTD
10091 #include <unistd.h>
10092 #endif
10093 #$i_stdlib I_STDLIB
10094 #ifdef I_STDLIB
10095 #include <stdlib.h>
10096 #endif
10097 int main() {
10098         exit(R_OK);
10099 }
10100 EOCP
10101         : check sys/file.h first, no particular reason here
10102         if $test `./findhdr sys/file.h` && \
10103                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10104                 h_sysfile=true;
10105                 echo "<sys/file.h> defines the *_OK access constants." >&4
10106         elif $test `./findhdr fcntl.h` && \
10107                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10108                 h_fcntl=true;
10109                 echo "<fcntl.h> defines the *_OK access constants." >&4
10110         elif $test `./findhdr unistd.h` && \
10111                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10112                 echo "<unistd.h> defines the *_OK access constants." >&4
10113         else
10114                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10115         fi
10116         ;;
10117 esac
10118 $rm -f access*
10119
10120 : see if accessx exists
10121 set accessx d_accessx
10122 eval $inlibc
10123
10124 : see if aintl exists
10125 set aintl d_aintl
10126 eval $inlibc
10127
10128 : see if alarm exists
10129 set alarm d_alarm
10130 eval $inlibc
10131
10132 : see if 64bit time functions exists
10133
10134 set ctime64 d_ctime64
10135 eval $inlibc
10136
10137 set localtime64 d_localtime64
10138 eval $inlibc
10139
10140 set gmtime64 d_gmtime64
10141 eval $inlibc
10142
10143 set mktime64 d_mktime64
10144 eval $inlibc
10145
10146 set difftime64 d_difftime64
10147 eval $inlibc
10148
10149 set asctime64 d_asctime64
10150 eval $inlibc
10151
10152 : see if POSIX threads are available
10153 set pthread.h i_pthread
10154 eval $inhdr
10155
10156 : define a function to check prototypes
10157 $cat > protochk <<EOSH
10158 $startsh
10159 cc="$cc"
10160 optimize="$optimize"
10161 ccflags="$ccflags"
10162 prototype="$prototype"
10163 define="$define"
10164 rm_try="$rm_try"
10165 usethreads=$usethreads
10166 i_pthread=$i_pthread
10167 pthread_h_first=$pthread_h_first
10168 EOSH
10169
10170 $cat >> protochk <<'EOSH'
10171
10172 $rm_try
10173 foo="$1"
10174 shift
10175 while test $# -ge 2; do
10176         case "$1" in
10177                 $define) echo "#include <$2>" >> try.c ;;
10178                 literal) echo "$2" >> try.c ;;
10179         esac
10180     # Extra magic for the benefit of systems that need pthread.h
10181     # to be included early to correctly detect threadsafe functions.
10182     # Such functions must guarantee themselves, though, that the usethreads
10183     # and i_pthread have been defined, before calling protochk.
10184     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10185         echo "#include <pthread.h>" >> try.c
10186         pthread_h_done=yes
10187     fi
10188     shift 2
10189 done
10190 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10191 cat >> try.c <<'EOCP'
10192 #ifdef CAN_PROTOTYPE
10193 #define _(args) args
10194 #else
10195 #define _(args) ()
10196 #endif
10197 EOCP
10198 echo "$foo" >> try.c
10199 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10200 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10201 status=$?
10202 $rm_try
10203 exit $status
10204 EOSH
10205 chmod +x protochk
10206 $eunicefix protochk
10207
10208 : Define hasproto macro for Configure internal use
10209 hasproto='varname=$1; func=$2; shift; shift;
10210 while $test $# -ge 2; do
10211         case "$1" in
10212         $define) echo "#include <$2>";;
10213         esac ;
10214     shift 2;
10215 done > try.c;
10216 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10217 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10218         echo "$func() prototype found.";
10219         val="$define";
10220 else
10221         echo "$func() prototype NOT found.";
10222         val="$undef";
10223 fi;
10224 set $varname;
10225 eval $setvar;
10226 $rm_try tryout.c'
10227
10228 : see if sys/types.h has to be included
10229 set sys/types.h i_systypes
10230 eval $inhdr
10231
10232 : see if sys/select.h has to be included
10233 set sys/select.h i_sysselct
10234 eval $inhdr
10235
10236 : Define hasfield macro for Configure internal use
10237 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10238 while $test $# -ge 2; do
10239         case "$1" in
10240         $define) echo "#include <$2>";;
10241         esac ;
10242     shift 2;
10243 done > try.c;
10244 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10245 set try;
10246 if eval $compile; then
10247         val="$define";
10248 else
10249         val="$undef";
10250 fi;
10251 set $varname;
10252 eval $setvar;
10253 $rm_try'
10254
10255 : see if we should include time.h, sys/time.h, or both
10256 echo " "
10257 if test "X$timeincl" = X; then
10258         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10259         $echo $n "I'm now running the test program...$c"
10260         $cat >try.c <<EOCP
10261 #include <sys/types.h>
10262 #ifdef I_TIME
10263 #include <time.h>
10264 #endif
10265 #ifdef I_SYSTIME
10266 #ifdef SYSTIMEKERNEL
10267 #define KERNEL
10268 #endif
10269 #include <sys/time.h>
10270 #endif
10271 #ifdef I_SYSSELECT
10272 #include <sys/select.h>
10273 #endif
10274 #$i_stdlib I_STDLIB
10275 #ifdef I_STDLIB
10276 #include <stdlib.h>
10277 #endif
10278 int main()
10279 {
10280         struct tm foo;
10281 #ifdef S_TIMEVAL
10282         struct timeval bar;
10283 #endif
10284 #ifdef S_TIMEZONE
10285         struct timezone tzp;
10286 #endif
10287         if (foo.tm_sec == foo.tm_sec)
10288                 exit(0);
10289 #ifdef S_TIMEVAL
10290         if (bar.tv_sec == bar.tv_sec)
10291                 exit(0);
10292 #endif
10293         exit(1);
10294 }
10295 EOCP
10296         flags=''
10297         for s_timezone in '-DS_TIMEZONE' ''; do
10298         sysselect=''
10299         for s_timeval in '-DS_TIMEVAL' ''; do
10300         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10301         for i_time in '' '-DI_TIME'; do
10302         for i_systime in '-DI_SYSTIME' ''; do
10303                 case "$flags" in
10304                 '') $echo $n ".$c"
10305                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10306                         if eval $compile; then
10307                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10308                                 shift
10309                                 flags="$*"
10310                                 echo " "
10311                                 $echo $n "Succeeded with $flags$c"
10312                         fi
10313                         ;;
10314                 esac
10315         done
10316         done
10317         done
10318         done
10319         done
10320         timeincl=''
10321         echo " "
10322         case "$flags" in
10323         *SYSTIMEKERNEL*) i_systimek="$define"
10324                 timeincl=`./findhdr sys/time.h`
10325                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10326         *) i_systimek="$undef";;
10327         esac
10328         case "$flags" in
10329         *I_TIME*) i_time="$define"
10330                 timeincl=`./findhdr time.h`" $timeincl"
10331                 echo "We'll include <time.h>." >&4;;
10332         *) i_time="$undef";;
10333         esac
10334         case "$flags" in
10335         *I_SYSTIME*) i_systime="$define"
10336                 timeincl=`./findhdr sys/time.h`" $timeincl"
10337                 echo "We'll include <sys/time.h>." >&4;;
10338         *) i_systime="$undef";;
10339         esac
10340         $rm_try
10341 fi
10342 : see if struct tm knows about tm_zone
10343 case "$i_systime$i_time" in
10344 *$define*)
10345         echo " "
10346         echo "Checking to see if your struct tm has tm_zone field..." >&4
10347         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10348         eval $hasfield
10349         ;;
10350 *)      val="$undef"
10351         set d_tm_tm_zone
10352         eval $setvar
10353         ;;
10354 esac
10355 case "$d_tm_tm_zone" in
10356 "$define")      echo "Yes, it does."   ;;
10357 *)              echo "No, it doesn't." ;;
10358 esac
10359 : see if struct tm knows about tm_gmtoff
10360 case "$i_systime$i_time" in
10361 *$define*)
10362         echo " "
10363         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10364         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10365         eval $hasfield
10366         ;;
10367 *)      val="$undef"
10368         set d_tm_tm_gmtoff
10369         eval $setvar
10370         ;;
10371 esac
10372 case "$d_tm_tm_gmtoff" in
10373 "$define")      echo "Yes, it does."   ;;
10374 *)              echo "No, it doesn't." ;;
10375 esac
10376
10377 : see if asctime_r exists
10378 set asctime_r d_asctime_r
10379 eval $inlibc
10380 case "$d_asctime_r" in
10381 "$define")
10382         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10383         case "$d_asctime_r_proto:$usethreads" in
10384         ":define")      d_asctime_r_proto=define
10385                 set d_asctime_r_proto asctime_r $hdrs
10386                 eval $hasproto ;;
10387         *)      ;;
10388         esac
10389         case "$d_asctime_r_proto" in
10390         define)
10391         case "$asctime_r_proto" in
10392         ''|0) try='char* asctime_r(const struct tm*, char*);'
10393         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10394         esac
10395         case "$asctime_r_proto" in
10396         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10397         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10398         esac
10399         case "$asctime_r_proto" in
10400         ''|0) try='int asctime_r(const struct tm*, char*);'
10401         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10402         esac
10403         case "$asctime_r_proto" in
10404         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10405         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10406         esac
10407         case "$asctime_r_proto" in
10408         ''|0)   d_asctime_r=undef
10409                 asctime_r_proto=0
10410                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10411         * )     case "$asctime_r_proto" in
10412                 REENTRANT_PROTO*) ;;
10413                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10414                 esac
10415                 echo "Prototype: $try" ;;
10416         esac
10417         ;;
10418         *)      case "$usethreads" in
10419                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10420                 esac
10421                 d_asctime_r=undef
10422                 asctime_r_proto=0
10423                 ;;
10424         esac
10425         ;;
10426 *)      asctime_r_proto=0
10427         ;;
10428 esac
10429
10430 : see if atolf exists
10431 set atolf d_atolf
10432 eval $inlibc
10433
10434 : see if atoll exists
10435 set atoll d_atoll
10436 eval $inlibc
10437
10438 : Look for GCC-style attribute format
10439 case "$d_attribute_format" in
10440 '')
10441 echo " "
10442 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10443 $cat >attrib.c <<'EOCP'
10444 #include <stdio.h>
10445 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10446 EOCP
10447 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10448         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10449                 echo "Your C compiler doesn't support __attribute__((format))."
10450                 val="$undef"
10451         else
10452                 echo "Your C compiler supports __attribute__((format))."
10453                 val="$define"
10454         fi
10455 else
10456         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10457         val="$undef"
10458 fi
10459 ;;
10460 *) val="$d_attribute_format" ;;
10461 esac
10462 set d_attribute_format
10463 eval $setvar
10464 $rm -f attrib*
10465
10466 : Look for GCC-style attribute format with null format allowed
10467 case "$d_printf_format_null" in
10468 '') case "$d_attribute_format" in
10469     $define)
10470         echo " "
10471         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10472 $cat >attrib.c <<EOCP
10473 #include <stdio.h>
10474 #$i_stdlib I_STDLIB
10475 #ifdef I_STDLIB
10476 #include <stdlib.h>
10477 #endif
10478 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10479 int null_printf (char* pat,...) { return (int)pat; }
10480 int main () { exit(null_printf(NULL)); }
10481 EOCP
10482         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10483             : run the executable in case it produces a run-time warning
10484             if $run ./attrib >>attrib.out 2>&1; then
10485                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10486                     echo "Your C compiler doesn't allow __printf__ format to be null."
10487                     val="$undef"
10488                 else
10489                     echo "Your C compiler allows __printf__ format to be null."
10490                     val="$define"
10491                 fi
10492             else
10493             echo "Your C compiler executable failed with __printf__ format null."
10494             val="$undef"
10495         fi
10496     else
10497         echo "Your C compiler fails with __printf__ format null."
10498         val="$undef"
10499     fi
10500     ;;
10501     *)  val="$undef" ;;
10502     esac
10503 ;;
10504 *)  val="$d_printf_format_null" ;;
10505 esac
10506 set d_printf_format_null
10507 eval $setvar
10508 $rm -f attrib*
10509
10510 : Look for GCC-style attribute malloc
10511 case "$d_attribute_malloc" in
10512 '')
10513 echo " "
10514 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10515 $cat >attrib.c <<'EOCP'
10516 #include <stdio.h>
10517 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10518 EOCP
10519 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10520         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10521                 echo "Your C compiler doesn't support __attribute__((malloc))."
10522                 val="$undef"
10523         else
10524                 echo "Your C compiler supports __attribute__((malloc))."
10525                 val="$define"
10526         fi
10527 else
10528         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10529         val="$undef"
10530 fi
10531 ;;
10532 *) val="$d_attribute_malloc" ;;
10533 esac
10534 set d_attribute_malloc
10535 eval $setvar
10536 $rm -f attrib*
10537
10538 : Look for GCC-style attribute nonnull
10539 case "$d_attribute_nonnull" in
10540 '')
10541 echo " "
10542 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10543 $cat >attrib.c <<'EOCP'
10544 #include <stdio.h>
10545 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10546 EOCP
10547 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10548         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10549                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10550                 val="$undef"
10551         else
10552                 echo "Your C compiler supports __attribute__((nonnull))."
10553                 val="$define"
10554         fi
10555 else
10556         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10557         val="$undef"
10558 fi
10559 ;;
10560 *) val="$d_attribute_nonnull" ;;
10561 esac
10562 set d_attribute_nonnull
10563 eval $setvar
10564 $rm -f attrib*
10565
10566 : Look for GCC-style attribute noreturn
10567 case "$d_attribute_noreturn" in
10568 '')
10569 echo " "
10570 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10571 $cat >attrib.c <<'EOCP'
10572 #include <stdio.h>
10573 void fall_over_dead( void ) __attribute__((noreturn));
10574 EOCP
10575 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10576         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10577                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10578                 val="$undef"
10579         else
10580                 echo "Your C compiler supports __attribute__((noreturn))."
10581                 val="$define"
10582         fi
10583 else
10584         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10585         val="$undef"
10586 fi
10587 ;;
10588 *) val="$d_attribute_noreturn" ;;
10589 esac
10590 set d_attribute_noreturn
10591 eval $setvar
10592 $rm -f attrib*
10593
10594 : Look for GCC-style attribute pure
10595 case "$d_attribute_pure" in
10596 '')
10597 echo " "
10598 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10599 $cat >attrib.c <<'EOCP'
10600 #include <stdio.h>
10601 int square( int n ) __attribute__((pure));
10602 EOCP
10603 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10604         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10605                 echo "Your C compiler doesn't support __attribute__((pure))."
10606                 val="$undef"
10607         else
10608                 echo "Your C compiler supports __attribute__((pure))."
10609                 val="$define"
10610         fi
10611 else
10612         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10613         val="$undef"
10614 fi
10615 ;;
10616 *) val="$d_attribute_pure" ;;
10617 esac
10618 set d_attribute_pure
10619 eval $setvar
10620 $rm -f attrib*
10621
10622 : Look for GCC-style attribute unused
10623 case "$d_attribute_unused" in
10624 '')
10625 echo " "
10626 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10627 $cat >attrib.c <<'EOCP'
10628 #include <stdio.h>
10629 int do_something( int dummy __attribute__((unused)), int n );
10630 EOCP
10631 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10632         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10633                 echo "Your C compiler doesn't support __attribute__((unused))."
10634                 val="$undef"
10635         else
10636                 echo "Your C compiler supports __attribute__((unused))."
10637                 val="$define"
10638         fi
10639 else
10640         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10641         val="$undef"
10642 fi
10643 ;;
10644 *) val="$d_attribute_unused" ;;
10645 esac
10646 set d_attribute_unused
10647 eval $setvar
10648 $rm -f attrib*
10649
10650 : Look for GCC-style attribute deprecated
10651 case "$d_attribute_deprecated" in
10652 '')
10653 echo " "
10654 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10655 $cat >attrib.c <<'EOCP'
10656 #include <stdio.h>
10657 int I_am_deprecated(void) __attribute__((deprecated));
10658 EOCP
10659 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10660         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10661                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10662                 val="$undef"
10663         else
10664                 echo "Your C compiler supports __attribute__((deprecated))."
10665                 val="$define"
10666         fi
10667 else
10668         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10669         val="$undef"
10670 fi
10671 ;;
10672 *) val="$d_attribute_deprecated" ;;
10673 esac
10674 set d_attribute_deprecated
10675 eval $setvar
10676 $rm -f attrib*
10677
10678 : Look for GCC-style attribute warn_unused_result
10679 case "$d_attribute_warn_unused_result" in
10680 '')
10681 echo " "
10682 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10683 $cat >attrib.c <<'EOCP'
10684 #include <stdio.h>
10685 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10686 EOCP
10687 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10688         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10689                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10690                 val="$undef"
10691         else
10692                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10693                 val="$define"
10694         fi
10695 else
10696         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10697         val="$undef"
10698 fi
10699 ;;
10700 *) val="$d_attribute_warn_unused_result" ;;
10701 esac
10702 set d_attribute_warn_unused_result
10703 eval $setvar
10704 $rm -f attrib*
10705
10706 : see if bcmp exists
10707 set bcmp d_bcmp
10708 eval $inlibc
10709
10710 : see if bcopy exists
10711 set bcopy d_bcopy
10712 eval $inlibc
10713
10714 : see if getpgrp exists
10715 set getpgrp d_getpgrp
10716 eval $inlibc
10717
10718 case "$d_getpgrp" in
10719 "$define")
10720         echo " "
10721         echo "Checking to see which flavor of getpgrp is in use..."
10722         $cat >try.c <<EOP
10723 #$i_unistd I_UNISTD
10724 #include <sys/types.h>
10725 #ifdef I_UNISTD
10726 #  include <unistd.h>
10727 #endif
10728 #$i_stdlib I_STDLIB
10729 #ifdef I_STDLIB
10730 #include <stdlib.h>
10731 #endif
10732 int main()
10733 {
10734         if (getuid() == 0) {
10735                 printf("(I see you are running Configure as super-user...)\n");
10736                 setuid(1);
10737         }
10738 #ifdef TRY_BSD_PGRP
10739         if (getpgrp(1) == 0)
10740                 exit(0);
10741 #else
10742         if (getpgrp() > 0)
10743                 exit(0);
10744 #endif
10745         exit(1);
10746 }
10747 EOP
10748         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10749                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10750                 val="$define"
10751         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10752                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10753                 val="$undef"
10754         else
10755                 echo "I can't seem to compile and run the test program."
10756                 if ./usg; then
10757                         xxx="a USG one, i.e. you use getpgrp()."
10758                 else
10759                         # SVR4 systems can appear rather BSD-ish.
10760                         case "$i_unistd" in
10761                         $undef)
10762                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10763                                 val="$define"
10764                                 ;;
10765                         $define)
10766                                 xxx="probably a USG one, i.e. you use getpgrp()."
10767                                 val="$undef"
10768                                 ;;
10769                         esac
10770                 fi
10771                 echo "Assuming your getpgrp is $xxx" >&4
10772         fi
10773         ;;
10774 *) val="$undef";;
10775 esac
10776 set d_bsdgetpgrp
10777 eval $setvar
10778 $rm_try
10779
10780 : see if setpgrp exists
10781 set setpgrp d_setpgrp
10782 eval $inlibc
10783
10784 case "$d_setpgrp" in
10785 "$define")
10786         echo " "
10787         echo "Checking to see which flavor of setpgrp is in use..."
10788         $cat >try.c <<EOP
10789 #$i_unistd I_UNISTD
10790 #include <sys/types.h>
10791 #ifdef I_UNISTD
10792 #  include <unistd.h>
10793 #endif
10794 #$i_stdlib I_STDLIB
10795 #ifdef I_STDLIB
10796 #include <stdlib.h>
10797 #endif
10798 int main()
10799 {
10800         if (getuid() == 0) {
10801                 printf("(I see you are running Configure as super-user...)\n");
10802                 setuid(1);
10803         }
10804 #ifdef TRY_BSD_PGRP
10805         if (-1 == setpgrp(1, 1))
10806                 exit(0);
10807 #else
10808         if (setpgrp() != -1)
10809                 exit(0);
10810 #endif
10811         exit(1);
10812 }
10813 EOP
10814         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10815                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10816                 val="$define"
10817         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10818                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10819                 val="$undef"
10820         else
10821                 echo "(I can't seem to compile and run the test program.)"
10822                 if ./usg; then
10823                         xxx="a USG one, i.e. you use setpgrp()."
10824                 else
10825                         # SVR4 systems can appear rather BSD-ish.
10826                         case "$i_unistd" in
10827                         $undef)
10828                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10829                                 val="$define"
10830                                 ;;
10831                         $define)
10832                                 xxx="probably a USG one, i.e. you use setpgrp()."
10833                                 val="$undef"
10834                                 ;;
10835                         esac
10836                 fi
10837                 echo "Assuming your setpgrp is $xxx" >&4
10838         fi
10839         ;;
10840 *) val="$undef";;
10841 esac
10842 set d_bsdsetpgrp
10843 eval $setvar
10844 $rm_try
10845
10846 : Look for GCC-style __builtin_choose_expr
10847 case "$d_builtin_choose_expr" in
10848 '')
10849     echo " "
10850     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10851     $cat >try.c <<'EOCP'
10852 #include <assert.h>
10853 #include <stdlib.h>
10854 #include <stdio.h>
10855
10856 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10857
10858 int main(void) {
10859     assert( SYRINX(1) == 2112 );
10860     assert( SYRINX(1) != 5150 );
10861     assert( SYRINX(0) == 5150 );
10862     assert( SYRINX(0) != 2112 );
10863     puts( "All good!" );
10864     exit(0);
10865 }
10866
10867 EOCP
10868     set try
10869     if eval $compile && $run ./try; then
10870         echo "Your C compiler supports __builtin_choose_expr."
10871         val="$define"
10872     else
10873         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10874         val="$undef"
10875     fi
10876 ;;
10877 *) val="$d_builtin_choose_expr" ;;
10878 esac
10879
10880 set d_builtin_choose_expr
10881 eval $setvar
10882 $rm_try
10883
10884 : Look for GCC-style __builtin_expect
10885 case "$d_builtin_expect" in
10886 '')
10887     echo " "
10888     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10889     $cat >try.c <<'EOCP'
10890 int main(void) {
10891     int n = 50;
10892     if ( __builtin_expect(n, 0) ) n = 1;
10893     /* Remember shell exit code truth is 0, C truth is non-zero */
10894     return !(n == 1);
10895 }
10896 EOCP
10897     set try
10898     if eval $compile && $run ./try; then
10899         echo "Your C compiler supports __builtin_expect."
10900         val="$define"
10901     else
10902         echo "Your C compiler doesn't seem to understand __builtin_expect."
10903         val="$undef"
10904     fi
10905     ;;
10906 *) val="$d_builtin_expect" ;;
10907 esac
10908
10909 set d_builtin_expect
10910 eval $setvar
10911 $rm_try
10912
10913 : see if bzero exists
10914 set bzero d_bzero
10915 eval $inlibc
10916
10917 : see if stdarg is available
10918 echo " "
10919 if $test `./findhdr stdarg.h`; then
10920         echo "<stdarg.h> found." >&4
10921         valstd="$define"
10922 else
10923         echo "<stdarg.h> NOT found." >&4
10924         valstd="$undef"
10925 fi
10926
10927 : see if varargs is available
10928 echo " "
10929 if $test `./findhdr varargs.h`; then
10930         echo "<varargs.h> found." >&4
10931 else
10932         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10933 fi
10934
10935 : set up the varargs testing programs
10936 $cat > varargs.c <<EOP
10937 #ifdef I_STDARG
10938 #include <stdarg.h>
10939 #endif
10940 #ifdef I_VARARGS
10941 #include <varargs.h>
10942 #endif
10943
10944 #ifdef I_STDARG
10945 int f(char *p, ...)
10946 #else
10947 int f(va_alist)
10948 va_dcl
10949 #endif
10950 {
10951         va_list ap;
10952 #ifndef I_STDARG
10953         char *p;
10954 #endif
10955 #ifdef I_STDARG
10956         va_start(ap,p);
10957 #else
10958         va_start(ap);
10959         p = va_arg(ap, char *);
10960 #endif
10961         va_end(ap);
10962         return 0;
10963 }
10964 EOP
10965 $cat > varargs <<EOP
10966 $startsh
10967 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10968         echo "true"
10969 else
10970         echo "false"
10971 fi
10972 $rm -f varargs$_o
10973 EOP
10974 chmod +x varargs
10975
10976 : now check which varargs header should be included
10977 echo " "
10978 i_varhdr=''
10979 val=''
10980 case "$valstd" in
10981 "$define")
10982         if `./varargs I_STDARG`; then
10983                 val='stdarg.h'
10984         elif `./varargs I_VARARGS`; then
10985                 val='varargs.h'
10986         fi
10987         ;;
10988 *)
10989         if `./varargs I_VARARGS`; then
10990                 val='varargs.h'
10991         fi
10992         ;;
10993 esac
10994 case "$val" in
10995 '')
10996         echo " "
10997         echo "*** WHOA THERE!!! ***" >&4
10998         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10999         case "$knowitall" in
11000         '')
11001         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11002                 exit 1
11003                 ;;
11004         esac
11005 echo "I could not find the definition for va_dcl... You have problems..." >&4
11006         val="$undef"; set i_stdarg; eval $setvar
11007         val="$undef"; set i_varargs; eval $setvar
11008         ;;
11009 *)
11010         set i_varhdr
11011         eval $setvar
11012         case "$i_varhdr" in
11013         stdarg.h)
11014                 val="$define"; set i_stdarg; eval $setvar
11015                 val="$undef"; set i_varargs; eval $setvar
11016                 ;;
11017         varargs.h)
11018                 val="$undef"; set i_stdarg; eval $setvar
11019                 val="$define"; set i_varargs; eval $setvar
11020                 ;;
11021         esac
11022         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11023 esac
11024 $rm -f varargs*
11025
11026 : see if the Compiler supports C99 variadic macros
11027 case "$i_stdarg$i_stdlib" in
11028     "$define$define")
11029     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11030     $cat >try.c <<EOCP
11031 #include <stdio.h>
11032 #include <stdarg.h>
11033
11034 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11035
11036 int main() {
11037   char buf[20];
11038   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11039   puts(buf);
11040   return 0;
11041 }
11042 EOCP
11043     set try
11044     if eval $compile && $run ./try 2>&1 >/dev/null; then
11045         case "`$run ./try`" in
11046             "123 456 789")
11047             echo "You have C99 variadic macros." >&4
11048             d_c99_variadic_macros="$define"
11049             ;;
11050             *)
11051             echo "You don't have functional C99 variadic macros." >&4
11052             d_c99_variadic_macros="$undef"
11053             ;;
11054         esac
11055     else
11056         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11057         d_c99_variadic_macros="$undef"
11058     fi
11059     $rm_try
11060     ;;
11061     *)
11062     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11063     d_c99_variadic_macros="$undef"
11064     ;;
11065 esac
11066
11067 : see if signal is declared as pointer to function returning int or void
11068 echo " "
11069 xxx=`./findhdr signal.h`
11070 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11071 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11072         echo "You have int (*signal())() instead of void." >&4
11073         val="$undef"
11074 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11075         echo "You have void (*signal())()." >&4
11076         val="$define"
11077 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11078         echo "You have int (*signal())() instead of void." >&4
11079         val="$undef"
11080 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11081         echo "You have void (*signal())()." >&4
11082         val="$define"
11083 else
11084         case "$d_voidsig" in
11085         '')
11086         echo "I can't determine whether signal handler returns void or int..." >&4
11087                 dflt=void
11088                 rp="What type does your signal handler return?"
11089                 . ./myread
11090                 case "$ans" in
11091                 v*) val="$define";;
11092                 *) val="$undef";;
11093                 esac;;
11094         "$define")
11095                 echo "As you already told me, signal handler returns void." >&4
11096                 val="$define"
11097                 ;;
11098         *)      echo "As you already told me, signal handler returns int." >&4
11099                 val="$undef"
11100                 ;;
11101         esac
11102 fi
11103 set d_voidsig
11104 eval $setvar
11105 case "$d_voidsig" in
11106 "$define") signal_t="void";;
11107 *) signal_t="int";;
11108 esac
11109 $rm -f $$.tmp
11110
11111 : check for ability to cast large floats to 32-bit ints.
11112 echo " "
11113 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11114 if $test "$intsize" -ge 4; then
11115         xxx=int
11116 else
11117         xxx=long
11118 fi
11119 $cat >try.c <<EOCP
11120 #include <stdio.h>
11121 #$i_stdlib I_STDLIB
11122 #ifdef I_STDLIB
11123 #include <stdlib.h>
11124 #endif
11125 #include <sys/types.h>
11126 #include <signal.h>
11127 $signal_t blech(int s) { exit(3); }
11128 int main()
11129 {
11130         $xxx i32;
11131         double f, g;
11132         int result = 0;
11133         char str[16];
11134         signal(SIGFPE, blech);
11135
11136         /* Don't let compiler optimize the test away.  Store the number
11137            in a writable string for gcc to pass to sscanf under HP-UX.
11138         */
11139         sprintf(str, "2147483647");
11140         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11141         g = 10 * f;
11142         i32  = ($xxx) g;
11143
11144         /* x86 processors will probably give 0x8000 0000, which is a
11145            sign change.  We don't want that.  We want to mimic SPARC
11146            behavior here, which is to preserve the sign and give
11147            back 0x7fff ffff.
11148         */
11149         if (i32 != ($xxx) f)
11150                 result |= 1;
11151         exit(result);
11152 }
11153 EOCP
11154 set try
11155 if eval $compile_ok; then
11156         $run ./try
11157         yyy=$?
11158 else
11159         echo "(I can't seem to compile the test program--assuming it can't)"
11160         yyy=1
11161 fi
11162 case "$yyy" in
11163 0)      val="$define"
11164         echo "Yup, it can."
11165         ;;
11166 *)      val="$undef"
11167         echo "Nope, it can't."
11168         ;;
11169 esac
11170 set d_casti32
11171 eval $setvar
11172 $rm_try
11173
11174 : check for ability to cast negative floats to unsigned
11175 echo " "
11176 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11177 $cat >try.c <<EOCP
11178 #include <stdio.h>
11179 #$i_stdlib I_STDLIB
11180 #ifdef I_STDLIB
11181 #include <stdlib.h>
11182 #endif
11183 #include <sys/types.h>
11184 #include <signal.h>
11185 $signal_t blech(int s) { exit(7); }
11186 $signal_t blech_in_list(int s) { exit(4); }
11187 unsigned long dummy_long(unsigned long p) { return p; }
11188 unsigned int dummy_int(unsigned int p) { return p; }
11189 unsigned short dummy_short(unsigned short p) { return p; }
11190 int main()
11191 {
11192         double f;
11193         unsigned long along;
11194         unsigned int aint;
11195         unsigned short ashort;
11196         int result = 0;
11197         char str[16];
11198
11199         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11200            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11201            optimized the whole file away
11202         */
11203         /* Store the number in a writable string for gcc to pass to
11204            sscanf under HP-UX.
11205         */
11206         sprintf(str, "-123");
11207         sscanf(str, "%lf", &f);  /* f = -123.; */
11208
11209         signal(SIGFPE, blech);
11210         along = (unsigned long)f;
11211         aint = (unsigned int)f;
11212         ashort = (unsigned short)f;
11213         if (along != (unsigned long)-123)
11214                 result |= 1;
11215         if (aint != (unsigned int)-123)
11216                 result |= 1;
11217         if (ashort != (unsigned short)-123)
11218                 result |= 1;
11219         sprintf(str, "1073741824.");
11220         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11221         f = f + f;
11222         along = 0;
11223         along = (unsigned long)f;
11224         if (along != 0x80000000)
11225                 result |= 2;
11226         f -= 1.;
11227         along = 0;
11228         along = (unsigned long)f;
11229         if (along != 0x7fffffff)
11230                 result |= 1;
11231         f += 2.;
11232         along = 0;
11233         along = (unsigned long)f;
11234         if (along != 0x80000001)
11235                 result |= 2;
11236         if (result)
11237                 exit(result);
11238         signal(SIGFPE, blech_in_list);
11239         sprintf(str, "123.");
11240         sscanf(str, "%lf", &f);  /* f = 123.; */
11241         along = dummy_long((unsigned long)f);
11242         aint = dummy_int((unsigned int)f);
11243         ashort = dummy_short((unsigned short)f);
11244         if (along != (unsigned long)123)
11245                 result |= 4;
11246         if (aint != (unsigned int)123)
11247                 result |= 4;
11248         if (ashort != (unsigned short)123)
11249                 result |= 4;
11250         exit(result);
11251
11252 }
11253 EOCP
11254 set try
11255 if eval $compile_ok; then
11256         $run ./try
11257         castflags=$?
11258 else
11259         echo "(I can't seem to compile the test program--assuming it can't)"
11260         castflags=7
11261 fi
11262 case "$castflags" in
11263 0)      val="$define"
11264         echo "Yup, it can."
11265         ;;
11266 *)      val="$undef"
11267         echo "Nope, it can't."
11268         ;;
11269 esac
11270 set d_castneg
11271 eval $setvar
11272 $rm_try
11273
11274 : see if vprintf exists
11275 echo " "
11276 if set vprintf val -f d_vprintf; eval $csym; $val; then
11277         echo 'vprintf() found.' >&4
11278         val="$define"
11279         $cat >try.c <<EOF
11280 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11281 #$i_varargs I_VARARGS
11282
11283 #$i_stdlib I_STDLIB
11284 #$i_unistd I_UNISTD
11285
11286 #ifdef I_STDARG
11287 #  include <stdarg.h>
11288 #else /* I_VARARGS */
11289 #  include <varargs.h>
11290 #endif
11291
11292 #ifdef I_UNISTD
11293 #  include <unistd.h>
11294 #endif
11295
11296 #ifdef I_STDLIB
11297 #  include <stdlib.h>
11298 #endif
11299
11300 #include <stdio.h> /* vsprintf prototype */
11301
11302 #ifdef I_STDARG
11303 void xxx(int n, ...)
11304 {
11305     va_list args;
11306     char buf[10];
11307     va_start(args, n);
11308     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11309 }
11310 int main() { xxx(1, "foo"); }
11311
11312 #else /* I_VARARGS */
11313
11314 xxx(va_alist)
11315 va_dcl
11316 {
11317     va_list args;
11318     char buf[10];
11319     va_start(args);
11320     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11321 }
11322 int main() { xxx("foo"); }
11323
11324 #endif
11325
11326 EOF
11327         set try
11328         if eval $compile_ok; then
11329                 if $run ./try; then
11330                         echo "Your vsprintf() returns (int)." >&4
11331                         val2="$undef"
11332                 else
11333                         echo "Your vsprintf() returns (char*)." >&4
11334                         val2="$define"
11335                 fi
11336         else
11337                 echo 'I am unable to compile the vsprintf() test program.' >&4
11338                 # We shouldn't get here.  If we do, assume the standard signature,
11339                 # not the old BSD one.
11340                 echo 'Guessing that vsprintf() returns (int).' >&4
11341                 val2="$undef"
11342         fi
11343 else
11344         echo 'vprintf() NOT found.' >&4
11345         val="$undef"
11346         val2="$undef"
11347 fi
11348 $rm_try
11349 set d_vprintf
11350 eval $setvar
11351 val=$val2
11352 set d_charvspr
11353 eval $setvar
11354
11355 : see if chown exists
11356 set chown d_chown
11357 eval $inlibc
11358
11359 : see if chroot exists
11360 set chroot d_chroot
11361 eval $inlibc
11362
11363 : see if chsize exists
11364 set chsize d_chsize
11365 eval $inlibc
11366
11367 : see if class exists
11368 set class d_class
11369 eval $inlibc
11370
11371 : see if clearenv exists
11372 set clearenv d_clearenv
11373 eval $inlibc
11374
11375 : Define hasstruct macro for Configure internal use
11376 hasstruct='varname=$1; struct=$2; shift; shift;
11377 while $test $# -ge 2; do
11378         case "$1" in
11379         $define) echo "#include <$2>";;
11380         esac ;
11381     shift 2;
11382 done > try.c;
11383 echo "int main () { struct $struct foo; }" >> try.c;
11384 set try;
11385 if eval $compile; then
11386         val="$define";
11387 else
11388         val="$undef";
11389 fi;
11390 set $varname;
11391 eval $setvar;
11392 $rm_try'
11393
11394 : see whether socket exists
11395 socketlib=''
11396 sockethdr=''
11397 echo " "
11398 $echo $n "Hmm... $c" >&4
11399 if set socket val -f d_socket; eval $csym; $val; then
11400         echo "Looks like you have Berkeley networking support." >&4
11401         d_socket="$define"
11402         if set setsockopt val -f; eval $csym; $val; then
11403                 d_oldsock="$undef"
11404         else
11405                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11406                 d_oldsock="$define"
11407         fi
11408 else
11409         if $contains socklib libc.list >/dev/null 2>&1; then
11410                 echo "Looks like you have Berkeley networking support." >&4
11411                 d_socket="$define"
11412                 : we will have to assume that it supports the 4.2 BSD interface
11413                 d_oldsock="$undef"
11414         else
11415                 echo "You don't have Berkeley networking in libc$_a..." >&4
11416                 if test "X$d_socket" = "X$define"; then
11417                    echo "...but you seem to believe that you have sockets." >&4
11418                 else
11419                         for net in net socket
11420                         do
11421                                 if test -f $sysroot/usr/lib/lib$net$_a; then
11422                                         ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11423                                         $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11424                                         if $contains socket libc.list >/dev/null 2>&1; then
11425                                                 d_socket="$define"
11426                                                 socketlib="-l$net"
11427                                                 case "$net" in
11428                                                 net)
11429                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11430                                                         sockethdr="-I$sysroot/usr/netinclude"
11431                                                         ;;
11432                                                 esac
11433                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11434                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11435                                                         d_oldsock="$undef"
11436                                                 else
11437                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11438                                                         d_oldsock="$define"
11439                                                 fi
11440                                                 break
11441                                         fi
11442                                 fi
11443                         done
11444                         if test "X$d_socket" != "X$define"; then
11445                            echo "or anywhere else I see." >&4
11446                            d_socket="$undef"
11447                            d_oldsock="$undef"
11448                         fi
11449                 fi
11450         fi
11451 fi
11452
11453 : see if socketpair exists
11454 set socketpair d_sockpair
11455 eval $inlibc
11456
11457
11458 echo " "
11459 echo "Checking the availability sa_len in the sock struct ..." >&4
11460 $cat >try.c <<EOF
11461 #include <sys/types.h>
11462 #include <sys/socket.h>
11463 int main() {
11464 struct sockaddr sa;
11465 return (sa.sa_len);
11466 }
11467 EOF
11468 val="$undef"
11469 set try; if eval $compile; then
11470         val="$define"
11471 fi
11472 set d_sockaddr_sa_len; eval $setvar
11473 $rm_try
11474
11475 echo " "
11476 echo "Checking the availability struct sockaddr_in6 ..." >&4
11477 $cat >try.c <<EOF
11478 #include <sys/types.h>
11479 #include <sys/socket.h>
11480 #include <netinet/in.h>
11481 int main() {
11482 struct sockaddr_in6 sin6;
11483 return (sin6.sin6_family);
11484 }
11485 EOF
11486 val="$undef"
11487 set try; if eval $compile; then
11488         val="$define"
11489 fi
11490 set d_sockaddr_in6; eval $setvar
11491 $rm_try
11492
11493 echo " "
11494 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11495 $cat >try.c <<EOF
11496 #include <sys/types.h>
11497 #include <sys/socket.h>
11498 #include <netinet/in.h>
11499 int main() {
11500 struct sockaddr_in6 sin6;
11501 return (sin6.sin6_scope_id);
11502 }
11503 EOF
11504 val="$undef"
11505 set try; if eval $compile; then
11506         val="$define"
11507 fi
11508 set d_sin6_scope_id; eval $setvar
11509 $rm_try
11510
11511 echo " "
11512 echo "Checking the availability struct ip_mreq ..." >&4
11513 $cat >try.c <<EOF
11514 #include <sys/types.h>
11515 #include <sys/socket.h>
11516 #include <netinet/in.h>
11517 int main() {
11518 struct ip_mreq mreq;
11519 return (mreq.imr_multiaddr.s_addr);
11520 }
11521 EOF
11522 val="$undef"
11523 set try; if eval $compile; then
11524        val="$define"
11525 fi
11526 set d_ip_mreq; eval $setvar
11527 $rm_try
11528
11529 echo " "
11530 echo "Checking the availability struct ip_mreq_source ..." >&4
11531 $cat >try.c <<EOF
11532 #include <sys/types.h>
11533 #include <sys/socket.h>
11534 #include <netinet/in.h>
11535 int main() {
11536 struct ip_mreq_source mreq;
11537 return (mreq.imr_multiaddr.s_addr);
11538 }
11539 EOF
11540 val="$undef"
11541 set try; if eval $compile; then
11542        val="$define"
11543 fi
11544 set d_ip_mreq_source; eval $setvar
11545 $rm_try
11546
11547 echo " "
11548 echo "Checking the availability struct ipv6_mreq ..." >&4
11549 $cat >try.c <<EOF
11550 #include <sys/types.h>
11551 #include <sys/socket.h>
11552 #include <netinet/in.h>
11553 int main() {
11554 struct ipv6_mreq mreq;
11555 return (mreq.ipv6mr_interface);
11556 }
11557 EOF
11558 val="$undef"
11559 set try; if eval $compile; then
11560         val="$define"
11561 fi
11562 set d_ipv6_mreq; eval $setvar
11563 $rm_try
11564
11565 echo " "
11566 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11567 $cat >try.c <<EOF
11568 #include <sys/types.h>
11569 #include <sys/socket.h>
11570 #include <netinet/in.h>
11571 int main() {
11572 struct ipv6_mreq_source mreq;
11573 return (mreq.imr_multiaddr.s_addr);
11574 }
11575 EOF
11576 val="$undef"
11577 set try; if eval $compile; then
11578        val="$define"
11579 fi
11580 set d_ipv6_mreq_source; eval $setvar
11581 $rm_try
11582
11583 echo " "
11584 echo "Checking the availability of certain socket constants..." >&4
11585 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11586         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11587         $cat >try.c <<EOF
11588 #include <sys/types.h>
11589 #include <sys/socket.h>
11590 int main() {
11591     int i = $ENUM;
11592 }
11593 EOF
11594         val="$undef"
11595         set try; if eval $compile; then
11596                 val="$define"
11597         fi
11598         set d_${enum}; eval $setvar
11599         $rm_try
11600 done
11601
11602 : see if this is a sys/uio.h system
11603 set sys/uio.h i_sysuio
11604 eval $inhdr
11605
11606 : Check for cmsghdr support
11607 echo " "
11608 echo "Checking to see if your system supports struct cmsghdr..." >&4
11609 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11610 eval $hasstruct
11611 case "$d_cmsghdr_s" in
11612 "$define")      echo "Yes, it does."   ;;
11613 *)              echo "No, it doesn't." ;;
11614 esac
11615
11616
11617 : check for const keyword
11618 echo " "
11619 echo 'Checking to see if your C compiler knows about "const"...' >&4
11620 $cat >const.c <<'EOCP'
11621 typedef struct spug { int drokk; } spug;
11622 int main()
11623 {
11624         const char *foo;
11625         const spug y = { 0 };
11626 }
11627 EOCP
11628 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11629         val="$define"
11630         echo "Yup, it does."
11631 else
11632         val="$undef"
11633         echo "Nope, it doesn't."
11634 fi
11635 set d_const
11636 eval $setvar
11637
11638 : see if copysignl exists
11639 set copysignl d_copysignl
11640 eval $inlibc
11641
11642 : see if crypt exists
11643 echo " "
11644 set crypt d_crypt
11645 eval $inlibc
11646 case "$d_crypt" in
11647 $define) cryptlib='' ;;
11648 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11649                 echo 'crypt() found.' >&4
11650                 val="$define"
11651                 cryptlib=''
11652         else
11653                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11654                 if $test -z "$cryptlib"; then
11655                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11656                 else
11657                         cryptlib=-lcrypt
11658                 fi
11659                 if $test -z "$cryptlib"; then
11660                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11661                 else
11662                         cryptlib=-lcrypt
11663                 fi
11664                 if $test -z "$cryptlib"; then
11665                         cryptlib=`./loc libcrypt$_a "" $libpth`
11666                 else
11667                         cryptlib=-lcrypt
11668                 fi
11669                 if $test -z "$cryptlib"; then
11670                         echo 'crypt() NOT found.' >&4
11671                         val="$undef"
11672                 else
11673                         val="$define"
11674                 fi
11675         fi
11676         set d_crypt
11677         eval $setvar
11678         ;;
11679 esac
11680
11681 : see if this is a crypt.h system
11682 set crypt.h i_crypt
11683 eval $inhdr
11684
11685 : see if crypt_r exists
11686 set crypt_r d_crypt_r
11687 eval $inlibc
11688 case "$d_crypt_r" in
11689 "$define")
11690         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11691         case "$d_crypt_r_proto:$usethreads" in
11692         ":define")      d_crypt_r_proto=define
11693                 set d_crypt_r_proto crypt_r $hdrs
11694                 eval $hasproto ;;
11695         *)      ;;
11696         esac
11697         case "$d_crypt_r_proto" in
11698         define)
11699         case "$crypt_r_proto" in
11700         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11701         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11702         esac
11703         case "$crypt_r_proto" in
11704         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11705         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11706         esac
11707         case "$crypt_r_proto" in
11708         ''|0)   d_crypt_r=undef
11709                 crypt_r_proto=0
11710                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11711         * )     case "$crypt_r_proto" in
11712                 REENTRANT_PROTO*) ;;
11713                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11714                 esac
11715                 echo "Prototype: $try" ;;
11716         esac
11717         ;;
11718         *)      case "$usethreads" in
11719                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11720                 esac
11721                 d_crypt_r=undef
11722                 crypt_r_proto=0
11723                 ;;
11724         esac
11725         ;;
11726 *)      crypt_r_proto=0
11727         ;;
11728 esac
11729
11730 : get csh whereabouts
11731 case "$csh" in
11732 'csh') val="$undef" ;;
11733 *) val="$define" ;;
11734 esac
11735 set d_csh
11736 eval $setvar
11737 : Respect a hint or command line value for full_csh.
11738 case "$full_csh" in
11739 '') full_csh=$csh ;;
11740 esac
11741
11742 : see if ctermid exists
11743 set ctermid d_ctermid
11744 eval $inlibc
11745
11746 : see if ctermid_r exists
11747 set ctermid_r d_ctermid_r
11748 eval $inlibc
11749 case "$d_ctermid_r" in
11750 "$define")
11751         hdrs="$i_systypes sys/types.h define stdio.h "
11752         case "$d_ctermid_r_proto:$usethreads" in
11753         ":define")      d_ctermid_r_proto=define
11754                 set d_ctermid_r_proto ctermid_r $hdrs
11755                 eval $hasproto ;;
11756         *)      ;;
11757         esac
11758         case "$d_ctermid_r_proto" in
11759         define)
11760         case "$ctermid_r_proto" in
11761         ''|0) try='char* ctermid_r(char*);'
11762         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11763         esac
11764         case "$ctermid_r_proto" in
11765         ''|0)   d_ctermid_r=undef
11766                 ctermid_r_proto=0
11767                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11768         * )     case "$ctermid_r_proto" in
11769                 REENTRANT_PROTO*) ;;
11770                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11771                 esac
11772                 echo "Prototype: $try" ;;
11773         esac
11774         ;;
11775         *)      case "$usethreads" in
11776                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11777                 esac
11778                 d_ctermid_r=undef
11779                 ctermid_r_proto=0
11780                 ;;
11781         esac
11782         ;;
11783 *)      ctermid_r_proto=0
11784         ;;
11785 esac
11786
11787 : see if ctime_r exists
11788 set ctime_r d_ctime_r
11789 eval $inlibc
11790 case "$d_ctime_r" in
11791 "$define")
11792         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11793         case "$d_ctime_r_proto:$usethreads" in
11794         ":define")      d_ctime_r_proto=define
11795                 set d_ctime_r_proto ctime_r $hdrs
11796                 eval $hasproto ;;
11797         *)      ;;
11798         esac
11799         case "$d_ctime_r_proto" in
11800         define)
11801         case "$ctime_r_proto" in
11802         ''|0) try='char* ctime_r(const time_t*, char*);'
11803         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11804         esac
11805         case "$ctime_r_proto" in
11806         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11807         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11808         esac
11809         case "$ctime_r_proto" in
11810         ''|0) try='int ctime_r(const time_t*, char*);'
11811         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11812         esac
11813         case "$ctime_r_proto" in
11814         ''|0) try='int ctime_r(const time_t*, char*, int);'
11815         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11816         esac
11817         case "$ctime_r_proto" in
11818         ''|0)   d_ctime_r=undef
11819                 ctime_r_proto=0
11820                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11821         * )     case "$ctime_r_proto" in
11822                 REENTRANT_PROTO*) ;;
11823                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11824                 esac
11825                 echo "Prototype: $try" ;;
11826         esac
11827         ;;
11828         *)      case "$usethreads" in
11829                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11830                 esac
11831                 d_ctime_r=undef
11832                 ctime_r_proto=0
11833                 ;;
11834         esac
11835         ;;
11836 *)      ctime_r_proto=0
11837         ;;
11838 esac
11839
11840 : see if cuserid exists
11841 set cuserid d_cuserid
11842 eval $inlibc
11843
11844 : see if this is a limits.h system
11845 set limits.h i_limits
11846 eval $inhdr
11847
11848 : see if this is a float.h system
11849 set float.h i_float
11850 eval $inhdr
11851
11852 : See if number of significant digits in a double precision number is known
11853 echo " "
11854 $cat >dbl_dig.c <<EOM
11855 #$i_limits I_LIMITS
11856 #$i_float I_FLOAT
11857 #ifdef I_LIMITS
11858 #include <limits.h>
11859 #endif
11860 #ifdef I_FLOAT
11861 #include <float.h>
11862 #endif
11863 #ifdef DBL_DIG
11864 printf("Contains DBL_DIG");
11865 #endif
11866 EOM
11867 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11868 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11869         echo "DBL_DIG found." >&4
11870         val="$define"
11871 else
11872         echo "DBL_DIG NOT found." >&4
11873         val="$undef"
11874 fi
11875 $rm -f dbl_dig.?
11876 set d_dbl_dig
11877 eval $setvar
11878
11879 : see if dbm.h is available
11880 : see if dbmclose exists
11881 set dbmclose d_dbmclose
11882 eval $inlibc
11883
11884 case "$d_dbmclose" in
11885 $define)
11886         set dbm.h i_dbm
11887         eval $inhdr
11888         case "$i_dbm" in
11889         $define)
11890                 val="$undef"
11891                 set i_rpcsvcdbm
11892                 eval $setvar
11893                 ;;
11894         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11895                 eval $inhdr
11896                 ;;
11897         esac
11898         ;;
11899 *)      echo "We won't be including <dbm.h>"
11900         val="$undef"
11901         set i_dbm
11902         eval $setvar
11903         val="$undef"
11904         set i_rpcsvcdbm
11905         eval $setvar
11906         ;;
11907 esac
11908
11909 : see if prototype for dbminit is available
11910 echo " "
11911 set d_dbminitproto dbminit $i_dbm dbm.h
11912 eval $hasproto
11913
11914 : see if difftime exists
11915 set difftime d_difftime
11916 eval $inlibc
11917
11918 : see if this is a dirent system
11919 echo " "
11920 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11921         val="$define"
11922         echo "<dirent.h> found." >&4
11923 else
11924         val="$undef"
11925         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11926                 echo "<sys/dir.h> found." >&4
11927                 echo " "
11928         else
11929                 xinc=`./findhdr sys/ndir.h`
11930         fi
11931         echo "<dirent.h> NOT found." >&4
11932 fi
11933 set i_dirent
11934 eval $setvar
11935
11936 : Look for type of directory structure.
11937 echo " "
11938 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11939
11940 case "$direntrytype" in
11941 ''|' ')
11942         case "$i_dirent" in
11943         $define) guess1='struct dirent' ;;
11944         *) guess1='struct direct'  ;;
11945         esac
11946         ;;
11947 *)      guess1="$direntrytype"
11948         ;;
11949 esac
11950
11951 case "$guess1" in
11952 'struct dirent') guess2='struct direct' ;;
11953 *) guess2='struct dirent' ;;
11954 esac
11955
11956 if $contains "$guess1" try.c >/dev/null 2>&1; then
11957         direntrytype="$guess1"
11958         echo "Your directory entries are $direntrytype." >&4
11959 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11960         direntrytype="$guess2"
11961         echo "Your directory entries seem to be $direntrytype." >&4
11962 else
11963         echo "I don't recognize your system's directory entries." >&4
11964         rp="What type is used for directory entries on this system?"
11965         dflt="$guess1"
11966         . ./myread
11967         direntrytype="$ans"
11968 fi
11969 $rm_try
11970
11971 : see if the directory entry stores field length
11972 echo " "
11973 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11974 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11975         echo "Good, your directory entry keeps length information in d_namlen." >&4
11976         val="$define"
11977 else
11978         echo "Your directory entry does not know about the d_namlen field." >&4
11979         val="$undef"
11980 fi
11981 set d_dirnamlen
11982 eval $setvar
11983 $rm_try
11984
11985 : Look for DIR.dd_fd
11986 case "$i_dirent" in
11987 "$define")
11988     echo "Checking to see if DIR has a dd_fd member variable" >&4
11989     $cat >try.c <<EOCP
11990 #$i_stdlib I_STDLIB
11991 #ifdef I_STDLIB
11992 #include <stdlib.h>
11993 #endif
11994 #include <dirent.h>
11995
11996 int main() {
11997     DIR dir;
11998     dir.dd_fd = 1;
11999     return 0;
12000 }
12001 EOCP
12002     val=$undef
12003     set try
12004     if eval $compile; then
12005         echo "Yes, it does."
12006         val="$define"
12007     else
12008         echo "No, it does not."
12009         val="$undef"
12010     fi
12011     ;;
12012 *)
12013     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12014     val="$undef"
12015     ;;
12016 esac
12017 set d_dir_dd_fd
12018 eval $setvar
12019 $rm_try
12020
12021 : see if this is an sysdir system
12022 set sys/dir.h i_sysdir
12023 eval $inhdr
12024
12025 : see if this is an sysndir system
12026 set sys/ndir.h i_sysndir
12027 eval $inhdr
12028
12029 : Look for dirfd
12030 echo " "
12031 $cat >dirfd.c <<EOM
12032 #include <stdio.h>
12033 #$i_stdlib I_STDLIB
12034 #ifdef I_STDLIB
12035 #include <stdlib.h>
12036 #endif
12037 #$i_dirent I_DIRENT             /**/
12038 #$i_sysdir I_SYS_DIR            /**/
12039 #$i_sysndir I_SYS_NDIR          /**/
12040 #$i_systypes I_SYS_TYPES        /**/
12041 #if defined(I_SYS_TYPES)
12042 #include <sys/types.h>
12043 #endif
12044 #if defined(I_DIRENT)
12045 #include <dirent.h>
12046 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12047 #include <sys/dir.h>
12048 #endif
12049 #else
12050 #ifdef I_SYS_NDIR
12051 #include <sys/ndir.h>
12052 #else
12053 #ifdef I_SYS_DIR
12054 #ifdef hp9000s500
12055 #include <ndir.h>       /* may be wrong in the future */
12056 #else
12057 #include <sys/dir.h>
12058 #endif
12059 #endif
12060 #endif
12061 #endif
12062 int main() {
12063         DIR *dirp = opendir(".");
12064         if (dirfd(dirp) >= 0)
12065                 exit(0);
12066         else
12067                 exit(1);
12068 }
12069 EOM
12070 val=$undef
12071 set dirfd
12072 if eval $compile; then
12073         val="$define"
12074 fi
12075 case "$val" in
12076 $define)        echo "dirfd() found." >&4       ;;
12077 *)              echo "dirfd() NOT found." >&4   ;;
12078 esac
12079 set d_dirfd
12080 eval $setvar
12081 $rm -f dirfd*
12082
12083 : see if dlerror exists
12084 xxx_runnm="$runnm"
12085 runnm=false
12086 set dlerror d_dlerror
12087 eval $inlibc
12088 runnm="$xxx_runnm"
12089
12090 : see if dlfcn is available
12091 set dlfcn.h i_dlfcn
12092 eval $inhdr
12093
12094 : Check what extension to use for shared libs
12095 case "$usedl" in
12096 $define|y|true)
12097         $cat << EOM
12098
12099 On a few systems, the dynamically loaded modules that perl generates and uses
12100 will need a different extension than shared libs. The default will probably
12101 be appropriate.
12102
12103 EOM
12104         case "$dlext" in
12105         '')     dflt="$so" ;;
12106         *)      dflt="$dlext" ;;
12107         esac
12108         rp='What is the extension of dynamically loaded modules'
12109         . ./myread
12110         dlext="$ans"
12111         ;;
12112 *)
12113         dlext="none"
12114         ;;
12115 esac
12116
12117 : Check if dlsym need a leading underscore
12118 echo " "
12119 val="$undef"
12120
12121 case "$dlsrc" in
12122 dl_dlopen.xs)
12123         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12124         $cat >dyna.c <<'EOM'
12125 fred () { }
12126 EOM
12127
12128 $cat >fred.c<<EOM
12129
12130 #include <stdio.h>
12131 #$i_stdlib I_STDLIB
12132 #ifdef I_STDLIB
12133 #include <stdlib.h>
12134 #endif
12135 #$i_dlfcn I_DLFCN
12136 #ifdef I_DLFCN
12137 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12138 #else
12139 #include <sys/types.h>
12140 #include <nlist.h>
12141 #include <link.h>
12142 #endif
12143
12144 extern int fred() ;
12145
12146 int main()
12147 {
12148     void * handle ;
12149     void * symbol ;
12150 #ifndef RTLD_LAZY
12151     int mode = 1 ;
12152 #else
12153     int mode = RTLD_LAZY ;
12154 #endif
12155     handle = dlopen("./dyna.$dlext", mode) ;
12156     if (handle == NULL) {
12157         printf ("1\n") ;
12158         fflush (stdout) ;
12159         exit(0);
12160     }
12161     symbol = dlsym(handle, "fred") ;
12162     if (symbol == NULL) {
12163         /* try putting a leading underscore */
12164         symbol = dlsym(handle, "_fred") ;
12165         if (symbol == NULL) {
12166             printf ("2\n") ;
12167             fflush (stdout) ;
12168             exit(0);
12169         }
12170         printf ("3\n") ;
12171     }
12172     else
12173         printf ("4\n") ;
12174     fflush (stdout) ;
12175     exit(0);
12176 }
12177 EOM
12178         : Call the object file tmp-dyna.o in case dlext=o.
12179         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12180                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12181                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12182                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12183                 xxx=`$run ./fred`
12184                 case $xxx in
12185                 1)      echo "Test program failed using dlopen." >&4
12186                         echo "Perhaps you should not use dynamic loading." >&4;;
12187                 2)      echo "Test program failed using dlsym." >&4
12188                         echo "Perhaps you should not use dynamic loading." >&4;;
12189                 3)      echo "dlsym needs a leading underscore" >&4
12190                         val="$define" ;;
12191                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12192                 esac
12193         else
12194                 echo "I can't compile and run the test program." >&4
12195                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12196         fi
12197         ;;
12198 esac
12199
12200 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12201
12202 set d_dlsymun
12203 eval $setvar
12204
12205 : see if drand48_r exists
12206 set drand48_r d_drand48_r
12207 eval $inlibc
12208 case "$d_drand48_r" in
12209 "$define")
12210         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12211         case "$d_drand48_r_proto:$usethreads" in
12212         ":define")      d_drand48_r_proto=define
12213                 set d_drand48_r_proto drand48_r $hdrs
12214                 eval $hasproto ;;
12215         *)      ;;
12216         esac
12217         case "$d_drand48_r_proto" in
12218         define)
12219         case "$drand48_r_proto" in
12220         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12221         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12222         esac
12223         case "$drand48_r_proto" in
12224         ''|0)   d_drand48_r=undef
12225                 drand48_r_proto=0
12226                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12227         * )     case "$drand48_r_proto" in
12228                 REENTRANT_PROTO*) ;;
12229                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12230                 esac
12231                 echo "Prototype: $try" ;;
12232         esac
12233         ;;
12234         *)      case "$usethreads" in
12235                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12236                 esac
12237                 d_drand48_r=undef
12238                 drand48_r_proto=0
12239                 ;;
12240         esac
12241         ;;
12242 *)      drand48_r_proto=0
12243         ;;
12244 esac
12245
12246 : see if prototype for drand48 is available
12247 echo " "
12248 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12249 eval $hasproto
12250
12251 : see if dup2 exists
12252 set dup2 d_dup2
12253 eval $inlibc
12254
12255 : see if eaccess exists
12256 set eaccess d_eaccess
12257 eval $inlibc
12258
12259 : see if endgrent exists
12260 set endgrent d_endgrent
12261 eval $inlibc
12262
12263 : see if this is an grp system
12264 set grp.h i_grp
12265 eval $inhdr
12266
12267 case "$i_grp" in
12268 $define)
12269         xxx=`./findhdr grp.h`
12270         $cppstdin $cppflags $cppminus < $xxx >$$.h
12271
12272         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12273                 val="$define"
12274         else
12275                 val="$undef"
12276         fi
12277         set d_grpasswd
12278         eval $setvar
12279
12280         $rm -f $$.h
12281         ;;
12282 *)
12283         val="$undef";
12284         set d_grpasswd; eval $setvar
12285         ;;
12286 esac
12287
12288 : see if endgrent_r exists
12289 set endgrent_r d_endgrent_r
12290 eval $inlibc
12291 case "$d_endgrent_r" in
12292 "$define")
12293         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12294         case "$d_endgrent_r_proto:$usethreads" in
12295         ":define")      d_endgrent_r_proto=define
12296                 set d_endgrent_r_proto endgrent_r $hdrs
12297                 eval $hasproto ;;
12298         *)      ;;
12299         esac
12300         case "$d_endgrent_r_proto" in
12301         define)
12302         case "$endgrent_r_proto" in
12303         ''|0) try='int endgrent_r(FILE**);'
12304         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12305         esac
12306         case "$endgrent_r_proto" in
12307         ''|0) try='void endgrent_r(FILE**);'
12308         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12309         esac
12310         case "$endgrent_r_proto" in
12311         ''|0)   d_endgrent_r=undef
12312                 endgrent_r_proto=0
12313                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12314         * )     case "$endgrent_r_proto" in
12315                 REENTRANT_PROTO*) ;;
12316                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12317                 esac
12318                 echo "Prototype: $try" ;;
12319         esac
12320         ;;
12321         *)      case "$usethreads" in
12322                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12323                 esac
12324                 d_endgrent_r=undef
12325                 endgrent_r_proto=0
12326                 ;;
12327         esac
12328         ;;
12329 *)      endgrent_r_proto=0
12330         ;;
12331 esac
12332
12333 : see if endhostent exists
12334 set endhostent d_endhent
12335 eval $inlibc
12336
12337 : see if this is a netdb.h system
12338 set netdb.h i_netdb
12339 eval $inhdr
12340
12341 : see if endhostent_r exists
12342 set endhostent_r d_endhostent_r
12343 eval $inlibc
12344 case "$d_endhostent_r" in
12345 "$define")
12346         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12347         case "$d_endhostent_r_proto:$usethreads" in
12348         ":define")      d_endhostent_r_proto=define
12349                 set d_endhostent_r_proto endhostent_r $hdrs
12350                 eval $hasproto ;;
12351         *)      ;;
12352         esac
12353         case "$d_endhostent_r_proto" in
12354         define)
12355         case "$endhostent_r_proto" in
12356         ''|0) try='int endhostent_r(struct hostent_data*);'
12357         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12358         esac
12359         case "$endhostent_r_proto" in
12360         ''|0) try='void endhostent_r(struct hostent_data*);'
12361         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12362         esac
12363         case "$endhostent_r_proto" in
12364         ''|0)   d_endhostent_r=undef
12365                 endhostent_r_proto=0
12366                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12367         * )     case "$endhostent_r_proto" in
12368                 REENTRANT_PROTO*) ;;
12369                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12370                 esac
12371                 echo "Prototype: $try" ;;
12372         esac
12373         ;;
12374         *)      case "$usethreads" in
12375                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12376                 esac
12377                 d_endhostent_r=undef
12378                 endhostent_r_proto=0
12379                 ;;
12380         esac
12381         ;;
12382 *)      endhostent_r_proto=0
12383         ;;
12384 esac
12385
12386 : see if endnetent exists
12387 set endnetent d_endnent
12388 eval $inlibc
12389
12390 : see if endnetent_r exists
12391 set endnetent_r d_endnetent_r
12392 eval $inlibc
12393 case "$d_endnetent_r" in
12394 "$define")
12395         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12396         case "$d_endnetent_r_proto:$usethreads" in
12397         ":define")      d_endnetent_r_proto=define
12398                 set d_endnetent_r_proto endnetent_r $hdrs
12399                 eval $hasproto ;;
12400         *)      ;;
12401         esac
12402         case "$d_endnetent_r_proto" in
12403         define)
12404         case "$endnetent_r_proto" in
12405         ''|0) try='int endnetent_r(struct netent_data*);'
12406         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12407         esac
12408         case "$endnetent_r_proto" in
12409         ''|0) try='void endnetent_r(struct netent_data*);'
12410         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12411         esac
12412         case "$endnetent_r_proto" in
12413         ''|0)   d_endnetent_r=undef
12414                 endnetent_r_proto=0
12415                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12416         * )     case "$endnetent_r_proto" in
12417                 REENTRANT_PROTO*) ;;
12418                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12419                 esac
12420                 echo "Prototype: $try" ;;
12421         esac
12422         ;;
12423         *)      case "$usethreads" in
12424                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12425                 esac
12426                 d_endnetent_r=undef
12427                 endnetent_r_proto=0
12428                 ;;
12429         esac
12430         ;;
12431 *)      endnetent_r_proto=0
12432         ;;
12433 esac
12434
12435 : see if endprotoent exists
12436 set endprotoent d_endpent
12437 eval $inlibc
12438
12439 : see if endprotoent_r exists
12440 set endprotoent_r d_endprotoent_r
12441 eval $inlibc
12442 case "$d_endprotoent_r" in
12443 "$define")
12444         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12445         case "$d_endprotoent_r_proto:$usethreads" in
12446         ":define")      d_endprotoent_r_proto=define
12447                 set d_endprotoent_r_proto endprotoent_r $hdrs
12448                 eval $hasproto ;;
12449         *)      ;;
12450         esac
12451         case "$d_endprotoent_r_proto" in
12452         define)
12453         case "$endprotoent_r_proto" in
12454         ''|0) try='int endprotoent_r(struct protoent_data*);'
12455         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12456         esac
12457         case "$endprotoent_r_proto" in
12458         ''|0) try='void endprotoent_r(struct protoent_data*);'
12459         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12460         esac
12461         case "$endprotoent_r_proto" in
12462         ''|0)   d_endprotoent_r=undef
12463                 endprotoent_r_proto=0
12464                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12465         * )     case "$endprotoent_r_proto" in
12466                 REENTRANT_PROTO*) ;;
12467                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12468                 esac
12469                 echo "Prototype: $try" ;;
12470         esac
12471         ;;
12472         *)      case "$usethreads" in
12473                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12474                 esac
12475                 d_endprotoent_r=undef
12476                 endprotoent_r_proto=0
12477                 ;;
12478         esac
12479         ;;
12480 *)      endprotoent_r_proto=0
12481         ;;
12482 esac
12483
12484 : see if endpwent exists
12485 set endpwent d_endpwent
12486 eval $inlibc
12487
12488 : see if this is a pwd.h system
12489 set pwd.h i_pwd
12490 eval $inhdr
12491
12492 case "$i_pwd" in
12493 $define)
12494         xxx=`./findhdr pwd.h`
12495         $cppstdin $cppflags $cppminus < $xxx >$$.h
12496
12497         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12498                 val="$define"
12499         else
12500                 val="$undef"
12501         fi
12502         set d_pwquota
12503         eval $setvar
12504
12505         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12506                 val="$define"
12507         else
12508                 val="$undef"
12509         fi
12510         set d_pwage
12511         eval $setvar
12512
12513         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12514                 val="$define"
12515         else
12516                 val="$undef"
12517         fi
12518         set d_pwchange
12519         eval $setvar
12520
12521         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12522                 val="$define"
12523         else
12524                 val="$undef"
12525         fi
12526         set d_pwclass
12527         eval $setvar
12528
12529         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12530                 val="$define"
12531         else
12532                 val="$undef"
12533         fi
12534         set d_pwexpire
12535         eval $setvar
12536
12537         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12538                 val="$define"
12539         else
12540                 val="$undef"
12541         fi
12542         set d_pwcomment
12543         eval $setvar
12544
12545         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12546                 val="$define"
12547         else
12548                 val="$undef"
12549         fi
12550         set d_pwgecos
12551         eval $setvar
12552
12553         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12554                 val="$define"
12555         else
12556                 val="$undef"
12557         fi
12558         set d_pwpasswd
12559         eval $setvar
12560
12561         $rm -f $$.h
12562         ;;
12563 *)
12564         val="$undef";
12565         set d_pwquota; eval $setvar
12566         set d_pwage; eval $setvar
12567         set d_pwchange; eval $setvar
12568         set d_pwclass; eval $setvar
12569         set d_pwexpire; eval $setvar
12570         set d_pwcomment; eval $setvar
12571         set d_pwgecos; eval $setvar
12572         set d_pwpasswd; eval $setvar
12573         ;;
12574 esac
12575
12576 : see if endpwent_r exists
12577 set endpwent_r d_endpwent_r
12578 eval $inlibc
12579 case "$d_endpwent_r" in
12580 "$define")
12581         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12582         case "$d_endpwent_r_proto:$usethreads" in
12583         ":define")      d_endpwent_r_proto=define
12584                 set d_endpwent_r_proto endpwent_r $hdrs
12585                 eval $hasproto ;;
12586         *)      ;;
12587         esac
12588         case "$d_endpwent_r_proto" in
12589         define)
12590         case "$endpwent_r_proto" in
12591         ''|0) try='int endpwent_r(FILE**);'
12592         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12593         esac
12594         case "$endpwent_r_proto" in
12595         ''|0) try='void endpwent_r(FILE**);'
12596         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12597         esac
12598         case "$endpwent_r_proto" in
12599         ''|0)   d_endpwent_r=undef
12600                 endpwent_r_proto=0
12601                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12602         * )     case "$endpwent_r_proto" in
12603                 REENTRANT_PROTO*) ;;
12604                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12605                 esac
12606                 echo "Prototype: $try" ;;
12607         esac
12608         ;;
12609         *)      case "$usethreads" in
12610                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12611                 esac
12612                 d_endpwent_r=undef
12613                 endpwent_r_proto=0
12614                 ;;
12615         esac
12616         ;;
12617 *)      endpwent_r_proto=0
12618         ;;
12619 esac
12620
12621 : see if endservent exists
12622 set endservent d_endsent
12623 eval $inlibc
12624
12625 : see if endservent_r exists
12626 set endservent_r d_endservent_r
12627 eval $inlibc
12628 case "$d_endservent_r" in
12629 "$define")
12630         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12631         case "$d_endservent_r_proto:$usethreads" in
12632         ":define")      d_endservent_r_proto=define
12633                 set d_endservent_r_proto endservent_r $hdrs
12634                 eval $hasproto ;;
12635         *)      ;;
12636         esac
12637         case "$d_endservent_r_proto" in
12638         define)
12639         case "$endservent_r_proto" in
12640         ''|0) try='int endservent_r(struct servent_data*);'
12641         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12642         esac
12643         case "$endservent_r_proto" in
12644         ''|0) try='void endservent_r(struct servent_data*);'
12645         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12646         esac
12647         case "$endservent_r_proto" in
12648         ''|0)   d_endservent_r=undef
12649                 endservent_r_proto=0
12650                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12651         * )     case "$endservent_r_proto" in
12652                 REENTRANT_PROTO*) ;;
12653                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12654                 esac
12655                 echo "Prototype: $try" ;;
12656         esac
12657         ;;
12658         *)      case "$usethreads" in
12659                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12660                 esac
12661                 d_endservent_r=undef
12662                 endservent_r_proto=0
12663                 ;;
12664         esac
12665         ;;
12666 *)      endservent_r_proto=0
12667         ;;
12668 esac
12669
12670 : Locate the flags for 'open()'
12671 echo " "
12672 $cat >try.c <<EOCP
12673 #include <sys/types.h>
12674 #ifdef I_FCNTL
12675 #include <fcntl.h>
12676 #endif
12677 #ifdef I_SYS_FILE
12678 #include <sys/file.h>
12679 #endif
12680 #$i_stdlib I_STDLIB
12681 #ifdef I_STDLIB
12682 #include <stdlib.h>
12683 #endif
12684 int main() {
12685         if(O_RDONLY);
12686 #ifdef O_TRUNC
12687         exit(0);
12688 #else
12689         exit(1);
12690 #endif
12691 }
12692 EOCP
12693 : check sys/file.h first to get FREAD on Sun
12694 if $test `./findhdr sys/file.h` && \
12695                 set try -DI_SYS_FILE && eval $compile; then
12696         h_sysfile=true;
12697         echo "<sys/file.h> defines the O_* constants..." >&4
12698         if $run ./try; then
12699                 echo "and you have the 3 argument form of open()." >&4
12700                 val="$define"
12701         else
12702                 echo "but not the 3 argument form of open().  Oh, well." >&4
12703                 val="$undef"
12704         fi
12705 elif $test `./findhdr fcntl.h` && \
12706                 set try -DI_FCNTL && eval $compile; then
12707         h_fcntl=true;
12708         echo "<fcntl.h> defines the O_* constants..." >&4
12709         if $run ./try; then
12710                 echo "and you have the 3 argument form of open()." >&4
12711                 val="$define"
12712         else
12713                 echo "but not the 3 argument form of open().  Oh, well." >&4
12714                 val="$undef"
12715         fi
12716 else
12717         val="$undef"
12718         echo "I can't find the O_* constant definitions!  You got problems." >&4
12719 fi
12720 set d_open3
12721 eval $setvar
12722 $rm_try
12723
12724 : see if this is a sys/file.h system
12725 val=''
12726 set sys/file.h val
12727 eval $inhdr
12728
12729 : do we need to include sys/file.h ?
12730 case "$val" in
12731 "$define")
12732         echo " "
12733         if $h_sysfile; then
12734                 val="$define"
12735                 echo "We'll be including <sys/file.h>." >&4
12736         else
12737                 val="$undef"
12738                 echo "We won't be including <sys/file.h>." >&4
12739         fi
12740         ;;
12741 *)
12742         h_sysfile=false
12743         ;;
12744 esac
12745 set i_sysfile
12746 eval $setvar
12747
12748 : see if fcntl.h is there
12749 val=''
12750 set fcntl.h val
12751 eval $inhdr
12752
12753 : see if we can include fcntl.h
12754 case "$val" in
12755 "$define")
12756         echo " "
12757         if $h_fcntl; then
12758                 val="$define"
12759                 echo "We'll be including <fcntl.h>." >&4
12760         else
12761                 val="$undef"
12762                 if $h_sysfile; then
12763         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12764                 else
12765                         echo "We won't be including <fcntl.h>." >&4
12766                 fi
12767         fi
12768         ;;
12769 *)
12770         h_fcntl=false
12771         val="$undef"
12772         ;;
12773 esac
12774 set i_fcntl
12775 eval $setvar
12776
12777 : see if fork exists
12778 set fork d_fork
12779 eval $inlibc
12780
12781 : see if pipe exists
12782 set pipe d_pipe
12783 eval $inlibc
12784
12785 : check for non-blocking I/O stuff
12786 case "$h_sysfile" in
12787 true) echo "#include <sys/file.h>" > head.c;;
12788 *)
12789        case "$h_fcntl" in
12790        true) echo "#include <fcntl.h>" > head.c;;
12791        *) echo "#include <sys/fcntl.h>" > head.c;;
12792        esac
12793        ;;
12794 esac
12795 echo " "
12796 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12797 case "$o_nonblock" in
12798 '')
12799         $cat head.c > try.c
12800         $cat >>try.c <<EOCP
12801 #include <stdio.h>
12802 #$i_stdlib I_STDLIB
12803 #ifdef I_STDLIB
12804 #include <stdlib.h>
12805 #endif
12806 #$i_fcntl I_FCNTL
12807 #ifdef I_FCNTL
12808 #include <fcntl.h>
12809 #endif
12810 int main() {
12811 #ifdef O_NONBLOCK
12812         printf("O_NONBLOCK\n");
12813         exit(0);
12814 #endif
12815 #ifdef O_NDELAY
12816         printf("O_NDELAY\n");
12817         exit(0);
12818 #endif
12819 #ifdef FNDELAY
12820         printf("FNDELAY\n");
12821         exit(0);
12822 #endif
12823         exit(0);
12824 }
12825 EOCP
12826         set try
12827         if eval $compile_ok; then
12828                 o_nonblock=`$run ./try`
12829                 case "$o_nonblock" in
12830                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12831                 *) echo "Seems like we can use $o_nonblock.";;
12832                 esac
12833         else
12834                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12835         fi
12836         ;;
12837 *) echo "Using $hint value $o_nonblock.";;
12838 esac
12839 $rm_try
12840
12841 echo " "
12842 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12843 case "$eagain" in
12844 '')
12845         case "$d_fork:$d_pipe" in
12846         define:define)
12847         $cat head.c > try.c
12848         $cat >>try.c <<EOCP
12849 #include <errno.h>
12850 #include <sys/types.h>
12851 #include <signal.h>
12852 #include <stdio.h>
12853 #$i_stdlib I_STDLIB
12854 #ifdef I_STDLIB
12855 #include <stdlib.h>
12856 #endif
12857 #$i_fcntl I_FCNTL
12858 #ifdef I_FCNTL
12859 #include <fcntl.h>
12860 #endif
12861 #define MY_O_NONBLOCK $o_nonblock
12862 #ifndef errno  /* XXX need better Configure test */
12863 extern int errno;
12864 #endif
12865 #$i_unistd I_UNISTD
12866 #ifdef I_UNISTD
12867 #include <unistd.h>
12868 #endif
12869 #$i_string I_STRING
12870 #ifdef I_STRING
12871 #include <string.h>
12872 #else
12873 #include <strings.h>
12874 #endif
12875 $signal_t blech(int x) { exit(3); }
12876 EOCP
12877         $cat >> try.c <<'EOCP'
12878 int main()
12879 {
12880         int pd[2];
12881         int pu[2];
12882         char buf[1];
12883         char string[100];
12884
12885         pipe(pd);       /* Down: child -> parent */
12886         pipe(pu);       /* Up: parent -> child */
12887         if (0 != fork()) {
12888                 int ret;
12889                 close(pd[1]);   /* Parent reads from pd[0] */
12890                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12891 #ifdef F_SETFL
12892                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12893                         exit(1);
12894 #else
12895                 exit(4);
12896 #endif
12897                 signal(SIGALRM, blech);
12898                 alarm(5);
12899                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12900                         exit(2);
12901                 sprintf(string, "%d\n", ret);
12902                 write(2, string, strlen(string));
12903                 alarm(0);
12904 #ifdef EAGAIN
12905                 if (errno == EAGAIN) {
12906                         printf("EAGAIN\n");
12907                         goto ok;
12908                 }
12909 #endif
12910 #ifdef EWOULDBLOCK
12911                 if (errno == EWOULDBLOCK)
12912                         printf("EWOULDBLOCK\n");
12913 #endif
12914         ok:
12915                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12916                 sleep(2);                               /* Give it time to close our pipe */
12917                 alarm(5);
12918                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12919                 alarm(0);
12920                 sprintf(string, "%d\n", ret);
12921                 write(4, string, strlen(string));
12922                 exit(0);
12923         }
12924
12925         close(pd[0]);                   /* We write to pd[1] */
12926         close(pu[1]);                   /* We read from pu[0] */
12927         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12928         close(pd[1]);                   /* Pipe pd is now fully closed! */
12929         exit(0);                                /* Bye bye, thank you for playing! */
12930 }
12931 EOCP
12932         set try
12933         if eval $compile_ok; then
12934                 echo "$startsh" >mtry
12935                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12936                 chmod +x mtry
12937                 $run ./mtry >/dev/null 2>&1
12938                 case $? in
12939                 0) eagain=`$cat try.out`;;
12940                 1) echo "Could not perform non-blocking setting!";;
12941                 2) echo "I did a successful read() for something that was not there!";;
12942                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12943                 4) echo "Could not find F_SETFL!";;
12944                 *) echo "Something terribly wrong happened during testing.";;
12945                 esac
12946                 rd_nodata=`$cat try.ret`
12947                 echo "A read() system call with no data present returns $rd_nodata."
12948                 case "$rd_nodata" in
12949                 0|-1) ;;
12950                 *)
12951                         echo "(That's peculiar, fixing that to be -1.)"
12952                         rd_nodata=-1
12953                         ;;
12954                 esac
12955                 case "$eagain" in
12956                 '')
12957                         echo "Forcing errno EAGAIN on read() with no data available."
12958                         eagain=EAGAIN
12959                         ;;
12960                 *)
12961                         echo "Your read() sets errno to $eagain when no data is available."
12962                         ;;
12963                 esac
12964                 status=`$cat try.err`
12965                 case "$status" in
12966                 0) echo "And it correctly returns 0 to signal EOF.";;
12967                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12968                 *) echo "However, your read() returns '$status' on EOF??";;
12969                 esac
12970                 val="$define"
12971                 if test "$status" = "$rd_nodata"; then
12972                         echo "WARNING: you can't distinguish between EOF and no data!"
12973                         val="$undef"
12974                 fi
12975         else
12976                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12977                 eagain=EAGAIN
12978         fi
12979         ;;
12980         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12981                 eagain=EAGAIN
12982                 val="$define"
12983                 ;;
12984         esac
12985         set d_eofnblk
12986         eval $setvar
12987         ;;
12988 *)
12989         echo "Using $hint value $eagain."
12990         echo "Your read() returns $rd_nodata when no data is present."
12991         case "$d_eofnblk" in
12992         "$define") echo "And you can see EOF because read() returns 0.";;
12993         "$undef") echo "But you can't see EOF status from read() returned value.";;
12994         *)
12995                 echo "(Assuming you can't see EOF status from read anyway.)"
12996                 d_eofnblk=$undef
12997                 ;;
12998         esac
12999         ;;
13000 esac
13001 $rm_try head.c mtry
13002
13003 : see if _ptr and _cnt from stdio act std
13004 echo " "
13005
13006 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13007         echo "(Looks like you have stdio.h from BSD.)"
13008         case "$stdio_ptr" in
13009         '') stdio_ptr='((fp)->_p)'
13010                 ptr_lval=$define
13011                 ;;
13012         *)      ptr_lval=$d_stdio_ptr_lval;;
13013         esac
13014         case "$stdio_cnt" in
13015         '') stdio_cnt='((fp)->_r)'
13016                 cnt_lval=$define
13017                 ;;
13018         *)      cnt_lval=$d_stdio_cnt_lval;;
13019         esac
13020         case "$stdio_base" in
13021         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13022         esac
13023         case "$stdio_bufsiz" in
13024         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13025         esac
13026 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13027         echo "(Looks like you have stdio.h from Linux.)"
13028         case "$stdio_ptr" in
13029         '') stdio_ptr='((fp)->_IO_read_ptr)'
13030                 ptr_lval=$define
13031                 ;;
13032         *)      ptr_lval=$d_stdio_ptr_lval;;
13033         esac
13034         case "$stdio_cnt" in
13035         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13036                 cnt_lval=$undef
13037                 ;;
13038         *)      cnt_lval=$d_stdio_cnt_lval;;
13039         esac
13040         case "$stdio_base" in
13041         '') stdio_base='((fp)->_IO_read_base)';;
13042         esac
13043         case "$stdio_bufsiz" in
13044         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13045         esac
13046 else
13047         case "$stdio_ptr" in
13048         '') stdio_ptr='((fp)->_ptr)'
13049                 ptr_lval=$define
13050                 ;;
13051         *)      ptr_lval=$d_stdio_ptr_lval;;
13052         esac
13053         case "$stdio_cnt" in
13054         '') stdio_cnt='((fp)->_cnt)'
13055                 cnt_lval=$define
13056                 ;;
13057         *)      cnt_lval=$d_stdio_cnt_lval;;
13058         esac
13059         case "$stdio_base" in
13060         '') stdio_base='((fp)->_base)';;
13061         esac
13062         case "$stdio_bufsiz" in
13063         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13064         esac
13065 fi
13066
13067 : test whether _ptr and _cnt really work
13068 echo "Checking how std your stdio is..." >&4
13069 $cat >try.c <<EOP
13070 #include <stdio.h>
13071 #$i_stdlib I_STDLIB
13072 #ifdef I_STDLIB
13073 #include <stdlib.h>
13074 #endif
13075 #define FILE_ptr(fp)    $stdio_ptr
13076 #define FILE_cnt(fp)    $stdio_cnt
13077 int main() {
13078         FILE *fp = fopen("try.c", "r");
13079         char c = getc(fp);
13080         if (
13081                 18 <= FILE_cnt(fp) &&
13082                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13083         )
13084                 exit(0);
13085         exit(1);
13086 }
13087 EOP
13088 val="$undef"
13089 set try
13090 if eval $compile && $to try.c; then
13091         if $run ./try; then
13092                 echo "Your stdio acts pretty std."
13093                 val="$define"
13094         else
13095                 echo "Your stdio isn't very std."
13096         fi
13097 else
13098         echo "Your stdio doesn't appear very std."
13099 fi
13100 $rm_try
13101
13102 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13103 # direct buffer manipulation no longer works.  The Configure tests
13104 # should be changed to correctly detect this, but until then,
13105 # the following check should at least let perl compile and run.
13106 # (This quick fix should be updated before 5.8.1.)
13107 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13108 # A. Dougherty, June 3, 2002.
13109 case "$d_gnulibc" in
13110 $define)
13111         case "$gnulibc_version" in
13112         2.[01]*)  ;;
13113         2.2) ;;
13114         2.2.[0-9]) ;;
13115         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13116                 val="$undef"
13117                 ;;
13118         esac
13119         ;;
13120 esac
13121 set d_stdstdio
13122 eval $setvar
13123
13124 : Can _ptr be used as an lvalue?
13125 case "$d_stdstdio$ptr_lval" in
13126 $define$define) val=$define ;;
13127 *) val=$undef ;;
13128 esac
13129 set d_stdio_ptr_lval
13130 eval $setvar
13131
13132 : Can _cnt be used as an lvalue?
13133 case "$d_stdstdio$cnt_lval" in
13134 $define$define) val=$define ;;
13135 *) val=$undef ;;
13136 esac
13137 set d_stdio_cnt_lval
13138 eval $setvar
13139
13140
13141 : test whether setting _ptr sets _cnt as a side effect
13142 d_stdio_ptr_lval_sets_cnt="$undef"
13143 d_stdio_ptr_lval_nochange_cnt="$undef"
13144 case "$d_stdio_ptr_lval$d_stdstdio" in
13145 $define$define)
13146         echo "Checking to see what happens if we set the stdio ptr..." >&4
13147 $cat >try.c <<EOP
13148 #include <stdio.h>
13149 /* Can we scream? */
13150 /* Eat dust sed :-) */
13151 /* In the buffer space, no one can hear you scream. */
13152 #$i_stdlib I_STDLIB
13153 #ifdef I_STDLIB
13154 #include <stdlib.h>
13155 #endif
13156 #define FILE_ptr(fp)    $stdio_ptr
13157 #define FILE_cnt(fp)    $stdio_cnt
13158 #include <sys/types.h>
13159 int main() {
13160         FILE *fp = fopen("try.c", "r");
13161         int c;
13162         char *ptr;
13163         size_t cnt;
13164         if (!fp) {
13165             puts("Fail even to read");
13166             exit(1);
13167         }
13168         c = getc(fp); /* Read away the first # */
13169         if (c == EOF) {
13170             puts("Fail even to read");
13171             exit(1);
13172         }
13173         if (!(
13174                 18 <= FILE_cnt(fp) &&
13175                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13176         )) {
13177                 puts("Fail even to read");
13178                 exit (1);
13179         }
13180         ptr = (char*) FILE_ptr(fp);
13181         cnt = (size_t)FILE_cnt(fp);
13182
13183         FILE_ptr(fp) += 42;
13184
13185         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13186                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13187                 exit (1);
13188         }
13189         if (FILE_cnt(fp) <= 20) {
13190                 printf ("Fail (<20 chars to test)");
13191                 exit (1);
13192         }
13193         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13194                 puts("Fail compare");
13195                 exit (1);
13196         }
13197         if (cnt == FILE_cnt(fp)) {
13198                 puts("Pass_unchanged");
13199                 exit (0);
13200         }
13201         if (FILE_cnt(fp) == (cnt - 42)) {
13202                 puts("Pass_changed");
13203                 exit (0);
13204         }
13205         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13206         return 1;
13207
13208 }
13209 EOP
13210         set try
13211         if eval $compile && $to try.c; then
13212                 case `$run ./try` in
13213                 Pass_changed)
13214                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13215                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13216                 Pass_unchanged)
13217                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13218                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13219                 Fail*)
13220                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13221                 *)
13222                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13223         esac
13224         else
13225                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13226         fi
13227         $rm_try
13228         ;;
13229 esac
13230
13231 : see if _base is also standard
13232 val="$undef"
13233 case "$d_stdstdio" in
13234 $define)
13235         $cat >try.c <<EOP
13236 #include <stdio.h>
13237 #$i_stdlib I_STDLIB
13238 #ifdef I_STDLIB
13239 #include <stdlib.h>
13240 #endif
13241 #define FILE_base(fp)   $stdio_base
13242 #define FILE_bufsiz(fp) $stdio_bufsiz
13243 int main() {
13244         FILE *fp = fopen("try.c", "r");
13245         char c = getc(fp);
13246         if (
13247                 19 <= FILE_bufsiz(fp) &&
13248                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13249         )
13250                 exit(0);
13251         exit(1);
13252 }
13253 EOP
13254         set try
13255         if eval $compile && $to try.c; then
13256                 if $run ./try; then
13257                         echo "And its _base field acts std."
13258                         val="$define"
13259                 else
13260                         echo "But its _base field isn't std."
13261                 fi
13262         else
13263                 echo "However, it seems to be lacking the _base field."
13264         fi
13265         $rm_try
13266         ;;
13267 esac
13268 set d_stdiobase
13269 eval $setvar
13270
13271 : see if fast_stdio exists
13272 val="$undef"
13273 case "$d_stdstdio:$d_stdio_ptr_lval" in
13274 "$define:$define")
13275         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13276         *$define*)
13277                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13278                 val="$define"
13279                 ;;
13280         esac
13281         ;;
13282 esac
13283 set d_faststdio
13284 eval $setvar
13285
13286
13287
13288 : see if fchdir exists
13289 set fchdir d_fchdir
13290 eval $inlibc
13291
13292 : see if fchmod exists
13293 set fchmod d_fchmod
13294 eval $inlibc
13295
13296 : see if fchown exists
13297 set fchown d_fchown
13298 eval $inlibc
13299
13300 : see if this is an fcntl system
13301 set fcntl d_fcntl
13302 eval $inlibc
13303
13304 : See if fcntl-based locking works.
13305 echo " "
13306 $cat >try.c <<EOCP
13307 #$i_stdlib I_STDLIB
13308 #ifdef I_STDLIB
13309 #include <stdlib.h>
13310 #endif
13311 #include <unistd.h>
13312 #include <fcntl.h>
13313 #include <signal.h>
13314 $signal_t blech(int x) { exit(3); }
13315 int main() {
13316 #if defined(F_SETLK) && defined(F_SETLKW)
13317      struct flock flock;
13318      int retval, fd;
13319      fd = open("try.c", O_RDONLY);
13320      flock.l_type = F_RDLCK;
13321      flock.l_whence = SEEK_SET;
13322      flock.l_start = flock.l_len = 0;
13323      signal(SIGALRM, blech);
13324      alarm(10);
13325      retval = fcntl(fd, F_SETLK, &flock);
13326      close(fd);
13327      (retval < 0 ? exit(2) : exit(0));
13328 #else
13329      exit(2);
13330 #endif
13331 }
13332 EOCP
13333 echo "Checking if fcntl-based file locking works... "
13334 case "$d_fcntl" in
13335 "$define")
13336         set try
13337         if eval $compile_ok; then
13338                 if $run ./try; then
13339                         echo "Yes, it seems to work."
13340                         val="$define"
13341                 else
13342                         echo "Nope, it didn't work."
13343                         val="$undef"
13344                         case "$?" in
13345                         3) $cat >&4 <<EOM
13346 ***
13347 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13348 *** This is (almost) impossible.
13349 *** If your NFS lock daemons are not feeling well, something like
13350 *** this may happen, please investigate.  Cannot continue, aborting.
13351 ***
13352 EOM
13353                                 exit 1
13354                                 ;;
13355                         esac
13356                 fi
13357         else
13358                 echo "I'm unable to compile the test program, so I'll assume not."
13359                 val="$undef"
13360         fi
13361         ;;
13362 *) val="$undef";
13363         echo "Nope, since you don't even have fcntl()."
13364         ;;
13365 esac
13366 set d_fcntl_can_lock
13367 eval $setvar
13368 $rm_try
13369
13370 : check for fd_set items
13371 $cat <<EOM
13372
13373 Checking to see how well your C compiler handles fd_set and friends ...
13374 EOM
13375 $cat >try.c <<EOCP
13376 #$i_stdlib I_STDLIB
13377 #ifdef I_STDLIB
13378 #include <stdlib.h>
13379 #endif
13380 #$i_systime I_SYS_TIME
13381 #$i_sysselct I_SYS_SELECT
13382 #$d_socket HAS_SOCKET
13383 #include <sys/types.h>
13384 #ifdef HAS_SOCKET
13385 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13386 #endif
13387 #ifdef I_SYS_TIME
13388 #include <sys/time.h>
13389 #endif
13390 #ifdef I_SYS_SELECT
13391 #include <sys/select.h>
13392 #endif
13393 int main() {
13394         fd_set fds;
13395
13396 #ifdef TRYBITS
13397         if(fds.fds_bits);
13398 #endif
13399
13400 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13401         exit(0);
13402 #else
13403         exit(1);
13404 #endif
13405 }
13406 EOCP
13407 set try -DTRYBITS
13408 if eval $compile; then
13409         d_fds_bits="$define"
13410         d_fd_set="$define"
13411         echo "Well, your system knows about the normal fd_set typedef..." >&4
13412         if $run ./try; then
13413                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13414                 d_fd_macros="$define"
13415         else
13416                 $cat >&4 <<'EOM'
13417 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13418 EOM
13419                 d_fd_macros="$undef"
13420         fi
13421 else
13422         $cat <<'EOM'
13423 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13424 EOM
13425         set try
13426         if eval $compile; then
13427                 d_fds_bits="$undef"
13428                 d_fd_set="$define"
13429                 echo "Well, your system has some sort of fd_set available..." >&4
13430                 if $run ./try; then
13431                         echo "and you have the normal fd_set macros." >&4
13432                         d_fd_macros="$define"
13433                 else
13434                         $cat <<'EOM'
13435 but not the normal fd_set macros!  Gross!  More work for me...
13436 EOM
13437                         d_fd_macros="$undef"
13438                 fi
13439         else
13440         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13441                 d_fd_set="$undef"
13442                 d_fds_bits="$undef"
13443                 d_fd_macros="$undef"
13444         fi
13445 fi
13446 $rm_try
13447
13448 : see if fgetpos exists
13449 set fgetpos d_fgetpos
13450 eval $inlibc
13451
13452 : see if finite exists
13453 set finite d_finite
13454 eval $inlibc
13455
13456 : see if finitel exists
13457 set finitel d_finitel
13458 eval $inlibc
13459
13460 : see if flock exists
13461 set flock d_flock
13462 eval $inlibc
13463
13464 : see if prototype for flock is available
13465 echo " "
13466 set d_flockproto flock $i_sysfile sys/file.h
13467 eval $hasproto
13468
13469 : see if fp_class exists
13470 set fp_class d_fp_class
13471 eval $inlibc
13472
13473 : see if pathconf exists
13474 set pathconf d_pathconf
13475 eval $inlibc
13476
13477 : see if fpathconf exists
13478 set fpathconf d_fpathconf
13479 eval $inlibc
13480
13481 : see if fpclass exists
13482 set fpclass d_fpclass
13483 eval $inlibc
13484
13485 : see if fpclassify exists
13486 set fpclassify d_fpclassify
13487 eval $inlibc
13488
13489 : see if fpclassl exists
13490 set fpclassl d_fpclassl
13491 eval $inlibc
13492
13493 : check for fpos64_t
13494 echo " "
13495 echo "Checking to see if you have fpos64_t..." >&4
13496 $cat >try.c <<EOCP
13497 #include <stdio.h>
13498 int main() { fpos64_t x = 7; }
13499 EOCP
13500 set try
13501 if eval $compile; then
13502         val="$define"
13503         echo "You have fpos64_t."
13504 else
13505         val="$undef"
13506         echo "You do not have fpos64_t."
13507         case "$fpossize" in
13508         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13509         esac
13510 fi
13511 $rm_try
13512 set d_fpos64_t
13513 eval $setvar
13514
13515 : see if frexpl exists
13516 set frexpl d_frexpl
13517 eval $inlibc
13518
13519 : see if this is a sys/param system
13520 set sys/param.h i_sysparam
13521 eval $inhdr
13522
13523 : see if this is a sys/mount.h system
13524 set sys/mount.h i_sysmount
13525 eval $inhdr
13526
13527 : Check for fs_data_s
13528 echo " "
13529 echo "Checking to see if your system supports struct fs_data..." >&4
13530 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13531 eval $hasstruct
13532 case "$d_fs_data_s" in
13533 "$define")      echo "Yes, it does."   ;;
13534 *)              echo "No, it doesn't." ;;
13535 esac
13536
13537 : see if fseeko exists
13538 set fseeko d_fseeko
13539 eval $inlibc
13540 case "$longsize" in
13541 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13542 esac
13543
13544 : see if fsetpos exists
13545 set fsetpos d_fsetpos
13546 eval $inlibc
13547
13548 : see if fstatfs exists
13549 set fstatfs d_fstatfs
13550 eval $inlibc
13551
13552 : see if statvfs exists
13553 set statvfs d_statvfs
13554 eval $inlibc
13555
13556 : see if fstatvfs exists
13557 set fstatvfs d_fstatvfs
13558 eval $inlibc
13559
13560
13561 : see if fsync exists
13562 set fsync d_fsync
13563 eval $inlibc
13564
13565 : see if ftello exists
13566 set ftello d_ftello
13567 eval $inlibc
13568 case "$longsize" in
13569 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13570 esac
13571
13572 : check for a working futimes
13573 d_futimes="$undef"
13574 echo " "
13575 echo "Checking if you have a working futimes()" >&4
13576 $cat >try.c <<EOCP
13577 #include <stdio.h>
13578 #include <sys/time.h>
13579 #include <errno.h>
13580 #include <fcntl.h>
13581
13582 int main ()
13583 {
13584     int fd, rv;
13585     fd = open ("try.c", O_RDWR);
13586     if (-1 == fd) exit (1);
13587     rv = futimes (fd, NULL);
13588     exit (rv == -1 ? errno : 0);
13589 }
13590 EOCP
13591 set try
13592 if eval $compile; then
13593     `$run ./try`
13594     rc=$?
13595     case "$rc" in
13596         0)  echo "Yes, you have" >&4
13597             d_futimes="$define"
13598             ;;
13599         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13600             ;;
13601     esac
13602 else
13603     echo "No, it does not (probably harmless)" >&4
13604 fi
13605 $rm_try
13606
13607 : see if ndbm.h is available
13608 set ndbm.h i_ndbm
13609 eval $inhdr
13610 : Compatibility location for RedHat 7.1
13611 set gdbm/ndbm.h i_gdbmndbm
13612 eval $inhdr
13613 : Compatibility location for Debian 4.0
13614 set gdbm-ndbm.h i_gdbm_ndbm
13615 eval $inhdr
13616
13617 val="$undef"
13618 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13619         : see if dbm_open exists
13620         set dbm_open d_dbm_open
13621         eval $inlibc
13622         case "$d_dbm_open" in
13623         $undef)
13624                 i_ndbm="$undef"
13625                 i_gdbmndbm="$undef"
13626                 i_gdbm_ndbm="$undef"
13627                 echo "We won't be including <ndbm.h>"
13628                 val="$undef"
13629                 ;;
13630         *) val="$define"
13631            ;;
13632         esac
13633 fi
13634 set d_ndbm
13635 eval $setvar
13636
13637 ndbm_hdr_protochk='name=$1; hdr=$2;
13638 eval "ihdr=\$""i_$name";
13639 val="$undef";
13640 if $test "$ihdr" = "$define"; then
13641         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13642         case "$d_cplusplus" in
13643         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13644         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13645         esac;
13646         case "$val" in
13647         $define) $echo "Your <$hdr> seems to have prototypes";;
13648         *) $echo "Your <$hdr> does not seem to have prototypes";;
13649         esac;
13650 fi;
13651 set "d_${name}_h_uses_prototypes";
13652 eval $setvar'
13653
13654 set ndbm ndbm.h
13655 eval $ndbm_hdr_protochk
13656 set gdbmndbm gdbm/ndbm.h
13657 eval $ndbm_hdr_protochk
13658 set gdbm_ndbm gdbm-ndbm.h
13659 eval $ndbm_hdr_protochk
13660
13661 : see if getaddrinfo exists
13662 set getaddrinfo d_getaddrinfo
13663 eval $inlibc
13664
13665 : see if getcwd exists
13666 set getcwd d_getcwd
13667 eval $inlibc
13668
13669 : see if getespwnam exists
13670 set getespwnam d_getespwnam
13671 eval $inlibc
13672
13673 : see if getfsstat exists
13674 set getfsstat d_getfsstat
13675 eval $inlibc
13676
13677 : see if getgrent exists
13678 set getgrent d_getgrent
13679 eval $inlibc
13680
13681 : see if getgrent_r exists
13682 set getgrent_r d_getgrent_r
13683 eval $inlibc
13684 case "$d_getgrent_r" in
13685 "$define")
13686         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13687         case "$d_getgrent_r_proto:$usethreads" in
13688         ":define")      d_getgrent_r_proto=define
13689                 set d_getgrent_r_proto getgrent_r $hdrs
13690                 eval $hasproto ;;
13691         *)      ;;
13692         esac
13693         case "$d_getgrent_r_proto" in
13694         define)
13695         case "$getgrent_r_proto" in
13696         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13697         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13698         esac
13699         case "$getgrent_r_proto" in
13700         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13701         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13702         esac
13703         case "$getgrent_r_proto" in
13704         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13705         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13706         esac
13707         case "$getgrent_r_proto" in
13708         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13709         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13710         esac
13711         case "$getgrent_r_proto" in
13712         ''|0) try='int getgrent_r(struct group*, char*, int);'
13713         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13714         esac
13715         case "$getgrent_r_proto" in
13716         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13717         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13718         esac
13719         case "$getgrent_r_proto" in
13720         ''|0)   d_getgrent_r=undef
13721                 getgrent_r_proto=0
13722                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13723         * )     case "$getgrent_r_proto" in
13724                 REENTRANT_PROTO*) ;;
13725                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13726                 esac
13727                 echo "Prototype: $try" ;;
13728         esac
13729         ;;
13730         *)      case "$usethreads" in
13731                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13732                 esac
13733                 d_getgrent_r=undef
13734                 getgrent_r_proto=0
13735                 ;;
13736         esac
13737         ;;
13738 *)      getgrent_r_proto=0
13739         ;;
13740 esac
13741
13742 : see if getgrgid_r exists
13743 set getgrgid_r d_getgrgid_r
13744 eval $inlibc
13745 case "$d_getgrgid_r" in
13746 "$define")
13747         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13748         case "$d_getgrgid_r_proto:$usethreads" in
13749         ":define")      d_getgrgid_r_proto=define
13750                 set d_getgrgid_r_proto getgrgid_r $hdrs
13751                 eval $hasproto ;;
13752         *)      ;;
13753         esac
13754         case "$d_getgrgid_r_proto" in
13755         define)
13756         case "$getgrgid_r_proto" in
13757         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13758         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13759         esac
13760         case "$getgrgid_r_proto" in
13761         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13762         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13763         esac
13764         case "$getgrgid_r_proto" in
13765         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13766         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13767         esac
13768         case "$getgrgid_r_proto" in
13769         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13770         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13771         esac
13772         case "$getgrgid_r_proto" in
13773         ''|0)   d_getgrgid_r=undef
13774                 getgrgid_r_proto=0
13775                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13776         * )     case "$getgrgid_r_proto" in
13777                 REENTRANT_PROTO*) ;;
13778                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13779                 esac
13780                 echo "Prototype: $try" ;;
13781         esac
13782         ;;
13783         *)      case "$usethreads" in
13784                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13785                 esac
13786                 d_getgrgid_r=undef
13787                 getgrgid_r_proto=0
13788                 ;;
13789         esac
13790         ;;
13791 *)      getgrgid_r_proto=0
13792         ;;
13793 esac
13794
13795 : see if getgrnam_r exists
13796 set getgrnam_r d_getgrnam_r
13797 eval $inlibc
13798 case "$d_getgrnam_r" in
13799 "$define")
13800         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13801         case "$d_getgrnam_r_proto:$usethreads" in
13802         ":define")      d_getgrnam_r_proto=define
13803                 set d_getgrnam_r_proto getgrnam_r $hdrs
13804                 eval $hasproto ;;
13805         *)      ;;
13806         esac
13807         case "$d_getgrnam_r_proto" in
13808         define)
13809         case "$getgrnam_r_proto" in
13810         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13811         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13812         esac
13813         case "$getgrnam_r_proto" in
13814         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13815         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13816         esac
13817         case "$getgrnam_r_proto" in
13818         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13819         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13820         esac
13821         case "$getgrnam_r_proto" in
13822         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13823         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13824         esac
13825         case "$getgrnam_r_proto" in
13826         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13827         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13828         esac
13829         case "$getgrnam_r_proto" in
13830         ''|0)   d_getgrnam_r=undef
13831                 getgrnam_r_proto=0
13832                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13833         * )     case "$getgrnam_r_proto" in
13834                 REENTRANT_PROTO*) ;;
13835                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13836                 esac
13837                 echo "Prototype: $try" ;;
13838         esac
13839         ;;
13840         *)      case "$usethreads" in
13841                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13842                 esac
13843                 d_getgrnam_r=undef
13844                 getgrnam_r_proto=0
13845                 ;;
13846         esac
13847         ;;
13848 *)      getgrnam_r_proto=0
13849         ;;
13850 esac
13851
13852 : see if gethostbyaddr exists
13853 set gethostbyaddr d_gethbyaddr
13854 eval $inlibc
13855
13856 : see if gethostbyname exists
13857 set gethostbyname d_gethbyname
13858 eval $inlibc
13859
13860 : see if gethostent exists
13861 set gethostent d_gethent
13862 eval $inlibc
13863
13864 : see how we will look up host name
13865 echo " "
13866 call=''
13867 if set gethostname val -f d_gethname; eval $csym; $val; then
13868         echo 'gethostname() found.' >&4
13869         d_gethname="$define"
13870         call=gethostname
13871 fi
13872 if set uname val -f d_uname; eval $csym; $val; then
13873         if ./xenix; then
13874                 $cat <<'EOM'
13875 uname() was found, but you're running xenix, and older versions of xenix
13876 have a broken uname(). If you don't really know whether your xenix is old
13877 enough to have a broken system call, use the default answer.
13878
13879 EOM
13880                 dflt=y
13881                 case "$d_uname" in
13882                 "$define") dflt=n;;
13883                 esac
13884                 rp='Is your uname() broken?'
13885                 . ./myread
13886                 case "$ans" in
13887                 n*) d_uname="$define"; call=uname;;
13888                 esac
13889         else
13890                 echo 'uname() found.' >&4
13891                 d_uname="$define"
13892                 case "$call" in
13893                 '') call=uname ;;
13894                 esac
13895         fi
13896 fi
13897 case "$d_gethname" in
13898 '') d_gethname="$undef";;
13899 esac
13900 case "$d_uname" in
13901 '') d_uname="$undef";;
13902 esac
13903 case "$d_uname$d_gethname" in
13904 *define*)
13905         dflt=n
13906         cat <<EOM
13907
13908 Every now and then someone has a $call() that lies about the hostname
13909 but can't be fixed for political or economic reasons.  If you wish, I can
13910 pretend $call() isn't there and maybe compute hostname at run-time
13911 thanks to the '$phostname' command.
13912
13913 EOM
13914         rp="Shall I ignore $call() from now on?"
13915         . ./myread
13916         case "$ans" in
13917         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13918         esac;;
13919 esac
13920 case "$phostname" in
13921 '') aphostname='';;
13922 *) case "$aphostname" in
13923         /*) ;;
13924         *) set X $phostname
13925                 shift
13926                 file=$1
13927                 shift
13928                 file=`./loc $file $file $pth`
13929                 aphostname=`echo $file $*`
13930                 ;;
13931         esac
13932         ;;
13933 esac
13934 case "$d_uname$d_gethname" in
13935 *define*) ;;
13936 *)
13937         case "$phostname" in
13938         '')
13939                 echo "There will be no way for $package to get your hostname." >&4;;
13940         *)
13941         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13942                 ;;
13943         esac;;
13944 esac
13945 case "$d_phostname" in
13946 '') d_phostname="$undef";;
13947 esac
13948
13949 : see if gethostbyaddr_r exists
13950 set gethostbyaddr_r d_gethostbyaddr_r
13951 eval $inlibc
13952 case "$d_gethostbyaddr_r" in
13953 "$define")
13954         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13955         case "$d_gethostbyaddr_r_proto:$usethreads" in
13956         ":define")      d_gethostbyaddr_r_proto=define
13957                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13958                 eval $hasproto ;;
13959         *)      ;;
13960         esac
13961         case "$d_gethostbyaddr_r_proto" in
13962         define)
13963         case "$gethostbyaddr_r_proto" in
13964         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13965         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13966         esac
13967         case "$gethostbyaddr_r_proto" in
13968         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13969         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13970         esac
13971         case "$gethostbyaddr_r_proto" in
13972         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13973         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13974         esac
13975         case "$gethostbyaddr_r_proto" in
13976         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13977         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13978         esac
13979         case "$gethostbyaddr_r_proto" in
13980         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13981         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13982         esac
13983         case "$gethostbyaddr_r_proto" in
13984         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13985         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13986         esac
13987         case "$gethostbyaddr_r_proto" in
13988         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13989         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13990         esac
13991         case "$gethostbyaddr_r_proto" in
13992         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13993         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13994         esac
13995         case "$gethostbyaddr_r_proto" in
13996         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13997         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13998         esac
13999         case "$gethostbyaddr_r_proto" in
14000         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14001         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14002         esac
14003         case "$gethostbyaddr_r_proto" in
14004         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14005         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14006         esac
14007         case "$gethostbyaddr_r_proto" in
14008         ''|0)   d_gethostbyaddr_r=undef
14009                 gethostbyaddr_r_proto=0
14010                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14011         * )     case "$gethostbyaddr_r_proto" in
14012                 REENTRANT_PROTO*) ;;
14013                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14014                 esac
14015                 echo "Prototype: $try" ;;
14016         esac
14017         ;;
14018         *)      case "$usethreads" in
14019                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14020                 esac
14021                 d_gethostbyaddr_r=undef
14022                 gethostbyaddr_r_proto=0
14023                 ;;
14024         esac
14025         ;;
14026 *)      gethostbyaddr_r_proto=0
14027         ;;
14028 esac
14029
14030 : see if gethostbyname_r exists
14031 set gethostbyname_r d_gethostbyname_r
14032 eval $inlibc
14033 case "$d_gethostbyname_r" in
14034 "$define")
14035         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14036         case "$d_gethostbyname_r_proto:$usethreads" in
14037         ":define")      d_gethostbyname_r_proto=define
14038                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14039                 eval $hasproto ;;
14040         *)      ;;
14041         esac
14042         case "$d_gethostbyname_r_proto" in
14043         define)
14044         case "$gethostbyname_r_proto" in
14045         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14046         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14047         esac
14048         case "$gethostbyname_r_proto" in
14049         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14050         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14051         esac
14052         case "$gethostbyname_r_proto" in
14053         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14054         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14055         esac
14056         case "$gethostbyname_r_proto" in
14057         ''|0)   d_gethostbyname_r=undef
14058                 gethostbyname_r_proto=0
14059                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14060         * )     case "$gethostbyname_r_proto" in
14061                 REENTRANT_PROTO*) ;;
14062                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14063                 esac
14064                 echo "Prototype: $try" ;;
14065         esac
14066         ;;
14067         *)      case "$usethreads" in
14068                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14069                 esac
14070                 d_gethostbyname_r=undef
14071                 gethostbyname_r_proto=0
14072                 ;;
14073         esac
14074         ;;
14075 *)      gethostbyname_r_proto=0
14076         ;;
14077 esac
14078
14079 : see if gethostent_r exists
14080 set gethostent_r d_gethostent_r
14081 eval $inlibc
14082 case "$d_gethostent_r" in
14083 "$define")
14084         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14085         case "$d_gethostent_r_proto:$usethreads" in
14086         ":define")      d_gethostent_r_proto=define
14087                 set d_gethostent_r_proto gethostent_r $hdrs
14088                 eval $hasproto ;;
14089         *)      ;;
14090         esac
14091         case "$d_gethostent_r_proto" in
14092         define)
14093         case "$gethostent_r_proto" in
14094         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14095         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14096         esac
14097         case "$gethostent_r_proto" in
14098         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14099         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14100         esac
14101         case "$gethostent_r_proto" in
14102         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14103         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14104         esac
14105         case "$gethostent_r_proto" in
14106         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14107         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14108         esac
14109         case "$gethostent_r_proto" in
14110         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14111         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14112         esac
14113         case "$gethostent_r_proto" in
14114         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14115         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14116         esac
14117         case "$gethostent_r_proto" in
14118         ''|0)   d_gethostent_r=undef
14119                 gethostent_r_proto=0
14120                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14121         * )     case "$gethostent_r_proto" in
14122                 REENTRANT_PROTO*) ;;
14123                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14124                 esac
14125                 echo "Prototype: $try" ;;
14126         esac
14127         ;;
14128         *)      case "$usethreads" in
14129                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14130                 esac
14131                 d_gethostent_r=undef
14132                 gethostent_r_proto=0
14133                 ;;
14134         esac
14135         ;;
14136 *)      gethostent_r_proto=0
14137         ;;
14138 esac
14139
14140 : see if prototypes for various gethostxxx netdb.h functions are available
14141 echo " "
14142 set d_gethostprotos gethostent $i_netdb netdb.h
14143 eval $hasproto
14144
14145 : see if getitimer exists
14146 set getitimer d_getitimer
14147 eval $inlibc
14148
14149 : see if getlogin exists
14150 set getlogin d_getlogin
14151 eval $inlibc
14152
14153 : see if getlogin_r exists
14154 set getlogin_r d_getlogin_r
14155 eval $inlibc
14156 case "$d_getlogin_r" in
14157 "$define")
14158         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14159         case "$d_getlogin_r_proto:$usethreads" in
14160         ":define")      d_getlogin_r_proto=define
14161                 set d_getlogin_r_proto getlogin_r $hdrs
14162                 eval $hasproto ;;
14163         *)      ;;
14164         esac
14165         case "$d_getlogin_r_proto" in
14166         define)
14167         case "$getlogin_r_proto" in
14168         ''|0) try='int getlogin_r(char*, size_t);'
14169         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14170         esac
14171         case "$getlogin_r_proto" in
14172         ''|0) try='int getlogin_r(char*, int);'
14173         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14174         esac
14175         case "$getlogin_r_proto" in
14176         ''|0) try='char* getlogin_r(char*, size_t);'
14177         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14178         esac
14179         case "$getlogin_r_proto" in
14180         ''|0) try='char* getlogin_r(char*, int);'
14181         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14182         esac
14183         case "$getlogin_r_proto" in
14184         ''|0)   d_getlogin_r=undef
14185                 getlogin_r_proto=0
14186                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14187         * )     case "$getlogin_r_proto" in
14188                 REENTRANT_PROTO*) ;;
14189                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14190                 esac
14191                 echo "Prototype: $try" ;;
14192         esac
14193         ;;
14194         *)      case "$usethreads" in
14195                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14196                 esac
14197                 d_getlogin_r=undef
14198                 getlogin_r_proto=0
14199                 ;;
14200         esac
14201         ;;
14202 *)      getlogin_r_proto=0
14203         ;;
14204 esac
14205
14206 : see if getmnt exists
14207 set getmnt d_getmnt
14208 eval $inlibc
14209
14210 : see if getmntent exists
14211 set getmntent d_getmntent
14212 eval $inlibc
14213
14214 : see if getnameinfo exists
14215 set getnameinfo d_getnameinfo
14216 eval $inlibc
14217
14218 : see if getnetbyaddr exists
14219 set getnetbyaddr d_getnbyaddr
14220 eval $inlibc
14221
14222 : see if getnetbyname exists
14223 set getnetbyname d_getnbyname
14224 eval $inlibc
14225
14226 : see if getnetent exists
14227 set getnetent d_getnent
14228 eval $inlibc
14229
14230 : see if getnetbyaddr_r exists
14231 set getnetbyaddr_r d_getnetbyaddr_r
14232 eval $inlibc
14233 case "$d_getnetbyaddr_r" in
14234 "$define")
14235         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14236         case "$d_getnetbyaddr_r_proto:$usethreads" in
14237         ":define")      d_getnetbyaddr_r_proto=define
14238                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14239                 eval $hasproto ;;
14240         *)      ;;
14241         esac
14242         case "$d_getnetbyaddr_r_proto" in
14243         define)
14244         case "$getnetbyaddr_r_proto" in
14245         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14246         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14247         esac
14248         case "$getnetbyaddr_r_proto" in
14249         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14250         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14251         esac
14252         case "$getnetbyaddr_r_proto" in
14253         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14254         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14255         esac
14256         case "$getnetbyaddr_r_proto" in
14257         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14258         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14259         esac
14260         case "$getnetbyaddr_r_proto" in
14261         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14262         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14263         esac
14264         case "$getnetbyaddr_r_proto" in
14265         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14266         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14267         esac
14268         case "$getnetbyaddr_r_proto" in
14269         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14270         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14271         esac
14272         case "$getnetbyaddr_r_proto" in
14273         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14274         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14275         esac
14276         case "$getnetbyaddr_r_proto" in
14277         ''|0)   d_getnetbyaddr_r=undef
14278                 getnetbyaddr_r_proto=0
14279                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14280         * )     case "$getnetbyaddr_r_proto" in
14281                 REENTRANT_PROTO*) ;;
14282                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14283                 esac
14284                 echo "Prototype: $try" ;;
14285         esac
14286         ;;
14287         *)      case "$usethreads" in
14288                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14289                 esac
14290                 d_getnetbyaddr_r=undef
14291                 getnetbyaddr_r_proto=0
14292                 ;;
14293         esac
14294         ;;
14295 *)      getnetbyaddr_r_proto=0
14296         ;;
14297 esac
14298
14299 : see if getnetbyname_r exists
14300 set getnetbyname_r d_getnetbyname_r
14301 eval $inlibc
14302 case "$d_getnetbyname_r" in
14303 "$define")
14304         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14305         case "$d_getnetbyname_r_proto:$usethreads" in
14306         ":define")      d_getnetbyname_r_proto=define
14307                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14308                 eval $hasproto ;;
14309         *)      ;;
14310         esac
14311         case "$d_getnetbyname_r_proto" in
14312         define)
14313         case "$getnetbyname_r_proto" in
14314         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14315         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14316         esac
14317         case "$getnetbyname_r_proto" in
14318         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14319         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14320         esac
14321         case "$getnetbyname_r_proto" in
14322         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14323         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14324         esac
14325         case "$getnetbyname_r_proto" in
14326         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14327         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14328         esac
14329         case "$getnetbyname_r_proto" in
14330         ''|0)   d_getnetbyname_r=undef
14331                 getnetbyname_r_proto=0
14332                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14333         * )     case "$getnetbyname_r_proto" in
14334                 REENTRANT_PROTO*) ;;
14335                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14336                 esac
14337                 echo "Prototype: $try" ;;
14338         esac
14339         ;;
14340         *)      case "$usethreads" in
14341                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14342                 esac
14343                 d_getnetbyname_r=undef
14344                 getnetbyname_r_proto=0
14345                 ;;
14346         esac
14347         ;;
14348 *)      getnetbyname_r_proto=0
14349         ;;
14350 esac
14351
14352 : see if getnetent_r exists
14353 set getnetent_r d_getnetent_r
14354 eval $inlibc
14355 case "$d_getnetent_r" in
14356 "$define")
14357         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14358         case "$d_getnetent_r_proto:$usethreads" in
14359         ":define")      d_getnetent_r_proto=define
14360                 set d_getnetent_r_proto getnetent_r $hdrs
14361                 eval $hasproto ;;
14362         *)      ;;
14363         esac
14364         case "$d_getnetent_r_proto" in
14365         define)
14366         case "$getnetent_r_proto" in
14367         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14368         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14369         esac
14370         case "$getnetent_r_proto" in
14371         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14372         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14373         esac
14374         case "$getnetent_r_proto" in
14375         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14376         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14377         esac
14378         case "$getnetent_r_proto" in
14379         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14380         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14381         esac
14382         case "$getnetent_r_proto" in
14383         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14384         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14385         esac
14386         case "$getnetent_r_proto" in
14387         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14388         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14389         esac
14390         case "$getnetent_r_proto" in
14391         ''|0)   d_getnetent_r=undef
14392                 getnetent_r_proto=0
14393                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14394         * )     case "$getnetent_r_proto" in
14395                 REENTRANT_PROTO*) ;;
14396                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14397                 esac
14398                 echo "Prototype: $try" ;;
14399         esac
14400         ;;
14401         *)      case "$usethreads" in
14402                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14403                 esac
14404                 d_getnetent_r=undef
14405                 getnetent_r_proto=0
14406                 ;;
14407         esac
14408         ;;
14409 *)      getnetent_r_proto=0
14410         ;;
14411 esac
14412
14413 : see if prototypes for various getnetxxx netdb.h functions are available
14414 echo " "
14415 set d_getnetprotos getnetent $i_netdb netdb.h
14416 eval $hasproto
14417
14418 : see if getpagesize exists
14419 set getpagesize d_getpagsz
14420 eval $inlibc
14421
14422 : Optional checks for getprotobyname and getprotobynumber
14423
14424 : see if getprotobyname exists
14425 set getprotobyname d_getpbyname
14426 eval $inlibc
14427
14428 : see if getprotobynumber exists
14429 set getprotobynumber d_getpbynumber
14430 eval $inlibc
14431
14432 : see if getprotoent exists
14433 set getprotoent d_getpent
14434 eval $inlibc
14435
14436 : see if getpgid exists
14437 set getpgid d_getpgid
14438 eval $inlibc
14439
14440 : see if getpgrp2 exists
14441 set getpgrp2 d_getpgrp2
14442 eval $inlibc
14443
14444 : see if getppid exists
14445 set getppid d_getppid
14446 eval $inlibc
14447
14448 : see if getpriority exists
14449 set getpriority d_getprior
14450 eval $inlibc
14451
14452 : see if getprotobyname_r exists
14453 set getprotobyname_r d_getprotobyname_r
14454 eval $inlibc
14455 case "$d_getprotobyname_r" in
14456 "$define")
14457         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14458         case "$d_getprotobyname_r_proto:$usethreads" in
14459         ":define")      d_getprotobyname_r_proto=define
14460                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14461                 eval $hasproto ;;
14462         *)      ;;
14463         esac
14464         case "$d_getprotobyname_r_proto" in
14465         define)
14466         case "$getprotobyname_r_proto" in
14467         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14468         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14469         esac
14470         case "$getprotobyname_r_proto" in
14471         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14472         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14473         esac
14474         case "$getprotobyname_r_proto" in
14475         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14476         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14477         esac
14478         case "$getprotobyname_r_proto" in
14479         ''|0)   d_getprotobyname_r=undef
14480                 getprotobyname_r_proto=0
14481                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14482         * )     case "$getprotobyname_r_proto" in
14483                 REENTRANT_PROTO*) ;;
14484                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14485                 esac
14486                 echo "Prototype: $try" ;;
14487         esac
14488         ;;
14489         *)      case "$usethreads" in
14490                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14491                 esac
14492                 d_getprotobyname_r=undef
14493                 getprotobyname_r_proto=0
14494                 ;;
14495         esac
14496         ;;
14497 *)      getprotobyname_r_proto=0
14498         ;;
14499 esac
14500
14501 : see if getprotobynumber_r exists
14502 set getprotobynumber_r d_getprotobynumber_r
14503 eval $inlibc
14504 case "$d_getprotobynumber_r" in
14505 "$define")
14506         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14507         case "$d_getprotobynumber_r_proto:$usethreads" in
14508         ":define")      d_getprotobynumber_r_proto=define
14509                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14510                 eval $hasproto ;;
14511         *)      ;;
14512         esac
14513         case "$d_getprotobynumber_r_proto" in
14514         define)
14515         case "$getprotobynumber_r_proto" in
14516         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14517         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14518         esac
14519         case "$getprotobynumber_r_proto" in
14520         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14521         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14522         esac
14523         case "$getprotobynumber_r_proto" in
14524         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14525         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14526         esac
14527         case "$getprotobynumber_r_proto" in
14528         ''|0)   d_getprotobynumber_r=undef
14529                 getprotobynumber_r_proto=0
14530                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14531         * )     case "$getprotobynumber_r_proto" in
14532                 REENTRANT_PROTO*) ;;
14533                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14534                 esac
14535                 echo "Prototype: $try" ;;
14536         esac
14537         ;;
14538         *)      case "$usethreads" in
14539                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14540                 esac
14541                 d_getprotobynumber_r=undef
14542                 getprotobynumber_r_proto=0
14543                 ;;
14544         esac
14545         ;;
14546 *)      getprotobynumber_r_proto=0
14547         ;;
14548 esac
14549
14550 : see if getprotoent_r exists
14551 set getprotoent_r d_getprotoent_r
14552 eval $inlibc
14553 case "$d_getprotoent_r" in
14554 "$define")
14555         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14556         case "$d_getprotoent_r_proto:$usethreads" in
14557         ":define")      d_getprotoent_r_proto=define
14558                 set d_getprotoent_r_proto getprotoent_r $hdrs
14559                 eval $hasproto ;;
14560         *)      ;;
14561         esac
14562         case "$d_getprotoent_r_proto" in
14563         define)
14564         case "$getprotoent_r_proto" in
14565         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14566         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14567         esac
14568         case "$getprotoent_r_proto" in
14569         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14570         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14571         esac
14572         case "$getprotoent_r_proto" in
14573         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14574         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14575         esac
14576         case "$getprotoent_r_proto" in
14577         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14578         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14579         esac
14580         case "$getprotoent_r_proto" in
14581         ''|0)   d_getprotoent_r=undef
14582                 getprotoent_r_proto=0
14583                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14584         * )     case "$getprotoent_r_proto" in
14585                 REENTRANT_PROTO*) ;;
14586                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14587                 esac
14588                 echo "Prototype: $try" ;;
14589         esac
14590         ;;
14591         *)      case "$usethreads" in
14592                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14593                 esac
14594                 d_getprotoent_r=undef
14595                 getprotoent_r_proto=0
14596                 ;;
14597         esac
14598         ;;
14599 *)      getprotoent_r_proto=0
14600         ;;
14601 esac
14602
14603 : see if prototypes for various getprotoxxx netdb.h functions are available
14604 echo " "
14605 set d_getprotoprotos getprotoent $i_netdb netdb.h
14606 eval $hasproto
14607
14608 : see if getprpwnam exists
14609 set getprpwnam d_getprpwnam
14610 eval $inlibc
14611
14612 : see if getpwent exists
14613 set getpwent d_getpwent
14614 eval $inlibc
14615
14616 : see if getpwent_r exists
14617 set getpwent_r d_getpwent_r
14618 eval $inlibc
14619 case "$d_getpwent_r" in
14620 "$define")
14621         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14622         case "$d_getpwent_r_proto:$usethreads" in
14623         ":define")      d_getpwent_r_proto=define
14624                 set d_getpwent_r_proto getpwent_r $hdrs
14625                 eval $hasproto ;;
14626         *)      ;;
14627         esac
14628         case "$d_getpwent_r_proto" in
14629         define)
14630         case "$getpwent_r_proto" in
14631         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14632         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14633         esac
14634         case "$getpwent_r_proto" in
14635         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14636         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14637         esac
14638         case "$getpwent_r_proto" in
14639         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14640         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14641         esac
14642         case "$getpwent_r_proto" in
14643         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14644         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14645         esac
14646         case "$getpwent_r_proto" in
14647         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14648         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14649         esac
14650         case "$getpwent_r_proto" in
14651         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14652         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14653         esac
14654         case "$getpwent_r_proto" in
14655         ''|0)   d_getpwent_r=undef
14656                 getpwent_r_proto=0
14657                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14658         * )     case "$getpwent_r_proto" in
14659                 REENTRANT_PROTO*) ;;
14660                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14661                 esac
14662                 echo "Prototype: $try" ;;
14663         esac
14664         ;;
14665         *)      case "$usethreads" in
14666                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14667                 esac
14668                 d_getpwent_r=undef
14669                 getpwent_r_proto=0
14670                 ;;
14671         esac
14672         ;;
14673 *)      getpwent_r_proto=0
14674         ;;
14675 esac
14676
14677 : see if getpwnam_r exists
14678 set getpwnam_r d_getpwnam_r
14679 eval $inlibc
14680 case "$d_getpwnam_r" in
14681 "$define")
14682         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14683         case "$d_getpwnam_r_proto:$usethreads" in
14684         ":define")      d_getpwnam_r_proto=define
14685                 set d_getpwnam_r_proto getpwnam_r $hdrs
14686                 eval $hasproto ;;
14687         *)      ;;
14688         esac
14689         case "$d_getpwnam_r_proto" in
14690         define)
14691         case "$getpwnam_r_proto" in
14692         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14693         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14694         esac
14695         case "$getpwnam_r_proto" in
14696         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14697         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14698         esac
14699         case "$getpwnam_r_proto" in
14700         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14701         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14702         esac
14703         case "$getpwnam_r_proto" in
14704         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14705         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14706         esac
14707         case "$getpwnam_r_proto" in
14708         ''|0)   d_getpwnam_r=undef
14709                 getpwnam_r_proto=0
14710                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14711         * )     case "$getpwnam_r_proto" in
14712                 REENTRANT_PROTO*) ;;
14713                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14714                 esac
14715                 echo "Prototype: $try" ;;
14716         esac
14717         ;;
14718         *)      case "$usethreads" in
14719                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14720                 esac
14721                 d_getpwnam_r=undef
14722                 getpwnam_r_proto=0
14723                 ;;
14724         esac
14725         ;;
14726 *)      getpwnam_r_proto=0
14727         ;;
14728 esac
14729
14730 : see if getpwuid_r exists
14731 set getpwuid_r d_getpwuid_r
14732 eval $inlibc
14733 case "$d_getpwuid_r" in
14734 "$define")
14735         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14736         case "$d_getpwuid_r_proto:$usethreads" in
14737         ":define")      d_getpwuid_r_proto=define
14738                 set d_getpwuid_r_proto getpwuid_r $hdrs
14739                 eval $hasproto ;;
14740         *)      ;;
14741         esac
14742         case "$d_getpwuid_r_proto" in
14743         define)
14744         case "$getpwuid_r_proto" in
14745         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14746         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14747         esac
14748         case "$getpwuid_r_proto" in
14749         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14750         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14751         esac
14752         case "$getpwuid_r_proto" in
14753         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14754         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14755         esac
14756         case "$getpwuid_r_proto" in
14757         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14758         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14759         esac
14760         case "$getpwuid_r_proto" in
14761         ''|0)   d_getpwuid_r=undef
14762                 getpwuid_r_proto=0
14763                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14764         * )     case "$getpwuid_r_proto" in
14765                 REENTRANT_PROTO*) ;;
14766                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14767                 esac
14768                 echo "Prototype: $try" ;;
14769         esac
14770         ;;
14771         *)      case "$usethreads" in
14772                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14773                 esac
14774                 d_getpwuid_r=undef
14775                 getpwuid_r_proto=0
14776                 ;;
14777         esac
14778         ;;
14779 *)      getpwuid_r_proto=0
14780         ;;
14781 esac
14782
14783 : Optional checks for getsbyname and getsbyport
14784
14785 : see if getservbyname exists
14786 set getservbyname d_getsbyname
14787 eval $inlibc
14788
14789 : see if getservbyport exists
14790 set getservbyport d_getsbyport
14791 eval $inlibc
14792
14793 : see if getservent exists
14794 set getservent d_getsent
14795 eval $inlibc
14796
14797 : see if getservbyname_r exists
14798 set getservbyname_r d_getservbyname_r
14799 eval $inlibc
14800 case "$d_getservbyname_r" in
14801 "$define")
14802         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14803         case "$d_getservbyname_r_proto:$usethreads" in
14804         ":define")      d_getservbyname_r_proto=define
14805                 set d_getservbyname_r_proto getservbyname_r $hdrs
14806                 eval $hasproto ;;
14807         *)      ;;
14808         esac
14809         case "$d_getservbyname_r_proto" in
14810         define)
14811         case "$getservbyname_r_proto" in
14812         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14813         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14814         esac
14815         case "$getservbyname_r_proto" in
14816         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14817         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14818         esac
14819         case "$getservbyname_r_proto" in
14820         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14821         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14822         esac
14823         case "$getservbyname_r_proto" in
14824         ''|0)   d_getservbyname_r=undef
14825                 getservbyname_r_proto=0
14826                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14827         * )     case "$getservbyname_r_proto" in
14828                 REENTRANT_PROTO*) ;;
14829                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14830                 esac
14831                 echo "Prototype: $try" ;;
14832         esac
14833         ;;
14834         *)      case "$usethreads" in
14835                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14836                 esac
14837                 d_getservbyname_r=undef
14838                 getservbyname_r_proto=0
14839                 ;;
14840         esac
14841         ;;
14842 *)      getservbyname_r_proto=0
14843         ;;
14844 esac
14845
14846 : see if getservbyport_r exists
14847 set getservbyport_r d_getservbyport_r
14848 eval $inlibc
14849 case "$d_getservbyport_r" in
14850 "$define")
14851         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14852         case "$d_getservbyport_r_proto:$usethreads" in
14853         ":define")      d_getservbyport_r_proto=define
14854                 set d_getservbyport_r_proto getservbyport_r $hdrs
14855                 eval $hasproto ;;
14856         *)      ;;
14857         esac
14858         case "$d_getservbyport_r_proto" in
14859         define)
14860         case "$getservbyport_r_proto" in
14861         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14862         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14863         esac
14864         case "$getservbyport_r_proto" in
14865         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14866         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14867         esac
14868         case "$getservbyport_r_proto" in
14869         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14870         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14871         esac
14872         case "$getservbyport_r_proto" in
14873         ''|0)   d_getservbyport_r=undef
14874                 getservbyport_r_proto=0
14875                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14876         * )     case "$getservbyport_r_proto" in
14877                 REENTRANT_PROTO*) ;;
14878                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14879                 esac
14880                 echo "Prototype: $try" ;;
14881         esac
14882         ;;
14883         *)      case "$usethreads" in
14884                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14885                 esac
14886                 d_getservbyport_r=undef
14887                 getservbyport_r_proto=0
14888                 ;;
14889         esac
14890         ;;
14891 *)      getservbyport_r_proto=0
14892         ;;
14893 esac
14894
14895 : see if getservent_r exists
14896 set getservent_r d_getservent_r
14897 eval $inlibc
14898 case "$d_getservent_r" in
14899 "$define")
14900         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14901         case "$d_getservent_r_proto:$usethreads" in
14902         ":define")      d_getservent_r_proto=define
14903                 set d_getservent_r_proto getservent_r $hdrs
14904                 eval $hasproto ;;
14905         *)      ;;
14906         esac
14907         case "$d_getservent_r_proto" in
14908         define)
14909         case "$getservent_r_proto" in
14910         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14911         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14912         esac
14913         case "$getservent_r_proto" in
14914         ''|0) try='int getservent_r(struct servent*, char*, int);'
14915         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14916         esac
14917         case "$getservent_r_proto" in
14918         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14919         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14920         esac
14921         case "$getservent_r_proto" in
14922         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14923         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14924         esac
14925         case "$getservent_r_proto" in
14926         ''|0)   d_getservent_r=undef
14927                 getservent_r_proto=0
14928                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14929         * )     case "$getservent_r_proto" in
14930                 REENTRANT_PROTO*) ;;
14931                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14932                 esac
14933                 echo "Prototype: $try" ;;
14934         esac
14935         ;;
14936         *)      case "$usethreads" in
14937                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14938                 esac
14939                 d_getservent_r=undef
14940                 getservent_r_proto=0
14941                 ;;
14942         esac
14943         ;;
14944 *)      getservent_r_proto=0
14945         ;;
14946 esac
14947
14948 : see if prototypes for various getservxxx netdb.h functions are available
14949 echo " "
14950 set d_getservprotos getservent $i_netdb netdb.h
14951 eval $hasproto
14952
14953 : see if getspnam exists
14954 set getspnam d_getspnam
14955 eval $inlibc
14956
14957 : see if this is a shadow.h system
14958 set shadow.h i_shadow
14959 eval $inhdr
14960
14961 : see if getspnam_r exists
14962 set getspnam_r d_getspnam_r
14963 eval $inlibc
14964 case "$d_getspnam_r" in
14965 "$define")
14966         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14967         case "$d_getspnam_r_proto:$usethreads" in
14968         ":define")      d_getspnam_r_proto=define
14969                 set d_getspnam_r_proto getspnam_r $hdrs
14970                 eval $hasproto ;;
14971         *)      ;;
14972         esac
14973         case "$d_getspnam_r_proto" in
14974         define)
14975         case "$getspnam_r_proto" in
14976         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14977         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14978         esac
14979         case "$getspnam_r_proto" in
14980         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14981         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14982         esac
14983         case "$getspnam_r_proto" in
14984         ''|0)   d_getspnam_r=undef
14985                 getspnam_r_proto=0
14986                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14987         * )     case "$getspnam_r_proto" in
14988                 REENTRANT_PROTO*) ;;
14989                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14990                 esac
14991                 echo "Prototype: $try" ;;
14992         esac
14993         ;;
14994         *)      case "$usethreads" in
14995                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14996                 esac
14997                 d_getspnam_r=undef
14998                 getspnam_r_proto=0
14999                 ;;
15000         esac
15001         ;;
15002 *)      getspnam_r_proto=0
15003         ;;
15004 esac
15005
15006 : see if gettimeofday or ftime exists
15007 set gettimeofday d_gettimeod
15008 eval $inlibc
15009 case "$d_gettimeod" in
15010 "$undef")
15011         set ftime d_ftime 
15012         eval $inlibc
15013         ;;
15014 *)
15015         val="$undef"; set d_ftime; eval $setvar
15016         ;;
15017 esac
15018 case "$d_gettimeod$d_ftime" in
15019 "$undef$undef")
15020         echo " "
15021         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15022         ;;
15023 esac
15024
15025 : see if gmtime_r exists
15026 set gmtime_r d_gmtime_r
15027 eval $inlibc
15028 case "$d_gmtime_r" in
15029 "$define")
15030         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15031         case "$d_gmtime_r_proto:$usethreads" in
15032         ":define")      d_gmtime_r_proto=define
15033                 set d_gmtime_r_proto gmtime_r $hdrs
15034                 eval $hasproto ;;
15035         *)      ;;
15036         esac
15037         case "$d_gmtime_r_proto" in
15038         define)
15039         case "$gmtime_r_proto" in
15040         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15041         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15042         esac
15043         case "$gmtime_r_proto" in
15044         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15045         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15046         esac
15047         case "$gmtime_r_proto" in
15048         ''|0)   d_gmtime_r=undef
15049                 gmtime_r_proto=0
15050                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15051         * )     case "$gmtime_r_proto" in
15052                 REENTRANT_PROTO*) ;;
15053                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15054                 esac
15055                 echo "Prototype: $try" ;;
15056         esac
15057         ;;
15058         *)      case "$usethreads" in
15059                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15060                 esac
15061                 d_gmtime_r=undef
15062                 gmtime_r_proto=0
15063                 ;;
15064         esac
15065         ;;
15066 *)      gmtime_r_proto=0
15067         ;;
15068 esac
15069
15070 : see if hasmntopt exists
15071 set hasmntopt d_hasmntopt
15072 eval $inlibc
15073
15074 : see if this is a netinet/in.h or sys/in.h system
15075 set netinet/in.h i_niin sys/in.h i_sysin
15076 eval $inhdr
15077
15078 : see if arpa/inet.h has to be included
15079 set arpa/inet.h i_arpainet
15080 eval $inhdr
15081
15082 : see if htonl --and friends-- exists
15083 val=''
15084 set htonl val
15085 eval $inlibc
15086
15087 : Maybe they are macros.
15088 case "$val" in
15089 $undef)
15090         $cat >htonl.c <<EOM
15091 #include <stdio.h>
15092 #include <sys/types.h>
15093 #$i_niin I_NETINET_IN
15094 #$i_sysin I_SYS_IN
15095 #$i_arpainet I_ARPA_INET
15096 #ifdef I_NETINET_IN
15097 #include <netinet/in.h>
15098 #endif
15099 #ifdef I_SYS_IN
15100 #include <sys/in.h>
15101 #endif
15102 #ifdef I_ARPA_INET
15103 #include <arpa/inet.h>
15104 #endif
15105 #ifdef htonl
15106 printf("Defined as a macro.");
15107 #endif
15108 EOM
15109         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15110         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15111                 val="$define"
15112                 echo "But it seems to be defined as a macro." >&4
15113         fi
15114         $rm -f htonl.?
15115         ;;
15116 esac
15117 set d_htonl
15118 eval $setvar
15119
15120 : see if ilogbl exists
15121 set ilogbl d_ilogbl
15122 eval $inlibc
15123
15124 : index or strchr
15125 echo " "
15126 if set index val -f; eval $csym; $val; then
15127         if set strchr val -f d_strchr; eval $csym; $val; then
15128                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15129                         val="$define"
15130                         vali="$undef"
15131                         echo "strchr() found." >&4
15132                 else
15133                         val="$undef"
15134                         vali="$define"
15135                         echo "index() found." >&4
15136                 fi
15137         else
15138                 val="$undef"
15139                 vali="$define"
15140                 echo "index() found." >&4
15141         fi
15142 else
15143         if set strchr val -f d_strchr; eval $csym; $val; then
15144                 val="$define"
15145                 vali="$undef"
15146                 echo "strchr() found." >&4
15147         else
15148                 echo "No index() or strchr() found!" >&4
15149                 val="$undef"
15150                 vali="$undef"
15151         fi
15152 fi
15153 set d_strchr; eval $setvar
15154 val="$vali"
15155 set d_index; eval $setvar
15156
15157 : check whether inet_aton exists
15158 set inet_aton d_inetaton
15159 eval $inlibc
15160
15161 : see if inet_ntop exists
15162 set inet_ntop d_inetntop
15163 eval $inlibc
15164
15165 : see if inet_pton exists
15166 set inet_pton d_inetpton
15167 eval $inlibc
15168
15169 : Look for isascii
15170 echo " "
15171 $cat >isascii.c <<EOCP
15172 #include <stdio.h>
15173 #include <ctype.h>
15174 #$i_stdlib I_STDLIB
15175 #ifdef I_STDLIB
15176 #include <stdlib.h>
15177 #endif
15178 int main() {
15179         int c = 'A';
15180         if (isascii(c))
15181                 exit(0);
15182         else
15183                 exit(1);
15184 }
15185 EOCP
15186 set isascii
15187 if eval $compile; then
15188         echo "isascii() found." >&4
15189         val="$define"
15190 else
15191         echo "isascii() NOT found." >&4
15192         val="$undef"
15193 fi
15194 set d_isascii
15195 eval $setvar
15196 $rm -f isascii*
15197
15198 : Look for isblank
15199 echo " "
15200 $cat >isblank.c <<'EOCP'
15201 #include <stdio.h>
15202 #include <ctype.h>
15203 int main() {
15204         int c = ' ';
15205         if (isblank(c))
15206                 return 0 ;
15207         else
15208                 return 1 ;
15209 }
15210 EOCP
15211 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15212         echo "isblank() found." >&4
15213         val="$define"
15214 else
15215         echo "isblank() NOT found." >&4
15216         val="$undef"
15217 fi
15218 set d_isblank
15219 eval $setvar
15220 $rm -f isblank*
15221
15222 : see if isfinite exists
15223 set isfinite d_isfinite
15224 eval $inlibc
15225
15226 : see if isinf exists
15227 set isinf d_isinf
15228 eval $inlibc
15229
15230 : see if isnan exists
15231 set isnan d_isnan
15232 eval $inlibc
15233
15234 : see if isnanl exists
15235 set isnanl d_isnanl
15236 eval $inlibc
15237
15238 : see if killpg exists
15239 set killpg d_killpg
15240 eval $inlibc
15241
15242 : see if lchown exists
15243 echo " "
15244 $cat > try.c <<'EOCP'
15245 /* System header to define __stub macros and hopefully few prototypes,
15246     which can conflict with char lchown(); below.  */
15247 #include <assert.h>
15248 /* Override any gcc2 internal prototype to avoid an error.  */
15249 /* We use char because int might match the return type of a gcc2
15250    builtin and then its argument prototype would still apply.  */
15251 char lchown();
15252 int main() {
15253     /*  The GNU C library defines this for functions which it implements
15254         to always fail with ENOSYS.  Some functions are actually named
15255         something starting with __ and the normal name is an alias.  */
15256 #if defined (__stub_lchown) || defined (__stub___lchown)
15257 choke me
15258 #else
15259 lchown();
15260 #endif
15261 ; return 0; }
15262 EOCP
15263 set try
15264 if eval $compile; then
15265     $echo "lchown() found." >&4
15266     val="$define"
15267 else
15268     $echo "lchown() NOT found." >&4
15269     val="$undef"
15270 fi
15271 set d_lchown
15272 eval $setvar
15273
15274 : See if number of significant digits in a double precision number is known
15275 echo " "
15276 $cat >ldbl_dig.c <<EOM
15277 #$i_limits I_LIMITS
15278 #$i_float I_FLOAT
15279 #ifdef I_LIMITS
15280 #include <limits.h>
15281 #endif
15282 #ifdef I_FLOAT
15283 #include <float.h>
15284 #endif
15285 #ifdef LDBL_DIG
15286 printf("Contains LDBL_DIG");
15287 #endif
15288 EOM
15289 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15290 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15291         echo "LDBL_DIG found." >&4
15292         val="$define"
15293 else
15294         echo "LDBL_DIG NOT found." >&4
15295         val="$undef"
15296 fi
15297 $rm -f ldbl_dig.?
15298 set d_ldbl_dig
15299 eval $setvar
15300
15301 : see if this is a math.h system
15302 set math.h i_math
15303 eval $inhdr
15304
15305 : check to see if math.h defines _LIB_VERSION
15306 d_libm_lib_version="$undef"
15307 case $i_math in
15308     $define)
15309         echo " "
15310         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15311         $cat >try.c <<EOCP
15312 #include <unistd.h>
15313 #include <math.h>
15314 int main (int argc, char *argv[])
15315 {
15316     printf ("%d\n", _LIB_VERSION);
15317     return (0);
15318     } /* main */
15319 EOCP
15320         set try
15321         if eval $compile; then
15322             foo=`$run ./try`
15323             echo "Yes, it does ($foo)" >&4
15324             d_libm_lib_version="$define"
15325         else
15326             echo "No, it does not (probably harmless)" >&4
15327             fi
15328         $rm_try
15329         ;;
15330
15331     esac
15332
15333 : see if link exists
15334 set link d_link
15335 eval $inlibc
15336
15337 : see if localtime_r exists
15338 set localtime_r d_localtime_r
15339 eval $inlibc
15340 case "$d_localtime_r" in
15341 "$define")
15342         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15343         case "$d_localtime_r_proto:$usethreads" in
15344         ":define")      d_localtime_r_proto=define
15345                 set d_localtime_r_proto localtime_r $hdrs
15346                 eval $hasproto ;;
15347         *)      ;;
15348         esac
15349         case "$d_localtime_r_proto" in
15350         define)
15351         case "$localtime_r_proto" in
15352         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15353         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15354         esac
15355         case "$localtime_r_proto" in
15356         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15357         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15358         esac
15359         case "$localtime_r_proto" in
15360         ''|0)   d_localtime_r=undef
15361                 localtime_r_proto=0
15362                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15363         * )     case "$localtime_r_proto" in
15364                 REENTRANT_PROTO*) ;;
15365                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15366                 esac
15367                 echo "Prototype: $try" ;;
15368         esac
15369         ;;
15370         *)      case "$usethreads" in
15371                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15372                 esac
15373                 d_localtime_r=undef
15374                 localtime_r_proto=0
15375                 ;;
15376         esac
15377         ;;
15378 *)      localtime_r_proto=0
15379         ;;
15380 esac
15381
15382 : see if localtime_r calls tzset
15383 case "$localtime_r_proto" in
15384 REENTRANT_PROTO*)
15385         $cat >try.c <<EOCP
15386 /*  Does our libc's localtime_r call tzset ?
15387  *  return 0 if so, 1 otherwise.
15388  */
15389 #$i_systypes    I_SYS_TYPES
15390 #$i_unistd      I_UNISTD
15391 #$i_time        I_TIME
15392 #$i_stdlib      I_STDLIB
15393 #$i_string      I_STRING
15394 #$i_malloc      I_MALLOC
15395 #ifdef I_SYS_TYPES
15396 #  include <sys/types.h>
15397 #endif
15398 #ifdef I_UNISTD
15399 #  include <unistd.h>
15400 #endif
15401 #ifdef I_TIME
15402 #  include <time.h>
15403 #endif
15404 #ifdef I_STDLIB
15405 #include <stdlib.h>
15406 #endif
15407 #ifdef I_STRING
15408 #  include <string.h>
15409 #else
15410 #  include <strings.h>
15411 #endif
15412 #ifdef I_MALLOC
15413 #  include <malloc.h>
15414 #endif
15415 int main()
15416 {
15417     time_t t = time(0L);
15418     char w_tz[]="TZ" "=GMT+5",
15419          e_tz[]="TZ" "=GMT-5",
15420         *tz_e = (char*)malloc(16),
15421         *tz_w = (char*)malloc(16);
15422     struct tm tm_e, tm_w;
15423     memset(&tm_e,'\0',sizeof(struct tm));
15424     memset(&tm_w,'\0',sizeof(struct tm));
15425     strcpy(tz_e,e_tz);
15426     strcpy(tz_w,w_tz);
15427
15428     putenv(tz_e);
15429     localtime_r(&t, &tm_e);
15430
15431     putenv(tz_w);
15432     localtime_r(&t, &tm_w);
15433
15434     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15435         return 1;
15436     return 0;
15437 }
15438 EOCP
15439         set try
15440         if eval $compile; then
15441             if $run ./try; then
15442                 d_localtime_r_needs_tzset=undef;
15443             else
15444                 d_localtime_r_needs_tzset=define;
15445             fi;
15446         else
15447             d_localtime_r_needs_tzset=undef;
15448         fi;
15449      ;;
15450   *)
15451      d_localtime_r_needs_tzset=undef;
15452      ;;
15453 esac
15454 $rm_try
15455
15456 : see if localeconv exists
15457 set localeconv d_locconv
15458 eval $inlibc
15459
15460 : see if lockf exists
15461 set lockf d_lockf
15462 eval $inlibc
15463
15464 : see if prototype for lseek is available
15465 echo " "
15466 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15467 eval $hasproto
15468
15469 : see if lstat exists
15470 set lstat d_lstat
15471 eval $inlibc
15472
15473 : see if madvise exists
15474 set madvise d_madvise
15475 eval $inlibc
15476
15477 : see if malloc_size exists
15478 set malloc_size d_malloc_size
15479 eval $inlibc
15480
15481 : see if malloc_size_good exists
15482 set malloc_good_size d_malloc_good_size
15483 eval $inlibc
15484
15485 : see if mblen exists
15486 set mblen d_mblen
15487 eval $inlibc
15488
15489 : see if mbstowcs exists
15490 set mbstowcs d_mbstowcs
15491 eval $inlibc
15492
15493 : see if mbtowc exists
15494 set mbtowc d_mbtowc
15495 eval $inlibc
15496
15497 : see if memchr exists
15498 set memchr d_memchr
15499 eval $inlibc
15500
15501 : see if memcmp exists
15502 set memcmp d_memcmp
15503 eval $inlibc
15504
15505 : see if memcpy exists
15506 set memcpy d_memcpy
15507 eval $inlibc
15508
15509 : see if memmove exists
15510 set memmove d_memmove
15511 eval $inlibc
15512
15513 : see if memset exists
15514 set memset d_memset
15515 eval $inlibc
15516
15517 : see if mkdir exists
15518 set mkdir d_mkdir
15519 eval $inlibc
15520
15521 : see if mkdtemp exists
15522 set mkdtemp d_mkdtemp
15523 eval $inlibc
15524
15525 : see if mkfifo exists
15526 set mkfifo d_mkfifo
15527 eval $inlibc
15528
15529 : see if mkstemp exists
15530 set mkstemp d_mkstemp
15531 eval $inlibc
15532
15533 : see if mkstemps exists
15534 set mkstemps d_mkstemps
15535 eval $inlibc
15536
15537 : see if mktime exists
15538 set mktime d_mktime
15539 eval $inlibc
15540
15541 : see if this is a sys/mman.h system
15542 set sys/mman.h i_sysmman
15543 eval $inhdr
15544
15545 : see if mmap exists
15546 set mmap d_mmap
15547 eval $inlibc
15548 : see what shmat returns
15549 : default to something harmless
15550 mmaptype='void *'
15551 case "$i_sysmman$d_mmap" in
15552 "$define$define")
15553         $cat >mmap.c <<'END'
15554 #include <sys/mman.h>
15555 void *mmap();
15556 END
15557         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15558                 mmaptype='void *'
15559         else
15560                 mmaptype='caddr_t'
15561         fi
15562         echo "and it returns ($mmaptype)." >&4
15563         ;;
15564 esac
15565
15566
15567
15568 : see if sqrtl exists
15569 set sqrtl d_sqrtl
15570 eval $inlibc
15571
15572 : see if scalbnl exists
15573 set scalbnl d_scalbnl
15574 eval $inlibc
15575
15576 : see if modfl exists
15577 set modfl d_modfl
15578 eval $inlibc
15579
15580 : see if prototype for modfl is available
15581 echo " "
15582 set d_modflproto modfl $i_math math.h
15583 eval $hasproto
15584
15585 d_modfl_pow32_bug="$undef"
15586
15587 case "$d_longdbl$d_modfl" in
15588 $define$define)
15589         $cat <<EOM
15590 Checking to see whether your modfl() is okay for large values...
15591 EOM
15592 $cat >try.c <<EOCP
15593 #include <math.h>
15594 #include <stdio.h>
15595 EOCP
15596 if $test "X$d_modflproto" != "X$define"; then
15597         $cat >>try.c <<EOCP
15598 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15599 long double modfl (long double, long double *);
15600 EOCP
15601 fi
15602 $cat >>try.c <<EOCP
15603 int main() {
15604     long double nv = 4294967303.15;
15605     long double v, w;
15606     v = modfl(nv, &w);
15607 #ifdef __GLIBC__
15608     printf("glibc");
15609 #endif
15610     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15611     return 0;
15612 }
15613 EOCP
15614         case "$osname:$gccversion" in
15615         aix:)   saveccflags="$ccflags"
15616                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15617         esac
15618         set try
15619         if eval $compile; then
15620                 foo=`$run ./try`
15621                 case "$foo" in
15622                 *" 4294967303.150000 1.150000 4294967302.000000")
15623                         echo >&4 "Your modfl() is broken for large values."
15624                         d_modfl_pow32_bug="$define"
15625                         case "$foo" in
15626                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15627                         ;;
15628                         esac
15629                         ;;
15630                 *" 4294967303.150000 0.150000 4294967303.000000")
15631                         echo >&4 "Your modfl() seems okay for large values."
15632                         ;;
15633                 *)      echo >&4 "I don't understand your modfl() at all."
15634                         d_modfl="$undef"
15635                         ;;
15636                 esac
15637                 $rm_try
15638         else
15639                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15640                 d_modfl="$undef"
15641         fi
15642         case "$osname:$gccversion" in
15643         aix:)   ccflags="$saveccflags" ;; # restore
15644         esac
15645         ;;
15646 esac
15647
15648 if $test "$uselongdouble" = "$define"; then
15649     message=""
15650     if $test "$d_sqrtl" != "$define"; then
15651         message="$message sqrtl"
15652     fi
15653     if $test "$d_modfl" != "$define"; then
15654         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15655             echo "You have both aintl and copysignl, so I can emulate modfl."
15656         else
15657             message="$message modfl"
15658         fi
15659     fi
15660     if $test "$d_frexpl" != "$define"; then
15661         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15662             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15663         else
15664             message="$message frexpl"
15665         fi
15666     fi
15667
15668     if $test "$message" != ""; then
15669         $cat <<EOM >&4
15670
15671 *** You requested the use of long doubles but you do not seem to have
15672 *** the following mathematical functions needed for long double support:
15673 ***    $message
15674 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15675 *** Cannot continue, aborting.
15676
15677 EOM
15678
15679         exit 1
15680     fi
15681 fi
15682
15683 : see if mprotect exists
15684 set mprotect d_mprotect
15685 eval $inlibc
15686
15687 : see if msgctl exists
15688 set msgctl d_msgctl
15689 eval $inlibc
15690
15691 : see if msgget exists
15692 set msgget d_msgget
15693 eval $inlibc
15694
15695 : see if msgsnd exists
15696 set msgsnd d_msgsnd
15697 eval $inlibc
15698
15699 : see if msgrcv exists
15700 set msgrcv d_msgrcv
15701 eval $inlibc
15702
15703 : see how much of the 'msg*(2)' library is present.
15704 h_msg=true
15705 echo " "
15706 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15707 *"$undef"*) h_msg=false;;
15708 esac
15709 case "$osname" in
15710 freebsd)
15711     case "`ipcs 2>&1`" in
15712     "SVID messages"*"not configured"*)
15713         echo "Your $osname does not have the msg*(2) configured." >&4
15714         h_msg=false
15715         val="$undef"
15716         set msgctl d_msgctl
15717         eval $setvar
15718         set msgget d_msgget
15719         eval $setvar
15720         set msgsnd d_msgsnd
15721         eval $setvar
15722         set msgrcv d_msgrcv
15723         eval $setvar
15724         ;;
15725     esac
15726     ;;
15727 esac
15728 : we could also check for sys/ipc.h ...
15729 if $h_msg && $test `./findhdr sys/msg.h`; then
15730         echo "You have the full msg*(2) library." >&4
15731         val="$define"
15732 else
15733         echo "You don't have the full msg*(2) library." >&4
15734         val="$undef"
15735 fi
15736 set d_msg
15737 eval $setvar
15738
15739 : Check for msghdr_s
15740 echo " "
15741 echo "Checking to see if your system supports struct msghdr..." >&4
15742 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15743 eval $hasstruct
15744 case "$d_msghdr_s" in
15745 "$define")      echo "Yes, it does."   ;;
15746 *)              echo "No, it doesn't." ;;
15747 esac
15748
15749
15750 : see if msync exists
15751 set msync d_msync
15752 eval $inlibc
15753
15754 : see if munmap exists
15755 set munmap d_munmap
15756 eval $inlibc
15757
15758 : see if nice exists
15759 set nice d_nice
15760 eval $inlibc
15761
15762 : see if this is a langinfo.h system
15763 set langinfo.h i_langinfo
15764 eval $inhdr
15765
15766 : see if nl_langinfo exists
15767 set nl_langinfo d_nl_langinfo
15768 eval $inlibc
15769
15770 : check for volatile keyword
15771 echo " "
15772 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15773 $cat >try.c <<'EOCP'
15774 int main()
15775 {
15776         typedef struct _goo_struct goo_struct;
15777         goo_struct * volatile goo = ((goo_struct *)0);
15778         struct _goo_struct {
15779                 long long_int;
15780                 int reg_int;
15781                 char char_var;
15782         };
15783         typedef unsigned short foo_t;
15784         char *volatile foo;
15785         volatile int bar;
15786         volatile foo_t blech;
15787         foo = foo;
15788 }
15789 EOCP
15790 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15791         val="$define"
15792         echo "Yup, it does."
15793 else
15794         val="$undef"
15795         echo "Nope, it doesn't."
15796 fi
15797 set d_volatile
15798 eval $setvar
15799 $rm_try
15800
15801 : Check basic sizes
15802 echo " "
15803 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15804
15805 case "$use64bitint:$d_quad:$quadtype" in
15806 define:define:?*)
15807         ivtype="$quadtype"
15808         uvtype="$uquadtype"
15809         ivsize=8
15810         uvsize=8
15811         ;;
15812 *)      ivtype="long"
15813         uvtype="unsigned long"
15814         ivsize=$longsize
15815         uvsize=$longsize
15816         ;;
15817 esac
15818
15819 case "$uselongdouble:$d_longdbl" in
15820 define:define)
15821         nvtype="long double"
15822         nvsize=$longdblsize
15823         ;;
15824 *)      nvtype=double
15825         nvsize=$doublesize
15826         ;;
15827 esac
15828
15829 $echo "(IV will be "$ivtype", $ivsize bytes)"
15830 $echo "(UV will be "$uvtype", $uvsize bytes)"
15831 $echo "(NV will be "$nvtype", $nvsize bytes)"
15832
15833 $cat >try.c <<EOCP
15834 #$i_inttypes I_INTTYPES
15835 #ifdef I_INTTYPES
15836 #include <inttypes.h>
15837 #endif
15838 #include <stdio.h>
15839 int main() {
15840 #ifdef INT8
15841    int8_t i =  INT8_MAX;
15842   uint8_t u = UINT8_MAX;
15843   printf("int8_t\n");
15844 #endif
15845 #ifdef INT16
15846    int16_t i =  INT16_MAX;
15847   uint16_t u = UINT16_MAX;
15848   printf("int16_t\n");
15849 #endif
15850 #ifdef INT32
15851    int32_t i =  INT32_MAX;
15852   uint32_t u = UINT32_MAX;
15853   printf("int32_t\n");
15854 #endif
15855 }
15856 EOCP
15857
15858 i8type="signed char"
15859 u8type="unsigned char"
15860 i8size=1
15861 u8size=1
15862
15863 case "$i16type" in
15864 '')     case "$shortsize" in
15865         2)      i16type=short
15866                 u16type="unsigned short"
15867                 i16size=$shortsize
15868                 u16size=$shortsize
15869                 ;;
15870         esac
15871         ;;
15872 esac
15873 case "$i16type" in
15874 '')     set try -DINT16
15875         if eval $compile; then
15876                 case "`$run ./try`" in
15877                 int16_t)
15878                         i16type=int16_t
15879                         u16type=uint16_t
15880                         i16size=2
15881                         u16size=2
15882                         ;;
15883                 esac
15884         fi
15885         ;;
15886 esac
15887 case "$i16type" in
15888 '')     if $test $shortsize -ge 2; then
15889                 i16type=short
15890                 u16type="unsigned short"
15891                 i16size=$shortsize
15892                 u16size=$shortsize
15893         fi
15894         ;;
15895 esac
15896
15897 case "$i32type" in
15898 '')     case "$longsize" in
15899         4)      i32type=long
15900                 u32type="unsigned long"
15901                 i32size=$longsize
15902                 u32size=$longsize
15903                 ;;
15904         *)      case "$intsize" in
15905                 4)      i32type=int
15906                         u32type="unsigned int"
15907                         i32size=$intsize
15908                         u32size=$intsize
15909                         ;;
15910                 esac
15911                 ;;
15912         esac
15913         ;;
15914 esac
15915 case "$i32type" in
15916 '')     set try -DINT32
15917         if eval $compile; then
15918                 case "`$run ./try`" in
15919                 int32_t)
15920                         i32type=int32_t
15921                         u32type=uint32_t
15922                         i32size=4
15923                         u32size=4
15924                         ;;
15925                 esac
15926         fi
15927         ;;
15928 esac
15929 case "$i32type" in
15930 '')     if $test $intsize -ge 4; then
15931                 i32type=int
15932                 u32type="unsigned int"
15933                 i32size=$intsize
15934                 u32size=$intsize
15935         fi
15936         ;;
15937 esac
15938
15939 case "$i64type" in
15940 '')     case "$d_quad:$quadtype" in
15941         define:?*)
15942                 i64type="$quadtype"
15943                 u64type="$uquadtype"
15944                 i64size=8
15945                 u64size=8
15946                 ;;
15947         esac
15948         ;;
15949 esac
15950
15951 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15952 : volatile so that the compiler has to store it out to memory.
15953 if test X"$d_volatile" = X"$define"; then
15954         volatile=volatile
15955 fi
15956 $cat <<EOP >try.c
15957 #include <stdio.h>
15958 #$i_stdlib I_STDLIB
15959 #ifdef I_STDLIB
15960 #include <stdlib.h>
15961 #endif
15962 #include <sys/types.h>
15963 #include <signal.h>
15964 #ifdef SIGFPE
15965 $volatile int bletched = 0;
15966 $signal_t blech(int s) { bletched = 1; }
15967 #endif
15968 int main() {
15969     $uvtype u = 0;
15970     $nvtype d;
15971     int     n = 8 * $uvsize;
15972     int     i;
15973 #ifdef SIGFPE
15974     signal(SIGFPE, blech);
15975 #endif
15976
15977     for (i = 0; i < n; i++) {
15978       u = u << 1 | ($uvtype)1;
15979       d = ($nvtype)u;
15980       if (($uvtype)d != u)
15981         break;
15982       if (d <= 0)
15983         break;
15984       d = ($nvtype)(u - 1);
15985       if (($uvtype)d != (u - 1))
15986         break;
15987 #ifdef SIGFPE
15988       if (bletched)
15989         break;
15990 #endif
15991     }
15992     printf("%d\n", ((i == n) ? -n : i));
15993     exit(0);
15994 }
15995 EOP
15996 set try
15997
15998 d_nv_preserves_uv="$undef"
15999 if eval $compile; then
16000         nv_preserves_uv_bits="`$run ./try`"
16001 fi
16002 case "$nv_preserves_uv_bits" in
16003 \-[1-9]*)
16004         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16005         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16006         d_nv_preserves_uv="$define"
16007         ;;
16008 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16009         d_nv_preserves_uv="$undef" ;;
16010 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16011         nv_preserves_uv_bits="0" ;;
16012 esac
16013 $rm_try
16014
16015 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16016 : volatile so that the compiler has to store it out to memory.
16017 if test X"$d_volatile" = X"$define"; then
16018         volatile=volatile
16019 fi
16020 $cat <<EOP >try.c
16021 #include <stdio.h>
16022
16023 typedef $nvtype NV;
16024
16025 int
16026 main() {
16027   NV value = 2;
16028   int count = 1;
16029
16030   while(count < 256) {
16031     $volatile NV up = value + 1.0;
16032     $volatile NV negated = -value;
16033     $volatile NV down = negated - 1.0;
16034     $volatile NV got_up = up - value;
16035     int up_good = got_up == 1.0;
16036     int got_down = down - negated;
16037     int down_good = got_down == -1.0;
16038
16039     if (down_good != up_good) {
16040       fprintf(stderr,
16041               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16042               up_good, (double) got_up, down_good, (double) got_down,
16043               count, (double) value);
16044       return 1;
16045     }
16046     if (!up_good) {
16047       while (1) {
16048         if (count > 8) {
16049           count -= 8;
16050           fputs("256.0", stdout);
16051         } else {
16052           count--;
16053           fputs("2.0", stdout);
16054         }
16055         if (!count) {
16056           puts("");
16057           return 0;
16058         }
16059         fputs("*", stdout);
16060       }
16061     }
16062     value *= 2;
16063     ++count;
16064   }
16065   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16066           count, (double) value);
16067   return 1;
16068 }
16069 EOP
16070 set try
16071
16072 nv_overflows_integers_at='0'
16073 if eval $compile; then
16074     xxx="`$run ./try`"
16075     case "$?" in
16076         0)
16077             case "$xxx" in
16078                 2*)  cat >&4 <<EOM
16079 The largest integer your NVs can preserve is equal to $xxx
16080 EOM
16081                     nv_overflows_integers_at="$xxx"
16082                     ;;
16083                 *)  cat >&4 <<EOM
16084 Cannot determine the largest integer value your NVs can hold, unexpected output
16085 '$xxx'
16086 EOM
16087                     ;;
16088             esac
16089             ;;
16090         *)  cat >&4 <<EOM
16091 Cannot determine the largest integer value your NVs can hold
16092 EOM
16093             ;;
16094     esac
16095 fi
16096 $rm_try
16097
16098 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16099 : volatile so that the compiler has to store it out to memory.
16100 if test X"$d_volatile" = X"$define"; then
16101         volatile=volatile
16102 fi
16103 $cat <<EOP >try.c
16104 #include <stdio.h>
16105 #$i_stdlib I_STDLIB
16106 #ifdef I_STDLIB
16107 #include <stdlib.h>
16108 #endif
16109 #$i_string I_STRING
16110 #ifdef I_STRING
16111 #  include <string.h>
16112 #else
16113 #  include <strings.h>
16114 #endif
16115 #include <sys/types.h>
16116 #include <signal.h>
16117 #ifdef SIGFPE
16118 $volatile int bletched = 0;
16119 $signal_t blech(int s) { bletched = 1; }
16120 #endif
16121
16122 int checkit($nvtype d, char *where) {
16123     unsigned char *p = (char *)&d;
16124     unsigned char *end = p + sizeof(d);
16125     int fail = 0;
16126
16127     while (p < end)
16128         fail += *p++;
16129
16130     if (!fail)
16131         return 0;
16132
16133     p = (char *)&d;
16134     printf("No - %s: 0x", where);
16135     while (p < end)
16136         printf ("%02X", *p++);
16137     printf("\n");
16138     return 1;
16139 }
16140
16141 int main(int argc, char **argv) {
16142     $nvtype d = 0.0;
16143     int fail = 0;
16144     fail += checkit(d, "0.0");
16145
16146     /* The compiler shouldn't be assuming that bletched is 0  */
16147     d = bletched;
16148
16149     fail += checkit(d, "bleched");
16150
16151 #ifdef SIGFPE
16152     signal(SIGFPE, blech);
16153 #endif
16154
16155     /* Paranoia - the compiler should have no way of knowing that ANSI says
16156        that argv[argc] will always be NULL.  Actually, if it did assume this it
16157        would be buggy, as this is C and main() can be called from elsewhere in
16158        the program.  */
16159     d = argv[argc] ? 1 : 0;
16160
16161     if (d) {
16162         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16163     }
16164
16165     fail += checkit(d, "ternary");
16166
16167     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16168
16169     if (d != 0.0) {
16170         printf("No - memset doesn't give 0.0\n");
16171         /* This might just blow up:  */
16172         printf("(gives %g)\n", d);
16173         return 1;
16174     }
16175
16176 #ifdef SIGFPE
16177     if (bletched) {
16178         printf("No - something bleched\n");
16179         return 1;
16180     }
16181 #endif
16182     if (fail) {
16183       printf("No - %d fail(s)\n", fail);
16184       return 1;
16185     }
16186     printf("Yes\n");
16187     return 0;
16188 }
16189 EOP
16190 set try
16191
16192 d_nv_zero_is_allbits_zero="$undef"
16193 if eval $compile; then
16194     xxx="`$run ./try`"
16195     case "$?" in
16196         0)
16197             case "$xxx" in
16198                 Yes)  cat >&4 <<EOM
16199 0.0 is represented as all bits zero in memory
16200 EOM
16201                     d_nv_zero_is_allbits_zero="$define"
16202                     ;;
16203                 *)  cat >&4 <<EOM
16204 0.0 is not represented as all bits zero in memory
16205 EOM
16206                     d_nv_zero_is_allbits_zero="$undef"
16207                     ;;
16208             esac
16209             ;;
16210         *)  cat >&4 <<EOM
16211 0.0 is not represented as all bits zero in memory
16212 EOM
16213             d_nv_zero_is_allbits_zero="$undef"
16214             ;;
16215     esac
16216 fi
16217 $rm_try
16218
16219 : check for off64_t
16220 echo " "
16221 echo "Checking to see if you have off64_t..." >&4
16222 $cat >try.c <<EOCP
16223 #include <sys/types.h>
16224 #include <unistd.h>
16225 int main() { off64_t x = 7; }
16226 EOCP
16227 set try
16228 if eval $compile; then
16229         val="$define"
16230         echo "You have off64_t."
16231 else
16232         val="$undef"
16233         echo "You do not have off64_t."
16234         case "$lseeksize" in
16235         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16236         esac
16237 fi
16238 $rm_try
16239 set d_off64_t
16240 eval $setvar
16241
16242 : how to create joinable pthreads
16243 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16244         echo " "
16245         echo "Checking what constant to use for creating joinable pthreads..." >&4
16246         $cat >try.c <<'EOCP'
16247 #include <pthread.h>
16248 int main() {
16249     int detachstate = JOINABLE;
16250 }
16251 EOCP
16252         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16253         if eval $compile; then
16254                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16255                 val="$undef" # Yes, undef.
16256                 set d_old_pthread_create_joinable
16257                 eval $setvar
16258                 val=""
16259                 set old_pthread_create_joinable
16260                 eval $setvar
16261         else
16262                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16263                 if eval $compile; then
16264                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16265                         val="$define"
16266                         set d_old_pthread_create_joinable
16267                         eval $setvar
16268                         val=PTHREAD_CREATE_UNDETACHED
16269                         set old_pthread_create_joinable
16270                         eval $setvar
16271                 else
16272                         set try -DJOINABLE=__UNDETACHED
16273                         if eval $compile; then
16274                                 echo "You seem to use __UNDETACHED." >&4
16275                                 val="$define"
16276                                 set d_old_pthread_create_joinable
16277                                 eval $setvar
16278                                 val=__UNDETACHED
16279                                 set old_pthread_create_joinable
16280                                 eval $setvar
16281                         else
16282                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16283                                 val="$define"
16284                                 set d_old_pthread_create_joinable
16285                                 eval $setvar
16286                                 val=0
16287                                 set old_pthread_create_joinable
16288                                 eval $setvar
16289                         fi
16290                 fi
16291         fi
16292         $rm_try
16293 else
16294     d_old_pthread_create_joinable="$undef"
16295     old_pthread_create_joinable=""
16296 fi
16297
16298 : see if pause exists
16299 set pause d_pause
16300 eval $inlibc
16301
16302 : see if poll exists
16303 set poll d_poll
16304 eval $inlibc
16305
16306 : see if prctl exists
16307 set prctl d_prctl
16308 eval $inlibc
16309
16310 : see if prctl supports PR_SET_NAME
16311 d_prctl_set_name=$undef
16312 case $d_prctl in
16313     $define)
16314         $cat >try.c <<EOM
16315 #include <sys/prctl.h>
16316
16317 int main (int argc, char *argv[])
16318 {
16319     return (prctl (PR_SET_NAME, "Test"));
16320     } /* main */
16321 EOM
16322         set try
16323         if eval $compile_ok && $run ./try; then
16324             echo "Your prctl (PR_SET_NAME, ...) works"
16325             d_prctl_set_name=$define
16326             fi
16327         $rm_try
16328         ;;
16329     esac
16330
16331 : see if readlink exists
16332 set readlink d_readlink
16333 eval $inlibc
16334
16335 : Check if exe is symlink to abs path of executing program
16336 echo " "
16337 procselfexe=''
16338 val="$undef"
16339 case "$d_readlink" in
16340     "$define")
16341         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16342         : more tidy to avoid an extra level of symlink
16343         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16344         while test $# -gt 0; do
16345             type=$1; try=$2
16346             shift; shift
16347             if $issymlink $try; then
16348                 $ls -l $try > reflect
16349                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16350                     echo "You have $type-like $try."
16351                     procselfexe='"'$try'"'
16352                     val="$define"
16353                     : This will break out of the loop
16354                     set X; shift
16355                 fi
16356             fi
16357         done
16358         ;;
16359 esac
16360 $rm -f reflect
16361 set d_procselfexe
16362 eval $setvar
16363
16364 : backward compatibility for d_hvfork
16365 if test X$d_hvfork != X; then
16366         d_vfork="$d_hvfork"
16367         d_hvfork=''
16368 fi
16369 : see if there is a vfork
16370 val=''
16371 set vfork val
16372 eval $inlibc
16373
16374 d_pseudofork=$undef
16375
16376 : Ok, but do we want to use it. vfork is reportedly unreliable in
16377 : perl on Solaris 2.x, and probably elsewhere.
16378 case "$val" in
16379 $define)
16380         echo " "
16381         case "$usevfork" in
16382         false) dflt='n';;
16383         *) dflt='y';;
16384         esac
16385         cat <<'EOM'
16386
16387 Perl can only use a vfork() that doesn't suffer from strict
16388 restrictions on calling functions or modifying global data in
16389 the child.  For example, glibc-2.1 contains such a vfork()
16390 that is unsuitable.  If your system provides a proper fork()
16391 call, chances are that you do NOT want perl to use vfork().
16392
16393 EOM
16394         rp="Do you still want to use vfork()?"
16395         . ./myread
16396         case "$ans" in
16397         y|Y) ;;
16398         *)
16399                 echo "Ok, we won't use vfork()."
16400                 val="$undef"
16401                 ;;
16402         esac
16403         ;;
16404 esac
16405 set d_vfork
16406 eval $setvar
16407 case "$d_vfork" in
16408 $define) usevfork='true';;
16409 *) usevfork='false';;
16410 esac
16411
16412 : see whether the pthread_atfork exists
16413 $cat >try.c <<EOP
16414 #include <pthread.h>
16415 #include <stdio.h>
16416 int main() {
16417 #ifdef  PTHREAD_ATFORK
16418         pthread_atfork(NULL,NULL,NULL);
16419 #endif
16420 }
16421 EOP
16422
16423 : see if pthread_atfork exists
16424 set try -DPTHREAD_ATFORK
16425 if eval $compile; then
16426     val="$define"
16427 else
16428     val="$undef"
16429 fi
16430 case "$usethreads" in
16431 $define)
16432         case "$val" in
16433         $define) echo 'pthread_atfork found.' >&4        ;;
16434         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16435         esac
16436 esac
16437 set d_pthread_atfork
16438 eval $setvar
16439
16440 : see if pthread_attr_setscope exists
16441 set pthread_attr_setscope d_pthread_attr_setscope
16442 eval $inlibc
16443
16444 : see whether the various POSIXish _yields exist
16445 $cat >try.c <<EOP
16446 #include <pthread.h>
16447 #include <stdio.h>
16448 int main() {
16449 #ifdef SCHED_YIELD
16450         sched_yield();
16451 #else
16452 #ifdef PTHREAD_YIELD
16453         pthread_yield();
16454 #else
16455 #ifdef PTHREAD_YIELD_NULL
16456         pthread_yield(NULL);
16457 #endif
16458 #endif
16459 #endif
16460 }
16461 EOP
16462 : see if sched_yield exists
16463 set try -DSCHED_YIELD
16464 if eval $compile; then
16465     val="$define"
16466     sched_yield='sched_yield()'
16467 else
16468     val="$undef"
16469 fi
16470 case "$usethreads" in
16471 $define)
16472         case "$val" in
16473         $define) echo 'sched_yield() found.' >&4        ;;
16474         *)       echo 'sched_yield() NOT found.' >&4    ;;
16475         esac
16476 esac
16477 set d_sched_yield
16478 eval $setvar
16479
16480 : see if pthread_yield exists
16481 set try -DPTHREAD_YIELD
16482 if eval $compile; then
16483     val="$define"
16484     case "$sched_yield" in
16485     '') sched_yield='pthread_yield()' ;;
16486     esac
16487 else
16488     set try -DPTHREAD_YIELD_NULL
16489     if eval $compile; then
16490         val="$define"
16491         case "$sched_yield" in
16492         '') sched_yield='pthread_yield(NULL)' ;;
16493         esac
16494     else
16495         val="$undef"
16496     fi
16497 fi
16498 case "$usethreads" in
16499 $define)
16500         case "$val" in
16501         $define) echo 'pthread_yield() found.' >&4      ;;
16502         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16503         esac
16504         ;;
16505 esac
16506 set d_pthread_yield
16507 eval $setvar
16508 case "$sched_yield" in
16509 '') sched_yield=undef ;;
16510 esac
16511 $rm_try
16512
16513 : see if random_r exists
16514 set random_r d_random_r
16515 eval $inlibc
16516 case "$d_random_r" in
16517 "$define")
16518         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16519         case "$d_random_r_proto:$usethreads" in
16520         ":define")      d_random_r_proto=define
16521                 set d_random_r_proto random_r $hdrs
16522                 eval $hasproto ;;
16523         *)      ;;
16524         esac
16525         case "$d_random_r_proto" in
16526         define)
16527         case "$random_r_proto" in
16528         ''|0) try='int random_r(int*, struct random_data*);'
16529         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16530         esac
16531         case "$random_r_proto" in
16532         ''|0) try='int random_r(long*, struct random_data*);'
16533         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16534         esac
16535         case "$random_r_proto" in
16536         ''|0) try='int random_r(struct random_data*, int32_t*);'
16537         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16538         esac
16539         case "$random_r_proto" in
16540         ''|0)   d_random_r=undef
16541                 random_r_proto=0
16542                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16543         * )     case "$random_r_proto" in
16544                 REENTRANT_PROTO*) ;;
16545                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16546                 esac
16547                 echo "Prototype: $try" ;;
16548         esac
16549         ;;
16550         *)      case "$usethreads" in
16551                 define) echo "random_r has no prototype, not using it." >&4 ;;
16552                 esac
16553                 d_random_r=undef
16554                 random_r_proto=0
16555                 ;;
16556         esac
16557         ;;
16558 *)      random_r_proto=0
16559         ;;
16560 esac
16561
16562 : see if readdir and friends exist
16563 set readdir d_readdir
16564 eval $inlibc
16565 set seekdir d_seekdir
16566 eval $inlibc
16567 set telldir d_telldir
16568 eval $inlibc
16569 set rewinddir d_rewinddir
16570 eval $inlibc
16571
16572 : see if readdir64_r exists
16573 set readdir64_r d_readdir64_r
16574 eval $inlibc
16575 case "$d_readdir64_r" in
16576 "$define")
16577         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16578         case "$d_readdir64_r_proto:$usethreads" in
16579         ":define")      d_readdir64_r_proto=define
16580                 set d_readdir64_r_proto readdir64_r $hdrs
16581                 eval $hasproto ;;
16582         *)      ;;
16583         esac
16584         case "$d_readdir64_r_proto" in
16585         define)
16586         case "$readdir64_r_proto" in
16587         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16588         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16589         esac
16590         case "$readdir64_r_proto" in
16591         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16592         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16593         esac
16594         case "$readdir64_r_proto" in
16595         ''|0)   d_readdir64_r=undef
16596                 readdir64_r_proto=0
16597                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16598         * )     case "$readdir64_r_proto" in
16599                 REENTRANT_PROTO*) ;;
16600                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16601                 esac
16602                 echo "Prototype: $try" ;;
16603         esac
16604         ;;
16605         *)      case "$usethreads" in
16606                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16607                 esac
16608                 d_readdir64_r=undef
16609                 readdir64_r_proto=0
16610                 ;;
16611         esac
16612         ;;
16613 *)      readdir64_r_proto=0
16614         ;;
16615 esac
16616
16617 : see if readdir_r exists
16618 set readdir_r d_readdir_r
16619 eval $inlibc
16620 case "$d_readdir_r" in
16621 "$define")
16622         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16623         case "$d_readdir_r_proto:$usethreads" in
16624         ":define")      d_readdir_r_proto=define
16625                 set d_readdir_r_proto readdir_r $hdrs
16626                 eval $hasproto ;;
16627         *)      ;;
16628         esac
16629         case "$d_readdir_r_proto" in
16630         define)
16631         case "$readdir_r_proto" in
16632         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16633         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16634         esac
16635         case "$readdir_r_proto" in
16636         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16637         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16638         esac
16639         case "$readdir_r_proto" in
16640         ''|0)   d_readdir_r=undef
16641                 readdir_r_proto=0
16642                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16643         * )     case "$readdir_r_proto" in
16644                 REENTRANT_PROTO*) ;;
16645                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16646                 esac
16647                 echo "Prototype: $try" ;;
16648         esac
16649         ;;
16650         *)      case "$usethreads" in
16651                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16652                 esac
16653                 d_readdir_r=undef
16654                 readdir_r_proto=0
16655                 ;;
16656         esac
16657         ;;
16658 *)      readdir_r_proto=0
16659         ;;
16660 esac
16661
16662 : see if readv exists
16663 set readv d_readv
16664 eval $inlibc
16665
16666 : see if recvmsg exists
16667 set recvmsg d_recvmsg
16668 eval $inlibc
16669
16670 : see if rename exists
16671 set rename d_rename
16672 eval $inlibc
16673
16674 : see if rmdir exists
16675 set rmdir d_rmdir
16676 eval $inlibc
16677
16678 : see if memory.h is available.
16679 val=''
16680 set memory.h val
16681 eval $inhdr
16682
16683 : See if it conflicts with string.h
16684 case "$val" in
16685 $define)
16686         case "$strings" in
16687         '') ;;
16688         *)
16689                 $cppstdin $cppflags $cppminus < $strings > mem.h
16690                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16691                         echo " "
16692                         echo "We won't be including <memory.h>."
16693                         val="$undef"
16694                 fi
16695                 $rm -f mem.h
16696                 ;;
16697         esac
16698 esac
16699 set i_memory
16700 eval $setvar
16701
16702 : can bcopy handle overlapping blocks?
16703 echo " "
16704 val="$undef"
16705 case "$d_memmove" in
16706 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16707 *)      case "$d_bcopy" in
16708         "$define")
16709                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16710                 $cat >try.c <<EOCP
16711 #$i_memory I_MEMORY
16712 #$i_stdlib I_STDLIB
16713 #$i_string I_STRING
16714 #$i_unistd I_UNISTD
16715 EOCP
16716         $cat >>try.c <<'EOCP'
16717 #include <stdio.h>
16718 #ifdef I_MEMORY
16719 #  include <memory.h>
16720 #endif
16721 #ifdef I_STDLIB
16722 #  include <stdlib.h>
16723 #endif
16724 #ifdef I_STRING
16725 #  include <string.h>
16726 #else
16727 #  include <strings.h>
16728 #endif
16729 #ifdef I_UNISTD
16730 #  include <unistd.h>  /* Needed for NetBSD */
16731 #endif
16732 int main()
16733 {
16734 char buf[128], abc[128];
16735 char *b;
16736 int len;
16737 int off;
16738 int align;
16739
16740 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16741    try to store the string in read-only memory. */
16742 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16743
16744 for (align = 7; align >= 0; align--) {
16745         for (len = 36; len; len--) {
16746                 b = buf+align;
16747                 bcopy(abc, b, len);
16748                 for (off = 1; off <= len; off++) {
16749                         bcopy(b, b+off, len);
16750                         bcopy(b+off, b, len);
16751                         if (bcmp(b, abc, len))
16752                                 exit(1);
16753                 }
16754         }
16755 }
16756 exit(0);
16757 }
16758 EOCP
16759                 set try
16760                 if eval $compile_ok; then
16761                         if $run ./try 2>/dev/null; then
16762                                 echo "Yes, it can."
16763                                 val="$define"
16764                         else
16765                                 echo "It can't, sorry."
16766                         fi
16767                 else
16768                         echo "(I can't compile the test program, so we'll assume not...)"
16769                 fi
16770                 ;;
16771         esac
16772         $rm_try
16773         ;;
16774 esac
16775 set d_safebcpy
16776 eval $setvar
16777
16778 : can memcpy handle overlapping blocks?
16779 echo " "
16780 val="$undef"
16781 case "$d_memmove" in
16782 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16783 *)      case "$d_memcpy" in
16784         "$define")
16785                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16786                 $cat >try.c <<EOCP
16787 #$i_memory I_MEMORY
16788 #$i_stdlib I_STDLIB
16789 #$i_string I_STRING
16790 #$i_unistd I_UNISTD
16791 EOCP
16792         $cat >>try.c <<'EOCP'
16793 #include <stdio.h>
16794 #ifdef I_MEMORY
16795 #  include <memory.h>
16796 #endif
16797 #ifdef I_STDLIB
16798 #  include <stdlib.h>
16799 #endif
16800 #ifdef I_STRING
16801 #  include <string.h>
16802 #else
16803 #  include <strings.h>
16804 #endif
16805 #ifdef I_UNISTD
16806 #  include <unistd.h>  /* Needed for NetBSD */
16807 #endif
16808 int main()
16809 {
16810 char buf[128], abc[128];
16811 char *b;
16812 int len;
16813 int off;
16814 int align;
16815
16816 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16817    try to store the string in read-only memory. */
16818 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16819
16820 for (align = 7; align >= 0; align--) {
16821         for (len = 36; len; len--) {
16822                 b = buf+align;
16823                 memcpy(b, abc, len);
16824                 for (off = 1; off <= len; off++) {
16825                         memcpy(b+off, b, len);
16826                         memcpy(b, b+off, len);
16827                         if (memcmp(b, abc, len))
16828                                 exit(1);
16829                 }
16830         }
16831 }
16832 exit(0);
16833 }
16834 EOCP
16835                 set try
16836                 if eval $compile_ok; then
16837                         if $run ./try 2>/dev/null; then
16838                                 echo "Yes, it can."
16839                                 val="$define"
16840                         else
16841                                 echo "It can't, sorry."
16842                         fi
16843                 else
16844                         echo "(I can't compile the test program, so we'll assume not...)"
16845                 fi
16846                 ;;
16847         esac
16848         $rm_try
16849         ;;
16850 esac
16851 set d_safemcpy
16852 eval $setvar
16853
16854 : can memcmp be trusted to compare relative magnitude?
16855 val="$undef"
16856 case "$d_memcmp" in
16857 "$define")
16858         echo " "
16859         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16860         $cat >try.c <<EOCP
16861 #$i_memory I_MEMORY
16862 #$i_stdlib I_STDLIB
16863 #$i_string I_STRING
16864 #$i_unistd I_UNISTD
16865 EOCP
16866         $cat >>try.c <<'EOCP'
16867 #include <stdio.h>
16868 #ifdef I_MEMORY
16869 #  include <memory.h>
16870 #endif
16871 #ifdef I_STDLIB
16872 #  include <stdlib.h>
16873 #endif
16874 #ifdef I_STRING
16875 #  include <string.h>
16876 #else
16877 #  include <strings.h>
16878 #endif
16879 #ifdef I_UNISTD
16880 #  include <unistd.h>  /* Needed for NetBSD */
16881 #endif
16882 int main()
16883 {
16884 char a = -1;
16885 char b = 0;
16886 if ((a < b) && memcmp(&a, &b, 1) < 0)
16887         exit(1);
16888 exit(0);
16889 }
16890 EOCP
16891         set try
16892         if eval $compile_ok; then
16893                 if $run ./try 2>/dev/null; then
16894                         echo "Yes, it can."
16895                         val="$define"
16896                 else
16897                         echo "No, it can't (it uses signed chars)."
16898                 fi
16899         else
16900                 echo "(I can't compile the test program, so we'll assume not...)"
16901         fi
16902         ;;
16903 esac
16904 $rm_try
16905 set d_sanemcmp
16906 eval $setvar
16907
16908 : see if prototype for sbrk is available
16909 echo " "
16910 set d_sbrkproto sbrk $i_unistd unistd.h
16911 eval $hasproto
16912
16913 : see if select exists
16914 set select d_select
16915 eval $inlibc
16916
16917 : see if semctl exists
16918 set semctl d_semctl
16919 eval $inlibc
16920
16921 : see if semget exists
16922 set semget d_semget
16923 eval $inlibc
16924
16925 : see if semop exists
16926 set semop d_semop
16927 eval $inlibc
16928
16929 : see how much of the 'sem*(2)' library is present.
16930 h_sem=true
16931 echo " "
16932 case "$d_semctl$d_semget$d_semop" in
16933 *"$undef"*) h_sem=false;;
16934 esac
16935 case "$osname" in
16936 freebsd)
16937     case "`ipcs 2>&1`" in
16938     "SVID messages"*"not configured"*)
16939         echo "Your $osname does not have the sem*(2) configured." >&4
16940         h_sem=false
16941         val="$undef"
16942         set semctl d_semctl
16943         eval $setvar
16944         set semget d_semget
16945         eval $setvar
16946         set semop d_semop
16947         eval $setvar
16948         ;;
16949     esac
16950     ;;
16951 esac
16952 : we could also check for sys/ipc.h ...
16953 if $h_sem && $test `./findhdr sys/sem.h`; then
16954         echo "You have the full sem*(2) library." >&4
16955         val="$define"
16956 else
16957         echo "You don't have the full sem*(2) library." >&4
16958         val="$undef"
16959 fi
16960 set d_sem
16961 eval $setvar
16962
16963 : see whether sys/sem.h defines union semun
16964 echo " "
16965 $cat > try.c <<'END'
16966 #include <sys/types.h>
16967 #include <sys/ipc.h>
16968 #include <sys/sem.h>
16969 int main () { union semun semun; semun.buf = 0; }
16970 END
16971 set try
16972 if eval $compile; then
16973     echo "You have union semun in <sys/sem.h>." >&4
16974     val="$define"
16975 else
16976     echo "You do not have union semun in <sys/sem.h>." >&4
16977     val="$undef"
16978 fi
16979 $rm_try
16980 set d_union_semun
16981 eval $setvar
16982
16983 : see how to do semctl IPC_STAT
16984 case "$d_sem" in
16985 $define)
16986     echo " "
16987     $cat > tryh.h <<END
16988 #ifndef S_IRUSR
16989 #   ifdef S_IREAD
16990 #       define S_IRUSR S_IREAD
16991 #       define S_IWUSR S_IWRITE
16992 #       define S_IXUSR S_IEXEC
16993 #   else
16994 #       define S_IRUSR 0400
16995 #       define S_IWUSR 0200
16996 #       define S_IXUSR 0100
16997 #   endif
16998 #   define S_IRGRP (S_IRUSR>>3)
16999 #   define S_IWGRP (S_IWUSR>>3)
17000 #   define S_IXGRP (S_IXUSR>>3)
17001 #   define S_IROTH (S_IRUSR>>6)
17002 #   define S_IWOTH (S_IWUSR>>6)
17003 #   define S_IXOTH (S_IXUSR>>6)
17004 #endif
17005 #ifndef S_IRWXU
17006 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17007 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17008 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17009 #endif
17010 END
17011     : see whether semctl IPC_STAT can use union semun
17012     case "$d_semctl_semun" in
17013     '')
17014       val="$undef"
17015       $cat > try.c <<END
17016 #include <sys/types.h>
17017 #include <sys/ipc.h>
17018 #include <sys/sem.h>
17019 #include <sys/stat.h>
17020 #include <stdio.h>
17021 #include <errno.h>
17022 #include "tryh.h"
17023 #ifndef errno
17024 extern int errno;
17025 #endif
17026 #$d_union_semun HAS_UNION_SEMUN
17027 int main() {
17028     union semun
17029 #ifndef HAS_UNION_SEMUN
17030     {
17031         int val;
17032         struct semid_ds *buf;
17033         unsigned short *array;
17034     }
17035 #endif
17036     arg;
17037     int sem, st;
17038
17039 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17040     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17041     if (sem > -1) {
17042         struct semid_ds argbuf;
17043         arg.buf = &argbuf;
17044 #       ifdef IPC_STAT
17045         st = semctl(sem, 0, IPC_STAT, arg);
17046         if (st == 0)
17047             printf("semun\n");
17048         else
17049 #       endif /* IPC_STAT */
17050             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17051 #       ifdef IPC_RMID
17052         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17053 #       endif /* IPC_RMID */
17054             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17055     } else
17056 #endif /* IPC_PRIVATE && ... */
17057         printf("semget failed: errno = %d\n", errno);
17058   return 0;
17059 }
17060 END
17061       set try
17062       if eval $compile; then
17063           xxx=`$run ./try`
17064           case "$xxx" in
17065           semun) val="$define" ;;
17066           esac
17067       fi
17068       $rm_try
17069       set d_semctl_semun
17070       eval $setvar
17071       ;;
17072     esac
17073     case "$d_semctl_semun" in
17074     $define)
17075         echo "You can use union semun for semctl IPC_STAT." >&4
17076         also='also'
17077         ;;
17078     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17079         also=''
17080         ;;
17081     esac
17082
17083     : see whether semctl IPC_STAT can use struct semid_ds pointer
17084     case "$d_semctl_semid_ds" in
17085     '')
17086       val="$undef"
17087       $cat > try.c <<'END'
17088 #include <sys/types.h>
17089 #include <sys/ipc.h>
17090 #include <sys/sem.h>
17091 #include <sys/stat.h>
17092 #include "tryh.h"
17093 #include <stdio.h>
17094 #include <errno.h>
17095 #ifndef errno
17096 extern int errno;
17097 #endif
17098 int main() {
17099     struct semid_ds arg;
17100     int sem, st;
17101
17102 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17103     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17104     if (sem > -1) {
17105 #       ifdef IPC_STAT
17106         st = semctl(sem, 0, IPC_STAT, &arg);
17107         if (st == 0)
17108             printf("semid_ds\n");
17109         else
17110 #       endif /* IPC_STAT */
17111             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17112 #       ifdef IPC_RMID
17113         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17114 #       endif /* IPC_RMID */
17115             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17116     } else
17117 #endif /* IPC_PRIVATE && ... */
17118         printf("semget failed: errno = %d\n", errno);
17119
17120     return 0;
17121 }
17122 END
17123       set try
17124       if eval $compile; then
17125           xxx=`$run ./try`
17126           case "$xxx" in
17127           semid_ds) val="$define" ;;
17128           esac
17129       fi
17130       $rm_try
17131       set d_semctl_semid_ds
17132       eval $setvar
17133       ;;
17134     esac
17135     case "$d_semctl_semid_ds" in
17136     $define)
17137         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17138         ;;
17139     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17140         ;;
17141     esac
17142     ;;
17143 *)  val="$undef"
17144
17145     # We do not have the full sem*(2) library, so assume we can not
17146     # use either.
17147
17148     set d_semctl_semun
17149     eval $setvar
17150
17151     set d_semctl_semid_ds
17152     eval $setvar
17153     ;;
17154 esac
17155 $rm_try tryh.h
17156
17157 : see if sendmsg exists
17158 set sendmsg d_sendmsg
17159 eval $inlibc
17160
17161 : see if setegid exists
17162 set setegid d_setegid
17163 eval $inlibc
17164
17165 : see if seteuid exists
17166 set seteuid d_seteuid
17167 eval $inlibc
17168
17169 : see if setgrent exists
17170 set setgrent d_setgrent
17171 eval $inlibc
17172
17173 : see if setgrent_r exists
17174 set setgrent_r d_setgrent_r
17175 eval $inlibc
17176 case "$d_setgrent_r" in
17177 "$define")
17178         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17179         case "$d_setgrent_r_proto:$usethreads" in
17180         ":define")      d_setgrent_r_proto=define
17181                 set d_setgrent_r_proto setgrent_r $hdrs
17182                 eval $hasproto ;;
17183         *)      ;;
17184         esac
17185         case "$d_setgrent_r_proto" in
17186         define)
17187         case "$setgrent_r_proto" in
17188         ''|0) try='int setgrent_r(FILE**);'
17189         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17190         esac
17191         case "$setgrent_r_proto" in
17192         ''|0) try='void setgrent_r(FILE**);'
17193         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17194         esac
17195         case "$setgrent_r_proto" in
17196         ''|0)   d_setgrent_r=undef
17197                 setgrent_r_proto=0
17198                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17199         * )     case "$setgrent_r_proto" in
17200                 REENTRANT_PROTO*) ;;
17201                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17202                 esac
17203                 echo "Prototype: $try" ;;
17204         esac
17205         ;;
17206         *)      case "$usethreads" in
17207                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17208                 esac
17209                 d_setgrent_r=undef
17210                 setgrent_r_proto=0
17211                 ;;
17212         esac
17213         ;;
17214 *)      setgrent_r_proto=0
17215         ;;
17216 esac
17217
17218 : see if sethostent exists
17219 set sethostent d_sethent
17220 eval $inlibc
17221
17222 : see if sethostent_r exists
17223 set sethostent_r d_sethostent_r
17224 eval $inlibc
17225 case "$d_sethostent_r" in
17226 "$define")
17227         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17228         case "$d_sethostent_r_proto:$usethreads" in
17229         ":define")      d_sethostent_r_proto=define
17230                 set d_sethostent_r_proto sethostent_r $hdrs
17231                 eval $hasproto ;;
17232         *)      ;;
17233         esac
17234         case "$d_sethostent_r_proto" in
17235         define)
17236         case "$sethostent_r_proto" in
17237         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17238         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17239         esac
17240         case "$sethostent_r_proto" in
17241         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17242         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17243         esac
17244         case "$sethostent_r_proto" in
17245         ''|0)   d_sethostent_r=undef
17246                 sethostent_r_proto=0
17247                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17248         * )     case "$sethostent_r_proto" in
17249                 REENTRANT_PROTO*) ;;
17250                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17251                 esac
17252                 echo "Prototype: $try" ;;
17253         esac
17254         ;;
17255         *)      case "$usethreads" in
17256                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17257                 esac
17258                 d_sethostent_r=undef
17259                 sethostent_r_proto=0
17260                 ;;
17261         esac
17262         ;;
17263 *)      sethostent_r_proto=0
17264         ;;
17265 esac
17266
17267 : see if setitimer exists
17268 set setitimer d_setitimer
17269 eval $inlibc
17270
17271 : see if setlinebuf exists
17272 set setlinebuf d_setlinebuf
17273 eval $inlibc
17274
17275 : see if setlocale exists
17276 set setlocale d_setlocale
17277 eval $inlibc
17278
17279 : see if locale.h is available
17280 set locale.h i_locale
17281 eval $inhdr
17282
17283 : see if setlocale_r exists
17284 set setlocale_r d_setlocale_r
17285 eval $inlibc
17286 case "$d_setlocale_r" in
17287 "$define")
17288         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17289         case "$d_setlocale_r_proto:$usethreads" in
17290         ":define")      d_setlocale_r_proto=define
17291                 set d_setlocale_r_proto setlocale_r $hdrs
17292                 eval $hasproto ;;
17293         *)      ;;
17294         esac
17295         case "$d_setlocale_r_proto" in
17296         define)
17297         case "$setlocale_r_proto" in
17298         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17299         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17300         esac
17301         case "$setlocale_r_proto" in
17302         ''|0)   d_setlocale_r=undef
17303                 setlocale_r_proto=0
17304                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17305         * )     case "$setlocale_r_proto" in
17306                 REENTRANT_PROTO*) ;;
17307                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17308                 esac
17309                 echo "Prototype: $try" ;;
17310         esac
17311         ;;
17312         *)      case "$usethreads" in
17313                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17314                 esac
17315                 d_setlocale_r=undef
17316                 setlocale_r_proto=0
17317                 ;;
17318         esac
17319         ;;
17320 *)      setlocale_r_proto=0
17321         ;;
17322 esac
17323
17324 : see if setnetent exists
17325 set setnetent d_setnent
17326 eval $inlibc
17327
17328 : see if setnetent_r exists
17329 set setnetent_r d_setnetent_r
17330 eval $inlibc
17331 case "$d_setnetent_r" in
17332 "$define")
17333         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17334         case "$d_setnetent_r_proto:$usethreads" in
17335         ":define")      d_setnetent_r_proto=define
17336                 set d_setnetent_r_proto setnetent_r $hdrs
17337                 eval $hasproto ;;
17338         *)      ;;
17339         esac
17340         case "$d_setnetent_r_proto" in
17341         define)
17342         case "$setnetent_r_proto" in
17343         ''|0) try='int setnetent_r(int, struct netent_data*);'
17344         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17345         esac
17346         case "$setnetent_r_proto" in
17347         ''|0) try='void setnetent_r(int, struct netent_data*);'
17348         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17349         esac
17350         case "$setnetent_r_proto" in
17351         ''|0)   d_setnetent_r=undef
17352                 setnetent_r_proto=0
17353                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17354         * )     case "$setnetent_r_proto" in
17355                 REENTRANT_PROTO*) ;;
17356                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17357                 esac
17358                 echo "Prototype: $try" ;;
17359         esac
17360         ;;
17361         *)      case "$usethreads" in
17362                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17363                 esac
17364                 d_setnetent_r=undef
17365                 setnetent_r_proto=0
17366                 ;;
17367         esac
17368         ;;
17369 *)      setnetent_r_proto=0
17370         ;;
17371 esac
17372
17373 : see if setprotoent exists
17374 set setprotoent d_setpent
17375 eval $inlibc
17376
17377 : see if setpgid exists
17378 set setpgid d_setpgid
17379 eval $inlibc
17380
17381 : see if setpgrp2 exists
17382 set setpgrp2 d_setpgrp2
17383 eval $inlibc
17384
17385 : see if setpriority exists
17386 set setpriority d_setprior
17387 eval $inlibc
17388
17389 : see if setproctitle exists
17390 set setproctitle d_setproctitle
17391 eval $inlibc
17392
17393 : see if setprotoent_r exists
17394 set setprotoent_r d_setprotoent_r
17395 eval $inlibc
17396 case "$d_setprotoent_r" in
17397 "$define")
17398         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17399         case "$d_setprotoent_r_proto:$usethreads" in
17400         ":define")      d_setprotoent_r_proto=define
17401                 set d_setprotoent_r_proto setprotoent_r $hdrs
17402                 eval $hasproto ;;
17403         *)      ;;
17404         esac
17405         case "$d_setprotoent_r_proto" in
17406         define)
17407         case "$setprotoent_r_proto" in
17408         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17409         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17410         esac
17411         case "$setprotoent_r_proto" in
17412         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17413         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17414         esac
17415         case "$setprotoent_r_proto" in
17416         ''|0)   d_setprotoent_r=undef
17417                 setprotoent_r_proto=0
17418                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17419         * )     case "$setprotoent_r_proto" in
17420                 REENTRANT_PROTO*) ;;
17421                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17422                 esac
17423                 echo "Prototype: $try" ;;
17424         esac
17425         ;;
17426         *)      case "$usethreads" in
17427                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17428                 esac
17429                 d_setprotoent_r=undef
17430                 setprotoent_r_proto=0
17431                 ;;
17432         esac
17433         ;;
17434 *)      setprotoent_r_proto=0
17435         ;;
17436 esac
17437
17438 : see if setpwent exists
17439 set setpwent d_setpwent
17440 eval $inlibc
17441
17442 : see if setpwent_r exists
17443 set setpwent_r d_setpwent_r
17444 eval $inlibc
17445 case "$d_setpwent_r" in
17446 "$define")
17447         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17448         case "$d_setpwent_r_proto:$usethreads" in
17449         ":define")      d_setpwent_r_proto=define
17450                 set d_setpwent_r_proto setpwent_r $hdrs
17451                 eval $hasproto ;;
17452         *)      ;;
17453         esac
17454         case "$d_setpwent_r_proto" in
17455         define)
17456         case "$setpwent_r_proto" in
17457         ''|0) try='int setpwent_r(FILE**);'
17458         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17459         esac
17460         case "$setpwent_r_proto" in
17461         ''|0) try='void setpwent_r(FILE**);'
17462         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17463         esac
17464         case "$setpwent_r_proto" in
17465         ''|0)   d_setpwent_r=undef
17466                 setpwent_r_proto=0
17467                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17468         * )     case "$setpwent_r_proto" in
17469                 REENTRANT_PROTO*) ;;
17470                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17471                 esac
17472                 echo "Prototype: $try" ;;
17473         esac
17474         ;;
17475         *)      case "$usethreads" in
17476                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17477                 esac
17478                 d_setpwent_r=undef
17479                 setpwent_r_proto=0
17480                 ;;
17481         esac
17482         ;;
17483 *)      setpwent_r_proto=0
17484         ;;
17485 esac
17486
17487 : see if setregid exists
17488 set setregid d_setregid
17489 eval $inlibc
17490 set setresgid d_setresgid
17491 eval $inlibc
17492
17493 : see if setreuid exists
17494 set setreuid d_setreuid
17495 eval $inlibc
17496 set setresuid d_setresuid
17497 eval $inlibc
17498
17499 : see if setrgid exists
17500 set setrgid d_setrgid
17501 eval $inlibc
17502
17503 : see if setruid exists
17504 set setruid d_setruid
17505 eval $inlibc
17506
17507 : see if setservent exists
17508 set setservent d_setsent
17509 eval $inlibc
17510
17511 : see if setservent_r exists
17512 set setservent_r d_setservent_r
17513 eval $inlibc
17514 case "$d_setservent_r" in
17515 "$define")
17516         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17517         case "$d_setservent_r_proto:$usethreads" in
17518         ":define")      d_setservent_r_proto=define
17519                 set d_setservent_r_proto setservent_r $hdrs
17520                 eval $hasproto ;;
17521         *)      ;;
17522         esac
17523         case "$d_setservent_r_proto" in
17524         define)
17525         case "$setservent_r_proto" in
17526         ''|0) try='int setservent_r(int, struct servent_data*);'
17527         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17528         esac
17529         case "$setservent_r_proto" in
17530         ''|0) try='void setservent_r(int, struct servent_data*);'
17531         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17532         esac
17533         case "$setservent_r_proto" in
17534         ''|0)   d_setservent_r=undef
17535                 setservent_r_proto=0
17536                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17537         * )     case "$setservent_r_proto" in
17538                 REENTRANT_PROTO*) ;;
17539                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17540                 esac
17541                 echo "Prototype: $try" ;;
17542         esac
17543         ;;
17544         *)      case "$usethreads" in
17545                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17546                 esac
17547                 d_setservent_r=undef
17548                 setservent_r_proto=0
17549                 ;;
17550         esac
17551         ;;
17552 *)      setservent_r_proto=0
17553         ;;
17554 esac
17555
17556 : see if setsid exists
17557 set setsid d_setsid
17558 eval $inlibc
17559
17560 : see if setvbuf exists
17561 set setvbuf d_setvbuf
17562 eval $inlibc
17563
17564 : see if shmctl exists
17565 set shmctl d_shmctl
17566 eval $inlibc
17567
17568 : see if shmget exists
17569 set shmget d_shmget
17570 eval $inlibc
17571
17572 : see if shmat exists
17573 set shmat d_shmat
17574 eval $inlibc
17575 : see what shmat returns
17576 case "$d_shmat" in
17577 "$define")
17578         $cat >shmat.c <<'END'
17579 #include <sys/shm.h>
17580 void *shmat();
17581 END
17582         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17583                 shmattype='void *'
17584         else
17585                 shmattype='char *'
17586         fi
17587         echo "and it returns ($shmattype)." >&4
17588         : see if a prototype for shmat is available
17589         xxx=`./findhdr sys/shm.h`
17590         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17591         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17592                 val="$define"
17593         else
17594                 val="$undef"
17595         fi
17596         $rm -f shmat.[co]
17597         ;;
17598 *)
17599         val="$undef"
17600         ;;
17601 esac
17602 set d_shmatprototype
17603 eval $setvar
17604
17605 : see if shmdt exists
17606 set shmdt d_shmdt
17607 eval $inlibc
17608
17609 : see how much of the 'shm*(2)' library is present.
17610 h_shm=true
17611 echo " "
17612 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17613 *"$undef"*) h_shm=false;;
17614 esac
17615 case "$osname" in
17616 freebsd)
17617     case "`ipcs 2>&1`" in
17618     "SVID shared memory"*"not configured"*)
17619         echo "Your $osname does not have the shm*(2) configured." >&4
17620         h_shm=false
17621         val="$undef"
17622         set shmctl d_shmctl
17623         evat $setvar
17624         set shmget d_shmget
17625         evat $setvar
17626         set shmat d_shmat
17627         evat $setvar
17628         set shmdt d_shmdt
17629         evat $setvar
17630         ;;
17631     esac
17632     ;;
17633 esac
17634 : we could also check for sys/ipc.h ...
17635 if $h_shm && $test `./findhdr sys/shm.h`; then
17636         echo "You have the full shm*(2) library." >&4
17637         val="$define"
17638 else
17639         echo "You don't have the full shm*(2) library." >&4
17640         val="$undef"
17641 fi
17642 set d_shm
17643 eval $setvar
17644
17645 : see if we have sigaction
17646 echo " "
17647 if set sigaction val -f d_sigaction; eval $csym; $val; then
17648         echo 'sigaction() found.' >&4
17649         $cat > try.c <<EOP
17650 #include <stdio.h>
17651 #include <sys/types.h>
17652 #include <signal.h>
17653 #$i_stdlib I_STDLIB
17654 #ifdef I_STDLIB
17655 #include <stdlib.h>
17656 #endif
17657 int main()
17658 {
17659     struct sigaction act, oact;
17660     act.sa_flags = 0;
17661     oact.sa_handler = 0;
17662     /* so that act and oact are used */
17663     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17664 }
17665 EOP
17666         set try
17667         if eval $compile_ok; then
17668                 val="$define"
17669         else
17670                 echo "But you don't seem to have a usable struct sigaction." >&4
17671                 val="$undef"
17672         fi
17673 else
17674         echo 'sigaction NOT found.' >&4
17675         val="$undef"
17676 fi
17677 set d_sigaction; eval $setvar
17678 $rm_try
17679
17680 : see if this is a sunmath.h system
17681 set sunmath.h i_sunmath
17682 eval $inhdr
17683
17684 : see if signbit exists
17685 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17686 $cat >try.c <<EOCP
17687 #$i_math I_MATH
17688 #$i_sunmath I_SUNMATH
17689 #ifdef I_MATH
17690 #  include <math.h>
17691 #endif
17692 #ifdef I_SUNMATH  /* Solaris special math library */
17693 #  include <sunmath.h>
17694 #endif
17695 #define NV $nvtype
17696 int main(int argc, char **argv)
17697 {
17698     NV x = 0.0;
17699     NV y = -0.0;
17700     if ((signbit(x) == 0) && (signbit(y) != 0))
17701         return 0;
17702     else
17703         return 1;
17704 }
17705 EOCP
17706 val="$undef"
17707 set try
17708 if eval $compile; then
17709     if $run ./try; then
17710         $echo "Yes." >&4
17711         val="$define"
17712     else
17713         $echo "Signbit seems to be available, but doesn't work as I expected."
17714         $echo "I won't use it." >&4
17715         val="$undef"
17716     fi
17717 else
17718     $echo "Nope." >&4
17719     dflt="$undef"
17720 fi
17721 set d_signbit
17722 eval $setvar
17723 $rm_try
17724
17725 : see if sigprocmask exists
17726 set sigprocmask d_sigprocmask
17727 eval $inlibc
17728
17729 : see if sigsetjmp exists
17730 echo " "
17731 case "$d_sigsetjmp" in
17732 '')
17733         $cat >try.c <<EOP
17734 #include <setjmp.h>
17735 #$i_stdlib I_STDLIB
17736 #ifdef I_STDLIB
17737 #include <stdlib.h>
17738 #endif
17739 sigjmp_buf env;
17740 int set = 1;
17741 int main()
17742 {
17743         if (sigsetjmp(env,1))
17744                 exit(set);
17745         set = 0;
17746         siglongjmp(env, 1);
17747         exit(1);
17748 }
17749 EOP
17750         set try
17751         if eval $compile; then
17752                 if $run ./try >/dev/null 2>&1; then
17753                         echo "POSIX sigsetjmp found." >&4
17754                         val="$define"
17755                 else
17756                         $cat >&4 <<EOM
17757 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17758 I'll ignore them.
17759 EOM
17760                         val="$undef"
17761                 fi
17762         else
17763                 echo "sigsetjmp not found." >&4
17764                 val="$undef"
17765         fi
17766         ;;
17767 *) val="$d_sigsetjmp"
17768         case "$d_sigsetjmp" in
17769         $define) echo "POSIX sigsetjmp found." >&4;;
17770         $undef) echo "sigsetjmp not found." >&4;;
17771         esac
17772         ;;
17773 esac
17774 set d_sigsetjmp
17775 eval $setvar
17776 $rm_try
17777
17778 : see if snprintf exists
17779 set snprintf d_snprintf
17780 eval $inlibc
17781
17782 : see if vsnprintf exists
17783 set vsnprintf d_vsnprintf
17784 eval $inlibc
17785
17786 case "$d_snprintf-$d_vsnprintf" in
17787 "$define-$define")
17788     $cat <<EOM
17789 Checking whether your snprintf() and vsnprintf() work okay...
17790 EOM
17791     $cat >try.c <<'EOCP'
17792 /* v?snprintf testing logic courtesy of Russ Allbery.
17793  * According to C99:
17794  * - if the buffer is too short it still must be \0-terminated
17795  * - if the buffer is too short the potentially required length
17796  *   must be returned and not -1
17797  * - if the buffer is NULL the potentially required length
17798  *   must be returned and not -1 or core dump
17799  */
17800 #include <stdio.h>
17801 #include <stdarg.h>
17802
17803 char buf[2];
17804
17805 int test (char *format, ...)
17806 {
17807     va_list args;
17808     int count;
17809
17810     va_start (args, format);
17811     count = vsnprintf (buf, sizeof buf, format, args);
17812     va_end (args);
17813     return count;
17814 }
17815
17816 int main ()
17817 {
17818     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17819              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17820 }
17821 EOCP
17822     set try
17823     if eval $compile; then
17824         `$run ./try`
17825         case "$?" in
17826         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17827         *) cat <<EOM >&4
17828 Your snprintf() and snprintf() don't seem to be working okay.
17829 EOM
17830            d_snprintf="$undef"
17831            d_vsnprintf="$undef"
17832            ;;
17833         esac
17834     else
17835         echo "(I can't seem to compile the test program--assuming they don't)"
17836         d_snprintf="$undef"
17837         d_vsnprintf="$undef"
17838     fi
17839     $rm_try
17840     ;;
17841 esac
17842
17843 : see if sockatmark exists
17844 set sockatmark d_sockatmark
17845 eval $inlibc
17846
17847 : see if prototype for sockatmark is available
17848 echo " "
17849 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17850 eval $hasproto
17851
17852 : see if socks5_init exists
17853 set socks5_init d_socks5_init
17854 eval $inlibc
17855
17856 : see if sprintf returns the length of the string in the buffer as per ANSI
17857 $echo "Checking whether sprintf returns the length of the string..." >&4
17858 $cat <<EOP >try.c
17859 #include <stdio.h>
17860 #$i_stdlib I_STDLIB
17861 #ifdef I_STDLIB
17862 #include <stdlib.h>
17863 #endif
17864 #$i_string I_STRING
17865 #ifdef I_STRING
17866 #  include <string.h>
17867 #else
17868 #  include <strings.h>
17869 #endif
17870 #$i_math I_MATH
17871 #ifdef I_MATH
17872 #include <math.h>
17873 #endif
17874
17875 char buffer[256];
17876
17877 int check (size_t expect, int test) {
17878   size_t got = strlen(buffer);
17879   if (expect == got)
17880     return 0;
17881
17882   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17883        test, buffer);
17884   exit (test);
17885 }
17886
17887 int main(int argc, char **argv) {
17888   int test = 0;
17889
17890   check(sprintf(buffer, ""), ++test);
17891   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17892   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17893
17894   return 0;
17895 }
17896 EOP
17897 set try
17898
17899 if eval $compile; then
17900     xxx="`$run ./try`"
17901     case "$?" in
17902         0) cat >&4 <<EOM
17903 sprintf returns the length of the string (as ANSI says it should)
17904 EOM
17905         d_sprintf_returns_strlen="$define"
17906         ;;
17907         *) cat >&4 <<EOM
17908 sprintf does not return the length of the string (how old is this system?)
17909 EOM
17910         d_sprintf_returns_strlen="$undef"
17911         ;;
17912     esac
17913 else
17914     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17915     d_sprintf_returns_strlen="$undef"
17916 fi
17917 $rm_try
17918
17919 : see if srand48_r exists
17920 set srand48_r d_srand48_r
17921 eval $inlibc
17922 case "$d_srand48_r" in
17923 "$define")
17924         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17925         case "$d_srand48_r_proto:$usethreads" in
17926         ":define")      d_srand48_r_proto=define
17927                 set d_srand48_r_proto srand48_r $hdrs
17928                 eval $hasproto ;;
17929         *)      ;;
17930         esac
17931         case "$d_srand48_r_proto" in
17932         define)
17933         case "$srand48_r_proto" in
17934         ''|0) try='int srand48_r(long, struct drand48_data*);'
17935         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17936         esac
17937         case "$srand48_r_proto" in
17938         ''|0)   d_srand48_r=undef
17939                 srand48_r_proto=0
17940                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17941         * )     case "$srand48_r_proto" in
17942                 REENTRANT_PROTO*) ;;
17943                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17944                 esac
17945                 echo "Prototype: $try" ;;
17946         esac
17947         ;;
17948         *)      case "$usethreads" in
17949                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17950                 esac
17951                 d_srand48_r=undef
17952                 srand48_r_proto=0
17953                 ;;
17954         esac
17955         ;;
17956 *)      srand48_r_proto=0
17957         ;;
17958 esac
17959
17960 : see if srandom_r exists
17961 set srandom_r d_srandom_r
17962 eval $inlibc
17963 case "$d_srandom_r" in
17964 "$define")
17965         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17966         case "$d_srandom_r_proto:$usethreads" in
17967         ":define")      d_srandom_r_proto=define
17968                 set d_srandom_r_proto srandom_r $hdrs
17969                 eval $hasproto ;;
17970         *)      ;;
17971         esac
17972         case "$d_srandom_r_proto" in
17973         define)
17974         case "$srandom_r_proto" in
17975         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17976         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17977         esac
17978         case "$srandom_r_proto" in
17979         ''|0)   d_srandom_r=undef
17980                 srandom_r_proto=0
17981                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17982         * )     case "$srandom_r_proto" in
17983                 REENTRANT_PROTO*) ;;
17984                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17985                 esac
17986                 echo "Prototype: $try" ;;
17987         esac
17988         ;;
17989         *)      case "$usethreads" in
17990                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17991                 esac
17992                 d_srandom_r=undef
17993                 srandom_r_proto=0
17994                 ;;
17995         esac
17996         ;;
17997 *)      srandom_r_proto=0
17998         ;;
17999 esac
18000
18001 : see if prototype for setresgid is available
18002 echo " "
18003 set d_sresgproto setresgid $i_unistd unistd.h
18004 eval $hasproto
18005
18006 : see if prototype for setresuid is available
18007 echo " "
18008 set d_sresuproto setresuid $i_unistd unistd.h
18009 eval $hasproto
18010
18011 : see if sys/stat.h is available
18012 set sys/stat.h i_sysstat
18013 eval $inhdr
18014
18015 : see if stat knows about block sizes
18016 echo " "
18017 echo "Checking to see if your struct stat has st_blocks field..." >&4
18018 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18019 eval $hasfield
18020
18021 : see if this is a sys/vfs.h system
18022 set sys/vfs.h i_sysvfs
18023 eval $inhdr
18024
18025 : see if this is a sys/statfs.h system
18026 set sys/statfs.h i_sysstatfs
18027 eval $inhdr
18028
18029 : Check for statfs_s
18030 echo " "
18031 echo "Checking to see if your system supports struct statfs..." >&4
18032 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
18033 eval $hasstruct
18034 case "$d_statfs_s" in
18035 "$define")      echo "Yes, it does."   ;;
18036 *)              echo "No, it doesn't." ;;
18037 esac
18038
18039
18040 : see if struct statfs knows about f_flags
18041 case "$d_statfs_s" in
18042 define)
18043         echo " "
18044         echo "Checking to see if your struct statfs has f_flags field..." >&4
18045         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
18046         eval $hasfield
18047         ;;
18048 *)      val="$undef"
18049         set d_statfs_f_flags
18050         eval $setvar
18051         ;;
18052 esac
18053 case "$d_statfs_f_flags" in
18054 "$define")      echo "Yes, it does."   ;;
18055 *)              echo "No, it doesn't." ;;
18056 esac
18057
18058 : see what flavor, if any, of static inline is supported
18059 echo " "
18060 echo "Checking to see if your system supports static inline..."
18061 $cat > try.c <<'EOCP'
18062 #include <stdlib.h>
18063 extern int f_via_a(int x);
18064 extern int f_via_b(int x);
18065 int main(int argc, char **argv)
18066 {
18067     int y;
18068
18069     y = f_via_a(0);
18070 #ifdef USE_B
18071     y = f_via_b(0);
18072 #endif
18073     if (y == 42) {
18074         return EXIT_SUCCESS;
18075     }
18076     else {
18077         return EXIT_FAILURE;
18078     }
18079 }
18080 EOCP
18081 $cat > a.c <<'EOCP'
18082 static INLINE int f(int x) {
18083     int y;
18084     y = x + 42;
18085     return y;
18086 }
18087
18088 int f_via_a(int x)
18089 {
18090     return f(x);
18091 }
18092 EOCP
18093 $cat > b.c <<'EOCP'
18094 extern int f(int x);
18095
18096 int f_via_b(int x)
18097 {
18098     return f(x);
18099 }
18100 EOCP
18101
18102 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18103 case "$perl_static_inline" in
18104 '')     # Check the various possibilities, and break out on success.
18105         # For gcc, prefer __inline__, which will still permit
18106         # cflags.SH to add in -ansi.
18107         case "$gccversion" in
18108                 '') xxx="inline __inline__ __inline _inline";;
18109                 *)  xxx="__inline__ inline __inline _inline";;
18110         esac
18111         for inline in $xxx; do
18112                 set try -DINLINE=$inline a.c
18113                 if eval $compile && $run ./try; then
18114                         # Now make sure there is no external linkage of static
18115                         # functions
18116                         set try -DINLINE=$inline -DUSE_B a.c b.c
18117                         if eval $compile && $run ./try; then
18118                                 $echo "Your compiler supports static $inline, " >&4
18119                                 $echo "but it also creates an external definition," >&4
18120                                 $echo "so I won't use it." >&4
18121                                 val=$undef
18122                         else
18123                                 $echo "Your compiler supports static $inline." >&4
18124                                 val=$define
18125                                 perl_static_inline="static $inline";
18126                                 break;
18127                         fi
18128                 else
18129                         $echo "Your compiler does NOT support static $inline." >&4
18130                         val="$undef"
18131                 fi
18132         done
18133         ;;
18134 *inline*) # Some variant of inline exists.
18135         echo "Keeping your $hint value of $perl_static_inline."
18136         val=$define
18137         ;;
18138 static)  # No inline capabilities
18139         echo "Keeping your $hint value of $perl_static_inline."
18140         val=$undef
18141         ;;
18142 *)  # Unrecognized previous value -- blindly trust the supplied
18143         # value and hope it makes sense.  Use old value for
18144         # d_static_inline, if there is one.
18145         echo "Keeping your $hint value of $perl_static_inline."
18146         case "$d_static_inline" in
18147                 '') val=$define ;;
18148                 *)  val=$d_static_inline ;;
18149         esac
18150         ;;
18151 esac
18152 # Fallback to plain 'static' if nothing worked.
18153 case "$perl_static_inline" in
18154 '')
18155         perl_static_inline="static"
18156         val=$undef
18157         ;;
18158 esac
18159 set d_static_inline
18160 eval $setvar
18161 $rm -f a.[co] b.[co]
18162 $rm_try
18163
18164 : Check stream access
18165 $cat >&4 <<EOM
18166 Checking how to access stdio streams by file descriptor number...
18167 EOM
18168 case "$stdio_stream_array" in
18169 '')     $cat >try.c <<EOCP
18170 #include <stdio.h>
18171 int main() {
18172   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18173     printf("yes\n");
18174 }
18175 EOCP
18176         for s in _iob __iob __sF
18177         do
18178                 set try -DSTDIO_STREAM_ARRAY=$s
18179                 if eval $compile; then
18180                         case "`$run ./try`" in
18181                         yes)    stdio_stream_array=$s; break ;;
18182                         esac
18183                 fi
18184         done
18185         $rm_try
18186 esac
18187 case "$stdio_stream_array" in
18188 '')     $cat >&4 <<EOM
18189 I can't figure out how to access stdio streams by file descriptor number.
18190 EOM
18191         d_stdio_stream_array="$undef"
18192         ;;
18193 *)      $cat >&4 <<EOM
18194 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18195 EOM
18196         d_stdio_stream_array="$define"
18197         ;;
18198 esac
18199
18200 : see if strcoll exists
18201 set strcoll d_strcoll
18202 eval $inlibc
18203
18204 : check for structure copying
18205 echo " "
18206 echo "Checking to see if your C compiler can copy structs..." >&4
18207 $cat >try.c <<'EOCP'
18208 int main()
18209 {
18210         struct blurfl {
18211                 int dyick;
18212         } foo, bar;
18213
18214         foo = bar;
18215 }
18216 EOCP
18217 if $cc -c try.c >/dev/null 2>&1 ; then
18218         val="$define"
18219         echo "Yup, it can."
18220 else
18221         val="$undef"
18222         echo "Nope, it can't."
18223 fi
18224 set d_strctcpy
18225 eval $setvar
18226 $rm_try
18227
18228 : see if strerror and/or sys_errlist[] exist
18229 echo " "
18230 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18231     if set strerror val -f d_strerror; eval $csym; $val; then
18232                 echo 'strerror() found.' >&4
18233                 d_strerror="$define"
18234                 d_strerrm='strerror(e)'
18235                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18236                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18237                         d_syserrlst="$define"
18238                 else
18239                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18240                         d_syserrlst="$undef"
18241                 fi
18242     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18243                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18244                 echo 'strerror() found in string header.' >&4
18245                 d_strerror="$define"
18246                 d_strerrm='strerror(e)'
18247                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18248                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18249                                 d_syserrlst="$define"
18250                 else
18251                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18252                         d_syserrlst="$undef"
18253                 fi
18254     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18255                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18256                 d_strerror="$undef"
18257                 d_syserrlst="$define"
18258                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18259     else
18260                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18261                 d_strerror="$undef"
18262                 d_syserrlst="$undef"
18263                 d_strerrm='"unknown"'
18264     fi
18265 fi
18266
18267 : see if strerror_r exists
18268 set strerror_r d_strerror_r
18269 eval $inlibc
18270 case "$d_strerror_r" in
18271 "$define")
18272         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18273         case "$d_strerror_r_proto:$usethreads" in
18274         ":define")      d_strerror_r_proto=define
18275                 set d_strerror_r_proto strerror_r $hdrs
18276                 eval $hasproto ;;
18277         *)      ;;
18278         esac
18279         case "$d_strerror_r_proto" in
18280         define)
18281         case "$strerror_r_proto" in
18282         ''|0) try='int strerror_r(int, char*, size_t);'
18283         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18284         esac
18285         case "$strerror_r_proto" in
18286         ''|0) try='int strerror_r(int, char*, int);'
18287         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18288         esac
18289         case "$strerror_r_proto" in
18290         ''|0) try='char* strerror_r(int, char*, size_t);'
18291         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18292         esac
18293         case "$strerror_r_proto" in
18294         ''|0)   d_strerror_r=undef
18295                 strerror_r_proto=0
18296                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18297         * )     case "$strerror_r_proto" in
18298                 REENTRANT_PROTO*) ;;
18299                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18300                 esac
18301                 echo "Prototype: $try" ;;
18302         esac
18303         ;;
18304         *)      case "$usethreads" in
18305                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18306                 esac
18307                 d_strerror_r=undef
18308                 strerror_r_proto=0
18309                 ;;
18310         esac
18311         ;;
18312 *)      strerror_r_proto=0
18313         ;;
18314 esac
18315
18316 : see if strftime exists
18317 set strftime d_strftime
18318 eval $inlibc
18319
18320 : see if strlcat exists
18321 set strlcat d_strlcat
18322 eval $inlibc
18323
18324 : see if strlcpy exists
18325 set strlcpy d_strlcpy
18326 eval $inlibc
18327
18328 : see if strtod exists
18329 set strtod d_strtod
18330 eval $inlibc
18331
18332 : see if strtol exists
18333 set strtol d_strtol
18334 eval $inlibc
18335
18336 : see if strtold exists
18337 set strtold d_strtold
18338 eval $inlibc
18339
18340 : see if strtoll exists
18341 set strtoll d_strtoll
18342 eval $inlibc
18343
18344 case "$d_longlong-$d_strtoll" in
18345 "$define-$define")
18346         $cat <<EOM
18347 Checking whether your strtoll() works okay...
18348 EOM
18349         $cat >try.c <<'EOCP'
18350 #include <errno.h>
18351 #ifdef __hpux
18352 #define strtoll __strtoll
18353 #endif
18354 #ifdef __EMX__
18355 #define strtoll _strtoll
18356 #endif
18357 #include <stdio.h>
18358 extern long long int strtoll(char *s, char **, int);
18359 static int bad = 0;
18360 int check(char *s, long long ell, int een) {
18361         long long gll;
18362         errno = 0;
18363         gll = strtoll(s, 0, 10);
18364         if (!((gll == ell) && (errno == een)))
18365                 bad++;
18366 }
18367 int main() {
18368         check(" 1",                                      1LL, 0);
18369         check(" 0",                                      0LL, 0);
18370         check("-1",                                     -1LL, 0);
18371         check("-9223372036854775808", -9223372036854775808LL, 0);
18372         check("-9223372036854775808", -9223372036854775808LL, 0);
18373         check(" 9223372036854775807",  9223372036854775807LL, 0);
18374         check("-9223372036854775808", -9223372036854775808LL, 0);
18375         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18376         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18377         if (!bad)
18378                 printf("ok\n");
18379 }
18380 EOCP
18381         set try
18382         if eval $compile; then
18383                 yyy=`$run ./try`
18384                 case "$yyy" in
18385                 ok) echo "Your strtoll() seems to be working okay." ;;
18386                 *) cat <<EOM >&4
18387 Your strtoll() doesn't seem to be working okay.
18388 EOM
18389                    d_strtoll="$undef"
18390                    ;;
18391                 esac
18392         else
18393                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18394                 d_strtoll="$undef"
18395         fi
18396         ;;
18397 esac
18398
18399 : see if strtoq exists
18400 set strtoq d_strtoq
18401 eval $inlibc
18402
18403 : see if strtoul exists
18404 set strtoul d_strtoul
18405 eval $inlibc
18406
18407 case "$d_strtoul" in
18408 "$define")
18409         $cat <<EOM
18410 Checking whether your strtoul() works okay...
18411 EOM
18412         $cat >try.c <<'EOCP'
18413 #include <errno.h>
18414 #include <stdio.h>
18415 extern unsigned long int strtoul(char *s, char **, int);
18416 static int bad = 0;
18417 void check(char *s, unsigned long eul, int een) {
18418         unsigned long gul;
18419         errno = 0;
18420         gul = strtoul(s, 0, 10);
18421         if (!((gul == eul) && (errno == een)))
18422                 bad++;
18423 }
18424 int main() {
18425         check(" 1", 1L, 0);
18426         check(" 0", 0L, 0);
18427 EOCP
18428         case "$longsize" in
18429         8)
18430             $cat >>try.c <<'EOCP'
18431         check("18446744073709551615", 18446744073709551615UL, 0);
18432         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18433 #if 0 /* strtoul() for /^-/ strings is undefined. */
18434         check("-1", 18446744073709551615UL, 0);
18435         check("-18446744073709551614", 2, 0);
18436         check("-18446744073709551615", 1, 0);
18437         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18438         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18439 #endif
18440 EOCP
18441                 ;;
18442         4)
18443                     $cat >>try.c <<'EOCP'
18444         check("4294967295", 4294967295UL, 0);
18445         check("4294967296", 4294967295UL, ERANGE);
18446 #if 0 /* strtoul() for /^-/ strings is undefined. */
18447         check("-1", 4294967295UL, 0);
18448         check("-4294967294", 2, 0);
18449         check("-4294967295", 1, 0);
18450         check("-4294967296", 4294967295UL, ERANGE);
18451         check("-4294967297", 4294967295UL, ERANGE);
18452 #endif
18453 EOCP
18454                 ;;
18455         *)
18456 : Should we write these tests to be more portable by sprintf-ing
18457 : ~0 and then manipulating that char string as input for strtol?
18458                 ;;
18459         esac
18460         $cat >>try.c <<'EOCP'
18461         if (!bad)
18462                 printf("ok\n");
18463         return 0;
18464 }
18465 EOCP
18466         set try
18467         if eval $compile; then
18468                 case "`$run ./try`" in
18469                 ok) echo "Your strtoul() seems to be working okay." ;;
18470                 *) cat <<EOM >&4
18471 Your strtoul() doesn't seem to be working okay.
18472 EOM
18473                    d_strtoul="$undef"
18474                    ;;
18475                 esac
18476         else
18477                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18478                 d_strtoul="$undef"
18479         fi
18480         ;;
18481 esac
18482
18483 : see if strtoull exists
18484 set strtoull d_strtoull
18485 eval $inlibc
18486
18487 case "$d_longlong-$d_strtoull" in
18488 "$define-$define")
18489         $cat <<EOM
18490 Checking whether your strtoull() works okay...
18491 EOM
18492         $cat >try.c <<'EOCP'
18493 #include <errno.h>
18494 #ifdef __hpux
18495 #define strtoull __strtoull
18496 #endif
18497 #include <stdio.h>
18498 extern unsigned long long int strtoull(char *s, char **, int);
18499 static int bad = 0;
18500 int check(char *s, long long eull, int een) {
18501         long long gull;
18502         errno = 0;
18503         gull = strtoull(s, 0, 10);
18504         if (!((gull == eull) && (errno == een)))
18505                 bad++;
18506 }
18507 int main() {
18508         check(" 1",                                        1LL, 0);
18509         check(" 0",                                        0LL, 0);
18510         check("18446744073709551615",  18446744073709551615ULL, 0);
18511         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18512 #if 0 /* strtoull() for /^-/ strings is undefined. */
18513         check("-1",                    18446744073709551615ULL, 0);
18514         check("-18446744073709551614",                     2LL, 0);
18515         check("-18446744073709551615",                     1LL, 0);
18516         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18517         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18518 #endif
18519         if (!bad)
18520                 printf("ok\n");
18521 }
18522 EOCP
18523         set try
18524         if eval $compile; then
18525                 case "`$run ./try`" in
18526                 ok) echo "Your strtoull() seems to be working okay." ;;
18527                 *) cat <<EOM >&4
18528 Your strtoull() doesn't seem to be working okay.
18529 EOM
18530                    d_strtoull="$undef"
18531                    ;;
18532                 esac
18533         else
18534                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18535                 d_strtoull="$undef"
18536         fi
18537         ;;
18538 esac
18539
18540 : see if strtouq exists
18541 set strtouq d_strtouq
18542 eval $inlibc
18543
18544 case "$d_strtouq" in
18545 "$define")
18546         $cat <<EOM
18547 Checking whether your strtouq() works okay...
18548 EOM
18549         $cat >try.c <<'EOCP'
18550 #include <errno.h>
18551 #include <stdio.h>
18552 extern unsigned long long int strtouq(char *s, char **, int);
18553 static int bad = 0;
18554 void check(char *s, unsigned long long eull, int een) {
18555         unsigned long long gull;
18556         errno = 0;
18557         gull = strtouq(s, 0, 10);
18558         if (!((gull == eull) && (errno == een)))
18559                 bad++;
18560 }
18561 int main() {
18562         check(" 1",                                        1LL, 0);
18563         check(" 0",                                        0LL, 0);
18564         check("18446744073709551615",  18446744073709551615ULL, 0);
18565         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18566 #if 0 /* strtouq() for /^-/ strings is undefined. */
18567         check("-1",                    18446744073709551615ULL, 0);
18568         check("-18446744073709551614",                     2LL, 0);
18569         check("-18446744073709551615",                     1LL, 0);
18570         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18571         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18572 #endif
18573         if (!bad)
18574                 printf("ok\n");
18575         return 0;
18576 }
18577 EOCP
18578         set try
18579         if eval $compile; then
18580                 case "`$run ./try`" in
18581                 ok) echo "Your strtouq() seems to be working okay." ;;
18582                 *) cat <<EOM >&4
18583 Your strtouq() doesn't seem to be working okay.
18584 EOM
18585                    d_strtouq="$undef"
18586                    ;;
18587                 esac
18588         else
18589                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18590                 d_strtouq="$undef"
18591         fi
18592         ;;
18593 esac
18594
18595 : see if strxfrm exists
18596 set strxfrm d_strxfrm
18597 eval $inlibc
18598
18599 : see if symlink exists
18600 set symlink d_symlink
18601 eval $inlibc
18602
18603 : see if syscall exists
18604 set syscall d_syscall
18605 eval $inlibc
18606
18607 : see if prototype for syscall is available
18608 echo " "
18609 set d_syscallproto syscall $i_unistd unistd.h
18610 eval $hasproto
18611
18612 : see if sysconf exists
18613 set sysconf d_sysconf
18614 eval $inlibc
18615
18616 : see if system exists
18617 set system d_system
18618 eval $inlibc
18619
18620 : see if tcgetpgrp exists
18621 set tcgetpgrp d_tcgetpgrp
18622 eval $inlibc
18623
18624 : see if tcsetpgrp exists
18625 set tcsetpgrp d_tcsetpgrp
18626 eval $inlibc
18627
18628 : see if prototype for telldir is available
18629 echo " "
18630 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18631 eval $hasproto
18632
18633 : see if time exists
18634 echo " "
18635 if test "X$d_time" = X -o X"$timetype" = X; then
18636     if set time val -f d_time; eval $csym; $val; then
18637                 echo 'time() found.' >&4
18638                 val="$define"
18639                 rp="What is the type returned by time() on this system?"
18640                 set time_t timetype long stdio.h sys/types.h
18641                 eval $typedef_ask
18642     else
18643                 echo 'time() not found, hope that will do.' >&4
18644                 val="$undef"
18645                 timetype='int';
18646     fi
18647     set d_time
18648     eval $setvar
18649 fi
18650
18651 : see if timegm exists
18652 set timegm d_timegm
18653 eval $inlibc
18654
18655 : see if this is a sys/times.h system
18656 set sys/times.h i_systimes
18657 eval $inhdr
18658
18659 : see if times exists
18660 echo " "
18661 if set times val -f d_times; eval $csym; $val; then
18662         echo 'times() found.' >&4
18663         d_times="$define"
18664         inc=''
18665         case "$i_systimes" in
18666         "$define") inc='sys/times.h';;
18667         esac
18668         rp="What is the type returned by times() on this system?"
18669         set clock_t clocktype long stdio.h sys/types.h $inc
18670         eval $typedef_ask
18671 else
18672         echo 'times() NOT found, hope that will do.' >&4
18673         d_times="$undef"
18674         clocktype='int'
18675 fi
18676
18677 : see if tmpnam_r exists
18678 set tmpnam_r d_tmpnam_r
18679 eval $inlibc
18680 case "$d_tmpnam_r" in
18681 "$define")
18682         hdrs="$i_systypes sys/types.h define stdio.h "
18683         case "$d_tmpnam_r_proto:$usethreads" in
18684         ":define")      d_tmpnam_r_proto=define
18685                 set d_tmpnam_r_proto tmpnam_r $hdrs
18686                 eval $hasproto ;;
18687         *)      ;;
18688         esac
18689         case "$d_tmpnam_r_proto" in
18690         define)
18691         case "$tmpnam_r_proto" in
18692         ''|0) try='char* tmpnam_r(char*);'
18693         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18694         esac
18695         case "$tmpnam_r_proto" in
18696         ''|0)   d_tmpnam_r=undef
18697                 tmpnam_r_proto=0
18698                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18699         * )     case "$tmpnam_r_proto" in
18700                 REENTRANT_PROTO*) ;;
18701                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18702                 esac
18703                 echo "Prototype: $try" ;;
18704         esac
18705         ;;
18706         *)      case "$usethreads" in
18707                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18708                 esac
18709                 d_tmpnam_r=undef
18710                 tmpnam_r_proto=0
18711                 ;;
18712         esac
18713         ;;
18714 *)      tmpnam_r_proto=0
18715         ;;
18716 esac
18717
18718 : see if truncate exists
18719 set truncate d_truncate
18720 eval $inlibc
18721
18722 : see if ttyname_r exists
18723 set ttyname_r d_ttyname_r
18724 eval $inlibc
18725 case "$d_ttyname_r" in
18726 "$define")
18727         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18728         case "$d_ttyname_r_proto:$usethreads" in
18729         ":define")      d_ttyname_r_proto=define
18730                 set d_ttyname_r_proto ttyname_r $hdrs
18731                 eval $hasproto ;;
18732         *)      ;;
18733         esac
18734         case "$d_ttyname_r_proto" in
18735         define)
18736         case "$ttyname_r_proto" in
18737         ''|0) try='int ttyname_r(int, char*, size_t);'
18738         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18739         esac
18740         case "$ttyname_r_proto" in
18741         ''|0) try='int ttyname_r(int, char*, int);'
18742         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18743         esac
18744         case "$ttyname_r_proto" in
18745         ''|0) try='char* ttyname_r(int, char*, int);'
18746         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18747         esac
18748         case "$ttyname_r_proto" in
18749         ''|0)   d_ttyname_r=undef
18750                 ttyname_r_proto=0
18751                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18752         * )     case "$ttyname_r_proto" in
18753                 REENTRANT_PROTO*) ;;
18754                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18755                 esac
18756                 echo "Prototype: $try" ;;
18757         esac
18758         ;;
18759         *)      case "$usethreads" in
18760                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18761                 esac
18762                 d_ttyname_r=undef
18763                 ttyname_r_proto=0
18764                 ;;
18765         esac
18766         ;;
18767 *)      ttyname_r_proto=0
18768         ;;
18769 esac
18770
18771 : see if tzname[] exists
18772 echo " "
18773 if set tzname val -a d_tzname; eval $csym; $val; then
18774         val="$define"
18775         echo 'tzname[] found.' >&4
18776 else
18777         val="$undef"
18778         echo 'tzname[] NOT found.' >&4
18779 fi
18780 set d_tzname
18781 eval $setvar
18782
18783 : Check if is a multiplatform env
18784 case "$osname" in
18785 next|darwin) multiarch="$define" ;;
18786 esac
18787 case "$multiarch" in
18788 ''|[nN]*) multiarch="$undef" ;;
18789 esac
18790
18791 : check for ordering of bytes in a UV
18792 echo " "
18793 case "$multiarch" in
18794 *$define*)
18795         $cat <<EOM
18796 You seem to be doing a multiarchitecture build,
18797 skipping the byteorder check.
18798
18799 EOM
18800         byteorder='ffff'
18801         ;;
18802 *)
18803         case "$byteorder" in
18804         '')
18805                 $cat <<'EOM'
18806 In the following, larger digits indicate more significance.  A big-endian
18807 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18808 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18809 machines may have weird orders like 3412.  A Cray will report 87654321,
18810 an Alpha will report 12345678. If the test program works the default is
18811 probably right.
18812 I'm now running the test program...
18813 EOM
18814                 $cat >try.c <<EOCP
18815 #include <stdio.h>
18816 #$i_stdlib I_STDLIB
18817 #ifdef I_STDLIB
18818 #include <stdlib.h>
18819 #endif
18820 #include <sys/types.h>
18821 typedef $uvtype UV;
18822 int main()
18823 {
18824         int i;
18825         union {
18826                 UV l;
18827                 char c[$uvsize];
18828         } u;
18829
18830         if ($uvsize > 4)
18831                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18832         else
18833                 u.l = (UV)0x04030201;
18834         for (i = 0; i < $uvsize; i++)
18835                 printf("%c", u.c[i]+'0');
18836         printf("\n");
18837         exit(0);
18838 }
18839 EOCP
18840                 xxx_prompt=y
18841                 set try
18842                 if eval $compile && $run ./try > /dev/null; then
18843                         dflt=`$run ./try`
18844                         case "$dflt" in
18845                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18846                                 echo "(The test program ran ok.)"
18847                                 echo "byteorder=$dflt"
18848                                 xxx_prompt=n
18849                         ;;
18850                         ????|????????) echo "(The test program ran ok.)" ;;
18851                         *) echo "(The test program didn't run right for some reason.)" ;;
18852                         esac
18853                 else
18854                         dflt='4321'
18855                         cat <<'EOM'
18856 (I can't seem to compile the test program.  Guessing big-endian...)
18857 EOM
18858                 fi
18859                 case "$xxx_prompt" in
18860                 y)
18861                         rp="What is the order of bytes in $uvtype?"
18862                         . ./myread
18863                         byteorder="$ans"
18864                         ;;
18865                 *)      byteorder=$dflt
18866                         ;;
18867                 esac
18868                 ;;
18869         esac
18870         $rm_try
18871         ;;
18872 esac
18873
18874 : Checking 32bit alignedness
18875 $cat <<EOM
18876
18877 Checking to see whether you can access character data unalignedly...
18878 EOM
18879 case "$d_u32align" in
18880 '')   $cat >try.c <<EOCP
18881 #include <stdio.h>
18882 #$i_stdlib I_STDLIB
18883 #ifdef I_STDLIB
18884 #include <stdlib.h>
18885 #endif
18886 #define U32 $u32type
18887 #define BYTEORDER 0x$byteorder
18888 #define U8 $u8type
18889 #include <signal.h>
18890 #ifdef SIGBUS
18891 $signal_t bletch(int s) { exit(4); }
18892 #endif
18893 int main() {
18894 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18895     volatile U8 buf[8];
18896     volatile U32 *up;
18897     int i;
18898
18899     if (sizeof(U32) != 4) {
18900         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18901         exit(1);
18902     }
18903
18904     fflush(stdout);
18905
18906 #ifdef SIGBUS
18907     signal(SIGBUS, bletch);
18908 #endif
18909
18910     buf[0] = 0;
18911     buf[1] = 0;
18912     buf[2] = 0;
18913     buf[3] = 1;
18914     buf[4] = 0;
18915     buf[5] = 0;
18916     buf[6] = 0;
18917     buf[7] = 1;
18918
18919     for (i = 0; i < 4; i++) {
18920         up = (U32*)(buf + i);
18921         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18922                (*up == 1 << (8*(3-i)))  /* little-endian */
18923               )
18924            )
18925         {
18926             printf("read failed (%x)\n", *up);
18927             exit(2);
18928         }
18929     }
18930
18931     /* write test */
18932     for (i = 0; i < 4; i++) {
18933         up = (U32*)(buf + i);
18934         *up = 0xBeef;
18935         if (*up != 0xBeef) {
18936             printf("write failed (%x)\n", *up);
18937             exit(3);
18938         }
18939     }
18940
18941     exit(0);
18942 #else
18943     printf("1\n");
18944     exit(1);
18945 #endif
18946     return 0;
18947 }
18948 EOCP
18949 set try
18950 if eval $compile_ok; then
18951         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18952         $run ./try 2>&1 >/dev/null
18953         case "$?" in
18954         0)      cat >&4 <<EOM
18955 You can access character data pretty unalignedly.
18956 EOM
18957                 d_u32align="$undef"
18958                 ;;
18959         *)      cat >&4 <<EOM
18960 It seems that you must access character data in an aligned manner.
18961 EOM
18962                 d_u32align="$define"
18963                 ;;
18964         esac
18965 else
18966         rp='Can you access character data at unaligned addresses?'
18967         dflt='n'
18968         . ./myread
18969         case "$ans" in
18970         [yY]*)  d_u32align="$undef"  ;;
18971         *)      d_u32align="$define" ;;
18972         esac
18973 fi
18974 $rm_try
18975 ;;
18976 esac
18977
18978 : see if ualarm exists
18979 set ualarm d_ualarm
18980 eval $inlibc
18981
18982 : see if umask exists
18983 set umask d_umask
18984 eval $inlibc
18985
18986 : see if unordered exists
18987 set unordered d_unordered
18988 eval $inlibc
18989
18990 : see if unsetenv exists
18991 set unsetenv d_unsetenv
18992 eval $inlibc
18993
18994 : see if usleep exists
18995 set usleep d_usleep
18996 eval $inlibc
18997
18998 : see if prototype for usleep is available
18999 echo " "
19000 set d_usleepproto usleep $i_unistd unistd.h
19001 eval $hasproto
19002
19003 : see if ustat exists
19004 set ustat d_ustat
19005 eval $inlibc
19006
19007 : see if closedir exists
19008 set closedir d_closedir
19009 eval $inlibc
19010
19011 case "$d_closedir" in
19012 "$define")
19013         echo " "
19014         echo "Checking whether closedir() returns a status..." >&4
19015         cat > try.c <<EOM
19016 #$i_dirent I_DIRENT             /**/
19017 #$i_sysdir I_SYS_DIR            /**/
19018 #$i_sysndir I_SYS_NDIR          /**/
19019 #$i_systypes I_SYS_TYPES        /**/
19020
19021 #if defined(I_SYS_TYPES)
19022 #include <sys/types.h>
19023 #endif
19024 #if defined(I_DIRENT)
19025 #include <dirent.h>
19026 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19027 #include <sys/dir.h>
19028 #endif
19029 #else
19030 #ifdef I_SYS_NDIR
19031 #include <sys/ndir.h>
19032 #else
19033 #ifdef I_SYS_DIR
19034 #ifdef hp9000s500
19035 #include <ndir.h>       /* may be wrong in the future */
19036 #else
19037 #include <sys/dir.h>
19038 #endif
19039 #endif
19040 #endif
19041 #endif
19042 int main() { return closedir(opendir(".")); }
19043 EOM
19044         set try
19045         if eval $compile_ok; then
19046                 if $run ./try > /dev/null 2>&1 ; then
19047                         echo "Yes, it does."
19048                         val="$undef"
19049                 else
19050                         echo "No, it doesn't."
19051                         val="$define"
19052                 fi
19053         else
19054                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19055                 val="$define"
19056         fi
19057         ;;
19058 *)
19059         val="$undef";
19060         ;;
19061 esac
19062 set d_void_closedir
19063 eval $setvar
19064 $rm_try
19065
19066 : see if there is a wait4
19067 set wait4 d_wait4
19068 eval $inlibc
19069
19070 : see if waitpid exists
19071 set waitpid d_waitpid
19072 eval $inlibc
19073
19074 : see if wcstombs exists
19075 set wcstombs d_wcstombs
19076 eval $inlibc
19077
19078 : see if wctomb exists
19079 set wctomb d_wctomb
19080 eval $inlibc
19081
19082 : see if writev exists
19083 set writev d_writev
19084 eval $inlibc
19085
19086 : preserve RCS keywords in files with variable substitution, grrr
19087 Date='$Date'
19088 Id='$Id'
19089 Log='$Log'
19090 RCSfile='$RCSfile'
19091 Revision='$Revision'
19092
19093 : check for alignment requirements
19094 echo " "
19095 case "$alignbytes" in
19096 '') echo "Checking alignment constraints..." >&4
19097         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19098                 $cat >try.c <<'EOCP'
19099 typedef long double NV;
19100 EOCP
19101         else
19102                 $cat >try.c <<'EOCP'
19103 typedef double NV;
19104 EOCP
19105         fi
19106         $cat >>try.c <<'EOCP'
19107 #include <stdio.h>
19108 struct foobar {
19109         char foo;
19110         NV bar;
19111 } try_algn;
19112 int main()
19113 {
19114     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19115     return(0);
19116 }
19117 EOCP
19118         set try
19119         if eval $compile_ok; then
19120                 dflt=`$run ./try`
19121         else
19122                 dflt='8'
19123                 echo "(I can't seem to compile the test program...)"
19124         fi
19125         case "$multiarch" in
19126                 *$define*)
19127                 : The usual safe value is 8, but Darwin with -Duselongdouble
19128                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19129                 : Configure to pick a larger value if needed.
19130                 if $test "$dflt" -lt 8; then
19131                     dflt='8'
19132                         echo "Setting alignment to 8 for multiarch support.">&4
19133                 fi
19134                 ;;
19135         esac
19136         ;;
19137 *) dflt="$alignbytes"
19138         ;;
19139 esac
19140 rp="Doubles must be aligned on a how-many-byte boundary?"
19141 . ./myread
19142 alignbytes="$ans"
19143 $rm_try
19144
19145
19146 : set the base revision
19147 baserev=5.0
19148
19149 : Determine if this is an EBCDIC system
19150 echo " "
19151 echo "Determining whether or not we are on an EBCDIC system..." >&4
19152 $cat >try.c <<'EOM'
19153 int main()
19154 {
19155   if ('M'==0xd4) return 0;
19156   return 1;
19157 }
19158 EOM
19159
19160 case "$BOOTSTRAP_CHARSET" in
19161     Y|y|define) bootstrap_charset=$define       ;;
19162     *)          bootstrap_charset=$undef        ;;
19163 esac
19164
19165 val=$undef
19166 set try
19167 if eval $compile_ok; then
19168         if $run ./try; then
19169                 echo "You seem to speak EBCDIC." >&4
19170                 val="$define"
19171         else
19172                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19173         fi
19174 else
19175         echo "I'm unable to compile the test program." >&4
19176         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19177 fi
19178 $rm_try
19179 set ebcdic
19180 eval $setvar
19181
19182 : length of character in bytes. Is always 1, otherwise it is not C
19183 : This used to be a test using sizeof
19184 charsize=1
19185
19186 : Check for the number of bits in a character
19187 case "$charbits" in
19188 '')     echo "Checking how long a character is (in bits)..." >&4
19189         $cat >try.c <<EOCP
19190 #include <stdio.h>
19191 int main ()
19192 {
19193     int n;
19194     unsigned char c;
19195     for (c = 1, n = 0; c; c <<= 1, n++) ;
19196     printf ("%d\n", n);
19197     return (0);
19198     }
19199 EOCP
19200         set try
19201         if eval $compile_ok; then
19202                 dflt=`$run ./try`
19203         else
19204                 dflt='8'
19205                 echo "(I can't seem to compile the test program.  Guessing...)"
19206         fi
19207         ;;
19208 *)
19209         dflt="$charbits"
19210         ;;
19211 esac
19212 rp="What is the length of a character (in bits)?"
19213 . ./myread
19214 charbits="$ans"
19215 $rm_try
19216 case "$charbits" in
19217 8)      ;;
19218 *)      cat >&4 << EOM
19219 Your system has an unsigned character size of $charbits bits, which
19220 is rather unusual (normally it is 8 bits).  Perl likely will not work
19221 correctly on your system, with subtle bugs in various places.
19222 EOM
19223         rp='Do you really want to continue?'
19224         dflt='n'
19225         . ./myread
19226         case "$ans" in
19227                 [yY])   echo >&4 "Okay, continuing."    ;;
19228                 *)      exit 1                          ;;
19229         esac
19230 esac
19231
19232 : how do we concatenate cpp tokens here?
19233 echo " "
19234 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19235 $cat >cpp_stuff.c <<'EOCP'
19236 #define RCAT(a,b)a/**/b
19237 #define ACAT(a,b)a ## b
19238 RCAT(Rei,ser)
19239 ACAT(Cir,cus)
19240 EOCP
19241 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19242 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19243         echo "Oh!  Smells like ANSI's been here." >&4
19244         echo "We can catify or stringify, separately or together!"
19245         cpp_stuff=42
19246 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19247         echo "Ah, yes!  The good old days!" >&4
19248         echo "However, in the good old days we don't know how to stringify and"
19249         echo "catify at the same time."
19250         cpp_stuff=1
19251 else
19252         $cat >&4 <<EOM
19253 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19254 You're going to have to edit the values of CAT[2-5] in config.h...
19255 EOM
19256         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19257 fi
19258 $rm -f cpp_stuff.*
19259
19260 : see if this is a db.h system
19261 set db.h i_db
19262 eval $inhdr
19263
19264 case "$i_db" in
19265 $define)
19266         : Check db version.
19267         echo " "
19268         echo "Checking Berkeley DB version ..." >&4
19269         $cat >try.c <<EOCP
19270 #$d_const HASCONST
19271 #ifndef HASCONST
19272 #define const
19273 #endif
19274 #include <sys/types.h>
19275 #include <stdio.h>
19276 #$i_stdlib I_STDLIB
19277 #ifdef I_STDLIB
19278 #include <stdlib.h>
19279 #endif
19280 #include <db.h>
19281 int main(int argc, char *argv[])
19282 {
19283 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19284     int Major, Minor, Patch ;
19285     unsigned long Version ;
19286     (void)db_version(&Major, &Minor, &Patch) ;
19287     if (argc == 2) {
19288         printf("%d %d %d %d %d %d\n",
19289                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19290                Major, Minor, Patch);
19291         exit(0);
19292     }
19293     printf("You have Berkeley DB Version 2 or greater.\n");
19294
19295     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19296                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19297     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19298                 Major, Minor, Patch) ;
19299
19300     /* check that db.h & libdb are compatible */
19301     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19302         printf("db.h and libdb are incompatible.\n") ;
19303         exit(3);
19304     }
19305
19306     printf("db.h and libdb are compatible.\n") ;
19307
19308     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19309                 + DB_VERSION_PATCH ;
19310
19311     /* needs to be >= 2.3.4 */
19312     if (Version < 2003004) {
19313     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19314         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19315         exit(2);
19316     }
19317
19318     exit(0);
19319 #else
19320 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19321     if (argc == 2) {
19322         printf("1 0 0\n");
19323         exit(0);
19324     }
19325     printf("You have Berkeley DB Version 1.\n");
19326     exit(0);    /* DB version < 2: the coast is clear. */
19327 #else
19328     exit(1);    /* <db.h> not Berkeley DB? */
19329 #endif
19330 #endif
19331 }
19332 EOCP
19333         set try
19334         if eval $compile_ok && $run ./try; then
19335                 echo 'Looks OK.' >&4
19336                 set `$run ./try 1`
19337                 db_version_major=$1
19338                 db_version_minor=$2
19339                 db_version_patch=$3
19340         else
19341                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19342                 i_db=$undef
19343                 case " $libs " in
19344                 *"-ldb "*)
19345                         : Remove db from list of libraries to use
19346                         echo "Removing unusable -ldb from library list" >&4
19347                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19348                         shift
19349                         libs="$*"
19350                         echo "libs = $libs" >&4
19351                         ;;
19352                 esac
19353         fi
19354         $rm_try
19355         ;;
19356 esac
19357
19358 case "$i_db" in
19359 define)
19360         : Check the return type needed for hash
19361         echo " "
19362         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19363         $cat >try.c <<EOCP
19364 #$d_const HASCONST
19365 #ifndef HASCONST
19366 #define const
19367 #endif
19368 #include <sys/types.h>
19369 #include <db.h>
19370
19371 #ifndef DB_VERSION_MAJOR
19372 u_int32_t hash_cb (ptr, size)
19373 const void *ptr;
19374 size_t size;
19375 {
19376 }
19377 HASHINFO info;
19378 int main()
19379 {
19380         info.hash = hash_cb;
19381 }
19382 #endif
19383 EOCP
19384         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19385                 if $contains warning try.out >>/dev/null 2>&1 ; then
19386                         db_hashtype='int'
19387                 else
19388                         db_hashtype='u_int32_t'
19389                 fi
19390         else
19391                 : XXX Maybe we should just give up here.
19392                 db_hashtype=u_int32_t
19393                 $cat try.out >&4
19394                 echo "Help:  I can't seem to compile the db test program." >&4
19395                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19396         fi
19397         $rm_try
19398         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19399         ;;
19400 *)      db_hashtype=u_int32_t
19401         ;;
19402 esac
19403 case "$i_db" in
19404 define)
19405         : Check the return type needed for prefix
19406         echo " "
19407         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19408         cat >try.c <<EOCP
19409 #$d_const HASCONST
19410 #ifndef HASCONST
19411 #define const
19412 #endif
19413 #include <sys/types.h>
19414 #include <db.h>
19415
19416 #ifndef DB_VERSION_MAJOR
19417 size_t prefix_cb (key1, key2)
19418 const DBT *key1;
19419 const DBT *key2;
19420 {
19421 }
19422 BTREEINFO info;
19423 int main()
19424 {
19425         info.prefix = prefix_cb;
19426 }
19427 #endif
19428 EOCP
19429         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19430                 if $contains warning try.out >>/dev/null 2>&1 ; then
19431                         db_prefixtype='int'
19432                 else
19433                         db_prefixtype='size_t'
19434                 fi
19435         else
19436                 db_prefixtype='size_t'
19437                 : XXX Maybe we should just give up here.
19438                 $cat try.out >&4
19439                 echo "Help:  I can't seem to compile the db test program." >&4
19440                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19441         fi
19442         $rm_try
19443         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19444         ;;
19445 *)      db_prefixtype='size_t'
19446         ;;
19447 esac
19448
19449 : How can we generate normalized random numbers ?
19450 echo " "
19451 echo "Using our internal random number implementation..." >&4
19452
19453 case "$ccflags" in
19454 *-Dmy_rand=*|*-Dmy_srand=*)
19455         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19456         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19457         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19458         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19459         ;;
19460 esac
19461
19462 randfunc=Perl_drand48
19463 drand01="Perl_drand48()"
19464 seedfunc="Perl_drand48_init"
19465 randbits=48
19466 randseedtype=U32
19467
19468 : Check how to flush
19469 echo " "
19470 $cat >&4 <<EOM
19471 Checking how to flush all pending stdio output...
19472 EOM
19473 # I only know how to find the first 32 possibly open files on SunOS.
19474 # See also hints/sunos_4_1.sh and util.c  --AD
19475 case "$osname" in
19476 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19477 esac
19478 $cat >>try.c <<EOCP
19479 #include <stdio.h>
19480 #$i_stdlib I_STDLIB
19481 #ifdef I_STDLIB
19482 #include <stdlib.h>
19483 #endif
19484 #$i_unistd I_UNISTD
19485 #ifdef I_UNISTD
19486 # include <unistd.h>
19487 #endif
19488 #$d_sysconf HAS_SYSCONF
19489 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19490 #ifdef HAS_STDIO_STREAM_ARRAY
19491 # define STDIO_STREAM_ARRAY $stdio_stream_array
19492 #endif
19493 int main() {
19494   FILE* p;
19495   unlink("try.out");
19496   p = fopen("try.out", "w");
19497 #ifdef TRY_FPUTC
19498   fputc('x', p);
19499 #else
19500 # ifdef TRY_FPRINTF
19501   fprintf(p, "x");
19502 # endif
19503 #endif
19504 #ifdef TRY_FFLUSH_NULL
19505   fflush(NULL);
19506 #endif
19507 #ifdef TRY_FFLUSH_ALL
19508   {
19509     long open_max = -1;
19510 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19511     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19512 # else
19513 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19514     open_max = sysconf(_SC_OPEN_MAX);
19515 #  else
19516 #   ifdef FOPEN_MAX
19517     open_max = FOPEN_MAX;
19518 #   else
19519 #    ifdef OPEN_MAX
19520     open_max = OPEN_MAX;
19521 #    else
19522 #     ifdef _NFILE
19523     open_max = _NFILE;
19524 #     endif
19525 #    endif
19526 #   endif
19527 #  endif
19528 # endif
19529 # ifdef HAS_STDIO_STREAM_ARRAY
19530     if (open_max > 0) {
19531       long i;
19532       for (i = 0; i < open_max; i++)
19533             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19534                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19535                 STDIO_STREAM_ARRAY[i]._flag)
19536                 fflush(&STDIO_STREAM_ARRAY[i]);
19537     }
19538   }
19539 # endif
19540 #endif
19541   _exit(42);
19542 }
19543 EOCP
19544 : first we have to find out how _not_ to flush
19545 $to try.c
19546 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19547     output=''
19548     set try -DTRY_FPUTC
19549     if eval $compile; then
19550             $run ./try 2>/dev/null
19551             code="$?"
19552             $from try.out
19553             if $test ! -s try.out -a "X$code" = X42; then
19554                 output=-DTRY_FPUTC
19555             fi
19556     fi
19557     case "$output" in
19558     '')
19559             set try -DTRY_FPRINTF
19560             if eval $compile; then
19561                     $run ./try 2>/dev/null
19562                     code="$?"
19563                     $from try.out
19564                     if $test ! -s try.out -a "X$code" = X42; then
19565                         output=-DTRY_FPRINTF
19566                     fi
19567             fi
19568         ;;
19569     esac
19570 fi
19571 : check for fflush NULL behavior
19572 case "$fflushNULL" in
19573 '')     set try -DTRY_FFLUSH_NULL $output
19574         if eval $compile; then
19575                 $run ./try 2>/dev/null
19576                 code="$?"
19577                 $from try.out
19578                 if $test -s try.out -a "X$code" = X42; then
19579                         fflushNULL="`$cat try.out`"
19580                 else
19581                         if $test "X$code" != X42; then
19582                                 $cat >&4 <<EOM
19583 (If this test failed, don't worry, we'll try another method shortly.)
19584 EOM
19585                         fi
19586                 fi
19587         fi
19588         $rm -f core try.core core.try.*
19589         case "$fflushNULL" in
19590         x)      $cat >&4 <<EOM
19591 Your fflush(NULL) works okay for output streams.
19592 Let's see if it clobbers input pipes...
19593 EOM
19594 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19595 # bug that improperly flushes the input end of pipes.  So we avoid the
19596 # autoflush on fork/system/exec support for now. :-(
19597 $cat >tryp.c <<EOCP
19598 #include <stdio.h>
19599 int
19600 main(int argc, char **argv)
19601 {
19602     char buf[1024];
19603     int i;
19604     char *bp = buf;
19605     while (1) {
19606         while ((i = getc(stdin)) != -1
19607                && (*bp++ = i) != '\n'
19608                && bp < &buf[1024])
19609         /* DO NOTHING */ ;
19610         *bp = '\0';
19611         fprintf(stdout, "%s", buf);
19612         fflush(NULL);
19613         if (i == -1)
19614             return 0;
19615         bp = buf;
19616     }
19617 }
19618 EOCP
19619                 fflushNULL="$define"
19620                 set tryp
19621                 if eval $compile; then
19622                     $rm -f tryp.out
19623                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
19624                     if $test "X$targethost" != X; then
19625                         $to tryp.c
19626                         $run ./tryp \< tryp.c 2>/dev/null > tryp.out
19627                     else
19628                         $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19629                     fi
19630                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19631                        $cat >&4 <<EOM
19632 fflush(NULL) seems to behave okay with input streams.
19633 EOM
19634                         fflushNULL="$define"
19635                     else
19636                         $cat >&4 <<EOM
19637 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19638 EOM
19639                         fflushNULL="$undef"
19640                     fi
19641                 fi
19642                 $rm -f core tryp.c tryp.core core.tryp.*
19643                 ;;
19644         '')     $cat >&4 <<EOM
19645 Your fflush(NULL) isn't working (contrary to ANSI C).
19646 EOM
19647                 fflushNULL="$undef"
19648                 ;;
19649         *)      $cat >&4 <<EOM
19650 Cannot figure out whether your fflush(NULL) works or not.
19651 I'm assuming it doesn't (contrary to ANSI C).
19652 EOM
19653                 fflushNULL="$undef"
19654                 ;;
19655         esac
19656         ;;
19657 $define|true|[yY]*)
19658         fflushNULL="$define"
19659         ;;
19660 *)
19661         fflushNULL="$undef"
19662         ;;
19663 esac
19664 : check explicit looping only if NULL did not work, and if the pipe
19665 : bug does not show up on an explicit flush too
19666 case "$fflushNULL" in
19667 "$undef")
19668         $cat >tryp.c <<EOCP
19669 #include <stdio.h>
19670 int
19671 main(int argc, char **argv)
19672 {
19673     char buf[1024];
19674     int i;
19675     char *bp = buf;
19676     while (1) {
19677         while ((i = getc(stdin)) != -1
19678                && (*bp++ = i) != '\n'
19679                && bp < &buf[1024])
19680         /* DO NOTHING */ ;
19681         *bp = '\0';
19682         fprintf(stdout, "%s", buf);
19683         fflush(stdin);
19684         if (i == -1)
19685             return 0;
19686         bp = buf;
19687     }
19688 }
19689 EOCP
19690         set tryp
19691         if eval $compile; then
19692             $rm -f tryp.out
19693             if $test "X$targethost" != X; then
19694                 $to tryp.c
19695                 $run ./tryp \< tryp.c 2>/dev/null > tryp.out
19696             else
19697                 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19698             fi
19699             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19700                $cat >&4 <<EOM
19701 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19702 EOM
19703                 : now check for fflushall behaviour
19704                 case "$fflushall" in
19705                 '')     set try -DTRY_FFLUSH_ALL $output
19706                         if eval $compile; then
19707                                 $cat >&4 <<EOM
19708 (Now testing the other method--but note that this also may fail.)
19709 EOM
19710                                 $run ./try 2>/dev/null
19711                                 code=$?
19712                                 $from try.out
19713                                 if $test -s try.out -a "X$code" = X42; then
19714                                         fflushall="`$cat try.out`"
19715                                 fi
19716                         fi
19717                         $rm_try
19718                         case "$fflushall" in
19719                         x)      $cat >&4 <<EOM
19720 Whew. Flushing explicitly all the stdio streams works.
19721 EOM
19722                                 fflushall="$define"
19723                                 ;;
19724                         '')     $cat >&4 <<EOM
19725 Sigh. Flushing explicitly all the stdio streams doesn't work.
19726 EOM
19727                                 fflushall="$undef"
19728                                 ;;
19729                         *)      $cat >&4 <<EOM
19730 Cannot figure out whether flushing stdio streams explicitly works or not.
19731 I'm assuming it doesn't.
19732 EOM
19733                                 fflushall="$undef"
19734                                 ;;
19735                         esac
19736                         ;;
19737                 "$define"|true|[yY]*)
19738                         fflushall="$define"
19739                         ;;
19740                 *)
19741                         fflushall="$undef"
19742                         ;;
19743                 esac
19744             else
19745                 $cat >&4 <<EOM
19746 All is futile.  Even fflush(stdin) clobbers input pipes!
19747 EOM
19748                 fflushall="$undef"
19749             fi
19750         else
19751             fflushall="$undef"
19752         fi
19753         $rm -f core tryp.c tryp.core core.tryp.*
19754         ;;
19755 *)      fflushall="$undef"
19756         ;;
19757 esac
19758
19759 case "$fflushNULL$fflushall" in
19760 undefundef)
19761         $cat <<EOM
19762 OK, I give up.  I cannot figure out how to flush pending stdio output.
19763 We won't be flushing handles at all before fork/exec/popen.
19764 EOM
19765         ;;
19766 esac
19767 $rm_try tryp
19768
19769 : Store the full pathname to the ar program for use in the C program
19770 : Respect a hint or command line value for full_ar.
19771 case "$full_ar" in
19772 '') full_ar=$ar ;;
19773 esac
19774
19775 : Store the full pathname to the sed program for use in the C program
19776 full_sed=$sed
19777
19778 : see what type gids are declared as in the kernel
19779 echo " "
19780 echo "Looking for the type for group ids returned by getgid()."
19781 set gid_t gidtype xxx stdio.h sys/types.h
19782 eval $typedef
19783 case "$gidtype" in
19784 xxx)
19785         xxx=`./findhdr sys/user.h`
19786         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19787         case $1 in
19788         unsigned) dflt="$1 $2" ;;
19789         *) dflt="$1" ;;
19790         esac
19791         ;;
19792 *) dflt="$gidtype";;
19793 esac
19794 case "$gidtype" in
19795 gid_t) echo "gid_t found." ;;
19796 *)      rp="What is the type for group ids returned by getgid()?"
19797         . ./myread
19798         gidtype="$ans"
19799         ;;
19800 esac
19801
19802 : Check the size of GID
19803 echo " "
19804 case "$gidtype" in
19805 *_t) zzz="$gidtype"     ;;
19806 *)   zzz="gid"          ;;
19807 esac
19808 echo "Checking the size of $zzz..." >&4
19809 cat > try.c <<EOCP
19810 #include <sys/types.h>
19811 #include <stdio.h>
19812 #$i_stdlib I_STDLIB
19813 #ifdef I_STDLIB
19814 #include <stdlib.h>
19815 #endif
19816 int main() {
19817     printf("%d\n", (int)sizeof($gidtype));
19818     exit(0);
19819 }
19820 EOCP
19821 set try
19822 if eval $compile_ok; then
19823         yyy=`$run ./try`
19824         case "$yyy" in
19825         '')     gidsize=4
19826                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19827                 ;;
19828         *)      gidsize=$yyy
19829                 echo "Your $zzz is $gidsize bytes long."
19830                 ;;
19831         esac
19832 else
19833         gidsize=4
19834         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19835 fi
19836
19837
19838 : Check if GID is signed
19839 echo " "
19840 case "$gidtype" in
19841 *_t) zzz="$gidtype"     ;;
19842 *)   zzz="gid"          ;;
19843 esac
19844 echo "Checking the sign of $zzz..." >&4
19845 cat > try.c <<EOCP
19846 #include <sys/types.h>
19847 #include <stdio.h>
19848 int main() {
19849         $gidtype foo = -1;
19850         if (foo < 0)
19851                 printf("-1\n");
19852         else
19853                 printf("1\n");
19854 }
19855 EOCP
19856 set try
19857 if eval $compile; then
19858         yyy=`$run ./try`
19859         case "$yyy" in
19860         '')     gidsign=1
19861                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19862                 ;;
19863         *)      gidsign=$yyy
19864                 case "$gidsign" in
19865                  1) echo "Your $zzz is unsigned." ;;
19866                 -1) echo "Your $zzz is signed."   ;;
19867                 esac
19868                 ;;
19869         esac
19870 else
19871         gidsign=1
19872         echo "(I can't compile the test program--guessing unsigned.)" >&4
19873 fi
19874
19875
19876 : Check 64bit sizes
19877 echo " "
19878
19879 if $test X"$quadtype" != X; then
19880
19881 echo "Checking how to print 64-bit integers..." >&4
19882
19883 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19884         $cat >try.c <<'EOCP'
19885 #include <sys/types.h>
19886 #include <stdio.h>
19887 int main() {
19888   int q = 12345678901;
19889   printf("%ld\n", q);
19890 }
19891 EOCP
19892         set try
19893         if eval $compile; then
19894                 yyy=`$run ./try`
19895                 case "$yyy" in
19896                 12345678901)
19897                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19898                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19899                         echo "We will use %d."
19900                         ;;
19901                 esac
19902         fi
19903 fi
19904
19905 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19906         $cat >try.c <<'EOCP'
19907 #include <sys/types.h>
19908 #include <stdio.h>
19909 int main() {
19910   long q = 12345678901;
19911   printf("%ld\n", q);
19912 }
19913 EOCP
19914         set try
19915         if eval $compile; then
19916                 yyy=`$run ./try`
19917                 case "$yyy" in
19918                 12345678901)
19919                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19920                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19921                         echo "We will use %ld."
19922                         ;;
19923                 esac
19924         fi
19925 fi
19926
19927 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19928         $cat >try.c <<'EOCP'
19929 #include <sys/types.h>
19930 #include <inttypes.h>
19931 #include <stdio.h>
19932 int main() {
19933   int64_t q = 12345678901;
19934   printf("%" PRId64 "\n", q);
19935 }
19936 EOCP
19937         set try
19938         if eval $compile; then
19939                 yyy=`$run ./try`
19940                 case "$yyy" in
19941                 12345678901)
19942                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19943                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19944                         echo "We will use the C9X style."
19945                         ;;
19946                 esac
19947         fi
19948 fi
19949
19950 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19951         $cat >try.c <<EOCP
19952 #include <sys/types.h>
19953 #include <stdio.h>
19954 int main() {
19955   $quadtype q = 12345678901;
19956   printf("%Ld\n", q);
19957 }
19958 EOCP
19959         set try
19960         if eval $compile; then
19961                 yyy=`$run ./try`
19962                 case "$yyy" in
19963                 12345678901)
19964                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19965                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19966                         echo "We will use %Ld."
19967                         ;;
19968                 esac
19969         fi
19970 fi
19971
19972 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19973         $cat >try.c <<'EOCP'
19974 #include <sys/types.h>
19975 #include <stdio.h>
19976 int main() {
19977   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19978   printf("%lld\n", q);
19979 }
19980 EOCP
19981         set try
19982         if eval $compile; then
19983                 yyy=`$run ./try`
19984                 case "$yyy" in
19985                 12345678901)
19986                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19987                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19988                         echo "We will use the %lld style."
19989                         ;;
19990                 esac
19991         fi
19992 fi
19993
19994 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19995         $cat >try.c <<EOCP
19996 #include <sys/types.h>
19997 #include <stdio.h>
19998 int main() {
19999   $quadtype q = 12345678901;
20000   printf("%qd\n", q);
20001 }
20002 EOCP
20003         set try
20004         if eval $compile; then
20005                 yyy=`$run ./try`
20006                 case "$yyy" in
20007                 12345678901)
20008                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20009                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20010                         echo "We will use %qd."
20011                         ;;
20012                 esac
20013         fi
20014 fi
20015
20016 if $test X"$sPRId64" = X; then
20017         echo "Cannot figure out how to print 64-bit integers." >&4
20018 fi
20019 $rm_try
20020
20021 fi
20022
20023 case "$sPRId64" in
20024 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20025         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20026         ;;
20027 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20028         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20029         ;;
20030 esac
20031
20032 : Check format strings for internal types
20033 echo " "
20034 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20035
20036 if $test X"$ivsize" = X8; then
20037         ivdformat="$sPRId64"
20038         uvuformat="$sPRIu64"
20039         uvoformat="$sPRIo64"
20040         uvxformat="$sPRIx64"
20041         uvXUformat="$sPRIXU64"
20042 else
20043         if $test X"$ivsize" = X"$longsize"; then
20044                 ivdformat='"ld"'
20045                 uvuformat='"lu"'
20046                 uvoformat='"lo"'
20047                 uvxformat='"lx"'
20048                 uvXUformat='"lX"'
20049         else
20050                 if $test X"$ivsize" = X"$intsize"; then
20051                         ivdformat='"d"'
20052                         uvuformat='"u"'
20053                         uvoformat='"o"'
20054                         uvxformat='"x"'
20055                         uvXUformat='"X"'
20056                 else
20057                         : far out
20058                         if $test X"$ivsize" = X"$shortsize"; then
20059                                 ivdformat='"hd"'
20060                                 uvuformat='"hu"'
20061                                 uvoformat='"ho"'
20062                                 uvxformat='"hx"'
20063                                 uvXUformat='"hX"'
20064                         fi
20065                 fi
20066         fi
20067 fi
20068
20069 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20070         nveformat="$sPRIeldbl"
20071         nvfformat="$sPRIfldbl"
20072         nvgformat="$sPRIgldbl"
20073         nvEUformat="$sPRIEUldbl"
20074         nvFUformat="$sPRIFUldbl"
20075         nvGUformat="$sPRIGUldbl"
20076 else
20077         nveformat='"e"'
20078         nvfformat='"f"'
20079         nvgformat='"g"'
20080         nvEUformat='"E"'
20081         nvFUformat='"F"'
20082         nvGUformat='"G"'
20083 fi
20084
20085 case "$ivdformat" in
20086 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20087     exit 1
20088     ;;
20089 esac
20090
20091 : Check format string for GID
20092
20093 echo " "
20094 $echo "Checking the format string to be used for gids..." >&4
20095
20096 case "$gidsign" in
20097 -1)     if $test X"$gidsize" = X"$ivsize"; then
20098                 gidformat="$ivdformat"
20099         else
20100                 if $test X"$gidsize" = X"$longsize"; then
20101                         gidformat='"ld"'
20102                 else
20103                         if $test X"$gidsize" = X"$intsize"; then
20104                                 gidformat='"d"'
20105                         else
20106                                 if $test X"$gidsize" = X"$shortsize"; then
20107                                         gidformat='"hd"'
20108                                 fi
20109                         fi
20110                 fi
20111         fi
20112         ;;
20113 *)      if $test X"$gidsize" = X"$uvsize"; then
20114                 gidformat="$uvuformat"
20115         else
20116                 if $test X"$gidsize" = X"$longsize"; then
20117                         gidformat='"lu"'
20118                 else
20119                         if $test X"$gidsize" = X"$intsize"; then
20120                                 gidformat='"u"'
20121                         else
20122                                 if $test X"$gidsize" = X"$shortsize"; then
20123                                         gidformat='"hu"'
20124                                 fi
20125                         fi
20126                 fi
20127         fi
20128         ;;
20129 esac
20130
20131 : see if getgroups exists
20132 set getgroups d_getgrps
20133 eval $inlibc
20134
20135 : see if setgroups exists
20136 set setgroups d_setgrps
20137 eval $inlibc
20138
20139 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20140 echo " "
20141 case "$d_getgrps$d_setgrps" in
20142 *define*)
20143         case "$groupstype" in
20144         '') dflt="$gidtype" ;;
20145         *)  dflt="$groupstype" ;;
20146         esac
20147         $cat <<EOM
20148 What type of pointer is the second argument to getgroups() and setgroups()?
20149 Usually this is the same as group ids, $gidtype, but not always.
20150
20151 EOM
20152         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20153         . ./myread
20154         groupstype="$ans"
20155         ;;
20156 *)  groupstype="$gidtype";;
20157 esac
20158
20159 : MAD = Misc Attribute Definition
20160
20161 if $test $patchlevel -lt 9; then
20162 : MAD is not available in 5.8.x or earlier.
20163     ans=n;
20164 else
20165     case "$mad" in
20166     $define|true|[yY]*) dflt='y' ;;
20167     *)                  dflt='n' ;;
20168     esac
20169     cat <<EOM
20170
20171 Would you like to build with Misc Attribute Decoration? This is development
20172 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20173 overhead on the interpreter.
20174
20175 If this doesn't make any sense to you, just accept the default '$dflt'.
20176 EOM
20177     rp='Build Perl with MAD?'
20178     . ./myread
20179 fi
20180 case "$ans" in
20181 y|Y)    val="$define"
20182         madlyh='madly.h madly.act madly.tab'
20183         madlysrc='madly.c'
20184         madlyobj="madly$_o" ;;
20185 *)      val="$undef"
20186         madlyh=''
20187         madlysrc=''
20188         madlyobj='' ;;
20189 esac
20190 set mad
20191 eval $setvar
20192
20193 : check whether make sets MAKE
20194 echo " "
20195 echo "Checking if your $make program sets \$(MAKE)..." >&4
20196 case "$make_set_make" in
20197 '')
20198         $sed 's/^X //' > testmake.mak << 'EOF'
20199 Xall:
20200 X       @echo 'maketemp="$(MAKE)"'
20201 EOF
20202         case "`$make -f testmake.mak 2>/dev/null`" in
20203         *maketemp=*) make_set_make='#' ;;
20204         *)      make_set_make="MAKE=$make" ;;
20205         esac
20206         $rm -f testmake.mak
20207         ;;
20208 esac
20209 case "$make_set_make" in
20210 '#') echo "Yup, it does.";;
20211 *) echo "Nope, it doesn't.";;
20212 esac
20213
20214 : see what type is used for mode_t
20215 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20216 set mode_t modetype int stdio.h sys/types.h
20217 eval $typedef_ask
20218
20219 : see if we need va_copy
20220 echo " "
20221 case "$i_stdarg" in
20222 "$define")
20223         $cat >try.c <<EOCP
20224 #include <stdarg.h>
20225 #include <stdio.h>
20226 #$i_stdlib I_STDLIB
20227 #ifdef I_STDLIB
20228 #include <stdlib.h>
20229 #endif
20230 #include <signal.h>
20231
20232 int
20233 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20234 {
20235   return vfprintf(f, fmt, *valp);
20236 }
20237
20238 int
20239 myvfprintf(FILE *f, const  char *fmt, va_list val)
20240 {
20241   return ivfprintf(f, fmt, &val);
20242 }
20243
20244 int
20245 myprintf(char *fmt, ...)
20246 {
20247   va_list val;
20248   va_start(val, fmt);
20249   return myvfprintf(stdout, fmt, val);
20250 }
20251
20252 int
20253 main(int ac, char **av)
20254 {
20255   signal(SIGSEGV, exit);
20256
20257   myprintf("%s%cs all right, then\n", "that", '\'');
20258   exit(0);
20259 }
20260 EOCP
20261         set try
20262         if eval $compile && $run ./try 2>&1 >/dev/null; then
20263                 case "`$run ./try`" in
20264                 "that's all right, then")
20265                         okay=yes
20266                         ;;
20267                 esac
20268         fi
20269         case "$okay" in
20270         yes)    echo "It seems that you don't need va_copy()." >&4
20271                 need_va_copy="$undef"
20272                 ;;
20273         *)      echo "It seems that va_copy() or similar will be needed." >&4
20274                 need_va_copy="$define"
20275                 ;;
20276         esac
20277         $rm_try
20278         ;;
20279 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20280         need_va_copy="$undef"
20281         ;;
20282 esac
20283
20284 : see what type is used for size_t
20285 rp="What is the type used for the length parameter for string functions?"
20286 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20287 eval $typedef_ask
20288
20289 : check for type of arguments to gethostbyaddr. 
20290 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20291         case "$d_gethbyaddr" in
20292         $define)
20293                 $cat <<EOM
20294
20295 Checking to see what type of arguments are accepted by gethostbyaddr().
20296 EOM
20297                 hdrs="$define sys/types.h
20298                         $d_socket sys/socket.h 
20299                         $i_niin netinet/in.h 
20300                         $i_netdb netdb.h
20301                         $i_unistd unistd.h"
20302                 : The first arg can 'char *' or 'void *'
20303                 : The second arg is some of integral type
20304                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20305                         for yyy in size_t long int; do
20306                                 case "$netdb_host_type" in
20307                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20308                                         if ./protochk "$try" $hdrs; then
20309                                                 echo "Your system accepts $xxx for the first arg."
20310                                                 echo "...and $yyy for the second arg."
20311                                                 netdb_host_type="$xxx"
20312                                                 netdb_hlen_type="$yyy"
20313                                         fi
20314                                         ;;
20315                                 esac
20316                         done
20317                 done
20318                 : In case none of those worked, prompt the user.
20319                 case "$netdb_host_type" in
20320                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20321                         dflt='char *'
20322                         . ./myread
20323                         netdb_host_type=$ans
20324                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20325                         dflt="$sizetype"
20326                         . ./myread
20327                         netdb_hlen_type=$ans
20328                         ;;
20329                 esac
20330                 ;;
20331         *)      : no gethostbyaddr, so pick harmless defaults
20332                 netdb_host_type='char *'
20333                 netdb_hlen_type="$sizetype"
20334                 ;;
20335         esac
20336         # Remove the "const" if needed. -- but then we'll have a 
20337         # prototype clash!
20338         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20339 fi
20340
20341 : check for type of argument to gethostbyname. 
20342 if test "X$netdb_name_type" = X ; then
20343         case "$d_gethbyname" in
20344         $define)
20345                 $cat <<EOM
20346
20347 Checking to see what type of argument is accepted by gethostbyname().
20348 EOM
20349                 hdrs="$define sys/types.h
20350                         $d_socket sys/socket.h 
20351                         $i_niin netinet/in.h 
20352                         $i_netdb netdb.h
20353                         $i_unistd unistd.h"
20354                 for xxx in "const char *" "char *"; do
20355                         case "$netdb_name_type" in
20356                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20357                                 if ./protochk "$try" $hdrs; then
20358                                         echo "Your system accepts $xxx."
20359                                         netdb_name_type="$xxx"
20360                                 fi
20361                                 ;;
20362                         esac
20363                 done
20364                 : In case none of those worked, prompt the user.
20365                 case "$netdb_name_type" in
20366                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20367                         dflt='char *'
20368                         . ./myread
20369                         netdb_name_type=$ans
20370                         ;;
20371                 esac
20372                 ;;
20373         *)      : no gethostbyname, so pick harmless default
20374                 netdb_name_type='char *'
20375                 ;;
20376         esac
20377 fi
20378
20379 : check for type of 1st argument to getnetbyaddr. 
20380 if test "X$netdb_net_type" = X ; then
20381         case "$d_getnbyaddr" in
20382         $define)
20383                 $cat <<EOM
20384
20385 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20386 EOM
20387                 hdrs="$define sys/types.h
20388                         $d_socket sys/socket.h 
20389                         $i_niin netinet/in.h 
20390                         $i_netdb netdb.h
20391                         $i_unistd unistd.h"
20392                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20393                         case "$netdb_net_type" in
20394                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20395                                 if ./protochk "$try" $hdrs; then
20396                                         echo "Your system accepts $xxx."
20397                                         netdb_net_type="$xxx"
20398                                 fi
20399                                 ;;
20400                         esac
20401                 done
20402                 : In case none of those worked, prompt the user.
20403                 case "$netdb_net_type" in
20404                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20405                         dflt='long'
20406                         . ./myread
20407                         netdb_net_type=$ans
20408                         ;;
20409                 esac
20410                 ;;
20411         *)      : no getnetbyaddr, so pick harmless default
20412                 netdb_net_type='long'
20413                 ;;
20414         esac
20415 fi
20416 : locate the preferred pager for this system
20417 fn=f/
20418 case "$pager" in
20419 '')
20420         dflt=''
20421         case "$pg" in
20422         /*) dflt=$pg;;
20423         [a-zA-Z]:/*) dflt=$pg;;
20424         esac
20425         case "$more" in
20426         /*) dflt=$more;;
20427         [a-zA-Z]:/*) dflt=$more;;
20428         esac
20429         case "$less" in
20430         /*) dflt=$less;;
20431         [a-zA-Z]:/*) dflt=$less;;
20432         esac
20433         case "$dflt" in
20434         '') dflt=/usr/ucb/more;;
20435         esac
20436         ;;
20437 *)      dflt="$pager"
20438         ;;
20439 esac
20440 fn="f/($dflt)"
20441 echo " "
20442 rp='What pager is used on your system?'
20443 . ./getfile
20444 pager="$ans"
20445
20446 : see what type pids are declared as in the kernel
20447 rp="What is the type of process ids on this system?"
20448 set pid_t pidtype int stdio.h sys/types.h
20449 eval $typedef_ask
20450
20451 : see if ar generates random libraries by itself
20452 echo " "
20453 echo "Checking how to generate random libraries on your machine..." >&4
20454 echo 'int bar1() { return bar2(); }' > bar1.c
20455 echo 'int bar2() { return 2; }' > bar2.c
20456 $cat > foo.c <<EOP
20457 #$i_stdlib I_STDLIB
20458 #ifdef I_STDLIB
20459 #include <stdlib.h>
20460 #endif
20461 int main() { printf("%d\n", bar1()); exit(0); }
20462 EOP
20463 $cc $ccflags -c bar1.c >/dev/null 2>&1
20464 $cc $ccflags -c bar2.c >/dev/null 2>&1
20465 $cc $ccflags -c foo.c >/dev/null 2>&1
20466 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20467 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20468         $run ./foobar >/dev/null 2>&1; then
20469         echo "$ar appears to generate random libraries itself."
20470         orderlib=false
20471         if [ "X$ranlib" = "X" ]; then
20472             ranlib=":"
20473         fi
20474 elif $ar s bar$_a >/dev/null 2>&1 &&
20475         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20476         $run ./foobar >/dev/null 2>&1; then
20477                 echo "a table of contents needs to be added with '$ar s'."
20478                 orderlib=false
20479                 ranlib="$ar s"
20480 elif $ar ts bar$_a >/dev/null 2>&1 &&
20481         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20482         $run ./foobar >/dev/null 2>&1; then
20483                 echo "a table of contents needs to be added with '$ar ts'."
20484                 orderlib=false
20485                 ranlib="$ar ts"
20486 else
20487         case "$ranlib" in
20488         :) ranlib='';;
20489         '')
20490                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20491                 $test -f $ranlib || ranlib=''
20492                 ;;
20493         esac
20494         if $test -n "$ranlib"; then
20495                 echo "your system has '$ranlib'; we'll use that."
20496                 orderlib=false
20497         else
20498                 echo "your system doesn't seem to support random libraries"
20499                 echo "so we'll use lorder and tsort to order the libraries."
20500                 orderlib=true
20501                 ranlib=":"
20502         fi
20503 fi
20504 $rm -f foo* bar*
20505
20506 : see if this is a values.h system
20507 set values.h i_values
20508 eval $inhdr
20509
20510 : Check the max offset that gmtime and localtime accept
20511 echo "Checking max offsets that gmtime () accepts"
20512
20513 case $i_values in
20514     define) yyy="#include <values.h>" ;;
20515     *)      yyy="" ;;
20516     esac
20517
20518 case "$sGMTIME_min/$sGMTIME_max" in
20519     0/0|/)
20520         $cat >try.c <<EOCP
20521 #include <sys/types.h>
20522 #include <stdio.h>
20523 #include <time.h>
20524 $yyy
20525
20526 int i;
20527 struct tm *tmp;
20528 time_t pt;
20529
20530 void gm_check (time_t t, int min_year, int max_year)
20531 {
20532     tmp = gmtime (&t);
20533     if ( tmp == NULL ||
20534         /* Check tm_year overflow */
20535          tmp->tm_year < min_year || tmp->tm_year > max_year)
20536         tmp = NULL;
20537     else
20538         pt = t;
20539     } /* gm_check */
20540
20541 int check_max ()
20542 {
20543     tmp = NULL;
20544     pt  = 0;
20545 #ifdef MAXLONG
20546     gm_check (MAXLONG, 69, 0x7fffffff);
20547 #endif
20548     if (tmp == NULL || tmp->tm_year < 0) {
20549         for (i = 63; i >= 0; i--) {
20550             time_t x = pt | ((time_t)1 << i);
20551             if (x < 0 || x < pt) continue;
20552             gm_check (x, 69, 0x7fffffff);
20553             }
20554         }
20555     printf ("sGMTIME_max=%ld\n", pt);
20556     return (0);
20557     } /* check_max */
20558
20559 int check_min ()
20560 {
20561     tmp = NULL;
20562     pt  = 0;
20563 #ifdef MINLONG
20564     gm_check (MINLONG, -1900, 70);
20565 #endif
20566     if (tmp == NULL) {
20567         for (i = 36; i >= 0; i--) {
20568             time_t x = pt - ((time_t)1 << i);
20569             if (x > 0) continue;
20570             gm_check (x, -1900, 70);
20571             }
20572         }
20573     printf ("sGMTIME_min=%ld\n", pt);
20574     return (0);
20575     } /* check_min */
20576
20577 int main (int argc, char *argv[])
20578 {
20579     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20580     check_max ();
20581     check_min ();
20582     return (0);
20583     } /* main */
20584 EOCP
20585         set try
20586         if eval $compile; then
20587             eval `$run ./try`
20588         else
20589             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20590             fi
20591         $rm_try
20592         ;;
20593     esac
20594
20595 echo "Checking max offsets that localtime () accepts"
20596
20597 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20598     0/0|/)
20599         $cat >try.c <<EOCP
20600 #include <sys/types.h>
20601 #include <stdio.h>
20602 #include <time.h>
20603 $yyy
20604
20605 int i;
20606 struct tm *tmp;
20607 time_t pt;
20608
20609 void local_check (time_t t, int min_year, int max_year)
20610 {
20611     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20612         tmp = NULL;
20613     else
20614         tmp = localtime (&t);
20615     if ( tmp == NULL ||
20616         /* Check tm_year overflow */
20617          tmp->tm_year < min_year || tmp->tm_year > max_year)
20618         tmp = NULL;
20619     else
20620         pt = t;
20621     } /* local_check */
20622
20623 int check_max ()
20624 {
20625     tmp = NULL;
20626     pt  = 0;
20627 #ifdef MAXLONG
20628     local_check (MAXLONG, 69, 0x7fffffff);
20629 #endif
20630     if (tmp == NULL || tmp->tm_year < 0) {
20631         for (i = 63; i >= 0; i--) {
20632             time_t x = pt | ((time_t)1 << i);
20633             if (x < 0 || x < pt) continue;
20634             local_check (x, 69, 0x7fffffff);
20635             }
20636         }
20637     printf ("sLOCALTIME_max=%ld\n", pt);
20638     return (0);
20639    } /* check_max */
20640
20641 int check_min ()
20642 {
20643     tmp = NULL;
20644     pt  = 0;
20645 #ifdef MINLONG
20646     local_check (MINLONG, -1900, 70);
20647 #endif
20648     if (tmp == NULL) {
20649         for (i = 36; i >= 0; i--) {
20650             time_t x = pt - ((time_t)1 << i);
20651             if (x > 0) continue;
20652             local_check (x, -1900, 70);
20653             }
20654         }
20655     printf ("sLOCALTIME_min=%ld\n", pt);
20656     return (0);
20657     } /* check_min */
20658
20659 int main (int argc, char *argv[])
20660 {
20661     check_max ();
20662     check_min ();
20663     return (0);
20664     } /* main */
20665 EOCP
20666         set try
20667         if eval $compile; then
20668             eval `$run ./try`
20669         else
20670             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20671             fi
20672         $rm_try
20673         ;;
20674     esac
20675
20676 : check for type of arguments to select.
20677 case "$selecttype" in
20678 '') case "$d_select" in
20679         $define)
20680                 echo " "
20681                 $cat <<EOM
20682 Checking to see what type of arguments are accepted by select().
20683 EOM
20684                 hdrs="$define sys/types.h
20685                         $i_systime sys/time.h
20686                         $i_sysselct sys/select.h
20687                         $d_socket sys/socket.h"
20688                 : The first arg can be int, unsigned, or size_t
20689                 : The last arg may or may not be 'const'
20690                 val=''
20691                 : void pointer has been seen but using that
20692                 : breaks the selectminbits test
20693                 for xxx in 'fd_set *' 'int *'; do
20694                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20695                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20696                                         case "$val" in
20697                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20698                                                 if ./protochk "$try" $hdrs; then
20699                                                         echo "Your system accepts $xxx."
20700                                                         val="$xxx"
20701                                                 fi
20702                                                 ;;
20703                                         esac
20704                                 done
20705                         done
20706                 done
20707                 case "$val" in
20708                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20709                         case "$d_fd_set" in
20710                                 $define) dflt="fd_set *" ;;
20711                                 *)              dflt="int *" ;;
20712                         esac
20713                         . ./myread
20714                         val=$ans
20715                         ;;
20716                 esac
20717                 selecttype="$val"
20718                 ;;
20719         *)      : no select, so pick a harmless default
20720                 selecttype='int *'
20721                 ;;
20722         esac
20723         ;;
20724 esac
20725
20726 : check for the select 'width'
20727 case "$selectminbits" in
20728 '') safebits=`expr $ptrsize \* 8`
20729     case "$d_select" in
20730         $define)
20731                 $cat <<EOM
20732
20733 Checking to see on how many bits at a time your select() operates...
20734 EOM
20735                 $cat >try.c <<EOCP
20736 #include <sys/types.h>
20737 #$i_time I_TIME
20738 #$i_systime I_SYS_TIME
20739 #$i_systimek I_SYS_TIME_KERNEL
20740 #ifdef I_TIME
20741 #   include <time.h>
20742 #endif
20743 #ifdef I_SYS_TIME
20744 #   ifdef I_SYS_TIME_KERNEL
20745 #       define KERNEL
20746 #   endif
20747 #   include <sys/time.h>
20748 #   ifdef I_SYS_TIME_KERNEL
20749 #       undef KERNEL
20750 #   endif
20751 #endif
20752 #$i_sysselct I_SYS_SELECT
20753 #ifdef I_SYS_SELECT
20754 #include <sys/select.h>
20755 #endif
20756 #$d_socket HAS_SOCKET
20757 #ifdef HAS_SOCKET
20758 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20759 #endif
20760 #include <stdio.h>
20761 #$i_stdlib I_STDLIB
20762 #ifdef I_STDLIB
20763 #include <stdlib.h>
20764 #endif
20765 $selecttype b;
20766 #define S sizeof(*(b))
20767 #define MINBITS 64
20768 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20769 #define NBITS  (NBYTES * 8)
20770 int main() {
20771     char *s = (char *)malloc(NBYTES);
20772     struct timeval t;
20773     int i;
20774     FILE* fp;
20775     int fd;
20776
20777     if (!s)
20778         exit(1);
20779     fclose(stdin);
20780     fp = fopen("try.c", "r");
20781     if (fp == 0)
20782       exit(2);
20783     fd = fileno(fp);
20784     if (fd < 0)
20785       exit(3);
20786     b = ($selecttype)s;
20787     for (i = 0; i < NBITS; i++)
20788         FD_SET(i, b);
20789     t.tv_sec  = 0;
20790     t.tv_usec = 0;
20791     select(fd + 1, b, 0, 0, &t);
20792     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20793     free(s);
20794     printf("%d\n", i + 1);
20795     return 0;
20796 }
20797 EOCP
20798                 set try
20799                 if eval $compile_ok; then
20800                         selectminbits=`$run ./try`
20801                         case "$selectminbits" in
20802                         '')     cat >&4 <<EOM
20803 Cannot figure out on how many bits at a time your select() operates.
20804 I'll play safe and guess it is $safebits bits.
20805 EOM
20806                                 selectminbits=$safebits
20807                                 bits="$safebits bits"
20808                                 ;;
20809                         1)      bits="1 bit" ;;
20810                         *)      bits="$selectminbits bits" ;;
20811                         esac
20812                         echo "Your select() operates on $bits at a time." >&4
20813                 else
20814                         rp='What is the minimum number of bits your select() operates on?'
20815                         case "$byteorder" in
20816                         12345678)       dflt=64 ;;
20817                         1234)           dflt=32 ;;
20818                         *)              dflt=1  ;;
20819                         esac
20820                         . ./myread
20821                         val=$ans
20822                         selectminbits="$val"
20823                 fi
20824                 $rm_try
20825                 ;;
20826         *)      : no select, so pick a harmless default
20827                 selectminbits=$safebits
20828                 ;;
20829         esac
20830         ;;
20831 esac
20832
20833 : Trace out the files included by signal.h, then look for SIGxxx names.
20834 if [ "X$fieldn" = X ]; then
20835         : Just make some guesses.  We check them later.
20836         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
20837 else
20838         xxx=`echo '#include <signal.h>' |
20839         $cppstdin $cppminus $cppflags 2>/dev/null |
20840         $grep '^[       ]*#.*include' |
20841         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20842                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20843 fi
20844 xxxfiles=''
20845 for xx in $xxx /dev/null ; do
20846         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20847 done
20848 case "$xxxfiles" in
20849 '')     xxxfiles=`./findhdr signal.h` ;;
20850 esac
20851 xxx=`awk '
20852 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20853         print substr($2, 4, 20)
20854 }
20855 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20856         print substr($3, 4, 20)
20857 }' $xxxfiles`
20858 : Append some common names just in case the awk scan failed.
20859 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20860 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20861 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20862 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20863 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20864
20865 : generate a few handy files for later
20866 $cat > signal.c <<EOCP
20867 #include <sys/types.h>
20868 #include <signal.h>
20869 #$i_stdlib I_STDLIB
20870 #ifdef I_STDLIB
20871 #include <stdlib.h>
20872 #endif
20873 #include <stdio.h>
20874 int main() {
20875
20876 /* Strange style to avoid deeply-nested #if/#else/#endif */
20877 #ifndef NSIG
20878 #  ifdef _NSIG
20879 #    define NSIG (_NSIG)
20880 #  endif
20881 #endif
20882
20883 #ifndef NSIG
20884 #  ifdef SIGMAX
20885 #    define NSIG (SIGMAX+1)
20886 #  endif
20887 #endif
20888
20889 #ifndef NSIG
20890 #  ifdef SIG_MAX
20891 #    define NSIG (SIG_MAX+1)
20892 #  endif
20893 #endif
20894
20895 #ifndef NSIG
20896 #  ifdef _SIG_MAX
20897 #    define NSIG (_SIG_MAX+1)
20898 #  endif
20899 #endif
20900
20901 #ifndef NSIG
20902 #  ifdef MAXSIG
20903 #    define NSIG (MAXSIG+1)
20904 #  endif
20905 #endif
20906
20907 #ifndef NSIG
20908 #  ifdef MAX_SIG
20909 #    define NSIG (MAX_SIG+1)
20910 #  endif
20911 #endif
20912
20913 #ifndef NSIG
20914 #  ifdef SIGARRAYSIZE
20915 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20916 #  endif
20917 #endif
20918
20919 #ifndef NSIG
20920 #  ifdef _sys_nsig
20921 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20922 #  endif
20923 #endif
20924
20925 /* Default to some arbitrary number that's big enough to get most
20926    of the common signals.
20927 */
20928 #ifndef NSIG
20929 #    define NSIG 50
20930 #endif
20931
20932 printf("NSIG %d\n", NSIG);
20933
20934 #ifndef JUST_NSIG
20935
20936 EOCP
20937
20938 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20939 {
20940         printf "#ifdef SIG"; printf $1; printf "\n"
20941         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20942         printf $1; printf ");\n"
20943         printf "#endif\n"
20944 }
20945 END {
20946         printf "#endif /* JUST_NSIG */\n";
20947         printf "exit(0);\n}\n";
20948 }
20949 ' >>signal.c
20950 $cat >signal.awk <<'EOP'
20951 BEGIN { ndups = 0 }
20952 $1 ~ /^NSIG$/ { nsig = $2 }
20953 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20954     if ($2 > maxsig) { maxsig = $2 }
20955     if (sig_name[$2]) {
20956         dup_name[ndups] = $1
20957         dup_num[ndups] = $2
20958         ndups++
20959     }
20960     else {
20961         sig_name[$2] = $1
20962         sig_num[$2] = $2
20963     }
20964 }
20965 END {
20966     if (nsig == 0) {
20967         nsig = maxsig + 1
20968     }
20969     printf("NSIG %d\n", nsig);
20970     for (n = 1; n < nsig; n++) {
20971         if (sig_name[n]) {
20972             printf("%s %d\n", sig_name[n], sig_num[n])
20973         }
20974         else {
20975             printf("NUM%d %d\n", n, n)
20976         }
20977     }
20978     for (n = 0; n < ndups; n++) {
20979         printf("%s %d\n", dup_name[n], dup_num[n])
20980     }
20981 }
20982 EOP
20983 $cat >signal_cmd <<EOS
20984 $startsh
20985 if $test -s signal.lst; then
20986     echo "Using your existing signal.lst file"
20987         exit 0
20988 fi
20989 xxx="$xxx"
20990 EOS
20991 $cat >>signal_cmd <<'EOS'
20992
20993 set signal
20994 if eval $compile_ok; then
20995         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20996                 $uniq | $awk -f signal.awk >signal.lst
20997 else
20998         echo "(I can't seem be able to compile the whole test program)" >&4
20999         echo "(I'll try it in little pieces.)" >&4
21000         set signal -DJUST_NSIG
21001         if eval $compile_ok; then
21002                 $run ./signal$_exe > signal.nsg
21003                 $cat signal.nsg
21004         else
21005                 echo "I can't seem to figure out how many signals you have." >&4
21006                 echo "Guessing 50." >&4
21007                 echo 'NSIG 50' > signal.nsg
21008         fi
21009         : Now look at all the signal names, one at a time.
21010         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21011                 $cat > signal.c <<EOCP
21012 #include <sys/types.h>
21013 #include <signal.h>
21014 #include <stdio.h>
21015 int main() {
21016 printf("$xx %d\n", SIG${xx});
21017 return 0;
21018 }
21019 EOCP
21020                 set signal
21021                 if eval $compile; then
21022                         echo "SIG${xx} found."
21023                         $run ./signal$_exe  >> signal.ls1
21024                 else
21025                         echo "SIG${xx} NOT found."
21026                 fi
21027         done
21028         if $test -s signal.ls1; then
21029                 $cat signal.nsg signal.ls1 |
21030                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21031         fi
21032
21033 fi
21034 if $test -s signal.lst; then
21035         :
21036 else
21037         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21038         echo 'kill -l' >signal
21039         set X `csh -f <signal`
21040         $rm -f signal
21041         shift
21042         case $# in
21043         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21044         esac
21045         echo $@ | $tr ' ' $trnl | \
21046             $awk '{ printf "%s %d\n", $1, ++s; }
21047                   END { printf "NSIG %d\n", ++s }' >signal.lst
21048 fi
21049 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21050 EOS
21051 chmod a+x signal_cmd
21052 $eunicefix signal_cmd
21053
21054 : generate list of signal names
21055 echo " "
21056 case "$sig_name_init" in
21057 '') doinit=yes ;;
21058 *)  case "$sig_num_init" in
21059     ''|*,*) doinit=yes ;;
21060     esac ;;
21061 esac
21062 case "$doinit" in
21063 yes)
21064         echo "Generating a list of signal names and numbers..." >&4
21065         . ./signal_cmd
21066         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21067         sig_name=`$awk 'BEGIN { printf "ZERO " }
21068                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21069         sig_num=`$awk  'BEGIN { printf "0 " }
21070                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21071         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21072                              !/^NSIG/   { printf "\"%s\", ", $1 }
21073                              END        { printf "0\n" }' signal.lst`
21074         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21075                              !/^NSIG/   { printf "%d, ", $2}
21076                              END        { printf "0\n"}' signal.lst`
21077         ;;
21078 esac
21079 echo "The following $sig_count signals are available:"
21080 echo " "
21081 echo $sig_name | $awk \
21082 'BEGIN { linelen = 0 }
21083 {
21084         for (i = 1; i <= NF; i++) {
21085                 name = "SIG" $i " "
21086                 linelen = linelen + length(name)
21087                 if (linelen > 70) {
21088                         printf "\n"
21089                         linelen = length(name)
21090                 }
21091                 printf "%s", name
21092         }
21093         printf "\n"
21094 }'
21095 sig_size=`echo $sig_name | awk '{print NF}'`
21096 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21097
21098 : Check size of size
21099 echo " "
21100 case "$sizetype" in
21101 *_t) zzz="$sizetype"    ;;
21102 *)   zzz="filesize"     ;;
21103 esac
21104 echo "Checking the size of $zzz..." >&4
21105 cat > try.c <<EOCP
21106 #include <sys/types.h>
21107 #include <stdio.h>
21108 #$i_stdlib I_STDLIB
21109 #ifdef I_STDLIB
21110 #include <stdlib.h>
21111 #endif
21112 int main() {
21113     printf("%d\n", (int)sizeof($sizetype));
21114     exit(0);
21115 }
21116 EOCP
21117 set try
21118 if eval $compile_ok; then
21119         yyy=`$run ./try`
21120         case "$yyy" in
21121         '')     sizesize=4
21122                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21123                 ;;
21124         *)      sizesize=$yyy
21125                 echo "Your $zzz size is $sizesize bytes."
21126                 ;;
21127         esac
21128 else
21129         sizesize=4
21130         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21131 fi
21132
21133
21134 : check for socklen_t
21135 echo " "
21136 echo "Checking to see if you have socklen_t..." >&4
21137 $cat >try.c <<EOCP
21138 #include <sys/types.h>
21139 #$d_socket HAS_SOCKET
21140 #ifdef HAS_SOCKET
21141 #include <sys/socket.h>
21142 #endif
21143 int main() { socklen_t x = 16; }
21144 EOCP
21145 set try
21146 if eval $compile; then
21147         val="$define"
21148         echo "You have socklen_t."
21149 else
21150         val="$undef"
21151         echo "You do not have socklen_t."
21152         case "$sizetype" in
21153         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21154         esac
21155 fi
21156 $rm_try
21157 set d_socklen_t
21158 eval $setvar
21159
21160 : see if this is a socks.h system
21161 set socks.h i_socks
21162 eval $inhdr
21163
21164 : check for type of the size argument to socket calls
21165 case "$d_socket" in
21166 "$define")
21167         $cat <<EOM
21168
21169 Checking to see what type is the last argument of accept().
21170 EOM
21171         yyy=''
21172         case "$d_socklen_t" in
21173         "$define") yyy="$yyy socklen_t"
21174         esac
21175         yyy="$yyy $sizetype int long unsigned"
21176         for xxx in $yyy; do
21177                 case "$socksizetype" in
21178                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21179                         case "$usesocks" in
21180                         "$define")
21181                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21182                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21183                                         socksizetype="$xxx"
21184                                 fi
21185                                 ;;
21186                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21187                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21188                                         socksizetype="$xxx"
21189                                 fi
21190                                 ;;
21191                         esac
21192                         ;;
21193                 esac
21194         done
21195 : In case none of those worked, prompt the user.
21196         case "$socksizetype" in
21197         '')     rp='What is the type for socket address structure sizes?'
21198                 dflt='int'
21199                 . ./myread
21200                 socksizetype=$ans
21201                 ;;
21202         esac
21203         ;;
21204 *)      : no sockets, so pick relatively harmless default
21205         socksizetype='int'
21206         ;;
21207 esac
21208
21209 : see what type is used for signed size_t
21210 set ssize_t ssizetype int stdio.h sys/types.h
21211 eval $typedef
21212 dflt="$ssizetype"
21213 $cat > try.c <<EOM
21214 #include <stdio.h>
21215 #$i_stdlib I_STDLIB
21216 #ifdef I_STDLIB
21217 #include <stdlib.h>
21218 #endif
21219 #include <sys/types.h>
21220 #define Size_t $sizetype
21221 #define SSize_t $dflt
21222 int main()
21223 {
21224         if (sizeof(Size_t) == sizeof(SSize_t))
21225                 printf("$dflt\n");
21226         else if (sizeof(Size_t) == sizeof(int))
21227                 printf("int\n");
21228         else
21229                 printf("long\n");
21230         exit(0);
21231 }
21232 EOM
21233 echo " "
21234 set try
21235 if eval $compile_ok && $run ./try > /dev/null; then
21236         ssizetype=`$run ./try`
21237         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21238 else
21239         $cat >&4 <<EOM
21240 Help! I can't compile and run the ssize_t test program: please enlighten me!
21241 (This is probably a misconfiguration in your system or libraries, and
21242 you really ought to fix it.  Still, I'll try anyway.)
21243
21244 I need a type that is the same size as $sizetype, but is guaranteed to
21245 be signed.  Common values are ssize_t, int and long.
21246
21247 EOM
21248         rp="What signed type is the same size as $sizetype?"
21249         . ./myread
21250         ssizetype="$ans"
21251 fi
21252 $rm_try
21253
21254 : Check the size of st_ino
21255 $echo " "
21256 $echo "Checking the size of st_ino..." >&4
21257 $cat > try.c <<EOCP
21258 #include <sys/stat.h>
21259 #include <stdio.h>
21260 #$i_stdlib I_STDLIB
21261 #ifdef I_STDLIB
21262 #include <stdlib.h>
21263 #endif
21264 int main() {
21265     struct stat st;
21266     printf("%d\n", (int)sizeof(st.st_ino));
21267     exit(0);
21268 }
21269 EOCP
21270 set try
21271 if eval $compile_ok; then
21272         val=`$run ./try`
21273         case "$val" in
21274         '')     st_ino_size=4
21275                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21276                 ;;
21277         *)      st_ino_size=$val
21278                 $echo "Your st_ino is $st_ino_size bytes long."
21279                 ;;
21280         esac
21281 else
21282         st_ino_size=4
21283         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21284 fi
21285 $rm_try
21286
21287 : Check if st_ino is signed
21288 $echo " "
21289 $echo "Checking the sign of st_ino..." >&4
21290 $cat > try.c <<EOCP
21291 #include <sys/stat.h>
21292 #include <stdio.h>
21293 int main() {
21294         struct stat foo;
21295         foo.st_ino = -1;
21296         if (foo.st_ino < 0)
21297                 printf("-1\n");
21298         else
21299                 printf("1\n");
21300 }
21301 EOCP
21302 set try
21303 if eval $compile; then
21304         val=`$run ./try`
21305         case "$val" in
21306         '')     st_ino_sign=1
21307                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21308                 ;;
21309         *)      st_ino_sign=$val
21310                 case "$st_ino_sign" in
21311                  1) $echo "Your st_ino is unsigned." ;;
21312                 -1) $echo "Your st_ino is signed."   ;;
21313                 esac
21314                 ;;
21315         esac
21316 else
21317         st_ino_sign=1
21318         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21319 fi
21320 $rm_try
21321
21322 : see what type of char stdio uses.
21323 echo " "
21324 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21325 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21326         echo "Your stdio uses unsigned chars." >&4
21327         stdchar="unsigned char"
21328 else
21329         echo "Your stdio uses signed chars." >&4
21330         stdchar="char"
21331 fi
21332 $rm -f stdioh
21333
21334 : see what type uids are declared as in the kernel
21335 echo " "
21336 echo "Looking for the type for user ids returned by getuid()."
21337 set uid_t uidtype xxx stdio.h sys/types.h
21338 eval $typedef
21339 case "$uidtype" in
21340 xxx)
21341         xxx=`./findhdr sys/user.h`
21342         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21343         case $1 in
21344         unsigned) dflt="$1 $2" ;;
21345         *) dflt="$1" ;;
21346         esac
21347         ;;
21348 *) dflt="$uidtype";;
21349 esac
21350 case "$uidtype" in
21351 uid_t)  echo "uid_t found." ;;
21352 *)      rp="What is the type for user ids returned by getuid()?"
21353         . ./myread
21354         uidtype="$ans"
21355         ;;
21356 esac
21357
21358 : Check size of UID
21359 echo " "
21360 case "$uidtype" in
21361 *_t) zzz="$uidtype"     ;;
21362 *)   zzz="uid"          ;;
21363 esac
21364 echo "Checking the size of $zzz..." >&4
21365 cat > try.c <<EOCP
21366 #include <sys/types.h>
21367 #include <stdio.h>
21368 #$i_stdlib I_STDLIB
21369 #ifdef I_STDLIB
21370 #include <stdlib.h>
21371 #endif
21372 int main() {
21373     printf("%d\n", (int)sizeof($uidtype));
21374     exit(0);
21375 }
21376 EOCP
21377 set try
21378 if eval $compile_ok; then
21379         yyy=`$run ./try`
21380         case "$yyy" in
21381         '')     uidsize=4
21382                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21383                 ;;
21384         *)      uidsize=$yyy
21385                 echo "Your $zzz is $uidsize bytes long."
21386                 ;;
21387         esac
21388 else
21389         uidsize=4
21390         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21391 fi
21392
21393 : Check if UID is signed
21394 echo " "
21395 case "$uidtype" in
21396 *_t) zzz="$uidtype"     ;;
21397 *)   zzz="uid"          ;;
21398 esac
21399 echo "Checking the sign of $zzz..." >&4
21400 cat > try.c <<EOCP
21401 #include <sys/types.h>
21402 #include <stdio.h>
21403 int main() {
21404         $uidtype foo = -1;
21405         if (foo < 0)
21406                 printf("-1\n");
21407         else
21408                 printf("1\n");
21409 }
21410 EOCP
21411 set try
21412 if eval $compile; then
21413         yyy=`$run ./try`
21414         case "$yyy" in
21415         '')     uidsign=1
21416                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21417                 ;;
21418         *)      uidsign=$yyy
21419                 case "$uidsign" in
21420                  1) echo "Your $zzz is unsigned." ;;
21421                 -1) echo "Your $zzz is signed."   ;;
21422                 esac
21423                 ;;
21424         esac
21425 else
21426         uidsign=1
21427         echo "(I can't compile the test program--guessing unsigned.)" >&4
21428 fi
21429
21430
21431 : Check format string for UID
21432 echo " "
21433 $echo "Checking the format string to be used for uids..." >&4
21434
21435 case "$uidsign" in
21436 -1)     if $test X"$uidsize" = X"$ivsize"; then
21437                 uidformat="$ivdformat"
21438         else
21439                 if $test X"$uidsize" = X"$longsize"; then
21440                         uidformat='"ld"'
21441                 else
21442                         if $test X"$uidsize" = X"$intsize"; then
21443                                 uidformat='"d"'
21444                         else
21445                                 if $test X"$uidsize" = X"$shortsize"; then
21446                                         uidformat='"hd"'
21447                                 fi
21448                         fi
21449                 fi
21450         fi
21451         ;;
21452 *)      if $test X"$uidsize" = X"$uvsize"; then
21453                 uidformat="$uvuformat"
21454         else
21455                 if $test X"$uidsize" = X"$longsize"; then
21456                         uidformat='"lu"'
21457                 else
21458                         if $test X"$uidsize" = X"$intsize"; then
21459                                 uidformat='"u"'
21460                         else
21461                                 if $test X"$uidsize" = X"$shortsize"; then
21462                                         uidformat='"hu"'
21463                                 fi
21464                         fi
21465                 fi
21466         fi
21467         ;;
21468 esac
21469
21470 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21471 echo " "
21472 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21473 $cat >try.c <<'EOM'
21474 /* Intentionally a long probe as I'd like to sanity check that the exact
21475    approach is going to work, as thinking it will work, but only having it
21476    part working at runtime is worse than not having it.  */
21477
21478 #include <sys/types.h>
21479 #include <sys/sysctl.h>
21480 #include <sys/param.h>
21481 #include <stdio.h>
21482 #include <string.h>
21483 #include <stdlib.h>
21484 #include <unistd.h>
21485
21486 int
21487 main(int argc, char **argv) {
21488     char *buffer;
21489     char *argv_leaf = strrchr(argv[0], '/');
21490     char *buffer_leaf;
21491     size_t size = 0;
21492     int mib[4];
21493
21494     mib[0] = CTL_KERN;
21495     mib[1] = KERN_PROC;
21496     mib[2] = KERN_PROC_PATHNAME;
21497     mib[3] = -1;
21498
21499     if (!argv_leaf) {
21500         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21501         return 1;
21502     }
21503
21504     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21505         perror("sysctl");
21506         return 2;
21507     }
21508
21509     if (size < strlen(argv_leaf) + 1) {
21510         fprintf(stderr, "size %lu is too short for a path\n",
21511                 (unsigned long) size);
21512         return 3;
21513     }
21514
21515     if (size > MAXPATHLEN * MAXPATHLEN) {
21516         fprintf(stderr, "size %lu is too long for a path\n",
21517                 (unsigned long) size);
21518         return 4;
21519     }
21520
21521     buffer = malloc(size);
21522     if (!buffer) {
21523         perror("malloc");
21524         return 5;
21525     }
21526
21527     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21528         perror("sysctl");
21529         return 6;
21530     }
21531
21532     if (strlen(buffer) + 1 != size) {
21533         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21534                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21535         return 7;
21536     }
21537
21538
21539     if (*buffer != '/') {
21540         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21541         return 8;
21542     }
21543
21544     if (strstr(buffer, "/./")) {
21545         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21546         return 9;
21547     }
21548
21549     if (strstr(buffer, "/../")) {
21550         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21551         return 10;
21552     }
21553
21554     buffer_leaf = strrchr(buffer, '/');
21555     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21556         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21557         return 11;
21558     }
21559
21560     free(buffer);
21561
21562     return 0;
21563 }
21564 EOM
21565
21566 val=$undef
21567 set try
21568 if eval $compile; then
21569         if $run ./try; then
21570                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21571                 val="$define"
21572         else
21573                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21574                 val="$undef"
21575         fi
21576 else
21577         echo "I'm unable to compile the test program." >&4
21578         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21579         val="$undef"
21580 fi
21581 $rm_try
21582 set usekernprocpathname
21583 eval $setvar
21584
21585 : Determine if we can use _NSGetExecutablePath to find executing program
21586 echo " "
21587 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21588 $cat >try.c <<'EOM'
21589 /* Intentionally a long probe as I'd like to sanity check that the exact
21590    approach is going to work, as thinking it will work, but only having it
21591    part working at runtime is worse than not having it.  */
21592 #include <mach-o/dyld.h>
21593 #include <stdio.h>
21594 #include <stdlib.h>
21595 #include <sys/param.h>
21596 #include <string.h>
21597
21598 int
21599 main(int argc, char **argv) {
21600     char buf[1];
21601     uint32_t size = sizeof(buf);
21602     int result;
21603     char *buffer;
21604     char *tidied;
21605     char *argv_leaf = strrchr(argv[0], '/');
21606     char *tidied_leaf;
21607
21608     if (!argv_leaf) {
21609         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21610         return 1;
21611     }
21612
21613     _NSGetExecutablePath(buf, &size);
21614     if (size > MAXPATHLEN * MAXPATHLEN) {
21615         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21616                 (unsigned int) size);
21617         return 2;
21618     }
21619
21620     buffer = malloc(size);
21621     if (!buffer) {
21622         perror("malloc");
21623         return 3;
21624     }
21625
21626     result = _NSGetExecutablePath(buffer, &size);
21627     if (result != 0) {
21628         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21629                 result, (unsigned int) size);
21630         return 4;
21631     }
21632
21633     tidied = realpath(buffer, NULL);
21634     if (!tidied) {
21635         perror("realpath");
21636         return 5;
21637     }
21638
21639     free(buffer);
21640
21641     if (*tidied != '/') {
21642         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21643         return 6;
21644     }
21645
21646     if (strstr(tidied, "/./")) {
21647         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21648         return 7;
21649     }
21650
21651     if (strstr(tidied, "/../")) {
21652         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21653         return 8;
21654     }
21655
21656     tidied_leaf = strrchr(tidied, '/');
21657     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21658         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21659         return 9;
21660     }
21661
21662     free(tidied);
21663
21664     return 0;
21665 }
21666 EOM
21667
21668 val=$undef
21669 set try
21670 if eval $compile; then
21671         if $run ./try; then
21672                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21673                 val="$define"
21674         else
21675                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21676         fi
21677 else
21678         echo "I'm unable to compile the test program." >&4
21679         echo "I'll assume no _NSGetExecutablePath here." >&4
21680 fi
21681 $rm_try
21682 set usensgetexecutablepath
21683 eval $setvar
21684
21685 : Check if site customization support was requested
21686 case "$usesitecustomize" in
21687     $define|true|[Yy]*)
21688         usesitecustomize="$define"
21689         ;;
21690     *)
21691         usesitecustomize="$undef"
21692         ;;
21693     esac
21694
21695 : see if prototypes support variable argument declarations
21696 echo " "
21697 case "$prototype$i_stdarg" in
21698 $define$define)
21699         echo "It appears we'll be able to prototype varargs functions." >&4
21700         val="$define"
21701         ;;
21702 *)
21703         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21704         val="$undef"
21705         ;;
21706 esac
21707 set vaproto
21708 eval $setvar
21709
21710 : determine compiler compiler
21711 case "$yacc" in
21712 '')
21713         dflt=yacc;;
21714 *)
21715         dflt="$yacc";;
21716 esac
21717 echo " "
21718 comp='yacc'
21719 if $test -f "$byacc$_exe"; then
21720         dflt="$byacc"
21721         comp="byacc or $comp"
21722 fi
21723 if $test -f "$bison$_exe"; then
21724         comp="$comp or bison -y"
21725 fi
21726 rp="Which compiler compiler ($comp) shall I use?"
21727 . ./myread
21728 yacc="$ans"
21729 case "$yacc" in
21730 *bis*)
21731         case "$yacc" in
21732         *-y*) ;;
21733         *)
21734                 yacc="$yacc -y"
21735                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21736                 ;;
21737         esac
21738         ;;
21739 esac
21740
21741 : see if this is a assert.h system
21742 set assert.h i_assert
21743 eval $inhdr
21744
21745 : see if this is a fp.h system
21746 set fp.h i_fp
21747 eval $inhdr
21748
21749 : see if this is a fp_class.h system
21750 set fp_class.h i_fp_class
21751 eval $inhdr
21752
21753 : see if gdbm.h is available
21754 set gdbm.h t_gdbm
21755 eval $inhdr
21756 case "$t_gdbm" in
21757 $define)
21758         : see if gdbm_open exists
21759         set gdbm_open d_gdbm_open
21760         eval $inlibc
21761         case "$d_gdbm_open" in
21762         $undef)
21763                 t_gdbm="$undef"
21764                 echo "We won't be including <gdbm.h>"
21765                 ;;
21766         esac
21767         ;;
21768 esac
21769 val="$t_gdbm"
21770 set i_gdbm
21771 eval $setvar
21772
21773 : see if this is a ieeefp.h system
21774 case "$i_ieeefp" in
21775 '' ) set ieeefp.h i_ieeefp
21776      eval $inhdr
21777      ;;
21778 esac
21779
21780 : see if this is a libutil.h system
21781 set libutil.h i_libutil
21782 eval $inhdr
21783
21784 : see if mach cthreads are available
21785 if test "X$usethreads" = "X$define"; then
21786         set mach/cthreads.h i_machcthr
21787         eval $inhdr
21788 else
21789         i_machcthr="$undef"
21790 fi
21791
21792 : see if this is a mntent.h system
21793 set mntent.h i_mntent
21794 eval $inhdr
21795
21796 : see if net/errno.h is available
21797 val=''
21798 set net/errno.h val
21799 eval $inhdr
21800
21801 : Unfortunately, it causes problems on some systems.  Arrgh.
21802 case "$val" in
21803 $define)
21804         cat > try.c <<'EOM'
21805 #include <stdio.h>
21806 #include <errno.h>
21807 #include <net/errno.h>
21808 int func()
21809 {
21810         return ENOTSOCK;
21811 }
21812 EOM
21813         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21814                 echo "We'll be including <net/errno.h>." >&4
21815         else
21816                 echo "We won't be including <net/errno.h>." >&4
21817                 val="$undef"
21818         fi
21819         $rm_try
21820         ;;
21821 esac
21822 set i_neterrno
21823 eval $setvar
21824
21825 : see if netinet/tcp.h is available
21826 set netinet/tcp.h i_netinettcp
21827 eval $inhdr
21828
21829 : see if this is a poll.h system
21830 set poll.h i_poll
21831 eval $inhdr
21832
21833 : see if this is a prot.h system
21834 set prot.h i_prot
21835 eval $inhdr
21836
21837 : Preprocessor symbols
21838 echo " "
21839 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21840 $cat <<'EOSH' > Cppsym.know
21841 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21842 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21843 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21844 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21845 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21846 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21847 bull c cadmus clipper CMU COFF COMPILER_VERSION
21848 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21849 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21850 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21851 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21852 GLIBC GLIBC_MINOR
21853 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21854 H3050R H3050RX hbullx20 hcx host_mips
21855 hp200 hp300 hp700 HP700 hp800 hp9000
21856 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21857 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21858 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21859 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21860 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21861 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21862 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21863 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21864 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21865 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21866 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21867 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21868 MATH_HAS_NO_SIDE_EFFECTS
21869 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21870 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21871 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21872 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21873 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21874 NetBSD news1500 news1700 news1800 news1900 news3700
21875 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21876 ns32016 ns32332 ns32k nsc32000
21877 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21878 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21879 pc532 pdp11 PGC PIC plexus PORTAR posix
21880 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21881 POSIX_C_SOURCE POSIX_SOURCE POWER
21882 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21883 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21884 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21885 sony sony_news sonyrisc sparc sparclite spectrum
21886 stardent stdc STDC_EXT stratos sun sun3 sun386
21887 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21888 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21889 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21890 sysV68 sysV88 Tek4132 Tek4300 titan
21891 TM3200 TM5400 TM5600
21892 tower tower32 tower32_200 tower32_600 tower32_700
21893 tower32_800 tower32_850 tss
21894 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21895 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21896 unix UNIX95 UNIX99 unixpc unos
21897 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21898 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21899 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21900 USGr4 USGr4_2
21901 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21902 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21903 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21904 z8000
21905 EOSH
21906 # Maybe put other stuff here too.
21907 cat <<EOSH >>Cppsym.know
21908 $osname
21909 EOSH
21910 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21911 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21912 $cat Cppsym.know > Cppsym.c
21913 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21914 $rm -f Cppsym.a Cppsym.b Cppsym.c
21915 cat <<EOSH > Cppsym
21916 $startsh
21917 if $test \$# -gt 0; then
21918     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21919     if $test -s Cppsym.got; then
21920         $rm -f Cppsym.got
21921         exit 0
21922     fi
21923     $rm -f Cppsym.got
21924     exit 1
21925 else
21926     $tr " " "$trnl" | ./Cppsym.try
21927     exit 0
21928 fi
21929 EOSH
21930 chmod +x Cppsym
21931 $eunicefix Cppsym
21932 cat <<EOSH > Cppsym.try
21933 $startsh
21934 cat <<'EOCP' > try.c
21935 #include <stdio.h>
21936 #if cpp_stuff == 1
21937 #define STRINGIFY(a)    "a"
21938 #endif
21939 #if cpp_stuff == 42
21940 #define StGiFy(a)  #a
21941 #define STRINGIFY(a)    StGiFy(a)
21942 #endif
21943 #if $cpp_stuff != 1 && $cpp_stuff != 42
21944 #   include "Bletch: How does this C preprocessor stringify macros?"
21945 #endif
21946 int main() {
21947 EOCP
21948 $awk \\
21949 EOSH
21950 cat <<'EOSH' >> Cppsym.try
21951 'length($1) > 0 {
21952     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21953     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21954     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21955     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21956 }'       >> try.c
21957 echo 'return 0;}' >> try.c
21958 EOSH
21959 cat <<EOSH >> Cppsym.try
21960 ccflags="$ccflags"
21961 case "$osname-$gccversion" in
21962 irix-) ccflags="\$ccflags -woff 1178" ;;
21963 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21964 esac
21965 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21966 EOSH
21967 chmod +x Cppsym.try
21968 $eunicefix Cppsym.try
21969 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
21970 : Add in any Linux cpp "predefined macros":
21971 case "$osname::$gccversion" in
21972   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21973     tHdrH=_tmpHdr
21974     rm -f $tHdrH'.h' $tHdrH
21975     touch $tHdrH'.h'
21976     # Filter out macro arguments, such as Linux's __INT8_C(c)
21977     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21978        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21979        if [ -s $tHdrH'_cppsym.real' ]; then
21980           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21981        fi
21982     fi
21983     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21984   ;;
21985 esac
21986 : now check the C compiler for additional symbols
21987 postprocess_cc_v=''
21988 case "$osname" in
21989 aix) postprocess_cc_v="|$tr , ' '" ;;
21990 esac
21991 $cat >ccsym <<EOS
21992 $startsh
21993 $cat >tmp.c <<EOF
21994 extern int foo;
21995 EOF
21996 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21997 do
21998         case "\$i" in
21999         -D*) echo "\$i" | $sed 's/^-D//';;
22000         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22001         esac
22002 done
22003 $rm_try
22004 EOS
22005 postprocess_cc_v=''
22006 chmod +x ccsym
22007 $eunicefix ccsym
22008 ./ccsym > ccsym1.raw
22009 if $test -s ccsym1.raw; then
22010        $sort ccsym1.raw | $uniq >ccsym.raw
22011 else
22012        mv ccsym1.raw ccsym.raw
22013 fi
22014
22015 $awk '/\=/ { print $0; next }
22016         { print $0"=1" }' ccsym.raw >ccsym.list
22017 $comm -13 Cppsym.true ccsym.list >ccsym.own
22018 $comm -12 Cppsym.true ccsym.list >ccsym.com
22019 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22020 also=''
22021 if $test -z ccsym.raw; then
22022         echo "Your C compiler doesn't seem to define any symbols!" >&4
22023         echo " "
22024         echo "However, your C preprocessor defines the following symbols:"
22025         $cat Cppsym.true
22026         ccsymbols=''
22027         cppsymbols=`$cat Cppsym.true`
22028         cppsymbols=`echo $cppsymbols`
22029         cppccsymbols="$cppsymbols"
22030 else
22031         if $test -s ccsym.com; then
22032                 echo "Your C compiler and pre-processor define these symbols:"
22033                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22034                 also='also '
22035                 symbols='ones'
22036                 cppccsymbols=`$cat ccsym.com`
22037                 cppccsymbols=`echo $cppccsymbols`
22038                 $test "$silent" || sleep 1
22039         fi
22040         if $test -s ccsym.cpp; then
22041                 $test "$also" && echo " "
22042                 echo "Your C pre-processor ${also}defines the following symbols:"
22043                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22044                 also='further '
22045                 cppsymbols=`$cat ccsym.cpp`
22046                 cppsymbols=`echo $cppsymbols`
22047                 $test "$silent" || sleep 1
22048         fi
22049         if $test -s ccsym.own; then
22050                 $test "$also" && echo " "
22051                 echo "Your C compiler ${also}defines the following cpp symbols:"
22052                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22053                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22054                 ccsymbols=`$cat ccsym.own`
22055                 ccsymbols=`echo $ccsymbols`
22056                 $test "$silent" || sleep 1
22057         fi
22058 fi
22059
22060 : see if this is a termio system
22061 val="$undef"
22062 val2="$undef"
22063 val3="$undef"
22064 if $test `./findhdr termios.h`; then
22065         set tcsetattr i_termios
22066         eval $inlibc
22067         val3="$i_termios"
22068 fi
22069 echo " "
22070 case "$val3" in
22071 "$define") echo "You have POSIX termios.h... good!" >&4;;
22072 *) if ./Cppsym pyr; then
22073                 case "`$run /bin/universe`" in
22074                 ucb) if $test `./findhdr sgtty.h`; then
22075                                 val2="$define"
22076                                 echo "<sgtty.h> found." >&4
22077                         else
22078                                 echo "System is pyramid with BSD universe."
22079                                 ./warn "<sgtty.h> not found--you could have problems."
22080                         fi;;
22081                 *) if $test `./findhdr termio.h`; then
22082                                 val="$define"
22083                                 echo "<termio.h> found." >&4
22084                         else
22085                                 echo "System is pyramid with USG universe."
22086                                 ./warn "<termio.h> not found--you could have problems."
22087                         fi;;
22088                 esac
22089         elif ./usg; then
22090                 if $test `./findhdr termio.h`; then
22091                         echo "<termio.h> found." >&4
22092                         val="$define"
22093                 elif $test `./findhdr sgtty.h`; then
22094                         echo "<sgtty.h> found." >&4
22095                         val2="$define"
22096                 else
22097                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22098                 fi
22099         else
22100                 if $test `./findhdr sgtty.h`; then
22101                         echo "<sgtty.h> found." >&4
22102                         val2="$define"
22103                 elif $test `./findhdr termio.h`; then
22104                         echo "<termio.h> found." >&4
22105                         val="$define"
22106                 else
22107                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22108                 fi
22109         fi;;
22110 esac
22111 set i_termio; eval $setvar
22112 val=$val2; set i_sgtty; eval $setvar
22113 val=$val3; set i_termios; eval $setvar
22114
22115 : see if stdbool is available
22116 : we want a real compile instead of Inhdr because some Solaris systems
22117 : have stdbool.h, but it can only be used if the compiler indicates it
22118 : is sufficiently c99-compliant.
22119 echo " "
22120 $cat >try.c <<EOCP
22121 #include <stdio.h>
22122 #include <stdbool.h>
22123 int func(bool x)
22124 {
22125     return x ? 1 : 0;
22126 }
22127 int main(int argc, char **argv)
22128 {
22129     return func(0);
22130 }
22131 EOCP
22132 set try
22133 if eval $compile; then
22134         echo "<stdbool.h> found." >&4
22135         val="$define"
22136 else
22137         echo "<stdbool.h> NOT found." >&4
22138         val="$undef"
22139 fi
22140 $rm_try
22141 set i_stdbool
22142 eval $setvar
22143
22144 : see if stddef is available
22145 set stddef.h i_stddef
22146 eval $inhdr
22147
22148 : see if sys/access.h is available
22149 set sys/access.h i_sysaccess
22150 eval $inhdr
22151
22152 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22153 set sys/filio.h i_sysfilio
22154 eval $inhdr
22155 echo " "
22156 if $test `./findhdr sys/ioctl.h`; then
22157         val="$define"
22158         echo '<sys/ioctl.h> found.' >&4
22159 else
22160         val="$undef"
22161         if $test $i_sysfilio = "$define"; then
22162             echo '<sys/ioctl.h> NOT found.' >&4
22163         else
22164                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22165                 $test $i_termio = "$define" && xxx="termio.h"
22166                 $test $i_termios = "$define" && xxx="termios.h"
22167 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22168         fi
22169 fi
22170 set i_sysioctl
22171 eval $setvar
22172
22173 : see if socket ioctl defs are in sys/sockio.h
22174 echo " "
22175 xxx=`./findhdr sys/sockio.h`
22176 if $test "$xxx"; then
22177         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22178                 val="$define"
22179                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22180         else
22181                 val="$undef"
22182                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22183         fi
22184 else
22185         val="$undef"
22186         $cat <<EOM
22187 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22188 EOM
22189 fi
22190 set i_syssockio
22191 eval $setvar
22192
22193 : see if this is a syslog.h system
22194 set syslog.h i_syslog
22195 eval $inhdr
22196
22197 : see if this is a sys/mode.h system
22198 set sys/mode.h i_sysmode
22199 eval $inhdr
22200
22201 : see if there is a sys/poll.h file
22202 set sys/poll.h i_syspoll
22203 eval $inhdr
22204
22205 : see if sys/resource.h has to be included
22206 set sys/resource.h i_sysresrc
22207 eval $inhdr
22208
22209 : see if sys/security.h is available
22210 set sys/security.h i_syssecrt
22211 eval $inhdr
22212
22213 : see if this is a sys/statvfs.h system
22214 set sys/statvfs.h i_sysstatvfs
22215 eval $inhdr
22216
22217 : see if this is a sys/un.h system
22218 set sys/un.h i_sysun
22219 eval $inhdr
22220
22221 : see if this is a sys/utsname.h system
22222 set sys/utsname.h i_sysutsname
22223 eval $inhdr
22224
22225 : see if this is a syswait system
22226 set sys/wait.h i_syswait
22227 eval $inhdr
22228
22229 : see if this is a ustat.h system
22230 set ustat.h i_ustat
22231 eval $inhdr
22232
22233 : see if this is an utime system
22234 set utime.h i_utime
22235 eval $inhdr
22236
22237 : see if this is a vfork system
22238 case "$d_vfork" in
22239 "$define")
22240         set vfork.h i_vfork
22241         eval $inhdr
22242         ;;
22243 *)
22244         i_vfork="$undef"
22245         ;;
22246 esac
22247
22248 : Check extensions
22249 echo " "
22250 echo "Looking for extensions..." >&4
22251 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22252 : contain old or inaccurate or duplicate values.
22253 nonxs_extensions=''
22254 xs_extensions=''
22255 : We do not use find because it might not be available.
22256 : We do not just use MANIFEST because the user may have dropped
22257 : some additional extensions into the source tree and expect them
22258 : to be built.
22259
22260 : Function to recursively find available extensions, ignoring DynaLoader
22261 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22262 : In 5.10.1 and later, extensions are stored in directories
22263 : like File-Glob instead of the older File/Glob/.
22264 find_extensions='
22265     for xxx in *; do
22266         case "$xxx" in
22267             DynaLoader|dynaload) ;;
22268             *)
22269             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22270             case "$this_ext" in
22271                 Scalar/List/Utils) this_ext="List/Util" ;;
22272                 PathTools)         this_ext="Cwd"       ;;
22273             esac;
22274             echo " $xs_extensions $nonxs_extensions" > $$.tmp;
22275             if $contains " $this_ext " $$.tmp; then
22276                 echo >&4;
22277                 echo "Duplicate directories detected for extension $xxx" >&4;
22278                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22279                 case "$knowitall" in
22280                 "") dflt=y;;
22281                 *) dflt=n;;
22282                 esac;
22283                 . ../UU/myread;
22284                 case "$ans" in
22285                 n*|N*) ;;
22286                 *) echo >&4;
22287                     echo "Ok.  Stopping Configure." >&4;
22288                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22289                     exit 1;;
22290                 esac;
22291                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22292             fi;
22293             $ls -1 $xxx > $$.tmp;
22294             if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22295                 xs_extensions="$xs_extensions $this_ext";
22296             elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22297                 xs_extensions="$xs_extensions $this_ext";
22298             elif $test -d $xxx; then
22299                 nonxs_extensions="$nonxs_extensions $this_ext";
22300             fi;
22301             $rm -f $$.tmp;
22302             ;;
22303         esac;
22304     done'
22305 tdir=`pwd`
22306 cd "$rsrc/cpan"
22307 set X
22308 shift
22309 eval $find_extensions
22310 cd "$rsrc/dist"
22311 set X
22312 shift
22313 eval $find_extensions
22314 cd "$rsrc/ext"
22315 set X
22316 shift
22317 eval $find_extensions
22318 set X $xs_extensions
22319 shift
22320 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22321 set X $nonxs_extensions
22322 shift
22323 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22324 cd "$tdir"
22325 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22326
22327 : Now see which are supported on this system.
22328 avail_ext=''
22329 for xxx in $xs_extensions ; do
22330         case "$xxx" in
22331         DB_File|db_file)
22332                 case "$i_db" in
22333                 $define) avail_ext="$avail_ext $xxx" ;;
22334                 esac
22335                 ;;
22336         GDBM_File|gdbm_fil)
22337                 case "$i_gdbm" in
22338                 $define) avail_ext="$avail_ext $xxx" ;;
22339                 esac
22340                 ;;
22341         I18N/Langinfo|i18n_lan)
22342                 case "$i_langinfo$d_nl_langinfo" in
22343                 $define$define) avail_ext="$avail_ext $xxx" ;;
22344                 esac
22345                 ;;
22346         IPC/SysV|ipc/sysv)
22347                 : XXX Do we need a useipcsysv variable here
22348                 case "${d_msg}${d_sem}${d_shm}" in
22349                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22350                 esac
22351                 ;;
22352         NDBM_File|ndbm_fil)
22353                 case "$d_ndbm" in
22354                 $define)
22355                     case "$osname-$use64bitint" in
22356                     hpux-define)
22357                         case "$libs" in
22358                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22359                         esac
22360                         ;;
22361                     *) avail_ext="$avail_ext $xxx" ;;
22362                     esac
22363                     ;;
22364                 esac
22365                 ;;
22366         ODBM_File|odbm_fil)
22367                 case "${i_dbm}${i_rpcsvcdbm}" in
22368                 *"${define}"*)
22369                     case "$d_cplusplus" in
22370                     define) ;; # delete as a function name will not work
22371                     *)  case "$osname-$use64bitint" in
22372                         hpux-define)
22373                             case "$libs" in
22374                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22375                             esac
22376                             ;;
22377                         *) avail_ext="$avail_ext $xxx" ;;
22378                         esac
22379                         ;;
22380                     esac
22381                     ;;
22382                 esac
22383                 ;;
22384         Opcode|opcode)
22385                 case "$useopcode" in
22386                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22387                 esac
22388                 ;;
22389         POSIX|posix)
22390                 case "$useposix" in
22391                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22392                 esac
22393                 ;;
22394         Socket|socket)
22395                 case "$d_socket" in
22396                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22397                 esac
22398                 ;;
22399         Sys/Syslog|sys/syslog)
22400                 : XXX syslog requires socket
22401                 case "$d_socket" in
22402                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22403                 esac
22404                 ;;
22405         Thread|thread)
22406                 case "$usethreads" in
22407                 true|$define|y)
22408                         case "$use5005threads" in
22409                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22410                         esac
22411                 esac
22412                 ;;
22413         threads|threads/shared)
22414                 # threads and threads::shared are special cases.
22415                 # To stop people from asking "Perl 5.8.0 was supposed
22416                 # to have this new fancy threads implementation but my
22417                 # perl doesn't have it" and from people trying to
22418                 # (re)install the threads module using CPAN.pm and
22419                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22420                 # the threads.pm and threads/shared.pm will always be
22421                 # there, croaking informatively ("you need to rebuild
22422                 # all of Perl with threads, sorry") when threads haven't
22423                 # been compiled in.
22424                 # --jhi
22425                 avail_ext="$avail_ext $xxx"
22426                 ;;
22427         VMS*)
22428                 ;;
22429         Win32*)
22430                 case "$osname" in
22431                 cygwin) avail_ext="$avail_ext $xxx" ;;
22432                 esac
22433                 ;;
22434         XS/APItest|xs/apitest)
22435                 # This is just for testing.  Skip it unless we have dynamic loading.
22436
22437                 case "$usedl" in
22438                 $define) avail_ext="$avail_ext $xxx" ;;
22439                 esac
22440                 ;;
22441         XS/Typemap|xs/typemap)
22442                 # This is just for testing.  Skip it unless we have dynamic loading.
22443                 case "$usedl" in
22444                 $define) avail_ext="$avail_ext $xxx" ;;
22445                 esac
22446                 ;;
22447         *)      avail_ext="$avail_ext $xxx"
22448                 ;;
22449         esac
22450 done
22451
22452 set X $avail_ext
22453 shift
22454 avail_ext="$*"
22455
22456 case "$onlyextensions" in
22457 '') ;;
22458 *)  keepextensions=''
22459     echo "You have requested that only certain extensions be included..." >&4
22460     for i in $onlyextensions; do
22461         case " $avail_ext " in
22462         *" $i "*)
22463             echo "Keeping extension $i."
22464             keepextensions="$keepextensions $i"
22465             ;;
22466         *) echo "Ignoring extension $i." ;;
22467         esac
22468     done
22469     avail_ext="$keepextensions"
22470     ;;
22471 esac
22472
22473 case "$noextensions" in
22474 '') ;;
22475 *)  keepextensions=''
22476     echo "You have requested that certain extensions be ignored..." >&4
22477     for i in $avail_ext; do
22478         case " $noextensions " in
22479         *" $i "*) echo "Ignoring extension $i." ;;
22480         *) echo "Keeping extension $i.";
22481            keepextensions="$keepextensions $i"
22482            ;;
22483         esac
22484     done
22485     avail_ext="$keepextensions"
22486     ;;
22487 esac
22488
22489 : Now see which nonxs extensions are supported on this system.
22490 : For now assume all are.
22491 nonxs_ext=''
22492 for xxx in $nonxs_extensions ; do
22493         case "$xxx" in
22494         VMS*)
22495                 ;;
22496         *)      nonxs_ext="$nonxs_ext $xxx"
22497                 ;;
22498         esac
22499 done
22500
22501 set X $nonxs_ext
22502 shift
22503 nonxs_ext="$*"
22504
22505 case $usedl in
22506 $define)
22507         $cat <<EOM
22508 A number of extensions are supplied with $package.  You may choose to
22509 compile these extensions for dynamic loading (the default), compile
22510 them into the $package executable (static loading), or not include
22511 them at all.  Answer "none" to include no extensions.
22512 Note that DynaLoader is always built and need not be mentioned here.
22513
22514 EOM
22515         case "$dynamic_ext" in
22516         '')
22517                 : Exclude those listed in static_ext
22518                 dflt=''
22519                 for xxx in $avail_ext; do
22520                         case " $static_ext " in
22521                         *" $xxx "*) ;;
22522                         *) dflt="$dflt $xxx" ;;
22523                         esac
22524                 done
22525                 set X $dflt
22526                 shift
22527                 dflt="$*"
22528                 ;;
22529         *)      dflt="$dynamic_ext"
22530                 # Perhaps we are reusing an old out-of-date config.sh.
22531                 case "$hint" in
22532                 previous)
22533                         if test X"$dynamic_ext" != X"$avail_ext"; then
22534                                 $cat <<EOM
22535 NOTICE:  Your previous config.sh list may be incorrect.
22536 The extensions now available to you are
22537         ${avail_ext}
22538 but the default list from your previous config.sh is
22539         ${dynamic_ext}
22540
22541 EOM
22542                         fi
22543                         ;;
22544                 esac
22545                 ;;
22546         esac
22547         case "$dflt" in
22548         '')     dflt=none;;
22549         esac
22550         rp="What extensions do you wish to load dynamically?"
22551         . ./myread
22552         case "$ans" in
22553         none) dynamic_ext=' ' ;;
22554         *) dynamic_ext="$ans" ;;
22555         esac
22556
22557         case "$static_ext" in
22558         '')
22559                 : Exclude those already listed in dynamic linking
22560                 dflt=''
22561                 for xxx in $avail_ext; do
22562                         case " $dynamic_ext " in
22563                         *" $xxx "*) ;;
22564                         *) dflt="$dflt $xxx" ;;
22565                         esac
22566                 done
22567                 set X $dflt
22568                 shift
22569                 dflt="$*"
22570                 ;;
22571         *)  dflt="$static_ext"
22572                 ;;
22573         esac
22574
22575         case "$dflt" in
22576         '')     dflt=none;;
22577         esac
22578         rp="What extensions do you wish to load statically?"
22579         . ./myread
22580         case "$ans" in
22581         none) static_ext=' ' ;;
22582         *) static_ext="$ans" ;;
22583         esac
22584         ;;
22585 *)
22586         $cat <<EOM
22587 A number of extensions are supplied with $package.  Answer "none"
22588 to include no extensions.
22589 Note that DynaLoader is always built and need not be mentioned here.
22590
22591 EOM
22592         case "$static_ext" in
22593         '') dflt="$avail_ext" ;;
22594         *)      dflt="$static_ext"
22595                 # Perhaps we are reusing an old out-of-date config.sh.
22596                 case "$hint" in
22597                 previous)
22598                         if test X"$static_ext" != X"$avail_ext"; then
22599                                 $cat <<EOM
22600 NOTICE:  Your previous config.sh list may be incorrect.
22601 The extensions now available to you are
22602         ${avail_ext}
22603 but the default list from your previous config.sh is
22604         ${static_ext}
22605
22606 EOM
22607                         fi
22608                         ;;
22609                 esac
22610                 ;;
22611         esac
22612         : Exclude those that are not xs extensions
22613         case "$dflt" in
22614         '')     dflt=none;;
22615         esac
22616         rp="What extensions do you wish to include?"
22617         . ./myread
22618         case "$ans" in
22619         none) static_ext=' ' ;;
22620         *) static_ext="$ans" ;;
22621         esac
22622         ;;
22623 esac
22624 #
22625 # Encode is a special case.  If we are building Encode as a static
22626 # extension, we need to explicitly list its subextensions as well.
22627 # For other nested extensions, this is handled automatically by
22628 # the appropriate Makefile.PL.
22629 case " $static_ext " in
22630         *" Encode "*) # Add the subextensions of Encode
22631         cd "$rsrc/cpan"
22632         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22633                 static_ext="$static_ext Encode/$xxx"
22634                 known_extensions="$known_extensions Encode/$xxx"
22635         done
22636         cd "$tdir"
22637         ;;
22638 esac
22639
22640 set X $dynamic_ext $static_ext $nonxs_ext
22641 shift
22642 extensions="$*"
22643
22644 # Sanity check:  We require an extension suitable for use with
22645 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22646 # should show up as failures in the test suite, but it's helpful to
22647 # catch them now.) The 'extensions' list is normally sorted
22648 # alphabetically, so we need to accept either
22649 #    DB_File ... Fcntl ... IO  ....
22650 # or something like
22651 #    Fcntl ... NDBM_File ... IO  ....
22652 case " $extensions"  in
22653 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22654 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22655 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22656 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22657    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22658    ;;
22659 esac
22660
22661 : Remove libraries needed only for extensions
22662 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22663 : The exception is SunOS 4.x, which needs them.
22664 case "${osname}X${osvers}" in
22665 sunos*X4*)
22666     perllibs="$libs"
22667     ;;
22668 *) case "$usedl" in
22669     $define|true|[yY]*)
22670             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22671             shift
22672             perllibs="$*"
22673             ;;
22674     *)  perllibs="$libs"
22675             ;;
22676     esac
22677     ;;
22678 esac
22679
22680 : Remove build directory name from cppstdin so it can be used from
22681 : either the present location or the final installed location.
22682 echo " "
22683 : Get out of the UU directory to get correct path name.
22684 cd ..
22685 case "$cppstdin" in
22686 `pwd`/cppstdin)
22687         echo "Stripping down cppstdin path name"
22688         cppstdin=cppstdin
22689         ;;
22690 esac
22691 cd UU
22692
22693 : end of configuration questions
22694 echo " "
22695 echo "End of configuration questions."
22696 echo " "
22697
22698 : back to where it started
22699 if test -d ../UU; then
22700         cd ..
22701 fi
22702
22703 : configuration may be unconditionally patched via a 'config.arch' file
22704 if $test -f config.arch; then
22705         echo "I see a config.arch file, loading it." >&4
22706         . ./config.arch
22707 fi
22708
22709 : configuration may be patched via a 'config.over' file
22710 if $test -f config.over; then
22711         echo " "
22712         dflt=y
22713         rp='I see a config.over file.  Do you wish to load it?'
22714         . UU/myread
22715         case "$ans" in
22716         n*) echo "OK, I'll ignore it.";;
22717         *)      . ./config.over
22718                 echo "Configuration override changes have been loaded."
22719                 ;;
22720         esac
22721 fi
22722
22723 : in case they want portability, strip down executable paths
22724 case "$d_portable" in
22725 "$define")
22726         echo " "
22727         echo "Stripping down executable paths..." >&4
22728         for file in $loclist $trylist; do
22729                 eval temp=\$$file
22730                 eval $file=`basename $temp`
22731         done
22732         ;;
22733 esac
22734
22735 : create config.sh file
22736 echo " "
22737 echo "Creating config.sh..." >&4
22738 $spitshell <<EOT >config.sh
22739 $startsh
22740 #
22741 # This file was produced by running the Configure script. It holds all the
22742 # definitions figured out by Configure. Should you modify one of these values,
22743 # do not forget to propagate your changes by running "Configure -der". You may
22744 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22745 #
22746
22747 # Package name      : $package
22748 # Source directory  : $src
22749 # Configuration time: $cf_time
22750 # Configured by     : $cf_by
22751 # Target system     : $myuname
22752
22753 EOT
22754 : Add in command line options if available
22755 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22756
22757 $spitshell <<EOT >>config.sh
22758
22759 Author='$Author'
22760 Date='$Date'
22761 Header='$Header'
22762 Id='$Id'
22763 Locker='$Locker'
22764 Log='$Log'
22765 RCSfile='$RCSfile'
22766 Revision='$Revision'
22767 Source='$Source'
22768 State='$State'
22769 _a='$_a'
22770 _exe='$_exe'
22771 _o='$_o'
22772 afs='$afs'
22773 afsroot='$afsroot'
22774 alignbytes='$alignbytes'
22775 ansi2knr='$ansi2knr'
22776 aphostname='$aphostname'
22777 api_revision='$api_revision'
22778 api_subversion='$api_subversion'
22779 api_version='$api_version'
22780 api_versionstring='$api_versionstring'
22781 ar='$ar'
22782 archlib='$archlib'
22783 archlibexp='$archlibexp'
22784 archname64='$archname64'
22785 archname='$archname'
22786 archobjs='$archobjs'
22787 asctime_r_proto='$asctime_r_proto'
22788 awk='$awk'
22789 baserev='$baserev'
22790 bash='$bash'
22791 bin='$bin'
22792 bin_ELF='$bin_ELF'
22793 binexp='$binexp'
22794 bison='$bison'
22795 bootstrap_charset='$bootstrap_charset'
22796 byacc='$byacc'
22797 byteorder='$byteorder'
22798 c='$c'
22799 castflags='$castflags'
22800 cat='$cat'
22801 cc='$cc'
22802 cccdlflags='$cccdlflags'
22803 ccdlflags='$ccdlflags'
22804 ccflags='$ccflags'
22805 ccflags_uselargefiles='$ccflags_uselargefiles'
22806 ccname='$ccname'
22807 ccsymbols='$ccsymbols'
22808 ccversion='$ccversion'
22809 cf_by='$cf_by'
22810 cf_email='$cf_email'
22811 cf_time='$cf_time'
22812 charbits='$charbits'
22813 charsize='$charsize'
22814 chgrp='$chgrp'
22815 chmod='$chmod'
22816 chown='$chown'
22817 clocktype='$clocktype'
22818 comm='$comm'
22819 compress='$compress'
22820 contains='$contains'
22821 cp='$cp'
22822 cpio='$cpio'
22823 cpp='$cpp'
22824 cpp_stuff='$cpp_stuff'
22825 cppccsymbols='$cppccsymbols'
22826 cppflags='$cppflags'
22827 cpplast='$cpplast'
22828 cppminus='$cppminus'
22829 cpprun='$cpprun'
22830 cppstdin='$cppstdin'
22831 cppsymbols='$cppsymbols'
22832 crypt_r_proto='$crypt_r_proto'
22833 cryptlib='$cryptlib'
22834 csh='$csh'
22835 ctermid_r_proto='$ctermid_r_proto'
22836 ctime_r_proto='$ctime_r_proto'
22837 d_Gconvert='$d_Gconvert'
22838 d_PRIEUldbl='$d_PRIEUldbl'
22839 d_PRIFUldbl='$d_PRIFUldbl'
22840 d_PRIGUldbl='$d_PRIGUldbl'
22841 d_PRIXU64='$d_PRIXU64'
22842 d_PRId64='$d_PRId64'
22843 d_PRIeldbl='$d_PRIeldbl'
22844 d_PRIfldbl='$d_PRIfldbl'
22845 d_PRIgldbl='$d_PRIgldbl'
22846 d_PRIi64='$d_PRIi64'
22847 d_PRIo64='$d_PRIo64'
22848 d_PRIu64='$d_PRIu64'
22849 d_PRIx64='$d_PRIx64'
22850 d_SCNfldbl='$d_SCNfldbl'
22851 d__fwalk='$d__fwalk'
22852 d_access='$d_access'
22853 d_accessx='$d_accessx'
22854 d_aintl='$d_aintl'
22855 d_alarm='$d_alarm'
22856 d_archlib='$d_archlib'
22857 d_asctime64='$d_asctime64'
22858 d_asctime_r='$d_asctime_r'
22859 d_atolf='$d_atolf'
22860 d_atoll='$d_atoll'
22861 d_attribute_deprecated='$d_attribute_deprecated'
22862 d_attribute_format='$d_attribute_format'
22863 d_attribute_malloc='$d_attribute_malloc'
22864 d_attribute_nonnull='$d_attribute_nonnull'
22865 d_attribute_noreturn='$d_attribute_noreturn'
22866 d_attribute_pure='$d_attribute_pure'
22867 d_attribute_unused='$d_attribute_unused'
22868 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22869 d_bcmp='$d_bcmp'
22870 d_bcopy='$d_bcopy'
22871 d_bsd='$d_bsd'
22872 d_bsdgetpgrp='$d_bsdgetpgrp'
22873 d_bsdsetpgrp='$d_bsdsetpgrp'
22874 d_builtin_choose_expr='$d_builtin_choose_expr'
22875 d_builtin_expect='$d_builtin_expect'
22876 d_bzero='$d_bzero'
22877 d_c99_variadic_macros='$d_c99_variadic_macros'
22878 d_casti32='$d_casti32'
22879 d_castneg='$d_castneg'
22880 d_charvspr='$d_charvspr'
22881 d_chown='$d_chown'
22882 d_chroot='$d_chroot'
22883 d_chsize='$d_chsize'
22884 d_class='$d_class'
22885 d_clearenv='$d_clearenv'
22886 d_closedir='$d_closedir'
22887 d_cmsghdr_s='$d_cmsghdr_s'
22888 d_const='$d_const'
22889 d_copysignl='$d_copysignl'
22890 d_cplusplus='$d_cplusplus'
22891 d_crypt='$d_crypt'
22892 d_crypt_r='$d_crypt_r'
22893 d_csh='$d_csh'
22894 d_ctermid='$d_ctermid'
22895 d_ctermid_r='$d_ctermid_r'
22896 d_ctime64='$d_ctime64'
22897 d_ctime_r='$d_ctime_r'
22898 d_cuserid='$d_cuserid'
22899 d_dbl_dig='$d_dbl_dig'
22900 d_dbminitproto='$d_dbminitproto'
22901 d_difftime64='$d_difftime64'
22902 d_difftime='$d_difftime'
22903 d_dir_dd_fd='$d_dir_dd_fd'
22904 d_dirfd='$d_dirfd'
22905 d_dirnamlen='$d_dirnamlen'
22906 d_dlerror='$d_dlerror'
22907 d_dlopen='$d_dlopen'
22908 d_dlsymun='$d_dlsymun'
22909 d_dosuid='$d_dosuid'
22910 d_drand48_r='$d_drand48_r'
22911 d_drand48proto='$d_drand48proto'
22912 d_dup2='$d_dup2'
22913 d_eaccess='$d_eaccess'
22914 d_endgrent='$d_endgrent'
22915 d_endgrent_r='$d_endgrent_r'
22916 d_endhent='$d_endhent'
22917 d_endhostent_r='$d_endhostent_r'
22918 d_endnent='$d_endnent'
22919 d_endnetent_r='$d_endnetent_r'
22920 d_endpent='$d_endpent'
22921 d_endprotoent_r='$d_endprotoent_r'
22922 d_endpwent='$d_endpwent'
22923 d_endpwent_r='$d_endpwent_r'
22924 d_endsent='$d_endsent'
22925 d_endservent_r='$d_endservent_r'
22926 d_eofnblk='$d_eofnblk'
22927 d_eunice='$d_eunice'
22928 d_faststdio='$d_faststdio'
22929 d_fchdir='$d_fchdir'
22930 d_fchmod='$d_fchmod'
22931 d_fchown='$d_fchown'
22932 d_fcntl='$d_fcntl'
22933 d_fcntl_can_lock='$d_fcntl_can_lock'
22934 d_fd_macros='$d_fd_macros'
22935 d_fd_set='$d_fd_set'
22936 d_fds_bits='$d_fds_bits'
22937 d_fgetpos='$d_fgetpos'
22938 d_finite='$d_finite'
22939 d_finitel='$d_finitel'
22940 d_flexfnam='$d_flexfnam'
22941 d_flock='$d_flock'
22942 d_flockproto='$d_flockproto'
22943 d_fork='$d_fork'
22944 d_fp_class='$d_fp_class'
22945 d_fpathconf='$d_fpathconf'
22946 d_fpclass='$d_fpclass'
22947 d_fpclassify='$d_fpclassify'
22948 d_fpclassl='$d_fpclassl'
22949 d_fpos64_t='$d_fpos64_t'
22950 d_frexpl='$d_frexpl'
22951 d_fs_data_s='$d_fs_data_s'
22952 d_fseeko='$d_fseeko'
22953 d_fsetpos='$d_fsetpos'
22954 d_fstatfs='$d_fstatfs'
22955 d_fstatvfs='$d_fstatvfs'
22956 d_fsync='$d_fsync'
22957 d_ftello='$d_ftello'
22958 d_ftime='$d_ftime'
22959 d_futimes='$d_futimes'
22960 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22961 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22962 d_getaddrinfo='$d_getaddrinfo'
22963 d_getcwd='$d_getcwd'
22964 d_getespwnam='$d_getespwnam'
22965 d_getfsstat='$d_getfsstat'
22966 d_getgrent='$d_getgrent'
22967 d_getgrent_r='$d_getgrent_r'
22968 d_getgrgid_r='$d_getgrgid_r'
22969 d_getgrnam_r='$d_getgrnam_r'
22970 d_getgrps='$d_getgrps'
22971 d_gethbyaddr='$d_gethbyaddr'
22972 d_gethbyname='$d_gethbyname'
22973 d_gethent='$d_gethent'
22974 d_gethname='$d_gethname'
22975 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22976 d_gethostbyname_r='$d_gethostbyname_r'
22977 d_gethostent_r='$d_gethostent_r'
22978 d_gethostprotos='$d_gethostprotos'
22979 d_getitimer='$d_getitimer'
22980 d_getlogin='$d_getlogin'
22981 d_getlogin_r='$d_getlogin_r'
22982 d_getmnt='$d_getmnt'
22983 d_getmntent='$d_getmntent'
22984 d_getnameinfo='$d_getnameinfo'
22985 d_getnbyaddr='$d_getnbyaddr'
22986 d_getnbyname='$d_getnbyname'
22987 d_getnent='$d_getnent'
22988 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22989 d_getnetbyname_r='$d_getnetbyname_r'
22990 d_getnetent_r='$d_getnetent_r'
22991 d_getnetprotos='$d_getnetprotos'
22992 d_getpagsz='$d_getpagsz'
22993 d_getpbyname='$d_getpbyname'
22994 d_getpbynumber='$d_getpbynumber'
22995 d_getpent='$d_getpent'
22996 d_getpgid='$d_getpgid'
22997 d_getpgrp2='$d_getpgrp2'
22998 d_getpgrp='$d_getpgrp'
22999 d_getppid='$d_getppid'
23000 d_getprior='$d_getprior'
23001 d_getprotobyname_r='$d_getprotobyname_r'
23002 d_getprotobynumber_r='$d_getprotobynumber_r'
23003 d_getprotoent_r='$d_getprotoent_r'
23004 d_getprotoprotos='$d_getprotoprotos'
23005 d_getprpwnam='$d_getprpwnam'
23006 d_getpwent='$d_getpwent'
23007 d_getpwent_r='$d_getpwent_r'
23008 d_getpwnam_r='$d_getpwnam_r'
23009 d_getpwuid_r='$d_getpwuid_r'
23010 d_getsbyname='$d_getsbyname'
23011 d_getsbyport='$d_getsbyport'
23012 d_getsent='$d_getsent'
23013 d_getservbyname_r='$d_getservbyname_r'
23014 d_getservbyport_r='$d_getservbyport_r'
23015 d_getservent_r='$d_getservent_r'
23016 d_getservprotos='$d_getservprotos'
23017 d_getspnam='$d_getspnam'
23018 d_getspnam_r='$d_getspnam_r'
23019 d_gettimeod='$d_gettimeod'
23020 d_gmtime64='$d_gmtime64'
23021 d_gmtime_r='$d_gmtime_r'
23022 d_gnulibc='$d_gnulibc'
23023 d_grpasswd='$d_grpasswd'
23024 d_hasmntopt='$d_hasmntopt'
23025 d_htonl='$d_htonl'
23026 d_ilogbl='$d_ilogbl'
23027 d_inc_version_list='$d_inc_version_list'
23028 d_index='$d_index'
23029 d_inetaton='$d_inetaton'
23030 d_inetntop='$d_inetntop'
23031 d_inetpton='$d_inetpton'
23032 d_int64_t='$d_int64_t'
23033 d_ip_mreq='$d_ip_mreq'
23034 d_ip_mreq_source='$d_ip_mreq_source'
23035 d_ipv6_mreq='$d_ipv6_mreq'
23036 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23037 d_isascii='$d_isascii'
23038 d_isblank='$d_isblank'
23039 d_isfinite='$d_isfinite'
23040 d_isinf='$d_isinf'
23041 d_isnan='$d_isnan'
23042 d_isnanl='$d_isnanl'
23043 d_killpg='$d_killpg'
23044 d_lchown='$d_lchown'
23045 d_ldbl_dig='$d_ldbl_dig'
23046 d_libm_lib_version='$d_libm_lib_version'
23047 d_libname_unique='$d_libname_unique'
23048 d_link='$d_link'
23049 d_localtime64='$d_localtime64'
23050 d_localtime_r='$d_localtime_r'
23051 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23052 d_locconv='$d_locconv'
23053 d_lockf='$d_lockf'
23054 d_longdbl='$d_longdbl'
23055 d_longlong='$d_longlong'
23056 d_lseekproto='$d_lseekproto'
23057 d_lstat='$d_lstat'
23058 d_madvise='$d_madvise'
23059 d_malloc_good_size='$d_malloc_good_size'
23060 d_malloc_size='$d_malloc_size'
23061 d_mblen='$d_mblen'
23062 d_mbstowcs='$d_mbstowcs'
23063 d_mbtowc='$d_mbtowc'
23064 d_memchr='$d_memchr'
23065 d_memcmp='$d_memcmp'
23066 d_memcpy='$d_memcpy'
23067 d_memmove='$d_memmove'
23068 d_memset='$d_memset'
23069 d_mkdir='$d_mkdir'
23070 d_mkdtemp='$d_mkdtemp'
23071 d_mkfifo='$d_mkfifo'
23072 d_mkstemp='$d_mkstemp'
23073 d_mkstemps='$d_mkstemps'
23074 d_mktime64='$d_mktime64'
23075 d_mktime='$d_mktime'
23076 d_mmap='$d_mmap'
23077 d_modfl='$d_modfl'
23078 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23079 d_modflproto='$d_modflproto'
23080 d_mprotect='$d_mprotect'
23081 d_msg='$d_msg'
23082 d_msg_ctrunc='$d_msg_ctrunc'
23083 d_msg_dontroute='$d_msg_dontroute'
23084 d_msg_oob='$d_msg_oob'
23085 d_msg_peek='$d_msg_peek'
23086 d_msg_proxy='$d_msg_proxy'
23087 d_msgctl='$d_msgctl'
23088 d_msgget='$d_msgget'
23089 d_msghdr_s='$d_msghdr_s'
23090 d_msgrcv='$d_msgrcv'
23091 d_msgsnd='$d_msgsnd'
23092 d_msync='$d_msync'
23093 d_munmap='$d_munmap'
23094 d_mymalloc='$d_mymalloc'
23095 d_ndbm='$d_ndbm'
23096 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23097 d_nice='$d_nice'
23098 d_nl_langinfo='$d_nl_langinfo'
23099 d_nv_preserves_uv='$d_nv_preserves_uv'
23100 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23101 d_off64_t='$d_off64_t'
23102 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23103 d_oldpthreads='$d_oldpthreads'
23104 d_oldsock='$d_oldsock'
23105 d_open3='$d_open3'
23106 d_pathconf='$d_pathconf'
23107 d_pause='$d_pause'
23108 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23109 d_phostname='$d_phostname'
23110 d_pipe='$d_pipe'
23111 d_poll='$d_poll'
23112 d_portable='$d_portable'
23113 d_prctl='$d_prctl'
23114 d_prctl_set_name='$d_prctl_set_name'
23115 d_printf_format_null='$d_printf_format_null'
23116 d_procselfexe='$d_procselfexe'
23117 d_pseudofork='$d_pseudofork'
23118 d_pthread_atfork='$d_pthread_atfork'
23119 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23120 d_pthread_yield='$d_pthread_yield'
23121 d_pwage='$d_pwage'
23122 d_pwchange='$d_pwchange'
23123 d_pwclass='$d_pwclass'
23124 d_pwcomment='$d_pwcomment'
23125 d_pwexpire='$d_pwexpire'
23126 d_pwgecos='$d_pwgecos'
23127 d_pwpasswd='$d_pwpasswd'
23128 d_pwquota='$d_pwquota'
23129 d_qgcvt='$d_qgcvt'
23130 d_quad='$d_quad'
23131 d_random_r='$d_random_r'
23132 d_readdir64_r='$d_readdir64_r'
23133 d_readdir='$d_readdir'
23134 d_readdir_r='$d_readdir_r'
23135 d_readlink='$d_readlink'
23136 d_readv='$d_readv'
23137 d_recvmsg='$d_recvmsg'
23138 d_rename='$d_rename'
23139 d_rewinddir='$d_rewinddir'
23140 d_rmdir='$d_rmdir'
23141 d_safebcpy='$d_safebcpy'
23142 d_safemcpy='$d_safemcpy'
23143 d_sanemcmp='$d_sanemcmp'
23144 d_sbrkproto='$d_sbrkproto'
23145 d_scalbnl='$d_scalbnl'
23146 d_sched_yield='$d_sched_yield'
23147 d_scm_rights='$d_scm_rights'
23148 d_seekdir='$d_seekdir'
23149 d_select='$d_select'
23150 d_sem='$d_sem'
23151 d_semctl='$d_semctl'
23152 d_semctl_semid_ds='$d_semctl_semid_ds'
23153 d_semctl_semun='$d_semctl_semun'
23154 d_semget='$d_semget'
23155 d_semop='$d_semop'
23156 d_sendmsg='$d_sendmsg'
23157 d_setegid='$d_setegid'
23158 d_seteuid='$d_seteuid'
23159 d_setgrent='$d_setgrent'
23160 d_setgrent_r='$d_setgrent_r'
23161 d_setgrps='$d_setgrps'
23162 d_sethent='$d_sethent'
23163 d_sethostent_r='$d_sethostent_r'
23164 d_setitimer='$d_setitimer'
23165 d_setlinebuf='$d_setlinebuf'
23166 d_setlocale='$d_setlocale'
23167 d_setlocale_r='$d_setlocale_r'
23168 d_setnent='$d_setnent'
23169 d_setnetent_r='$d_setnetent_r'
23170 d_setpent='$d_setpent'
23171 d_setpgid='$d_setpgid'
23172 d_setpgrp2='$d_setpgrp2'
23173 d_setpgrp='$d_setpgrp'
23174 d_setprior='$d_setprior'
23175 d_setproctitle='$d_setproctitle'
23176 d_setprotoent_r='$d_setprotoent_r'
23177 d_setpwent='$d_setpwent'
23178 d_setpwent_r='$d_setpwent_r'
23179 d_setregid='$d_setregid'
23180 d_setresgid='$d_setresgid'
23181 d_setresuid='$d_setresuid'
23182 d_setreuid='$d_setreuid'
23183 d_setrgid='$d_setrgid'
23184 d_setruid='$d_setruid'
23185 d_setsent='$d_setsent'
23186 d_setservent_r='$d_setservent_r'
23187 d_setsid='$d_setsid'
23188 d_setvbuf='$d_setvbuf'
23189 d_shm='$d_shm'
23190 d_shmat='$d_shmat'
23191 d_shmatprototype='$d_shmatprototype'
23192 d_shmctl='$d_shmctl'
23193 d_shmdt='$d_shmdt'
23194 d_shmget='$d_shmget'
23195 d_sigaction='$d_sigaction'
23196 d_signbit='$d_signbit'
23197 d_sigprocmask='$d_sigprocmask'
23198 d_sigsetjmp='$d_sigsetjmp'
23199 d_sin6_scope_id='$d_sin6_scope_id'
23200 d_sitearch='$d_sitearch'
23201 d_snprintf='$d_snprintf'
23202 d_sockaddr_in6='$d_sockaddr_in6'
23203 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23204 d_sockatmark='$d_sockatmark'
23205 d_sockatmarkproto='$d_sockatmarkproto'
23206 d_socket='$d_socket'
23207 d_socklen_t='$d_socklen_t'
23208 d_sockpair='$d_sockpair'
23209 d_socks5_init='$d_socks5_init'
23210 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23211 d_sqrtl='$d_sqrtl'
23212 d_srand48_r='$d_srand48_r'
23213 d_srandom_r='$d_srandom_r'
23214 d_sresgproto='$d_sresgproto'
23215 d_sresuproto='$d_sresuproto'
23216 d_statblks='$d_statblks'
23217 d_statfs_f_flags='$d_statfs_f_flags'
23218 d_statfs_s='$d_statfs_s'
23219 d_static_inline='$d_static_inline'
23220 d_statvfs='$d_statvfs'
23221 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23222 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23223 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23224 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23225 d_stdio_stream_array='$d_stdio_stream_array'
23226 d_stdiobase='$d_stdiobase'
23227 d_stdstdio='$d_stdstdio'
23228 d_strchr='$d_strchr'
23229 d_strcoll='$d_strcoll'
23230 d_strctcpy='$d_strctcpy'
23231 d_strerrm='$d_strerrm'
23232 d_strerror='$d_strerror'
23233 d_strerror_r='$d_strerror_r'
23234 d_strftime='$d_strftime'
23235 d_strlcat='$d_strlcat'
23236 d_strlcpy='$d_strlcpy'
23237 d_strtod='$d_strtod'
23238 d_strtol='$d_strtol'
23239 d_strtold='$d_strtold'
23240 d_strtoll='$d_strtoll'
23241 d_strtoq='$d_strtoq'
23242 d_strtoul='$d_strtoul'
23243 d_strtoull='$d_strtoull'
23244 d_strtouq='$d_strtouq'
23245 d_strxfrm='$d_strxfrm'
23246 d_suidsafe='$d_suidsafe'
23247 d_symlink='$d_symlink'
23248 d_syscall='$d_syscall'
23249 d_syscallproto='$d_syscallproto'
23250 d_sysconf='$d_sysconf'
23251 d_sysernlst='$d_sysernlst'
23252 d_syserrlst='$d_syserrlst'
23253 d_system='$d_system'
23254 d_tcgetpgrp='$d_tcgetpgrp'
23255 d_tcsetpgrp='$d_tcsetpgrp'
23256 d_telldir='$d_telldir'
23257 d_telldirproto='$d_telldirproto'
23258 d_time='$d_time'
23259 d_timegm='$d_timegm'
23260 d_times='$d_times'
23261 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23262 d_tm_tm_zone='$d_tm_tm_zone'
23263 d_tmpnam_r='$d_tmpnam_r'
23264 d_truncate='$d_truncate'
23265 d_ttyname_r='$d_ttyname_r'
23266 d_tzname='$d_tzname'
23267 d_u32align='$d_u32align'
23268 d_ualarm='$d_ualarm'
23269 d_umask='$d_umask'
23270 d_uname='$d_uname'
23271 d_union_semun='$d_union_semun'
23272 d_unordered='$d_unordered'
23273 d_unsetenv='$d_unsetenv'
23274 d_usleep='$d_usleep'
23275 d_usleepproto='$d_usleepproto'
23276 d_ustat='$d_ustat'
23277 d_vendorarch='$d_vendorarch'
23278 d_vendorbin='$d_vendorbin'
23279 d_vendorlib='$d_vendorlib'
23280 d_vendorscript='$d_vendorscript'
23281 d_vfork='$d_vfork'
23282 d_void_closedir='$d_void_closedir'
23283 d_voidsig='$d_voidsig'
23284 d_voidtty='$d_voidtty'
23285 d_volatile='$d_volatile'
23286 d_vprintf='$d_vprintf'
23287 d_vsnprintf='$d_vsnprintf'
23288 d_wait4='$d_wait4'
23289 d_waitpid='$d_waitpid'
23290 d_wcstombs='$d_wcstombs'
23291 d_wctomb='$d_wctomb'
23292 d_writev='$d_writev'
23293 d_xenix='$d_xenix'
23294 date='$date'
23295 db_hashtype='$db_hashtype'
23296 db_prefixtype='$db_prefixtype'
23297 db_version_major='$db_version_major'
23298 db_version_minor='$db_version_minor'
23299 db_version_patch='$db_version_patch'
23300 direntrytype='$direntrytype'
23301 dlext='$dlext'
23302 dlsrc='$dlsrc'
23303 doublesize='$doublesize'
23304 drand01='$drand01'
23305 drand48_r_proto='$drand48_r_proto'
23306 dtrace='$dtrace'
23307 dynamic_ext='$dynamic_ext'
23308 eagain='$eagain'
23309 ebcdic='$ebcdic'
23310 echo='$echo'
23311 egrep='$egrep'
23312 emacs='$emacs'
23313 endgrent_r_proto='$endgrent_r_proto'
23314 endhostent_r_proto='$endhostent_r_proto'
23315 endnetent_r_proto='$endnetent_r_proto'
23316 endprotoent_r_proto='$endprotoent_r_proto'
23317 endpwent_r_proto='$endpwent_r_proto'
23318 endservent_r_proto='$endservent_r_proto'
23319 eunicefix='$eunicefix'
23320 exe_ext='$exe_ext'
23321 expr='$expr'
23322 extensions='$extensions'
23323 extern_C='$extern_C'
23324 extras='$extras'
23325 fflushNULL='$fflushNULL'
23326 fflushall='$fflushall'
23327 find='$find'
23328 firstmakefile='$firstmakefile'
23329 flex='$flex'
23330 fpossize='$fpossize'
23331 fpostype='$fpostype'
23332 freetype='$freetype'
23333 from='$from'
23334 full_ar='$full_ar'
23335 full_csh='$full_csh'
23336 full_sed='$full_sed'
23337 gccansipedantic='$gccansipedantic'
23338 gccosandvers='$gccosandvers'
23339 gccversion='$gccversion'
23340 getgrent_r_proto='$getgrent_r_proto'
23341 getgrgid_r_proto='$getgrgid_r_proto'
23342 getgrnam_r_proto='$getgrnam_r_proto'
23343 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23344 gethostbyname_r_proto='$gethostbyname_r_proto'
23345 gethostent_r_proto='$gethostent_r_proto'
23346 getlogin_r_proto='$getlogin_r_proto'
23347 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23348 getnetbyname_r_proto='$getnetbyname_r_proto'
23349 getnetent_r_proto='$getnetent_r_proto'
23350 getprotobyname_r_proto='$getprotobyname_r_proto'
23351 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23352 getprotoent_r_proto='$getprotoent_r_proto'
23353 getpwent_r_proto='$getpwent_r_proto'
23354 getpwnam_r_proto='$getpwnam_r_proto'
23355 getpwuid_r_proto='$getpwuid_r_proto'
23356 getservbyname_r_proto='$getservbyname_r_proto'
23357 getservbyport_r_proto='$getservbyport_r_proto'
23358 getservent_r_proto='$getservent_r_proto'
23359 getspnam_r_proto='$getspnam_r_proto'
23360 gidformat='$gidformat'
23361 gidsign='$gidsign'
23362 gidsize='$gidsize'
23363 gidtype='$gidtype'
23364 glibpth='$glibpth'
23365 gmake='$gmake'
23366 gmtime_r_proto='$gmtime_r_proto'
23367 gnulibc_version='$gnulibc_version'
23368 grep='$grep'
23369 groupcat='$groupcat'
23370 groupstype='$groupstype'
23371 gzip='$gzip'
23372 h_fcntl='$h_fcntl'
23373 h_sysfile='$h_sysfile'
23374 hint='$hint'
23375 hostcat='$hostcat'
23376 html1dir='$html1dir'
23377 html1direxp='$html1direxp'
23378 html3dir='$html3dir'
23379 html3direxp='$html3direxp'
23380 i16size='$i16size'
23381 i16type='$i16type'
23382 i32size='$i32size'
23383 i32type='$i32type'
23384 i64size='$i64size'
23385 i64type='$i64type'
23386 i8size='$i8size'
23387 i8type='$i8type'
23388 i_arpainet='$i_arpainet'
23389 i_assert='$i_assert'
23390 i_bsdioctl='$i_bsdioctl'
23391 i_crypt='$i_crypt'
23392 i_db='$i_db'
23393 i_dbm='$i_dbm'
23394 i_dirent='$i_dirent'
23395 i_dlfcn='$i_dlfcn'
23396 i_fcntl='$i_fcntl'
23397 i_float='$i_float'
23398 i_fp='$i_fp'
23399 i_fp_class='$i_fp_class'
23400 i_gdbm='$i_gdbm'
23401 i_gdbm_ndbm='$i_gdbm_ndbm'
23402 i_gdbmndbm='$i_gdbmndbm'
23403 i_grp='$i_grp'
23404 i_ieeefp='$i_ieeefp'
23405 i_inttypes='$i_inttypes'
23406 i_langinfo='$i_langinfo'
23407 i_libutil='$i_libutil'
23408 i_limits='$i_limits'
23409 i_locale='$i_locale'
23410 i_machcthr='$i_machcthr'
23411 i_malloc='$i_malloc'
23412 i_mallocmalloc='$i_mallocmalloc'
23413 i_math='$i_math'
23414 i_memory='$i_memory'
23415 i_mntent='$i_mntent'
23416 i_ndbm='$i_ndbm'
23417 i_netdb='$i_netdb'
23418 i_neterrno='$i_neterrno'
23419 i_netinettcp='$i_netinettcp'
23420 i_niin='$i_niin'
23421 i_poll='$i_poll'
23422 i_prot='$i_prot'
23423 i_pthread='$i_pthread'
23424 i_pwd='$i_pwd'
23425 i_rpcsvcdbm='$i_rpcsvcdbm'
23426 i_sgtty='$i_sgtty'
23427 i_shadow='$i_shadow'
23428 i_socks='$i_socks'
23429 i_stdarg='$i_stdarg'
23430 i_stdbool='$i_stdbool'
23431 i_stddef='$i_stddef'
23432 i_stdlib='$i_stdlib'
23433 i_string='$i_string'
23434 i_sunmath='$i_sunmath'
23435 i_sysaccess='$i_sysaccess'
23436 i_sysdir='$i_sysdir'
23437 i_sysfile='$i_sysfile'
23438 i_sysfilio='$i_sysfilio'
23439 i_sysin='$i_sysin'
23440 i_sysioctl='$i_sysioctl'
23441 i_syslog='$i_syslog'
23442 i_sysmman='$i_sysmman'
23443 i_sysmode='$i_sysmode'
23444 i_sysmount='$i_sysmount'
23445 i_sysndir='$i_sysndir'
23446 i_sysparam='$i_sysparam'
23447 i_syspoll='$i_syspoll'
23448 i_sysresrc='$i_sysresrc'
23449 i_syssecrt='$i_syssecrt'
23450 i_sysselct='$i_sysselct'
23451 i_syssockio='$i_syssockio'
23452 i_sysstat='$i_sysstat'
23453 i_sysstatfs='$i_sysstatfs'
23454 i_sysstatvfs='$i_sysstatvfs'
23455 i_systime='$i_systime'
23456 i_systimek='$i_systimek'
23457 i_systimes='$i_systimes'
23458 i_systypes='$i_systypes'
23459 i_sysuio='$i_sysuio'
23460 i_sysun='$i_sysun'
23461 i_sysutsname='$i_sysutsname'
23462 i_sysvfs='$i_sysvfs'
23463 i_syswait='$i_syswait'
23464 i_termio='$i_termio'
23465 i_termios='$i_termios'
23466 i_time='$i_time'
23467 i_unistd='$i_unistd'
23468 i_ustat='$i_ustat'
23469 i_utime='$i_utime'
23470 i_values='$i_values'
23471 i_varargs='$i_varargs'
23472 i_varhdr='$i_varhdr'
23473 i_vfork='$i_vfork'
23474 ignore_versioned_solibs='$ignore_versioned_solibs'
23475 inc_version_list='$inc_version_list'
23476 inc_version_list_init='$inc_version_list_init'
23477 incpath='$incpath'
23478 inews='$inews'
23479 initialinstalllocation='$initialinstalllocation'
23480 installarchlib='$installarchlib'
23481 installbin='$installbin'
23482 installhtml1dir='$installhtml1dir'
23483 installhtml3dir='$installhtml3dir'
23484 installman1dir='$installman1dir'
23485 installman3dir='$installman3dir'
23486 installprefix='$installprefix'
23487 installprefixexp='$installprefixexp'
23488 installprivlib='$installprivlib'
23489 installscript='$installscript'
23490 installsitearch='$installsitearch'
23491 installsitebin='$installsitebin'
23492 installsitehtml1dir='$installsitehtml1dir'
23493 installsitehtml3dir='$installsitehtml3dir'
23494 installsitelib='$installsitelib'
23495 installsiteman1dir='$installsiteman1dir'
23496 installsiteman3dir='$installsiteman3dir'
23497 installsitescript='$installsitescript'
23498 installstyle='$installstyle'
23499 installusrbinperl='$installusrbinperl'
23500 installvendorarch='$installvendorarch'
23501 installvendorbin='$installvendorbin'
23502 installvendorhtml1dir='$installvendorhtml1dir'
23503 installvendorhtml3dir='$installvendorhtml3dir'
23504 installvendorlib='$installvendorlib'
23505 installvendorman1dir='$installvendorman1dir'
23506 installvendorman3dir='$installvendorman3dir'
23507 installvendorscript='$installvendorscript'
23508 intsize='$intsize'
23509 issymlink='$issymlink'
23510 ivdformat='$ivdformat'
23511 ivsize='$ivsize'
23512 ivtype='$ivtype'
23513 known_extensions='$known_extensions'
23514 ksh='$ksh'
23515 ld='$ld'
23516 ld_can_script='$ld_can_script'
23517 lddlflags='$lddlflags'
23518 ldflags='$ldflags'
23519 ldflags_uselargefiles='$ldflags_uselargefiles'
23520 ldlibpthname='$ldlibpthname'
23521 less='$less'
23522 lib_ext='$lib_ext'
23523 libc='$libc'
23524 libperl='$libperl'
23525 libpth='$libpth'
23526 libs='$libs'
23527 libsdirs='$libsdirs'
23528 libsfiles='$libsfiles'
23529 libsfound='$libsfound'
23530 libspath='$libspath'
23531 libswanted='$libswanted'
23532 libswanted_uselargefiles='$libswanted_uselargefiles'
23533 line='$line'
23534 lint='$lint'
23535 lkflags='$lkflags'
23536 ln='$ln'
23537 lns='$lns'
23538 localtime_r_proto='$localtime_r_proto'
23539 locincpth='$locincpth'
23540 loclibpth='$loclibpth'
23541 longdblsize='$longdblsize'
23542 longlongsize='$longlongsize'
23543 longsize='$longsize'
23544 lp='$lp'
23545 lpr='$lpr'
23546 ls='$ls'
23547 lseeksize='$lseeksize'
23548 lseektype='$lseektype'
23549 mad='$mad'
23550 madlyh='$madlyh'
23551 madlyobj='$madlyobj'
23552 madlysrc='$madlysrc'
23553 mail='$mail'
23554 mailx='$mailx'
23555 make='$make'
23556 make_set_make='$make_set_make'
23557 mallocobj='$mallocobj'
23558 mallocsrc='$mallocsrc'
23559 malloctype='$malloctype'
23560 man1dir='$man1dir'
23561 man1direxp='$man1direxp'
23562 man1ext='$man1ext'
23563 man3dir='$man3dir'
23564 man3direxp='$man3direxp'
23565 man3ext='$man3ext'
23566 mips_type='$mips_type'
23567 mistrustnm='$mistrustnm'
23568 mkdir='$mkdir'
23569 mmaptype='$mmaptype'
23570 modetype='$modetype'
23571 more='$more'
23572 multiarch='$multiarch'
23573 mv='$mv'
23574 myarchname='$myarchname'
23575 mydomain='$mydomain'
23576 myhostname='$myhostname'
23577 myuname='$myuname'
23578 n='$n'
23579 need_va_copy='$need_va_copy'
23580 netdb_hlen_type='$netdb_hlen_type'
23581 netdb_host_type='$netdb_host_type'
23582 netdb_name_type='$netdb_name_type'
23583 netdb_net_type='$netdb_net_type'
23584 nm='$nm'
23585 nm_opt='$nm_opt'
23586 nm_so_opt='$nm_so_opt'
23587 nonxs_ext='$nonxs_ext'
23588 nroff='$nroff'
23589 nvEUformat='$nvEUformat'
23590 nvFUformat='$nvFUformat'
23591 nvGUformat='$nvGUformat'
23592 nv_overflows_integers_at='$nv_overflows_integers_at'
23593 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23594 nveformat='$nveformat'
23595 nvfformat='$nvfformat'
23596 nvgformat='$nvgformat'
23597 nvsize='$nvsize'
23598 nvtype='$nvtype'
23599 o_nonblock='$o_nonblock'
23600 obj_ext='$obj_ext'
23601 old_pthread_create_joinable='$old_pthread_create_joinable'
23602 optimize='$optimize'
23603 orderlib='$orderlib'
23604 osname='$osname'
23605 osvers='$osvers'
23606 otherlibdirs='$otherlibdirs'
23607 package='$package'
23608 pager='$pager'
23609 passcat='$passcat'
23610 patchlevel='$patchlevel'
23611 path_sep='$path_sep'
23612 perl5='$perl5'
23613 perl='$perl'
23614 perl_patchlevel='$perl_patchlevel'
23615 perl_static_inline='$perl_static_inline'
23616 perladmin='$perladmin'
23617 perllibs='$perllibs'
23618 perlpath='$perlpath'
23619 pg='$pg'
23620 phostname='$phostname'
23621 pidtype='$pidtype'
23622 plibpth='$plibpth'
23623 pmake='$pmake'
23624 pr='$pr'
23625 prefix='$prefix'
23626 prefixexp='$prefixexp'
23627 privlib='$privlib'
23628 privlibexp='$privlibexp'
23629 procselfexe='$procselfexe'
23630 prototype='$prototype'
23631 ptrsize='$ptrsize'
23632 quadkind='$quadkind'
23633 quadtype='$quadtype'
23634 randbits='$randbits'
23635 randfunc='$randfunc'
23636 random_r_proto='$random_r_proto'
23637 randseedtype='$randseedtype'
23638 ranlib='$ranlib'
23639 rd_nodata='$rd_nodata'
23640 readdir64_r_proto='$readdir64_r_proto'
23641 readdir_r_proto='$readdir_r_proto'
23642 revision='$revision'
23643 rm='$rm'
23644 rm_try='$rm_try'
23645 rmail='$rmail'
23646 run='$run'
23647 runnm='$runnm'
23648 sGMTIME_max='$sGMTIME_max'
23649 sGMTIME_min='$sGMTIME_min'
23650 sLOCALTIME_max='$sLOCALTIME_max'
23651 sLOCALTIME_min='$sLOCALTIME_min'
23652 sPRIEUldbl='$sPRIEUldbl'
23653 sPRIFUldbl='$sPRIFUldbl'
23654 sPRIGUldbl='$sPRIGUldbl'
23655 sPRIXU64='$sPRIXU64'
23656 sPRId64='$sPRId64'
23657 sPRIeldbl='$sPRIeldbl'
23658 sPRIfldbl='$sPRIfldbl'
23659 sPRIgldbl='$sPRIgldbl'
23660 sPRIi64='$sPRIi64'
23661 sPRIo64='$sPRIo64'
23662 sPRIu64='$sPRIu64'
23663 sPRIx64='$sPRIx64'
23664 sSCNfldbl='$sSCNfldbl'
23665 sched_yield='$sched_yield'
23666 scriptdir='$scriptdir'
23667 scriptdirexp='$scriptdirexp'
23668 sed='$sed'
23669 seedfunc='$seedfunc'
23670 selectminbits='$selectminbits'
23671 selecttype='$selecttype'
23672 sendmail='$sendmail'
23673 setgrent_r_proto='$setgrent_r_proto'
23674 sethostent_r_proto='$sethostent_r_proto'
23675 setlocale_r_proto='$setlocale_r_proto'
23676 setnetent_r_proto='$setnetent_r_proto'
23677 setprotoent_r_proto='$setprotoent_r_proto'
23678 setpwent_r_proto='$setpwent_r_proto'
23679 setservent_r_proto='$setservent_r_proto'
23680 sh='$sh'
23681 shar='$shar'
23682 sharpbang='$sharpbang'
23683 shmattype='$shmattype'
23684 shortsize='$shortsize'
23685 shrpenv='$shrpenv'
23686 shsharp='$shsharp'
23687 sig_count='$sig_count'
23688 sig_name='$sig_name'
23689 sig_name_init='$sig_name_init'
23690 sig_num='$sig_num'
23691 sig_num_init='$sig_num_init'
23692 sig_size='$sig_size'
23693 signal_t='$signal_t'
23694 sitearch='$sitearch'
23695 sitearchexp='$sitearchexp'
23696 sitebin='$sitebin'
23697 sitebinexp='$sitebinexp'
23698 sitehtml1dir='$sitehtml1dir'
23699 sitehtml1direxp='$sitehtml1direxp'
23700 sitehtml3dir='$sitehtml3dir'
23701 sitehtml3direxp='$sitehtml3direxp'
23702 sitelib='$sitelib'
23703 sitelib_stem='$sitelib_stem'
23704 sitelibexp='$sitelibexp'
23705 siteman1dir='$siteman1dir'
23706 siteman1direxp='$siteman1direxp'
23707 siteman3dir='$siteman3dir'
23708 siteman3direxp='$siteman3direxp'
23709 siteprefix='$siteprefix'
23710 siteprefixexp='$siteprefixexp'
23711 sitescript='$sitescript'
23712 sitescriptexp='$sitescriptexp'
23713 sizesize='$sizesize'
23714 sizetype='$sizetype'
23715 sleep='$sleep'
23716 smail='$smail'
23717 so='$so'
23718 sockethdr='$sockethdr'
23719 socketlib='$socketlib'
23720 socksizetype='$socksizetype'
23721 sort='$sort'
23722 spackage='$spackage'
23723 spitshell='$spitshell'
23724 srand48_r_proto='$srand48_r_proto'
23725 srandom_r_proto='$srandom_r_proto'
23726 src='$src'
23727 ssizetype='$ssizetype'
23728 st_ino_sign='$st_ino_sign'
23729 st_ino_size='$st_ino_size'
23730 startperl='$startperl'
23731 startsh='$startsh'
23732 static_ext='$static_ext'
23733 stdchar='$stdchar'
23734 stdio_base='$stdio_base'
23735 stdio_bufsiz='$stdio_bufsiz'
23736 stdio_cnt='$stdio_cnt'
23737 stdio_filbuf='$stdio_filbuf'
23738 stdio_ptr='$stdio_ptr'
23739 stdio_stream_array='$stdio_stream_array'
23740 strerror_r_proto='$strerror_r_proto'
23741 strings='$strings'
23742 submit='$submit'
23743 subversion='$subversion'
23744 sysman='$sysman'
23745 sysroot='$sysroot'
23746 tail='$tail'
23747 tar='$tar'
23748 targetarch='$targetarch'
23749 targetdir='$targetdir'
23750 targethost='$targethost'
23751 targetport='$targetport'
23752 tbl='$tbl'
23753 tee='$tee'
23754 test='$test'
23755 timeincl='$timeincl'
23756 timetype='$timetype'
23757 tmpnam_r_proto='$tmpnam_r_proto'
23758 to='$to'
23759 touch='$touch'
23760 tr='$tr'
23761 trnl='$trnl'
23762 troff='$troff'
23763 ttyname_r_proto='$ttyname_r_proto'
23764 u16size='$u16size'
23765 u16type='$u16type'
23766 u32size='$u32size'
23767 u32type='$u32type'
23768 u64size='$u64size'
23769 u64type='$u64type'
23770 u8size='$u8size'
23771 u8type='$u8type'
23772 uidformat='$uidformat'
23773 uidsign='$uidsign'
23774 uidsize='$uidsize'
23775 uidtype='$uidtype'
23776 uname='$uname'
23777 uniq='$uniq'
23778 uquadtype='$uquadtype'
23779 use5005threads='$use5005threads'
23780 use64bitall='$use64bitall'
23781 use64bitint='$use64bitint'
23782 usecrosscompile='$usecrosscompile'
23783 usedevel='$usedevel'
23784 usedl='$usedl'
23785 usedtrace='$usedtrace'
23786 usefaststdio='$usefaststdio'
23787 useithreads='$useithreads'
23788 usekernprocpathname='$usekernprocpathname'
23789 uselargefiles='$uselargefiles'
23790 uselongdouble='$uselongdouble'
23791 usemallocwrap='$usemallocwrap'
23792 usemorebits='$usemorebits'
23793 usemultiplicity='$usemultiplicity'
23794 usemymalloc='$usemymalloc'
23795 usenm='$usenm'
23796 usensgetexecutablepath='$usensgetexecutablepath'
23797 useopcode='$useopcode'
23798 useperlio='$useperlio'
23799 useposix='$useposix'
23800 usereentrant='$usereentrant'
23801 userelocatableinc='$userelocatableinc'
23802 useshrplib='$useshrplib'
23803 usesitecustomize='$usesitecustomize'
23804 usesocks='$usesocks'
23805 usethreads='$usethreads'
23806 usevendorprefix='$usevendorprefix'
23807 useversionedarchname='$useversionedarchname'
23808 usevfork='$usevfork'
23809 usrinc='$usrinc'
23810 uuname='$uuname'
23811 uvXUformat='$uvXUformat'
23812 uvoformat='$uvoformat'
23813 uvsize='$uvsize'
23814 uvtype='$uvtype'
23815 uvuformat='$uvuformat'
23816 uvxformat='$uvxformat'
23817 vaproto='$vaproto'
23818 vendorarch='$vendorarch'
23819 vendorarchexp='$vendorarchexp'
23820 vendorbin='$vendorbin'
23821 vendorbinexp='$vendorbinexp'
23822 vendorhtml1dir='$vendorhtml1dir'
23823 vendorhtml1direxp='$vendorhtml1direxp'
23824 vendorhtml3dir='$vendorhtml3dir'
23825 vendorhtml3direxp='$vendorhtml3direxp'
23826 vendorlib='$vendorlib'
23827 vendorlib_stem='$vendorlib_stem'
23828 vendorlibexp='$vendorlibexp'
23829 vendorman1dir='$vendorman1dir'
23830 vendorman1direxp='$vendorman1direxp'
23831 vendorman3dir='$vendorman3dir'
23832 vendorman3direxp='$vendorman3direxp'
23833 vendorprefix='$vendorprefix'
23834 vendorprefixexp='$vendorprefixexp'
23835 vendorscript='$vendorscript'
23836 vendorscriptexp='$vendorscriptexp'
23837 version='$version'
23838 version_patchlevel_string='$version_patchlevel_string'
23839 versiononly='$versiononly'
23840 vi='$vi'
23841 xlibpth='$xlibpth'
23842 yacc='$yacc'
23843 yaccflags='$yaccflags'
23844 zcat='$zcat'
23845 zip='$zip'
23846 EOT
23847
23848 : add special variables
23849 $test -f $src/patchlevel.h && \
23850 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23851 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23852 echo "PERL_CONFIG_SH=true" >>config.sh
23853
23854 : propagate old symbols
23855 if $test -f UU/config.sh; then
23856         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23857         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23858                 config.sh config.sh UU/oldconfig.sh |\
23859                 $sort | $uniq -u >UU/oldsyms
23860         set X `$cat UU/oldsyms`
23861         shift
23862         case $# in
23863         0) ;;
23864         *)
23865                 $cat <<EOM
23866 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23867 EOM
23868                 echo ": Variables propagated from previous config.sh file." >>config.sh
23869                 for sym in `$cat UU/oldsyms`; do
23870                         echo "    Propagating $hint variable "'$'"$sym..."
23871                         eval 'tmp="$'"${sym}"'"'
23872                         echo "$tmp" | \
23873                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23874                 done
23875                 ;;
23876         esac
23877 fi
23878
23879 : Finish up by extracting the .SH files
23880 case "$alldone" in
23881 exit)
23882         $rm -rf UU
23883         echo "Extraction done."
23884         exit 0
23885         ;;
23886 cont)
23887         ;;
23888 '')
23889         dflt=''
23890         nostick=true
23891         $cat <<EOM
23892
23893 If you'd like to make any changes to the config.sh file before I begin
23894 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23895
23896 EOM
23897         rp="Press return or use a shell escape to edit config.sh:"
23898         . UU/myread
23899         nostick=''
23900         case "$ans" in
23901         '') ;;
23902         *) : in case they cannot read
23903                 sh 1>&4 -c "$ans";;
23904         esac
23905         ;;
23906 esac
23907
23908 : if this fails, just run all the .SH files by hand
23909 . ./config.sh
23910
23911 echo " "
23912 exec 1>&4
23913 pwd=`pwd`
23914 . ./UU/extract
23915 cd "$pwd"
23916
23917 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23918         dflt=y
23919         case "$silent" in
23920         true) ;;
23921         *)
23922                 $cat <<EOM
23923
23924 Now you need to generate make dependencies by running "$make depend".
23925 You might prefer to run it in background: "$make depend > makedepend.out &"
23926 It can take a while, so you might not want to run it right now.
23927
23928 EOM
23929                 ;;
23930         esac
23931         rp="Run $make depend now?"
23932         . UU/myread
23933         case "$ans" in
23934         y*)
23935                 $make depend && echo "Now you must run '$make'."
23936                 ;;
23937         *)
23938                 echo "You must run '$make depend' then '$make'."
23939                 ;;
23940         esac
23941 elif test -f [Mm]akefile; then
23942         echo " "
23943         echo "Now you must run a $make."
23944 else
23945         echo "Configure done."
23946 fi
23947
23948 if $test -f Policy.sh; then
23949     $cat <<EOM
23950
23951 If you compile $package on a different machine or from a different object
23952 directory, copy the Policy.sh file from this object directory to the
23953 new one before you run Configure -- this will help you with most of
23954 the policy defaults.
23955
23956 EOM
23957 fi
23958 if $test -f config.msg; then
23959     echo "Hmm.  I also noted the following information while running:"
23960     echo " "
23961     $cat config.msg >&4
23962     $rm -f config.msg
23963 fi
23964 $rm -f kit*isdone ark*isdone
23965 $rm -rf UU
23966
23967 : End of Configure
23968